- Timestamp:
- Jan 30, 2011, 8:19:57 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/config.sample.php
r298 r303 38 38 ), 39 39 'GoogleMapsApiKey' => '', 40 'ItemsPerPage' => 50, 41 'VisiblePagingItems' => 20, 40 42 ), 41 43 'Finance' => array -
trunk/global.php
r267 r303 183 183 return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit); 184 184 } 185 186 function Link($Target) 187 { 188 global $Config; 189 190 return($Config['Web']['RootFolder'].$Target); 191 } 185 192 } 186 193 … … 297 304 } 298 305 306 function GetQueryStringArray($QueryString) 307 { 308 $Result = array(); 309 $Parts = explode('&', $QueryString); 310 foreach($Parts as $Part) 311 { 312 if($Part != '') 313 { 314 if(!strpos($Part, '=')) $Part .= '='; 315 $Item = explode('=', $Part); 316 $Result[$Item[0]] = $Item[1]; 317 } 318 } 319 return($Result); 320 } 321 322 function SetQueryStringArray($QueryStringArray) 323 { 324 $Parts = array(); 325 foreach($QueryStringArray as $Index => $Item) 326 { 327 $Parts[] = $Index.'='.$Item; 328 } 329 return(implode('&', $Parts)); 330 } 331 332 function GetPageList($TotalCount) 333 { 334 global $System; 335 336 $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']); 337 338 $ItemPerPage = $System->Config['Web']['ItemsPerPage']; 339 $Around = round($System->Config['Web']['VisiblePagingItems'] / 2); 340 $Result = ''; 341 $PageCount = floor($TotalCount / $ItemPerPage) + 1; 342 343 if(!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0; 344 if(array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1; 345 if($_SESSION['Page'] < 0) $_SESSION['Page'] = 0; 346 if($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1; 347 $CurrentPage = $_SESSION['Page']; 348 349 350 $Result .= 'Počet položek: <strong>'.$TotalCount.'</strong> Stránky: '; 351 352 $Result = ''; 353 if($PageCount > 1) 354 { 355 if($CurrentPage > 0) 356 { 357 $QueryItems['page'] = 0; 358 $Result.= '<a href="?'.SetQueryStringArray($QueryItems).'"><<</a> '; 359 $QueryItems['page'] = ($CurrentPage - 1); 360 $Result.= '<a href="?'.SetQueryStringArray($QueryItems).'"><</a> '; 361 } 362 $PagesMax = $PageCount - 1; 363 $PagesMin = 0; 364 if($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around; 365 if($PagesMin < ($CurrentPage - $Around)) 366 { 367 $Result.= ' ... '; 368 $PagesMin = $CurrentPage - $Around; 369 } 370 for($i = $PagesMin; $i <= $PagesMax; $i++) 371 { 372 if($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> '; 373 else { 374 $QueryItems['page'] = $i; 375 $Result .= '<a href="?'.SetQueryStringArray($QueryItems).'">'.($i + 1).'</a> '; 376 } 377 } 378 if($PagesMax < ($PageCount - 1)) $Result .= ' ... '; 379 if($CurrentPage < ($PageCount - 1)) 380 { 381 $QueryItems['page'] = ($CurrentPage + 1); 382 $Result.= '<a href="?'.SetQueryStringArray($QueryItems).'">></a> '; 383 $QueryItems['page'] = ($PageCount - 1); 384 $Result.= '<a href="?'.SetQueryStringArray($QueryItems).'">>></a>'; 385 } 386 } 387 $Result = '<div style="text-align: center">'.$Result.'</div>'; 388 return(array('SQLLimit' => ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage, 389 'Page' => $CurrentPage, 390 'Output' => $Result, 391 )); 392 } 393 394 $OrderDirSQL = array('ASC', 'DESC'); 395 $OrderArrowImage = array('sort_asc.png', 'sort_desc.png'); 396 397 function GetOrderTableHeader($Columns, $DefaultColumn, $DefaultOrder = 0) 398 { 399 global $OrderDirSQL, $OrderArrowImage, $Config, $System; 400 401 if(array_key_exists('OrderCol', $_GET)) $_SESSION['OrderCol'] = $_GET['OrderCol']; 402 if(array_key_exists('OrderDir', $_GET)) $_SESSION['OrderDir'] = $_GET['OrderDir']; 403 if(!array_key_exists('OrderCol', $_SESSION)) $_SESSION['OrderCol'] = $DefaultColumn; 404 if(!array_key_exists('OrderDir', $_SESSION)) $_SESSION['OrderDir'] = $DefaultOrder; 405 406 // Check OrderCol 407 $Found = false; 408 foreach($Columns as $Column) 409 { 410 if($Column['Name'] == $_SESSION['OrderCol']) 411 { 412 $Found = true; 413 break; 414 } 415 } 416 if($Found == false) 417 { 418 $_SESSION['OrderCol'] = $DefaultColumn; 419 $_SESSION['OrderDir'] = $DefaultOrder; 420 } 421 // Check OrderDir 422 if(($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1)) $_SESSION['OrderDir'] = 0; 423 424 $Result = ''; 425 $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']); 426 foreach($Columns as $Index => $Column) 427 { 428 $QueryItems['OrderCol'] = $Column['Name']; 429 $QueryItems['OrderDir'] = 1 - $_SESSION['OrderDir']; 430 if($Column['Name'] == $_SESSION['OrderCol']) $ArrowImage = '<img style="vertical-align: middle; border: 0px;" src="'.$System->Link('/images/'.$OrderArrowImage[$_SESSION['OrderDir']]).'" alt="order arrow">'; 431 else $ArrowImage = ''; 432 if($Column['Name'] == '') $Result .= '<th>'.$Column['Title'].'</th>'; 433 else $Result .= '<th><a href="?'.SetQueryStringArray($QueryItems).'">'.$Column['Title'].$ArrowImage.'</a></th>'; 434 } 435 return(array( 436 'SQL' => ' ORDER BY `'.$_SESSION['OrderCol'].'` '.$OrderDirSQL[$_SESSION['OrderDir']], 437 'Output' => '<tr>'.$Result.'</tr>', 438 'Column' => $_SESSION['OrderCol'], 439 'Direction' => $_SESSION['OrderDir'], 440 )); 441 } 299 442 function GetRemoteAddress() 300 443 { -
trunk/telseznam.php
r148 r303 4 4 class PhoneBookPage extends Page 5 5 { 6 var $FullTitle = 'Seznam telefon ích čísel';6 var $FullTitle = 'Seznam telefonních čísel'; 7 7 var $ShortTitle = 'Telefonní seznam'; 8 9 var $OperatorURL = array( 10 'Mikrotech' => 'http://voip.mikrotech.cz', 11 '802.cz' => 'http://802.cz/telefon', 12 'O2' => 'http://o2.cz', 13 ); 8 14 9 15 function Show() 10 16 { 11 $Output = '<img alt="Telefonní seznam" width="100%" src="images/telseznam.jpg">'; 17 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `PhoneBook`'); 18 $DbRow = $DbResult->fetch_row(); 19 $PageList = GetPageList($DbRow[0]); 20 21 $Output = $PageList['Output']; 22 $Output .= '<br/><table class="WideTable">'; 23 24 $TableColumns = array( 25 array('Name' => 'Number', 'Title' => 'Číslo'), 26 array('Name' => 'Name', 'Title' => 'Jméno'), 27 array('Name' => 'Address', 'Title' => 'Adresa'), 28 array('Name' => 'Operator', 'Title' => 'Operátor'), 29 array('Name' => 'LastUpdate', 'Title' => 'Aktualizace'), 30 ); 31 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 32 $Output .= $Order['Output']; 33 34 $Query = 'SELECT * FROM `PhoneBook` '.$Order['SQL'].$PageList['SQLLimit']; 35 36 $DbResult = $this->Database->query($Query); 37 while($Line = $DbResult->fetch_assoc()) 38 { 39 if(array_key_exists($Line['Operator'], $this->OperatorURL)) 40 $Line['Operator'] = '<a href="'.$this->OperatorURL[$Line['Operator']].'">'.$Line['Operator'].'</a>'; 41 $Output .= '<tr><td>'.$Line['Number'].'</td>'. 42 '<td>'.$Line['Name'].'</td>'. 43 '<td>'.$Line['Address'].'</td>'. 44 '<td>'.$Line['Operator'].'</td>'. 45 '<td>'.$this->System->HumanDate(MysqlDateTimeToTime($Line['LastUpdate'])).'</td></tr>'; 46 } 47 $Output .= '</table>'; 48 $Output .= $PageList['Output']; 49 50 $Output .= '<p>Pro aktualizaci údajů v seznamu se prosím obraťte na email robie@centrum.cz</p>'; 51 $Output .= '<a href="images/telseznam.jpg">Starý seznam</a>'; 12 52 return($Output); 13 53 } -
trunk/tv/index.php
r289 r303 16 16 'Zobrazení playlistu ve VLC lze provést pomocí menu <strong>View - Playlist</strong> nebo klávesové zkratky CTRL+L<br/>'. 17 17 '<br/>'. 18 '<div align="center"><strong>Výpis kanálů:</strong><br>'. 19 '<table class="WideTable">'. 20 '<tr><th>Jméno stanice</th><th>Jazyk</th><th>Zaměření</th><th>Zdroj</th></th><th>Ladění</th></tr>'; 18 '<div align="center"><strong>Výpis kanálů:</strong><br>'; 21 19 22 $DbResult = $this->Database->select('TV', '*', ' (`Stream` <> "") OR (`StreamWeb` <> "") ORDER BY `Name` '); 23 while($Channel = $DbResult->fetch_array()) 24 { 25 $Output .= '<tr><td><a href="'.$Channel['Homepage'].'">'.$Channel['Name'].'</a></td><td>'.$Channel['Language'].'</td><td>'.$Channel['Category'].'</td><td>'.$Channel['SourceType'].'</td><td>'; 26 if($Channel['Stream'] <> '') $Output .= '<a href="playlist.php?id='.$Channel['ShortName'].'">Naladit</a>'; 27 else $Output .= ' '; 28 if($Channel['StreamWeb'] <> '') $Output .= '<a href="'.$Channel['StreamWeb'].'">Naladit</a>'; 29 else $Output .= ' '; 30 $Output .= '</td></tr>'; 20 $Where = 21 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `TV` WHERE (`Stream` <> "") OR (`StreamWeb` <> "")'); 22 $DbRow = $DbResult->fetch_row(); 23 $PageList = GetPageList($DbRow[0]); 24 25 $Output .= $PageList['Output']; 26 $Output .= '<table class="WideTable">'; 27 28 $TableColumns = array( 29 array('Name' => 'Name', 'Title' => 'Jméno stanice'), 30 array('Name' => 'Language', 'Title' => 'Jazyk'), 31 array('Name' => 'Category', 'Title' => 'Zaměření'), 32 array('Name' => 'SourceType', 'Title' => 'Zdroj'), 33 array('Name' => '', 'Title' => 'Ladění'), 34 ); 35 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 36 $Output .= $Order['Output']; 37 38 $Query = 'SELECT * FROM `TV` WHERE (`Stream` <> "") OR (`StreamWeb` <> "") '.$Order['SQL'].$PageList['SQLLimit']; 39 40 $DbResult = $this->Database->query($Query); 41 while($Line = $DbResult->fetch_assoc()) 42 { 43 if($Line['Stream'] <> '') $Line['Show'] = '<a href="playlist.php?id='.$Line['ShortName'].'">Naladit</a>'; 44 else 45 if($Line['StreamWeb'] <> '') $Line['Show'] = '<a href="'.$Line['StreamWeb'].'">Naladit</a>'; 46 else $Line['Show'] = ' '; 47 48 $Output .= '<tr><td><a href="'.$Line['Homepage'].'">'.$Line['Name'].'</a></td>'. 49 '<td>'.$Line['Language'].'</td>'. 50 '<td>'.$Line['Category'].'</td>'. 51 '<td>'.$Line['SourceType'].'</td>'. 52 '<td>'.$Line['Show'].'</td></tr>'; 31 53 } 32 33 $Output .= '</table></div><br/>'; 54 $Output .= '</table>'; 55 $Output .= $PageList['Output']; 56 57 $Output .= '</div><br/>'; 34 58 35 59 $Output .= 'Originální informace o televizi: <a href="http://tv.hovnet.czf/">HovNet televize</a><br/>'; -
trunk/userlist.php
r214 r303 9 9 function Show() 10 10 { 11 $Output = '<table class="WideTable" style="font-size: small;"><tr><th>Jméno uživatele</th><th>E-mail</th><th>ICQ</th><th>Telefon</th><th>Počítače</th></tr>'; 11 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `User` WHERE (`Login` != "Anonym")'); 12 $DbRow = $DbResult->fetch_row(); 13 $PageList = GetPageList($DbRow[0]); 12 14 13 $DbResult = $this->Database->select('User', '*', 'Login != "Anonym" ORDER BY Name'); 14 while($User = $DbResult->fetch_assoc()) 15 { 16 if($User['ICQ'] > 0) $ICQ = $User['ICQ']; else $ICQ = ' '; 17 if($User['PhoneNumber'] > 0) $Phone = $User['PhoneNumber']; else $Phone = ' '; 15 $Output = $PageList['Output']; 16 $Output .= '<table class="WideTable" style="font-size: small;">'; 17 18 $TableColumns = array( 19 array('Name' => 'Name', 'Title' => 'Jméno'), 20 array('Name' => 'Email', 'Title' => 'E-mail'), 21 array('Name' => 'ICQ', 'Title' => 'ICQ'), 22 array('Name' => 'PhoneNumber', 'Title' => 'Telefón'), 23 array('Name' => '', 'Title' => 'Počítače'), 24 ); 25 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 26 $Output .= $Order['Output']; 27 28 $Query = 'SELECT * FROM `User` WHERE (`Login` != "Anonym") '.$Order['SQL'].$PageList['SQLLimit']; 29 30 $DbResult = $this->Database->query($Query); 31 while($User = $DbResult->fetch_assoc()) 32 { 33 if($User['ICQ'] > 0) $User['ICQ'] = $User['ICQ']; 34 else $User['ICQ'] = ' '; 35 if($User['PhoneNumber'] > 0) $User['PhoneNumber'] = $User['PhoneNumber']; 36 else $User['PhoneNumber'] = ' '; 18 37 19 38 $DbResult2 = $this->Database->query('SELECT Name, Id FROM NetworkDevice WHERE Member = (SELECT Id FROM Member WHERE Member.ResponsibleUser = '.$User['Id'].') AND Used=1 ORDER BY Name'); … … 23 42 $Devices[] = $Device['Name']; 24 43 } 25 $Devices = implode(', ', $Devices); 26 $Output .= '<tr><td>'.$User['Name'].'</td><td>'.$User['Email'].' </td><td>'.$ICQ.'</td><td>'.$Phone.'</td><td>'.$Devices.'</td></tr>'; 44 $User['Devices'] = implode(', ', $Devices); 45 46 $Output .= '<tr><td>'.$User['Name'].'</td>'. 47 '<td>'.$User['Email'].'</td>'. 48 '<td>'.$User['ICQ'].'</td>'. 49 '<td>'.$User['PhoneNumber'].'</td>'. 50 '<td>'.$User['Devices'].'</td></tr>'; 27 51 } 28 52 $Output .= '</table>'; 53 $Output .= $PageList['Output']; 54 29 55 return($Output); 30 56 }
Note:
See TracChangeset
for help on using the changeset viewer.