Legend:
- Unmodified
- Added
- Removed
-
base.php
r23 r24 27 27 $Where .= ' AND (t1.'.$Column.'='.$ColumnValue.')'; 28 28 $ColumnSelection = '&Column='.$Column.'&ColumnValue='.$ColumnValue; 29 $FullListLink = '<a href="?Action=ViewList&Table='.$List[' TableName'].'">Celkový seznam</a>';29 $FullListLink = '<a href="?Action=ViewList&Table='.$List['ItemId'].'">Celkový seznam</a>'; 30 30 } else 31 31 { … … 39 39 if($_SESSION['OrderColumn'] == $_GET['OrderColumn']) // Same column => reverse order 40 40 $_SESSION['OrderDirection'] = ($_SESSION['OrderDirection'] + 1) % 2; 41 if($_SESSION['OrderTable'] != $List[' TableName']) // Different table => set ascending order41 if($_SESSION['OrderTable'] != $List['ItemId']) // Different table => set ascending order 42 42 $_SESSION['OrderDirection'] = 0; 43 43 $_SESSION['OrderColumn'] = $_GET['OrderColumn']; 44 $_SESSION['OrderTable'] = $List[' TableName'];45 } 46 if(array_key_exists('OrderColumn', $_SESSION) and ($_SESSION['OrderTable'] == $List[' TableName']))44 $_SESSION['OrderTable'] = $List['ItemId']; 45 } 46 if(array_key_exists('OrderColumn', $_SESSION) and ($_SESSION['OrderTable'] == $List['ItemId'])) 47 47 { 48 48 $OrderDirection = array('ASC', 'DESC'); … … 66 66 if($Item['VisibleInList'] == 1) 67 67 { 68 $ItemDefinition = array('Name' => $Index, 'Value' => $DbRow[$Index], 'SourceTable' => $List[' TableName'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']);68 $ItemDefinition = array('Name' => $Index, 'Value' => $DbRow[$Index], 'SourceTable' => $List['ItemId'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']); 69 69 $Output .= '<td>'.ExecuteTypeEvent($Item['Type'], 'OnView', $ItemDefinition).'</td>'; 70 70 } 71 71 } 72 72 $Output .= '<td>'; 73 if(CheckPermission('Read', $List['ItemId'])) $Output .= '<a href="?Action=ViewItem&Table='.$List[' TableName'].'&Item='.$DbRow['ItemId'].'"><img border="0" src="images/view.png" alt="Zobrazit" title="Zobrazit"></a>';74 if(CheckPermission('Write', $List['ItemId'])) $Output .= ' <a href="?Action=EditItem&Table='.$List[' TableName'].'&Item='.$DbRow['ItemId'].'"><img border="0" src="images/edit.png" alt="Editovat" title="Editovat"></a>';75 if(CheckPermission('Write', $List['ItemId'])) $Output .= ' <a href="?Action=DeleteItem&Table='.$List[' TableName'].'&Item='.$DbRow['ItemId'].'"><img border="0" src="images/delete.png" alt="Smazat" title="Smazat"></a>';73 if(CheckPermission('Read', $List['ItemId'])) $Output .= '<a href="?Action=ViewItem&Table='.$List['ItemId'].'&Item='.$DbRow['ItemId'].'"><img border="0" src="images/view.png" alt="Zobrazit" title="Zobrazit"></a>'; 74 if(CheckPermission('Write', $List['ItemId'])) $Output .= ' <a href="?Action=EditItem&Table='.$List['ItemId'].'&Item='.$DbRow['ItemId'].'"><img border="0" src="images/edit.png" alt="Editovat" title="Editovat"></a>'; 75 if(CheckPermission('Write', $List['ItemId'])) $Output .= ' <a href="?Action=DeleteItem&Table='.$List['ItemId'].'&Item='.$DbRow['ItemId'].'"><img border="0" src="images/delete.png" alt="Smazat" title="Smazat" onclick="return confirmAction(\'Opravdu smazat položku?\');"></a>'; 76 76 $Output .= '</td></tr>'; 77 77 } … … 79 79 $PageList = PagesList($Page, $TotalItemCount); 80 80 if(strlen($PageList) != 0) $Output .= $PageList.'<br />'; 81 if(CheckPermission('Write', $List['ItemId'])) $Output .= ' <a href="?Action=AddItem&Table='.$List[' TableName'].$ColumnSelection.'">Přidat</a> '.$FullListLink;81 if(CheckPermission('Write', $List['ItemId'])) $Output .= ' <a href="?Action=AddItem&Table='.$List['ItemId'].$ColumnSelection.'">Přidat</a> '.$FullListLink; 82 82 return($Output); 83 83 } … … 104 104 if($_SESSION['OrderColumn'] == $_GET['OrderColumn']) // Same column => reverse orded 105 105 $_SESSION['OrderDirection'] = ($_SESSION['OrderDirection'] + 1) % 2; 106 if($_SESSION['OrderTable'] != $List[' TableName']) // Different table => set ascending order106 if($_SESSION['OrderTable'] != $List['ItemId']) // Different table => set ascending order 107 107 $_SESSION['OrderDirection'] = 0; 108 108 $_SESSION['OrderColumn'] = $_GET['OrderColumn']; 109 $_SESSION['OrderTable'] = $List[' TableName'];110 } 111 if(array_key_exists('OrderColumn', $_SESSION) and ($_SESSION['OrderTable'] == $List[' TableName']))109 $_SESSION['OrderTable'] = $List['ItemId']; 110 } 111 if(array_key_exists('OrderColumn', $_SESSION) and ($_SESSION['OrderTable'] == $List['ItemId'])) 112 112 { 113 113 $OrderDirection = array('ASC', 'DESC'); … … 132 132 if($Item['VisibleInList'] == 1) 133 133 { 134 $ItemDefinition = array('Name' => $Item['Name'], 'Value' => $DbRow[$Item['Name']], 'SourceTable' => $List[' TableName'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']);134 $ItemDefinition = array('Name' => $Item['Name'], 'Value' => $DbRow[$Item['Name']], 'SourceTable' => $List['ItemId'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']); 135 135 $Output .= '<td>'.ExecuteTypeEvent($Item['Type'], 'OnView', $ItemDefinition).'</td>'; 136 136 } 137 137 } 138 138 $Item = array('Name' => 'Author', 'Type' => TypePointerToUserId); 139 $ItemDefinition = array('Name' => $Item['Name'], 'Value' => $DbRow[$Item['Name']], 'SourceTable' => $List[' TableName'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']);139 $ItemDefinition = array('Name' => $Item['Name'], 'Value' => $DbRow[$Item['Name']], 'SourceTable' => $List['ItemId'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']); 140 140 $Output .= '<td>'.ExecuteTypeEvent($Item['Type'], 'OnView', $ItemDefinition).'</td>'; 141 141 142 142 $Output .= '<td>'.$DbRow['CreationTime'].'</td><td>'.$DbRow['DeletionTime'].'</td>'; 143 $Output .= '<td><a href="?Action=ViewItem&Table='.$List[' TableName'].'&Item='.$DbRow['Id'].'"><img border="0" src="images/view.png" alt="Zobrazit" title="Zobrazit"></a></td></tr>';143 $Output .= '<td><a href="?Action=ViewItem&Table='.$List['ItemId'].'&Item='.$DbRow['Id'].'"><img border="0" src="images/view.png" alt="Zobrazit" title="Zobrazit"></a></td></tr>'; 144 144 } 145 145 $Output .= '</table>'; 146 146 $Output .= PagesList($Page, $TotalItemCount); 147 $Output .= ' <a href="?Action=ShowList&Table='.$List[' TableName'].'">Celkový seznam</a>';147 $Output .= ' <a href="?Action=ShowList&Table='.$List['ItemId'].'">Celkový seznam</a>'; 148 148 return($Output); 149 149 } … … 165 165 if($Item['Editable'] == 1) 166 166 { 167 $DefinitionItems[] = array('Name' => $Index, 'Caption' => $Item['TextBefore'].$Required, 'Value' => $DbRow[$Index], 'SourceTable' => $List[' TableName'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']);167 $DefinitionItems[] = array('Name' => $Index, 'Caption' => $Item['TextBefore'].$Required, 'Value' => $DbRow[$Index], 'SourceTable' => $List['ItemId'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']); 168 168 } else $DefinitionItems[] = array('Name' => $Index, 'Type' => TypeHiddenId, 'Caption' => '', 'Value' => $DbRow[$Index]); 169 169 } … … 181 181 if(($Column != '') and ($ColumnValue != 0)) 182 182 { 183 $Output .= '<a href="?Action=ShowList&Table='.$List[' TableName'].'&Column='.$Column.'&ColumnValue='.$ColumnValue.'">Celkový seznam</a>';183 $Output .= '<a href="?Action=ShowList&Table='.$List['ItemId'].'&Column='.$Column.'&ColumnValue='.$ColumnValue.'">Celkový seznam</a>'; 184 184 } else 185 185 { 186 $Output .= '<a href="?Action=ShowList&Table='.$List[' TableName'].'">Celkový seznam</a>';186 $Output .= '<a href="?Action=ShowList&Table='.$List['ItemId'].'">Celkový seznam</a>'; 187 187 } 188 188 return($Output); … … 203 203 if($Type['BaseType'] != 'PointerOneToMany') 204 204 { 205 $DefinitionItems[] = array('Name' => $Index, 'Caption' => $Item['TextBefore'].$Required, 'Value' => $DbRow[$Index], 'SourceTable' => $List[' TableName'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']);205 $DefinitionItems[] = array('Name' => $Index, 'Caption' => $Item['TextBefore'].$Required, 'Value' => $DbRow[$Index], 'SourceTable' => $List['ItemId'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']); 206 206 } 207 207 } … … 215 215 ); 216 216 $Form->LoadValuesFromForm(); 217 $System->Modules['DatabaseList']->EditItem($List[' TableName'], $Form->Values, $Id);217 $System->Modules['DatabaseList']->EditItem($List['ItemId'], $Form->Values, $Id); 218 218 $NewId = $Database->insert_id; 219 219 $System->Modules['Log']->Add($List['Id'], $NewId, $LogActionType['Edit']); … … 223 223 $Form->Values['ItemId'] = $Id; 224 224 $Form->Values['ListTableName'] = $List['TableName']; 225 ExecuteListEvent($List[' TableName'], 'OnEdit', $Form->Values);225 ExecuteListEvent($List['ItemId'], 'OnEdit', $Form->Values); 226 226 return($Output); 227 227 } … … 242 242 if($Item['Required'] == 1) $Required = '*'; else $Required = ''; 243 243 if($Item['Editable'] == 1) 244 $DefinitionItems[] = array('Name' => $Item['Name'], 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'].$Required, 'Value' => '', 'SourceTable' => $List[' TableName'], 'SourceItemId' => 0);244 $DefinitionItems[] = array('Name' => $Item['Name'], 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'].$Required, 'Value' => '', 'SourceTable' => $List['ItemId'], 'SourceItemId' => 0); 245 245 } else 246 246 if($Item['Name'] == $Column) … … 262 262 if(($Column != '') and ($ColumnValue != 0)) 263 263 { 264 $Output .= '<a href="?Action=ShowList&Table='.$List[' TableName'].'&Column='.$Column.'&ColumnValue='.$ColumnValue.'">Celkový seznam</a>';264 $Output .= '<a href="?Action=ShowList&Table='.$List['ItemId'].'&Column='.$Column.'&ColumnValue='.$ColumnValue.'">Celkový seznam</a>'; 265 265 } else 266 266 { 267 $Output .= '<a href="?Action=ShowList&Table='.$List[' TableName'].'">Celkový seznam</a>';267 $Output .= '<a href="?Action=ShowList&Table='.$List['ItemId'].'">Celkový seznam</a>'; 268 268 } 269 269 return($Output); … … 284 284 { 285 285 if($Item['Required'] == 1) $Required = '*'; else $Required = ''; 286 $DefinitionItems[] = array('Name' => $Item['Name'], 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'].$Required, 'Value' => '', 'SourceTable' => $List[' TableName'], 'SourceItemId' => 0);286 $DefinitionItems[] = array('Name' => $Item['Name'], 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'].$Required, 'Value' => '', 'SourceTable' => $List['ItemId'], 'SourceItemId' => 0); 287 287 } else 288 288 if($Item['Name'] == $Column) … … 300 300 ); 301 301 $Form->LoadValuesFromForm(); 302 $NewItemId = $System->Modules['DatabaseList']->AddItem($List[' TableName'], $Form->Values);302 $NewItemId = $System->Modules['DatabaseList']->AddItem($List['ItemId'], $Form->Values); 303 303 $NewId = $Database->insert_id; 304 304 $System->Modules['Log']->Add($List['Id'], $NewId, $LogActionType['Add']); … … 306 306 $Output .= ShowViewItem($List, $NewItemId); 307 307 $Form->Values['Column'] = $_POST['Column']; 308 ExecuteListEvent($List[' TableName'], 'OnAdd', $Form->Values);308 ExecuteListEvent($List['ItemId'], 'OnAdd', $Form->Values); 309 309 return($Output); 310 310 } … … 326 326 if($Type['BaseType'] != 'PointerOneToMany') 327 327 { 328 $DefinitionItems[] = array('Name' => $Index, 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'].$Required, 'Value' => $DbRow[$Index], 'SourceTable' => $List[' TableName'], 'SourceItemId' => 0);328 $DefinitionItems[] = array('Name' => $Index, 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'].$Required, 'Value' => $DbRow[$Index], 'SourceTable' => $List['ItemId'], 'SourceItemId' => 0); 329 329 } 330 330 } … … 336 336 ); 337 337 $Output .= $Form->ShowReadOnlyForm(); 338 if(CheckPermission('Write', $List['ItemId'])) $Output .= '<a href="?Action=EditItem&Table='.$List[' TableName'].'&Item='.$DbRow['ItemId'].'">Editovat</a> ';338 if(CheckPermission('Write', $List['ItemId'])) $Output .= '<a href="?Action=EditItem&Table='.$List['ItemId'].'&Item='.$DbRow['ItemId'].'">Editovat</a> '; 339 339 340 340 if(($Column != '') and ($ColumnValue != 0)) 341 341 { 342 $Output .= '<a href="?Action=ShowList&Table='.$List[' TableName'].'&Column='.$Column.'&ColumnValue='.$ColumnValue.'">Celkový seznam</a>';342 $Output .= '<a href="?Action=ShowList&Table='.$List['ItemId'].'&Column='.$Column.'&ColumnValue='.$ColumnValue.'">Celkový seznam</a>'; 343 343 } else 344 344 { 345 $Output .= '<a href="?Action=ShowList&Table='.$List[' TableName'].'">Celkový seznam</a>';346 } 347 $Output .= ' <a href="?Action=ShowHistory&Table='.$List[' TableName'].'&Item='.$DbRow['ItemId'].'">Historie</a>';345 $Output .= '<a href="?Action=ShowList&Table='.$List['ItemId'].'">Celkový seznam</a>'; 346 } 347 $Output .= ' <a href="?Action=ShowHistory&Table='.$List['ItemId'].'&Item='.$DbRow['ItemId'].'">Historie</a>'; 348 348 $Output .= '<div class="line"></div>'; 349 349 foreach($List['Items'] as $Index => $Item) … … 366 366 if(!CheckPermission('Write', $List['ItemId'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění')); 367 367 $System->Modules['Log']->Add($List['Id'], $Id, $LogActionType['Delete']); 368 $System->Modules['DatabaseList']->DeleteItem($List[' TableName'], $Id);368 $System->Modules['DatabaseList']->DeleteItem($List['ItemId'], $Id); 369 369 $Output = 'Položka smazána.'; 370 $Output .= ShowList($ _SESSION['Table'], $_SESSION['Column'], $_SESSION['ColumnValue']).'<br /><br />';371 ExecuteListEvent($List[' TableName'], 'OnDelete', $Id);370 $Output .= ShowList($List, $_SESSION['Column'], $_SESSION['ColumnValue']).'<br /><br />'; 371 ExecuteListEvent($List['ItemId'], 'OnDelete', $Id); 372 372 return($Output); 373 373 } … … 386 386 { 387 387 if(CheckPermission('Read', $DbRow2['ItemId'])) 388 $Group .= '<a href="?Action=ShowList&Table='.$DbRow2[' TableName'].'">'.$DbRow2['Title'].'</a><br />';388 $Group .= '<a href="?Action=ShowList&Table='.$DbRow2['ItemId'].'">'.$DbRow2['Title'].'</a><br />'; 389 389 } 390 390 if($Group != '') … … 411 411 { 412 412 $List = GetListDefinition($_SESSION['Table']); 413 if($List == NULL) SystemMessage('Zobrazení stránky', 'Seznam id '.$_SESSION['Table'].' nenalezen!'); 414 //echo($_SESSION['Table']); 415 //print_r($List); 413 416 if(array_key_exists('Action', $_SESSION)) 414 417 { … … 451 454 if(!array_key_exists($Id, $Lists)) 452 455 { 453 $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.'"');456 $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.ItemId="'.$Id.'"'); 454 457 if($DbResult->num_rows > 0) 455 458 { … … 468 471 'Items' => $Items, 469 472 ); 470 if(!array_key_exists($List['TableName'], $TypeDefinitionList))473 //if(!array_key_exists($List['ItemId'], $TypeDefinitionList)) 471 474 { 472 475 $ClassName = 'List'.$DbRow['TableName']; 473 476 if(class_exists($ClassName)) $List['Class'] = new $ClassName; 474 477 } 475 $Lists[$List[' TableName']] = $List;476 } else $Lists[$List[' TableName']] = NULL;478 $Lists[$List['ItemId']] = $List; 479 } else $Lists[$List['ItemId']] = NULL; 477 480 } 478 481 return($Lists[$Id]); … … 491 494 $DbRow = $DbResult->fetch_assoc(); 492 495 $DbRow['Parameters'] = explode('|', $DbRow['Parameters']); 496 if(($DbRow['ParentType'] == TypePointerOneToOneId) or ($DbRow['ParentType'] == TypePointerOneToManyId)) 497 { 498 $DbResult2 = $Database->query('SELECT t1.* FROM `SystemList` AS t1 LEFT JOIN `SystemType` 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="'.$DbRow['Parameters'][0].'"'); 499 $DbRow2 = $DbResult2->fetch_assoc(); 500 //echo($DbRow['ParentType'].'-'.$DbRow['Parameters'][0].'='.$DbRow2['ItemId'].'<br>'); 501 $DbRow['Parameters'][0] = $DbRow2['ItemId']; 502 } 493 503 $DbRow['BaseType'] = $DbRow['Name']; 494 504
Note:
See TracChangeset
for help on using the changeset viewer.