Changeset 229


Ignore:
Timestamp:
Jun 21, 2009, 12:04:00 PM (16 years ago)
Author:
george
Message:
  • Opraveno: Funkce pro přidávání předpon násobků jednotek čísel.
  • Upraveno: Seznam dostupných AP a obsazených kanálů se nyní načítá z databáze z tabulky NetworkAP.
Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/database.php

    r226 r229  
    5454    {
    5555            if(!in_array($Value, $this->Functions)) $Value = '"'.$this->real_escape_string($Value).'"';
    56       $Values .= ', '.$Key.'='.$Value;
     56      $Values .= ', `'.$Key.'`='.$Value;
    5757    }
    5858    $Values = substr($Values, 2); 
  • trunk/forms.php

    r219 r229  
    9494                $Edit = '<select style="width: 100%;" name="'.$Context.$Index.'">';
    9595                $DbResult = $Database->select($FormTypes[$Item['Type']]['Table'], $FormTypes[$Item['Type']]['Id'].' as Id, '.$FormTypes[$Item['Type']]['Name'].' as Name', $FormTypes[$Item['Type']]['Filter'].' ORDER BY Name');
    96                 while($Row = $DbResult->fetch_array())
    97                   $Edit .= '<option value="'.$Row['Id'].'">'.$Row['Name'].'</option>';
     96                while($Row = $DbResult->fetch_assoc())
     97                {
     98                  if($Row['Id'] == $this->Values[$Index]) $Selected = ' selected="selected"';
     99                    else $Selected = '';
     100                  $Edit .= '<option value="'.$Row['Id'].'"'.$Selected.'>'.$Row['Name'].'</option>';
     101                }
    98102                $Edit .= '</select>';
    99103                break;
  • trunk/global.php

    r228 r229  
    5050      array('u', 'mikro', pow(10, -6)),
    5151      array('m', 'mili', pow(10, -3)),
    52       array('', '', pow(10, 0), pow(2, 0)),
     52      array('', '', pow(10, 0)),
    5353      array('k', 'kilo', pow(10, 3)),
    5454      array('M', 'mega', pow(10, 6)),
     
    6363  'Time' => array
    6464  (
    65     'BaseIndex' => 0,
     65    'BaseIndex' => 8,
    6666    'Definition' => array
    6767    (
     
    7575      array('ms', 'milisekunda', pow(10, -3)),
    7676      array('s', 'sekunda', 1),
    77       array('min', 'minuta', 60),
    78       array('hod', 'hodina', 60 * 60) ,
    79       array('den', 'den', 24 * 60 * 60),
    80       array('týd', 'týden', 7 * 24 * 60 * 60),
    81       array('měs', 'měsíc', 30 * 24 * 60 * 60),
    82       array('rok', 'rok', 364 * 24 * 60 * 60),
    83       array('des', 'desetiletí', 10 * 364 * 24 * 60 * 60),
    84       array('sta', 'staletí', 100 * 364 * 24 * 60 * 60),
    85       array('tis', 'tisiciletí', 10000 * 364 * 24 * 60 * 60),
     77      array('minut', 'minuta', 60),
     78      array('hodin', 'hodina', 60 * 60) ,
     79      array('d', 'den', 24 * 60 * 60),
     80      array('týd', 'týden', 7 * 24 * 60 * 60),
     81      array('měsíců', 'měsíc', 30 * 24 * 60 * 60),
     82      array('roků', 'rok', 364 * 24 * 60 * 60),
     83      array('desetiletí', 'desetiletí', 10 * 364 * 24 * 60 * 60),
     84      array('stalatí', 'staletí', 100 * 364 * 24 * 60 * 60),
     85      array('tisíciletí', 'tisiciletí', 10000 * 364 * 24 * 60 * 60),
    8686    ),
    8787  ),
    8888);
    89 
    9089
    9190class System extends Module
     
    137136  function HumanDate($Time)
    138137  {
    139       return(date('j.n.Y', $Time));
     138    return(date('j.n.Y', $Time));
    140139  }
    141140
     
    158157    global $PrefixMultipliers;
    159158
    160     if(($Unit == '') and ($PrefixType != 'Time')) return($this->TruncateDigits($Value, $Digits));
     159    $Negative = ($Value < 0);
     160    $Value = abs($Value);
     161    if(($Unit == '') and ($PrefixType != 'Time'))
     162      return($this->TruncateDigits($Value, $Digits));
     163
    161164    $I = $PrefixMultipliers[$PrefixType]['BaseIndex'];
    162     if($Value > 0) $II = 1;
    163     else if($Value < 0) $II = -1;
    164     else $II = 0;
    165     while((($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I + $II][2]) > $II) and (($I + $II) >= 0) and (($I + $II) <= count($PrefixMultipliers[$PrefixType]['Definition']))) $I = $I + $II;
     165    if($Value == 0) return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit);
     166     
     167    if($Value > 1)
     168    {
     169      while((($I + 1) <= count($PrefixMultipliers[$PrefixType]['Definition'])) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I + 1][2]) > 1))
     170        $I = $I + 1;
     171    } else
     172    if($Value < 1)
     173    {
     174      while((($I - 1) >= 0) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2]) < 1))
     175        $I = $I - 1;
     176    }
    166177    $Value = $Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2];
    167 
     178   
    168179    // Truncate digits count
    169180    $Value = $this->TruncateDigits($Value, $Digits);
    170 
     181    if($Negative) $Value = -$Value;
    171182    return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit);
    172183  }
  • trunk/network.php

    r195 r229  
    9898        break;
    9999      case 'obsazeni_wifi_kanalu':
    100         $Output .= '<br /><strong>Obsazení wifi kanálů:</strong><br />
    101 <table style="font-size: small;"  border="1" cellspacing="0" cellpadding="3">
    102 <tr><th>Kanál</th><th>Frekvence [GHz]</th><th>Zařízení</th></tr>
    103 <tr><td>1</td><td>2,412</td><td>AP-RUDO, AP-HAJDIKOVI, ptp-skarpa</td></tr>
    104 <tr><td>2</td><td>2,417</td><td>&nbsp;</td></tr>
    105 <tr><td>3</td><td>2,422</td><td>ap-markytan, ap-zvonicek, ap-hrbacek</td></tr>
    106 <tr><td>4</td><td>2,427</td><td>ap-george</td></tr>
    107 <tr><td>5</td><td>2,432</td><td>AP-MARON, ap-janicata</td></tr>
    108 <tr><td>6</td><td>2,437</td><td>ap-sekula</td></tr>
    109 <tr><td>7</td><td>2,442</td><td>ap-chaty</td></tr>
    110 <tr><td>8</td><td>2,447</td><td>ap-bytovky</td></tr>
    111 <tr><td>9</td><td>2,452</td><td>ap-kopecek</td></tr>
    112 <tr><td>10</td><td>2,457</td><td>ap-skarpa, AP-HAJDIKOVI2, AP-NAVRATIL</td></tr>
    113 <tr><td>11</td><td>2,462</td><td>&nbsp;</td></tr>
    114 <tr><td>12</td><td>2,467</td><td>&nbsp;</td></tr>
    115 <tr><td>13</td><td>2,472</td><td>ap-hajda, zbranek</td></tr>
    116 <tr><td>100</td><td>5,500</td><td>ptp-markytan</td></tr>
    117 <tr><td>104</td><td>5,520</td><td>ptp-smutny</td></tr>
    118 <tr><td>108</td><td>5,540</td><td>&nbsp;</td></tr>
    119 <tr><td>112</td><td>5,560</td><td>&nbsp;</td></tr>
    120 <tr><td>116</td><td>5,580</td><td>ptp-janicata</td></tr>
    121 <tr><td>120</td><td>5,600</td><td>ptp-hajdova</td></tr>
    122 <tr><td>124</td><td>5,620</td><td>&nbsp;</td></tr>
    123 <tr><td>128</td><td>5,640</td><td>ptp-bytovky</td></tr>
    124 <tr><td>132</td><td>5,660</td><td>ptp-chaty</td></tr>
    125 <tr><td>136<td>5,700</td></td><td>ptp-sekula</td></tr>
    126 <tr><td>140<td>5,720</td></td><td>&nbsp;</td></tr>
    127 </table>';
    128         $Output .= 'Aktualizováno: 10.8.2008';
     100        $Output .= '<br/><div align="center"><strong>Seznam AP a obsazení wifi kanálů:</strong></div>
     101<table class="WideTable">
     102<tr><th>Kanál</th><th>Frekvence [GHz]</th><th>SSID</th></tr>'; 
     103        // http://en.wikipedia.org/wiki/List_of_WLAN_channels
     104        $ChannelList = array(2412 => 1, 2417 => 2, 2422 => 3, 2427 => 4, 2432 => 5, 2437 => 6, 2442 => 7, 2447 => 8, 2452 => 9, 2457 => 10, 2462 => 11, 2467 => 12, 2472 => 13, 5210 => 42, 5250 => 50, 5290 => 48, 5500 => 100, 5520 => 104, 5540 => 108, 5560 => 112, 5580 => 116, 5600 => 120, 5620 => 124, 5640 => 128, 5660 => 132, 5700 => 140, 5720 => 144);
     105        $DbResult = $this->Database->query('SELECT Frequency FROM NetworkAP GROUP BY Frequency');
     106        while($DbRow = $DbResult->fetch_assoc())
     107        {
     108          $SSID = '';
     109          $DbResult2 = $this->Database->query('SELECT * FROM NetworkAP WHERE Frequency='.$DbRow['Frequency']);
     110          while($DbRow2 = $DbResult2->fetch_assoc())
     111            $SSID .= ', '.$DbRow2['SSID'];
     112          $SSID = substr($SSID, 2);
     113          $Output .= '<tr><td>'.$ChannelList[$DbRow['Frequency']].'</td><td>'.$DbRow['Frequency'].'</td><td>'.$SSID.'</td></tr>';
     114        }
     115        $Output .= '</table>';
    129116        break;
    130117      default:
Note: See TracChangeset for help on using the changeset viewer.