Changeset 639 for trunk/Modules/IS/IS.php
- Timestamp:
- Mar 16, 2014, 1:33:22 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/IS/IS.php
r628 r639 13 13 function Show() 14 14 { 15 if(!$this->System->User->CheckPermission('IS', 'Manage')) 15 if(!$this->System->User->CheckPermission('IS', 'Manage')) 16 16 return('Nemáte oprávnění'); 17 17 $this->System->FormManager->ShowRelation = true; 18 18 19 19 if(array_key_exists('a', $_GET)) $Action = $_GET['a']; 20 20 else $Action = ''; … … 23 23 if(array_key_exists('i', $_GET)) $ItemId = $_GET['i']; 24 24 else $ItemId = 0; 25 25 26 26 if($Action == 'list') $Content = $this->ShowList($Table); 27 27 else if($Action == 'select') $Content = $this->ShowSelect($Table); … … 29 29 else if($Action == 'edit') $Content = $this->ShowEdit($Table, $ItemId); 30 30 else if($Action == 'add') $Content = $this->ShowAdd($Table); 31 else if($Action == 'addsub') $Content = $this->ShowAddSub($Table); 31 32 else if($Action == 'view') $Content = $this->ShowView($Table, $ItemId); 32 33 else if($Action == 'delete') $Content = $this->ShowDelete($Table, $ItemId); … … 35 36 { 36 37 $Output = '<table style="width: 100%"><tr><td style="width: 20%; vertical-align: top;">'; 37 $Output .= '<strong>Nabídka:</strong>'.$this->ShowMenu(); 38 $Output .= '<strong>Nabídka:</strong>'.$this->ShowMenu(); 38 39 $Output .= '</td><td style="width: 80%; vertical-align: top;">'; 39 40 $Output .= $Content; 40 41 $Output .= '</td></tr></table>'; 41 42 } else $Output = $Content; 42 43 return($Output); 44 } 45 43 44 return($Output); 45 } 46 46 47 function Dashboard() 47 48 { 48 $Output = '<strong>Nástěnka:</strong><br/>'; 49 $Output = '<strong>Nástěnka:</strong><br/>'; 49 50 $DbResult = $this->Database->select('Task', 'COUNT(*)', 'Progress < 100'); 50 51 $DbRow = $DbResult->fetch_row(); … … 70 71 return($Output); 71 72 } 72 73 73 74 function ShowEdit($Table, $Id) 74 75 { … … 86 87 $Form->Validate(); 87 88 $Form->SaveValuesToDatabase($Id); 88 $Values = $Table.': '.str_replace('=>', '=', str_replace('array', '', var_export($Form->Values, true))); 89 $Values = $Table.': '.str_replace('=>', '=', str_replace('array', '', var_export($Form->Values, true))); 89 90 $this->System->ModuleManager->Modules['Log']->NewRecord('IS', 'Edit', $Values); 90 91 $Output .= $this->SystemMessage('Úprava položky', 'Položka upravena'); 91 $Output .= $this->ShowView($Table, $Id); 92 $Output .= $this->ShowView($Table, $Id); 92 93 } catch (Exception $E) 93 94 { … … 105 106 } 106 107 } 107 } else 108 } else 108 109 { 109 110 $Form = new Form($this->System->FormManager); … … 123 124 return($Output); 124 125 } 125 126 126 127 function ShowDelete($Table, $Id) 127 128 { … … 142 143 $Output .= $this->SystemMessage('Smazání položky', 'Položku se nepodařilo smazat. Pravděpodobně na ni závisejí další položky.'); 143 144 } 144 } else $Output .= $this->SystemMessage('Smazání položky', 'Položka nenalezena'); 145 $Output .= $this->ShowList($Table); 146 return($Output); 147 } 148 149 function ShowAdd($Table )145 } else $Output .= $this->SystemMessage('Smazání položky', 'Položka nenalezena'); 146 $Output .= $this->ShowList($Table); 147 return($Output); 148 } 149 150 function ShowAdd($Table, $Actions = array()) 150 151 { 151 152 $Output = ''; … … 158 159 $Form = new Form($this->System->FormManager); 159 160 $Form->SetClass($Table); 160 $Form->LoadValuesFromForm(); 161 $Form->LoadValuesFromForm(); 161 162 try { 162 163 $Form->Validate(); … … 170 171 $Form->SaveValuesToDatabase(0); 171 172 $Id = $this->Database->insert_id; 172 $Values = $Table.': '.str_replace('=>', '=', str_replace('array', '', var_export($Form->Values, true))); 173 $Values = $Table.': '.str_replace('=>', '=', str_replace('array', '', var_export($Form->Values, true))); 173 174 $this->System->ModuleManager->Modules['Log']->NewRecord('IS', 'Add', $Values); 174 175 $Output .= $this->SystemMessage('Přidání položky', 'Nová položka vytvořena'); 175 $Output .= $this->ShowView($Table, $Id );176 $Output .= $this->ShowView($Table, $Id, $_GET['a'] == 'addsub'); 176 177 if(array_key_exists('AfterInsert', $Form->Definition)) 177 178 { … … 180 181 $this->Values = $Class->$Method($Form); 181 182 } 182 //$this->Database->update($Table, 'Id='.$Id, 183 // array('UserCreate' => $this->System->User->User['Id'], 183 // Add action to update caller form 184 if($_GET['a'] == 'addsub') 185 { 186 $Type = $this->System->FormManager->FormTypes[$_GET['rt']]; 187 $DbResult = $this->Database->select($Table, '('.$Type['Name'].') AS Name', 'Id='.$Id); 188 $DbRow = $DbResult->fetch_assoc(); 189 $Actions[] = '<a href="javascript:window.close();" onclick="add_select_item('.$Id.',"'.$DbRow['Name'].'","'. 190 $_GET['r'].'"); set_return('.$Id.',"'. 191 $_GET['r'].'");"><img alt="Vybrat" title="Vybrat" src="'. 192 $this->System->Link('/images/select.png').'"/> Vybrat</a>'; 193 } 194 195 //$this->Database->update($Table, 'Id='.$Id, 196 // array('UserCreate' => $this->System->User->User['Id'], 184 197 // 'TimeCreate' => 'NOW()')); 185 198 } catch (Exception $E) … … 188 201 $Form->OnSubmit = '?a=add&t='.$Table.'&o=save'; 189 202 $Output .= $Form->ShowEditForm(); 190 $Output .= '<ul class="ActionMenu">'; 191 $Output .= '<li><a href="?a=list&t='.$Table.'"><img alt="Seznam" title="Seznam" src="'. 192 $this->System->Link('/images/list.png').'"/>Seznam</a></li>'; 193 $Output .= '</ul>'; 203 $Actions[] = '<a href="?a=list&t='.$Table.'"><img alt="Seznam" title="Seznam" src="'. 204 $this->System->Link('/images/list.png').'"/>Seznam</a>'; 194 205 } 195 206 } 196 } else 207 } else 197 208 { 198 209 $Form = new Form($this->System->FormManager); 199 210 $Form->SetClass($Table); 200 // Check preset name and value 201 if(array_key_exists('pn', $_GET) and array_key_exists('pv', $_GET)) 202 $Form->Values[$_GET['pn']] = $_GET['pv']; 203 $Form->OnSubmit = '?a=add&t='.$Table.'&o=save'; 211 // Load presets from URL 212 foreach($_GET as $Key => $Value) 213 if(substr($Key, 0, 6) == 'preset') 214 { 215 $Key = substr($Key, 6); 216 if(($Key != '') and array_key_exists($Key, $Form->Values)) 217 $Form->Values[$Key] = $Value; 218 } 219 if(array_key_exists('r', $_GET)) $URL = '&r='.$_GET['r'].'&rt='.$_GET['rt']; 220 else $URL = ''; 221 $Form->OnSubmit = '?a='.$_GET['a'].'&t='.$Table.'&o=save'.$URL; 204 222 $Output .= $Form->ShowEditForm(); 205 $Output .= '<ul class="ActionMenu">'; 206 $Output .= '<li><a href="?a=list&t='.$Table.'"><img alt="Seznam" title="Seznam" src="'. 207 $this->System->Link('/images/list.png').'"/>Seznam</a></li>'; 208 $Output .= '</ul>'; 209 } 210 return($Output); 211 } 212 213 function ShowView($Table, $Id) 223 $Actions[] = '<a href="?a=list&t='.$Table.'"><img alt="Seznam" title="Seznam" src="'. 224 $this->System->Link('/images/list.png').'"/>Seznam</a>'; 225 } 226 $Output .= '<ul class="ActionMenu">'; 227 foreach($Actions as $Action) 228 { 229 $Output .= '<li>'.$Action.'</li>'; 230 } 231 $Output .= '</ul>'; 232 return($Output); 233 } 234 235 function ShowAddSub($Table, $Filter = '', $Title = '') 236 { 237 if(defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Write')) 238 return('Nemáte oprávnění'); 239 $this->BasicHTML = true; 240 $this->HideMenu = true; 241 $Output = $this->ShowAdd($Table); 242 return($Output); 243 } 244 245 function ShowView($Table, $Id, $WithoutActions = false) 214 246 { 215 247 if($Table != '') $FormClass = $this->System->FormManager->Classes[$Table]; … … 217 249 if(defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Read')) 218 250 return('Nemáte oprávnění'); 219 251 220 252 $Form = new Form($this->System->FormManager); 221 253 $Form->SetClass($Table); … … 223 255 $Form->OnSubmit = '?a=view'; 224 256 $Output = $Form->ShowViewForm(); 257 if($WithoutActions == false) 258 { 259 $Actions = array( 260 '<a href="?a=edit&t='.$Table.'&i='.$Id.'"><img alt="Upravit" title="Upravit" src="'. 261 $this->System->Link('/images/edit.png').'"/>Upravit</a>', 262 '<a href="?a=list&t='.$Table.'"><img alt="Seznam" title="Seznam" src="'. 263 $this->System->Link('/images/list.png').'"/>Seznam</a>', 264 '<a href="?a=delete&t='.$Table.'&i='.$Id.'" onclick="return confirmAction(\'Opravdu smazat položku?\');"><img alt="Odstranit" title="Odstranit" src="'. 265 $this->System->Link('/images/delete.png').'" />Odstranit</a>', 266 '<a href="?a=add&t='.$Table.'"><img alt="Přidat" title="Přidat" src="'. 267 $this->System->Link('/images/add.png').'"/>Přidat</a>'); 268 if(array_key_exists('ItemActions', $FormClass)) 269 { 270 foreach($FormClass['ItemActions'] as $Action) 271 { 272 $URL = $this->System->Link($Action['URL']); 273 if(strpos($URL, '?') === false) $URL .= '?'; 274 else if((substr($URL, -5, 5) !== '&') and (substr($URL, -1, 1) !== '?')) $URL .= '&'; 275 $URL .= 'i='.$Id; 276 $Actions[] = '<a href="'.$URL.'"><img alt="'.$Action['Caption'].'" title="'.$Action['Caption'].'" src="'. 277 $this->System->Link('/images/action.png').'"/>'.$Action['Caption'].'</a>'; 278 } 279 } 225 280 $Output .= '<ul class="ActionMenu">'; 226 $Output .= '<li><a href="?a=edit&t='.$Table.'&i='.$Id.'"><img alt="Upravit" title="Upravit" src="'. 227 $this->System->Link('/images/edit.png').'"/>Upravit</a></li>'; 228 $Output .= '<li><a href="?a=list&t='.$Table.'"><img alt="Seznam" title="Seznam" src="'. 229 $this->System->Link('/images/list.png').'"/>Seznam</a></li>'; 230 $Output .= '<li><a href="?a=delete&t='.$Table.'&i='.$Id.'" onclick="return confirmAction(\'Opravdu smazat položku?\');"><img alt="Odstranit" title="Odstranit" src="'. 231 $this->System->Link('/images/delete.png').'" />Odstranit</a></li>'; 232 $Output .= '<li><a href="?a=add&t='.$Table.'"><img alt="Přidat" title="Přidat" src="'. 233 $this->System->Link('/images/add.png').'"/>Přidat</a></li>'; 234 if(array_key_exists('ItemActions', $FormClass)) 235 { 236 foreach($FormClass['ItemActions'] as $Action) 237 { 238 $URL = $this->System->Link($Action['URL']); 239 if(strpos('?', $URL) === false) $URL .= '?'; 240 else if((substr($URL, -5, 5) !== '&') and (substr($URL, -1, 1) !== '?')) $URL .= '&'; 241 $URL .= '&i='.$Id; 242 $Output .= '<li><a href="'.$URL.'"><img alt="'.$Action['Caption'].'" title="'.$Action['Caption'].'" src="'. 243 $this->System->Link('/images/action.png').'"/>'.$Action['Caption'].'</a></li>'; 244 } 245 } 281 foreach($Actions as $Action) 282 { 283 $Output .= '<li>'.$Action.'</li>'; 284 } 246 285 $Output .= '</ul><br/>'; 247 286 248 287 // Show ManyToOne relations 249 288 foreach($Form->Definition['Items'] as $Index => $Item) 250 if((array_key_exists($Item['Type'], $this->System->FormManager->FormTypes) and 289 if((array_key_exists($Item['Type'], $this->System->FormManager->FormTypes) and 251 290 ($this->System->FormManager->FormTypes[$Item['Type']]['Type'] == 'ManyToOne'))) 252 291 { 253 292 $Output .= $this->ShowList($this->System->FormManager->FormTypes[$Item['Type']]['Table'], '`'. 254 $this->System->FormManager->FormTypes[$Item['Type']]['Ref'].'`='.$Id, $Item['Caption'], 293 $this->System->FormManager->FormTypes[$Item['Type']]['Ref'].'`='.$Id, $Item['Caption'], 255 294 $this->System->FormManager->FormTypes[$Item['Type']]['Ref'], $Id).'<br/>'; 256 } 257 return($Output); 258 } 259 295 } 296 } 297 return($Output); 298 } 299 260 300 function ShowTable($Table, $Filter = '', $Title = '', $RowActions = array(), $ExcludeColumn = '') 261 { 301 { 262 302 if($Table != '') $FormClass = $this->System->FormManager->Classes[$Table]; 263 303 else return($this->SystemMessage('Chyba', 'Tabulka nenalezena')); … … 271 311 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 272 312 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 273 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 313 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 274 314 { 275 315 $UseType = $UseType = $FormItem['Type']; 276 316 if(array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes)) 277 317 { 278 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList)) 279 $this->System->FormManager->Type->RegisterType($FormItem['Type'], '', 318 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList)) 319 $this->System->FormManager->Type->RegisterType($FormItem['Type'], '', 280 320 $this->System->FormManager->FormTypes[$FormItem['Type']]); 281 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference') 321 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference') 282 322 $UseType = 'OneToMany'; 283 else 284 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration') 323 else 324 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration') 285 325 $UseType = 'Enumeration'; 286 326 } … … 290 330 $UserFilter .= ' AND ('.$FilterName.' LIKE "%'.$_POST['Filter'.$ItemIndex].'%")'; 291 331 } 292 } 332 } 293 333 if(($Filter == '') and ($UserFilter != '')) $Filter = '1 '.$UserFilter; 294 334 if($Filter != '') $Filter = ' WHERE '.$Filter; 295 335 296 336 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 297 337 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or … … 315 355 if(array_key_exists('Filter'.$ItemIndex, $_POST) and ($_POST['Filter'.$ItemIndex] != '')) 316 356 $Value = $_POST['Filter'.$ItemIndex]; 317 else $Value = ''; 357 else $Value = ''; 318 358 if($ItemIndex == 'Id') unset($Columns['Id']); 319 359 320 360 if(!array_key_exists('SQL', $FormItem)) $FormItem['SQL'] = ''; 321 361 else $FormItem['SQL'] = str_replace('#Id', '`'.$FormClass['Table'].'`.`Id`', $FormItem['SQL']); … … 324 364 'Type' => $FormItem['Type'], 'SQL' => $FormItem['SQL'])); 325 365 } 326 366 327 367 // Get total item count in database 328 368 $Query = 'SELECT COUNT(*) FROM `'.$FormClass['Table'].'`'; … … 330 370 $DbRow = $DbResult->fetch_assoc(); 331 371 $TotalCount = $DbRow['COUNT(*)']; 332 372 333 373 // Get total filtered item count in database 334 374 $Columns = implode(',', $Columns); 335 if($Filter != '') 375 if($Filter != '') 336 376 { 337 377 $Query = 'SELECT COUNT(*) FROM (SELECT '.$Columns.' FROM `'.$FormClass['Table'].'`) AS `TS` '.$Filter; … … 340 380 $TotalFilteredCount = $DbRow[0]; 341 381 } else $TotalFilteredCount = $TotalCount; 342 $PageList = GetPageList($TotalFilteredCount); 382 $PageList = GetPageList($TotalFilteredCount); 343 383 344 384 $Output = '<div style="text-align: center;">'.$FormClass['Title'].'</div>'; 345 385 $Output .= $PageList['Output']; 346 386 $Output .= '<table class="WideTable" style="font-size: small;">'; 347 387 348 388 $TableColumns[] = array('Name' => '', 'Title' => 'Akce'); 349 389 if(!array_key_exists('DefaultSortColumn', $FormClass)) … … 351 391 $Order = GetOrderTableHeader($TableColumns, $FormClass['DefaultSortColumn'], 0); 352 392 $Output .= $Order['Output']; 353 393 354 394 // Show search fields 355 395 if(array_key_exists('r', $_GET)) $Addition = '&r='.$_GET['r']; … … 364 404 if(array_key_exists('Filter'.$ItemIndex, $_POST) and ($_POST['Filter'.$ItemIndex] != '')) 365 405 $Value = $_POST['Filter'.$ItemIndex]; 366 else $Value = ''; 367 $Output .= '<td><input type="text" name="Filter'.$ItemIndex.'" value="'.$Value.'" style="width: 100%"/></td>'; 406 else $Value = ''; 407 $Output .= '<td><input type="text" name="Filter'.$ItemIndex.'" value="'.$Value.'" style="width: 100%"/></td>'; 368 408 } 369 409 $Output .= '<td><input type="Submit" value="Hledat"/></td></form></tr>'; 370 410 371 411 // Load and show items 372 412 $Query = 'SELECT * FROM (SELECT '.$Columns.' FROM `'.$FormClass['Table'].'`) AS `TS` '. 373 $Filter.' '.$Order['SQL'].$PageList['SQLLimit']; 413 $Filter.' '.$Order['SQL'].$PageList['SQLLimit']; 374 414 $VisibleItemCount = 0; 375 415 $DbResult = $this->Database->query($Query); 376 while($Row = $DbResult->fetch_assoc()) 377 { 416 while($Row = $DbResult->fetch_assoc()) 417 { 378 418 $Output .= '<tr>'; 379 419 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 380 if((!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 381 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 420 if((!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 421 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 382 422 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) and 383 423 ($ExcludeColumn != $ItemIndex)) … … 387 427 if(array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes)) 388 428 { 389 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList)) 390 $this->System->FormManager->Type->RegisterType($FormItem['Type'], '', 429 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList)) 430 $this->System->FormManager->Type->RegisterType($FormItem['Type'], '', 391 431 $this->System->FormManager->FormTypes[$FormItem['Type']]); 392 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference') 432 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference') 393 433 $UseType = 'OneToMany'; 394 else 395 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration') 434 else 435 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration') 396 436 $UseType = 'Enumeration'; 397 437 } 398 $Row[$ItemIndex] = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnLoadDb', 399 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 438 $Row[$ItemIndex] = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnLoadDb', 439 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 400 440 'Type' => $FormItem['Type'])); 401 $Value = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnView', 402 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 441 $Value = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnView', 442 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 403 443 'Type' => $FormItem['Type'], 'Filter' => $Row[$ItemIndex.'_Filter'])); 404 444 if($Value == '') $Value = ' '; … … 415 455 return($Output); 416 456 } 417 457 418 458 function ShowSelect($Table, $Filter = '', $Title = '') 419 { 459 { 420 460 if(defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Read')) 421 461 return('Nemáte oprávnění'); … … 425 465 $_GET['r'].'");"><img alt="Vybrat" title="Vybrat" src="'. 426 466 $this->System->Link('/images/select.png').'"/></a>'; 427 $Output = $this->ShowTable($Table, $Filter, $Title, $RowActions); 428 return($Output); 429 } 430 467 $Output = $this->ShowTable($Table, $Filter, $Title, $RowActions); 468 return($Output); 469 } 470 431 471 function ShowMapSelect($Table, $Filter = '', $Title = '') 432 472 { … … 434 474 return('Nemáte oprávnění'); 435 475 $MapApi = new MapApiGoogle($this->System); 436 $MapApi->Position = array('Lat' => $this->System->Config['Map']['DefaultLatitude'], 476 $MapApi->Position = array('Lat' => $this->System->Config['Map']['DefaultLatitude'], 437 477 'Lng' => $this->System->Config['Map']['DefaultLongitude']); 438 478 $MapApi->Zoom = $this->System->Config['Map']['DefaultZoom']; … … 440 480 $MapApi->OnClickObject = $_GET['r']; 441 481 //$MapApi->ShowMarker = true; 442 $Output = $MapApi->ShowPage($this); 443 return($Output); 444 } 445 446 function ShowList($Table, $Filter = '', $Title = '', $ExcludeColumn = '', $ExcludeValue = '') 482 $Output = $MapApi->ShowPage($this); 483 return($Output); 484 } 485 486 function ShowList($Table, $Filter = '', $Title = '', $ExcludeColumn = '', $ExcludeValue = '') 447 487 { 448 488 if(defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Read')) … … 461 501 { 462 502 $URL = $this->System->Link($Action['URL']); 463 if(strpos( '?', $URL) === false) $URL .= '?';503 if(strpos($URL, '?') === false) $URL .= '?'; 464 504 else if((substr($URL, -5, 5) !== '&') and (substr($URL, -1, 1) !== '?')) $URL .= '&'; 465 $URL .= ' &i=#RowId';505 $URL .= 'i=#RowId'; 466 506 $RowActions .= '<a href="'.$URL.'"><img alt="'.$Action['Caption'].'" title="'.$Action['Caption'].'" src="'. 467 507 $this->System->Link('/images/action.png').'"/></a>'; 468 508 } 469 } 509 } 470 510 $Output = $this->ShowTable($Table, $Filter, $Title, $RowActions, $ExcludeColumn); 471 511 $Output .= '<ul class="ActionMenu">'; 472 $Output .= '<li><a href="?a=add&t='.$Table.'&p n='.$ExcludeColumn.'&pv='.$ExcludeValue.'"><img alt="Přidat" title="Přidat" src="'.512 $Output .= '<li><a href="?a=add&t='.$Table.'&preset'.$ExcludeColumn.'='.$ExcludeValue.'"><img alt="Přidat" title="Přidat" src="'. 473 513 $this->System->Link('/images/add.png').'"/>Přidat</a></li>'; 474 514 $Output .= '<li><a href="?a=list&t='.$Table.'"><img alt="Seznam" title="Seznam" src="'. … … 481 521 } 482 522 $Output .= '</ul>'; 483 return($Output); 484 } 485 523 return($Output); 524 } 525 486 526 function ShowMenu() 487 527 { … … 499 539 return($this->ShowMenuItem('')); 500 540 } 501 541 502 542 function ShowMenuItem($Parent) 503 543 { … … 507 547 { 508 548 $LinkTitle = $MenuItem['Name']; 509 if($MenuItem['URL'] != '') 549 if($MenuItem['URL'] != '') 510 550 { 511 551 if(substr($MenuItem['URL'], 0, 4) != 'http') $MenuItem['URL'] = $this->System->Link($MenuItem['URL']); … … 514 554 if($MenuItem['IconName'] != '') $Image = '<img src="'.$this->System->Link('/images/favicons/'.$MenuItem['IconName']).'"/> '; 515 555 else $Image = '<img src="'.$this->System->Link('/images/favicons/blank.png').'"/> '; 516 //if($this->System->User->CheckPermission($this->TableToModule($Table), 'Write') or !defined('NEW_PERMISSION')) 556 //if($this->System->User->CheckPermission($this->TableToModule($Table), 'Write') or !defined('NEW_PERMISSION')) 517 557 $Output .= '<li>'.$Image.$LinkTitle.'</li>'; 518 558 $Output .= $this->ShowMenuItem($MenuItem['Id']); … … 521 561 return($Output); 522 562 } 523 563 524 564 function TableToModule($Table) 525 565 { … … 529 569 { 530 570 $DbRow = $DbResult->fetch_assoc(); 531 return($DbRow['Name']); 571 return($DbRow['Name']); 532 572 } else return(''); 533 573 } … … 545 585 $this->Description = 'User interface for generic information system'; 546 586 $this->Dependencies = array(); 547 } 587 } 548 588 549 589 function DoInstall() 550 590 { 551 591 } 552 592 553 593 function DoUninstall() 554 { 555 } 556 594 { 595 } 596 557 597 function DoStart() 558 598 { … … 576 616 'Items' => array('Type' => 'TMenuItemListMenu', 'Caption' => 'Položky'), 577 617 ), 578 )); 579 } 580 618 )); 619 } 620 581 621 function DoStop() 582 { 583 } 622 { 623 } 584 624 }
Note:
See TracChangeset
for help on using the changeset viewer.