<?php
//
// phpSysInfo - A PHP System Information Script
// http://phpsysinfo.sourceforge.net/
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
//
// $Id: table_sensors.php,v 1.0 2000/12/10 21:42:11 TheGoop Exp $

require('includes/system_sensors.php');

$scale_factor = 2;

$sensors = sys_parsesensors();

//Voltajes
$_text = '<table width="100%" align="center">';

$_text .= 	'<tr><td align="left"><font size="-1"><b>' . $text['vtype'] . 
		'</b></font></td><td align="left"><font size="-1"><b>' . $text['current'] .
		'</b></font></td><td align="left"><font size="-1"><b>' . $text['min'] . 
		'</b></font></td><td align="left"><font size="-1"><b>' . $text['max'] . 
		'</b></font></td><td align="right"><font size="-1"><b>' . $text['status'] . 
		'</b></font></td></tr>';

       for ( $i = 0; $i < $sensors[voltcount]; $i++ ) {
               if ($sensors['volt'.$i]['min'] == " V" && $sensors['volt'.$i]['max'] == " V") {
                  $_text .= '<tr>';
                  $_text .= '<td align="left"><font size="-1">' . $sensors['volt'.$i]['label'] . '&nbsp;</td>';
                  $_text .= '<td align="left"><font size="-1">' . $sensors['volt'.$i]['current'] . '&nbsp;</td>';
                  $_text .= '<td align="left">&nbsp;</td>';
                  $_text .= '<td align="left">&nbsp;</td>';
                  $_text .= '<td align="left">&nbsp;</td>';
                  $_text .= '</tr>';
               }
               else {
                 $_text .= '<tr>';
                 $_text .= '<td align="left"><font size="-1">' . $sensors['volt'.$i]['label'] . '&nbsp;</font></td>';
                 $_text .= '<td align="left"><font size="-1">' . $sensors['volt'.$i]['current'] . '&nbsp;</font></td>';
                 $_text .= '<td align="left"><font size="-1">' . $sensors['volt'.$i]['min'] . '&nbsp;</font></td>';
                 $_text .= '<td align="left"><font size="-1">' . $sensors['volt'.$i]['max'] . '&nbsp;</font></td>';
                 $_text .= '<td align="right"><font size="-1">' . $sensors['volt'.$i]['status'] . '&nbsp;</font></td>';
                 $_text .= '</tr>';
               }
       }
$_text .= '</table>';

$tpl->set_var('vsensors', makebox($text['vsensors'], $_text, '100%'));

// Ventiladores
$_text = '<table width="100%" align="center">';
$_text .= '<tr><td align="left"><font size="-1"><b>'.$text['ftype'].'</b></font></td>'.
              '<td align="left"><font size="-1"><b>'.$text['current'].'</b></font></b></td>'.
              '<td align="left"><font size="-1"><b>'.$text['min'].'</b></font></td>'.
              '<td align="left"><font size="-1"><b>'.$text['div'].'</b></font></td>'.
              '<td align="right"><font size="-1"><b>'.$text['status'].'</font></b></td></tr>';
        for ( $i = 1; $i < $sensors['fancount'] + 1; $i++ ) {
                $_text .= '<tr>';
                $_text .= '<td align="left"><font size="-1">' . $sensors['fan'.$i]['label'] .'&nbsp;</font></td>';
                $_text .= '<td align="left"><font size="-1">' . $sensors['fan'.$i]['current'] .'&nbsp;</font></td>';
                $_text .= '<td align="left"><font size="-1">' . $sensors['fan'.$i]['min'] .'&nbsp;</font></td>';
                $_text .= '<td align="left"><font size="-1">' . $sensors['fan'.$i]['div'] .'&nbsp;</font></td>';
                $_text .= '<td align="right"><font size="-1">'. $sensors['fan'.$i]['status'] .'&nbsp;</font></td>';
                $_text .= '</tr>';
        }
$_text .= '</table>';

