Changeset 29
- Timestamp:
- Dec 9, 2008, 1:24:32 PM (16 years ago)
- Files:
-
- 6 added
- 18 edited
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) -
forms.php
r21 r29 13 13 $Output = '<center><form enctype="multipart/form-data" action="'.$this->OnSubmit.'" method="post"><div align="center">'; 14 14 $Table = $this->ShowEditBlock(); 15 $Output .= $this->Definition['Title'].Table($Table).$this->ShowHiddenBlock().'<input type="submit" value="'.$this->Definition['SubmitBu ffonText'].'"></div></form>';15 $Output .= $this->Definition['Title'].Table($Table).$this->ShowHiddenBlock().'<input type="submit" value="'.$this->Definition['SubmitButtonText'].'"></div></form>'; 16 16 return($Output); 17 17 } -
lists/SystemListItem.php
r28 r29 3 3 class ListSystemListItem 4 4 { 5 function RebuildOrder( )5 function RebuildOrder($List) 6 6 { 7 7 global $Database; 8 8 9 $Database->query('UPDATE SystemListItem AS Table1 SET Sequence = (SELECT COUNT(*) FROM (SELECT * FROM SystemListItem) AS Table2 WHERE ((Table2.Sequence < Table1.Sequence) OR ((Table1.Sequence = Table2.Sequence) AND (Table2.Id < Table1.Id))))'); 9 $Database->query('SET @I = 0;'); 10 $Database->query('UPDATE `SystemListItem` SET `Sequence` = (@I := @I + 1) WHERE `List`='.$List.' ORDER BY `Sequence`;'); 10 11 } 11 12 … … 15 16 16 17 //print_r($Parameters); 17 $DbResult = $Database->query('SELECT DbDataType FROM SystemTypeWHERE Id='.$Parameters['Type']);18 $DbResult = $Database->query('SELECT `DbDataType` FROM `SystemType` WHERE Id='.$Parameters['Type']); 18 19 //echo($Database->LastQuery); 19 20 $DbRow = $DbResult->fetch_assoc(); 20 $DbResult = $Database->query('SELECT TableName FROM SystemListWHERE Id='.$Parameters[$Parameters['Column']]);21 $DbResult = $Database->query('SELECT `TableName` FROM `SystemList` WHERE Id='.$Parameters[$Parameters['Column']]); 21 22 //echo($Database->LastQuery); 22 23 $DbRow2 = $DbResult->fetch_assoc(); … … 24 25 //echo($Database->LastQuery); 25 26 26 $this->RebuildOrder( );27 $this->RebuildOrder($Parameters['List']); 27 28 } 28 29 29 30 function OnEdit($Parameters) 30 31 { 31 $this->RebuildOrder( );32 $this->RebuildOrder($Parameters['List']); 32 33 } 33 34 34 35 function OnDelete($Parameters) 35 36 { 36 $this->RebuildOrder( );37 $this->RebuildOrder($Parameters['List']); 37 38 } 38 39 } -
types/Boolean.php
r22 r29 1 1 <?php 2 2 3 class TypeBoolean 3 class TypeBoolean extends TypeBase 4 4 { 5 var $DatabaseCompareOperators = array('Rovno' => '=', 'Nerovno' => '!='); 6 5 7 function OnView($Item) 6 8 { -
types/Date.php
r22 r29 1 1 <?php 2 2 3 class TypeDate 3 class TypeDate extends TypeBase 4 4 { 5 var $DatabaseCompareOperators = array('Rovno' => '=', 'Nerovno' => '!=', 'Menší' => '<', 'Větší' => '>'); 6 5 7 function OnView($Item) 6 8 { … … 50 52 return($_POST[$Item['Name'].'-year'].'-'.$_POST[$Item['Name'].'-month'].'-'.$_POST[$Item['Name'].'-day']); 51 53 } 54 55 function DatabaseEscape($Value) 56 { 57 return('"'.addslashes($Value).'"'); 58 } 52 59 } 53 60 -
types/DateTime.php
r22 r29 1 1 <?php 2 2 3 class TypeDateTime 3 class TypeDateTime extends TypeBase 4 4 { 5 var $DatabaseCompareOperators = array('Rovno' => '=', 'Nerovno' => '!=', 'Menší' => '<', 'Větší' => '>'); 6 5 7 function OnView($Item) 6 8 { … … 79 81 $_POST[$Item['Name'].'-hour'].':'.$_POST[$Item['Name'].'-minute'].':'.$_POST[$Item['Name'].'-second']); 80 82 } 83 84 function DatabaseEscape($Value) 85 { 86 return('"'.addslashes($Value).'"'); 87 } 81 88 } 82 89 -
types/Enumeration.php
r22 r29 1 1 <?php 2 2 3 class TypeEnumeration 3 class TypeEnumeration extends TypeBase 4 4 { 5 5 function OnView($Item) -
types/Float.php
r22 r29 1 1 <?php 2 2 3 class TypeFloat 3 class TypeFloat extends TypeBase 4 4 { 5 var $DatabaseCompareOperators = array('Rovno' => '=', 'Nerovno' => '!=', 'Menší' => '<', 'Větší' => '>'); 6 5 7 function OnView($Item) 6 8 { -
types/GPS.php
r22 r29 1 1 <?php 2 2 3 class TypeGPS 3 class TypeGPS extends TypeBase 4 4 { 5 5 function OnView($Item) -
types/Hidden.php
r22 r29 1 1 <?php 2 2 3 class TypeHidden 3 class TypeHidden extends TypeBase 4 4 { 5 5 function OnView($Item) -
types/Hyperlink.php
r22 r29 1 1 <?php 2 2 3 class TypeHyperlink 3 class TypeHyperlink extends TypeBase 4 4 { 5 5 function OnView($Item) -
types/IPv4Address.php
r22 r29 1 1 <?php 2 2 3 class TypeIPv4Address 3 class TypeIPv4Address extends TypeBase 4 4 { 5 5 function OnView($Item) -
types/Integer.php
r22 r29 1 1 <?php 2 2 3 class TypeInteger 3 class TypeInteger extends TypeBase 4 4 { 5 var $DatabaseCompareOperators = array('Rovno' => '=', 'Nerovno' => '!=', 'Menší' => '<', 'Větší' => '>'); 6 5 7 function OnView($Item) 6 8 { -
types/Password.php
r22 r29 3 3 // SHA1 hash used 4 4 5 class TypePassword 5 class TypePassword extends TypeBase 6 6 { 7 7 function OnView($Item) -
types/PointerOneToMany.php
r22 r29 1 1 <?php 2 2 3 class TypePointerOneToMany 3 class TypePointerOneToMany extends TypeBase 4 4 { 5 5 function OnView($Item) -
types/PointerOneToOne.php
r28 r29 1 1 <?php 2 2 3 class TypePointerOneToOne 3 class TypePointerOneToOne extends TypeBase 4 4 { 5 5 function GetTablePointerName($Type, $Item) -
types/String.php
r22 r29 1 1 <?php 2 2 3 class TypeString 3 class TypeString extends TypeBase 4 4 { 5 var $DatabaseCompareOperators = array('Jako' => 'LIKE', 'Rovno' => '=', 'Nerovno' => '!='); 6 5 7 function OnView($Item) 6 8 { … … 19 21 return($_POST[$Item['Name']]); 20 22 } 23 24 function DatabaseEscape($Value) 25 { 26 return('"'.addslashes($Value).'"'); 27 } 21 28 } 22 29 -
types/include.php
r26 r29 2 2 3 3 // Include type definitions 4 include('types/Base.php'); 4 5 include('types/Enumeration.php'); 5 6 include('types/Boolean.php');
Note:
See TracChangeset
for help on using the changeset viewer.