Changeset 843 for trunk/Modules/IS/IS.php
- Timestamp:
- Jan 1, 2017, 5:03:41 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/IS/IS.php
r837 r843 358 358 return($Output); 359 359 } 360 361 function ShowTabs($Tabs, $QueryParamName, $TabContent) 362 { 363 $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']); 364 365 if(array_key_exists($QueryParamName, $_GET)) $TabIndex = $_GET[$QueryParamName]; 366 else $TabIndex = 0; 367 368 $Output = '<div class="Tab">'. 369 '<ul>'; 370 foreach($Tabs as $Index => $Tab) 371 { 372 $QueryItems[$QueryParamName] = $Index; 373 if($Index == $TabIndex) $Selected = ' id="selected"'; 374 else $Selected = ''; 375 $Output .= '<li'.$Selected.'><a href="?'.SetQueryStringArray($QueryItems).'">'.$Tab.'</a></li>'; 376 } 377 $Output .= '</ul></div><div class="TabContent">'.$TabContent.'</div>'; 378 return($Output); 379 } 360 380 361 381 function ShowView($Table, $Id, $WithoutActions = false) … … 379 399 if($WithoutActions == false) 380 400 { 381 $Actions = array( 382 $this->ShowAction('Upravit', '?a=edit&t='.$TableModify.'&i='.$Id, 383 $this->System->Link('/images/edit.png')), 384 $this->ShowAction('Seznam', '?a=list&t='.$Table, 385 $this->System->Link('/images/list.png')), 386 $this->ShowAction('Odstranit', '?a=delete&t='.$Table.'&i='.$Id, 387 $this->System->Link('/images/delete.png'), 'Opravdu smazat položku?'), 388 $this->ShowAction('Přidat', '?a=add&t='.$TableModify, 389 $this->System->Link('/images/add.png')) 390 ); 391 if(array_key_exists('ItemActions', $FormClass)) 392 { 393 foreach($FormClass['ItemActions'] as $Action) 394 { 395 $URL = str_replace('#RowId', $Id, $this->System->Link($Action['URL'])); 396 $Actions[] = $this->ShowAction($Action['Caption'], $URL, 397 $this->System->Link('/images/action.png')); 398 } 399 } 400 $Output .= '<ul class="ActionMenu">'; 401 foreach($Actions as $Action) 402 { 403 $Output .= '<li>'.$Action.'</li>'; 404 } 405 $Output .= '</ul><br/>'; 401 $Actions = array( 402 $this->ShowAction('Upravit', '?a=edit&t='.$TableModify.'&i='.$Id, 403 $this->System->Link('/images/edit.png')), 404 $this->ShowAction('Seznam', '?a=list&t='.$Table, 405 $this->System->Link('/images/list.png')), 406 $this->ShowAction('Odstranit', '?a=delete&t='.$Table.'&i='.$Id, 407 $this->System->Link('/images/delete.png'), 'Opravdu smazat položku?'), 408 $this->ShowAction('Přidat', '?a=add&t='.$TableModify, 409 $this->System->Link('/images/add.png')) 410 ); 411 if(array_key_exists('ItemActions', $FormClass)) 412 { 413 foreach($FormClass['ItemActions'] as $Action) 414 { 415 $URL = str_replace('#RowId', $Id, $this->System->Link($Action['URL'])); 416 $Actions[] = $this->ShowAction($Action['Caption'], $URL, 417 $this->System->Link('/images/action.png')); 418 } 419 } 420 $Output .= '<ul class="ActionMenu">'; 421 foreach($Actions as $Action) 422 { 423 $Output .= '<li>'.$Action.'</li>'; 424 } 425 $Output .= '</ul><br/>'; 426 } 406 427 407 428 // Show ManyToOne relations 429 $Tabs = array(); 408 430 foreach($Form->Definition['Items'] as $Index => $Item) 409 431 if((array_key_exists($Item['Type'], $this->System->FormManager->FormTypes) and 410 432 ($this->System->FormManager->FormTypes[$Item['Type']]['Type'] == 'ManyToOne'))) 411 433 { 412 $Output .= $this->ShowList($this->System->FormManager->FormTypes[$Item['Type']]['Table'], '`'. 413 $this->System->FormManager->FormTypes[$Item['Type']]['Ref'].'`='.$Id, $Item['Caption'], 414 $this->System->FormManager->FormTypes[$Item['Type']]['Ref'], $Id).'<br/>'; 415 } 416 } 434 $Tabs[] = $Item['Caption']; 435 } 436 $Tabs[] = 'Vše'; 437 if(array_key_exists('tab', $_GET)) $TabIndex = $_GET['tab']; 438 else $TabIndex = 0; 439 440 $TabContent = ''; 441 $I = 0; 442 foreach($Form->Definition['Items'] as $Index => $Item) 443 if((array_key_exists($Item['Type'], $this->System->FormManager->FormTypes) and 444 ($this->System->FormManager->FormTypes[$Item['Type']]['Type'] == 'ManyToOne'))) 445 { 446 $TypeItem = $this->System->FormManager->FormTypes[$Item['Type']]; 447 if (($TabIndex == $I) or ($TabIndex == (count($Tabs) - 1))) 448 { 449 $TabContent .= $this->ShowList($TypeItem['Table'], '`'. 450 $TypeItem['Ref'].'`='.$Id, $Item['Caption'], 451 $TypeItem['Ref'], $Id).'<br/>'; 452 } 453 $I++; 454 } 455 456 $Output .= $this->ShowTabs($Tabs, 'tab', $TabContent); 417 457 return($Output); 418 458 }
Note:
See TracChangeset
for help on using the changeset viewer.