$tpl->set_var('fsensors', makebox($text['fsensors'], $_text, '100%'));

// Temperaturas
$_text = '<table width="100%" align="center">';
$_text .= '<tr><td align="left"><font size="-1"><b>'.$text['ttype'].'</b></td>'.                
		'<td align="left"><font size="-1"><b>'.$text['current'].'</b></font></td>'.
                '<td align="left"><font size="-1"><b>'.$text['hysteresis'].'</b></font></td>'.
                '<td align="left"><font size="-1"><b>'.$text['limit'].'</b></font></td>'.
                '<td align="right"><font size="-1"><b>'.$text['status'].'</b></font></td></tr>';

	for ( $i = 1; $i < $sensors['tempcount'] + 1; $i++ ) {
                $_text .= '<tr>';
                $_text .= '<td valign="top" align="left"><font size="-1">' . $sensors['temp'.$i]['label'] . '&nbsp;</font></td>';
                $_text .= '<td valign="top" align="left"><font size="-1">' . $sensors['temp'.$i]['current'] . '&nbsp;</font></td>';
                $_text .= '<td valign="top" align="left"><font size="-1">' . $sensors['temp'.$i]['min'] . '&nbsp;</font></td>';
                $_text .= '<td valign="top" align="left"><font size="-1">' . $sensors['temp'.$i]['max'] . '&nbsp;</font></td>';
                $_text .= '<td valign="top" align="right"><font size="-1">'. $sensors['temp'.$i]['status'] . '&nbsp;</font></td>';
                $_text .= '</tr>';
        }

$_text .= '</table>';

$tpl->set_var('tsensors', makebox($text['tsensors'], $_text, '100%'));


// Otros
$_text = '<table width="100%" align="center">';
$_text .= '<tr><td><p>Prueba</p></td></tr><tr><td><p>ewrkfhsjghkshgk</p></td></tr>';

$_text .= '</table>';

$tpl->set_var('osensors', makebox($text['osensors'], $_text, '100%'));

?>
<!--
/*
<.!-- Start Fans table --.>
<.!-- Start Temperature table --.>
       
<?php

        
?>
        <tr>
                <td colspan="5" align="left">&nbsp;</td>
        </tr>
        </table>
        </td>
</tr>
</table>

<SPACER type="block" height="10">

<.!-- Start Other Info table --.>

<table width="100%" bgcolor="<?php echo $detail_border_color; ?>" border="0" cellpadding="1" cellspacing="0">
<tr>
        <td>
        <table width="100%" bgcolor="<?php echo $detail_body_color; ?>" border="0" cellpadding="2" cellspacing="0">
        <tr bgcolor="<?php echo $detail_header_color; ?>">
                <td colspan="2" align="left">
                        <?php echo $f_head_open; ?>&nbsp;&nbsp;<?php echo $text['osensors'] ?>&nbsp;&nbsp;<?php echo $f_head_close; ?>
                </td>
        </tr>
        <tr>
                <td colspan="2" align="left">&nbsp;</td>
        </tr>
        <tr>
                <td align="left"><?php echo $f_body_open; echo '<b>'.$text['field'].'</b>'; echo $f_body_close; ?></td>
                <td align="left"><?php echo $f_body_open; echo '<b>'.$text['current'].'</b>'; echo $f_body_close; ?></td>
        </tr>
<?php

        for ( $i = 0; $i < $sensors['othercount']; $i++ ) {

                echo "\t<tr>\n";
                echo "\t\t<td align=\"left\">$f_body_open" . $sensors['others'.$i]['label'] . "&nbsp;$f_body_close</td>\n";
                echo "\t\t<td align=\"left\">$f_body_open" . $sensors['others'.$i]['current'] . "&nbsp;$f_body_close</td>\n";
                echo "\t</tr>\n";
       }

?>

        <tr>
                <td colspan="2" align="left">&nbsp;</td>
        </tr>
        </table>
        </td>
</tr>
</table>

</td>
</tr>

</table>
*/ 
-->