Changeset 501 for trunk/Modules
- Timestamp:
- Mar 10, 2013, 8:15:46 PM (12 years ago)
- Location:
- trunk/Modules
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.