[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/phpsysinfo/includes/xml/ -> mbinfo.php (source)

   1  <?php
   2  //
   3  // phpSysInfo - A PHP System Information Script
   4  // http://phpsysinfo.sourceforge.net/
   5  //
   6  // This program is free software; you can redistribute it and/or
   7  // modify it under the terms of the GNU General Public License
   8  // as published by the Free Software Foundation; either version 2
   9  // of the License, or (at your option) any later version.
  10  //
  11  // This program is distributed in the hope that it will be useful,
  12  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14  // GNU General Public License for more details.
  15  //
  16  // You should have received a copy of the GNU General Public License
  17  // along with this program; if not, write to the Free Software
  18  // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  
  19  //   
  20  // $Id: mbinfo.php 21228 2006-04-06 13:52:08Z ralfbecker $
  21  
  22  function xml_mbtemp() {
  23      global $text;
  24      global $mbinfo;
  25  
  26      $_text = "";
  27      $data = $mbinfo->temperature();
  28  
  29      $_text = "  <MBinfo>\n";
  30      if (sizeof($data) > 0) {
  31      $_text .= "    <Temperature>\n";
  32      for ($i=0, $max = sizeof($data); $i < $max; $i++) {
  33          $_text .= "       <Item>\n";
  34          $_text .= "      <Label>" . htmlspecialchars($data[$i]['label'], ENT_QUOTES) . "</Label>\n";
  35          $_text .= "      <Value>" . htmlspecialchars($data[$i]['value'], ENT_QUOTES) . "</Value>\n";
  36          $_text .= "      <Limit>" . htmlspecialchars($data[$i]['limit'], ENT_QUOTES) . "</Limit>\n";
  37          $_text .= "       </Item>\n";
  38      }
  39      $_text .= "    </Temperature>\n";
  40      }
  41  
  42      return $_text;  
  43  };
  44  
  45  function xml_mbfans() {
  46      global $text;
  47      global $mbinfo;
  48  
  49      $_text = "";
  50      $data = $mbinfo->fans();
  51      if (sizeof($data) > 0) {
  52          $_text = "    <Fans>\n";
  53          for ($i=0, $max = sizeof($data); $i < $max; $i++) {
  54              $_text .= "       <Item>\n";
  55              $_text .= "      <Label>" . htmlspecialchars($data[$i]['label'], ENT_QUOTES) . "</Label>\n";
  56              $_text .= "      <Value>" . htmlspecialchars($data[$i]['value'], ENT_QUOTES) . "</Value>\n";
  57              $_text .= "      <Min>" . htmlspecialchars($data[$i]['min'], ENT_QUOTES) . "</Min>\n";
  58              $_text .= "      <Div>" . htmlspecialchars($data[$i]['div'], ENT_QUOTES) . "</Div>\n";
  59              $_text .= "       </Item>\n";
  60          }
  61          $_text .= "    </Fans>\n";
  62      }
  63  
  64      return $_text;  
  65  };
  66  
  67  function xml_mbvoltage() {
  68      global $text;
  69      global $mbinfo;
  70  
  71      $_text = "";
  72      $data = $mbinfo->voltage();
  73      if (sizeof($data) > 0) {
  74          $_text = "    <Voltage>\n";
  75          for ($i=0, $max = sizeof($data); $i < $max; $i++) {
  76              $_text .= "       <Item>\n";
  77              $_text .= "      <Label>" . htmlspecialchars($data[$i]['label'], ENT_QUOTES) . "</Label>\n";
  78              $_text .= "      <Value>" . htmlspecialchars($data[$i]['value'], ENT_QUOTES) . "</Value>\n";
  79              $_text .= "      <Min>" . htmlspecialchars($data[$i]['min'], ENT_QUOTES) . "</Min>\n";
  80              $_text .= "      <Max>" . htmlspecialchars($data[$i]['max'], ENT_QUOTES) . "</Max>\n";
  81              $_text .= "       </Item>\n";
  82          }
  83          $_text .= "    </Voltage>\n";
  84      }
  85      $_text .= "  </MBinfo>\n";
  86  
  87      return $_text;  
  88  };
  89  
  90  
  91  function html_mbtemp() {
  92    global $text;
  93    global $mbinfo;
  94  
  95    $textdir = direction();
  96    $data = array();
  97    $scale_factor = 2;
  98  
  99    $_text = "  <tr>\n"
 100           . "    <td><font size=\"-1\"><b>" . $text['s_label'] . "</b></font></td>\n"
 101       . "    <td><font size=\"-1\"><b>" . $text['s_value'] . "</b></font></td>\n"
 102       . "    <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['s_limit'] . "</b></font></td>\n"
 103       . "  </tr>\n";
 104  
 105    $data = $mbinfo->temperature();
 106    for ($i=0, $max = sizeof($data); $i < $max; $i++) {
 107       $_text .= "  <tr>\n"
 108               . "    <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">". $data[$i]['label'] . "</font></td>\n"
 109           . "    <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">";
 110       if ($data[$i]['value'] == 0) {
 111         $_text .= "Unknown - Not connected?";
 112       } else {
 113         $_text .= create_bargraph($data[$i]['value'], $data[$i]['limit'], $scale_factor);
 114       }
 115       $_text .= "&nbsp;" . round($data[$i]['value']) . "&nbsp;" . $text['degree_mark'] . "</font></td>\n"
 116               . "    <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">". $data[$i]['limit'] . "&nbsp;" . $text['degree_mark'] . "</font></td>\n"
 117           . "  </tr>\n";
 118    };
 119  
 120    return $_text;  
 121  };
 122  
 123  
 124  function html_mbfans() {
 125    global $text;
 126    global $mbinfo;
 127    $textdir = direction();
 128  
 129    $_text ="<table width=\"100%\">\n";
 130  
 131    $_text .= "  <tr>\n"
 132        . "    <td><font size=\"-1\"><b>" . $text['s_label'] . "</b></font></td>\n"
 133            . "    <td align=\"" . $textdir['right'] . "\"><font size=\"-1\"><b>" . $text['s_value'] . "</b></font></td>\n"
 134        . "    <td align=\"" . $textdir['right'] . "\"><font size=\"-1\"><b>" . $text['s_min'] . "</b></font></td>\n"
 135        . "    <td align=\"" . $textdir['right'] . "\"><font size=\"-1\"><b>" . $text['s_div'] . "</b></font></td>\n"
 136        . "  </tr>\n";
 137  
 138    $data = $mbinfo->fans();
 139    $show_fans = false;
 140  
 141    for ($i=0, $max = sizeof($data); $i < $max; $i++) {
 142        $_text .= "  <tr>\n"
 143                . "    <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">". $data[$i]['label'] . "</font></td>\n"
 144                . "    <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">". round($data[$i]['value']) . " " . $text['rpm_mark'] . "</font></td>\n"
 145                . "    <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">". $data[$i]['min'] . " " . $text['rpm_mark'] . "</font></td>\n"
 146                . "    <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . $data[$i]['div'] . "</font></td>\n"
 147                . "  </tr>\n";
 148        if (round($data[$i]['value']) > 0) { 
 149            $show_fans = true;
 150        }
 151    };
 152    $_text .= "</table>\n";
 153  
 154    if (!$show_fans) {
 155        $_text = "";
 156    }
 157  
 158    return $_text;  
 159  };
 160  
 161  
 162  function html_mbvoltage() {
 163    global $text;
 164    global $mbinfo;
 165    $textdir = direction();
 166  
 167    $_text = "<table width=\"100%\">\n";
 168  
 169    $_text .= "  <tr>\n"
 170            . "    <td><font size=\"-1\"><b>" . $text['s_label'] . "</b></font></td>\n"
 171        . "    <td align=\"" . $textdir['right'] . "\"><font size=\"-1\"><b>" . $text['s_value'] . "</b></font></td>\n"
 172        . "    <td align=\"" . $textdir['right'] . "\"><font size=\"-1\"><b>" . $text['s_min'] . "</b></font></td>\n"
 173        . "    <td align=\"" . $textdir['right'] . "\"><font size=\"-1\"><b>" . $text['s_max'] . "</b></font></td>\n"
 174        . "  </tr>\n";
 175  
 176      $data = $mbinfo->voltage();
 177      for ($i=0, $max = sizeof($data); $i < $max; $i++) {
 178              $_text .= "  <tr>\n"
 179                      . "    <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">". $data[$i]['label'] . "</font></td>\n"
 180                      . "    <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">". $data[$i]['value'] . " " . $text['voltage_mark'] . "</font></td>\n"
 181                      . "    <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">". $data[$i]['min'] . " " . $text['voltage_mark'] . "</font></td>\n"
 182                      . "    <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . $data[$i]['max'] . " " . $text['voltage_mark'] . "</font></td>\n"
 183              . "  </tr>\n";
 184      };
 185  
 186    $_text .= "</table>\n";
 187  
 188    return $_text;  
 189  };
 190  
 191  function wml_mbtemp() {
 192    global $text;
 193    global $mbinfo;
 194    $data = array();
 195    $data = $mbinfo->temperature();
 196  
 197    for ($i=0; $i < $max = sizeof($data); $i++) {
 198       $_text .= "<p>\n"
 199               . $data[$i]['label'] . ": ";
 200       if ($data[$i]['value'] == 0) {
 201         $_text .= "Unknown - Not connected?</p>";
 202       } else {
 203         $_text .= round($data[$i]['value']) . "&nbsp;" . str_replace("&ordm;", "", $text['degree_mark']) . "</p>\n";
 204       }
 205    };
 206    
 207    return $_text;
 208  }
 209  
 210  function wml_mbfans() {
 211    global $text;
 212    global $mbinfo;
 213    $data = array();
 214    $data = $mbinfo->fans();
 215    
 216    $_text = "<card id=\"fans\" title=\"" . $text['fans'] . "\">\n";
 217    for ($i = 0; $i <  sizeof($data); $i++) {
 218        $_text .= "<p>\n"
 219                . $data[$i]['label'] . ": " . round($data[$i]['value']) . "&nbsp;" . $text['rpm_mark'] . "</p>\n";
 220        }
 221    $_text .= "</card>\n";
 222  
 223    return $_text;  
 224  }
 225  
 226  function wml_mbvoltage() {
 227    global $text;
 228    global $mbinfo;
 229    $data = array();
 230    $data = $mbinfo->voltage();
 231    
 232    $_text = "<card id=\"volt\" title=\"" . $text['voltage'] . "\">\n";
 233  
 234    for ($i = 0; $i < sizeof($data); $i++) {
 235      $_text .= "<p><br/>\n"
 236              . $data[$i]['label'] . ": " . $data[$i]['value'] . "&nbsp;" . $text['voltage_mark'] . "<br/>\n"
 237              . "- " . $text['s_min'] . ": " . $data[$i]['min'] . " " . $text['voltage_mark'] . "<br/>\n"
 238              . "- " . $text['s_max'] . ": " . $data[$i]['max'] . " " . $text['voltage_mark'] . "</p>\n";
 239    };
 240  
 241    $_text .= "</card>\n";
 242  
 243    return $_text;  
 244  };
 245  
 246  ?>


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7