Changeset 7 for trunk/Packages/Common/Form/Types/OneToMany.php
- Timestamp:
- Apr 14, 2020, 11:13:32 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/Form/Types/OneToMany.php
r1 r7 10 10 { 11 11 $Type = $this->FormManager->Type->TypeDefinitionList[$Item['Type']]; 12 if ($Item['Value'] != '')12 if ($Item['Value'] != '') 13 13 { 14 14 $Output = '<a href="?t='.$Type['Parameters']['Table'].'&a='. 15 15 'view'.'&i='.$Item['Value'].'">'.$Item['Filter'].'</a>'; 16 16 } else $Output = ''; 17 return ($Output);17 return $Output; 18 18 } 19 19 … … 22 22 $Output = '<select name="'.$Item['Name'].'" id="'.$Item['Name'].'">'; 23 23 $Type = $this->FormManager->Type->TypeDefinitionList[$Item['Type']]; 24 if (array_key_exists('Condition', $Type['Parameters'])) $Where = ' WHERE '.$Type['Parameters']['Condition'];24 if (array_key_exists('Condition', $Type['Parameters'])) $Where = ' WHERE '.$Type['Parameters']['Condition']; 25 25 else $Where = ''; 26 if (array_key_exists('Null', $Item) and $Item['Null'])26 if (array_key_exists('Null', $Item) and $Item['Null']) 27 27 { 28 if ($Item['Value'] == NULL) $Selected = ' selected="1"'; else $Selected = '';28 if ($Item['Value'] == NULL) $Selected = ' selected="1"'; else $Selected = ''; 29 29 $Output .= '<option value=""'.$Selected.'></option>'; 30 30 } 31 if (array_key_exists('View', $Type['Parameters'])) $Table = $Type['Parameters']['View'];31 if (array_key_exists('View', $Type['Parameters'])) $Table = $Type['Parameters']['View']; 32 32 else $Table = $Type['Parameters']['Table']; 33 33 $DbResult = $this->Database->query('SELECT '.$Type['Parameters']['Name'].' AS `Name`,'.$Type['Parameters']['Id'].' AS `Id` FROM '.$Table.''.$Where.' ORDER BY `Name`'); 34 while ($DbRow = $DbResult->fetch_assoc())34 while ($DbRow = $DbResult->fetch_assoc()) 35 35 { 36 if ($Item['Value'] == $DbRow['Id']) $Selected = ' selected="1"'; else $Selected = '';36 if ($Item['Value'] == $DbRow['Id']) $Selected = ' selected="1"'; else $Selected = ''; 37 37 $Output .= '<option value="'.$DbRow['Id'].'"'.$Selected.'>'.$DbRow['Name'].'</option>'; 38 38 } 39 39 $Output .= '</select>'; 40 if ($this->FormManager->ShowRelation)40 if ($this->FormManager->ShowRelation) 41 41 { 42 42 $URL = ''; 43 if (array_key_exists('OnPreset', $Item))43 if (array_key_exists('OnPreset', $Item)) 44 44 { 45 45 $Preset = call_user_func($Item['OnPreset'], $Item['Values']); … … 51 51 'onclick="return popupwindow("'.$this->FormManager->Root.'/is/?a=select&t='.$Table.'&r='.$Item['Name'].'","test");" style="cursor:hand;cursor:pointer"/>'; 52 52 } 53 return ($Output);53 return $Output; 54 54 } 55 55 56 56 function OnLoad($Item) 57 57 { 58 if ($_POST[$Item['Name']] == '') return(NULL);59 else return ($_POST[$Item['Name']]);58 if ($_POST[$Item['Name']] == '') return NULL; 59 else return $_POST[$Item['Name']]; 60 60 } 61 61 62 62 function OnLoadDb($Item) 63 63 { 64 if ($Item['Value'] == '') return(NULL);65 else return ($Item['Value']);64 if ($Item['Value'] == '') return NULL; 65 else return $Item['Value']; 66 66 } 67 67 68 68 function OnFilterName($Item) 69 69 { 70 return ('`'.$Item['Name'].'_Filter`');70 return '`'.$Item['Name'].'_Filter`'; 71 71 } 72 72 … … 74 74 { 75 75 $Type = $this->FormManager->Type->TypeDefinitionList[$Item['Type']]; 76 //if ($Item['Value'] != '')76 //if ($Item['Value'] != '') 77 77 //{ 78 if (array_key_exists('View', $Type['Parameters'])) $Table = $Type['Parameters']['View'];78 if (array_key_exists('View', $Type['Parameters'])) $Table = $Type['Parameters']['View']; 79 79 else $Table = $Type['Parameters']['Table']; 80 80 $Output = '`'.$Item['Name'].'`, (SELECT '.$Type['Parameters']['Name'].''. … … 82 82 $Type['Parameters']['Id'].'`=`TX`.`'.$Item['Name'].'`) AS `'.$Item['Name'].'_Filter`'; 83 83 //} else $Output = '`'.$Item['Name'].'`, `'.$Item['Name'].'` AS `'.$Item['Name'].'_Filter`'; 84 return ($Output);84 return $Output; 85 85 } 86 86 }
Note:
See TracChangeset
for help on using the changeset viewer.