Changeset 8 for types/PointerOneToOne.php
- Timestamp:
- Sep 29, 2008, 2:35:42 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
types/PointerOneToOne.php
r6 r8 1 1 <?php 2 2 3 function TypePointerOneToOneViewHtml($Type, $ Parameter, $Table, $Id)3 function TypePointerOneToOneViewHtml($Type, $Item) 4 4 { 5 5 global $Database, $Lists; 6 6 7 //print_r($Type); 7 8 $Output = ''; 8 9 $Columns = ''; 9 foreach($Lists[$Type['Parameter']]['Items'] as $ListItem) 10 $ItemType = explode(':', $Item['Type']); 11 $TargetTable = $ItemType[1]; 12 13 foreach($Lists[$TargetTable]['Items'] as $ListItem) 10 14 if($ListItem['VisibleInPointer'] == 1) $Columns .= '`'.$ListItem['Name'].'`," ",'; 11 15 $Columns = 'CONCAT('.substr($Columns, 0, -1).') AS Name, Id'; 12 $DbResult = $Database->select($T ype['Parameter'], $Columns, 'Id='.$Parameter);16 $DbResult = $Database->select($TargetTable, $Columns, 'Id='.$Item['Value']); 13 17 //echo($Database->LastQuery); 14 18 if($DbResult->num_rows > 0) 15 19 { 16 20 $DbRow = $DbResult->fetch_array(); 17 $Output = '<a href="?Action=ViewItem&Table='.$T ype['Parameter'].'&Item='.$DbRow['Id'].'">'.$DbRow['Name'].'</a>';21 $Output = '<a href="?Action=ViewItem&Table='.$TargetTable.'&Item='.$DbRow['Id'].'">'.$DbRow['Name'].'</a>'; 18 22 } 19 23 return($Output); 20 24 } 21 25 22 function TypePointerOneToOneEditHtml($Type, $ Parameter, $Table, $Id)26 function TypePointerOneToOneEditHtml($Type, $Item) 23 27 { 24 28 global $Database, $Lists; 25 29 26 $Output = '<select name=" %name%">';30 $Output = '<select name="'.$Item['Name'].'">'; 27 31 $Columns = ''; 28 foreach($Lists[$Type['Parameter']]['Items'] as $ListItem) 32 $ItemType = explode(':', $Item['Type']); 33 $TargetTable = $ItemType[1]; 34 foreach($Lists[$TargetTable]['Items'] as $ListItem) 29 35 if($ListItem['VisibleInPointer'] == 1) $Columns .= '`'.$ListItem['Name'].'`," ",'; 30 36 $Columns = 'CONCAT('.substr($Columns, 0, -1).') AS Name, Id'; 31 $DbResult = $Database->select($T ype['Parameter'], $Columns);37 $DbResult = $Database->select($TargetTable, $Columns); 32 38 //echo($Database->LastQuery); 33 39 while($DbRow = $DbResult->fetch_array())
Note:
See TracChangeset
for help on using the changeset viewer.