Legend:
- Unmodified
- Added
- Removed
-
base.php
r18 r19 58 58 59 59 $DbResult = $Database->query('SELECT t1.* FROM `'.$List['TableName'].'` AS t1 LEFT JOIN `'.$List['TableName'].'` AS t2 ON t1.ItemId=t2.ItemId AND t1.Id < t2.Id WHERE (t2.ItemId IS NULL)'.$Where.' LIMIT '.($Page * $Config['Web']['ItemsPerPage']).', '.$Config['Web']['ItemsPerPage']); 60 //echo($Database->LastQuery); 60 61 while($DbRow = $DbResult->fetch_assoc()) 61 62 { … … 135 136 } 136 137 } 137 //print_r($TypeNames);138 //print_r($Types);139 138 $Item = array('Name' => 'Author', 'Type' => $TypeNames['PointerToUser']); 140 //print_r($Item);141 $ItemType = explode('|', $Types[$Item['Type']]['Parameters']);142 $Type = $Types[$ItemType[0]];143 139 $ItemDefinition = array('Name' => $Item['Name'], 'Value' => $DbRow[$Item['Name']], 'SourceTable' => $List['TableName'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']); 144 if(is_callable($Type['CallbackView'])) $Value = $Type['CallbackView']($Type, $ItemDefinition); 145 else $Value = $Type['CallbackView']; 146 $Output .= '<td>'.$Value.'</td>'; 140 $Output .= '<td>'.ExecuteTypeEvent($Item['Type'], 'OnView', $ItemDefinition).'</td>'; 147 141 148 142 $Output .= '<td>'.$DbRow['CreationTime'].'</td><td>'.$DbRow['DeletionTime'].'</td>'; … … 168 162 if($Types[$Item['Type']]['BaseType'] != 'PointerOneToMany') 169 163 { 170 $DefinitionItems[] = array('Name' => $Index, 'Caption' => $Item['TextBefore'].$Required, 'Value' => $DbRow[$Index], 'SourceTable' => $List['TableName'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']); 164 if($Item['Editable'] == 1) 165 { 166 $DefinitionItems[] = array('Name' => $Index, 'Caption' => $Item['TextBefore'].$Required, 'Value' => $DbRow[$Index], 'SourceTable' => $List['TableName'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']); 167 } else $DefinitionItems[] = array('Name' => $Index, 'Type' => 'Hidden', 'Caption' => '', 'Value' => $DbRow[$Index]); 171 168 } 172 169 } … … 241 238 { 242 239 if($Item['Required'] == 1) $Required = '*'; else $Required = ''; 243 $DefinitionItems[] = array('Name' => $Item['Name'], 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'].$Required, 'Value' => '', 'SourceTable' => $List['TableName'], 'SourceItemId' => 0); 240 if($Item['Editable'] == 1) 241 $DefinitionItems[] = array('Name' => $Item['Name'], 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'].$Required, 'Value' => '', 'SourceTable' => $List['TableName'], 'SourceItemId' => 0); 244 242 } else 245 243 if($Item['Name'] == $Column) … … 308 306 } 309 307 310 function ShowViewItem($List, $Id )308 function ShowViewItem($List, $Id, $Column = '', $ColumnValue = 0) 311 309 { 312 310 global $Database, $Types, $Lists; … … 318 316 { 319 317 $DefinitionItems = array(); 318 $Required = ''; 320 319 foreach($List['Items'] as $Index => $Item) 321 320 { … … 372 371 global $Lists, $Database; 373 372 373 $Output = ''; 374 374 $DbResult = $Database->query('SELECT t1.* FROM `SystemMenu` AS t1 LEFT JOIN `SystemMenu` AS t2 ON t1.ItemId=t2.ItemId AND t1.Id < t2.Id WHERE (t2.ItemId IS NULL) AND (t1.DeletionTime IS NULL)'); 375 375 while($DbRow = $DbResult->fetch_assoc()) … … 421 421 break; 422 422 case 'ViewItem': 423 $Output = ShowViewItem($List, $_SESSION['Item'] );423 $Output = ShowViewItem($List, $_SESSION['Item'], $_SESSION['Column'], $_SESSION['ColumnValue']); 424 424 break; 425 425 case 'AddItem': … … 434 434 case 'ShowList': 435 435 default: 436 $Output = ShowList($List );437 } 438 } else $Output = ShowList($List );436 $Output = ShowList($List, $_SESSION['Column'], $_SESSION['ColumnValue']); 437 } 438 } else $Output = ShowList($List, $_SESSION['Column'], $_SESSION['ColumnValue']); 439 439 } 440 440 return($Output); … … 505 505 function ExecuteTypeEvent($Type, $Event, $Parameters) 506 506 { 507 global $Types ;508 509 $ Callback = 'Type'.$Types[$Type]['BaseType'].$Event;507 global $Types, $TypeDefinitionList; 508 509 $TypeObject = $TypeDefinitionList[$Types[$Type]['BaseType']]; 510 510 //echo($Callback.','); 511 if(is_callable( $Callback)) return($Callback($Parameters));512 else return($ Callback.'('.$Type.')');511 if(is_callable(array($TypeObject, $Event))) return($TypeObject->$Event($Parameters)); 512 else return($Types[$Type]['BaseType'].'->'.$Event.'('.$Type.')'); 513 513 } 514 514
Note:
See TracChangeset
for help on using the changeset viewer.