Changeset 469 for trunk/Common
- Timestamp:
- Dec 30, 2012, 9:13:55 PM (13 years ago)
- Location:
- trunk/Common
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/AppModule.php
r467 r469 18 18 /** @var ModularSystem */ 19 19 var $Manager; 20 var $OnChange; 20 21 21 function __construct($ Database, $System)22 function __construct($System) 22 23 { 23 24 $this->System = &$System; 24 $this->Database = &$ Database;25 $this->Database = &$System->Database; 25 26 } 26 27 … … 39 40 function Stop() 40 41 { 42 } 43 } 44 45 class AppModuleManager 46 { 47 var $Modules; 48 49 function __construct() 50 { 51 $this->Modules = array(); 41 52 } 42 53 54 function StartAll() 55 { 56 foreach($this->Modules as $Index => $Module) 57 { 58 //DebugLog('Init module '.$Module->Name); 59 $this->Modules[$Index]->Start(); 60 } 61 } 62 63 function StopAll() 64 { 65 foreach($this->Modules as $Index => $Module) 66 { 67 //DebugLog('Init module '.$Module->Name); 68 $this->Modules[$Index]->Stop(); 69 } 70 } 71 72 function ModulePresent($Name) 73 { 74 return(array_key_exists($Name, $this->Modules)); 75 } 76 77 function RegisterModule(AppModule $Module) 78 { 79 $this->Modules[$Module->Name] = &$Module; 80 $Module->Manager = &$this; 81 $Module->OnChange = &$this->OnModuleChange; 82 } 83 84 function UnregisterModule($Module) 85 { 86 unset($this->Modules[array_search($Module, $this->Modules)]); 87 } 43 88 } 44 89 -
trunk/Common/Error.php
r445 r469 57 57 foreach($Item['args'] as $Item) 58 58 { 59 if(is_array($Item) ) $Arguments .= "'".serialize($Item)."',";59 if(is_array($Item) || is_object($Item)) $Arguments .= "'".serialize($Item)."',"; 60 60 else $Arguments .= "'".$Item."',"; 61 61 } -
trunk/Common/Global.php
r463 r469 2 2 3 3 $ConfigFileName = dirname(__FILE__).'/../config.php'; 4 /* @var $System System */ 5 $System = NULL; 6 /* @var $Database Database */ 7 $Database = NULL; 4 8 5 9 if(file_exists($ConfigFileName)) include_once($ConfigFileName); … … 23 27 24 28 include_once(dirname(__FILE__).'/../Modules/Meteostation/Meteostation.php'); 29 include_once(dirname(__FILE__).'/../Modules/Portal/Portal.php'); 25 30 26 31 $PrefixMultipliers = array … … 95 100 class System extends Module 96 101 { 97 var $Modules = array();102 var $Modules; 98 103 /** @var Type */ 99 104 var $Type; 105 var $Pages; 106 /** @var AppModuleManager */ 107 var $ModuleManager; 100 108 101 109 function __construct() 102 110 { 103 111 parent::__construct(); 112 $this->Modules = array(); 104 113 $this->Type = new Type($this); 114 $this->Pages = array(); 115 $this->ModuleManager = new AppModuleManager(); 116 } 117 118 function RegisterPage($Path, $Handler) 119 { 120 $this->Pages[$Path] = $Handler; 121 } 122 123 function ShowPage($Path) 124 { 125 /* @var $Page Page */ 126 $ClassName = $this->Pages[$Path]; 127 $Page = new $ClassName(); 128 $Page->System = &$this; 129 $Page->Database = &$this->Database; 130 $Page->GetOutput(); 105 131 } 106 132 … … 209 235 210 236 return($Config['Web']['RootFolder'].$Target); 211 } 237 } 212 238 } 213 239 … … 243 269 $System->AddModule(new Finance()); 244 270 $System->Modules['Finance']->LoadMonthParameters(0); 271 272 // Register new modules 273 $System->ModuleManager->RegisterModule(new Meteostation($System)); 274 $System->ModuleManager->RegisterModule(new Portal($System)); 275 $System->ModuleManager->StartAll(); 245 276 } 246 277
Note:
See TracChangeset
for help on using the changeset viewer.