Changeset 530 for trunk/Modules/IS/IS.php
- Timestamp:
- Apr 23, 2013, 10:49:05 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/IS/IS.php
r529 r530 15 15 if(!$this->System->User->CheckPermission('IS', 'Manage')) 16 16 return('Nemáte oprávnění'); 17 18 $DbResult = $this->Database->query('SELECT `MenuItem`.`Id`, `MenuItem`.`Name`, `MenuItem`.`Parent`, `Action`.`URL` AS `URL`, `ActionIcon`.`Name` AS `IconName` FROM `MenuItem` '. 19 'LEFT JOIN `Action` ON `Action`.`Id` = `MenuItem`.`Action` '. 20 'LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '. 21 'ORDER BY `MenuItem`.`Parent`,`MenuItem`.`Name`'); 22 while($DbRow = $DbResult->fetch_assoc()) 23 { 24 $this->MenuItems[$DbRow['Id']] = $DbRow; 25 } 26 27 if(array_key_exists('t', $_GET)) $_SESSION['Table'] = $_GET['t']; 28 if(array_key_exists('a', $_GET)) $_SESSION['Action'] = $_GET['a']; 29 if(array_key_exists('id', $_GET)) $_SESSION['Id'] = $_GET['id']; 30 if(array_key_exists('r', $_GET)) $_SESSION['Ref'] = $_GET['r']; 31 32 if(!array_key_exists('Action', $_SESSION)) $_SESSION['Action'] = 'list'; 33 if(!array_key_exists('Id', $_SESSION) or !array_key_exists('Table', $_SESSION) or 34 ($_SESSION['Table'] == '')) { 35 $_SESSION['Id'] = 0; 36 $_SESSION['Action'] = ''; 37 $_SESSION['Table'] = ''; 38 $_SESSION['Ref'] = ''; 39 } 40 41 if($_SESSION['Action'] == 'list') $Content = $this->ShowList($_SESSION['Table']); 42 else if($_SESSION['Action'] == 'select') $Content = $this->ShowSelect($_SESSION['Table']); 43 else if($_SESSION['Action'] == 'edit') $Content = $this->ShowEdit($_SESSION['Table'], $_SESSION['Id']); 44 else if($_SESSION['Action'] == 'add') $Content = $this->ShowAdd($_SESSION['Table']); 45 else if($_SESSION['Action'] == 'view') $Content = $this->ShowView($_SESSION['Table'], $_SESSION['Id']); 46 else if($_SESSION['Action'] == 'delete') $Content = $this->ShowDelete($_SESSION['Table'], $_SESSION['Id']); 17 18 if(array_key_exists('a', $_GET)) $Action = $_GET['a']; 19 else $Action = ''; 20 if(array_key_exists('t', $_GET)) $Table = $_GET['t']; 21 else $Table = ''; 22 if(array_key_exists('i', $_GET)) $ItemId = $_GET['i']; 23 else $ItemId = 0; 24 25 if($Action == 'list') $Content = $this->ShowList($Table); 26 else if($Action == 'select') $Content = $this->ShowSelect($Table); 27 else if($Action == 'edit') $Content = $this->ShowEdit($Table, $ItemId); 28 else if($Action == 'add') $Content = $this->ShowAdd($Table); 29 else if($Action == 'view') $Content = $this->ShowView($Table, $ItemId); 30 else if($Action == 'delete') $Content = $this->ShowDelete($Table, $ItemId); 47 31 else $Content = ''; 48 32 if($this->HideMenu == false) 49 33 { 50 34 $Output = '<table style="width: 100%"><tr><td style="width: 20%; vertical-align: top;">'; 51 $Output .= '<strong>Nabídka:</strong> <br/>'.$this->ShowMenuItem('');35 $Output .= '<strong>Nabídka:</strong>'.$this->ShowMenuItem(''); 52 36 $Output .= '</td><td style="width: 80%; vertical-align: top;">'; 53 37 $Output .= $Content; … … 70 54 $Form->SaveValuesToDatabase($Id); 71 55 $Output .= $this->SystemMessage('Úprava položky', 'Položka upravena'); 72 $_SESSION['Action'] = 'view';73 56 $Output .= $this->ShowView($Table, $Id); 74 57 } … … 85 68 $Output .= '<li><a href="?a=list&t='.$Table.'"><img alt="Seznam" title="Seznam" src="'. 86 69 $this->System->Link('/images/list.png').'"/>Seznam</a></li>'; 87 $Output .= '<li><a href="?a=delete&t='.$Table.' " onclick="return confirmAction(\'Opravdu smazat položku?\');"><img alt="Odstranit" title="Odstranit" src="'.70 $Output .= '<li><a href="?a=delete&t='.$Table.'&i='.$Id.'" onclick="return confirmAction(\'Opravdu smazat položku?\');"><img alt="Odstranit" title="Odstranit" src="'. 88 71 $this->System->Link('/images/delete.png').'"/>Odstranit</a></li>'; 89 72 $Output .= '</ul>'; … … 97 80 $this->Database->delete($Table, 'Id='.$Id); 98 81 $Output .= $this->SystemMessage('Odstranění položky', 'Položka odstraněna'); 99 $_SESSION['Action'] = 'list';100 82 $Output .= $this->ShowList($Table); 101 83 return($Output); … … 114 96 $Form->SaveValuesToDatabase(0); 115 97 $Output .= $this->SystemMessage('Přidání položky', 'Nová položka vytvořena'); 116 $_SESSION['Action'] = 'view';117 98 $Id = $this->Database->insert_id; 118 $_SESSION['Id'] = $Id;119 99 //$this->Database->update($Table, 'Id='.$Id, 120 100 // array('UserCreate' => $this->System->User->User['Id'], … … 147 127 $Output = $Form->ShowViewForm(); 148 128 $Output .= '<ul class="ActionMenu">'; 149 $Output .= '<li><a href="?a=edit "><img alt="Upravit" title="Upravit" src="'.129 $Output .= '<li><a href="?a=edit&t='.$Table.'&i='.$Id.'"><img alt="Upravit" title="Upravit" src="'. 150 130 $this->System->Link('/images/edit.png').'"/>Upravit</a></li>'; 151 $Output .= '<li><a href="?a=list "><img alt="Seznam" title="Seznam" src="'.131 $Output .= '<li><a href="?a=list&t='.$Table.'"><img alt="Seznam" title="Seznam" src="'. 152 132 $this->System->Link('/images/list.png').'"/>Seznam</a></li>'; 153 $Output .= '<li><a href="?a=delete " onclick="return confirmAction(\'Opravdu smazat položku?\');"><img alt="Odstranit" title="Odstranit" src="'.133 $Output .= '<li><a href="?a=delete&t='.$Table.'&i='.$Id.'" onclick="return confirmAction(\'Opravdu smazat položku?\');"><img alt="Odstranit" title="Odstranit" src="'. 154 134 $this->System->Link('/images/delete.png').'" />Odstranit</a></li>'; 155 $Output .= '<li><a href="?a=add "><img alt="Přidat" title="Přidat" src="'.135 $Output .= '<li><a href="?a=add&t='.$Table.'"><img alt="Přidat" title="Přidat" src="'. 156 136 $this->System->Link('/images/add.png').'"/>Přidat</a></li>'; 157 137 if(array_key_exists('ItemActions', $FormClass)) 158 138 { 159 139 foreach($FormClass['ItemActions'] as $Action) 160 $Output .= '<li><a href="'.$this->System->Link($Action['URL']).'&i d='.$Id.'"><img alt="'.$Action['Caption'].'" title="'.$Action['Caption'].'" src="'.140 $Output .= '<li><a href="'.$this->System->Link($Action['URL']).'&i='.$Id.'"><img alt="'.$Action['Caption'].'" title="'.$Action['Caption'].'" src="'. 161 141 $this->System->Link('/images/action.png').'"/>'.$Action['Caption'].'</a></li>'; 162 142 } … … 268 248 $Output .= '<td>'.$Value.'</td>'; 269 249 } 270 $Output .= '<td><a href="javascript:window.close();" onclick="set_return('.$Row['Id'].',"'.$_ SESSION['Ref'].'");"><img alt="Vybrat" title="Vybrat" src="'.250 $Output .= '<td><a href="javascript:window.close();" onclick="set_return('.$Row['Id'].',"'.$_GET['r'].'");"><img alt="Vybrat" title="Vybrat" src="'. 271 251 $this->System->Link('/images/select.png').'"/></a>'; 272 252 $Output .= '</td></tr>'; … … 320 300 321 301 // Show search fields 322 $Output .= '<tr><form action="?a=list& filter=1" method="post">';302 $Output .= '<tr><form action="?a=list&t='.$Table.'&filter=1" method="post">'; 323 303 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 324 304 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or … … 366 346 $Output .= '<td>'.$Value.'</td>'; 367 347 } 368 $Output .= '<td><a href="?a=view&t='.$Table.'&i d='.$Row['Id'].'"><img alt="Ukázat" title="Ukázat" src="'.348 $Output .= '<td><a href="?a=view&t='.$Table.'&i='.$Row['Id'].'"><img alt="Ukázat" title="Ukázat" src="'. 369 349 $this->System->Link('/images/view.png').'"/></a>'. 370 '<a href="?a=edit&t='.$Table.'&i d='.$Row['Id'].'"><img alt="Upravit" title="Upravit" src="'.350 '<a href="?a=edit&t='.$Table.'&i='.$Row['Id'].'"><img alt="Upravit" title="Upravit" src="'. 371 351 $this->System->Link('/images/edit.png').'"/></a>'. 372 '<a href="?a=delete&t='.$Table.'&i d='.$Row['Id'].'"><img alt="Smazat" title="Smazat" src="'.352 '<a href="?a=delete&t='.$Table.'&i='.$Row['Id'].'"><img alt="Smazat" title="Smazat" src="'. 373 353 $this->System->Link('/images/delete.png').'" onclick="return confirmAction(\'Opravdu smazat položku?\');"/></a>'; 374 354 if(array_key_exists('ItemActions', $FormClass)) 375 355 { 376 356 foreach($FormClass['ItemActions'] as $Action) 377 $Output .= '<a href="'.$this->System->Link($Action['URL']).'&i d='.$Row['Id'].'"><img alt="'.$Action['Caption'].'" title="'.$Action['Caption'].'" src="'.357 $Output .= '<a href="'.$this->System->Link($Action['URL']).'&i='.$Row['Id'].'"><img alt="'.$Action['Caption'].'" title="'.$Action['Caption'].'" src="'. 378 358 $this->System->Link('/images/action.png').'"/></a>'; 379 359 } … … 399 379 function ShowMenuItem($Parent) 400 380 { 381 $DbResult = $this->Database->query('SELECT `MenuItem`.`Id`, `MenuItem`.`Name`, `MenuItem`.`Parent`, `Action`.`URL` AS `URL`, `ActionIcon`.`Name` AS `IconName` FROM `MenuItem` '. 382 'LEFT JOIN `Action` ON `Action`.`Id` = `MenuItem`.`Action` '. 383 'LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '. 384 'ORDER BY `MenuItem`.`Parent`,`MenuItem`.`Name`'); 385 while($DbRow = $DbResult->fetch_assoc()) 386 { 387 $this->MenuItems[$DbRow['Id']] = $DbRow; 388 } 389 401 390 $Output = '<ul style="list-style: none; margin-left:1em; padding-left:0em;">'; 402 391 foreach($this->MenuItems as $MenuItem)
Note:
See TracChangeset
for help on using the changeset viewer.