<?php
/**
 * @version		$Id: contacto.php 20196 2011-03-19 02:40:25Z pol $
 * @package		Joomla.Site
 * @subpackage	Contact
 * @copyright	Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

class HTML_contacto {

	function show() {

            //Load switcher behavior
    		JHTML::_('behavior.tooltip');
    		JHTML::_('behavior.switcher');

            // Build the component's submenu
    		$contents = '';
    		$tmplpath = dirname(__FILE__) . DS . 'tmpl';
    		ob_start();
?>
            <div id="submenu-box">
            	<div class="t">
            		<div class="t">
            			<div class="t"></div>
            		</div>
            	</div>
          	<div class="m">

                <div class="submenu-box">
    			<div class="submenu-pad">
        				<ul id="submenu">
        					<li>
        						<a id="general" class="active">General</a>
        					</li>
        					<li>
        						<a id="listemails">Lista de Emails enviados</a>
        					</li>
        					<li>
        						<a id="about">About</a>
        					</li>
        				</ul>
        				<div class="clr"></div>
        			</div>
        		</div>
        		<div class="clr"></div>
            </div>
            	<div class="b">
            		<div class="b">
            			<div class="b"></div>
            		</div>
            	</div>
            </div>
<?php
    		$contents = ob_get_contents();
    		ob_end_clean();

    		// Set document data
    	   	$document =& JFactory::getDocument();
    		$document->setBuffer($contents, 'modules', 'submenu');
?>


		<script language="javascript" type="text/javascript">
		function submitbutton(pressbutton) {
			var form = document.getElementById('adminForm');
			if (pressbutton == 'cancel') {
				submitform( pressbutton );
				return;
			}
			submitform( pressbutton );
		}
		</script>

		<form action="index.php?option=com_contacto" method="post" name="adminForm" id="adminForm">
     		<div id="config-document">
    			<div id="page-general" class="tab">
    				<table class="noshow">
    				<tr>
    					<td>
                        <?php
                        $db =& JFactory::getDBO();
                        $db->setQuery( 'SELECT * FROM #__contacto_form WHERE id=1');
                        $messages = $db->loadObjectList();
                        if ($messages)
                        {
                            foreach($messages as $message)
                            {
                                $mail= $message->diremail;
                                $mensaje=$message->mensaje;
                            }
                        }
                        ?>

                        <label for="diremail">Ingrese el email de destino:</label><br/>
                        <input type="text" name="diremail" size="50" value="<?php echo $mail ?>"/>
                        <br/><br/>
                        <label for="mensaje">Ingrese mensaje de finalizacion:</label><br/>
                        <input type="text" name="mensaje" size="150" value="<?php echo $mensaje ?>" /><br/>


    					</td>
    				</tr>
    				</table>
    			</div>
    			<div id="page-listemails" class="tab">
    				<table class="noshow">
    				<tr>
    					<td>
                           <h1>Lista de emails enviados</h1>
                        <style>
                        .tablacomm {
                              	margin:10px;
                              	border: 1px solid #666666;
                              	background-color: #FAFAFA;
                              	/*border: 1px solid red;*/
                              	text-align: center;
                        }
                        </style>
                        <?php
                        $db =& JFactory::getDBO();
                        $db->setQuery( 'SELECT * FROM #__contacto_historia');
                        $messages = $db->loadObjectList();
                        if ($messages)
                        {
                            echo "<table width=\"960px\" border=\"0\">";
                            echo "<tr>
                            <th>Email</th>
                            <th>Name</th>
                            <th>Company</th>
                            <th>Message</th>
                            <th>Delete</th>
                            </tr>";
                            foreach($messages as $message)
                            {
                                echo "<tr>";
                                echo "<td width=\"15%\" valign=\"top\" class=\"tablacomm\" >".$message->diremail."</td>";
                                echo "<td width=\"15%\" valign=\"top\" class=\"tablacomm\" >".$message->nombre."</td>";
                                echo "<td width=\"15%\" valign=\"top\" class=\"tablacomm\" >".$message->empresa."</td>";
                                echo "<td width=\"50%\" valign=\"top\" class=\"tablacomm\" ><p align=\"left\">".$message->mensaje."</p></td>";
                                echo "<td width=\"5%\" valign=\"top\" class=\"tablacomm\" >".
                                "<a href=\"index.php?option=com_contacto&task=bajacoment&id={$message->id}\">delete</a>".
                                "</td>";
                                echo "</tr>";
                            }
                            echo "</table>";
                        }
                        ?>
    					</td>
    				</tr>
    				</table>
    			</div>
    			<div id="page-about" class="tab">
    				<table class="noshow" width="100%">
    				<tr>
    					<td>
                           <div align="center" style="margin:0px auto;">
                           <h1>PBLF(c)</h1>
                           <p> Argentina-Buenos Aires-Necochea</p>
                           <p><a href="http://www.pblf.com.ar">www.pblf.com.ar</a></p>
    					   <p><a href="mailto:pblf@hotmail.com">pblf@hotmail.com</a></p>
                           <p>Te agradecemos una donacion minima, para nosotros es importante, contacte con nosotros GRACIAS</p>
                           </div>
    					</td>
    				</tr>
    				</table>
    			</div>
     		</div>
     		<div class="clr"></div>
    		<input type="hidden" name="task" value="" />
		</form>

<?php
	                }

}
?>