Legend:
- Unmodified
- Added
- Removed
-
base.php
r19 r20 120 120 $DbResult = $Database->query('SELECT COUNT(t2.Id) AS Count FROM (SELECT DISTINCT(ItemId) as Id FROM `'.$List['TableName'].'` as t1 WHERE 1'.$Where.') as t2'); 121 121 //echo($Database->LastQuery.'<br>'); 122 $DbRow = $DbResult->fetch_ array();122 $DbRow = $DbResult->fetch_row(); 123 123 $TotalItemCount = $DbRow[0]; 124 124 125 125 $DbResult = $Database->query('SELECT * FROM `'.$List['TableName'].'` AS t1 WHERE 1'.$Where.' LIMIT '.($Page * $Config['Web']['ItemsPerPage']).', '.$Config['Web']['ItemsPerPage']); 126 126 //echo($Database->LastQuery.'<br>'); 127 while($DbRow = $DbResult->fetch_a rray())127 while($DbRow = $DbResult->fetch_assoc()) 128 128 { 129 129 $Output .= '<tr>'; … … 155 155 if(!CheckPermission('Write', $List['ItemId'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění')); 156 156 $DbResult = $Database->select($List['TableName'], '*', 'ItemId='.$Id.' ORDER BY Id DESC LIMIT 1'); 157 while($DbRow = $DbResult->fetch_a rray())157 while($DbRow = $DbResult->fetch_assoc()) 158 158 { 159 159 $DefinitionItems = array(); … … 194 194 if(!CheckPermission('Write', $List['ItemId'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění')); 195 195 $DbResult = $Database->select($List['TableName'], '*', 'ItemId='.$Id.' ORDER BY Id DESC LIMIT 1'); 196 while($DbRow = $DbResult->fetch_a rray())196 while($DbRow = $DbResult->fetch_assoc()) 197 197 { 198 198 $DefinitionItems = array(); … … 308 308 function ShowViewItem($List, $Id, $Column = '', $ColumnValue = 0) 309 309 { 310 global $Database, $Types , $Lists;310 global $Database, $Types; 311 311 312 312 if(!CheckPermission('Read', $List['ItemId'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění')); 313 313 $Output = ''; 314 314 $DbResult = $Database->select($List['TableName'], '*', 'ItemId='.$Id.' ORDER BY Id DESC LIMIT 1'); 315 while($DbRow = $DbResult->fetch_a rray())315 while($DbRow = $DbResult->fetch_assoc()) 316 316 { 317 317 $DefinitionItems = array(); … … 346 346 if($Types[$Item['Type']]['BaseType'] == 'PointerOneToMany') 347 347 { 348 $SubList = $Lists[$Types[$Item['Type']]['Parameters'][0]];348 $SubList = GetListDefinition($Types[$Item['Type']]['Parameters'][0]); 349 349 $Output .= ShowList($SubList, $Types[$Item['Type']]['Parameters'][1], $DbRow['ItemId'], $Item['TextBefore']).'<br /><br />'; 350 350 } … … 356 356 function ShowDeleteItem($List, $Id) 357 357 { 358 global $Database, $ Lists, $System, $LogActionType;358 global $Database, $System, $LogActionType; 359 359 360 360 if(!CheckPermission('Write', $List['ItemId'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění')); … … 362 362 $System->Modules['DatabaseList']->DeleteItem($List['TableName'], $Id); 363 363 $Output = 'Položka smazána.'; 364 $Output .= ShowList($ Lists[$_SESSION['Table']], $Lists[$_SESSION['Column']], $Lists[$_SESSION['ColumnValue']]).'<br /><br />';364 $Output .= ShowList($_SESSION['Table'], $_SESSION['Column'], $_SESSION['ColumnValue']).'<br /><br />'; 365 365 ExecuteListEvent($List['TableName'], 'OnDelete', $Id); 366 366 return($Output); … … 369 369 function ShowMenu() 370 370 { 371 global $ Lists, $Database;371 global $Database; 372 372 373 373 $Output = ''; … … 391 391 function Output() 392 392 { 393 global $Lists;394 395 393 $PermanentVar = array('Table', 'Item', 'Column', 'ColumnValue', 'Action'); 396 394 if($_GET['Table'] != $_SESSION['Table']) … … 404 402 } 405 403 $Output = ''; 406 if(array_key_exists('Table', $_SESSION) and array_key_exists($_SESSION['Table'], $Lists))407 { 408 $List = $Lists[$_SESSION['Table']];404 if(array_key_exists('Table', $_SESSION)) 405 { 406 $List = GetListDefinition($_SESSION['Table']); 409 407 if(array_key_exists('Action', $_SESSION)) 410 408 { … … 441 439 } 442 440 443 function LoadListDefinition()441 function GetListDefinition($Id) 444 442 { 445 443 global $Database, $Lists; 446 444 447 $DbResult = $Database->query('SELECT t1.* FROM `SystemList` AS t1 LEFT JOIN `SystemList` AS t2 ON t1.ItemId=t2.ItemId AND t1.Id < t2.Id WHERE (t2.ItemId IS NULL) AND (t1.DeletionTime IS NULL)'); 448 while($DbRow = $DbResult->fetch_assoc()) 449 { 450 $Items = array(); 451 $DbResult2 = $Database->query('SELECT t1.* FROM `SystemListItem` AS t1 LEFT JOIN `SystemListItem` AS t2 ON t1.ItemId=t2.ItemId AND t1.Id < t2.Id WHERE (t2.ItemId IS NULL) AND (t1.DeletionTime IS NULL) AND (t1.List='.$DbRow['ItemId'].')'); 452 while($DbRow2 = $DbResult2->fetch_assoc()) 453 { 454 $Items[$DbRow2['Name']] = $DbRow2; 455 } 456 $List = array( 457 'Id' => $DbRow['Id'], 458 'ItemId' => $DbRow['ItemId'], 459 'TableName' => $DbRow['TableName'], 460 'Title' => $DbRow['Title'], 461 'Items' => $Items, 462 ); 463 $Lists[$List['TableName']] = $List; 464 } 445 if(!array_key_exists($Id, $Lists)) 446 { 447 $DbResult = $Database->query('SELECT t1.* FROM `SystemList` AS t1 LEFT JOIN `SystemList` AS t2 ON t1.ItemId=t2.ItemId AND t1.Id < t2.Id WHERE (t2.ItemId IS NULL) AND (t1.DeletionTime IS NULL) AND t1.TableName="'.$Id.'"'); 448 if($DbResult->num_rows > 0) 449 { 450 $DbRow = $DbResult->fetch_assoc(); 451 $Items = array(); 452 $DbResult2 = $Database->query('SELECT t1.* FROM `SystemListItem` AS t1 LEFT JOIN `SystemListItem` AS t2 ON t1.ItemId=t2.ItemId AND t1.Id < t2.Id WHERE (t2.ItemId IS NULL) AND (t1.DeletionTime IS NULL) AND (t1.List='.$DbRow['ItemId'].')'); 453 while($DbRow2 = $DbResult2->fetch_assoc()) 454 { 455 $Items[$DbRow2['Name']] = $DbRow2; 456 } 457 $List = array( 458 'Id' => $DbRow['Id'], 459 'ItemId' => $DbRow['ItemId'], 460 'TableName' => $DbRow['TableName'], 461 'Title' => $DbRow['Title'], 462 'Items' => $Items, 463 ); 464 $Lists[$List['TableName']] = $List; 465 } else $Lists[$List['TableName']] = NULL; 466 } 467 return($Lists[$Id]); 465 468 //print_r($Lists); 466 469 }
Note:
See TracChangeset
for help on using the changeset viewer.