Changeset 501
- Timestamp:
- Mar 10, 2013, 8:15:46 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 deleted
- 23 edited
- 2 copied
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Database.php
r486 r501 38 38 var $ShowSQLQuery = false; 39 39 40 function __construct($Host, $User, $Password, $Database) 40 function __construct() 41 { 42 } 43 44 function Connect($Host, $User, $Password, $Database) 41 45 { 42 46 if($this->Type == 'mysql') $ConnectionString = 'mysql:host='.$Host.';dbname='.$Database; … … 66 70 $this->Error = $this->Error[2]; 67 71 if(($this->Error != '') and ($this->ShowSQLError == true)) 68 echo('<div><strong>SQL Error: </strong>'.$this->Error.'<br />'.$Query.'</div>'); 72 //echo('<div><strong>SQL Error: </strong>'.$this->Error.'<br />'.$Query.'</div>'); 73 throw new Exception('SQL Error: </strong>'.$this->Error.', Query: '.$Query); 69 74 } 70 75 return($Result); -
trunk/Common/Error.php
r476 r501 4 4 { 5 5 var $Encoding; 6 var $ShowError; 7 var $UserErrors; 6 8 7 9 function __construct() 8 10 { 9 11 $this->Encoding = 'utf-8'; 12 $this->ShowError = false; 13 $this->UserErrors = E_ALL; //E_ERROR | E_WARNING | E_PARSE; 10 14 } 11 15 … … 17 21 function Handle($Number, $Message, $FileName, $LineNumber, $Variables) 18 22 { 19 global $Config; 23 $Date = date('Y-m-d H:i:s'); // časové razítko položky 24 $ErrorType = array 25 ( 26 1 => 'Error', 27 2 => 'Warning', 28 4 => 'Parsing Error', 29 8 => 'Notice', 30 16 => 'Core Error', 31 32 => 'Core Warning', 32 64 => 'Compile Error', 33 128 => 'Compile Warning', 34 256 => 'User Error', 35 512 => 'User Warning', 36 1024 => 'User Notice' 37 ); 20 38 21 $Date = date('Y-m-d H:i:s'); // časové razítko položky 22 $ErrorType = array 23 ( 24 1 => 'Error', 25 2 => 'Warning', 26 4 => 'Parsing Error', 27 8 => 'Notice', 28 16 => 'Core Error', 29 32 => 'Core Warning', 30 64 => 'Compile Error', 31 128 => 'Compile Warning', 32 256 => 'User Error', 33 512 => 'User Warning', 34 1024 => 'User Notice' 35 ); 36 $UserErrors = E_ALL; //E_ERROR | E_WARNING | E_PARSE; 37 38 if(($UserErrors & $Number)) 39 { 40 $Error = '# '.$Date."\n"; 41 $Backtrace = debug_backtrace(); 42 $Backtrace[0]['function'] = $Message; 43 $Backtrace[0]['args'] = ''; 44 $Backtrace[0]['file'] = $FileName; 45 $Backtrace[0]['line'] = $LineNumber; 46 //$First = array_shift($Backtrace); 47 //print_r($Backtrace); 39 if(($this->UserErrors & $Number)) 40 { 41 $Error = '# '.$Date."\n"; 42 $Backtrace = debug_backtrace(); 43 $Backtrace[0]['function'] = $Message; 44 $Backtrace[0]['args'] = ''; 45 $Backtrace[0]['file'] = $FileName; 46 $Backtrace[0]['line'] = $LineNumber; 47 //$First = array_shift($Backtrace); 48 48 49 //array_unshift($Backtrace, $First); 50 //array_shift($Backtrace); 51 //print_r($Backtrace); 52 foreach($Backtrace as $Item) 53 { 54 $Error .= ' '.$Item['file'].'('.$Item['line'].")\t".$Item['function']; 55 $Arguments = ''; 56 if(array_key_exists('args', $Item) and is_array($Item['args'])) 49 //array_unshift($Backtrace, $First); 50 //array_shift($Backtrace); 51 foreach($Backtrace as $Item) 52 { 53 $Error .= ' '.$Item['file'].'('.$Item['line'].")\t".$Item['function']; 54 $Arguments = ''; 55 if(array_key_exists('args', $Item) and is_array($Item['args'])) 57 56 foreach($Item['args'] as $Item) 58 57 { … … 61 60 else $Arguments .= "'".$Item."',"; 62 61 } 63 if(strlen($Arguments) > 0) $Error .= '('.substr($Arguments, 0, -1).')'; 62 if(strlen($Arguments) > 0) $Error .= '('.substr($Arguments, 0, -1).')'; 63 $Error .= "\n"; 64 } 64 65 $Error .= "\n"; 65 66 67 $this->System->Modules['Log']->NewRecord('Error', 'Log', $Error); 68 69 //if($Config['Web']['ErrorLogFile'] != '') 70 // error_log($Error, 3, $Config['Web']['ErrorLogFile']); 71 // Pošli mi zprávu (pokud je to kritická chyba) 72 //mail($Config['Web']['AdminEmail'], $Config['Web']['Title'].' - Chybové hlášení', $Error); 73 // Show error message 74 if($this->ShowError == true) 75 { 76 echo('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>'."\n". 77 '<meta http-equiv="Content-Language" content="cs">'."\n". 78 '<meta http-equiv="Content-Type" content="text/html; charset='.$this->Encoding.'"></head><body>'."\n". 79 'Došlo k vnitřní chybě!<br/> O chybě byl uvědoměn správce webu a chybu brzy odstraní.<br/><br/>'); 80 echo('<pre>'.$Error.'</pre><br/>'); // V případě ladění chybu i zobraz 81 echo('</body></html>'); 82 } 83 if((E_ERROR | E_PARSE) & $Number) die(); 66 84 } 67 $Error .= "\n";68 69 $this->System->Modules['Log']->NewRecord('Error', 'Log', $Error);70 71 //if($Config['Web']['ErrorLogFile'] != '')72 //error_log($Error, 3, $Config['Web']['ErrorLogFile']);73 // Pošli mi zprávu (pokud je to kritická chyba)74 //mail($Config['Web']['AdminEmail'], $Config['Web']['Title'].' - Chybové hlášení', $Error);75 // Show error message76 if($Config['Web']['ShowPHPError'] == true)77 {78 echo('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>'."\n".79 '<meta http-equiv="Content-Language" content="cs">'."\n".80 '<meta http-equiv="Content-Type" content="text/html; charset='.$this->Encoding.'"></head><body>'."\n".81 'Došlo k vnitřní chybě!<br/> O chybě byl uvědoměn správce webu a chybu brzy odstraní.<br/><br/>');82 echo('<pre>'.$Error.'</pre><br/>'); // V případě ladění chybu i zobraz83 echo('</body></html>');84 }85 if((E_ERROR | E_PARSE) & $Number) die();86 }87 85 } 88 86 } -
trunk/Common/Form/Form.php
r500 r501 1 1 <?php 2 2 3 include_once(dirname(__FILE__).'/../ form_classes.php');4 include_once(dirname(__FILE__).'/ Database.php');3 include_once(dirname(__FILE__).'/../Database.php'); 4 include_once(dirname(__FILE__).'/Types/Type.php'); 5 5 6 6 class Form 7 7 { 8 var $Definition = array(); 9 var $Values = array(); 10 var $OnSubmit = ''; 11 12 function __construct($ClassName) 13 { 14 global $FormClasses; 15 16 $this->Definition = &$FormClasses[$ClassName]; 17 } 8 var $FormManager; 9 var $Definition; 10 var $Values; 11 var $OnSubmit; 12 var $Database; 13 14 function __construct($FormManager) 15 { 16 $this->FormManager = &$FormManager; 17 $this->Database = $FormManager->Database; 18 $this->Definition = array(); 19 $this->Values = array(); 20 $this->OnSubmit = ''; 21 } 22 23 function SetClass($Name) 24 { 25 $this->Definition = &$this->FormManager->Classes[$Name]; 26 } 18 27 19 28 function ShowViewForm() 20 29 { 21 global $Database, $FormTypes, $System;22 23 30 $Table = array( 24 31 //'Header' => array('Položka', 'Hodnota'), … … 26 33 ); 27 34 foreach($this->Definition['Items'] as $Index => $Item) 28 if(!array_key_exists($Item['Type'], $FormTypes) or 29 (array_key_exists($Item['Type'], $FormTypes) and ($FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 30 { 31 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 32 if(array_key_exists($Item['Type'], $FormTypes)) 33 { 34 if(!array_key_exists($Item['Type'], $System->Type->TypeDefinitionList)) 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') 35 if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 36 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 37 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 38 { 39 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 40 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 41 { 42 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 43 $this->FormManager->Type->RegisterType($Item['Type'], '', $this->FormManager->FormTypes[$Item['Type']]); 44 if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference') 45 $UseType = 'OneToMany'; 46 else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration') 39 47 $UseType = 'Enumeration'; 40 48 } else $UseType = $Item['Type']; 41 $Edit = $ System->Type->ExecuteTypeEvent($UseType, 'OnView',49 $Edit = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnView', 42 50 array('Value' => $this->Values[$Index], 'Name' => $Index, 43 51 'Type' => $Item['Type'], 'Values' => $this->Values)); 44 52 if(array_key_exists('Suffix', $Item)) $Edit .= ' '.$Item['Suffix']; 45 if(!$ System->Type->IsHidden($UseType))53 if(!$this->FormManager->Type->IsHidden($UseType)) 46 54 array_push($Table['Rows'], array($Item['Caption'].':', $Edit)); 47 55 } … … 62 70 function ShowEditBlock($Context = '') 63 71 { 64 global $Database, $FormTypes, $System;65 66 72 $Hidden = ''; 67 73 $IsHidden = false; … … 75 81 if(!array_key_exists('ReadOnly', $Item)) $Item['ReadOnly'] = false; 76 82 if($Item['ReadOnly'] == false) 77 if(!array_key_exists($Item['Type'], $FormTypes) or 78 (array_key_exists($Item['Type'], $FormTypes) and ($FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 83 if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 84 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 85 ($$this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 79 86 { 80 87 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; … … 84 91 else unset($Parameters['Null']); 85 92 86 if(array_key_exists($Item['Type'], $ FormTypes))87 { 88 if(!array_key_exists($Item['Type'], $ System->Type->TypeDefinitionList))89 $ System->Type->RegisterType($Item['Type'], '',90 $ FormTypes[$Item['Type']]);91 if($ FormTypes[$Item['Type']]['Type'] == 'Reference')93 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 94 { 95 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 96 $this->FormManager->Type->RegisterType($Item['Type'], '', 97 $this->FormManager->FormTypes[$Item['Type']]); 98 if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference') 92 99 { 93 100 $UseType = 'OneToMany'; 94 } else if($ FormTypes[$Item['Type']]['Type'] == 'Enumeration')95 $UseType = 'Enumeration'; 96 } else $UseType = $Item['Type']; 97 $Edit = $ System->Type->ExecuteTypeEvent($UseType, 'OnEdit', $Parameters);101 } else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration') 102 $UseType = 'Enumeration'; 103 } else $UseType = $Item['Type']; 104 $Edit = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnEdit', $Parameters); 98 105 if(array_key_exists('Suffix', $Item)) $Edit .= $Item['Suffix']; 99 106 100 if(!$ System->Type->IsHidden($UseType))107 if(!$this->FormManager->Type->IsHidden($UseType)) 101 108 array_push($Table['Rows'], array($Item['Caption'].':', $Edit)); 102 109 else $Hidden .= $Edit; … … 110 117 function LoadValuesFromDatabase($Id) 111 118 { 112 global $Database, $FormTypes, $System; 113 114 $DbResult = $Database->query('SELECT T.* FROM '.$this->Definition['Table'].' AS T WHERE T.Id='.$Id); 119 $DbResult = $this->Database->query('SELECT T.* FROM '.$this->Definition['Table'].' AS T WHERE T.Id='.$Id); 115 120 $DbRow = $DbResult->fetch_array(); 116 121 foreach($this->Definition['Items'] as $Index => $Item) 117 if(!array_key_exists($Item['Type'], $FormTypes) or 118 (array_key_exists($Item['Type'], $FormTypes) and ($FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 119 { 120 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 121 if(array_key_exists($Item['Type'], $FormTypes)) 122 { 123 if(!array_key_exists($Item['Type'], $System->Type->TypeDefinitionList)) 124 $System->Type->RegisterType($Item['Type'], '', 125 $FormTypes[$Item['Type']]); 126 if($FormTypes[$Item['Type']]['Type'] == 'Reference') 127 $UseType = 'OneToMany'; 128 else if($FormTypes[$Item['Type']]['Type'] == 'Enumeration') 129 $UseType = 'Enumeration'; 130 } else $UseType = $Item['Type']; 131 $this->Values[$Index] = $System->Type->ExecuteTypeEvent($UseType, 'OnLoadDb', 122 if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 123 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 124 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 125 { 126 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 127 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 128 { 129 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 130 $this->FormManager->Type->RegisterType($Item['Type'], '', 131 $this->FormManager->FormTypes[$Item['Type']]); 132 if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference') 133 $UseType = 'OneToMany'; 134 else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration') 135 $UseType = 'Enumeration'; 136 } else $UseType = $Item['Type']; 137 $this->Values[$Index] = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnLoadDb', 132 138 array('Value' => $DbRow[$Index], 'Name' => $Index, 133 139 'Type' => $Item['Type'], 'Values' => $this->Values)); … … 139 145 function SaveValuesToDatabase($Id) 140 146 { 141 global $Database, $FormTypes, $System;142 143 147 $Values = array(); 144 148 foreach($this->Definition['Items'] as $Index => $Item) … … 146 150 if(!array_key_exists('ReadOnly', $Item)) $Item['ReadOnly'] = false; 147 151 if($Item['ReadOnly'] == false) 148 if(!array_key_exists($Item['Type'], $FormTypes) or 149 (array_key_exists($Item['Type'], $FormTypes) and ($FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 152 if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 153 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 154 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 150 155 { 151 156 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; … … 153 158 'Type' => $Item['Type'], 'Values' => $this->Values); 154 159 155 if(array_key_exists($Item['Type'], $ FormTypes))156 { 157 if(!array_key_exists($Item['Type'], $ System->Type->TypeDefinitionList))158 $ System->Type->RegisterType($Item['Type'], '',159 $ FormTypes[$Item['Type']]);160 if($ FormTypes[$Item['Type']]['Type'] == 'Reference')160 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 161 { 162 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 163 $this->FormManager->Type->RegisterType($Item['Type'], '', 164 $this->FormManager->FormTypes[$Item['Type']]); 165 if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference') 161 166 { 162 167 $UseType = 'OneToMany'; 163 168 } 164 else if($ FormTypes[$Item['Type']]['Type'] == 'Enumeration')165 $UseType = 'Enumeration'; 166 } else $UseType = $Item['Type']; 167 $Values[$Index] = $ System->Type->ExecuteTypeEvent($UseType, 'OnSaveDb', $Parameters);169 else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration') 170 $UseType = 'Enumeration'; 171 } else $UseType = $Item['Type']; 172 $Values[$Index] = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnSaveDb', $Parameters); 168 173 if(($Item['Type'] == 'Password') and ($Values[$Index] == '')) unset($Values[$Index]); 169 174 … … 174 179 { 175 180 $Values['Id'] = $Id; 176 $DbResult = $ Database->insert($this->Definition['Table'], $Values);181 $DbResult = $this->Database->insert($this->Definition['Table'], $Values); 177 182 } else 178 $DbResult = $ Database->update($this->Definition['Table'], 'Id='.$Id, $Values);183 $DbResult = $this->Database->update($this->Definition['Table'], 'Id='.$Id, $Values); 179 184 //echo($Database->LastQuery); 180 185 } … … 187 192 function LoadValuesFromFormBlock($Context = '') 188 193 { 189 global $Database, $FormTypes, $System;190 191 194 if($Context != '') $Context = $Context.'-'; 192 195 $Values = array(); 193 196 foreach($this->Definition['Items'] as $Index => $Item) 194 if((!array_key_exists($Item['Type'], $ FormTypes) or195 (array_key_exists($Item['Type'], $ FormTypes) and196 ($ FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) and197 if((!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 198 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and 199 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) and 197 200 (!array_key_exists('ReadOnly', $Item) or 198 201 (array_key_exists('ReadOnly', $Item) and … … 200 203 { 201 204 //if(array_key_exists($Context.$Index, $_POST)) 202 if(array_key_exists($Item['Type'], $ FormTypes))203 { 204 if(!array_key_exists($Item['Type'], $ System->Type->TypeDefinitionList))205 $ System->Type->RegisterType($Item['Type'], '',206 $ FormTypes[$Item['Type']]);207 if($ FormTypes[$Item['Type']]['Type'] == 'Reference')208 $UseType = 'OneToMany'; 209 else if($ FormTypes[$Item['Type']]['Type'] == 'Enumeration')210 $UseType = 'Enumeration'; 211 } else $UseType = $Item['Type']; 212 $Values[$Index] = $ System->Type->ExecuteTypeEvent($UseType, 'OnLoad',205 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 206 { 207 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 208 $this->FormManager->Type->RegisterType($Item['Type'], '', 209 $this->FormManager->FormTypes[$Item['Type']]); 210 if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference') 211 $UseType = 'OneToMany'; 212 else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration') 213 $UseType = 'Enumeration'; 214 } else $UseType = $Item['Type']; 215 $Values[$Index] = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnLoad', 213 216 array('Name' => $Index, 'Type' => $Item['Type'], 'Values' => $this->Values)); 214 217 } … … 246 249 } 247 250 248 function ShowEditTable($ClassName, $Values) 249 { 251 class FormManager 252 { 253 var $Classes; 254 var $FormTypes; 255 var $Database; 256 var $Type; 257 258 function __construct($Database) 259 { 260 $this->Database = &$Database; 261 $this->Classes = array(); 262 $this->FormTypes = array(); 263 $this->Type = new Type($this); 264 } 265 266 function RegisterClass($Name, $Class) 267 { 268 $this->Classes[$Name] = $Class; 269 } 270 271 function UnregisterClass($Name) 272 { 273 unset($this->Classes[$Name]); 274 } 250 275 } 251 276 -
trunk/Common/Form/Types/Base.php
r484 r501 3 3 class TypeBase 4 4 { 5 var $System; 5 var $FormManager; 6 var $Database; 6 7 var $DatabaseCompareOperators = array(); 7 8 var $Hidden; 8 9 9 function __construct($ System)10 function __construct($FormManager) 10 11 { 11 $this->System = &$System; 12 $this->FormManager = &$FormManager; 13 $this->Database = &$FormManager->Database; 12 14 $this->Hidden = false; 13 15 } -
trunk/Common/Form/Types/Enumeration.php
r498 r501 7 7 function OnView($Item) 8 8 { 9 $Type = $this-> System->Type->GetTypeDefinition($Item['Type']);9 $Type = $this->FormManager->Type->GetTypeDefinition($Item['Type']); 10 10 if(array_key_exists($Item['Value'], $Type['Parameters']['States'])) 11 11 $Output = $Type['Parameters']['States'][$Item['Value']]; … … 16 16 function OnEdit($Item) 17 17 { 18 $Type = $this-> System->Type->GetTypeDefinition($Item['Type']);18 $Type = $this->FormManager->Type->GetTypeDefinition($Item['Type']); 19 19 $Output = '<select name="'.$Item['Name'].'">'; 20 20 if(array_key_exists('Null', $Item) and $Item['Null']) -
trunk/Common/Form/Types/Hidden.php
r484 r501 5 5 class TypeHidden extends TypeBase 6 6 { 7 function __construct($ System)7 function __construct($FormManager) 8 8 { 9 parent::__construct($ System);9 parent::__construct($FormManager); 10 10 $this->Hidden = true; 11 11 } -
trunk/Common/Form/Types/OneToMany.php
r483 r501 25 25 { 26 26 $Output = '<select name="'.$Item['Name'].'">'; 27 $Type = $this-> System->Type->TypeDefinitionList[$Item['Type']];27 $Type = $this->FormManager->Type->TypeDefinitionList[$Item['Type']]; 28 28 if(array_key_exists('Condition', $Type['Parameters'])) $Where = ' WHERE '.$Type['Parameters']['Condition']; 29 29 else $Where = ''; … … 35 35 if(array_key_exists('View', $Type['Parameters'])) $Table = $Type['Parameters']['View']; 36 36 else $Table = $Type['Parameters']['Table']; 37 $DbResult = $this-> System->Database->query('SELECT '.$Type['Parameters']['Name'].' AS `Name`,'.$Type['Parameters']['Id'].' AS `Id` FROM '.$Table.''.$Where.' ORDER BY `Name`');37 $DbResult = $this->Database->query('SELECT '.$Type['Parameters']['Name'].' AS `Name`,'.$Type['Parameters']['Id'].' AS `Id` FROM '.$Table.''.$Where.' ORDER BY `Name`'); 38 38 while($DbRow = $DbResult->fetch_assoc()) 39 39 { -
trunk/Common/Form/Types/RandomHash.php
r484 r501 5 5 class TypeRandomHash extends TypeBase 6 6 { 7 function __construct($ System)7 function __construct($FormManager) 8 8 { 9 parent::__construct($ System);9 parent::__construct($FormManager); 10 10 $this->Hidden = true; 11 11 } -
trunk/Common/Form/Types/Type.php
r500 r501 16 16 include(dirname(__FILE__).'/Hyperlink.php'); 17 17 include(dirname(__FILE__).'/Hidden.php'); 18 include(dirname(__FILE__).'/File/File.php'); 18 include(dirname(__FILE__).'/File.php'); 19 include(dirname(__FILE__).'/FileContent.php'); 19 20 include(dirname(__FILE__).'/GPS.php'); 20 21 include(dirname(__FILE__).'/IPv4Address.php'); … … 24 25 class Type 25 26 { 26 var $ System;27 var $FormManager; 27 28 var $TypeDefinitionList; 28 29 var $Values; 29 30 30 function __construct($ System)31 function __construct($FormManager) 31 32 { 32 $this-> System = $System;33 $this->FormManager = &$FormManager; 33 34 $this->TypeDefinitionList = array 34 35 ( … … 52 53 'Color' => array('Name' => 'Color', 'Class' => 'Color', 'ParentType' => '', 'Parameters' => array()), 53 54 'RandomHash' => array('Name' => 'RandomHash', 'Class' => 'RandomHash', 'ParentType' => '', 'Parameters' => array()), 55 'FileContent' => array('Name' => 'FileContent', 'Class' => 'FileContent', 'ParentType' => '', 'Parameters' => array()), 54 56 ); 55 57 } … … 61 63 $Type = $this->TypeDefinitionList[$TypeName]; 62 64 $TypeClass = 'Type'.$Type['Class']; 63 $TypeObject = new $TypeClass($this-> System);65 $TypeObject = new $TypeClass($this->FormManager); 64 66 if(is_callable(array($TypeObject, $Event))) return($TypeObject->$Event($Parameters)); 65 67 else return($TypeName.'->'.$Event.'('.serialize($Parameters).')'); … … 73 75 $Type = $this->TypeDefinitionList[$TypeName]; 74 76 $TypeClass = 'Type'.$Type['Class']; 75 $TypeObject = new $TypeClass($this-> System);77 $TypeObject = new $TypeClass($this->FormManager); 76 78 return($TypeObject->Hidden); 77 79 } else return(false); … … 92 94 } 93 95 96 function UnregisterType($Name) 97 { 98 unset($this->TypeDefinitionList[$Name]); 99 // TODO: remove dependent types 100 } 101 94 102 function GetTypeDefinition($TypeName) 95 103 { -
trunk/Common/Global.php
r500 r501 21 21 include_once(dirname(__FILE__).'/User.php'); 22 22 include_once(dirname(__FILE__).'/Page.php'); 23 include_once(dirname(__FILE__).'/Forms.php'); 24 include_once(dirname(__FILE__).'/Types/Type.php'); 23 include_once(dirname(__FILE__).'/Form/Form.php'); 25 24 include_once(dirname(__FILE__).'/File.php'); 26 25 include_once(dirname(__FILE__).'/../aktuality/news.php'); 27 26 include_once(dirname(__FILE__).'/../finance/bills.php'); 28 27 include_once(dirname(__FILE__).'/../finance/finance.php'); 28 include_once(dirname(__FILE__).'/../form_classes.php'); 29 29 30 30 31 // Application modules … … 57 58 parent::__construct(); 58 59 $this->Modules = array(); 59 $this->Type = new Type($this);60 60 $this->Pages = array(); 61 61 $this->ModuleManager = new AppModuleManager(); 62 62 $this->FilesDir = ''; 63 $this->Database = new Database(); 64 $this->FormManager = new FormManager($this->Database); 63 65 } 64 66 … … 101 103 function AddModule($Module) 102 104 { 103 global $Database;104 105 105 //echo('Přidávám modul '.get_class($Module).'<br />'); 106 106 $Module->System = &$this; 107 $Module->Database = &$ Database;107 $Module->Database = &$this->Database; 108 108 $this->Modules[get_class($Module)] = $Module; 109 109 } … … 166 166 167 167 if(!isset($Config)) die('Systém není nainstalován. Pokračujte v instalaci <a href="admin/install.php">zde</a>.'); 168 169 168 170 169 // SQL injection hack protection … … 174 173 if(isset($_SERVER['REMOTE_ADDR'])) session_start(); 175 174 176 $Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password'], $Config['Database']['Database']); 177 $Database->Prefix = $Config['Database']['Prefix']; 178 $Database->charset($Config['Database']['Charset']); 179 $Database->ShowSQLError = $Config['Web']['ShowSQLError']; 180 $Database->ShowSQLQuery = $Config['Web']['ShowSQLQuery']; 175 $System = new System(); 176 $System->Config = $Config; 177 $System->FilesDir = dirname(__FILE__).'/../'.$Config['Web']['UploadFileFolder'].'/'; 178 $System->Database->Connect($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password'], $Config['Database']['Database']); 179 $System->Database->Prefix = $Config['Database']['Prefix']; 180 $System->Database->charset($Config['Database']['Charset']); 181 $System->Database->ShowSQLError = $Config['Web']['ShowSQLError']; 182 $System->Database->ShowSQLQuery = $Config['Web']['ShowSQLQuery']; 181 183 182 184 // Check database persistence structure 183 185 $UpdateManager = new UpdateManager(); 184 $UpdateManager->Database = &$ Database;186 $UpdateManager->Database = &$System->Database; 185 187 $UpdateManager->Revision = $DatabaseRevision; 186 188 if(!$UpdateManager->IsInstalled()) die('Systém vyžaduje instalaci databáze.'); 187 189 if(!$UpdateManager->IsUpToDate()) die('Systém vyžaduje aktualizaci databáze.'); 188 190 189 $System = new System(); 190 $System->Config = $Config; 191 $System->FilesDir = dirname(__FILE__).'/../'.$Config['Web']['UploadFileFolder'].'/'; 192 $System->Database = &$Database; 191 // Init old modules 193 192 $System->AddModule(new Log()); 194 193 $System->AddModule(new ErrorHandler()); 194 $System->Modules['ErrorHandler']->ShowErrors = $Config['Web']['ShowPHPError']; 195 195 $System->Modules['ErrorHandler']->Init(); 196 196 $System->AddModule(new User()); … … 200 200 $System->AddModule(new Finance()); 201 201 $System->Modules['Finance']->LoadMonthParameters(0); 202 RegisterFormClasses($System->FormManager); 202 203 203 204 // Register new modules -
trunk/Common/Page.php
r494 r501 125 125 foreach($ScriptNameParts as $ScriptNamePart) 126 126 { 127 //echo($ScriptNamePart.'<br />');128 127 if(array_key_exists($ScriptNamePart, $PathTreeItem)) 129 128 { -
trunk/Common/Update.php
r493 r501 153 153 if(isset($_SERVER['REMOTE_ADDR'])) session_start(); 154 154 155 $Database = new Database($this->Config['Database']['Host'], $this->Config['Database']['User'], 155 $Database = new Database(); 156 $Database->Connect($this->Config['Database']['Host'], $this->Config['Database']['User'], 156 157 $this->Config['Database']['Password'], $this->Config['Database']['Database']); 157 158 $Database->Prefix = $this->Config['Database']['Prefix']; -
trunk/Common/Version.php
r500 r501 1 1 <?php 2 2 3 $Revision = 50 0; // Subversion revision4 $DatabaseRevision = 50 0;5 $ReleaseTime = '2013-03- 03';3 $Revision = 501; // Subversion revision 4 $DatabaseRevision = 501; 5 $ReleaseTime = '2013-03-10'; 6 6 7 7 ?> -
trunk/Modules/FinanceBankAPI/FileImport.php
r500 r501 1 1 <?php 2 2 3 include_once(dirname(__FILE__).'/../ Common/Global.php');3 include_once(dirname(__FILE__).'/../../Common/Global.php'); 4 4 5 5 class PageFileImport extends Page -
trunk/Modules/FinanceBankAPI/FinanceBankAPI.php
r500 r501 1 1 <?php 2 2 3 include_once( 'FileImport.php');3 include_once(dirname(__FILE__).'/FileImport.php'); 4 4 5 5 class ModuleFinanceBankAPI extends AppModule -
trunk/Modules/IS/IS.php
r498 r501 1 1 <?php 2 2 3 include_once( 'Common/Global.php');3 include_once(dirname(__FILE__).'/../../Common/Global.php'); 4 4 5 5 class PageIS extends Page … … 11 11 function Show() 12 12 { 13 global $FormClasses;14 15 13 if(!$this->System->Modules['User']->CheckPermission('IS', 'Manage')) 16 14 return('Nemáte oprávnění'); … … 55 53 if($_GET['o'] == 'save') 56 54 { 57 $Form = new Form($Table); 55 $Form = new Form($this->System->FormManager); 56 $Form->SetClass($Table); 58 57 $Form->LoadValuesFromForm(); 59 58 $Form->SaveValuesToDatabase($Id); … … 64 63 } else 65 64 { 66 $Form = new Form($Table); 65 $Form = new Form($this->System->FormManager); 66 $Form->SetClass($Table); 67 67 $Form->LoadValuesFromDatabase($Id); 68 68 $Form->OnSubmit = '?a=edit&o=save'; … … 97 97 if($_GET['o'] == 'save') 98 98 { 99 $Form = new Form($Table); 99 $Form = new Form($this->System->FormManager); 100 $Form->SetClass($Table); 100 101 $Form->LoadValuesFromForm(); 101 102 $Form->SaveValuesToDatabase(0); … … 111 112 } else 112 113 { 113 $Form = new Form($Table); 114 $Form = new Form($this->System->FormManager); 115 $Form->SetClass($Table); 114 116 $Form->OnSubmit = '?a=add&o=save'; 115 117 $Output .= $Form->ShowEditForm(); … … 124 126 function ShowView($Table, $Id) 125 127 { 126 global $FormTypes; 127 128 $Form = new Form($Table); 128 $Form = new Form($this->System->FormManager); 129 $Form->SetClass($Table); 129 130 $Form->LoadValuesFromDatabase($Id); 130 131 $Form->OnSubmit = '?a=view'; … … 143 144 // Show ManyToOne relations 144 145 foreach($Form->Definition['Items'] as $Index => $Item) 145 if((array_key_exists($Item['Type'], $FormTypes) and ($FormTypes[$Item['Type']]['Type'] == 'ManyToOne'))) 146 { 147 $Output .= $this->ShowList($FormTypes[$Item['Type']]['Table'], '`'.$FormTypes[$Item['Type']]['Ref'].'`='.$Id, $Item['Caption']).'<br/>'; 146 if((array_key_exists($Item['Type'], $this->System->FormManager->FormTypes) and 147 ($this->System->FormManager->FormTypes[$Item['Type']]['Type'] == 'ManyToOne'))) 148 { 149 $Output .= $this->ShowList($this->System->FormManager->FormTypes[$Item['Type']]['Table'], '`'. 150 $this->System->FormManager->FormTypes[$Item['Type']]['Ref'].'`='.$Id, $Item['Caption']).'<br/>'; 148 151 } 149 152 return($Output); … … 152 155 function ShowList($Table, $Filter = '', $Title = '') 153 156 { 154 global $Type, $FormTypes, $FormClasses; 155 156 if($Table != '') $FormClass = $FormClasses[$Table]; 157 if($Table != '') $FormClass = $this->System->FormManager->Classes[$Table]; 157 158 else return($this->SystemMessage('Chyba', 'Tabulka nenalezena')); 158 159 if($Filter != '') $Filter = ' WHERE '.$Filter; … … 166 167 167 168 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 168 if(!array_key_exists($FormItem['Type'], $FormTypes) or 169 (array_key_exists($FormItem['Type'], $FormTypes) and ($FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 169 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->Type) or 170 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 171 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 170 172 $TableColumns[] = array('Name' => $ItemIndex, 'Title' => $FormItem['Caption']); 171 173 $TableColumns[] = array('Name' => '', 'Title' => 'Akce'); … … 182 184 $Output .= '<tr>'; 183 185 foreach($FormClass['Items'] as $ItemIndex => $FormItem) 184 if(!array_key_exists($FormItem['Type'], $FormTypes) or 185 (array_key_exists($FormItem['Type'], $FormTypes) and ($FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 186 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or 187 (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and 188 ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne'))) 186 189 { 187 190 //$Output .= '<td>'.$Row[$ItemIndex].'</td>'; 188 191 $UseType = $UseType = $FormItem['Type']; 189 if(array_key_exists($FormItem['Type'], $ FormTypes))192 if(array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes)) 190 193 { 191 if(!array_key_exists($FormItem['Type'], $this->System-> Type->TypeDefinitionList))192 $this->System-> Type->RegisterType($FormItem['Type'], '',193 $ FormTypes[$FormItem['Type']]);194 if($ FormTypes[$FormItem['Type']]['Type'] == 'Reference')194 if(!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList)) 195 $this->System->FormManager->Type->RegisterType($FormItem['Type'], '', 196 $this->System->FormManager->FormTypes[$FormItem['Type']]); 197 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference') 195 198 $UseType = 'OneToMany'; 196 199 else 197 if($ FormTypes[$FormItem['Type']]['Type'] == 'Enumeration')200 if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration') 198 201 $UseType = 'Enumeration'; 199 202 } 200 $Row[$ItemIndex] = $this->System-> Type->ExecuteTypeEvent($UseType, 'OnLoadDb',203 $Row[$ItemIndex] = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnLoadDb', 201 204 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 202 205 'Type' => $FormItem['Type'])); 203 $Value = $this->System-> Type->ExecuteTypeEvent($UseType, 'OnView',206 $Value = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnView', 204 207 array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex, 205 208 'Type' => $FormItem['Type'])); -
trunk/Modules/Map/Map.php
r482 r501 1 1 <?php 2 2 3 include_once( 'Common/Global.php');3 include_once(dirname(__FILE__).'/../../Common/Global.php'); 4 4 5 5 class PageNetworkMap extends Page -
trunk/Modules/Meteostation/Meteostation.php
r479 r501 1 1 <?php 2 2 3 include_once( 'Common/Image.php');4 include_once( 'Common/Global.php');3 include_once(dirname(__FILE__).'/../../Common/Image.php'); 4 include_once(dirname(__FILE__).'/../../Common/Global.php'); 5 5 6 6 class PageMeteo extends Page -
trunk/Modules/Network/HostList.php
r470 r501 1 1 <?php 2 include_once('Common/Global.php'); 2 3 include_once(dirname(__FILE__).'/../../Common/Global.php'); 3 4 4 5 class PageHostList extends Page -
trunk/Modules/OpeningHours/OpeningHours.php
r473 r501 1 1 <?php 2 2 3 include_once( 'Common/Global.php');3 include_once(dirname(__FILE__).'/../../Common/Global.php'); 4 4 5 5 class PageSubjectOpenTime extends Page -
trunk/Modules/Portal/Portal.php
r494 r501 1 1 <?php 2 2 3 include_once( 'Common/Global.php');3 include_once(dirname(__FILE__).'/../../Common/Global.php'); 4 4 5 5 class PagePortal extends Page … … 45 45 $TotalUser = $DbRow[0]; 46 46 47 $DbResult = $this->Database->query('SELECT COUNT(DISTINCT(Member)) FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE NetworkDeviceType.ShowOnline = 1 AND NetworkDevice.Online = 1'); 47 $DbResult = $this->Database->query('SELECT COUNT(DISTINCT(Member)) FROM NetworkDevice '. 48 'LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type '. 49 'WHERE NetworkDeviceType.ShowOnline = 1 AND NetworkDevice.Online = 1'); 48 50 $DbRow = $DbResult->fetch_array(); 49 51 $OnlineUser = $DbRow[0]; … … 132 134 function Show() 133 135 { 134 global $ Database, $Config, $User;136 global $Config, $User; 135 137 136 138 $Output = ''; … … 143 145 if($_GET['Action'] == 'LoginForm') 144 146 { 145 $Form = new Form('UserLogin'); 147 $Form = new Form($this->System->FormManager); 148 $Form->SetClass('UserLogin'); 146 149 $Form->OnSubmit = '?Action=Login'; 147 150 $Output .= $Form->ShowEditForm(); … … 153 156 if(array_key_exists('Username', $_POST) and array_key_exists('Password', $_POST)) 154 157 { 155 $Form = new Form('UserLogin'); 158 $Form = new Form($this->System->FormManager); 159 $Form->SetClass('UserLogin'); 156 160 $Form->OnSubmit = '?Action=Login'; 157 161 $Result = $this->System->Modules['User']->Login($_POST['Username'], $_POST['Password']); … … 178 182 if($this->System->Modules['User']->User['Id'] != null) 179 183 { 180 $UserOptions = new Form('UserOptions'); 184 $UserOptions = new Form($this->System->FormManager); 185 $UserOptions->SetClass('UserOptions'); 181 186 $UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']); 182 187 $UserOptions->OnSubmit = '?Action=UserOptionsSave'; … … 186 191 if($_GET['Action'] == 'UserOptionsSave') 187 192 { 188 $UserOptions = new Form('UserOptions', array()); 193 $UserOptions = new Form($this->System->FormManager); 194 $UserOptions->SetClass('UserOptions'); 189 195 $UserOptions->LoadValuesFromForm(); 190 196 $UserOptions->SaveValuesToDatabase($this->System->Modules['User']->User['Id']); … … 197 203 if($_GET['Action'] == 'UserRegister') 198 204 { 199 $Form = new Form('UserRegister'); 205 $Form = new Form($this->System->FormManager); 206 $Form->SetClass('UserRegister'); 200 207 //$Form->LoadValuesFromForm(); 201 208 $Form->OnSubmit = '?Action=UserRegisterSave'; … … 209 216 if($_GET['Action'] == 'PasswordRecovery') 210 217 { 211 $Form = new Form('PasswordRecovery'); 218 $Form = new Form($this->System->FormManager); 219 $Form->SetClass('PasswordRecovery'); 212 220 $Form->OnSubmit = '?Action=PasswordRecovery2'; 213 221 $Output .= $Form->ShowEditForm(); … … 215 223 if($_GET['Action'] == 'PasswordRecovery2') 216 224 { 217 $Form = new Form('PasswordRecovery'); 225 $Form = new Form($this->System->FormManager); 226 $Form->SetClass('PasswordRecovery'); 218 227 $Form->LoadValuesFromForm(); 219 228 $Result = $this->System->Modules['User']->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']); … … 230 239 if($_GET['Action'] == 'UserRegisterSave') 231 240 { 232 $Form = new Form('UserRegister', array()); 241 $Form = new Form($this->System->FormManager); 242 $Form->SetClass('UserRegister'); 233 243 $Form->LoadValuesFromForm(); 234 244 $Result = $this->System->Modules['User']->Register($Form->Values['Login'], $Form->Values['Password'], $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Name'], $Form->Values['PhoneNumber'], $Form->Values['ICQ']); … … 242 252 if($_GET['Action'] == 'MemberOptions') 243 253 { 244 $UserOptions = new Form('MemberOptions'); 254 $Form = new Form($this->System->FormManager); 255 $Form->SetClass('MemberOptions'); 245 256 $DbResult = $this->Database->query('SELECT Customer FROM UserCustomerRel WHERE User='.$this->System->Modules['User']->User['Id']); 246 257 if($DbResult->num_rows > 0) … … 252 263 'ON Subject.Id = Member.Subject WHERE Member.Id='.$CustomerUserRel['Customer']); 253 264 $DbRow = $DbResult->fetch_array(); 254 foreach($ UserOptions->Definition['Items'] as $Index => $Item)265 foreach($Form->Definition['Items'] as $Index => $Item) 255 266 { 256 $ UserOptions->Values[$Index] = $DbRow[$Index];267 $Form->Values[$Index] = $DbRow[$Index]; 257 268 } 258 $ UserOptions->OnSubmit = '?Action=MemberOptionsSave';259 $Output .= $ UserOptions->ShowEditForm();269 $Form->OnSubmit = '?Action=MemberOptionsSave'; 270 $Output .= $Form->ShowEditForm(); 260 271 } else $Output .= $this->SystemMessage('Chyba', 'Nejste zákazníkem'); 261 272 } else 262 273 if($_GET['Action'] == 'MemberOptionsSave') 263 274 { 264 $UserOptions = new Form('MemberOptions'); 265 $UserOptions->LoadValuesFromForm(); 266 if($UserOptions->Values['FamilyMemberCount'] < 0) 267 $UserOptions->Values['FamilyMemberCount'] = 0; 268 if($UserOptions->Values['BillingPeriodNext'] < 2) 269 $UserOptions->Values['BillingPeriodNext'] = 2; 275 $Form = new Form($this->System->FormManager); 276 $Form->SetClass('MemberOptions'); 277 $Form->LoadValuesFromForm(); 278 if($Form->Values['FamilyMemberCount'] < 0) 279 $Form->Values['FamilyMemberCount'] = 0; 280 if($Form->Values['BillingPeriodNext'] < 2) 281 $Form->Values['BillingPeriodNext'] = 2; 270 282 271 283 $DbResult = $this->Database->update('Member', 'Id='.$this->System->Modules['User']->User['Member'], 272 array('FamilyMemberCount' => $ UserOptions->Values['FamilyMemberCount'],273 'BillingPeriodNext' => $ UserOptions->Values['BillingPeriodNext']));284 array('FamilyMemberCount' => $Form->Values['FamilyMemberCount'], 285 'BillingPeriodNext' => $Form->Values['BillingPeriodNext'])); 274 286 $DbResult = $this->Database->query('SELECT Subject FROM Member WHERE Id='.$this->System->Modules['User']->User['Member']); 275 287 $Member = $DbResult->fetch_assoc(); 276 288 $DbResult = $this->Database->update('Subject', 'Id='.$Member['Subject'], 277 array('Name' => $ UserOptions->Values['Name'], 'AddressStreet' => $UserOptions->Values['AddressStreet'],278 'AddressTown' => $ UserOptions->Values['AddressTown'], 'AddressCountry' => $UserOptions->Values['AddressCountry'],279 'AddressPSC' => $ UserOptions->Values['AddressPSC'], 'IC' => $UserOptions->Values['IC'],289 array('Name' => $Form->Values['Name'], 'AddressStreet' => $Form->Values['AddressStreet'], 290 'AddressTown' => $Form->Values['AddressTown'], 'AddressCountry' => $Form->Values['AddressCountry'], 291 'AddressPSC' => $Form->Values['AddressPSC'], 'IC' => $Form->Values['IC'], 280 292 'DIC' => $UserOptions->Values['DIC'])); 281 293 $Output .= $this->SystemMessage('Nastavení', 'Nastavení domácnosti uloženo.'); 282 $this->System->Modules['Log']->NewRecord('Member+Subject', 'Nastavení člena/subjektu změněno', $UserOptions->Values['Name']); 283 $DbResult = $this->Database->query('SELECT Member.Id, Member.FamilyMemberCount, Member.BillingPeriodNext, Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, Subject.AddressCountry, Subject.IC, Subject.DIC FROM Member JOIN Subject ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System->Modules['User']->User['Member']); 294 $this->System->Modules['Log']->NewRecord('Member+Subject', 'Nastavení člena/subjektu změněno', 295 $Form->Values['Name']); 296 $DbResult = $this->Database->query('SELECT Member.Id, Member.FamilyMemberCount, Member.BillingPeriodNext, '. 297 'Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, '. 298 'Subject.AddressCountry, Subject.IC, Subject.DIC FROM Member JOIN Subject '. 299 'ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System->Modules['User']->User['Member']); 284 300 $DbRow = $DbResult->fetch_array(); 285 foreach($ UserOptions->Definition['Items'] as $Index => $Item)286 { 287 $ UserOptions->Values[$Index] = $DbRow[$Index];301 foreach($Form->Definition['Items'] as $Index => $Item) 302 { 303 $Form->Values[$Index] = $DbRow[$Index]; 288 304 } 289 $ UserOptions->OnSubmit = '?Action=MemberOptionsSave';290 $Output .= $ UserOptions->ShowEditForm();305 $Form->OnSubmit = '?Action=MemberOptionsSave'; 306 $Output .= $Form->ShowEditForm(); 291 307 } 292 308 } 293 309 294 $ Database->select_db($Config['Database']['Database']);295 296 $DbResult = $ Database->query('SELECT * FROM `HyperlinkGroup`');310 $this->Database->select_db($Config['Database']['Database']); 311 312 $DbResult = $this->Database->query('SELECT * FROM `HyperlinkGroup`'); 297 313 while($DbRow = $DbResult->fetch_assoc()) 298 314 $HyperlinkGroups[$DbRow['Id']] = $DbRow; … … 302 318 //$Output .= $this->InfoBar(); 303 319 $Output .= '<table id="MainTable"><tr>'; 304 $DbResult = $ Database->select('PanelColumn', '*');320 $DbResult = $this->Database->select('PanelColumn', '*'); 305 321 while($PanelColumn = $DbResult->fetch_assoc()) 306 322 { … … 308 324 else $Width = ''; 309 325 $Output .= '<td valign="top"'.$Width.'>'; 310 $DbResult2 = $ Database->query('SELECT * FROM `Panel` WHERE `PanelColumn`='.$PanelColumn['Id'].' ORDER BY `Order`');326 $DbResult2 = $this->Database->query('SELECT * FROM `Panel` WHERE `PanelColumn`='.$PanelColumn['Id'].' ORDER BY `Order`'); 311 327 while($Panel = $DbResult2->fetch_assoc()) 312 328 { -
trunk/Modules/TV/TV.php
r494 r501 1 1 <?php 2 2 3 include_once( 'Common/Global.php');3 include_once(dirname(__FILE__).'/../../Common/Global.php'); 4 4 5 5 class PageIPTV extends Page -
trunk/aktuality/news.php
r500 r501 44 44 function ShowNews($Category, $ItemCount, $DaysAgo) 45 45 { 46 global $ Database, $NewsCategoryNames, $NewsCountPerCategory, $UploadedFilesFolder;46 global $NewsCategoryNames, $NewsCountPerCategory, $UploadedFilesFolder; 47 47 48 48 $ItemCount = abs($ItemCount); 49 49 $DaysAgo = abs($DaysAgo); 50 $DbResult = $ Database->select('NewsCategory', '*', 'Id='.$Category);50 $DbResult = $this->Database->select('NewsCategory', '*', 'Id='.$Category); 51 51 $Row = $DbResult->fetch_array(); 52 52 $Output = '<div class="NewsPanel"><div class="Title">'.$Row['Caption']; … … 55 55 $Output .= ' <a href="aktuality/index.php?action=add&category='.$Category.'">Přidat</a>'; 56 56 $Output .= '</div></div><div class="Content">'; 57 $DbResult = $Database->query('SELECT `News`.*, `User`.`Name` FROM `News` LEFT JOIN `User` ON `User`.`Id`=`News`.`User` WHERE (`News`.`Category`='.$Category.') AND (DATE_SUB(NOW(), INTERVAL '.$DaysAgo.' DAY) < `News`.`Date`) ORDER BY `News`.`Date` DESC LIMIT 0,'.$ItemCount); 58 //echo('<table cellpadding="0" cellspacing="0" width="100%"><tr><td>'); 57 $DbResult = $this->Database->query('SELECT `News`.*, `User`.`Name` FROM `News` LEFT JOIN `User` ON `User`.`Id`=`News`.`User` WHERE (`News`.`Category`='.$Category.') AND (DATE_SUB(NOW(), INTERVAL '.$DaysAgo.' DAY) < `News`.`Date`) ORDER BY `News`.`Date` DESC LIMIT 0,'.$ItemCount); 59 58 $Index = 0; 60 59 $FontSize = 12; -
trunk/finance/manage.php
r500 r501 1 1 <?php 2 2 3 include_once( '../Common/Global.php');3 include_once(dirname(__FILE__).'/../Common/Global.php'); 4 4 5 5 class FinanceManagePage extends Page … … 190 190 function ShowNewDeviceForm() 191 191 { 192 $Form = new Form('NewNetworkDevice'); 192 $Form = new Form($this->System->FormManager); 193 $Form->SetClass('NewNetworkDevice'); 193 194 $Form->OnSubmit = '?Operation=NewDeviceInsert'; 194 195 $Output = $Form->ShowEditForm(); … … 198 199 function ShowNewDeviceInsert() 199 200 { 200 $Form = new Form('NewNetworkDevice'); 201 $Form = new Form($this->System->FormManager); 202 $Form->SetClass('NewNetworkDevice'); 201 203 $Form->LoadValuesFromForm(); 202 204 $Form->SaveValuesToDatabase(0); … … 208 210 function ShowNewDeviceHistoryForm() 209 211 { 210 $Form = new Form('NewNetworkDeviceHistory'); 212 $Form = new Form($this->System->FormManager); 213 $Form->SetClass('NewNetworkDeviceHistory'); 211 214 $Form->OnSubmit = '?Operation=NewDeviceHistoryInsert'; 212 215 $Output = $Form->ShowEditForm(); … … 216 219 function ShowNewDeviceHistoryInsert() 217 220 { 218 $Form = new Form('NewNetworkDeviceHistory'); 221 $Form = new Form($this->System->FormManager); 222 $Form->SetClass('NewNetworkDeviceHistory'); 219 223 $Form->LoadValuesFromForm(); 220 224 $Form->SaveValuesToDatabase(0); … … 226 230 function ShowNewPaymentForm() 227 231 { 228 $Form = new Form('NewPayment'); 232 $Form = new Form($this->System->FormManager); 233 $Form->SetClass('NewPayment'); 229 234 $Form->OnSubmit = '?Operation=NewPaymentInsert'; 230 235 $Output = $Form->ShowEditForm(); … … 234 239 function ShowNewPaymentInsert() 235 240 { 236 $Form = new Form('NewPayment'); 241 $Form = new Form($this->System->FormManager); 242 $Form->SetClass('NewPayment'); 237 243 $Form->LoadValuesFromForm(); 238 244 $this->InsertMoney($Form->Values['Subject'], $Form->Values['Value'], $Form->Values['Cash'], $Form->Values['Taxable'], $Form->Values['Time'], $Form->Values['Text'], $Form->Values['DocumentLine']); … … 247 253 function ShowNewInvoiceForm() 248 254 { 249 $Form = new Form('NewInvoice'); 255 $Form = new Form($this->System->FormManager); 256 $Form->SetClass('NewInvoice'); 250 257 $Form->OnSubmit = '?Operation=NewInvoiceInsert'; 251 258 $Output = $Form->ShowEditForm(); … … 255 262 function ShowNewInvoiceInsert() 256 263 { 257 $Form = new Form('NewInvoice'); 264 $Form = new Form($this->System->FormManager); 265 $Form->SetClass('NewInvoice'); 258 266 $Form->LoadvaluesFromForm(); 259 267 $Items = array(array('Price' => $Form->Values['Value'], -
trunk/form_classes.php
r500 r501 16 16 */ 17 17 18 $FormClasses = array( 18 function RegisterFormClasses($FormManager) 19 { 20 $FormManager->Classes = array( 19 21 'ImportBankFile' => array( 20 22 'Title' => 'Import souborů s platbami', … … 841 843 ); 842 844 843 $Form Types = array(845 $FormManager->FormTypes = array( 844 846 'TServiceCategory' => array( 845 847 'Type' => 'Reference', … … 1285 1287 ), 1286 1288 ); 1287 1289 } 1288 1290 1289 1291 ?>
Note:
See TracChangeset
for help on using the changeset viewer.