Changeset 442
- Timestamp:
- Oct 14, 2012, 9:27:26 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Forms.php
r440 r442 33 33 { 34 34 if(!array_key_exists($Item['Type'], $System->Type->TypeDefinitionList)) 35 $System->Type->RegisterType($Item['Type'], '', 36 $FormTypes[$Item['Type']]); 37 if($FormTypes[$Item['Type']]['Type'] == 'Reference') 38 $Edit = ''.$System->Type->ExecuteTypeEvent('OneToMany', 'OnView', 39 array('Value' => $this->Values[$Index], 'Name' => $Index, 40 'Type' => $Item['Type'])).''; 41 else if($FormTypes[$Item['Type']]['Type'] == 'Enumeration') 42 $Edit = ''.$System->Type->ExecuteTypeEvent('Enumeration', 'OnView', 43 array('Value' => $this->Values[$Index], 'Name' => $Index, 44 'Type' => $Item['Type'])).''; 45 } else $Edit = ''.$System->Type->ExecuteTypeEvent($Item['Type'], 'OnView', 46 array('Value' => $this->Values[$Index], 'Name' => $Index)).''; 35 $System->Type->RegisterType($Item['Type'], '', $FormTypes[$Item['Type']]); 36 if($FormTypes[$Item['Type']]['Type'] == 'Reference') 37 $UseType = 'OneToMany'; 38 else if($FormTypes[$Item['Type']]['Type'] == 'Enumeration') 39 $UseType = 'Enumeration'; 40 } else $UseType = $Item['Type']; 41 $Edit = $System->Type->ExecuteTypeEvent($UseType, 'OnView', 42 array('Value' => $this->Values[$Index], 'Name' => $Index, 'Type' => $Item['Type'])); 47 43 array_push($Table['Rows'], array($Item['Caption'].':', $Edit)); 48 44 } … … 63 59 function ShowEditBlock($Context = '') 64 60 { 65 global $Database, $FormTypes ;61 global $Database, $FormTypes, $System; 66 62 67 63 $Table = array( … … 75 71 { 76 72 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 77 switch($Item['Type']) 78 { 79 case 'Boolean': 80 if($this->Values[$Index] == 0) $Checked = ''; else $Checked = ' CHECKED'; 81 $Edit = '<input type="checkbox" name="'.$Context.$Index.'"'.$Checked.' />'; 82 break; 83 case 'String': 84 $Edit = '<input style="width: 98%;" type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'" />'; 85 break; 86 case 'Text': 87 $Edit = '<textarea style="width: 98%; height: 200px;" name="'.$Context.$Index.'">'.$this->Values[$Index].'</textarea>'; 88 break; 89 case 'Password': 90 $Edit = '<input style="width: 98%;" type="password" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'" />'; 91 break; 92 case 'Integer': 93 $Edit = '<input style="width: 98%;" type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'" />'; 94 break; 95 case 'Float': 96 $Edit = '<input style="width: 98%;" type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'" />'; 97 break; 98 case 'Time': 99 if($this->Values[$Index] == 'Now') $this->Values[$Index] = date('G:i:s'); 100 $Edit = '<input style="width: 98%;" type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'" />'; 101 break; 102 case 'Date': 103 if($this->Values[$Index] == 'Now') $this->Values[$Index] = date('j.n.Y'); 104 $Edit = '<input style="width: 98%;" type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'" />'; 105 break; 106 case 'DateTime': 107 if($this->Values[$Index] == 'Now') $this->Values[$Index] = date('j.n.Y G:i:s'); 108 $Edit = '<input style="width: 98%;" type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'" />'; 109 break; 110 case 'Array': 111 $Form = new Form($Item['ItemClass']); 112 $Edit = '<script type="text/javascript" id="syndication">'. 113 "var Count = 0;". 114 "function AddItem() {". 115 "Count = Count + 1;". 116 "var newcontent = document.createElement('div');". 117 "newcontent.id = '".$Context.$Item['ItemClass']."-' + Count;". 118 "newcontent.innerHTML = '<input type=\"hidden\" name=\"".$Context.$Item['ItemClass']."-' + Count + '\">".$Form->ShowEditBlock($Context.$Item['ItemClass']."-' + Count + '")."';". 119 "var scr = document.getElementById('syndication');". 120 "scr.parentNode.insertBefore(newcontent, scr); }". 121 '</script>'; 122 $Edit .= '<form><input type="button" onclick="AddItem();" value="Přidat položku" /></form>'; 123 break; 124 default: 125 if(array_key_exists($Item['Type'], $FormTypes)) 126 { 127 // Custom types 128 switch($FormTypes[$Item['Type']]['Type']) 129 { 130 case 'Enumeration': 131 $Edit = '<select style="width: 100%;" name="'.$Context.$Index.'">'; 132 foreach($FormTypes[$Item['Type']]['States'] as $StateIndex => $StateName) 133 { 134 if($this->Values[$Index] == $StateIndex) $Selected = 'selected="selected"'; 135 else $Selected = ''; 136 $Edit .= '<option value="'.$StateIndex.'"'.$Selected.'>'.$StateName.'</option>'; 137 } 138 $Edit .= '</select>'; 139 break; 140 case 'Reference': 141 $Edit = '<select style="width: 100%;" name="'.$Context.$Index.'">'; 142 $DbResult = $Database->select($FormTypes[$Item['Type']]['Table'], $FormTypes[$Item['Type']]['Id'].' as Id, '.$FormTypes[$Item['Type']]['Name'].' as Name', $FormTypes[$Item['Type']]['Filter'].' ORDER BY Name'); 143 while($Row = $DbResult->fetch_assoc()) 144 { 145 if($Row['Id'] == $this->Values[$Index]) $Selected = ' selected="selected"'; 146 else $Selected = ''; 147 $Edit .= '<option value="'.$Row['Id'].'"'.$Selected.'>'.$Row['Id'].': '.$Row['Name'].'</option>'; 148 } 149 $Edit .= '</select>'; 150 break; 151 default: 152 $Edit = 'Neznámý typ'; 153 } 154 } else $Edit = 'Neznámý typ'; 155 } 73 if(array_key_exists($Item['Type'], $FormTypes)) 74 { 75 if(!array_key_exists($Item['Type'], $System->Type->TypeDefinitionList)) 76 $System->Type->RegisterType($Item['Type'], '', 77 $FormTypes[$Item['Type']]); 78 if($FormTypes[$Item['Type']]['Type'] == 'Reference') 79 $UseType = 'OneToMany'; 80 else if($FormTypes[$Item['Type']]['Type'] == 'Enumeration') 81 $UseType = 'Enumeration'; 82 } else $UseType = $Item['Type']; 83 $Edit = ''.$System->Type->ExecuteTypeEvent($UseType, 'OnEdit', 84 array('Value' => $this->Values[$Index], 'Name' => $Index, 85 'Type' => $Item['Type'])).''; 86 156 87 array_push($Table['Rows'], array($Item['Caption'].':', $Edit)); 157 88 } … … 163 94 function LoadValuesFromDatabase($Id) 164 95 { 165 global $Database, $FormTypes ;96 global $Database, $FormTypes, $System; 166 97 167 98 $DbResult = $Database->query('SELECT T.* FROM '.$this->Definition['Table'].' AS T WHERE T.Id='.$Id); … … 171 102 (array_key_exists($Item['Type'], $FormTypes) and ($FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 172 103 { 173 $this->Values[$Index] = $DbRow[$Index]; 174 switch($Item['Type']) 175 { 176 case 'Password': 177 if($Item['Type'] == 'Password') $this->Values[$Index] = ''; // Dont show password 178 break; 179 case 'Time': 180 $this->Values[$Index] == MysqlDateTimeToTime($this->Values[$Index]); 181 break; 182 } 104 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 105 if(array_key_exists($Item['Type'], $FormTypes)) 106 { 107 if(!array_key_exists($Item['Type'], $System->Type->TypeDefinitionList)) 108 $System->Type->RegisterType($Item['Type'], '', 109 $FormTypes[$Item['Type']]); 110 if($FormTypes[$Item['Type']]['Type'] == 'Reference') 111 $UseType = 'OneToMany'; 112 else if($FormTypes[$Item['Type']]['Type'] == 'Enumeration') 113 $UseType = 'Enumeration'; 114 } else $UseType = $Item['Type']; 115 $this->Values[$Index] = ''.$System->Type->ExecuteTypeEvent($UseType, 'OnLoadDb', 116 array('Value' => $DbRow[$Index], 'Name' => $Index, 117 'Type' => $Item['Type'])).''; 118 119 //echo($DbRow[$Index].'='.$this->Values[$Index].'<br/>'); 183 120 } 184 121 } … … 186 123 function SaveValuesToDatabase($Id) 187 124 { 188 global $Database; 189 190 foreach($this->Definition['Items'] as $Index => $Item) 191 { 192 switch($Item['Type']) 193 { 194 case 'Password': 195 if($this->Values[$Index] == '') unset($this->Values[$Index]); // Do not modify empty passwords 196 else $this->Values[$Index] = sha1($this->Values[$Index]); 197 break; 198 case 'Time': 199 $this->Values[$Index] = TimeToMysqlDateTime($this->Values[$Index]); 200 break; 201 } 125 global $Database, $FormTypes, $System; 126 127 $Values = array(); 128 foreach($this->Definition['Items'] as $Index => $Item) 129 if(!array_key_exists($Item['Type'], $FormTypes) or 130 (array_key_exists($Item['Type'], $FormTypes) and ($FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 131 { 132 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 133 if(array_key_exists($Item['Type'], $FormTypes)) 134 { 135 if(!array_key_exists($Item['Type'], $System->Type->TypeDefinitionList)) 136 $System->Type->RegisterType($Item['Type'], '', 137 $FormTypes[$Item['Type']]); 138 if($FormTypes[$Item['Type']]['Type'] == 'Reference') 139 $UseType = 'OneToMany'; 140 else if($FormTypes[$Item['Type']]['Type'] == 'Enumeration') 141 $UseType = 'Enumeration'; 142 } else $UseType = $Item['Type']; 143 $Values[$Index] = ''.$System->Type->ExecuteTypeEvent($UseType, 'OnSaveDb', 144 array('Value' => $this->Values[$Index], 'Name' => $Index, 145 'Type' => $Item['Type'])).''; 146 147 //echo($DbRow[$Index].'='.$this->Values[$Index].'<br/>'); 202 148 } 203 149 if($Id == 0) 204 150 { 205 $ this->Values['Id'] = $Id;206 $DbResult = $Database->insert($this->Definition['Table'], $ this->Values);151 $Values['Id'] = $Id; 152 $DbResult = $Database->insert($this->Definition['Table'], $Values); 207 153 } else 208 $DbResult = $Database->update($this->Definition['Table'], 'Id='.$Id, $ this->Values);154 $DbResult = $Database->update($this->Definition['Table'], 'Id='.$Id, $Values); 209 155 //echo($Database->LastQuery); 210 156 } … … 217 163 function LoadValuesFromFormBlock($Context = '') 218 164 { 219 global $ FormTypes;165 global $Database, $FormTypes, $System; 220 166 221 167 if($Context != '') $Context = $Context.'-'; … … 223 169 foreach($this->Definition['Items'] as $Index => $Item) 224 170 { 225 if(array_key_exists($Context.$Index, $_POST)) 226 switch($Item['Type']) 227 { 228 case 'Boolean': 229 if(array_key_exists($Context.$Index, $_POST)) $Values[$Index] = 1; 230 else $Values[$Index] = 0; 231 break; 232 case 'String': 233 $Values[$Index] = $_POST[$Context.$Index]; 234 break; 235 case 'Text': 236 $Values[$Index] = $_POST[$Context.$Index]; 237 break; 238 case 'Password': 239 $Values[$Index] = $_POST[$Context.$Index]; 240 break; 241 case 'Integer': 242 $Values[$Index] = $_POST[$Context.$Index]; 243 break; 244 case 'Float': 245 $Values[$Index] = $_POST[$Context.$Index]; 246 break; 247 case 'Time': 248 $Values[$Index] = explode('.', $_POST[$Context.$Index]); 249 $Values[$Index] = mktime(0, 0, 0, $Values[$Index][1], $Values[$Index][0], $Values[$Index][2]); 250 break; 251 case 'Array': 252 $I = 1; 253 //echo('Expect: '.$Context.$Item['ItemClass'].'-'.$I.'<br />'); 254 while(isset($_POST[$Context.$Item['ItemClass'].'-'.$I])) 255 { 256 $Form = new Form($Item['ItemClass']); 257 $Values[$Index][] = $Form->LoadValuesFromFormBlock($Context.$Item['ItemClass'].'-'.$I); 258 $I++; 259 } 260 break; 261 default: 262 if(array_key_exists($Item['Type'], $FormTypes)) 263 { 264 // Custom types 265 switch($FormTypes[$Item['Type']]['Type']) 266 { 267 case 'Enumeration': 268 $Values[$Index] = $_POST[$Context.$Index]; 269 break; 270 case 'Reference': 271 $Values[$Index] = $_POST[$Context.$Index]; 272 break; 273 default: 274 } 275 } 276 } 171 //if(array_key_exists($Context.$Index, $_POST)) 172 if(array_key_exists($Item['Type'], $FormTypes)) 173 { 174 if(!array_key_exists($Item['Type'], $System->Type->TypeDefinitionList)) 175 $System->Type->RegisterType($Item['Type'], '', 176 $FormTypes[$Item['Type']]); 177 if($FormTypes[$Item['Type']]['Type'] == 'Reference') 178 $UseType = 'OneToMany'; 179 else if($FormTypes[$Item['Type']]['Type'] == 'Enumeration') 180 $UseType = 'Enumeration'; 181 } else $UseType = $Item['Type']; 182 $Values[$Index] = ''.$System->Type->ExecuteTypeEvent($UseType, 'OnLoad', 183 array('Name' => $Index, 'Type' => $Item['Type'])).''; 277 184 } 278 185 return($Values); -
trunk/Common/Global.php
r438 r442 290 290 } 291 291 292 function MysqlTimeToTime($Time) 293 { 294 return(MysqlDateTimeToTime('0000-00-00 '.$Time)); 295 } 296 292 297 function HumanDate($Time) 293 298 { -
trunk/Common/Types/Base.php
r428 r442 26 26 } 27 27 28 function OnLoadDb($Item) 29 { 30 return($Item['Value']); 31 } 32 33 function OnSaveDb($Item) 34 { 35 return($Item['Value']); 36 } 37 28 38 function DatabaseEscape($Value) 29 39 { -
trunk/Common/Types/Date.php
r428 r442 11 11 global $MonthNames; 12 12 13 $Parts = explode('-', $Item['Value']); 13 if(strtolower($Item['Value']) == 'now') $Item['Value'] = time(); 14 $Parts = getdate($Item['Value']); 14 15 15 $Output = ($Parts[2] * 1).'.'.$MonthNames[$Parts[1] * 1].' '.$Parts[0];16 $Output = $Parts['mday'].'. '.$MonthNames[$Parts['mon']].' '.$Parts['year']; 16 17 return($Output); 17 18 } … … 20 21 { 21 22 global $MonthNames; 22 23 $Parts = explode('-', $Item['Value']); 23 24 if(strtolower($Item['Value']) == 'now') $Item['Value'] = time(); 25 $Parts = getdate($Item['Value']); 24 26 25 27 // Day … … 27 29 for($I = 1; $I <= 31; $I++) 28 30 { 29 if($Parts[ 2] == $I) $Selected = ' selected="1"'; else $Selected = '';31 if($Parts['mday'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 30 32 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 31 33 } … … 35 37 for($I = 1; $I <= 12; $I++) 36 38 { 37 if($Parts[ 1] == $I) $Selected = ' selected="1"'; else $Selected = '';39 if($Parts['mon'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 38 40 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$MonthNames[$I].'</option>'; 39 41 } … … 43 45 for($I = 1900; $I < 2100; $I++) 44 46 { 45 if($Parts[ 0] == $I) $Selected = ' selected="1"'; else $Selected = '';47 if($Parts['year'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 46 48 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 47 49 } … … 52 54 function OnLoad($Item) 53 55 { 54 return($_POST[$Item['Name'].'-year'].'-'.$_POST[$Item['Name'].'-month'].'-'.$_POST[$Item['Name'].'-day']); 56 return(mktime(0, 0, 0, $_POST[$Item['Name'].'-month'], $_POST[$Item['Name'].'-day'], $_POST[$Item['Name'].'-year'])); 57 } 58 59 function OnLoadDb($Item) 60 { 61 return(MysqlDateToTime($Item['Value'])); 62 } 63 64 function OnSaveDb($Item) 65 { 66 return(date('Y-m-d', $Item['Value'])); 55 67 } 56 68 -
trunk/Common/Types/DateTime.php
r428 r442 11 11 global $MonthNames; 12 12 13 if($Item['Value'] != '') 14 { 15 $ValueParts = explode(' ', $Item['Value']); 16 $DateParts = explode('-', $ValueParts[0]); 17 $TimeParts = explode(':', $ValueParts[1]); 18 19 $Output = ($DateParts[2] * 1).'.'.($DateParts[1] * 1).'.'.$DateParts[0].' '.$TimeParts[0].':'.$TimeParts[1].':'.$TimeParts[2]; 20 } else $Output = ''; 13 if(strtolower($Item['Value']) == 'now') $Item['Value'] = time(); 14 $Parts = getdate($Item['Value']); 15 $Output = $Parts['mday'].'.'.$Parts['mon'].'.'.$Parts['year'].' '. 16 $Parts['hours'].':'.$Parts['minutes'].':'.$Parts['seconds']; 21 17 return($Output); 22 18 } … … 26 22 global $MonthNames; 27 23 28 $ValueParts = explode(' ', $Item['Value']); 29 $DateParts = explode('-', $ValueParts[0]); 30 $TimeParts = explode(':', $ValueParts[1]); 24 if(strtolower($Item['Value']) == 'now') $Item['Value'] = time(); 25 $Parts = getdate($Item['Value']); 31 26 32 27 // Hour … … 34 29 for($I = 1; $I <= 24; $I++) 35 30 { 36 if($ TimeParts[2] == $I) $Selected = ' selected="1"'; else $Selected = '';31 if($Parts['hours'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 37 32 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 38 33 } … … 42 37 for($I = 1; $I <= 60; $I++) 43 38 { 44 if($ TimeParts[1] == $I) $Selected = ' selected="1"'; else $Selected = '';39 if($Parts['minutes'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 45 40 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 46 41 } … … 50 45 for($I = 1; $I <= 60; $I++) 51 46 { 52 if($ TimeParts[0] == $I) $Selected = ' selected="1"'; else $Selected = '';47 if($Parts['seconds'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 53 48 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 54 49 } … … 58 53 for($I = 1; $I <= 31; $I++) 59 54 { 60 if($ DateParts[2] == $I) $Selected = ' selected="1"'; else $Selected = '';55 if($Parts['mday'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 61 56 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 62 57 } … … 66 61 for($I = 1; $I <= 12; $I++) 67 62 { 68 if($ DateParts[1] == $I) $Selected = ' selected="1"'; else $Selected = '';63 if($Parts['mon'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 69 64 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$MonthNames[$I].'</option>'; 70 65 } … … 74 69 for($I = 1900; $I < 2100; $I++) 75 70 { 76 if($ DateParts[0] == $I) $Selected = ' selected="1"'; else $Selected = '';71 if($Parts['year'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 77 72 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 78 73 } … … 83 78 function OnLoad($Item) 84 79 { 85 return($_POST[$Item['Name'].'-year'].'-'.$_POST[$Item['Name'].'-month'].'-'.$_POST[$Item['Name'].'-day'].' '. 86 $_POST[$Item['Name'].'-hour'].':'.$_POST[$Item['Name'].'-minute'].':'.$_POST[$Item['Name'].'-second']); 80 return(mktime($_POST[$Item['Name'].'-hour'], $_POST[$Item['Name'].'-minute'], $_POST[$Item['Name'].'-second'], 81 $_POST[$Item['Name'].'-month'], $_POST[$Item['Name'].'-day'], $_POST[$Item['Name'].'-year'])); 82 } 83 84 function OnLoadDb($Item) 85 { 86 return(MysqlDateTimeToTime($Item['Value'])); 87 } 88 89 function OnSaveDb($Item) 90 { 91 return(date('Y-m-d H:i:s', $Item['Value'])); 87 92 } 88 93 -
trunk/Common/Types/OneToMany.php
r430 r442 30 30 { 31 31 if($Item['Value'] == $DbRow['Id']) $Selected = ' selected="1"'; else $Selected = ''; 32 $Output .= '<option value="'.$DbRow['Id'].'"'.$Selected.'>'.$DbRow[' Name'].'</option>';32 $Output .= '<option value="'.$DbRow['Id'].'"'.$Selected.'>'.$DbRow['Id'].': '.$DbRow['Name'].'</option>'; 33 33 } 34 34 $Output .= '</select>'; -
trunk/Common/Types/Password.php
r428 r442 41 41 return($Result); 42 42 } 43 44 function OnLoadDb($Item) 45 { 46 return(''); 47 } 43 48 } 44 49 -
trunk/Common/Types/Time.php
r428 r442 9 9 function OnView($Item) 10 10 { 11 $TimeParts = explode(':', $Item['Value']); 11 if(strtolower($Item['Value']) == 'now') $Item['Value'] = time(); 12 $TimeParts = getdate($Item['Value']); 12 13 13 $Output = $TimeParts[ 0].':'.$TimeParts[1].':'.$TimeParts[2];14 $Output = $TimeParts['hours'].':'.$TimeParts['minutes'].':'.$TimeParts['seconds']; 14 15 return($Output); 15 16 } … … 17 18 function OnEdit($Item) 18 19 { 19 $TimeParts = explode(':', $Item['Value']); 20 if(strtolower($Item['Value']) == 'now') $Item['Value'] = time(); 21 $TimeParts = getdate($Item['Value']); 20 22 21 23 // Hour … … 23 25 for($I = 1; $I <= 24; $I++) 24 26 { 25 if($TimeParts[ 2] == $I) $Selected = ' selected="1"'; else $Selected = '';27 if($TimeParts['hours'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 26 28 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 27 29 } … … 31 33 for($I = 1; $I <= 60; $I++) 32 34 { 33 if($TimeParts[ 1] == $I) $Selected = ' selected="1"'; else $Selected = '';35 if($TimeParts['month'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 34 36 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 35 37 } … … 39 41 for($I = 1; $I <= 60; $I++) 40 42 { 41 if($TimeParts[ 0] == $I) $Selected = ' selected="1"'; else $Selected = '';43 if($TimeParts['seconds'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 42 44 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 43 45 } … … 48 50 function OnLoad($Item) 49 51 { 50 return($_POST[$Item['Name'].'-hour'].':'.$_POST[$Item['Name'].'-minute'].':'.$_POST[$Item['Name'].'-second']); 52 return(mktime($_POST[$Item['Name'].'-hour'], $_POST[$Item['Name'].'-minute'], $_POST[$Item['Name'].'-second'])); 53 } 54 55 function OnLoadDb($Item) 56 { 57 return(MysqlTimeToTime($Item['Value'])); 58 } 59 60 function OnSaveDb($Item) 61 { 62 return(date('H:i:s', $Item['Value'])); 51 63 } 52 64 -
trunk/form_classes.php
r441 r442 207 207 ), 208 208 ), 209 'Product' => array(210 'Title' => 'Zboží',211 'Table' => 'Product',212 'DefaultSortColumn' => 'Name',213 'Items' => array(214 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),215 'Price' => array('Type' => 'Integer', 'Caption' => 'Cena', 'Default' => '0'),216 'Count' => array('Type' => 'Integer', 'Caption' => 'Počet', 'Default' => ''),217 'Date' => array('Type' => 'Date', 'Caption' => 'Datum', 'Default' => ''),218 'Segment' => array('Type' => 'TNetworkSegment', 'Caption' => 'Úsek', 'Default' => ''),219 'Used' => array('Type' => 'Boolean', 'Caption' => 'Použito', 'Default' => '0'),220 'Info' => array('Type' => 'Text', 'Caption' => 'Informace', 'Default' => ''),221 'User' => array('Type' => 'TMember', 'Caption' => 'Uživatel', 'Default' => ''),222 'Consumption' => array('Type' => 'Integer', 'Caption' => 'Spotřeba', 'Default' => ''),223 'DeviceId' => array('Type' => 'String', 'Caption' => 'Označení', 'Default' => ''),224 'DeprecatedPrice' => array('Type' => 'Float', 'Caption' => 'Odpisová cena', 'Default' => ''),225 'StockCard' => array('Type' => 'TStockCard', 'Caption' => 'Zboží', 'Default' => ''),226 ),227 ),228 209 'NetworkSubnet' => array( 229 210 'Title' => 'Podsítě', … … 247 228 ), 248 229 ), 230 'NewPayment' => array( 231 'Title' => 'Nová platba', 232 'Items' => array( 233 'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => 3), 234 'Time' => array('Type' => 'Date', 'Caption' => 'Čas', 'Default' => 'Now'), 235 'Subject' => array('Type' => 'TFinanceSubject', 'Caption' => 'Subjekt', 'Default' => 0), 236 'Value' => array('Type' => 'Float', 'Caption' => 'Částka [Kč]', 'Default' => '0'), 237 'Text' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => 'Vklad'), 238 'Cash' => array('Type' => 'Boolean', 'Caption' => 'Hotovost', 'Default' => '0'), 239 'Taxable' => array('Type' => 'Boolean', 'Caption' => 'Ovlivňující daňový základ', 'Default' => '1'), 240 //'BankAccount' => array('Type' => 'TBankAccount', 'Caption' => 'Bankovní účet', 'Default' => '1'), 241 ), 242 ), 249 243 'NewInvoice' => array( 250 244 'Title' => 'Nová faktura', 251 245 'Items' => array( 252 246 'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => 5), 253 'TimeCreation' => array('Type' => ' Time', 'Caption' => 'Čas vytvoření', 'Default' => 'Now'),254 'TimeDue' => array('Type' => ' Time', 'Caption' => 'Čas splatnosti', 'Default' => 'Now'),247 'TimeCreation' => array('Type' => 'Date', 'Caption' => 'Čas vytvoření', 'Default' => 'Now'), 248 'TimeDue' => array('Type' => 'Date', 'Caption' => 'Čas splatnosti', 'Default' => 'Now'), 255 249 'Subject' => array('Type' => 'TFinanceSubject', 'Caption' => 'Subjekt', 'Default' => 0), 256 250 'Text' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => 'Nákup zařízení'), … … 273 267 'DefaultSortColumn' => 'Time', 274 268 'Items' => array( 275 'Time' => array('Type' => 'Date Time', 'Caption' => 'Čas realizace', 'Default' => ''),269 'Time' => array('Type' => 'Date', 'Caption' => 'Čas realizace', 'Default' => ''), 276 270 'Subject' => array('Type' => 'TSubject', 'Caption' => 'Subjekt', 'Default' => ''), 277 271 'Cash' => array('Type' => 'Boolean', 'Caption' => 'Hotově', 'Default' => ''), … … 290 284 'DefaultSortColumn' => 'TimeCreation', 291 285 'Items' => array( 292 'TimeCreation' => array('Type' => 'Date Time', 'Caption' => 'Čas vytvoření', 'Default' => ''),293 'TimeDue' => array('Type' => 'Date Time', 'Caption' => 'Čas splatnosti', 'Default' => ''),294 'TimePayment' => array('Type' => 'Date Time', 'Caption' => 'Čas zaplacení', 'Default' => ''),286 'TimeCreation' => array('Type' => 'Date', 'Caption' => 'Čas vytvoření', 'Default' => ''), 287 'TimeDue' => array('Type' => 'Date', 'Caption' => 'Čas splatnosti', 'Default' => ''), 288 'TimePayment' => array('Type' => 'Date', 'Caption' => 'Čas zaplacení', 'Default' => ''), 295 289 'Subject' => array('Type' => 'TSubject', 'Caption' => 'Subjekt', 'Default' => ''), 296 290 'BillCode' => array('Type' => 'String', 'Caption' => 'Označení', 'Default' => ''), -
trunk/is/index.php
r440 r442 180 180 { 181 181 //$Output .= '<td>'.$Row[$ItemIndex].'</td>'; 182 $UseType = $UseType = $FormItem['Type']; 182 183 if(array_key_exists($FormItem['Type'], $FormTypes)) 183 184 { … … 186 187 $FormTypes[$FormItem['Type']]); 187 188 if($FormTypes[$FormItem['Type']]['Type'] == 'Reference') 188 $Value = $this->System->Type->ExecuteTypeEvent('OneToMany', 'OnView', 189 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 190 'Type' => $FormItem['Type'])); 191 else 189 $UseType = 'OneToMany'; 190 else 192 191 if($FormTypes[$FormItem['Type']]['Type'] == 'Enumeration') 193 $Value = $this->System->Type->ExecuteTypeEvent('Enumeration', 'OnView', 194 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 195 'Type' => $FormItem['Type'])); 196 } else $Value = $this->System->Type->ExecuteTypeEvent($FormItem['Type'], 'OnView', 197 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex)); 192 $UseType = 'Enumeration'; 193 } 194 $Row[$ItemIndex] = $this->System->Type->ExecuteTypeEvent($UseType, 'OnLoadDb', 195 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 196 'Type' => $FormItem['Type'])); 197 $Value = $this->System->Type->ExecuteTypeEvent($UseType, 'OnView', 198 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 199 'Type' => $FormItem['Type'])); 198 200 if($Value == '') $Value = ' '; 199 201 $Output .= '<td>'.$Value.'</td>'; -
trunk/sql/updates/441.sql
r441 r442 1 ALTER TABLE SystemVersion CHANGE COLUMN Rev43 0 Rev436bit;1 ALTER TABLE SystemVersion CHANGE COLUMN Rev436 Rev441 bit; 2 2 3 3 ALTER TABLE `Log` ADD `Id` INT NOT NULL AUTO_INCREMENT FIRST , ADD PRIMARY KEY ( `Id` );
Note:
See TracChangeset
for help on using the changeset viewer.