Changeset 639
- Timestamp:
- Mar 16, 2014, 1:33:22 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Version.php
r635 r639 1 1 <?php 2 2 3 $Revision = 6 35; // Subversion revision3 $Revision = 640; // Subversion revision 4 4 $DatabaseRevision = 633; // SQL structure revision 5 $ReleaseTime = strtotime('2014-0 1-19');5 $ReleaseTime = strtotime('2014-03-16'); -
trunk/Common/Form/Form.php
r606 r639 13 13 var $OnSubmit; 14 14 var $Database; 15 15 16 16 function __construct($FormManager) 17 { 17 { 18 18 $this->FormManager = &$FormManager; 19 19 $this->Database = $FormManager->Database; 20 20 $this->Definition = array(); 21 $this->Values = array(); 21 $this->Values = array(); 22 22 $this->ValuesFilter = array(); 23 $this->ValuesValidate = array(); 23 $this->ValuesValidate = array(); 24 24 $this->OnSubmit = ''; 25 25 } 26 26 27 function LoadDefaults() 28 { 29 foreach($this->Definition['Items'] as $Index => $Item) 30 if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 31 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 32 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 33 { 34 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 35 } 36 } 37 27 38 function SetClass($Name) 28 39 { 29 $this->Definition = &$this->FormManager->Classes[$Name]; 30 } 40 $this->Definition = &$this->FormManager->Classes[$Name]; 41 $this->LoadDefaults(); 42 } 31 43 32 44 function ShowViewForm() … … 37 49 ); 38 50 foreach($this->Definition['Items'] as $Index => $Item) 39 if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 40 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 41 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 42 { 43 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 44 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 45 { 46 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 51 if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 52 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 53 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 54 { 55 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 56 { 57 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 47 58 $this->FormManager->Type->RegisterType($Item['Type'], '', $this->FormManager->FormTypes[$Item['Type']]); 48 if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference') 49 $UseType = 'OneToMany'; 50 else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration') 51 $UseType = 'Enumeration'; 52 } else $UseType = $Item['Type']; 53 $Edit = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnView', 54 array('Value' => $this->Values[$Index], 'Name' => $Index, 55 'Type' => $Item['Type'], 'Values' => $this->Values, 59 if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference') 60 $UseType = 'OneToMany'; 61 else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration') 62 $UseType = 'Enumeration'; 63 } else $UseType = $Item['Type']; 64 $Edit = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnView', 65 array('Value' => $this->Values[$Index], 'Name' => $Index, 66 'Type' => $Item['Type'], 'Values' => $this->Values, 56 67 'Filter' => $this->ValuesFilter[$Index])); 57 68 if(array_key_exists('Suffix', $Item)) $Edit .= ' '.$Item['Suffix']; … … 61 72 $Output = '<fieldset><legend>'.$this->Definition['Title'].'</legend>'.Table($Table). 62 73 '</fieldset>'; 63 return($Output); 74 return($Output); 64 75 } 65 76 … … 86 97 if(!array_key_exists('ReadOnly', $Item)) $Item['ReadOnly'] = false; 87 98 if($Item['ReadOnly'] == false) 88 if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 89 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 90 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 91 { 92 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 93 $Parameters = array('Value' => $this->Values[$Index], 'Name' => $Index, 99 if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 100 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 101 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 102 { 103 $Parameters = array('Value' => $this->Values[$Index], 'Name' => $Index, 94 104 'Type' => $Item['Type'], 'Values' => $this->Values); 95 105 if(array_key_exists('Null', $Item)) $Parameters['Null'] = $Item['Null']; 96 106 else unset($Parameters['Null']); 97 98 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 99 { 100 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 101 $this->FormManager->Type->RegisterType($Item['Type'], '', 102 $this->FormManager->FormTypes[$Item['Type']]); 103 if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference') 107 if(array_key_exists('OnPreset', $Item)) $Parameters['OnPreset'] = $Item['OnPreset']; 108 else unset($Parameters['OnPreset']); 109 110 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 111 { 112 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 113 $this->FormManager->Type->RegisterType($Item['Type'], '', 114 $this->FormManager->FormTypes[$Item['Type']]); 115 if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference') 104 116 { 105 117 $UseType = 'OneToMany'; 106 } else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration') 118 } else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration') 107 119 $UseType = 'Enumeration'; 108 120 } else $UseType = $Item['Type']; … … 111 123 112 124 $Caption = $Item['Caption'].':'; 113 if(array_key_exists($Index, $this->ValuesValidate) and 125 if(array_key_exists($Index, $this->ValuesValidate) and 114 126 $this->ValuesValidate[$Index]) { 115 127 $Format = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'GetValidationFormat', array()); … … 124 136 $Output = '<fieldset><legend>'.$this->Definition['Title'].'</legend>'.Table($Table). 125 137 $Hidden.'</fieldset>'; 126 return($Output); 138 return($Output); 127 139 } 128 140 129 141 function LoadValuesFromDatabase($Id) 130 { 131 foreach($this->Definition['Items'] as $Index => $Item) 132 if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 133 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 134 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 135 { 136 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 137 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 138 { 139 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 140 $this->FormManager->Type->RegisterType($Item['Type'], '', 141 $this->FormManager->FormTypes[$Item['Type']]); 142 if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference') 143 $UseType = 'OneToMany'; 144 else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration') 142 { 143 foreach($this->Definition['Items'] as $Index => $Item) 144 if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 145 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 146 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 147 { 148 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 149 { 150 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 151 $this->FormManager->Type->RegisterType($Item['Type'], '', 152 $this->FormManager->FormTypes[$Item['Type']]); 153 if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference') 154 $UseType = 'OneToMany'; 155 else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration') 145 156 $UseType = 'Enumeration'; 146 157 } else $UseType = $Item['Type']; … … 154 165 $DbRow = $DbResult->fetch_array(); 155 166 foreach($this->Definition['Items'] as $Index => $Item) 156 if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 157 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 158 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 159 { 160 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 161 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 162 { 163 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 164 $this->FormManager->Type->RegisterType($Item['Type'], '', 165 $this->FormManager->FormTypes[$Item['Type']]); 166 if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference') 167 $UseType = 'OneToMany'; 168 else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration') 169 $UseType = 'Enumeration'; 170 } else $UseType = $Item['Type']; 171 $this->Values[$Index] = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnLoadDb', 172 array('Value' => $DbRow[$Index], 'Name' => $Index, 167 if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 168 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 169 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 170 { 171 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 172 { 173 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 174 $this->FormManager->Type->RegisterType($Item['Type'], '', 175 $this->FormManager->FormTypes[$Item['Type']]); 176 if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference') 177 $UseType = 'OneToMany'; 178 else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration') 179 $UseType = 'Enumeration'; 180 } else $UseType = $Item['Type']; 181 $this->Values[$Index] = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnLoadDb', 182 array('Value' => $DbRow[$Index], 'Name' => $Index, 173 183 'Type' => $Item['Type'], 'Values' => $this->Values)); 174 184 $this->ValuesFilter[$Index] = $DbRow[$Index.'_Filter']; … … 183 193 if(!array_key_exists('ReadOnly', $Item)) $Item['ReadOnly'] = false; 184 194 if($Item['ReadOnly'] == false) 185 if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 186 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 195 if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 196 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 187 197 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 188 198 { 189 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 190 $Parameters = array('Value' => $this->Values[$Index], 'Name' => $Index, 199 $Parameters = array('Value' => $this->Values[$Index], 'Name' => $Index, 191 200 'Type' => $Item['Type'], 'Values' => $this->Values); 192 193 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 194 { 195 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 196 $this->FormManager->Type->RegisterType($Item['Type'], '', 197 $this->FormManager->FormTypes[$Item['Type']]); 198 if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference') 201 202 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 203 { 204 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 205 $this->FormManager->Type->RegisterType($Item['Type'], '', 206 $this->FormManager->FormTypes[$Item['Type']]); 207 if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference') 199 208 { 200 209 $UseType = 'OneToMany'; 201 210 } 202 else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration') 211 else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration') 203 212 $UseType = 'Enumeration'; 204 213 } else $UseType = $Item['Type']; … … 225 234 $Values = array(); 226 235 foreach($this->Definition['Items'] as $Index => $Item) 227 if((!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 236 if((!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 228 237 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 229 238 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) and 230 (!array_key_exists('ReadOnly', $Item) or 239 (!array_key_exists('ReadOnly', $Item) or 231 240 (array_key_exists('ReadOnly', $Item) and 232 241 ($Item['ReadOnly'] != true)))) 233 { 242 { 234 243 //if(array_key_exists($Context.$Index, $_POST)) 235 244 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 236 { 237 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 238 $this->FormManager->Type->RegisterType($Item['Type'], '', 245 { 246 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 247 $this->FormManager->Type->RegisterType($Item['Type'], '', 239 248 $this->FormManager->FormTypes[$Item['Type']]); 240 249 $CustomType = $this->FormManager->FormTypes[$Item['Type']]['Type']; 241 if($CustomType == 'Reference') 242 $UseType = 'OneToMany'; 243 else if($CustomType == 'Enumeration') 250 if($CustomType == 'Reference') 251 $UseType = 'OneToMany'; 252 else if($CustomType == 'Enumeration') 244 253 $UseType = 'Enumeration'; 245 254 } else $UseType = $Item['Type']; … … 247 256 if(array_key_exists('Null', $Item)) $Parameters['Null'] = $Item['Null']; 248 257 else unset($Parameters['Null']); 249 $Values[$Index] = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnLoad', 258 $Values[$Index] = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnLoad', 250 259 $Parameters); 251 260 } … … 257 266 $Valid = true; 258 267 foreach($this->Definition['Items'] as $Index => $Item) 259 if((!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 268 if((!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 260 269 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 261 270 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) and 262 (!array_key_exists('ReadOnly', $Item) or 271 (!array_key_exists('ReadOnly', $Item) or 263 272 (array_key_exists('ReadOnly', $Item) and 264 273 ($Item['ReadOnly'] != true)))) 265 { 274 { 266 275 //if(array_key_exists($Context.$Index, $_POST)) 267 276 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 268 { 269 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 270 $this->FormManager->Type->RegisterType($Item['Type'], '', 277 { 278 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 279 $this->FormManager->Type->RegisterType($Item['Type'], '', 271 280 $this->FormManager->FormTypes[$Item['Type']]); 272 281 $CustomType = $this->FormManager->FormTypes[$Item['Type']]['Type']; 273 if($CustomType == 'Reference') 274 $UseType = 'OneToMany'; 275 else if($CustomType == 'Enumeration') 276 $UseType = 'Enumeration'; 277 } else $UseType = $Item['Type']; 278 282 if($CustomType == 'Reference') 283 $UseType = 'OneToMany'; 284 else if($CustomType == 'Enumeration') 285 $UseType = 'Enumeration'; 286 } else $UseType = $Item['Type']; 287 279 288 $Parameters = array('Value' => $this->Values[$Index]); 280 289 if(array_key_exists('Null', $Item)) $Parameters['Null'] = $Item['Null']; 281 290 else $Parameters['Null'] = false; 282 if(!$this->FormManager->Type->ExecuteTypeEvent($UseType, 'Validate', 291 if(!$this->FormManager->Type->ExecuteTypeEvent($UseType, 'Validate', 283 292 $Parameters)) { 284 293 $this->ValuesValidate[$Index] = true; … … 288 297 if($Valid == false) throw new Exception('not validated'); 289 298 return($Valid); 290 } 299 } 291 300 } 292 301 … … 294 303 function MakeLink($Target, $Title) 295 304 { 296 return('<a href="'.$Target.'">'.$Title.'</a>'); 305 return('<a href="'.$Target.'">'.$Title.'</a>'); 297 306 } 298 307 … … 329 338 var $RootURL; 330 339 var $ShowRelation; 331 340 332 341 function __construct($Database) 333 342 { … … 336 345 $this->FormTypes = array(); 337 346 $this->Type = new Type($this); 338 $this->ShowRelation = false; 339 } 340 347 $this->ShowRelation = false; 348 } 349 341 350 function RegisterClass($Name, $Class) 342 351 { 343 352 $this->Classes[$Name] = $Class; 344 353 } 345 354 346 355 function UnregisterClass($Name) 347 356 { … … 353 362 $this->FormTypes[$Name] = $Class; 354 363 } 355 364 356 365 function UnregisterFormType($Name) 357 366 { -
trunk/Common/Form/Types/Date.php
r616 r639 22 22 { 23 23 global $MonthNames; 24 24 25 25 if(($Item['Value'] !== null) and ((strtolower($Item['Value']) == 'now') or (strtolower($Item['Value']) == ''))) $Item['Value'] = time(); 26 26 $Parts = getdate($Item['Value']); … … 28 28 $Output = ''; 29 29 $Style = ''; 30 if(array_key_exists('Null', $Item) and $Item['Null']) 30 if(array_key_exists('Null', $Item) and $Item['Null']) 31 31 { 32 if($Item['Value'] != null) 32 if($Item['Value'] != null) 33 33 { 34 34 $Checked = ' checked="1"'; 35 35 $Style = 'style="display:inline;"'; 36 } else 36 } else 37 37 { 38 38 $Checked = ''; 39 $Style = 'style="display:none;"'; 39 $Style = 'style="display:none;"'; 40 40 } 41 41 $Output .= '<input type="checkbox" name="'.$Item['Name'].'-null"'.$Checked.' onclick="toggle(\''. 42 $Item['Name'].'-day\');toggle(\''.$Item['Name'].'-month\');toggle(\''.$Item['Name'].'-year\');"/>'; 42 $Item['Name'].'-day\');toggle(\''.$Item['Name'].'-month\');toggle(\''.$Item['Name'].'-year\');"/>'; 43 43 } 44 44 45 45 // Day 46 46 $Output .= '<select name="'.$Item['Name'].'-day" id="'.$Item['Name'].'-day" '.$Style.'>'; … … 72 72 function OnLoad($Item) 73 73 { 74 if(!array_key_exists($Item['Name'].'-null', $_POST) and array_key_exists('Null', $Item) and ($Item['Null'] == true)) return(null); 74 if(!array_key_exists($Item['Name'].'-null', $_POST) and array_key_exists('Null', $Item) and ($Item['Null'] == true)) return(null); 75 75 else return(mktime(0, 0, 0, $_POST[$Item['Name'].'-month'], $_POST[$Item['Name'].'-day'], $_POST[$Item['Name'].'-year'])); 76 76 } 77 77 78 78 function OnLoadDb($Item) 79 79 { … … 81 81 } 82 82 83 function OnSaveDb($Item) 83 function OnSaveDb($Item) 84 84 { 85 85 if($Item['Value'] == null) return(null); -
trunk/Common/Form/Types/OneToMany.php
r548 r639 6 6 { 7 7 var $EditActions; 8 8 9 9 function OnView($Item) 10 10 { … … 14 14 $Output = '<a href="?t='.$Type['Parameters']['Table'].'&a='. 15 15 'view'.'&i='.$Item['Value'].'">'.$Item['Filter'].'</a>'; 16 } else $Output = ''; 16 } else $Output = ''; 17 17 return($Output); 18 18 } … … 24 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 28 if($Item['Value'] == NULL) $Selected = ' selected="1"'; else $Selected = ''; … … 39 39 $Output .= '</select>'; 40 40 if($this->FormManager->ShowRelation) 41 { 42 $URL = ''; 43 if(array_key_exists('OnPreset', $Item)) 44 { 45 $Preset = call_user_func($Item['OnPreset'], $Item['Values']); 46 $URL = str_replace('&', '&', '&'.http_build_query($Preset)); 47 } 48 $Output .= '<img src="'.$this->FormManager->Root.'/images/add.png" alf="Přidat" language="javascript" '. 49 'onclick="return popupwindow("'.$this->FormManager->Root.'/is/?a=addsub&t='.$Table.'&r='.$Item['Name'].'&rt='.$Item['Type'].$URL.'","test");" style="cursor:hand;cursor:pointer"/>'; 41 50 $Output .= '<img src="'.$this->FormManager->Root.'/images/select.png" alf="Vybrat" language="javascript" '. 42 51 'onclick="return popupwindow("'.$this->FormManager->Root.'/is/?a=select&t='.$Table.'&r='.$Item['Name'].'","test");" style="cursor:hand;cursor:pointer"/>'; 52 } 43 53 return($Output); 44 54 } … … 55 65 else return($Item['Value']); 56 66 } 57 67 58 68 function OnFilterName($Item) 59 69 { 60 70 return('`'.$Item['Name'].'_Filter`'); 61 71 } 62 72 63 73 function OnFilterNameQuery($Item) 64 74 { … … 72 82 $Type['Parameters']['Id'].'`=`'.$Item['Name'].'`) AS `'.$Item['Name'].'_Filter`'; 73 83 //} else $Output = '`'.$Item['Name'].'`, `'.$Item['Name'].'` AS `'.$Item['Name'].'_Filter`'; 74 return($Output); 84 return($Output); 75 85 } 76 86 } -
trunk/Modules/Finance/Finance.php
r632 r639 15 15 define('TARIFF_FREE', 7); 16 16 define('INVOICE_DUE_DAYS', 15); 17 define('INVOICE_OUT_DOC_LINE', 6); 17 define('DOC_LINE_INVOICE_OUT', 6); 18 define('DOC_LINE_ACCOUNT_IN', 3); 19 define('DOC_LINE_ACCOUNT_OUT', 4); 20 18 21 19 22 class Finance extends Model … … 302 305 $this->Description = 'Base module for finance management'; 303 306 $this->Dependencies = array('File', 'EmailQueue'); 304 } 307 } 305 308 306 309 function DoInstall() 307 310 { 308 311 } 309 312 310 313 function DoUninstall() 311 { 312 } 313 314 { 315 } 316 314 317 function DoStart() 315 318 { 316 319 global $Config; 317 320 318 321 $this->System->RegisterPage('finance', 'PageFinance'); 319 322 $this->System->RegisterPage(array('finance', 'spotreba'), 'PageFinanceConsumption'); … … 324 327 $this->System->RegisterPage(array('finance', 'sprava'), 'PageFinanceManage'); 325 328 $this->System->RegisterPage(array('finance', 'platby'), 'PageFinanceUserState'); 326 $this->System->RegisterPage(array('finance', 'import'), 'PageFinanceImportPayment'); 329 $this->System->RegisterPage(array('finance', 'import'), 'PageFinanceImportPayment'); 327 330 $this->System->RegisterPage(array('finance', 'zivnost'), 'PageFinanceTaxFiling'); 328 331 … … 345 348 'Treasury' => array('Type' => 'TFinanceTreasury', 'Caption' => 'Pokladna', 'Default' => '', 'Null' => true), 346 349 'Generate' => array('Type' => 'Boolean', 'Caption' => 'Generovat', 'Default' => ''), 347 'InvoiceRel' => array('Type' => 'TFinanceInvoiceOperationRelListOperation', 'Caption' => 'Zaplacené faktury', 'Default' => ''), 350 'InvoiceRel' => array('Type' => 'TFinanceInvoiceOperationRelListOperation', 'Caption' => 'Zaplacené faktury', 'Default' => ''), 348 351 ), 349 352 'BeforeInsert' => array($this, 'BeforeInsertFinanceOperation'), … … 378 381 'VAT' => array('Type' => 'Integer', 'Caption' => 'Daň', 'Default' => '21', 'Suffix' => '%'), 379 382 ), 380 )); 383 )); 381 384 $this->System->FormManager->RegisterClass('FinanceTreasury', array( 382 385 'Title' => 'Pokladny', … … 386 389 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 387 390 'TimeCreate' => array('Type' => 'Date', 'Caption' => 'Čas vytvoření', 'Default' => ''), 388 'State' => array('Type' => 'Float', 'Caption' => 'Stav', 'Default' => '', 391 'State' => array('Type' => 'Float', 'Caption' => 'Stav', 'Default' => '', 389 392 'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => '(SELECT SUM(`FinanceOperation`.`Value`) FROM `FinanceOperation` '. 390 393 'WHERE `FinanceOperation`.`Treasury`=#Id)'), … … 409 412 'LastImportDate' => array('Type' => 'Date', 'Caption' => 'Datum posledního importu', 'Default' => ''), 410 413 'LastImportId' => array('Type' => 'String', 'Caption' => 'Id posledního importu', 'Default' => ''), 411 'State' => array('Type' => 'Float', 'Caption' => 'Stav', 'Default' => '', 414 'State' => array('Type' => 'Float', 'Caption' => 'Stav', 'Default' => '', 412 415 'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => '(SELECT SUM(`FinanceOperation`.`Value`) FROM `FinanceOperation` '. 413 416 'WHERE `FinanceOperation`.`BankAccount`=#Id)'), … … 432 435 'Table' => 'Currency', 433 436 'Items' => array( 434 'Code' => array('Type' => 'String', 'Caption' => 'Kód' ),437 'Code' => array('Type' => 'String', 'Caption' => 'Kód', 'Default' => ''), 435 438 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 436 439 'Symbol' => array('Type' => 'String', 'Caption' => 'Symbol', 'Default' => ''), … … 452 455 'ReplaceId' => array('Type' => 'TFinanceCharge', 'Caption' => 'Cílová položka', 'Default' => '0', 'Null' => true), 453 456 ), 454 )); 455 457 )); 458 456 459 $this->System->AddModule(new Bill($this->System)); 457 460 $this->System->AddModule(new Finance($this->System)); 458 461 $this->System->Modules['Finance']->MainSubject = $Config['Finance']['MainSubjectId']; 459 462 $this->System->Modules['Finance']->DirectoryId = $Config['Finance']['DirectoryId']; 460 } 461 463 } 464 462 465 function DoStop() 463 { 464 } 465 466 { 467 } 468 466 469 function BeforeInsertFinanceOperation($Form) 467 470 { … … 470 473 $Form->Values['BillCode'] = $this->System->Modules['Finance']->GetNextDocumentLineNumber($DocumentLine, $Year); 471 474 return($Form->Values); 472 } 475 } 473 476 } -
trunk/Modules/Finance/Manage.php
r629 r639 6 6 var $ShortTitle = 'Správa financí'; 7 7 var $ParentClass = 'PageFinance'; 8 8 9 9 function Show() 10 10 { 11 11 $Output = ''; 12 if(!$this->System->User->CheckPermission('Finance', 'Manage')) 12 if(!$this->System->User->CheckPermission('Finance', 'Manage')) 13 13 return('Nemáte oprávnění'); 14 14 15 if(array_key_exists('Operation', $_GET)) $Operation = $_GET['Operation']; 15 if(array_key_exists('Operation', $_GET)) $Operation = $_GET['Operation']; 16 16 else $Operation = ''; 17 17 switch($Operation) … … 39 39 return($Output); 40 40 } 41 41 42 42 function GetBillingPeriod($Period) 43 43 { … … 46 46 $PeriodTo = mktime(0, 0, 0, date('n') + $MonthCount - 1, date('t', mktime(0, 0, 0, date('n') + $MonthCount - 1, 1, date('Y'))) , date('Y')); 47 47 return(array('From' => $PeriodFrom, 'To' => $PeriodTo, 'MonthCount' => $MonthCount)); 48 } 48 } 49 49 50 50 function ShowMonthlyPayment() … … 62 62 'FinanceBillingPeriod.Id=Member.BillingPeriodNext WHERE (Member.Blocked = 0)'. 63 63 'AND (Member.BillingPeriodNext > 1) AND (MemberPayment.MonthlyTotal != 0)'; 64 64 65 65 $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$SQL.') AS T'); 66 66 $DbRow = $DbResult->fetch_row(); 67 $PageList = GetPageList($DbRow[0]); 67 $PageList = GetPageList($DbRow[0]); 68 68 69 69 $Output = $PageList['Output']; 70 70 $Output .= '<table class="WideTable" style="font-size: small;">'; 71 71 72 72 $TableColumns = array( 73 array('Name' => 'SubjectName', 'Title' => 'Jméno'), 74 array('Name' => 'Monthly', 'Title' => 'Platba'), 75 array('Name' => 'Cash', 'Title' => 'Kredit'), 76 array('Name' => 'LastDate', 'Title' => 'Poslední fakturace'), 77 array('Name' => 'ServicesNextMonth', 'Title' => 'Služby'), 78 array('Name' => 'BillingPeriodName', 'Title' => 'Perioda'), 73 array('Name' => 'SubjectName', 'Title' => 'Jméno'), 74 array('Name' => 'Monthly', 'Title' => 'Platba'), 75 array('Name' => 'Cash', 'Title' => 'Kredit'), 76 array('Name' => 'LastDate', 'Title' => 'Poslední fakturace'), 77 array('Name' => 'ServicesNextMonth', 'Title' => 'Služby'), 78 array('Name' => 'BillingPeriodName', 'Title' => 'Perioda'), 79 79 ); 80 80 $Order = GetOrderTableHeader($TableColumns, 'SubjectName', 0); … … 82 82 83 83 $Query = $SQL.' '.$Order['SQL'].$PageList['SQLLimit']; 84 84 85 85 $DbResult = $this->Database->query($Query); 86 while($Row = $DbResult->fetch_assoc()) 87 { 86 while($Row = $DbResult->fetch_assoc()) 87 { 88 88 $Output .= '<tr>'. 89 89 '<td>'.$Row['SubjectName'].'</td>'. … … 100 100 return($Output); 101 101 } 102 102 103 103 function InsertInvoice($Subject, $TimeCreation, $TimeDue, $Items, 104 104 $DocumentLine, $PeriodFrom, $PeriodTo) 105 105 { 106 106 global $LastInsertTime; 107 107 108 108 $Year = date('Y', $TimeCreation); 109 109 $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumber($DocumentLine, $Year); … … 124 124 return($InvoiceId); 125 125 } 126 126 127 127 function ProduceInvoices() 128 128 { 129 129 $Output = ''; 130 130 131 131 // Generuj účetní položky 132 132 $DbResult = $this->Database->query('SELECT Member.*, MemberPayment.MonthlyTotal AS MonthlyTotal, '. … … 169 169 $MonthlyTotal -= $Member['MonthlyPlus']; 170 170 } 171 $PayPerPeriod = $MonthlyTotal * $Period['MonthCount']; 171 $PayPerPeriod = $MonthlyTotal * $Period['MonthCount']; 172 172 if($PayPerPeriod != 0) 173 173 { 174 174 $TimePeriodText = date('j.n.Y', $Period['From']).' - '.date('j.n.Y', $Period['To']); 175 175 $Output .= $TimePeriodText.': '.$MonthlyTotal.' * '.$Period['MonthCount'].' = '.$PayPerPeriod.'<br />'; 176 $this->InsertInvoice($Member['Subject'], time(), time() + 3600 * 24 * INVOICE_DUE_DAYS, 177 $InvoiceItems, INVOICE_OUT_DOC_LINE, $Period['From'], $Period['To']);178 176 $this->InsertInvoice($Member['Subject'], time(), time() + 3600 * 24 * INVOICE_DUE_DAYS, 177 $InvoiceItems, DOC_LINE_INVOICE_OUT, $Period['From'], $Period['To']); 178 179 179 $Output .= $this->SendPaymentEmail($Member['Id']); 180 180 } else $Output .= '<br />'; 181 $this->Database->update('Member', 'Id='.$Member['Id'], 181 $this->Database->update('Member', 'Id='.$Member['Id'], 182 182 array('BillingPeriodLastDate' => TimeToMysqlDateTime($Period['To']))); 183 183 } else $Output .= '<br />'; 184 } 184 } 185 185 return($Output); 186 186 } 187 187 188 188 function TableUpdatePeriod($Table) 189 189 { … … 212 212 } 213 213 $this->Database->delete($Table, '`Action` IS NOT NULL'); 214 } 215 214 } 215 216 216 function ProcessMonthlyPayment() 217 217 { … … 221 221 $Finance = &$this->System->Modules['Finance']; 222 222 $Finance->LoadMonthParameters(0); 223 223 224 224 // Načti poslední měsíční přehled a nastavení 225 225 $DbResult = $this->Database->select('FinanceMonthlyOverall', '*', '1 ORDER BY Date DESC LIMIT 1'); … … 227 227 228 228 $Output -= 'Datum: '.date('j.n.Y').'<br />'; 229 229 230 230 $DateParts = explode('-', $Overall['Date']); 231 231 $MonthLast = $DateParts[1]; … … 242 242 $TotalDeviceCost = $Row[0]; 243 243 $Output .= 'Celková cena zařízení: Zařízení('.$TotalDeviceCost; 244 244 245 245 $DbResult = $this->Database->query('SELECT SUM(Price) FROM NetworkSegment'); 246 246 $Row = $DbResult->fetch_row(); 247 247 $TotalSegmentDeviceCost = $Row[0]; 248 248 $Output .= '), Segmenty('.$TotalSegmentDeviceCost; 249 249 250 250 $DbResult = $this->Database->query('SELECT SUM(NetworkDevice) FROM MemberPayment'); 251 251 $Row = $DbResult->fetch_row(); 252 252 $TotalMemberDeviceCost = $Row[0]; 253 253 $Output .= '), Členové('.$TotalMemberDeviceCost.')<br />'; 254 254 255 255 $DbResult = $this->Database->query('SELECT SUM(Cash) FROM MemberPayment'); 256 256 $Row = $DbResult->fetch_row(); 257 257 $TotalMemberCash = $Row[0]; 258 $Output .= 'Stav pokladny: Členové('.$TotalMemberCash.')'; 258 $Output .= 'Stav pokladny: Členové('.$TotalMemberCash.')'; 259 259 260 260 $DbResult = $this->Database->query('SELECT SUM(Product.Consumption) AS Consumption FROM StockItem '. … … 272 272 { 273 273 $Output .= 'Odečítám měsíční poplatek...<br />'; 274 $Output .= $this->ProduceInvoices(); 275 274 $Output .= $this->ProduceInvoices(); 275 276 276 // Update finance charge 277 277 $Output .= 'Měním aktuální parametry sítě...<br>'; … … 281 281 $DbResult = $this->Database->query('SELECT * FROM FinanceCharge WHERE Action IS NULL LIMIT 1'); 282 282 $Charge = $DbResult->fetch_assoc(); 283 $this->Database->insert('FinanceMonthlyOverall', array('Date' => 'NOW()', 284 'Money' => $Finance->Internet, 'kWh' => $Finance->kWh, 285 'Administration' => $Finance->Sprava, 'AdministrationTotal' => $SpravaCelkem, 286 'ConsumptionTotal' => $TotalConsumptionCost, 'TotalPaid' => $Finance->TotalPaid, 287 'BaseTariffPrice' => $Charge['BaseTariffPrice'], 283 $this->Database->insert('FinanceMonthlyOverall', array('Date' => 'NOW()', 284 'Money' => $Finance->Internet, 'kWh' => $Finance->kWh, 285 'Administration' => $Finance->Sprava, 'AdministrationTotal' => $SpravaCelkem, 286 'ConsumptionTotal' => $TotalConsumptionCost, 'TotalPaid' => $Finance->TotalPaid, 287 'BaseTariffPrice' => $Charge['BaseTariffPrice'], 288 288 'TopTariffPrice' => $Charge['TopTariffPrice'], 'MemberCount' => $Finance->InternetUsers)); 289 289 290 290 // Update services 291 291 $Output .= 'Aktualizuji služby....<br>'; 292 $this->TableUpdatePeriod('Service'); 292 $this->TableUpdatePeriod('Service'); 293 293 // Update customer service selections 294 294 $Output .= 'Aktualizuji výběr služeb zákazníků....<br>'; 295 $this->TableUpdatePeriod('ServiceCustomerRel'); 296 295 $this->TableUpdatePeriod('ServiceCustomerRel'); 296 297 297 $Finance->RecalculateMemberPayment(); 298 298 //CreateMonthlyOverallBill(); … … 300 300 301 301 // Restart traffic shaping 302 //$this->Database->update('NetworkConfiguration', 'Id = 3', array('Changed' => 1)); 302 //$this->Database->update('NetworkConfiguration', 'Id = 3', array('Changed' => 1)); 303 303 //flush(); 304 304 //$this->GenerateBills(); … … 306 306 return($Output); 307 307 } 308 308 309 309 function SendPaymentEmail($MemberId, $FileId = '') 310 310 { 311 311 global $Config; 312 312 313 313 $DbResult = $this->Database->select('Member', '*', 'Id='.$MemberId); 314 314 $Member = $DbResult->fetch_assoc(); 315 315 316 316 $DbResult = $this->Database->select('MemberPayment', '*', 'Member='.$MemberId); 317 $MemberPayment = $DbResult->fetch_assoc(); 317 $MemberPayment = $DbResult->fetch_assoc(); 318 318 319 319 $DbResult = $this->Database->select('Subject', 'Name', 'Id='.$Member['Subject']); 320 $Subject = $DbResult->fetch_assoc(); 321 322 $DbResult = $this->Database->select('User', '*', 'Id='.$Member['ResponsibleUser']); 320 $Subject = $DbResult->fetch_assoc(); 321 322 $DbResult = $this->Database->select('User', '*', 'Id='.$Member['ResponsibleUser']); 323 323 $User = $DbResult->fetch_assoc(); 324 324 325 325 $DbResult = $this->Database->select('Subject', '*', '`Id`='.$Config['Finance']['MainSubjectId']); 326 $MainSubject = $DbResult->fetch_assoc(); 327 326 $MainSubject = $DbResult->fetch_assoc(); 327 328 328 $DbResult = $this->Database->query('SELECT FinanceBankAccount.*, CONCAT(FinanceBankAccount.Number, "/", FinanceBank.Code) AS NumberFull FROM FinanceBankAccount '. 329 329 'JOIN FinanceBank ON FinanceBank.Id=FinanceBankAccount.Bank '. 330 330 'WHERE (FinanceBankAccount.`Subject`='.$Config['Finance']['MainSubjectId'].') AND (FinanceBankAccount.`Use`=1)'); 331 331 $MainSubjectAccount = $DbResult->fetch_assoc(); 332 332 333 333 if($User['Email'] != '') 334 334 { … … 357 357 while($DbRow = $DbResult->fetch_assoc()) 358 358 { 359 $Text = $DbRow['Text']; 359 $Text = $DbRow['Text']; 360 360 $Content .= '<tr><td style="border-style: solid; border-width: 1px; padding: 1px 5px 1px 5px; text-align: center;">'.HumanDate($DbRow['Time']).'</td>'. 361 361 '<td style="border-style: solid; border-width: 1px; padding: 1px 5px 1px 5px; text-align: center;">'.$Text.'</td>'. … … 364 364 $Content .= '</table><br />'."\n". 365 365 'Pro aktuální informace, prohlížení elektronických dokladů a možnost změny údajů se prosím přihlašte na stránkách <a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'">http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'</a>.<br /><br />'."\n"; 366 366 367 367 $Content .= '<br />Tento email je generován automaticky. V případě zjištění nesrovnalostí napište zpět.'; 368 $this->System->ModuleManager->Modules['EmailQueue']->AddItem($User['Name'].' <'.$User['Email'].'>', $Title, $Content, 368 $this->System->ModuleManager->Modules['EmailQueue']->AddItem($User['Name'].' <'.$User['Email'].'>', $Title, $Content, 369 369 $Config['Web']['Admin'].' <'.$Config['Web']['AdminEmail'].'>'); 370 370 $Output = ''; 371 371 } else $Output = 'Uživatel '.$User['Name'].' nemá email.'; 372 372 } 373 373 374 374 function GenerateBills() 375 375 { 376 376 $Output = ''; 377 377 378 378 // FinanceInvoice 379 379 $DbResult = $this->Database->query('SELECT * FROM `FinanceInvoice` WHERE (`BillCode` <> "") '. … … 420 420 $Output .= '.'; 421 421 } else $Output .= 'Soubor "'.$FullFileName.'" se nepodařilo uložit.'; 422 } 422 } 423 423 return($Output); 424 424 } -
trunk/Modules/FinanceBankAPI/FinanceBankAPI.php
r600 r639 16 16 $this->Description = 'Communication through API to various banks, manual file import'; 17 17 $this->Dependencies = array('Finance'); 18 } 18 } 19 19 20 20 function DoInstall() 21 21 { 22 22 } 23 23 24 24 function DoUninstall() 25 { 25 { 26 26 } 27 27 28 28 function DoStart() 29 29 { … … 53 53 'Description' => array('Type' => 'String', 'Caption' => 'Popis operace', 'Default' => ''), 54 54 'OffsetAccountName' => array('Type' => 'String', 'Caption' => 'Jméno protiúčtu', 'Default' => ''), 55 'FinanceOperation' => array('Type' => 'TFinanceOperation', 'Caption' => 'Přiřazená operace', 'Default' => '', 'Null' => true ),55 'FinanceOperation' => array('Type' => 'TFinanceOperation', 'Caption' => 'Přiřazená operace', 'Default' => '', 'Null' => true, 'OnPreset' => array($this, 'PresetItem')), 56 56 ), 57 57 )); 58 58 59 59 $this->System->RegisterPage(array('finance', 'import-api'), 'PageImportAPI'); 60 60 $this->System->RegisterPage(array('finance', 'import-soubor'), 'PageImportFile'); 61 } 62 61 } 62 63 63 function DoStop() 64 { 65 } 64 { 65 } 66 67 function PresetItem($Item) 68 { 69 $Preset = array(); 70 if($Item['Value'] < 0) $DocumentLine = DOC_LINE_ACCOUNT_OUT; 71 else $DocumentLine = DOC_LINE_ACCOUNT_IN; 72 $Preset = array( 73 'presetTime' => $Item['Time'], 74 'presetValue' => $Item['Value'], 75 'presetTaxable' => 1, 76 'presetText' => $Item['Description'], 77 'presetNetwork' => 1, 78 'presetBankAccount' => $Item['BankAccount'], 79 'presetDocumentLine' => $DocumentLine); 80 return($Preset); 81 } 66 82 } -
trunk/Modules/IS/IS.php
r628 r639 13 13 function Show() 14 14 { 15 if(!$this->System->User->CheckPermission('IS', 'Manage')) 15 if(!$this->System->User->CheckPermission('IS', 'Manage')) 16 16 return('Nemáte oprávnění'); 17 17 $this->System->FormManager->ShowRelation = true; 18 18 19 19 if(array_key_exists('a', $_GET)) $Action = $_GET['a']; 20 20 else $Action = ''; … … 23 23 if(array_key_exists('i', $_GET)) $ItemId = $_GET['i']; 24 24 else $ItemId = 0; 25 25 26 26 if($Action == 'list') $Content = $this->ShowList($Table); 27 27 else if($Action == 'select') $Content = $this->ShowSelect($Table); … … 29 29 else if($Action == 'edit') $Content = $this->ShowEdit($Table, $ItemId); 30 30 else if($Action == 'add') $Content = $this->ShowAdd($Table); 31 else if($Action == 'addsub') $Content = $this->ShowAddSub($Table); 31 32 else if($Action == 'view') $Content = $this->ShowView($Table, $ItemId); 32 33 else if($Action == 'delete') $Content = $this->ShowDelete($Table, $ItemId); … … 35 36 { 36 37 $Output = '<table style="width: 100%"><tr><td style="width: 20%; vertical-align: top;">'; 37 $Output .= '<strong>Nabídka:</strong>'.$this->ShowMenu(); 38 $Output .= '<strong>Nabídka:</strong>'.$this->ShowMenu(); 38 39 $Output .= '</td><td style="width: 80%; vertical-align: top;">'; 39 40 $Output .= $Content; 40 41 $Output .= '</td></tr></table>'; 41 42 } else $Output = $Content; 42 43 return($Output); 44 } 45 43 44 return($Output); 45 } 46 46 47 function Dashboard() 47 48 { 48 $Output = '<strong>Nástěnka:</strong><br/>'; 49 $Output = '<strong>Nástěnka:</strong><br/>'; 49 50 $DbResult = $this->Database->select('Task', 'COUNT(*)', 'Progress < 100'); 50 51 $DbRow = $DbResult->fetch_row(); … … 70 71 return($Output); 71 72 } 72 73 73 74 function ShowEdit($Table, $Id) 74 75 { … … 86 87 $Form->Validate(); 87 88 $Form->SaveValuesToDatabase($Id); 88 $Values = $Table.': '.str_replace('=>', '=', str_replace('array', '', var_export($Form->Values, true))); 89 $Values = $Table.': '.str_replace('=>', '=', str_replace('array', '', var_export($Form->Values, true))); 89 90 $this->System->ModuleManager->Modules['Log']->NewRecord('IS', 'Edit', $Values); 90 91 $Output .= $this->SystemMessage('Úprava položky', 'Položka upravena'); 91 $Output .= $this->ShowView($Table, $Id); 92 $Output .= $this->ShowView($Table, $Id); 92 93 } catch (Exception $E) 93 94 { … … 105 106 } 106 107 } 107 } else 108 } else 108 109 { 109 110 $Form = new Form($this->System->FormManager); … … 123 124 return($Output); 124 125 } 125 126 126 127 function ShowDelete($Table, $Id) 127 128 { … … 142 143 $Output .= $this->SystemMessage('Smazání položky', 'Položku se nepodařilo smazat. Pravděpodobně na ni závisejí další položky.'); 143 144 } 144 } else $Output .= $this->SystemMessage('Smazání položky', 'Položka nenalezena'); 145 $Output .= $this->ShowList($Table); 146 return($Output); 147 } 148 149 function ShowAdd($Table )145 } else $Output .= $this->SystemMessage('Smazání položky', 'Položka nenalezena'); 146 $Output .= $this->ShowList($Table); 147 return($Output); 148 } 149 150 function ShowAdd($Table, $Actions = array()) 150 151 { 151 152 $Output = ''; … … 158 159 $Form = new Form($this->System->FormManager); 159 160 $Form->SetClass($Table); 160 $Form->LoadValuesFromForm(); 161 $Form->LoadValuesFromForm(); 161 162 try { 162 163 $Form->Validate(); … … 170 171 $Form->SaveValuesToDatabase(0); 171 172 $Id = $this->Database->insert_id; 172 $Values = $Table.': '.str_replace('=>', '=', str_replace('array', '', var_export($Form->Values, true))); 173 $Values = $Table.': '.str_replace('=>', '=', str_replace('array', '', var_export($Form->Values, true))); 173 174 $this->System->ModuleManager->Modules['Log']->NewRecord('IS', 'Add', $Values); 174 175 $Output .= $this->SystemMessage('Přidání položky', 'Nová položka vytvořena'); 175 $Output .= $this->ShowView($Table, $Id );176 $Output .= $this->ShowView($Table, $Id, $_GET['a'] == 'addsub'); 176 177 if(array_key_exists('AfterInsert', $Form->Definition)) 177 178 { … … 180 181 $this->Values = $Class->$Method($Form); 181 182 } 182 //$this->Database->update($Table, 'Id='.$Id, 183 // array('UserCreate' => $this->System->User->User['Id'], 183 // Add action to update caller form 184 if($_GET['a'] == 'addsub') 185 { 186 $Type = $this->System->FormManager->FormTypes[$_GET['rt']]; 187 $DbResult = $this->Database->select($Table, '('.$Type['Name'].') AS Name', 'Id='.$Id); 188 $DbRow = $DbResult->fetch_assoc(); 189 $Actions[] = '<a href="javascript:window.close();" onclick="add_select_item('.$Id.',"'.$DbRow['Name'].'","'. 190 $_GET['r'].'"); set_return('.$Id.',"'. 191 $_GET['r'].'");"><img alt="Vybrat" title="Vybrat" src="'. 192 $this->System->Link('/images/select.png').'"/> Vybrat</a>'; 193 } 194 195 //$this->Database->update($Table, 'Id='.$Id, 196 // array('UserCreate' => $this->System->User->User['Id'], 184 197 // 'TimeCreate' => 'NOW()')); 185 198 } catch (Exception $E) … … 188 201 $Form->OnSubmit = '?a=add&t='.$Table.'&o=save'; 189 202 $Output .= $Form->ShowEditForm(); 190 $Output .= '<ul class="ActionMenu">'; 191 $Output .= '<li><a href="?a=list&t='.$Table.'"><img alt="Seznam" title="Seznam" src="'. 192 $this->System->Link('/images/list.png').'"/>Seznam</a></li>'; 193 $Output .= '</ul>'; 203 $Actions[] = '<a href="?a=list&t='.$Table.'"><img alt="Seznam" title="Seznam" src="'. 204 $this->System->Link('/images/list.png').'"/>Seznam</a>'; 194 205 } 195 206 } 196 } else 207 } else 197 208 { 198 209 $Form = new Form($this->System->FormManager); 199 210 $Form->SetClass($Table); 200 // Check preset name and value 201 if(array_key_exists('pn', $_GET) and array_key_exists('pv', $_GET)) 202 $Form->Values[$_GET['pn']] = $_GET['pv']; 203 $Form->OnSubmit = '?a=add&t='.$Table.'&o=save'; 211 // Load presets from URL 212 foreach($_GET as $Key => $Value) 213 if(substr($Key, 0, 6) == 'preset') 214 { 215 $Key = substr($Key, 6); 216 if(($Key != '') and array_key_exists($Key, $Form->Values)) 217 $Form->Values[$Key] = $Value; 218 } 219 if(array_key_exists('r', $_GET)) $URL = '&r='.$_GET['r'].'&rt='.$_GET['rt']; 220 else $URL = ''; 221 $Form->OnSubmit = '?a='.$_GET['a'].'&t='.$Table.'&o=save'.$URL; 204 222 $Output .= $Form->ShowEditForm(); 205 $Output .= '<ul class="ActionMenu">'; 206 $Output .= '<li><a href="?a=list&t='.$Table.'"><img alt="Seznam" title="Seznam" src="'. 207 $this->System->Link('/images/list.png').'"/>Seznam</a></li>'; 208 $Output .= '</ul>'; 209 } 210 return($Output); 211 } 212 213 function ShowView($Table, $Id) 223 $Actions[] = '<a href="?a=list&t='.$Table.'"><img alt="Seznam" title="Seznam" src="'. 224 $this->System->Link('/images/list.png').'"/>Seznam</a>'; 225 } 226 $Output .= '<ul class="ActionMenu">'; 227 foreach($Actions as $Action) 228 { 229 $Output .= '<li>'.$Action.'</li>'; 230 } 231 $Output .= '</ul>'; 232 return($Output); 233 } 234 235 function ShowAddSub($Table, $Filter = '', $Title = '') 236 { 237 if(defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Write')) 238 return('Nemáte oprávnění'); 239 $this->BasicHTML = true; 240 $this->HideMenu = true; 241 $Output = $this->ShowAdd($Table); 242 return($Output); 243 } 244 245 function ShowView($Table, $Id, $WithoutActions = false) 214 246 { 215 247 if($Table != '') $FormClass = $this->System->FormManager->Classes[$Table]; … … 217 249 if(defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Read')) 218 250 return('Nemáte oprávnění'); 219 251 220 252 $Form = new Form($this->System->FormManager); 221 253 $Form->SetClass($Table); … … 223 255 $Form->OnSubmit = '?a=view'; 224 256 $Output = $Form->ShowViewForm(); 257 if($WithoutActions == false) 258 { 259 $Actions = array( 260 '<a href="?a=edit&t='.$Table.'&i='.$Id.'"><img alt="Upravit" title="Upravit" src="'. 261 $this->System->Link('/images/edit.png').'"/>Upravit</a>', 262 '<a href="?a=list&t='.$Table.'"><img alt="Seznam" title="Seznam" src="'. 263 $this->System->Link('/images/list.png').'"/>Seznam</a>', 264 '<a href="?a=delete&t='.$Table.'&i='.$Id.'" onclick="return confirmAction(\'Opravdu smazat položku?\');"><img alt="Odstranit" title="Odstranit" src="'. 265 $this->System->Link('/images/delete.png').'" />Odstranit</a>', 266 '<a href="?a=add&t='.$Table.'"><img alt="Přidat" title="Přidat" src="'. 267 $this->System->Link('/images/add.png').'"/>Přidat</a>'); 268 if(array_key_exists('ItemActions', $FormClass)) 269 { 270 foreach($FormClass['ItemActions'] as $Action) 271 { 272 $URL = $this->System->Link($Action['URL']); 273 if(strpos($URL, '?') === false) $URL .= '?'; 274 else if((substr($URL, -5, 5) !== '&') and (substr($URL, -1, 1) !== '?')) $URL .= '&'; 275 $URL .= 'i='.$Id; 276 $Actions[] = '<a href="'.$URL.'"><img alt="'.$Action['Caption'].'" title="'.$Action['Caption'].'" src="'. 277 $this->System->Link('/images/action.png').'"/>'.$Action['Caption'].'</a>'; 278 } 279 } 225 280 $Output .= '<ul class="ActionMenu">'; 226 $Output .= '<li><a href="?a=edit&t='.$Table.'&i='.$Id.'"><img alt="Upravit" title="Upravit" src="'. 227 $this->System->Link('/images/edit.png').'"/>Upravit</a></li>'; 228 $Output .= '<li><a href="?a=list&t='.$Table.'"><img alt="Seznam" title="Seznam" src="'. 229 $this->System->Link('/images/list.png').'"/>Seznam</a></li>'; 230 $Output .= '<li><a href="?a=delete&t='.$Table.'&i='.$Id.'" onclick="return confirmAction(\'Opravdu smazat položku?\');"><img alt="Odstranit" title="Odstranit" src="'. 231 $this->System->Link('/images/delete.png').'" />Odstranit</a></li>'; 232 $Output .= '<li><a href="?a=add&t='.$Table.'"><img alt="Přidat" title="Přidat" src="'. 233 $this->System->Link('/images/add.png').'"/>Přidat</a></li>'; 234 if(array_key_exists('ItemActions', $FormClass)) 235 { 236 foreach($FormClass['ItemActions'] as $Action) 237 { 238 $URL = $this->System->Link($Action['URL']); 239 if(strpos('?', $URL) === false) $URL .= '?'; 240 else if((substr($URL, -5, 5) !== '&') and (substr($URL, -1, 1) !== '?')) $URL .= '&'; 241 $URL .= '&i='.$Id; 242 $Output .= '<li><a href="'.$URL.'"><img alt="'.$Action['Caption'].'" title="'.$Action['Caption'].'" src="'. 243 $this->System->Link('/images/action.png').'"/>'.$Action['Caption'].'</a></li>'; 244 } 245 } 281 foreach($Actions as $Action) 282 { 283 $Output .= '<li>'.$Action.'</li>'; 284 } 246 285 $Output .= '</ul><br/>'; 247 286 248 287 // Show ManyToOne relations 249 288 foreach($Form->Definition['Items'] as $Index => $Item) 250 if((array_key_exists($Item['Type'], $this->System->FormManager->FormTypes) and 289 if((array_key_exists($Item['Type'], $this->System->FormManager->FormTypes) and 251 290 ($this->System->FormManager->FormTypes[$Item['Type']]['Type'] == 'ManyToOne'))) 252 291 { 253 292 $Output .= $this->ShowList($this->System->FormManager->FormTypes[$Item['Type']]['Table'], '`'. 254 $this->System->FormManager->FormTypes[$Item['Type']]['Ref'].'`='.$Id, $Item['Caption'], 293 $this->System->FormManager->FormTypes[$Item['Type']]['Ref'].'`='.$Id, $Item['Caption'], 255 294 $this->System->FormManager->FormTypes[$Item['Type']]['Ref'], $Id).'<br/>'; 256 } 257 return($Output); 258 } 259 295 } 296 } 297 return($Output); 298 } 299 260 300 function ShowTable($Table, $Filter = '', $Title = '', $RowActions = array(), $ExcludeColumn = '') 261 { 301 { 262 302 if($Table != '') $FormClass = $this->System->FormManager->Classes[$Table]; 263 303 else return($this->SystemMessage('Chyba', 'Tabulka nenalezena')); … … 271 311 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 272 312 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 273 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 313 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 274 314 { 275 315 $UseType = $UseType = $FormItem['Type']; 276 316 if(array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes)) 277 317 { 278 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList)) 279 $this->System->FormManager->Type->RegisterType($FormItem['Type'], '', 318 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList)) 319 $this->System->FormManager->Type->RegisterType($FormItem['Type'], '', 280 320 $this->System->FormManager->FormTypes[$FormItem['Type']]); 281 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference') 321 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference') 282 322 $UseType = 'OneToMany'; 283 else 284 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration') 323 else 324 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration') 285 325 $UseType = 'Enumeration'; 286 326 } … … 290 330 $UserFilter .= ' AND ('.$FilterName.' LIKE "%'.$_POST['Filter'.$ItemIndex].'%")'; 291 331 } 292 } 332 } 293 333 if(($Filter == '') and ($UserFilter != '')) $Filter = '1 '.$UserFilter; 294 334 if($Filter != '') $Filter = ' WHERE '.$Filter; 295 335 296 336 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 297 337 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or … … 315 355 if(array_key_exists('Filter'.$ItemIndex, $_POST) and ($_POST['Filter'.$ItemIndex] != '')) 316 356 $Value = $_POST['Filter'.$ItemIndex]; 317 else $Value = ''; 357 else $Value = ''; 318 358 if($ItemIndex == 'Id') unset($Columns['Id']); 319 359 320 360 if(!array_key_exists('SQL', $FormItem)) $FormItem['SQL'] = ''; 321 361 else $FormItem['SQL'] = str_replace('#Id', '`'.$FormClass['Table'].'`.`Id`', $FormItem['SQL']); … … 324 364 'Type' => $FormItem['Type'], 'SQL' => $FormItem['SQL'])); 325 365 } 326 366 327 367 // Get total item count in database 328 368 $Query = 'SELECT COUNT(*) FROM `'.$FormClass['Table'].'`'; … … 330 370 $DbRow = $DbResult->fetch_assoc(); 331 371 $TotalCount = $DbRow['COUNT(*)']; 332 372 333 373 // Get total filtered item count in database 334 374 $Columns = implode(',', $Columns); 335 if($Filter != '') 375 if($Filter != '') 336 376 { 337 377 $Query = 'SELECT COUNT(*) FROM (SELECT '.$Columns.' FROM `'.$FormClass['Table'].'`) AS `TS` '.$Filter; … … 340 380 $TotalFilteredCount = $DbRow[0]; 341 381 } else $TotalFilteredCount = $TotalCount; 342 $PageList = GetPageList($TotalFilteredCount); 382 $PageList = GetPageList($TotalFilteredCount); 343 383 344 384 $Output = '<div style="text-align: center;">'.$FormClass['Title'].'</div>'; 345 385 $Output .= $PageList['Output']; 346 386 $Output .= '<table class="WideTable" style="font-size: small;">'; 347 387 348 388 $TableColumns[] = array('Name' => '', 'Title' => 'Akce'); 349 389 if(!array_key_exists('DefaultSortColumn', $FormClass)) … … 351 391 $Order = GetOrderTableHeader($TableColumns, $FormClass['DefaultSortColumn'], 0); 352 392 $Output .= $Order['Output']; 353 393 354 394 // Show search fields 355 395 if(array_key_exists('r', $_GET)) $Addition = '&r='.$_GET['r']; … … 364 404 if(array_key_exists('Filter'.$ItemIndex, $_POST) and ($_POST['Filter'.$ItemIndex] != '')) 365 405 $Value = $_POST['Filter'.$ItemIndex]; 366 else $Value = ''; 367 $Output .= '<td><input type="text" name="Filter'.$ItemIndex.'" value="'.$Value.'" style="width: 100%"/></td>'; 406 else $Value = ''; 407 $Output .= '<td><input type="text" name="Filter'.$ItemIndex.'" value="'.$Value.'" style="width: 100%"/></td>'; 368 408 } 369 409 $Output .= '<td><input type="Submit" value="Hledat"/></td></form></tr>'; 370 410 371 411 // Load and show items 372 412 $Query = 'SELECT * FROM (SELECT '.$Columns.' FROM `'.$FormClass['Table'].'`) AS `TS` '. 373 $Filter.' '.$Order['SQL'].$PageList['SQLLimit']; 413 $Filter.' '.$Order['SQL'].$PageList['SQLLimit']; 374 414 $VisibleItemCount = 0; 375 415 $DbResult = $this->Database->query($Query); 376 while($Row = $DbResult->fetch_assoc()) 377 { 416 while($Row = $DbResult->fetch_assoc()) 417 { 378 418 $Output .= '<tr>'; 379 419 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 380 if((!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 381 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 420 if((!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 421 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 382 422 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) and 383 423 ($ExcludeColumn != $ItemIndex)) … … 387 427 if(array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes)) 388 428 { 389 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList)) 390 $this->System->FormManager->Type->RegisterType($FormItem['Type'], '', 429 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList)) 430 $this->System->FormManager->Type->RegisterType($FormItem['Type'], '', 391 431 $this->System->FormManager->FormTypes[$FormItem['Type']]); 392 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference') 432 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference') 393 433 $UseType = 'OneToMany'; 394 else 395 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration') 434 else 435 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration') 396 436 $UseType = 'Enumeration'; 397 437 } 398 $Row[$ItemIndex] = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnLoadDb', 399 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 438 $Row[$ItemIndex] = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnLoadDb', 439 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 400 440 'Type' => $FormItem['Type'])); 401 $Value = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnView', 402 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 441 $Value = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnView', 442 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 403 443 'Type' => $FormItem['Type'], 'Filter' => $Row[$ItemIndex.'_Filter'])); 404 444 if($Value == '') $Value = ' '; … … 415 455 return($Output); 416 456 } 417 457 418 458 function ShowSelect($Table, $Filter = '', $Title = '') 419 { 459 { 420 460 if(defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Read')) 421 461 return('Nemáte oprávnění'); … … 425 465 $_GET['r'].'");"><img alt="Vybrat" title="Vybrat" src="'. 426 466 $this->System->Link('/images/select.png').'"/></a>'; 427 $Output = $this->ShowTable($Table, $Filter, $Title, $RowActions); 428 return($Output); 429 } 430 467 $Output = $this->ShowTable($Table, $Filter, $Title, $RowActions); 468 return($Output); 469 } 470 431 471 function ShowMapSelect($Table, $Filter = '', $Title = '') 432 472 { … … 434 474 return('Nemáte oprávnění'); 435 475 $MapApi = new MapApiGoogle($this->System); 436 $MapApi->Position = array('Lat' => $this->System->Config['Map']['DefaultLatitude'], 476 $MapApi->Position = array('Lat' => $this->System->Config['Map']['DefaultLatitude'], 437 477 'Lng' => $this->System->Config['Map']['DefaultLongitude']); 438 478 $MapApi->Zoom = $this->System->Config['Map']['DefaultZoom']; … … 440 480 $MapApi->OnClickObject = $_GET['r']; 441 481 //$MapApi->ShowMarker = true; 442 $Output = $MapApi->ShowPage($this); 443 return($Output); 444 } 445 446 function ShowList($Table, $Filter = '', $Title = '', $ExcludeColumn = '', $ExcludeValue = '') 482 $Output = $MapApi->ShowPage($this); 483 return($Output); 484 } 485 486 function ShowList($Table, $Filter = '', $Title = '', $ExcludeColumn = '', $ExcludeValue = '') 447 487 { 448 488 if(defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Read')) … … 461 501 { 462 502 $URL = $this->System->Link($Action['URL']); 463 if(strpos( '?', $URL) === false) $URL .= '?';503 if(strpos($URL, '?') === false) $URL .= '?'; 464 504 else if((substr($URL, -5, 5) !== '&') and (substr($URL, -1, 1) !== '?')) $URL .= '&'; 465 $URL .= ' &i=#RowId';505 $URL .= 'i=#RowId'; 466 506 $RowActions .= '<a href="'.$URL.'"><img alt="'.$Action['Caption'].'" title="'.$Action['Caption'].'" src="'. 467 507 $this->System->Link('/images/action.png').'"/></a>'; 468 508 } 469 } 509 } 470 510 $Output = $this->ShowTable($Table, $Filter, $Title, $RowActions, $ExcludeColumn); 471 511 $Output .= '<ul class="ActionMenu">'; 472 $Output .= '<li><a href="?a=add&t='.$Table.'&p n='.$ExcludeColumn.'&pv='.$ExcludeValue.'"><img alt="Přidat" title="Přidat" src="'.512 $Output .= '<li><a href="?a=add&t='.$Table.'&preset'.$ExcludeColumn.'='.$ExcludeValue.'"><img alt="Přidat" title="Přidat" src="'. 473 513 $this->System->Link('/images/add.png').'"/>Přidat</a></li>'; 474 514 $Output .= '<li><a href="?a=list&t='.$Table.'"><img alt="Seznam" title="Seznam" src="'. … … 481 521 } 482 522 $Output .= '</ul>'; 483 return($Output); 484 } 485 523 return($Output); 524 } 525 486 526 function ShowMenu() 487 527 { … … 499 539 return($this->ShowMenuItem('')); 500 540 } 501 541 502 542 function ShowMenuItem($Parent) 503 543 { … … 507 547 { 508 548 $LinkTitle = $MenuItem['Name']; 509 if($MenuItem['URL'] != '') 549 if($MenuItem['URL'] != '') 510 550 { 511 551 if(substr($MenuItem['URL'], 0, 4) != 'http') $MenuItem['URL'] = $this->System->Link($MenuItem['URL']); … … 514 554 if($MenuItem['IconName'] != '') $Image = '<img src="'.$this->System->Link('/images/favicons/'.$MenuItem['IconName']).'"/> '; 515 555 else $Image = '<img src="'.$this->System->Link('/images/favicons/blank.png').'"/> '; 516 //if($this->System->User->CheckPermission($this->TableToModule($Table), 'Write') or !defined('NEW_PERMISSION')) 556 //if($this->System->User->CheckPermission($this->TableToModule($Table), 'Write') or !defined('NEW_PERMISSION')) 517 557 $Output .= '<li>'.$Image.$LinkTitle.'</li>'; 518 558 $Output .= $this->ShowMenuItem($MenuItem['Id']); … … 521 561 return($Output); 522 562 } 523 563 524 564 function TableToModule($Table) 525 565 { … … 529 569 { 530 570 $DbRow = $DbResult->fetch_assoc(); 531 return($DbRow['Name']); 571 return($DbRow['Name']); 532 572 } else return(''); 533 573 } … … 545 585 $this->Description = 'User interface for generic information system'; 546 586 $this->Dependencies = array(); 547 } 587 } 548 588 549 589 function DoInstall() 550 590 { 551 591 } 552 592 553 593 function DoUninstall() 554 { 555 } 556 594 { 595 } 596 557 597 function DoStart() 558 598 { … … 576 616 'Items' => array('Type' => 'TMenuItemListMenu', 'Caption' => 'Položky'), 577 617 ), 578 )); 579 } 580 618 )); 619 } 620 581 621 function DoStop() 582 { 583 } 622 { 623 } 584 624 } -
trunk/style/new/global.js
r570 r639 77 77 window.opener.document.getElementById(obj).value = id; 78 78 } 79 80 function add_select_item(id, text, obj) 81 { 82 var option = window.opener.document.createElement('option') 83 option.value = id; 84 option.innerHTML = text; 85 window.opener.document.getElementById(obj).appendChild(option); 86 }
Note:
See TracChangeset
for help on using the changeset viewer.