Legend:
- Unmodified
- Added
- Removed
-
base.php
r28 r29 1 1 <?php 2 2 3 function ShowList($List, $Column = '', $ColumnValue = 0, $Title = '' )3 function ShowList($List, $Column = '', $ColumnValue = 0, $Title = '', $Filter = '') 4 4 { 5 5 global $Database, $Config; … … 33 33 $FullListLink = ''; 34 34 } 35 if($Filter != '') $Where .= ' AND '.$Filter; 35 36 36 37 // Handle ordering … … 53 54 //$Where .= ' AND (ValidFromTime <= NOW()) AND ((ValidToTime >= NOW()) OR (ValidToTime IS NULL))'; 54 55 $Where .= ' '.$Order; 55 $DbResult = $Database->query('SELECT COUNT(*) AS Count FROM `'.$List['TableName'].'` WHERE 1'.$Where);56 $DbResult = $Database->query('SELECT COUNT(*) AS Count FROM `'.$List['TableName'].'` WHERE '.$Where); 56 57 $DbRow = $DbResult->fetch_row(); 57 58 $TotalItemCount = $DbRow[0]; … … 177 178 ( 178 179 'Title' => '', 179 'SubmitBu ffonText' => 'Uložit',180 'SubmitButtonText' => 'Uložit', 180 181 'Items' => $DefinitionItems, 181 182 ); … … 214 215 ( 215 216 'Title' => '', 216 'SubmitBu ffonText' => 'Uložit',217 'SubmitButtonText' => 'Uložit', 217 218 'Items' => $DefinitionItems, 218 219 ); … … 258 259 ( 259 260 'Title' => '', 260 'SubmitBu ffonText' => 'Přidat',261 'SubmitButtonText' => 'Přidat', 261 262 'Items' => $DefinitionItems, 262 263 ); … … 299 300 ( 300 301 'Title' => '', 301 'SubmitBu ffonText' => 'Přidat',302 'SubmitButtonText' => 'Přidat', 302 303 'Items' => $DefinitionItems, 303 304 ); … … 404 405 ( 405 406 'Title' => 'Hledání', 406 'SubmitBu ffonText' => 'Vyhledat',407 'SubmitButtonText' => 'Vyhledat', 407 408 'Items' => $DefinitionItems, 408 409 ); … … 417 418 418 419 if(!CheckPermission('Write', $List['Id'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění')); 419 $System->Modules['Log']->Add($List['Id'], $Id, $LogActionType['Delete']); 420 $System->Modules['DatabaseList']->DeleteItem($List['Id'], $Id); 421 $Output = 'Položka smazána.'; 422 $Output .= ShowList($List, $_SESSION['Column'], $_SESSION['ColumnValue']).'<br /><br />'; 423 ExecuteListEvent($List['Id'], 'OnDelete', $Id); 424 return($Output); 425 426 $Output = ShowList($List); 420 $DefinitionItems = array(); 421 $AfterTableOutput = ''; 422 foreach($List['Items'] as $Item) 423 { 424 //echo($Item['Name'].','); 425 $Type = GetTypeDefinition($Item['Type']); 426 if(($Type['BaseType'] != 'PointerOneToMany') and ($Item['Name'] != $Column)) 427 { 428 if($Item['Required'] == 1) $Required = '*'; else $Required = ''; 429 $DefinitionItems[] = array('Name' => $Item['Name'], 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'].$Required, 'Value' => '', 'SourceTable' => $List['Id'], 'SourceItemId' => 0); 430 } else 431 if($Item['Name'] == $Column) 432 { 433 $DefinitionItems[] = array('Name' => $Column, 'Type' => TypeHiddenId, 'Caption' => '', 'Value' => $ColumnValue); 434 } 435 } 436 437 $Form = new Form(); 438 $Form->Definition = array 439 ( 440 'Title' => '', 441 'SubmitButtonText' => 'Přidat', 442 'Items' => $DefinitionItems, 443 ); 444 $Form->LoadValuesFromForm(); 445 $Filter = '1'; 446 print_r($Form); 447 foreach($Form->Definition['Items'] as $Item) 448 { 449 //if($Item['Editable'] == 1) 450 { 451 //echo($Item['Name'].','); 452 $Type = GetTypeDefinition($Item['Type']); 453 $TypeObject = $Type['Class']; 454 $Filter .= ' AND (`'.$Item['Name'].'` LIKE '.$TypeObject->DatabaseEscape($Form->Values[$Item['Name']]).')'; 455 } 456 } 457 echo('d'.$Filter.'d'); 458 $Output = ShowList($List, $_SESSION['Column'], $_SESSION['ColumnValue'], '', $Filter).'<br /><br />'; 427 459 return($Output); 428 460 } … … 476 508 case 'ShowSearch': 477 509 $Output = ShowSearch($List); 510 break; 511 case 'Search': 512 $Output = Search($List); 478 513 break; 479 514 case 'EditItem': … … 620 655 621 656 $Result = FALSE; 622 //return(TRUE);657 return(TRUE); 623 658 $DbResult = $Database->query('SELECT t1.* FROM `Permission` AS t1 WHERE t1.PermissionGroup = (SELECT PermissionGroup.Id FROM PermissionGroup WHERE PermissionGroup.Id=(SELECT User.PermissionGroup FROM User WHERE User.Id='.$System->Modules['User']->User['Id'].')) AND t1.List='.$ListId); 624 659 if($DbResult->num_rows > 0)
Note:
See TracChangeset
for help on using the changeset viewer.