- Timestamp:
- Oct 11, 2008, 11:06:21 PM (16 years ago)
- Location:
- types
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
types/Hyperlink.php
r8 r9 3 3 function TypeHyperlinkViewHtml($Type, $Item) 4 4 { 5 $Output = '<a href="'.$Item[' Name'].'">'.$Item['Value'].'</a>';5 $Output = '<a href="'.$Item['Value'].'">'.$Item['Value'].'</a>'; 6 6 return($Output); 7 7 } 8 8 9 function TypeHyperlinkEditHtml($Type, $ Parameter, $Table, $Id)9 function TypeHyperlinkEditHtml($Type, $Item) 10 10 { 11 11 $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'">'; -
types/Password.php
r8 r9 1 1 <?php 2 2 3 function TypePasswordViewHtml($Type, $ Parameter, $Table, $Id)3 function TypePasswordViewHtml($Type, $Item) 4 4 { 5 5 $Output = ''; … … 9 9 } 10 10 11 function TypePasswordEditHtml($Type, $ Parameter, $Table, $Id)11 function TypePasswordEditHtml($Type, $Item) 12 12 { 13 13 $Output = '<input type="password" name="'.$Item['Name'].'" value="'.$Item['Value'].'">'; -
types/PointerOneToOne.php
r8 r9 1 1 <?php 2 2 3 function TypePointerOneToOneViewHtml($Type, $Item)3 function GetTablePointerName($Type, $Item) 4 4 { 5 5 global $Database, $Lists; 6 6 7 //print_r($Type);8 $Output = '';9 7 $Columns = ''; 10 8 $ItemType = explode(':', $Item['Type']); … … 18 16 if($DbResult->num_rows > 0) 19 17 { 20 $DbRow = $DbResult->fetch_array(); 21 $Output = '<a href="?Action=ViewItem&Table='.$TargetTable.'&Item='.$DbRow['Id'].'">'.$DbRow['Name'].'</a>'; 22 } 18 return($DbResult->fetch_assoc()); 19 } else return(''); 20 } 21 22 function GetTablePointerNameList($Type, $Item) 23 { 24 global $Database, $Lists; 25 26 $Columns = ''; 27 $ItemType = explode(':', $Item['Type']); 28 $TargetTable = $ItemType[1]; 29 30 foreach($Lists[$TargetTable]['Items'] as $ListItem) 31 if($ListItem['VisibleInPointer'] == 1) $Columns .= '`'.$ListItem['Name'].'`," ",'; 32 $Columns = 'CONCAT('.substr($Columns, 0, -1).') AS Name, Id'; 33 $DbResult = $Database->select($TargetTable, $Columns); 34 //echo($Database->LastQuery); 35 if($DbResult->num_rows > 0) 36 { 37 $Result = array(); 38 while($DbRow = $DbResult->fetch_assoc()) 39 $Result[] = $DbRow; 40 return($Result); 41 } else return(array()); 42 } 43 44 function TypePointerOneToOneViewHtml($Type, $Item) 45 { 46 global $Database, $Lists; 47 48 $ItemType = explode(':', $Item['Type']); 49 $TargetTable = $ItemType[1]; 50 $TargetName = GetTablePointerName($Type, $Item); 51 $Output = '<a href="?Action=ViewItem&Table='.$TargetTable.'&Item='.$TargetName['Id'].'">'.$TargetName['Name'].'</a>'; 23 52 return($Output); 24 53 } … … 29 58 30 59 $Output = '<select name="'.$Item['Name'].'">'; 31 $Columns = ''; 32 $ItemType = explode(':', $Item['Type']); 33 $TargetTable = $ItemType[1]; 34 foreach($Lists[$TargetTable]['Items'] as $ListItem) 35 if($ListItem['VisibleInPointer'] == 1) $Columns .= '`'.$ListItem['Name'].'`," ",'; 36 $Columns = 'CONCAT('.substr($Columns, 0, -1).') AS Name, Id'; 37 $DbResult = $Database->select($TargetTable, $Columns); 60 $TargetNameList = GetTablePointerNameList($Type, $Item); 38 61 //echo($Database->LastQuery); 39 while($DbRow = $DbResult->fetch_array())62 foreach($TargetNameList as $TargetName) 40 63 { 41 if($ Parameter == $DbRow['Id']) $Selected = ' selected="1"'; else $Selected = '';42 $Output .= '<option value="'.$ DbRow['Id'].'"'.$Selected.'>'.$DbRow['Name'].'</option>';64 if($Item['Value'] == $TargetName['Id']) $Selected = ' selected="1"'; else $Selected = ''; 65 $Output .= '<option value="'.$TargetName['Id'].'"'.$Selected.'>'.$TargetName['Name'].'</option>'; 43 66 } 44 67 $Output .= '</select>';
Note:
See TracChangeset
for help on using the changeset viewer.