Changeset 42 for trunk/Base/Types/PointerOneToOne.php
- Timestamp:
- Nov 24, 2009, 9:13:38 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Base/Types/PointerOneToOne.php
r40 r42 1 1 <?php 2 3 include_once(dirname(__FILE__).'/Base.php'); 2 4 3 5 class TypePointerOneToOne extends TypeBase … … 5 7 function OnView($Item) 6 8 { 7 global $TypeDefinitionList; 8 9 $Type = $TypeDefinitionList[$Item['Type']]; 10 $DbResult = $this->Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name FROM `'.$Type['Parameters']['Table'].'` WHERE `'.$Type['Parameters']['Id'].'`='.$Item['Value']); 9 $Type = $this->System->Type->TypeDefinitionList[$Item['Type']]; 10 $DbResult = $this->System->Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name FROM `'.$Type['Parameters']['Table'].'` WHERE `'.$Type['Parameters']['Id'].'`='.$Item['Value']); 11 11 $DbRow = $DbResult->fetch_assoc(); 12 $Output = $DbRow['Name']; 13 14 /* $Type = GetTypeDefinition($Item['Type']); 15 $List = GetListDefinition($Type['Parameters'][0]); 16 $TargetTable = $Type['Parameters'][0]; 17 $TargetName = $this->GetTablePointerName($Type, $Item); 18 if($TargetName != '') $Output = '<a href="?Action=ViewItem&Table='.$TargetTable.'&Item='.$TargetName[$List['IdName']].'">'.$TargetName['Name'].'</a>'; 19 else $Output = ''; 20 */ 12 if($this->System->Modules['Permission']->Check('Corporation', 'Show')) 13 $Output = $this->System->HTML->MakeLink($DbRow['Name'], $this->System->MakeLink($Type['Parameters']['Table'], 'Show', array('Id' => $Item['Value']))); 14 else $Output = $DbRow['Name']; 21 15 return($Output); 22 16 } … … 24 18 function OnEdit($Item) 25 19 { 26 global $TypeDefinitionList;27 28 20 $Output = '<select name="'.$Item['Name'].'">'; 29 $Type = $ TypeDefinitionList[$Item['Type']];21 $Type = $this->System->Type->TypeDefinitionList[$Item['Type']]; 30 22 if(array_key_exists('Condition', $Type['Parameters'])) $Where = ' WHERE '.$Type['Parameters']['Condition']; 31 23 else $Where = ''; 32 $DbResult = $this-> Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name,'.$Type['Parameters']['Id'].' AS Id FROM `'.$Type['Parameters']['Table'].'`'.$Where.' ORDER BY Name DESC');24 $DbResult = $this->System->Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name,'.$Type['Parameters']['Id'].' AS Id FROM `'.$Type['Parameters']['Table'].'`'.$Where.' ORDER BY Name DESC'); 33 25 while($DbRow = $DbResult->fetch_assoc()) 34 26 {
Note:
See TracChangeset
for help on using the changeset viewer.