Changeset 23
- Timestamp:
- Oct 22, 2008, 12:54:08 PM (16 years ago)
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
base.php
r22 r23 166 166 { 167 167 $DefinitionItems[] = array('Name' => $Index, 'Caption' => $Item['TextBefore'].$Required, 'Value' => $DbRow[$Index], 'SourceTable' => $List['TableName'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']); 168 } else $DefinitionItems[] = array('Name' => $Index, 'Type' => 'Hidden', 'Caption' => '', 'Value' => $DbRow[$Index]);168 } else $DefinitionItems[] = array('Name' => $Index, 'Type' => TypeHiddenId, 'Caption' => '', 'Value' => $DbRow[$Index]); 169 169 } 170 170 } … … 246 246 if($Item['Name'] == $Column) 247 247 { 248 $DefinitionItems[] = array('Name' => $Column, 'Type' => 'Hidden', 'Caption' => '', 'Value' => $ColumnValue);249 } 250 } 251 $DefinitionItems[] = array('Name' => 'Column', 'Type' => 'Hidden', 'Caption' => '', 'Value' => $Column);248 $DefinitionItems[] = array('Name' => $Column, 'Type' => TypeHiddenId, 'Caption' => '', 'Value' => $ColumnValue); 249 } 250 } 251 $DefinitionItems[] = array('Name' => 'Column', 'Type' => TypeHiddenId, 'Caption' => '', 'Value' => $Column); 252 252 253 253 $Form = new Form(); … … 288 288 if($Item['Name'] == $Column) 289 289 { 290 $DefinitionItems[] = array('Name' => $Column, 'Type' => 'Hidden', 'Caption' => '', 'Value' => $ColumnValue);290 $DefinitionItems[] = array('Name' => $Column, 'Type' => TypeHiddenId, 'Caption' => '', 'Value' => $ColumnValue); 291 291 } 292 292 } … … 468 468 'Items' => $Items, 469 469 ); 470 if(!array_key_exists($List['TableName'], $TypeDefinitionList)) 471 { 472 $ClassName = 'List'.$DbRow['TableName']; 473 if(class_exists($ClassName)) $List['Class'] = new $ClassName; 474 } 470 475 $Lists[$List['TableName']] = $List; 471 476 } else $Lists[$List['TableName']] = NULL; … … 514 519 function ExecuteListEvent($Table, $Event, $Parameters) 515 520 { 516 $Callback = 'List'.$Table.$Event; 517 if(is_callable($Callback)) $Callback($Parameters); 521 $ListDefinition = GetListDefinition($Table); 522 if(array_key_exists('Class', $ListDefinition)) 523 { 524 $ListObject = $ListDefinition['Class']; 525 if(is_callable(array($ListObject, $Event))) return($ListObject->$Event($Parameters)); 526 else return($ListDefinition['TableName'].'->'.$Event.'('.$List.')'); 527 } else return($ListDefinition['TableName'].'->'.$Event.'('.$List.')'); 518 528 } 519 529 -
database.php
r13 r23 17 17 { 18 18 echo('<strong>Database error:</strong> '.$this->error.'<br /><strong>Query:</strong> '.$Query.'<br />'); 19 //echo('<pre>'); print_r(debug_backtrace()); echo('</pre>');19 echo('<pre>'); print_r(debug_backtrace()); echo('</pre>'); 20 20 } 21 21 return($DbResult); -
lists/SystemList.php
r16 r23 1 1 <?php 2 2 3 function ListSystemListOnAdd($Parameters) 3 class ListSystemList 4 4 { 5 global $Database; 5 function OnAdd($Parameters) 6 { 7 global $Database; 6 8 7 $Database->query('CREATE TABLE IF NOT EXISTS `'.$Parameters['TableName'].'` (8 `Id` int(11) NOT NULL auto_increment,9 `ItemId` int(11) NOT NULL,10 `Author` int(11) NOT NULL,11 `ValidTimeFrom` datetime default NULL,12 `ValidTimeTo` datetime default NULL,13 `CreationTime` datetime default NULL,14 `DeletionTime` datetime default NULL,15 PRIMARY KEY (`Id`)16 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;');17 //echo($Database->LastQuery);18 }9 $Database->query('CREATE TABLE IF NOT EXISTS `'.$Parameters['TableName'].'` ( 10 `Id` int(11) NOT NULL auto_increment, 11 `ItemId` int(11) NOT NULL, 12 `Author` int(11) NOT NULL, 13 `ValidTimeFrom` datetime default NULL, 14 `ValidTimeTo` datetime default NULL, 15 `CreationTime` datetime default NULL, 16 `DeletionTime` datetime default NULL, 17 PRIMARY KEY (`Id`) 18 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;'); 19 //echo($Database->LastQuery); 20 } 19 21 20 function ListSystemListOnEdit($Parameters)21 {22 global $Database;22 function ListSystemListOnEdit($Parameters) 23 { 24 global $Database; 23 25 24 $DbResult = $Database->query('SELECT `TableName` FROM `'.$Parameters['ListTableName'].'` WHERE ItemId='.$Parameters['ItemId'].' ORDER BY `Id` DESC LIMIT 1,1'); 25 $DbRow = $DbResult->fetch_assoc(); 26 if($DbRow['TableName'] != $Parameters['TableName']) 27 $Database->query('RENAME TABLE `'.$DbRow['TableName'].'` TO `'.$Parameters['TableName'].'`'); 26 $DbResult = $Database->query('SELECT `TableName` FROM `'.$Parameters['ListTableName'].'` WHERE ItemId='.$Parameters['ItemId'].' ORDER BY `Id` DESC LIMIT 1,1'); 27 $DbRow = $DbResult->fetch_assoc(); 28 if($DbRow['TableName'] != $Parameters['TableName']) 29 $Database->query('RENAME TABLE `'.$DbRow['TableName'].'` TO `'.$Parameters['TableName'].'`'); 30 } 28 31 } 29 32 -
lists/SystemListItem.php
r16 r23 1 1 <?php 2 2 3 function ListSystemListItemOnAdd($Parameters) 3 class ListSystemListItem 4 4 { 5 global $Database; 5 function OnAdd($Parameters) 6 { 7 global $Database; 6 8 7 //print_r($Parameters); 8 $DbResult = $Database->query('SELECT DbDataType FROM SystemType WHERE ItemId='.$Parameters['Type'].' ORDER BY Id DESC LIMIT 1'); 9 //echo($Database->LastQuery); 10 $DbRow = $DbResult->fetch_assoc(); 11 $DbResult = $Database->query('SELECT TableName FROM SystemList WHERE ItemId='.$Parameters[$Parameters['Column']].' ORDER BY Id DESC LIMIT 1'); 12 //echo($Database->LastQuery); 13 $DbRow2 = $DbResult->fetch_assoc(); 14 $Database->query('ALTER TABLE `'.$DbRow2['TableName'].'` ADD `'.$Parameters['Name'].'` '.$DbRow['DbDataType'].' NOT NULL ;'); 15 //echo($Database->LastQuery); 9 //print_r($Parameters); 10 $DbResult = $Database->query('SELECT DbDataType FROM SystemType WHERE ItemId='.$Parameters['Type'].' ORDER BY Id DESC LIMIT 1'); 11 //echo($Database->LastQuery); 12 $DbRow = $DbResult->fetch_assoc(); 13 $DbResult = $Database->query('SELECT TableName FROM SystemList WHERE ItemId='.$Parameters[$Parameters['Column']].' ORDER BY Id DESC LIMIT 1'); 14 //echo($Database->LastQuery); 15 $DbRow2 = $DbResult->fetch_assoc(); 16 $Database->query('ALTER TABLE `'.$DbRow2['TableName'].'` ADD `'.$Parameters['Name'].'` '.$DbRow['DbDataType'].' NOT NULL ;'); 17 //echo($Database->LastQuery); 18 } 16 19 } 17 20 -
types/include.php
r21 r23 17 17 include('types/GPS.php'); 18 18 19 define( TypeIntegerId, 1);20 define( TypeBooleanId, 4);21 define( TypeStringId, 3);22 define( TypeDateId, 2);23 define( TypePasswordId, 15);24 define( TypeFloatId, 16);25 define( TypeHiddenId, 20);26 define( TypePointerToUserId, 37);19 define("TypeIntegerId", 1); 20 define('TypeBooleanId', 4); 21 define('TypeStringId', 3); 22 define('TypeDateId', 2); 23 define('TypePasswordId', 15); 24 define('TypeFloatId', 16); 25 define('TypeHiddenId', 20); 26 define('TypePointerToUserId', 37); 27 27 28 28 ?>
Note:
See TracChangeset
for help on using the changeset viewer.