<?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 align="left"><font size="-1"><b>'.$text['field'].'</b></font></td>' .
               '<td align="left"><font size="-1"><b>'.$text['current'].'</b></font></td></tr>';
        for ( $i = 0; $i < $sensors['othercount']; $i++ ) {
                $_text .= '<tr><td align="left"><font size="-1">' . $sensors['others'.$i]['label'] . '&nbsp;</font></td>';
                $_text .= '<td align="left"><font size="-1">' . $sensors['others'.$i]['current'] . '&nbsp;</font></td></tr>';
        }

$_text .= '</table>';

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

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


?>

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

</td>
</tr>

</table>
*/ 
-->