- Timestamp:
- Feb 17, 2021, 12:30:23 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 57 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Core.php
r897 r899 9 9 include_once(dirname(__FILE__).'/FullInstall.php'); 10 10 include_once(dirname(__FILE__).'/UpdateTrace.php'); 11 include_once(dirname(__FILE__).'/ View.php');11 include_once(dirname(__FILE__).'/BaseView.php'); 12 12 include_once(dirname(__FILE__).'/DefaultConfig.php'); 13 13 14 class Core extends Application14 class Core extends System 15 15 { 16 16 public Type $Type; … … 145 145 function StartModules(): void 146 146 { 147 $ModuleSetup = $this->ModuleManager->LoadModule(dirname(__FILE__).'/ Modules/Setup.php');147 $ModuleSetup = $this->ModuleManager->LoadModule(dirname(__FILE__).'/../Packages/Common/Modules/Setup.php'); 148 148 $ModuleSetup->Install(); 149 149 $ModuleSetup->Start(); 150 150 $this->ModuleManager->LoadModules(); 151 $this->ModuleManager->LoadModule(dirname(__FILE__).'/ Modules/ModuleManager.php');151 $this->ModuleManager->LoadModule(dirname(__FILE__).'/../Packages/Common/Modules/ModuleManager.php'); 152 152 if (file_exists($this->ModuleManager->FileName)) $this->ModuleManager->LoadState(); 153 153 $this->ModuleManager->StartAll(array(ModuleCondition::Enabled)); -
trunk/Application/Version.php
r889 r899 1 1 <?php 2 2 3 $Revision = 8 87; // Subversion revision3 $Revision = 899; // Subversion revision 4 4 $DatabaseRevision = 885; // SQL structure revision 5 $ReleaseTime = strtotime('202 0-12-22');5 $ReleaseTime = strtotime('2021-02-17'); -
trunk/Install/deb/debian/control
r857 r899 8 8 Package: isp-central 9 9 Architecture: all 10 Depends: ${shlibs:Depends}, ${misc:Depends}, apache2, php, dbconfig-mysql, fping, htmldoc, php-mbstring 10 Depends: ${shlibs:Depends}, ${misc:Depends}, apache2, php, dbconfig-mysql, fping, htmldoc, php-mbstring, sendmail 11 11 Description: Web interface for ISP network management 12 12 HomePage: https://app.zdechov.net/isp-central -
trunk/Modules/API/API.php
r894 r899 15 15 */ 16 16 17 class ModuleAPI extends AppModule17 class ModuleAPI extends Module 18 18 { 19 19 function __construct(System $System) … … 23 23 $this->Version = '1.0'; 24 24 $this->Creator = 'Chronos'; 25 $this->License = 'GNU/GPL ';25 $this->License = 'GNU/GPLv3'; 26 26 $this->Description = 'Remote API for support of other clients'; 27 $this->Dependencies = array('User'); 27 $this->Dependencies = array(ModuleUser::GetName()); 28 $this->Models = array(APIToken::GetClassName()); 28 29 } 29 30 … … 32 33 $this->System->RegisterPage(['api'], 'PageAPI'); 33 34 } 34 35 function GetModels(): array36 {37 return array(APIToken::GetClassName());38 }39 35 } 40 36 41 37 class ApiToken extends Model 42 38 { 43 static function Get Desc(): ModelDesc39 static function GetModelDesc(): ModelDesc 44 40 { 45 41 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/Chat/Chat.php
r894 r899 85 85 } 86 86 87 class ModuleChat extends AppModule87 class ModuleChat extends Module 88 88 { 89 89 function __construct(System $System) … … 93 93 $this->Version = '1.0'; 94 94 $this->Creator = 'Chronos'; 95 $this->License = 'GNU/GPL ';95 $this->License = 'GNU/GPLv3'; 96 96 $this->Description = 'Show history of IRC chat and previous SunriseChat'; 97 $this->Dependencies = array(); 98 } 99 100 function GetModels(): array 101 { 102 return array(ChatHistory::GetClassName()); 97 $this->Models = array(ChatHistory::GetClassName()); 103 98 } 104 99 … … 111 106 class ChatHistory extends Model 112 107 { 113 static function Get Desc(): ModelDesc108 static function GetModelDesc(): ModelDesc 114 109 { 115 110 $Desc = new ModelDesc(self::GetClassName()); … … 121 116 $Desc->AddInteger('RoomType'); 122 117 $Desc->AddString('Host'); 123 118 return $Desc; 124 119 } 125 120 } -
trunk/Modules/Config/Config.php
r897 r899 1 1 <?php 2 2 3 class ModuleConfig extends AppModule3 class ModuleConfig extends Module 4 4 { 5 5 function __construct(System $System) 6 6 { 7 7 parent::__construct($System); 8 $this->Name = ' Config';8 $this->Name = 'Desc'; 9 9 $this->Version = '1.0'; 10 10 $this->Creator = 'Chronos'; 11 11 $this->License = 'GNU/GPLv3'; 12 12 $this->Description = 'Configuration support for other modules'; 13 $this->Dependencies = array('System'); 14 $this->Revision = 1; 13 $this->Dependencies = array(ModuleSystem::GetName()); 15 14 $this->Type = ModuleType::System; 16 15 } 17 18 function GetModels(): array19 {20 return array();21 }22 23 function DoStart(): void24 {25 }26 16 } -
trunk/Modules/Customer/Customer.php
r896 r899 1 1 <?php 2 2 3 class ModuleCustomer extends AppModule3 class ModuleCustomer extends Module 4 4 { 5 5 function __construct(System $System) … … 9 9 $this->Version = '1.0'; 10 10 $this->Creator = 'Chronos'; 11 $this->License = 'GNU/GPL ';11 $this->License = 'GNU/GPLv3'; 12 12 $this->Description = 'Customer management'; 13 $this->Dependencies = array('User', 'Finance'); 13 $this->Dependencies = array(ModuleUser::GetName(), ModuleFinance::GetName()); 14 $this->Models = array(Member::GetClassName(), MemberPayment::GetClassName(), SupportActivity::GetClassName(), ServiceCategory::GetClassName(), 15 Service::GetClassName(), ServiceCustomerRel::GetClassName(), UserCustomerRel::GetClassName()); 14 16 } 15 17 … … 199 201 } 200 202 201 function GetModels(): array202 {203 return array(Member::GetClassName(), MemberPayment::GetClassName(), SupportActivity::GetClassName(), ServiceCategory::GetClassName(),204 Service::GetClassName(), ServiceCustomerRel::GetClassName(), UserCustomerRel::GetClassName());205 }206 207 203 function ShowDashboardItem(): string 208 204 { … … 221 217 class Member extends Model 222 218 { 223 static function Get Desc(): ModelDesc219 static function GetModelDesc(): ModelDesc 224 220 { 225 221 $Desc = new ModelDesc(self::GetClassName()); … … 242 238 class MemberPayment extends Model 243 239 { 244 static function Get Desc(): ModelDesc240 static function GetModelDesc(): ModelDesc 245 241 { 246 242 $Desc = new ModelDesc(self::GetClassName()); … … 257 253 class Service extends Model 258 254 { 259 static function Get Desc(): ModelDesc255 static function GetModelDesc(): ModelDesc 260 256 { 261 257 $Desc = new ModelDesc(self::GetClassName()); … … 279 275 class ServiceCategory extends Model 280 276 { 281 static function Get Desc(): ModelDesc277 static function GetModelDesc(): ModelDesc 282 278 { 283 279 $Desc = new ModelDesc(self::GetClassName()); … … 289 285 class SupportActivity extends Model 290 286 { 291 static function Get Desc(): ModelDesc287 static function GetModelDesc(): ModelDesc 292 288 { 293 289 $Desc = new ModelDesc(self::GetClassName()); … … 302 298 class ServiceCustomerRel extends Model 303 299 { 304 static function Get Desc(): ModelDesc300 static function GetModelDesc(): ModelDesc 305 301 { 306 302 $Desc = new ModelDesc(self::GetClassName()); … … 315 311 class UserCustomerRel extends Model 316 312 { 317 static function Get Desc(): ModelDesc313 static function GetModelDesc(): ModelDesc 318 314 { 319 315 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/Document/Document.php
r894 r899 1 1 <?php 2 2 3 class ModuleDocument extends AppModule3 class ModuleDocument extends Module 4 4 { 5 5 function __construct(System $System) … … 9 9 $this->Version = '1.0'; 10 10 $this->Creator = 'Chronos'; 11 $this->License = 'GNU/GPL ';11 $this->License = 'GNU/GPLv3'; 12 12 $this->Description = 'Documents support'; 13 $this->Dependencies = array(); 13 $this->Models = array(FinanceYear::GetClassName(), DocumentLineCode::GetClassName(), DocumentLine::GetClassName(), 14 DocumentLineSequence::GetClassName()); 14 15 } 15 16 … … 79 80 )); 80 81 } 81 82 function GetModels(): array83 {84 return array(FinanceYear::GetClassName(), DocumentLineCode::GetClassName(), DocumentLine::GetClassName(),85 DocumentLineSequence::GetClassName());86 }87 82 } 88 83 89 84 class DocumentLine extends Model 90 85 { 91 static function Get Desc(): ModelDesc86 static function GetModelDesc(): ModelDesc 92 87 { 93 88 $Desc = new ModelDesc(self::GetClassName()); … … 101 96 class DocumentLineCode extends Model 102 97 { 103 static function Get Desc(): ModelDesc98 static function GetModelDesc(): ModelDesc 104 99 { 105 100 $Desc = new ModelDesc(self::GetClassName()); … … 112 107 class DocumentLineSequence extends Model 113 108 { 114 static function Get Desc(): ModelDesc109 static function GetModelDesc(): ModelDesc 115 110 { 116 111 $Desc = new ModelDesc(self::GetClassName()); … … 125 120 class FinanceYear extends Model 126 121 { 127 static function Get Desc(): ModelDesc122 static function GetModelDesc(): ModelDesc 128 123 { 129 124 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/EmailQueue/EmailQueue.php
r894 r899 21 21 class EmailQueue extends Model 22 22 { 23 static function Get Desc(): ModelDesc23 static function GetModelDesc(): ModelDesc 24 24 { 25 25 $Desc = new ModelDesc(self::GetClassName()); … … 36 36 } 37 37 38 class ModuleEmailQueue extends AppModule38 class ModuleEmailQueue extends Module 39 39 { 40 40 function __construct(System $System) … … 46 46 $this->License = 'GNU/GPLv3'; 47 47 $this->Description = 'Queue for delayed email sending and history'; 48 $this->Dependencies = array('Log'); 49 } 50 51 function GetModels(): array 52 { 53 return array(EmailQueue::GetClassName()); 48 $this->Dependencies = array(ModuleLog::GetName()); 49 $this->Models = array(EmailQueue::GetClassName()); 54 50 } 55 51 … … 123 119 } 124 120 125 static function Cast( AppModule $AppModule): ModuleEmailQueue121 static function Cast(Module $Module): ModuleEmailQueue 126 122 { 127 if ($ AppModule instanceof ModuleEmailQueue)123 if ($Module instanceof ModuleEmailQueue) 128 124 { 129 return $ AppModule;125 return $Module; 130 126 } 131 throw new Exception('Expected ModuleEmailQueue type but '.gettype($ AppModule));127 throw new Exception('Expected ModuleEmailQueue type but '.gettype($Module)); 132 128 } 133 129 } -
trunk/Modules/Employee/Employee.php
r894 r899 3 3 class Employee extends Model 4 4 { 5 static function Get Desc(): ModelDesc5 static function GetModelDesc(): ModelDesc 6 6 { 7 7 $Desc = new ModelDesc(self::GetClassName()); … … 20 20 class EmployeeSalary extends Model 21 21 { 22 static function Get Desc(): ModelDesc22 static function GetModelDesc(): ModelDesc 23 23 { 24 24 $Desc = new ModelDesc(self::GetClassName()); … … 31 31 } 32 32 33 class ModuleEmployee extends AppModule33 class ModuleEmployee extends Module 34 34 { 35 35 function __construct(System $System) … … 39 39 $this->Version = '1.0'; 40 40 $this->Creator = 'Chronos'; 41 $this->License = 'GNU/GPL ';41 $this->License = 'GNU/GPLv3'; 42 42 $this->Description = 'Employee wages management'; 43 $this->Dependencies = array('User', 'Finance'); 44 } 45 46 function GetModels(): array 47 { 48 return array(Employee::GetClassName(), EmployeeSalary::GetClassName()); 43 $this->Dependencies = array(ModuleUser::GetName(), ModuleFinance::GetName()); 44 $this->Models = array(Employee::GetClassName(), EmployeeSalary::GetClassName()); 49 45 } 50 46 -
trunk/Modules/Error/Error.php
r893 r899 1 1 <?php 2 2 3 class ModuleError extends AppModule3 class ModuleError extends Module 4 4 { 5 5 public string $Encoding; … … 14 14 $this->License = 'GNU/GPLv3'; 15 15 $this->Description = 'Error logging and reporting'; 16 $this->Dependencies = array( 'Log');16 $this->Dependencies = array(ModuleLog::GetName()); 17 17 18 18 $this->ErrorHandler = new ErrorHandler(); -
trunk/Modules/File/File.php
r894 r899 13 13 } 14 14 15 static function Get Desc(): ModelDesc15 static function GetModelDesc(): ModelDesc 16 16 { 17 17 $Desc = new ModelDesc('File'); … … 116 116 class FileDirectory extends Model 117 117 { 118 static function Get Desc(): ModelDesc118 static function GetModelDesc(): ModelDesc 119 119 { 120 120 $Desc = new ModelDesc('FileDirectory'); … … 175 175 } 176 176 177 class ModuleFile extends AppModule177 class ModuleFile extends Module 178 178 { 179 179 public File $File; … … 187 187 $this->License = 'GNU/GPLv3'; 188 188 $this->Description = 'Base module for file management'; 189 $this->Dependencies = array('User'); 189 $this->Dependencies = array(ModuleUser::GetName()); 190 $this->Models = array(FileDirectory::GetClassName(), File::GetClassName()); 190 191 191 192 $this->File = new File($this->System); 192 }193 194 function GetModels(): array195 {196 return array(FileDirectory::GetClassName(), File::GetClassName());197 193 } 198 194 … … 292 288 } 293 289 294 static function Cast( AppModule $AppModule): ModuleFile295 { 296 if ($ AppModule instanceof ModuleFile)297 { 298 return $ AppModule;299 } 300 throw new Exception('Expected ModuleFile type but got '.gettype($ AppModule));301 } 302 } 290 static function Cast(Module $Module): ModuleFile 291 { 292 if ($Module instanceof ModuleFile) 293 { 294 return $Module; 295 } 296 throw new Exception('Expected ModuleFile type but got '.gettype($Module)); 297 } 298 } -
trunk/Modules/Finance/Finance.php
r894 r899 8 8 include_once(dirname(__FILE__).'/Trade.php'); 9 9 10 class ModuleFinance extends AppModule10 class ModuleFinance extends Module 11 11 { 12 12 public Finance $Finance; … … 21 21 $this->License = 'GNU/GPLv3'; 22 22 $this->Description = 'Base module for finance management'; 23 $this->Dependencies = array('File', 'EmailQueue', 'Subject', 'Document'); 24 25 $this->Bill = new Bill($this->System); 26 $this->Finance = new Finance($this->System); 27 } 28 29 function GetModels(): array 30 { 31 return array(FinanceBillingPeriod::GetClassName(), FinanceVatType::GetClassName(), FinanceVat::GetClassName(), 23 $this->Dependencies = array(ModuleFile::GetName(), ModuleEmailQueue::GetName(), ModuleSubject::GetName(), ModuleDocument::GetName()); 24 $this->Models = array(FinanceBillingPeriod::GetClassName(), FinanceVatType::GetClassName(), FinanceVat::GetClassName(), 32 25 FinanceGroup::GetClassName(), FinanceOperationGroup::GetClassName(), FinanceOperation::GetClassName(), 33 26 FinanceInvoiceGroup::GetClassName(), FinanceInvoice::GetClassName(), FinanceInvoiceItem::GetClassName(), … … 35 28 Currency::GetClassName(), FinanceBank::GetClassName(), FinanceBankAccount::GetClassName(), FinanceCharge::GetClassName(), 36 29 Contract::GetClassName(), FinanceInvoiceOperationRel::GetClassName()); 30 31 $this->Bill = new Bill($this->System); 32 $this->Finance = new Finance($this->System); 37 33 } 38 34 … … 632 628 } 633 629 634 static function Cast( AppModule $AppModule): ModuleFinance635 { 636 if ($ AppModule instanceof ModuleFinance)630 static function Cast(Module $Module): ModuleFinance 631 { 632 if ($Module instanceof ModuleFinance) 637 633 { 638 return $ AppModule;634 return $Module; 639 635 } 640 throw new Exception('Expected ModuleFinance type but '.gettype($ AppModule));636 throw new Exception('Expected ModuleFinance type but '.gettype($Module)); 641 637 } 642 638 } -
trunk/Modules/Finance/FinanceModels.php
r894 r899 217 217 class FinanceGroup extends Model 218 218 { 219 static function Get Desc(): ModelDesc219 static function GetModelDesc(): ModelDesc 220 220 { 221 221 $Desc = new ModelDesc(self::GetClassName()); … … 227 227 class FinanceOperation extends Model 228 228 { 229 static function Get Desc(): ModelDesc229 static function GetModelDesc(): ModelDesc 230 230 { 231 231 $Desc = new ModelDesc(self::GetClassName()); … … 250 250 class FinanceOperationGroup extends Model 251 251 { 252 static function Get Desc(): ModelDesc252 static function GetModelDesc(): ModelDesc 253 253 { 254 254 $Desc = new ModelDesc(self::GetClassName()); … … 263 263 class FinanceInvoice extends Model 264 264 { 265 static function Get Desc(): ModelDesc265 static function GetModelDesc(): ModelDesc 266 266 { 267 267 $Desc = new ModelDesc(self::GetClassName()); … … 285 285 class FinanceInvoiceGroup extends Model 286 286 { 287 static function Get Desc(): ModelDesc287 static function GetModelDesc(): ModelDesc 288 288 { 289 289 $Desc = new ModelDesc(self::GetClassName()); … … 298 298 class Company extends Model 299 299 { 300 static function Get Desc(): ModelDesc300 static function GetModelDesc(): ModelDesc 301 301 { 302 302 $Desc = new ModelDesc(self::GetClassName()); … … 309 309 class FinanceInvoiceItem extends Model 310 310 { 311 static function Get Desc(): ModelDesc311 static function GetModelDesc(): ModelDesc 312 312 { 313 313 $Desc = new ModelDesc(self::GetClassName()); … … 323 323 class FinanceTreasury extends Model 324 324 { 325 static function Get Desc(): ModelDesc325 static function GetModelDesc(): ModelDesc 326 326 { 327 327 $Desc = new ModelDesc(self::GetClassName()); … … 334 334 class FinanceTreasuryCheck extends Model 335 335 { 336 static function Get Desc(): ModelDesc336 static function GetModelDesc(): ModelDesc 337 337 { 338 338 $Desc = new ModelDesc(self::GetClassName()); … … 357 357 class FinanceBankAccount extends Model 358 358 { 359 static function Get Desc(): ModelDesc359 static function GetModelDesc(): ModelDesc 360 360 { 361 361 $Desc = new ModelDesc(self::GetClassName()); … … 379 379 class FinanceBank extends Model 380 380 { 381 static function Get Desc(): ModelDesc381 static function GetModelDesc(): ModelDesc 382 382 { 383 383 $Desc = new ModelDesc(self::GetClassName()); … … 392 392 class Currency extends Model 393 393 { 394 static function Get Desc(): ModelDesc394 static function GetModelDesc(): ModelDesc 395 395 { 396 396 $Desc = new ModelDesc(self::GetClassName()); … … 404 404 class FinanceCharge extends Model 405 405 { 406 static function Get Desc(): ModelDesc406 static function GetModelDesc(): ModelDesc 407 407 { 408 408 $Desc = new ModelDesc(self::GetClassName()); … … 422 422 class FinanceVat extends Model 423 423 { 424 static function Get Desc(): ModelDesc424 static function GetModelDesc(): ModelDesc 425 425 { 426 426 $Desc = new ModelDesc(self::GetClassName()); … … 435 435 class FinanceVatType extends Model 436 436 { 437 static function Get Desc(): ModelDesc437 static function GetModelDesc(): ModelDesc 438 438 { 439 439 $Desc = new ModelDesc(self::GetClassName()); … … 445 445 class Contract extends Model 446 446 { 447 static function Get Desc(): ModelDesc447 static function GetModelDesc(): ModelDesc 448 448 { 449 449 $Desc = new ModelDesc(self::GetClassName()); … … 460 460 class FinanceBillingPeriod extends Model 461 461 { 462 static function Get Desc(): ModelDesc462 static function GetModelDesc(): ModelDesc 463 463 { 464 464 $Desc = new ModelDesc(self::GetClassName()); … … 471 471 class FinanceInvoiceOperationRel extends Model 472 472 { 473 static function Get Desc(): ModelDesc473 static function GetModelDesc(): ModelDesc 474 474 { 475 475 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/FinanceBankAPI/FileImport.php
r887 r899 180 180 function Insert(): string 181 181 { 182 $Finance = $ModuleFinance::Cast($this->System->GetModule('Finance'))->Finance;182 $Finance = ModuleFinance::Cast($this->System->GetModule('Finance'))->Finance; 183 183 $Output = ''; 184 184 -
trunk/Modules/FinanceBankAPI/FinanceBankAPI.php
r894 r899 8 8 class FinanceBankImport extends Model 9 9 { 10 static function Get Desc(): ModelDesc10 static function GetModelDesc(): ModelDesc 11 11 { 12 12 $Desc = new ModelDesc(self::GetClassName()); … … 27 27 } 28 28 29 class ModuleFinanceBankAPI extends AppModule29 class ModuleFinanceBankAPI extends Module 30 30 { 31 31 function __construct(System $System) … … 37 37 $this->License = 'GNU/GPLv3'; 38 38 $this->Description = 'Communication through API to various banks, manual file import'; 39 $this->Dependencies = array('Finance', 'Scheduler', 'IS'); 40 } 41 42 function GetModels(): array 43 { 44 return array(FinanceBankImport::GetClassName()); 39 $this->Dependencies = array(ModuleFinance::GetName(), ModuleScheduler::GetName(), ModuleIS::GetName()); 40 $this->Models = array(FinanceBankImport::GetClassName()); 45 41 } 46 42 -
trunk/Modules/IS/IS.php
r894 r899 845 845 class Menu extends Model 846 846 { 847 static function Get Desc(): ModelDesc847 static function GetModelDesc(): ModelDesc 848 848 { 849 849 $Desc = new ModelDesc(self::GetClassName()); … … 855 855 class MenuItem extends Model 856 856 { 857 static function Get Desc(): ModelDesc857 static function GetModelDesc(): ModelDesc 858 858 { 859 859 $Desc = new ModelDesc(self::GetClassName()); … … 868 868 class MenuItemFavorite extends Model 869 869 { 870 static function Get Desc(): ModelDesc870 static function GetModelDesc(): ModelDesc 871 871 { 872 872 $Desc = new ModelDesc(self::GetClassName()); … … 877 877 } 878 878 879 class ModuleIS extends AppModule879 class ModuleIS extends Module 880 880 { 881 881 public array $DashboardItems; … … 890 890 $this->License = 'GNU/GPLv3'; 891 891 $this->Description = 'User interface for generic information system'; 892 $this->Dependencies = array('User'); 892 $this->Dependencies = array(ModuleUser::GetName()); 893 $this->Models = array(Menu::GetClassName(), MenuItem::GetClassName(), MenuItemFavorite::GetClassName()); 893 894 894 895 $this->DashboardItems = array(); 895 }896 897 function GetModels(): array898 {899 return array(Menu::GetClassName(), MenuItem::GetClassName(), MenuItemFavorite::GetClassName());900 896 } 901 897 … … 956 952 } 957 953 958 static function Cast( AppModule $AppModule): ModuleIS959 { 960 if ($ AppModule instanceof ModuleIS)961 { 962 return $ AppModule;963 } 964 throw new Exception('Expected ModuleIS type but '.gettype($ AppModule));954 static function Cast(Module $Module): ModuleIS 955 { 956 if ($Module instanceof ModuleIS) 957 { 958 return $Module; 959 } 960 throw new Exception('Expected ModuleIS type but '.gettype($Module)); 965 961 } 966 962 } -
trunk/Modules/Log/Log.php
r894 r899 1 1 <?php 2 2 3 class ModuleLog extends AppModule3 class ModuleLog extends Module 4 4 { 5 5 function __construct(System $System) … … 11 11 $this->License = 'GNU/GPLv3'; 12 12 $this->Description = 'Logging user actions'; 13 $this->Dependencies = array('User', 'RSS'); 14 } 15 16 function GetModels(): array 17 { 18 return array('Log'); 13 $this->Dependencies = array(ModuleUser::GetName(), ModuleRSS::GetName()); 14 $this->Models = array(Log::GetClassName()); 19 15 } 20 16 … … 91 87 } 92 88 93 static function Cast( AppModule $AppModule): ModuleLog89 static function Cast(Module $Module): ModuleLog 94 90 { 95 if ($ AppModule instanceof ModuleLog)91 if ($Module instanceof ModuleLog) 96 92 { 97 return $ AppModule;93 return $Module; 98 94 } 99 throw new Exception('Expected ModuleLog type but got '.gettype($ AppModule));95 throw new Exception('Expected ModuleLog type but got '.gettype($Module)); 100 96 } 101 97 } … … 103 99 class Log extends Model 104 100 { 105 static function Get Desc(): ModelDesc101 static function GetModelDesc(): ModelDesc 106 102 { 107 103 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/Map/Map.php
r894 r899 257 257 } 258 258 259 class ModuleMap extends AppModule259 class ModuleMap extends Module 260 260 { 261 261 function __construct(System $System) … … 265 265 $this->Version = '1.0'; 266 266 $this->Creator = 'Chronos'; 267 $this->License = 'GNU/GPL ';267 $this->License = 'GNU/GPLv3'; 268 268 $this->Description = 'Show objects on Google maps'; 269 $this->Dependencies = array( 'Network', 'User');270 $this-> SupportedModels = array();269 $this->Dependencies = array(ModuleNetwork::GetName(), ModuleUser::GetName()); 270 $this->Models = array(MapPosition::GetClassName()); 271 271 } 272 272 … … 313 313 )); 314 314 } 315 316 function GetModels(): array317 {318 return array(MapPosition::GetClassName());319 }320 315 } 321 316 322 317 class MapPosition extends Model 323 318 { 324 static function Get Desc(): ModelDesc319 static function GetModelDesc(): ModelDesc 325 320 { 326 321 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/Meals/Meals.php
r894 r899 182 182 } 183 183 184 class ModuleMeals extends AppModule184 class ModuleMeals extends Module 185 185 { 186 186 function __construct(System $System) … … 190 190 $this->Version = '1.0'; 191 191 $this->Creator = 'Chronos'; 192 $this->License = 'GNU/GPL ';192 $this->License = 'GNU/GPLv3'; 193 193 $this->Description = 'Module for management meals. Can print week menu.'; 194 $this->Dependencies = array('Log'); 195 $this->SupportedModels = array('Meals', 'MealsInfo'); 196 } 197 198 function GetModels(): array 199 { 200 return array(Meals::GetClassName(), MealsInfo::GetClassName()); 194 $this->Dependencies = array(ModuleLog::GetName()); 195 $this->Models = array(Meals::GetClassName(), MealsInfo::GetClassName()); 201 196 } 202 197 … … 209 204 class Meals extends Model 210 205 { 211 static function Get Desc(): ModelDesc206 static function GetModelDesc(): ModelDesc 212 207 { 213 208 $Desc = new ModelDesc(self::GetClassName()); … … 222 217 class MealsInfo extends Model 223 218 { 224 static function Get Desc(): ModelDesc219 static function GetModelDesc(): ModelDesc 225 220 { 226 221 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/Meteostation/Meteostation.php
r894 r899 77 77 } 78 78 79 class ModuleMeteoStation extends AppModule79 class ModuleMeteoStation extends Module 80 80 { 81 81 function __construct(System $System) … … 87 87 $this->License = 'GNU/GPLv3'; 88 88 $this->Description = 'Gathering and presentation of data from network meteostation.'; 89 $this->Dependencies = array();90 89 } 91 90 -
trunk/Modules/Monitoring/Monitoring.php
r895 r899 1 1 <?php 2 2 3 class ModuleMonitoring extends AppModule3 class ModuleMonitoring extends Module 4 4 { 5 5 function __construct(System $System) … … 11 11 $this->License = 'GNU/GPLv3'; 12 12 $this->Description = 'Monitoring for various states'; 13 $this->Dependencies = array();14 13 } 15 14 -
trunk/Modules/Network/Network.php
r895 r899 100 100 } 101 101 102 class ModuleNetwork extends AppModule102 class ModuleNetwork extends Module 103 103 { 104 104 public int $MinNotifyTime; … … 112 112 $this->License = 'GNU/GPLv3'; 113 113 $this->Description = 'Networking related tools'; 114 $this->Dependencies = array('Notify', 'IS'); 115 116 // TODO: Make notify time configurable 117 $this->MinNotifyTime = 30; // seconds 118 } 119 120 function GetModels(): array 121 { 122 return array(NetworkDomainAlias::GetClassName(), NetworkDevice::GetClassName(), NetworkDeviceType::GetClassName(), 114 $this->Dependencies = array(ModuleNotify::GetName(), ModuleIS::GetName()); 115 $this->Models = array(NetworkDomainAlias::GetClassName(), NetworkDevice::GetClassName(), NetworkDeviceType::GetClassName(), 123 116 NetworkDeviceLog::GetClassName(), NetworkInterface::GetClassName(), NetworkInterfaceType::GetClassName(), 124 117 NetworkSubnet::GetClassName(), NetworkPort::GetClassName(), NetworkSpeedLimit::GetClassName(), … … 128 121 NetworkDomainItemFilter::GetClassName(), DeviceAPIType::GetClassName(), NetworkInterfaceWireless::GetClassName(), 129 122 NetworkInterfaceUpDown::GetClassName(), NetworkPortUpDown::GetClassName()); 123 124 // TODO: Make notify time configurable 125 $this->MinNotifyTime = 30; // seconds 130 126 } 131 127 -
trunk/Modules/Network/NetworkModels.php
r895 r899 3 3 class NetworkDomainAlias extends Model 4 4 { 5 static function Get Desc(): ModelDesc5 static function GetModelDesc(): ModelDesc 6 6 { 7 7 $Desc = new ModelDesc(self::GetClassName()); … … 16 16 class NetworkDevice extends Model 17 17 { 18 static function Get Desc(): ModelDesc18 static function GetModelDesc(): ModelDesc 19 19 { 20 20 $Desc = new ModelDesc(self::GetClassName()); … … 39 39 class NetworkDeviceType extends Model 40 40 { 41 static function Get Desc(): ModelDesc41 static function GetModelDesc(): ModelDesc 42 42 { 43 43 $Desc = new ModelDesc(self::GetClassName()); … … 51 51 class NetworkDeviceLog extends Model 52 52 { 53 static function Get Desc(): ModelDesc53 static function GetModelDesc(): ModelDesc 54 54 { 55 55 $Desc = new ModelDesc(self::GetClassName()); … … 64 64 class NetworkInterface extends Model 65 65 { 66 static function Get Desc(): ModelDesc66 static function GetModelDesc(): ModelDesc 67 67 { 68 68 $Desc = new ModelDesc(self::GetClassName()); … … 83 83 class NetworkInterfaceType extends Model 84 84 { 85 static function Get Desc(): ModelDesc85 static function GetModelDesc(): ModelDesc 86 86 { 87 87 $Desc = new ModelDesc(self::GetClassName()); … … 96 96 class NetworkSubnet extends Model 97 97 { 98 static function Get Desc(): ModelDesc98 static function GetModelDesc(): ModelDesc 99 99 { 100 100 $Desc = new ModelDesc(self::GetClassName()); … … 121 121 class NetworkPort extends Model 122 122 { 123 static function Get Desc(): ModelDesc123 static function GetModelDesc(): ModelDesc 124 124 { 125 125 $Desc = new ModelDesc(self::GetClassName()); … … 137 137 class NetworkSpeedLimit extends Model 138 138 { 139 static function Get Desc(): ModelDesc139 static function GetModelDesc(): ModelDesc 140 140 { 141 141 $Desc = new ModelDesc(self::GetClassName()); … … 150 150 class NetworkInterfaceLatency extends Model 151 151 { 152 static function Get Desc(): ModelDesc152 static function GetModelDesc(): ModelDesc 153 153 { 154 154 $Desc = new ModelDesc(self::GetClassName()); … … 162 162 class NetworkLink extends Model 163 163 { 164 static function Get Desc(): ModelDesc164 static function GetModelDesc(): ModelDesc 165 165 { 166 166 $Desc = new ModelDesc(self::GetClassName()); … … 174 174 class NetworkLinkType extends Model 175 175 { 176 static function Get Desc(): ModelDesc176 static function GetModelDesc(): ModelDesc 177 177 { 178 178 $Desc = new ModelDesc(self::GetClassName()); … … 188 188 class NetworkSignal extends Model 189 189 { 190 static function Get Desc(): ModelDesc190 static function GetModelDesc(): ModelDesc 191 191 { 192 192 $Desc = new ModelDesc(self::GetClassName()); … … 204 204 class NetworkAddressCategory extends Model 205 205 { 206 static function Get Desc(): ModelDesc206 static function GetModelDesc(): ModelDesc 207 207 { 208 208 $Desc = new ModelDesc(self::GetClassName()); … … 214 214 class NetworkDomain extends Model 215 215 { 216 static function Get Desc(): ModelDesc216 static function GetModelDesc(): ModelDesc 217 217 { 218 218 $Desc = new ModelDesc(self::GetClassName()); … … 232 232 class NetworkDomainServer extends Model 233 233 { 234 static function Get Desc(): ModelDesc234 static function GetModelDesc(): ModelDesc 235 235 { 236 236 $Desc = new ModelDesc(self::GetClassName()); … … 244 244 class NetworkDomainView extends Model 245 245 { 246 static function Get Desc(): ModelDesc246 static function GetModelDesc(): ModelDesc 247 247 { 248 248 $Desc = new ModelDesc(self::GetClassName()); … … 257 257 class NetworkDomainItemFilter extends Model 258 258 { 259 static function Get Desc(): ModelDesc259 static function GetModelDesc(): ModelDesc 260 260 { 261 261 $Desc = new ModelDesc(self::GetClassName()); … … 272 272 class DeviceAPIType extends Model 273 273 { 274 static function Get Desc(): ModelDesc274 static function GetModelDesc(): ModelDesc 275 275 { 276 276 $Desc = new ModelDesc(self::GetClassName()); … … 282 282 class NetworkInterfaceWireless extends Model 283 283 { 284 static function Get Desc(): ModelDesc284 static function GetModelDesc(): ModelDesc 285 285 { 286 286 $Desc = new ModelDesc(self::GetClassName()); … … 305 305 class NetworkDeviceConfig extends Model 306 306 { 307 static function Get Desc(): ModelDesc307 static function GetModelDesc(): ModelDesc 308 308 { 309 309 $Desc = new ModelDesc(self::GetClassName()); … … 318 318 class NetworkInterfaceUpDown extends Model 319 319 { 320 static function Get Desc(): ModelDesc320 static function GetModelDesc(): ModelDesc 321 321 { 322 322 $Desc = new ModelDesc(self::GetClassName()); … … 331 331 class NetworkPortUpDown extends Model 332 332 { 333 static function Get Desc(): ModelDesc333 static function GetModelDesc(): ModelDesc 334 334 { 335 335 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/NetworkConfig/NetworkConfig.php
r894 r899 1 1 <?php 2 2 3 class ModuleNetworkConfig extends AppModule3 class ModuleNetworkConfig extends Module 4 4 { 5 5 public array $ConfigItems; … … 11 11 $this->Version = '1.0'; 12 12 $this->Creator = 'Chronos'; 13 $this->License = 'GNU/GPL ';13 $this->License = 'GNU/GPLv3'; 14 14 $this->Description = 'Network device remote configuration'; 15 $this->Dependencies = array('Network'); 15 $this->Dependencies = array(ModuleNetwork::GetName()); 16 $this->Models = array(NetworkConfigurationLog::GetClassName(), NetworkConfiguration::GetClassName()); 17 16 18 $this->ConfigItems = array(); 17 }18 19 function GetModels(): array20 {21 return array(NetworkConfigurationLog::GetClassName(), NetworkConfiguration::GetClassName());22 19 } 23 20 … … 90 87 } 91 88 92 static function Cast( AppModule $AppModule): ModuleNetworkConfig89 static function Cast(Module $Module): ModuleNetworkConfig 93 90 { 94 if ($ AppModule instanceof ModuleNetworkConfig)91 if ($Module instanceof ModuleNetworkConfig) 95 92 { 96 return $ AppModule;93 return $Module; 97 94 } 98 throw new Exception('Expected ModuleNetworkConfig type but got '.gettype($ AppModule));95 throw new Exception('Expected ModuleNetworkConfig type but got '.gettype($Module)); 99 96 } 100 97 } … … 109 106 class NetworkConfiguration extends Model 110 107 { 111 static function Get Desc(): ModelDesc108 static function GetModelDesc(): ModelDesc 112 109 { 113 110 $Desc = new ModelDesc(self::GetClassName()); … … 125 122 class NetworkConfigurationLog extends Model 126 123 { 127 static function Get Desc(): ModelDesc124 static function GetModelDesc(): ModelDesc 128 125 { 129 126 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/NetworkConfigAirOS/NetworkConfigAirOS.php
r894 r899 3 3 include_once(dirname(__FILE__).'/Generators/Signal.php'); 4 4 5 class ModuleNetworkConfigAirOS extends AppModule5 class ModuleNetworkConfigAirOS extends Module 6 6 { 7 7 function __construct(System $System) … … 11 11 $this->Version = '1.0'; 12 12 $this->Creator = 'Chronos'; 13 $this->License = 'GNU/GPL ';13 $this->License = 'GNU/GPLv3'; 14 14 $this->Description = 'Network service configuration of Ubiquity AirOS devices'; 15 $this->Dependencies = array( 'NetworkConfig');15 $this->Dependencies = array(ModuleNetworkConfig::GetName()); 16 16 } 17 17 -
trunk/Modules/NetworkConfigLinux/NetworkConfigLinux.php
r894 r899 5 5 include_once(dirname(__FILE__).'/Generators/Latency.php'); 6 6 7 class ModuleNetworkConfigLinux extends AppModule7 class ModuleNetworkConfigLinux extends Module 8 8 { 9 9 function __construct(System $System) … … 15 15 $this->License = 'GNU/GPL'; 16 16 $this->Description = 'Network service configuration of Linux server'; 17 $this->Dependencies = array( 'NetworkConfig');17 $this->Dependencies = array(ModuleNetworkConfig::GetName()); 18 18 } 19 19 -
trunk/Modules/NetworkConfigRouterOS/Generators/Queue.php
r887 r899 273 273 echo($Main->Print()); 274 274 $ItemsQueue = $Main->GetCommands(); 275 //print_r($ItemsQueue);276 //die();277 278 //print_r($ItemsQueue);279 275 $Routerboard->ListUpdate($PathQueue, array('name', 'limit-at', 'max-limit', 'parent', 'packet-mark'), $ItemsQueue, array(), true); 280 276 } -
trunk/Modules/NetworkConfigRouterOS/NetworkConfigRouterOS.php
r894 r899 16 16 include_once(dirname(__FILE__).'/Generators/Queue.php'); 17 17 18 class ModuleNetworkConfigRouterOS extends AppModule18 class ModuleNetworkConfigRouterOS extends Module 19 19 { 20 20 function __construct(System $System) … … 24 24 $this->Version = '1.0'; 25 25 $this->Creator = 'Chronos'; 26 $this->License = 'GNU/GPL ';26 $this->License = 'GNU/GPLv3'; 27 27 $this->Description = 'Mikrotik RouterOS configuration'; 28 $this->Dependencies = array( 'NetworkConfig');28 $this->Dependencies = array(ModuleNetworkConfig::GetName()); 29 29 } 30 30 -
trunk/Modules/NetworkShare/NetworkShare.php
r894 r899 5 5 include_once('SharePage.php'); 6 6 7 class ModuleNetworkShare extends AppModule7 class ModuleNetworkShare extends Module 8 8 { 9 9 function __construct(System $System) … … 13 13 $this->Version = '1.0'; 14 14 $this->Creator = 'Chronos'; 15 $this->License = 'GNU/GPL ';15 $this->License = 'GNU/GPLv3'; 16 16 $this->Description = 'System for loading network computer share file list and allow fast searching.'; 17 $this->Dependencies = array('Network'); 18 } 19 20 function GetModels(): array 21 { 22 return array(NetworkShareItem::GetClassName(), NetworkShareError::GetClassName()); 17 $this->Dependencies = array(ModuleNetwork::GetName()); 18 $this->Models = array(NetworkShareItem::GetClassName(), NetworkShareError::GetClassName()); 23 19 } 24 20 … … 31 27 class NetworkShareItem extends Model 32 28 { 33 static function Get Desc(): ModelDesc29 static function GetModelDesc(): ModelDesc 34 30 { 35 31 $Desc = new ModelDesc('NetworkShareItem'); … … 47 43 class NetworkShareError extends Model 48 44 { 49 static function Get Desc(): ModelDesc45 static function GetModelDesc(): ModelDesc 50 46 { 51 47 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/NetworkShare/browse.php
r874 r899 38 38 } 39 39 //ShowArray($Shares); 40 //die();41 40 42 41 // Analyzuj slozku a projdi podslozky -
trunk/Modules/NetworkTopology/NetworkTopology.php
r894 r899 135 135 } 136 136 137 class ModuleNetworkTopology extends AppModule137 class ModuleNetworkTopology extends Module 138 138 { 139 139 function __construct(System $System) … … 143 143 $this->Version = '1.0'; 144 144 $this->Creator = 'Chronos'; 145 $this->License = 'GNU/GPL ';145 $this->License = 'GNU/GPLv3'; 146 146 $this->Description = 'Generate image of network device interconnection'; 147 $this->Dependencies = array('Network'); 148 } 149 150 function GetModels(): array 151 { 152 return array(NetworkTopology::GetClassName()); 147 $this->Dependencies = array(ModuleNetwork::GetName()); 148 $this->Models = array(NetworkTopology::GetClassName()); 153 149 } 154 150 … … 161 157 class NetworkTopology extends Model 162 158 { 163 static function Get Desc(): ModelDesc159 static function GetModelDesc(): ModelDesc 164 160 { 165 161 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/News/News.php
r894 r899 11 11 } 12 12 13 class ModuleNews extends AppModule13 class ModuleNews extends Module 14 14 { 15 15 public int $NewsCountPerCategory = 3; … … 22 22 $this->Version = '1.0'; 23 23 $this->Creator = 'Chronos'; 24 $this->License = 'GNU/GPL ';24 $this->License = 'GNU/GPLv3'; 25 25 $this->Description = 'News and news groups management'; 26 $this->Dependencies = array( 'User', 'Log', 'File');26 $this->Dependencies = array(ModuleUser::GetName(), ModuleLog::GetName(), ModuleFile::GetName()); 27 27 $this->SupportedModules = array('Search'); 28 } 29 30 function GetModels(): array 31 { 32 return array(NewsCategory::GetClassName(), News::GetClassName()); 28 $this->Models = array(NewsCategory::GetClassName(), News::GetClassName()); 33 29 } 34 30 … … 272 268 } 273 269 274 static function Cast( AppModule $AppModule): ModuleNews275 { 276 if ($ AppModule instanceof ModuleNews)277 { 278 return $ AppModule;279 } 280 throw new Exception('Expected ModuleNews type but got '.gettype($ AppModule));270 static function Cast(Module $Module): ModuleNews 271 { 272 if ($Module instanceof ModuleNews) 273 { 274 return $Module; 275 } 276 throw new Exception('Expected ModuleNews type but got '.gettype($Module)); 281 277 } 282 278 } … … 284 280 class News extends Model 285 281 { 286 static function Get Desc(): ModelDesc282 static function GetModelDesc(): ModelDesc 287 283 { 288 284 $Desc = new ModelDesc(self::GetClassName()); … … 302 298 class NewsCategory extends Model 303 299 { 304 static function Get Desc(): ModelDesc300 static function GetModelDesc(): ModelDesc 305 301 { 306 302 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/Notify/Notify.php
r894 r899 3 3 define('CONTACT_CATEGORY_EMAIL', 4); 4 4 5 class ModuleNotify extends AppModule5 class ModuleNotify extends Module 6 6 { 7 7 public array $Checks; … … 13 13 $this->Version = '1.0'; 14 14 $this->Creator = 'Chronos'; 15 $this->License = 'GNU/GPL ';15 $this->License = 'GNU/GPLv3'; 16 16 $this->Description = 'Send notification messages to selected users'; 17 $this->Dependencies = array('User', 'RSS'); 17 $this->Dependencies = array(ModuleUser::GetName(), ModuleRSS::GetName()); 18 $this->Models = array(NotifyCategory::GetClassName(), NotifyUser::GetClassName()); 19 18 20 $this->Checks = array(); 19 21 } … … 128 130 } 129 131 130 function GetModels(): array131 {132 return array(NotifyCategory::GetClassName(), NotifyUser::GetClassName());133 }134 135 132 function DoInstall(): void 136 133 { … … 176 173 } 177 174 178 static function Cast( AppModule $AppModule): ModuleNotify179 { 180 if ($ AppModule instanceof ModuleNotify)181 { 182 return $ AppModule;183 } 184 throw new Exception('Expected ModuleNotify type but got '.gettype($ AppModule));175 static function Cast(Module $Module): ModuleNotify 176 { 177 if ($Module instanceof ModuleNotify) 178 { 179 return $Module; 180 } 181 throw new Exception('Expected ModuleNotify type but got '.gettype($Module)); 185 182 } 186 183 } … … 188 185 class NotifyCategory extends Model 189 186 { 190 static function Get Desc(): ModelDesc187 static function GetModelDesc(): ModelDesc 191 188 { 192 189 $Desc = new ModelDesc(self::GetClassName()); … … 199 196 class NotifyUser extends Model 200 197 { 201 static function Get Desc(): ModelDesc198 static function GetModelDesc(): ModelDesc 202 199 { 203 200 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/OpeningHours/OpeningHours.php
r894 r899 215 215 } 216 216 217 class ModuleOpeningHours extends AppModule217 class ModuleOpeningHours extends Module 218 218 { 219 219 function __construct(System $System) … … 223 223 $this->Version = '1.0'; 224 224 $this->Creator = 'Chronos'; 225 $this->License = 'GNU/GPL ';225 $this->License = 'GNU/GPLv3'; 226 226 $this->Description = 'Show subject opening hours with time to open or time to close'; 227 $this->Dependencies = array(); 228 } 229 230 function GetModels(): array 231 { 232 return array(SubjectOpenTime::GetClassName(), SubjectOpenTimeDay::GetClassName()); 227 $this->Models = array(SubjectOpenTime::GetClassName(), SubjectOpenTimeDay::GetClassName()); 233 228 } 234 229 … … 246 241 class SubjectOpenTime extends Model 247 242 { 248 static function Get Desc(): ModelDesc243 static function GetModelDesc(): ModelDesc 249 244 { 250 245 $Desc = new ModelDesc(self::GetClassName()); … … 259 254 class SubjectOpenTimeDay extends Model 260 255 { 261 static function Get Desc(): ModelDesc256 static function GetModelDesc(): ModelDesc 262 257 { 263 258 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/Portal/Portal.php
r896 r899 3 3 include_once(dirname(__FILE__).'/../../Common/Global.php'); 4 4 5 class ModulePortal extends AppModule5 class ModulePortal extends Module 6 6 { 7 7 function __construct(System $System) … … 13 13 $this->License = 'GNU/GPLv3'; 14 14 $this->Description = 'Community portal.'; 15 $this->Dependencies = array('News', 'User'); 16 } 17 18 function GetModels(): array 19 { 20 return array(Panel::GetClassName(), PanelColumn::GetClassName()); 15 $this->Dependencies = array(ModuleNews::GetName(), ModuleUser::GetName()); 16 $this->Models = array(Panel::GetClassName(), PanelColumn::GetClassName()); 21 17 } 22 18 … … 65 61 class PanelColumn extends Model 66 62 { 67 static function Get Desc(): ModelDesc63 static function GetModelDesc(): ModelDesc 68 64 { 69 65 $Desc = new ModelDesc(self::GetClassName()); … … 75 71 class Panel extends Model 76 72 { 77 static function Get Desc(): ModelDesc73 static function GetModelDesc(): ModelDesc 78 74 { 79 75 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/RSS/RSS.php
r887 r899 1 1 <?php 2 2 3 class ModuleRSS extends AppModule3 class ModuleRSS extends Module 4 4 { 5 5 public array $RSSChannels; … … 11 11 $this->Version = '1.0'; 12 12 $this->Creator = 'Chronos'; 13 $this->License = 'GNU/GPL ';13 $this->License = 'GNU/GPLv3'; 14 14 $this->Description = 'Web site RSS channel management'; 15 $this->Dependencies = array();16 15 $this->RSSChannels = array(); 17 16 } … … 20 19 { 21 20 $this->System->RegisterPage(['rss'], 'PageRSS'); 22 $this->System->RegisterPageHeader('RSS', array($this, 'ShowRSSHeader'));21 Core::Cast($this->System)->RegisterPageHeader('RSS', array($this, 'ShowRSSHeader')); 23 22 } 24 23 … … 52 51 } 53 52 54 static function Cast( AppModule $AppModule): ModuleRSS53 static function Cast(Module $Module): ModuleRSS 55 54 { 56 if ($ AppModule instanceof ModuleRSS)55 if ($Module instanceof ModuleRSS) 57 56 { 58 return $ AppModule;57 return $Module; 59 58 } 60 throw new Exception('Expected ModuleRSS type but got '.gettype($ AppModule));59 throw new Exception('Expected ModuleRSS type but got '.gettype($Module)); 61 60 } 62 61 } -
trunk/Modules/Scheduler/Scheduler.php
r894 r899 1 1 <?php 2 2 3 class ModuleScheduler extends AppModule3 class ModuleScheduler extends Module 4 4 { 5 5 function __construct(System $System) … … 9 9 $this->Version = '1.0'; 10 10 $this->Creator = 'Chronos'; 11 $this->License = 'GNU/GPL ';11 $this->License = 'GNU/GPLv3'; 12 12 $this->Description = 'Allow to setup and execute planned and recurring tasks'; 13 $this->Dependencies = array(); 14 } 15 16 function GetModels(): array 17 { 18 return array(SchedulerAction::GetClassName(), Scheduler::GetClassName()); 13 $this->Models = array(SchedulerAction::GetClassName(), Scheduler::GetClassName()); 19 14 } 20 15 … … 99 94 } 100 95 101 static function Cast( AppModule $AppModule): ModuleScheduler96 static function Cast(Module $Module): ModuleScheduler 102 97 { 103 if ($ AppModule instanceof ModuleScheduler)98 if ($Module instanceof ModuleScheduler) 104 99 { 105 return $ AppModule;100 return $Module; 106 101 } 107 throw new Exception('Expected ModuleScheduler type but got '.gettype($ AppModule));102 throw new Exception('Expected ModuleScheduler type but got '.gettype($Module)); 108 103 } 109 104 } … … 128 123 class Scheduler extends Model 129 124 { 130 static function Get Desc(): ModelDesc125 static function GetModelDesc(): ModelDesc 131 126 { 132 127 $Desc = new ModelDesc(self::GetClassName()); … … 145 140 class SchedulerAction extends Model 146 141 { 147 static function Get Desc(): ModelDesc142 static function GetModelDesc(): ModelDesc 148 143 { 149 144 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/Search/Search.php
r894 r899 47 47 } 48 48 49 class ModuleSearch extends AppModule49 class ModuleSearch extends Module 50 50 { 51 51 public array $Items; … … 58 58 $this->Version = '1.0'; 59 59 $this->Creator = 'Chronos'; 60 $this->License = 'GNU/GPL ';60 $this->License = 'GNU/GPLv3'; 61 61 $this->Description = 'Allow search through registered content objects'; 62 $this->Dependencies = array(); 62 63 63 $this->MaxItemCount = 10; 64 64 $this->Items = array(); … … 75 75 } 76 76 77 static function Cast( AppModule $AppModule): ModuleSearch77 static function Cast(Module $Module): ModuleSearch 78 78 { 79 if ($ AppModule instanceof ModuleSearch)79 if ($Module instanceof ModuleSearch) 80 80 { 81 return $ AppModule;81 return $Module; 82 82 } 83 throw new Exception('Expected ModuleSearch type but got '.gettype($ AppModule));83 throw new Exception('Expected ModuleSearch type but got '.gettype($Module)); 84 84 } 85 85 } -
trunk/Modules/SpeedTest/SpeedTest.php
r887 r899 12 12 ############################################################################### 13 13 14 class ModuleSpeedTest extends AppModule14 class ModuleSpeedTest extends Module 15 15 { 16 16 function __construct(System $System) … … 20 20 $this->Version = '1.0'; 21 21 $this->Creator = 'Chronos'; 22 $this->License = 'GNU/GPL ';22 $this->License = 'GNU/GPLv3'; 23 23 $this->Description = 'Testing of download and upload bandwidth'; 24 $this->Dependencies = array();25 24 } 26 25 -
trunk/Modules/Stock/Stock.php
r894 r899 1 1 <?php 2 2 3 class ModuleStock extends AppModule3 class ModuleStock extends Module 4 4 { 5 5 function __construct(System $System) … … 9 9 $this->Version = '1.0'; 10 10 $this->Creator = 'Chronos'; 11 $this->License = 'GNU/GPL ';11 $this->License = 'GNU/GPLv3'; 12 12 $this->Description = 'Stock and products'; 13 $this->Dependencies = array('User', 'Customer', 'Network'); 14 } 15 16 function GetModels(): array 17 { 18 return array(Product::GetClassName(), StockSerialNumber::GetClassName(), Stock::GetClassName(), 13 $this->Dependencies = array(ModuleUser::GetName(), ModuleCustomer::GetName(), ModuleNetwork::GetName()); 14 $this->Models = array(Product::GetClassName(), StockSerialNumber::GetClassName(), Stock::GetClassName(), 19 15 StockMoveGroup::GetClassName(), StockMove::GetClassName(), StockMoveItem::GetClassName(), 20 16 StockItemHistory::GetClassName(), StockMoveItemSerialRel::GetClassName()); … … 266 262 class Product extends Model 267 263 { 268 static function Get Desc(): ModelDesc264 static function GetModelDesc(): ModelDesc 269 265 { 270 266 $Desc = new ModelDesc(self::GetClassName()); … … 285 281 class StockSerialNumber extends Model 286 282 { 287 static function Get Desc(): ModelDesc283 static function GetModelDesc(): ModelDesc 288 284 { 289 285 $Desc = new ModelDesc(self::GetClassName()); … … 305 301 class Stock extends Model 306 302 { 307 static function Get Desc(): ModelDesc303 static function GetModelDesc(): ModelDesc 308 304 { 309 305 $Desc = new ModelDesc(self::GetClassName()); … … 315 311 class StockMove extends Model 316 312 { 317 static function Get Desc(): ModelDesc313 static function GetModelDesc(): ModelDesc 318 314 { 319 315 $Desc = new ModelDesc(self::GetClassName()); … … 328 324 class StockMoveItem extends Model 329 325 { 330 static function Get Desc(): ModelDesc326 static function GetModelDesc(): ModelDesc 331 327 { 332 328 $Desc = new ModelDesc(self::GetClassName()); … … 341 337 class StockMoveGroup extends Model 342 338 { 343 static function Get Desc(): ModelDesc339 static function GetModelDesc(): ModelDesc 344 340 { 345 341 $Desc = new ModelDesc(self::GetClassName()); … … 354 350 class StockItemHistory extends Model 355 351 { 356 static function Get Desc(): ModelDesc352 static function GetModelDesc(): ModelDesc 357 353 { 358 354 $Desc = new ModelDesc(self::GetClassName()); … … 366 362 class StockMoveItemSerialRel extends Model 367 363 { 368 static function Get Desc(): ModelDesc364 static function GetModelDesc(): ModelDesc 369 365 { 370 366 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/Subject/Subject.php
r897 r899 1 1 <?php 2 2 3 class ModuleSubject extends AppModule3 class ModuleSubject extends Module 4 4 { 5 5 function __construct(System $System) … … 9 9 $this->Version = '1.0'; 10 10 $this->Creator = 'Chronos'; 11 $this->License = 'GNU/GPL ';11 $this->License = 'GNU/GPLv3'; 12 12 $this->Description = 'Subject management'; 13 $this->Dependencies = array('User', 'Map'); 13 $this->Dependencies = array(ModuleUser::GetName(), ModuleMap::GetName()); 14 $this->Models = array(Subject::GetClassName(), ContactCategory::GetClassName(), 15 Contact::GetClassName()); 14 16 } 15 17 … … 131 133 } 132 134 133 function GetModels(): array134 {135 return array(Subject::GetClassName(), ContactCategory::GetClassName(),136 Contact::GetClassName());137 }138 139 135 function ShowDashboardItem(): string 140 136 { … … 148 144 class Subject extends Model 149 145 { 150 static function Get Desc(): ModelDesc146 static function GetModelDesc(): ModelDesc 151 147 { 152 148 $Desc = new ModelDesc(self::GetClassName()); … … 168 164 class Contact extends Model 169 165 { 170 static function Get Desc(): ModelDesc166 static function GetModelDesc(): ModelDesc 171 167 { 172 168 $Desc = new ModelDesc(self::GetClassName()); … … 183 179 class ContactCategory extends Model 184 180 { 185 static function Get Desc(): ModelDesc181 static function GetModelDesc(): ModelDesc 186 182 { 187 183 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/System/System.php
r897 r899 3 3 include_once(dirname(__FILE__).'/SystemModels.php'); 4 4 5 class ModuleSystem extends AppModule5 class ModuleSystem extends Module 6 6 { 7 7 public bool $InstalledChecked; … … 13 13 $this->Version = '1.0'; 14 14 $this->Creator = 'Chronos'; 15 $this->License = 'GNU/GPL ';15 $this->License = 'GNU/GPLv3'; 16 16 $this->Description = 'Base system module'; 17 $this->Dependencies = array();18 17 $this->Type = ModuleType::System; 19 } 20 21 function GetModels(): array 22 { 23 return array(UnitOfMeasure::GetClassName(), ActionIcon::GetClassName(), ActionGroup::GetClassName(), 18 $this->Models = array(UnitOfMeasure::GetClassName(), ActionIcon::GetClassName(), ActionGroup::GetClassName(), 24 19 ActionType::GetClassName(), Action::GetClassName(), Language::GetClassName(), Country::GetClassName()); 25 20 } … … 141 136 } 142 137 143 static function Cast( AppModule $AppModule): ModuleSystem138 static function Cast(Module $Module): ModuleSystem 144 139 { 145 if ($ AppModule instanceof ModuleSystem)140 if ($Module instanceof ModuleSystem) 146 141 { 147 return $ AppModule;142 return $Module; 148 143 } 149 throw new Exception('Expected ModuleSystem type but got '.gettype($ AppModule));144 throw new Exception('Expected ModuleSystem type but got '.gettype($Module)); 150 145 } 151 146 -
trunk/Modules/System/SystemModels.php
r895 r899 3 3 class UnitOfMeasure extends Model 4 4 { 5 static function Get Desc(): ModelDesc5 static function GetModelDesc(): ModelDesc 6 6 { 7 7 $Desc = new ModelDesc(self::GetClassName()); … … 14 14 class Action extends Model 15 15 { 16 static function Get Desc(): ModelDesc16 static function GetModelDesc(): ModelDesc 17 17 { 18 18 $Desc = new ModelDesc(self::GetClassName()); … … 30 30 class ActionIcon extends Model 31 31 { 32 static function Get Desc(): ModelDesc32 static function GetModelDesc(): ModelDesc 33 33 { 34 34 $Desc = new ModelDesc(self::GetClassName()); … … 40 40 class ActionGroup extends Model 41 41 { 42 static function Get Desc(): ModelDesc42 static function GetModelDesc(): ModelDesc 43 43 { 44 44 $Desc = new ModelDesc(self::GetClassName()); … … 50 50 class ActionType extends Model 51 51 { 52 static function Get Desc(): ModelDesc52 static function GetModelDesc(): ModelDesc 53 53 { 54 54 $Desc = new ModelDesc(self::GetClassName()); … … 60 60 class Language extends Model 61 61 { 62 static function Get Desc(): ModelDesc62 static function GetModelDesc(): ModelDesc 63 63 { 64 64 $Desc = new ModelDesc(self::GetClassName()); … … 70 70 class Country extends Model 71 71 { 72 static function Get Desc(): ModelDesc72 static function GetModelDesc(): ModelDesc 73 73 { 74 74 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/TV/TV.php
r894 r899 99 99 } 100 100 101 class ModuleTV extends AppModule101 class ModuleTV extends Module 102 102 { 103 103 function __construct(System $System) … … 109 109 $this->License = 'GNU/GPLv3'; 110 110 $this->Description = 'Television channels management'; 111 $this->Dependencies = array(); 112 } 113 114 function GetModels(): array 115 { 116 return array(TVGroup::GetClassName(), TV::GetClassName()); 111 $this->Models = array(TVGroup::GetClassName(), TV::GetClassName()); 117 112 } 118 113 … … 166 161 class TVGroup extends Model 167 162 { 168 static function Get Desc(): ModelDesc163 static function GetModelDesc(): ModelDesc 169 164 { 170 165 $Desc = new ModelDesc(self::GetClassName()); … … 176 171 class TV extends Model 177 172 { 178 static function Get Desc(): ModelDesc173 static function GetModelDesc(): ModelDesc 179 174 { 180 175 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/Task/Task.php
r894 r899 1 1 <?php 2 2 3 class ModuleTask extends AppModule3 class ModuleTask extends Module 4 4 { 5 5 function __construct(System $System) … … 9 9 $this->Version = '1.0'; 10 10 $this->Creator = 'Chronos'; 11 $this->License = 'GNU/GPL ';11 $this->License = 'GNU/GPLv3'; 12 12 $this->Description = 'Work and task management'; 13 $this->Dependencies = array('User'); 14 } 15 16 function GetModels(): array 17 { 18 return array(TaskGroup::GetClassName(), Task::GetClassName(), Work::GetClassName()); 13 $this->Dependencies = array(ModuleUser::GetName()); 14 $this->Models = array(TaskGroup::GetClassName(), Task::GetClassName(), Work::GetClassName()); 19 15 } 20 16 … … 109 105 class Task extends Model 110 106 { 111 static function Get Desc(): ModelDesc107 static function GetModelDesc(): ModelDesc 112 108 { 113 109 $Desc = new ModelDesc(self::GetClassName()); … … 129 125 class TaskGroup extends Model 130 126 { 131 static function Get Desc(): ModelDesc127 static function GetModelDesc(): ModelDesc 132 128 { 133 129 $Desc = new ModelDesc(self::GetClassName()); … … 141 137 class Work extends Model 142 138 { 143 static function Get Desc(): ModelDesc139 static function GetModelDesc(): ModelDesc 144 140 { 145 141 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/TimeMeasure/Measure.php
r894 r899 12 12 public array $ValueTypes = array('Min', 'Avg', 'Max'); 13 13 14 static function Get Desc(): ModelDesc14 static function GetModelDesc(): ModelDesc 15 15 { 16 16 $Desc = new ModelDesc(self::GetClassName()); … … 329 329 } 330 330 // array_pop($Values); 331 // echo('abc');332 // die();333 331 if ($this->Debug) echo('Item count: '.count($Values)); 334 332 -
trunk/Modules/TimeMeasure/TimeMeasure.php
r894 r899 5 5 include_once(dirname(__FILE__).'/Main.php'); 6 6 7 class ModuleTimeMeasure extends AppModule7 class ModuleTimeMeasure extends Module 8 8 { 9 9 function __construct(System $System) … … 15 15 $this->License = 'GNU/GPLv3'; 16 16 $this->Description = 'Time measure of custom values, char'; 17 $this->Dependencies = array('User'); 18 } 19 20 function GetModels(): array 21 { 22 return array(Measure::GetClassName()); 17 $this->Dependencies = array(ModuleUser::GetName()); 18 $this->Models = array(Measure::GetClassName()); 23 19 } 24 20 -
trunk/Modules/User/User.php
r896 r899 5 5 include_once(dirname(__FILE__).'/UserPage.php'); 6 6 7 class ModuleUser extends AppModule7 class ModuleUser extends Module 8 8 { 9 9 public array $UserPanel; … … 18 18 $this->License = 'GNU/GPLv3'; 19 19 $this->Description = 'User management'; 20 $this->Dependencies = array(); 20 $this->Models = array(User::GetClassName(), UserOnline::GetClassName(), PermissionGroup::GetClassName(), PermissionOperation::GetClassName(), 21 PermissionGroupAssignment::GetClassName(), PermissionUserAssignment::GetClassName()); 22 21 23 $this->UserPanel = array(); 22 24 $this->User = new User($System); 23 }24 25 function GetModels(): array26 {27 return array(User::GetClassName(), UserOnline::GetClassName(), PermissionGroup::GetClassName(), PermissionOperation::GetClassName(),28 PermissionGroupAssignment::GetClassName(), PermissionUserAssignment::GetClassName());29 25 } 30 26 … … 208 204 } 209 205 210 static function Cast( AppModule $AppModule): ModuleUser211 { 212 if ($ AppModule instanceof ModuleUser)206 static function Cast(Module $Module): ModuleUser 207 { 208 if ($Module instanceof ModuleUser) 213 209 { 214 return $ AppModule;210 return $Module; 215 211 } 216 throw new Exception('Expected ModuleUser type but got '.gettype($ AppModule));212 throw new Exception('Expected ModuleUser type but got '.gettype($Module)); 217 213 } 218 214 } -
trunk/Modules/User/UserModel.php
r897 r899 65 65 } 66 66 67 static function Get Desc(): ModelDesc67 static function GetModelDesc(): ModelDesc 68 68 { 69 69 $Desc = new ModelDesc(self::GetClassName()); … … 461 461 class UserOnline extends Model 462 462 { 463 static function Get Desc(): ModelDesc463 static function GetModelDesc(): ModelDesc 464 464 { 465 465 $Desc = new ModelDesc(self::GetClassName()); … … 480 480 class PermissionGroup extends Model 481 481 { 482 static function Get Desc(): ModelDesc482 static function GetModelDesc(): ModelDesc 483 483 { 484 484 $Desc = new ModelDesc(self::GetClassName()); … … 490 490 class PermissionGroupAssignment extends Model 491 491 { 492 static function Get Desc(): ModelDesc492 static function GetModelDesc(): ModelDesc 493 493 { 494 494 $Desc = new ModelDesc(self::GetClassName()); … … 502 502 class PermissionOperation extends Model 503 503 { 504 static function Get Desc(): ModelDesc504 static function GetModelDesc(): ModelDesc 505 505 { 506 506 $Desc = new ModelDesc(self::GetClassName()); … … 516 516 class PermissionUserAssignment extends Model 517 517 { 518 static function Get Desc(): ModelDesc518 static function GetModelDesc(): ModelDesc 519 519 { 520 520 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Modules/VPS/VPS.php
r887 r899 1 1 <?php 2 2 3 class ModuleVPS extends AppModule3 class ModuleVPS extends Module 4 4 { 5 5 function __construct(System $System) … … 10 10 $this->Version = '1.0'; 11 11 $this->Creator = 'Chronos'; 12 $this->License = 'GNU/GPL ';12 $this->License = 'GNU/GPLv3'; 13 13 $this->Description = 'VPS(Virtual Private Server) hosting management'; 14 $this->Dependencies = array('User', 'Network', 'Subject'); 15 $this->Modules = array(); 16 } 17 18 function DoStart(): void 19 { 20 21 } 22 23 function DoInstall(): void 24 { 25 14 $this->Dependencies = array(ModuleUser::GetName(), ModuleNetwork::GetName(), ModuleSubject::GetName()); 26 15 } 27 16 } -
trunk/Modules/WebCam/WebCam.php
r887 r899 48 48 } 49 49 50 class ModuleWebCam extends AppModule50 class ModuleWebCam extends Module 51 51 { 52 52 public string $ImageFileName = 'webcam.jpg'; … … 58 58 $this->Version = '1.0'; 59 59 $this->Creator = 'Chronos'; 60 $this->License = 'GNU/GPL ';60 $this->License = 'GNU/GPLv3'; 61 61 $this->Description = 'Web camera image presentetation'; 62 $this->Dependencies = array();63 $this->SupportedModels = array();64 62 } 65 63 … … 81 79 } 82 80 83 static function Cast( AppModule $AppModule): ModuleWebCam81 static function Cast(Module $Module): ModuleWebCam 84 82 { 85 if ($ AppModule instanceof ModuleWebCam)83 if ($Module instanceof ModuleWebCam) 86 84 { 87 return $ AppModule;85 return $Module; 88 86 } 89 throw new Exception('Expected ModuleWebCam type but got '.gettype($ AppModule));87 throw new Exception('Expected ModuleWebCam type but got '.gettype($Module)); 90 88 } 91 89 } -
trunk/Modules/Wiki/Wiki.php
r897 r899 1 1 <?php 2 2 3 class ModuleWiki extends AppModule3 class ModuleWiki extends Module 4 4 { 5 5 function __construct(System $System) … … 11 11 $this->License = 'GNU/GPLv3'; 12 12 $this->Description = 'Mediawiki style page management'; 13 $this->Dependencies = array('User'); 14 $this->Revision = 1; 15 } 16 17 function GetModels(): array 18 { 19 return array(WikiPage::GetClassName(), WikiPageContent::GetClassName()); 13 $this->Dependencies = array(ModuleUser::GetName()); 14 $this->Models = array(WikiPage::GetClassName(), WikiPageContent::GetClassName()); 20 15 } 21 16 … … 44 39 class WikiPage extends Model 45 40 { 46 static function Get Desc(): ModelDesc41 static function GetModelDesc(): ModelDesc 47 42 { 48 43 $Desc = new ModelDesc(self::GetClassName()); … … 56 51 class WikiPageContent extends Model 57 52 { 58 static function Get Desc(): ModelDesc53 static function GetModelDesc(): ModelDesc 59 54 { 60 55 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Packages/Common/Base.php
r898 r899 1 1 <?php 2 3 class System4 {5 public Database $Database;6 7 function __construct()8 {9 $this->Database = new Database();10 }11 }12 2 13 3 class Base 14 4 { 15 public Application$System;5 public System $System; 16 6 public Database $Database; 17 7 … … 27 17 } 28 18 } 29 30 class Model extends Base31 {32 }33 34 class View extends Base35 {36 }37 38 class Controller extends Base39 {40 }41 42 class ModelDesc43 {44 public string $Name;45 public array $Columns;46 public array $Indices;47 public string $PrimaryKey;48 public bool $Memory;49 50 function __construct(string $Name)51 {52 $this->Name = $Name;53 $this->Columns = array();54 $this->Indices = array();55 $this->PrimaryKey = 'Id';56 $this->Memory = false;57 }58 59 function AddString(string $Name): ModelColumnString60 {61 $Result = new ModelColumnString($Name);62 $this->Columns[] = $Result;63 return $Result;64 }65 66 function AddFloat(string $Name): ModelColumnFloat67 {68 $Result = new ModelColumnFloat($Name);69 $this->Columns[] = $Result;70 return $Result;71 }72 73 function AddText(string $Name): ModelColumnText74 {75 $Result = new ModelColumnText($Name);76 $this->Columns[] = $Result;77 return $Result;78 }79 80 function AddInteger(string $Name): ModelColumnInteger81 {82 $Result = new ModelColumnInteger($Name);83 $this->Columns[] = $Result;84 return $Result;85 }86 87 function AddBigInt(string $Name): ModelColumnBigInt88 {89 $Result = new ModelColumnBigInt($Name);90 $this->Columns[] = $Result;91 return $Result;92 }93 94 function AddDateTime(string $Name): ModelColumnDateTime95 {96 $Result = new ModelColumnDateTime($Name);97 $this->Columns[] = $Result;98 return $Result;99 }100 101 function AddDate(string $Name): ModelColumnDate102 {103 $Result = new ModelColumnDate($Name);104 $this->Columns[] = $Result;105 return $Result;106 }107 108 function AddBoolean(string $Name): ModelColumnBoolean109 {110 $Result = new ModelColumnBoolean($Name);111 $this->Columns[] = $Result;112 return $Result;113 }114 115 function AddReference(string $Name, string $RefTable, bool $Nullable = true): ModelColumnReference116 {117 $Result = new ModelColumnReference($Name, $RefTable);118 $this->Columns[] = $Result;119 $Result->Nullable = $Nullable;120 return $Result;121 }122 123 function AddEnum(string $Name, array $States): ModelColumnEnum124 {125 $Result = new ModelColumnEnum($Name, $States);126 $this->Columns[] = $Result;127 return $Result;128 }129 130 function AddChangeAction(): void131 {132 $Column = $this->AddEnum('ChangeAction', array('add', 'modify', 'remove'));133 $Column->Nullable = true;134 $Column = $this->AddDateTime('ChangeTime');135 $Column->Nullable = true;136 $this->AddInteger('ChangeReplaceId');137 }138 }139 140 class ModelColumnType141 {142 const Integer = 0;143 const String = 1;144 const Float = 2;145 const Text = 3;146 const DateTime = 4;147 const Reference = 5;148 const Boolean = 6;149 const Date = 7;150 const Enum = 8;151 const BigInt = 9;152 153 static function GetName(int $Index)154 {155 $Text = array('Integer', 'String', 'Float', 'Text', 'DateTime', 'Reference', 'Boolean', 'Date', 'Enum', 'BigInt');156 return $Text[$Index];157 }158 }159 160 class ModelColumn161 {162 public string $Name;163 public int $Type; // ModelColumnType164 public bool $Nullable;165 public bool $Unique;166 public bool $HasDefault;167 168 function __construct(string $Name, int $Type, bool $Nullable = false, bool $Unique = false)169 {170 $this->Name = $Name;171 $this->Type = $Type;172 $this->Nullable = $Nullable;173 $this->Unique = $Unique;174 $this->HasDefault = false;175 }176 177 function GetDefault(): ?string178 {179 return null;180 }181 }182 183 class ModelColumnString extends ModelColumn184 {185 public ?string $Default;186 187 function __construct(string $Name)188 {189 parent::__construct($Name, ModelColumnType::String);190 $this->HasDefault = false;191 $this->Default = null;192 }193 194 function GetDefault(): ?string195 {196 return '"'.$this->Default.'"';197 }198 }199 200 class ModelColumnFloat extends ModelColumn201 {202 public ?float $Default;203 204 function __construct(string $Name)205 {206 parent::__construct($Name, ModelColumnType::Float);207 $this->HasDefault = false;208 $this->Default = null;209 }210 211 function GetDefault(): ?string212 {213 return '"'.$this->Default.'"';214 }215 }216 217 class ModelColumnText extends ModelColumn218 {219 public ?string $Default;220 221 function __construct(string $Name)222 {223 parent::__construct($Name, ModelColumnType::Text);224 $this->HasDefault = false;225 $this->Default = null;226 }227 228 function GetDefault(): ?string229 {230 return '"'.$this->Default.'"';231 }232 }233 234 class ModelColumnInteger extends ModelColumn235 {236 public ?int $Default;237 238 function __construct(string $Name)239 {240 parent::__construct($Name, ModelColumnType::Integer);241 $this->HasDefault = false;242 $this->Default = null;243 }244 245 function GetDefault(): ?string246 {247 return $this->Default;248 }249 }250 251 class ModelColumnBigInt extends ModelColumn252 {253 public ?int $Default;254 255 function __construct(string $Name)256 {257 parent::__construct($Name, ModelColumnType::BigInt);258 $this->HasDefault = false;259 $this->Default = null;260 }261 262 function GetDefault(): ?string263 {264 return $this->Default;265 }266 }267 268 class ModelColumnDateTime extends ModelColumn269 {270 public ?DateTime $Default;271 272 function __construct(string $Name)273 {274 parent::__construct($Name, ModelColumnType::DateTime);275 $this->HasDefault = false;276 $this->Default = null;277 }278 279 function GetDefault(): ?string280 {281 return '"'.$this->Default.'"';282 }283 }284 285 class ModelColumnDate extends ModelColumn286 {287 public ?DateTime $Default;288 289 function __construct(string $Name)290 {291 parent::__construct($Name, ModelColumnType::Date);292 $this->HasDefault = false;293 $this->Default = null;294 }295 296 function GetDefault(): ?string297 {298 return '"'.$this->Default.'"';299 }300 }301 302 class ModelColumnReference extends ModelColumn303 {304 public string $RefTable;305 306 function __construct(string $Name, string $RefTable)307 {308 parent::__construct($Name, ModelColumnType::Reference);309 $this->RefTable = $RefTable;310 }311 }312 313 class ModelColumnBoolean extends ModelColumn314 {315 public ?bool $Default;316 317 function __construct(string $Name)318 {319 parent::__construct($Name, ModelColumnType::Boolean);320 $this->HasDefault = false;321 $this->Default = null;322 }323 324 function GetDefault(): ?string325 {326 return $this->Default;327 }328 }329 330 class ModelColumnEnum extends ModelColumn331 {332 public ?bool $Default;333 public array $States;334 335 function __construct(string $Name, array $States)336 {337 parent::__construct($Name, ModelColumnType::Enum);338 $this->HasDefault = false;339 $this->Default = null;340 $this->States = $States;341 }342 343 function GetDefault(): ?string344 {345 return $this->Default;346 }347 } -
trunk/Packages/Common/Common.php
r897 r899 11 11 include_once(dirname(__FILE__).'/Error.php'); 12 12 include_once(dirname(__FILE__).'/Base.php'); 13 include_once(dirname(__FILE__).'/Application.php'); 14 include_once(dirname(__FILE__).'/AppModule.php'); 13 include_once(dirname(__FILE__).'/View.php'); 14 include_once(dirname(__FILE__).'/Model.php'); 15 include_once(dirname(__FILE__).'/ModelDesc.php'); 16 include_once(dirname(__FILE__).'/Controller.php'); 17 include_once(dirname(__FILE__).'/System.php'); 18 include_once(dirname(__FILE__).'/Module.php'); 19 include_once(dirname(__FILE__).'/ModuleManager.php'); 15 20 include_once(dirname(__FILE__).'/Config.php'); 16 21 include_once(dirname(__FILE__).'/Page.php'); … … 40 45 $this->ReleaseDate = strtotime('2020-03-29'); 41 46 $this->Creator = 'Chronos'; 42 $this->License = 'GNU/GPL ';47 $this->License = 'GNU/GPLv3'; 43 48 $this->Homepage = 'https://svn.zdechov.net/PHPlib/Common/'; 44 49 } -
trunk/Packages/Common/Module.php
r898 r899 1 1 <?php 2 3 /* This implementation will not support installation from remote source. Just4 * installation of already presented modules mainly to persistence preparation.5 */6 2 7 3 class ModuleType … … 37 33 } 38 34 39 class AppModule35 class Module extends Model 40 36 { 41 37 public int $Id; … … 47 43 public string $HomePage; 48 44 public string $Description; 45 public int $Type; // ModuleType 46 public array $Dependencies; 47 public array $Models; // Model 49 48 public bool $Running; 50 49 public bool $Enabled; 51 50 public bool $Installed; 52 51 public string $InstalledVersion; 53 public int $Type;54 public array $Dependencies;55 52 public Database $Database; 56 53 public System $System; 57 public AppModuleManager $Manager;54 public ModuleManager $Manager; 58 55 public $OnChange; 59 public array $Models; 60 61 function __construct(Application $System) 62 { 63 $this->System = &$System; 64 $this->Database = &$System->Database; 65 $this->Installed = false; 66 $this->InstalledVersion = ''; 67 $this->Enabled = false; 68 $this->Running = false; 56 57 function __construct(System $System) 58 { 59 parent::__construct($System); 60 $this->Name = ''; 69 61 $this->HomePage = ''; 70 62 $this->License = ''; … … 74 66 $this->Description = ''; 75 67 $this->Dependencies = array(); 68 $this->Models = array(); 76 69 $this->Type = ModuleType::Library; 77 $this->Models = array(); 78 } 79 80 function GetModels(): array 81 { 82 return array(); 70 $this->Installed = false; 71 $this->InstalledVersion = ''; 72 $this->Enabled = false; 73 $this->Running = false; 74 } 75 76 static function GetName() 77 { 78 $ClassName = get_called_class(); 79 if (substr($ClassName, 0, 6) == 'Module') return substr($ClassName, 6); 80 else return $ClassName; 81 } 82 83 static function GetModelDesc(): ModelDesc 84 { 85 $Desc = new ModelDesc(self::GetClassName()); 86 $Desc->AddString('Name'); 87 $Desc->AddString('Title'); 88 $Desc->AddString('Creator'); 89 $Desc->AddString('Version'); 90 $Desc->AddString('License'); 91 $Desc->AddBoolean('Installed'); 92 $Desc->AddString('InstalledVersion'); 93 $Desc->AddString('Description'); 94 return $Desc; 83 95 } 84 96 … … 86 98 { 87 99 if ($this->Installed) return; 88 echo('Install mod '.$this->Name.'<br/>');89 100 $List = array(); 90 101 $this->Manager->EnumDependenciesCascade($this, $List, array(ModuleCondition::NotInstalled)); … … 99 110 call_user_func($this->Manager->OnInstallModule, $this); 100 111 } 101 $this->InstallModels( );112 $this->InstallModels($this->Models); 102 113 $this->DoInstall(); 103 114 } … … 112 123 $this->Manager->PerformList($List, array(ModuleAction::Uninstall), array(ModuleCondition::Installed)); 113 124 $this->DoUninstall(); 114 $this->UninstallModels( );125 $this->UninstallModels($this->Models); 115 126 if ($this->Manager->OnUninstallModule != null) 116 127 { … … 218 229 } 219 230 220 function InstallModels( ): void231 function InstallModels(array $Models): void 221 232 { 222 233 if ($this->Manager->OnInstallModel != null) 223 234 { 224 foreach ($ this->GetModels()as $Model)235 foreach ($Models as $Model) 225 236 { 226 call_user_func($this->Manager->OnInstallModel, $Model::Get Desc(), $this);237 call_user_func($this->Manager->OnInstallModel, $Model::GetModelDesc(), $this); 227 238 } 228 239 } 229 240 } 230 241 231 function UninstallModels( ): void242 function UninstallModels(array $Models): void 232 243 { 233 244 if ($this->Manager->OnUninstallModel != null) 234 245 { 235 foreach (array_reverse($ this->GetModels()) as $Model)246 foreach (array_reverse($Models) as $Model) 236 247 { 237 call_user_func($this->Manager->OnUninstallModel, $Model::Get Desc(), $this);248 call_user_func($this->Manager->OnUninstallModel, $Model::GetModelDesc(), $this); 238 249 } 239 250 } 240 251 } 241 252 } 242 243 /* Manage installed modules */244 class AppModuleManager245 {246 public array $Modules;247 public System $System;248 public string $FileName;249 public string $ModulesDir;250 public $OnLoadModules;251 public $OnInstallModel;252 public $OnUninstsallModel;253 public $OnInstallModule;254 public $OnUninstsallModule;255 256 function __construct(System $System)257 {258 $this->Modules = array();259 $this->System = &$System;260 $this->FileName = dirname(__FILE__).'/../../Config/ModulesConfig.php';261 $this->ModulesDir = dirname(__FILE__).'/../../Modules';262 $this->OnInstallModel = null;263 $this->OnUninstallModel = null;264 $this->OnInstallModule = null;265 $this->OnUninstallModule = null;266 }267 268 function Perform(array $Actions, array $Conditions = array(ModuleCondition::All)): void269 {270 $this->PerformList($this->Modules, $Actions, $Conditions);271 }272 273 function PerformList(array $List, array $Actions, array $Conditions = array(ModuleCondition::All)): void274 {275 foreach ($List as $Module)276 {277 if (in_array(ModuleCondition::All, $Conditions) or278 ($Module->Running and in_array(ModuleCondition::Running, $Conditions)) or279 (!$Module->Running and in_array(ModuleCondition::NotRunning, $Conditions)) or280 ($Module->Installed and in_array(ModuleCondition::Installed, $Conditions)) or281 (!$Module->Installed and in_array(ModuleCondition::NotInstalled, $Conditions)) or282 ($Module->Enabled and in_array(ModuleCondition::Enabled, $Conditions)) or283 (!$Module->Enabled and in_array(ModuleCondition::NotEnabled, $Conditions)) or284 (($Module->Type == ModuleType::System) and in_array(ModuleCondition::System, $Conditions)) or285 (($Module->Type == ModuleType::Application) and in_array(ModuleCondition::Application, $Conditions)) or286 (($Module->Type == ModuleType::Library) and in_array(ModuleCondition::Library, $Conditions)))287 {288 foreach ($Actions as $Action)289 {290 if ($Action == ModuleAction::Start) $Module->Start();291 if ($Action == ModuleAction::Stop) $Module->Stop();292 if ($Action == ModuleAction::Install) $Module->Install();293 if ($Action == ModuleAction::Uninstall) $Module->Uninstall();294 if ($Action == ModuleAction::Enable) $Module->Enable();295 if ($Action == ModuleAction::Disable) $Module->Disable();296 if ($Action == ModuleAction::Upgrade) $Module->Upgrade();297 }298 }299 }300 }301 302 function EnumDependenciesCascade(AppModule $Module, array &$List, array $Conditions = array(ModuleCondition::All))303 {304 foreach ($Module->Dependencies as $Dependency)305 {306 if (!array_key_exists($Dependency, $this->Modules))307 throw new Exception(sprintf(T('Module "%s" dependency "%s" not found'), $Module->Name, $Dependency));308 $DepModule = $this->Modules[$Dependency];309 if (in_array(ModuleCondition::All, $Conditions) or310 ($DepModule->Running and in_array(ModuleCondition::Running, $Conditions)) or311 (!$DepModule->Running and in_array(ModuleCondition::NotRunning, $Conditions)) or312 ($DepModule->Enabled and in_array(ModuleCondition::Enabled, $Conditions)) or313 (!$DepModule->Enabled and in_array(ModuleCondition::NotEnabled, $Conditions)) or314 ($DepModule->Installed and in_array(ModuleCondition::Installed, $Conditions)) or315 (!$DepModule->Installed and in_array(ModuleCondition::NotInstalled, $Conditions)) or316 (($Module->Type == ModuleType::System) and in_array(ModuleCondition::System, $Conditions)) or317 (($Module->Type == ModuleType::Application) and in_array(ModuleCondition::Application, $Conditions)) or318 (($Module->Type == ModuleType::Library) and in_array(ModuleCondition::Library, $Conditions)))319 {320 array_push($List, $DepModule);321 $this->EnumDependenciesCascade($DepModule, $List, $Conditions);322 }323 }324 }325 326 function EnumSuperiorDependenciesCascade(AppModule $Module, array &$List, array $Conditions = array(ModuleCondition::All))327 {328 foreach ($this->Modules as $RefModule)329 {330 if (in_array($Module->Name, $RefModule->Dependencies) and331 (in_array(ModuleCondition::All, $Conditions) or332 ($RefModule->Running and in_array(ModuleCondition::Running, $Conditions)) or333 (!$RefModule->Running and in_array(ModuleCondition::NotRunning, $Conditions)) or334 ($RefModule->Enabled and in_array(ModuleCondition::Enabled, $Conditions)) or335 (!$RefModule->Enabled and in_array(ModuleCondition::NotEnabled, $Conditions)) or336 ($RefModule->Installed and in_array(ModuleCondition::Installed, $Conditions)) or337 (!$RefModule->Installed and in_array(ModuleCondition::NotInstalled, $Conditions)) or338 (($Module->Type == ModuleType::System) and in_array(ModuleCondition::System, $Conditions)) or339 (($Module->Type == ModuleType::Application) and in_array(ModuleCondition::Application, $Conditions)) or340 (($Module->Type == ModuleType::Library) and in_array(ModuleCondition::Library, $Conditions))))341 {342 array_push($List, $RefModule);343 $this->EnumSuperiorDependenciesCascade($RefModule, $List, $Conditions);344 }345 }346 }347 348 function StartAll(array $Conditions = array(ModuleCondition::All)): void349 {350 $this->Perform(array(ModuleAction::Start), $Conditions);351 }352 353 function StopAll(array $Conditions = array(ModuleCondition::All)): void354 {355 $this->Perform(array(ModuleAction::Stop), $Conditions);356 }357 358 function InstallAll(array $Conditions = array(ModuleCondition::All)): void359 {360 $this->Perform(array(ModuleAction::Install), $Conditions);361 $this->SaveState();362 }363 364 function UninstallAll(array $Conditions = array(ModuleCondition::All)): void365 {366 $this->Perform(array(ModuleAction::Uninstall), $Conditions);367 $this->SaveState();368 }369 370 function EnableAll(array $Conditions = array(ModuleCondition::All)): void371 {372 $this->Perform(array(ModuleAction::Enable), $Conditions);373 $this->SaveState();374 }375 376 function DisableAll(array $Conditions = array(ModuleCondition::All)): void377 {378 $this->Perform(array(ModuleAction::Disable), $Conditions);379 $this->SaveState();380 }381 382 function UpgradeAll(array $Conditions = array(ModuleCondition::All)): void383 {384 $this->Perform(array(ModuleAction::Upgrade), $Conditions);385 $this->SaveState();386 }387 388 function ModulePresent(string $Name): bool389 {390 return array_key_exists($Name, $this->Modules);391 }392 393 function ModuleEnabled(string $Name): bool394 {395 return array_key_exists($Name, $this->Modules) and $this->Modules[$Name]->Enabled;396 }397 398 function ModuleRunning(string $Name): bool399 {400 return array_key_exists($Name, $this->Modules) and $this->Modules[$Name]->Running;401 }402 403 function GetModule(string $Name): AppModule404 {405 return $this->Modules[$Name];406 }407 408 function SearchModuleById(int $Id): string409 {410 foreach ($this->Modules as $Module)411 {412 if ($Module->Id == $Id) return $Module->Name;413 }414 return '';415 }416 417 function LoadState(): void418 {419 $ConfigModules = array();420 include $this->FileName;421 foreach ($ConfigModules as $Mod)422 {423 $ModuleName = $Mod['Name'];424 if (array_key_exists($ModuleName, $this->Modules))425 {426 if (array_key_exists('Enabled', $Mod))427 {428 $this->Modules[$ModuleName]->Enabled = $Mod['Enabled'];429 }430 if (array_key_exists('Installed', $Mod))431 {432 $this->Modules[$ModuleName]->Installed = $Mod['Installed'];433 }434 if (array_key_exists('InstalledVersion', $Mod))435 {436 $this->Modules[$ModuleName]->InstalledVersion = $Mod['InstalledVersion'];437 }438 }439 }440 }441 442 function SaveState(): void443 {444 $Data = array();445 foreach ($this->Modules as $Module)446 {447 $Data[] = array(448 'Name' => $Module->Name,449 'Enabled' => $Module->Enabled,450 'InstalledVersion' => $Module->InstalledVersion,451 'Installed' => $Module->Installed452 );453 }454 if (file_put_contents($this->FileName, "<?php \n\n\$ConfigModules = ".var_export($Data, true).";\n") === FALSE)455 {456 echo($this->FileName.' is not writeable.');457 }458 }459 460 function RegisterModule(AppModule $Module): void461 {462 $this->Modules[$Module->Name] = &$Module;463 $Module->Manager = &$this;464 $Module->OnChange = &$this->OnModuleChange;465 }466 467 function UnregisterModule(AppModule $Module): void468 {469 unset($this->Modules[array_search($Module, $this->Modules)]);470 }471 472 function GetUniqueModuleId()473 {474 $Id = 1;475 foreach ($this->Modules as $Module)476 {477 if ($Module->Id >= $Id) $Id = $Module->Id + 1;478 }479 return $Id;480 }481 482 function LoadModule(string $FileName): AppModule483 {484 include_once($FileName);485 $ModuleName = 'Module'.pathinfo($FileName, PATHINFO_FILENAME);486 $Module = new $ModuleName($this->System);487 $Module->Id = $this->GetUniqueModuleId();488 $this->RegisterModule($Module);489 return $Module;490 }491 492 function LoadModulesFromDir(string $Directory): void493 {494 $List = scandir($Directory);495 foreach ($List as $Item)496 {497 if (is_dir($Directory.'/'.$Item) and ($Item != '.') and ($Item != '..') and ($Item != '.svn'))498 {499 $this->LoadModule($Directory.'/'.$Item.'/'.$Item.'.php');500 }501 }502 }503 504 function LoadModules(): void505 {506 if (is_array($this->OnLoadModules) and (count($this->OnLoadModules) == 2) and method_exists($this->OnLoadModules[0], $this->OnLoadModules[1]))507 call_user_func($this->OnLoadModules);508 else $this->LoadModulesFromDir($this->ModulesDir);509 }510 } -
trunk/Packages/Common/Modules/ModuleManager.php
r898 r899 1 1 <?php 2 2 3 class ModuleModuleManager extends AppModule3 class ModuleModuleManager extends Module 4 4 { 5 5 public UpdateManager $UpdateManager; … … 13 13 $this->License = 'GNU/GPLv3'; 14 14 $this->Description = 'User interface for module management.'; 15 $this->Dependencies = array( 'Setup');15 $this->Dependencies = array(ModuleSetup::GetName()); 16 16 $this->Revision = 1; 17 17 $this->Type = ModuleType::System; 18 $this->Models = array(ModelField::GetClassName(), ModuleDependency::GetClassName()); 18 19 } 19 20 … … 142 143 function DoBeforeInstall(): void 143 144 { 144 $this->AddModelDatabase(Module::Get Desc());145 $this->AddModelDatabase(Module::GetModelDesc()); 145 146 $this->Manager->OnInstallModule = array($this, 'InstallModule'); 146 147 $this->Manager->OnUninstallModule = array($this, 'UninstallModule'); 147 $this->AddModelDatabase(Mod uleModel::GetDesc());148 $this->AddModelDatabase(Model::GetModelDesc()); 148 149 $this->Manager->OnInstallModel = array($this, 'InstallModel'); 149 150 $this->Manager->OnUninstallModel = array($this, 'UninstallModel'); … … 154 155 $this->Manager->OnInstallModel = null; 155 156 $this->Manager->OnUninstallModel = null; 156 $this->RemoveModelDatabase(Mod uleModel::GetDesc());157 $this->RemoveModelDatabase(Model::GetModelDesc()); 157 158 $this->Manager->OnInstallModule = null; 158 159 $this->Manager->OnUninstallModule = null; 159 $this->RemoveModelDatabase(Module::GetDesc()); 160 } 161 162 function GetModels(): array 163 { 164 return array(ModuleModelField::GetClassName(), ModuleDependency::GetClassName()); 160 $this->RemoveModelDatabase(Module::GetModelDesc()); 161 } 162 163 function DoInstall(): void 164 { 165 $this->InstallModel(Module::GetModelDesc(), $this->System->GetModule($this::GetName())); 166 $this->InstallModel(Model::GetModelDesc(), $this->System->GetModule($this::GetName())); 165 167 } 166 168 … … 238 240 } 239 241 240 function InstallModel(ModelDesc $ModelDesc, AppModule $Module)242 function InstallModel(ModelDesc $ModelDesc, Module $Module) 241 243 { 242 244 $this->AddModelDatabase($ModelDesc); 243 $this->Database->insert('Mod uleModel', array('Name' => $ModelDesc->Name, 'Module' => $Module->Id));245 $this->Database->insert('Model', array('Name' => $ModelDesc->Name, 'Module' => $Module->Id)); 244 246 $ModelId = $this->Database->insert_id; 245 247 foreach ($ModelDesc->Columns as $Field) 246 248 { 247 $this->Database->insert('Mod uleModelField', array('Name' => $Field->Name, 'Model' => $ModelId,249 $this->Database->insert('ModelField', array('Name' => $Field->Name, 'Model' => $ModelId, 248 250 'Type' => ModelColumnType::GetName($Field->Type), 'Nullable' => (int)$Field->Nullable)); 249 251 } 250 252 } 251 253 252 function UninstallModel(ModelDesc $ModelDesc, AppModule $Module) 253 { 254 $this->Database->delete('ModuleModel', '(Name='.$ModelDesc->Name.') AND (Module='.$Module->Id.')'); 254 function UninstallModel(ModelDesc $ModelDesc, Module $Module) 255 { 256 $DbResult = $this->Database->select('Model', 'Id', '(Name="'.$ModelDesc->Name.'") AND (Module='.$Module->Id.')'); 257 if ($DbResult->num_rows > 0) 258 { 259 $DbRow = $DbResult->fetch_assoc(); 260 $ModelId = $DbRow['Id']; 261 $DbResult = $this->Database->delete('ModelField', '(Model='.$ModelId.')'); 262 } 263 $this->Database->delete('Model', '(Id='.$ModelId.')'); 255 264 $this->RemoveModelDatabase($ModelDesc); 256 265 } 257 266 258 function InstallModule(AppModule $Module) 259 { 260 echo('Install module '.$Module->Name); 267 function InstallModule(Module $Module) 268 { 261 269 $this->Database->insert('Module', array( 270 'Id' => $Module->Id, 262 271 'Name' => $Module->Name, 263 272 'Title' => $Module->Title, … … 269 278 'InstalledVersion' => $Module->InstalledVersion 270 279 )); 271 $Module->Id = $this->Database->insert_id; 272 } 273 274 function UninstallModule(AppModule $Module) 275 { 276 echo('Uninstall module '.$Module->Name); 277 $this->Database->delete('Module', 'Name='.$Module->Name); 278 } 279 280 function ModuleChange(AppModule $Module): void 280 } 281 282 function UninstallModule(Module $Module) 283 { 284 $this->Database->delete('Module', 'Name="'.$Module->Name.'"'); 285 } 286 287 function ModuleChange(Module $Module): void 281 288 { 282 289 if ($Module->Installed) $Installed = 1; … … 293 300 while ($Module = $DbResult->fetch_array()) 294 301 { 295 //echo($Module['Name'].',');296 302 include_once('Modules/'.$Module['Name'].'/'.$Module['Name'].'.php'); 297 303 $ModuleClassName = 'Module'.$Module['Name']; … … 534 540 } 535 541 536 class Mod uleextends Model542 class ModelField extends Model 537 543 { 538 static function Get Desc(): ModelDesc544 static function GetModelDesc(): ModelDesc 539 545 { 540 546 $Desc = new ModelDesc(self::GetClassName()); 541 547 $Desc->AddString('Name'); 542 $Desc->AddString('Title'); 543 $Desc->AddString('Creator'); 544 $Desc->AddString('Version'); 545 $Desc->AddString('License'); 546 $Desc->AddBoolean('Installed'); 547 $Desc->AddString('InstalledVersion'); 548 $Desc->AddString('Description'); 549 return $Desc; 550 } 551 } 552 553 class ModuleModel extends Model 554 { 555 static function GetDesc(): ModelDesc 556 { 557 $Desc = new ModelDesc(self::GetClassName()); 558 $Desc->AddString('Name'); 559 $Desc->AddReference('Module', Module::GetClassName()); 560 return $Desc; 561 } 562 } 563 564 class ModuleModelField extends Model 565 { 566 static function GetDesc(): ModelDesc 567 { 568 $Desc = new ModelDesc(self::GetClassName()); 569 $Desc->AddString('Name'); 570 $Desc->AddReference('Model', ModuleModel::GetClassName()); 548 $Desc->AddReference('Model', Model::GetClassName()); 571 549 $Desc->AddString('Type'); 572 550 $Desc->AddBoolean('Nullable'); … … 577 555 class ModuleDependency extends Model 578 556 { 579 static function Get Desc(): ModelDesc557 static function GetModelDesc(): ModelDesc 580 558 { 581 559 $Desc = new ModelDesc(self::GetClassName()); -
trunk/Packages/Common/Modules/Setup.php
r897 r899 1 1 <?php 2 3 class ModuleSetup extends Module 4 { 5 public UpdateManager $UpdateManager; 6 7 function __construct(System $System) 8 { 9 global $DatabaseRevision; 10 11 parent::__construct($System); 12 $this->Name = 'Setup'; 13 $this->Version = '1.0'; 14 $this->Creator = 'Chronos'; 15 $this->License = 'GNU/GPLv3'; 16 $this->Description = 'Base setup module'; 17 $this->Revision = 1; 18 $this->Type = ModuleType::System; 19 20 // Check database persistence structure 21 $this->UpdateManager = new UpdateManager(); 22 $this->UpdateManager->Database = &$this->Database; 23 $this->UpdateManager->Revision = $DatabaseRevision; 24 $this->UpdateManager->InstallMethod = 'FullInstall'; 25 } 26 27 static function Cast(Module $Module): ModuleSetup 28 { 29 if ($Module instanceof ModuleSetup) 30 { 31 return $Module; 32 } 33 throw new Exception('Expected ModuleSetup type but '.gettype($Module)); 34 } 35 36 function DoStart(): void 37 { 38 Core::Cast($this->System)->RegisterPage([''], 'PageSetupRedirect'); 39 Core::Cast($this->System)->RegisterPage(['setup'], 'PageSetup'); 40 } 41 42 function DoStop(): void 43 { 44 unset($this->UpdateManager); 45 Core::Cast($this->System)->UnregisterPage(['']); 46 Core::Cast($this->System)->UnregisterPage(['setup']); 47 } 48 49 function CheckState(): bool 50 { 51 return $this->Database->Connected() and $this->UpdateManager->IsInstalled() and 52 $this->UpdateManager->IsUpToDate(); 53 } 54 55 function DoUpgrade(): string 56 { 57 $Updates = new Updates(); 58 $this->UpdateManager->Trace = $Updates->Get(); 59 $Output = $this->UpdateManager->Upgrade(); 60 return $Output; 61 } 62 63 function InsertSampleData(): void 64 { 65 } 66 } 2 67 3 68 class PageSetup extends Page … … 111 176 { 112 177 $Output .= '<h3>Instalace systém</h3>'; 178 global $DatabaseRevision; 179 180 $this->Database->query("CREATE TABLE IF NOT EXISTS `".$this->UpdateManager->VersionTable."` (". 181 '`Id` int(11) NOT NULL AUTO_INCREMENT, '. 182 '`Revision` int(11) NOT NULL, '. 183 'PRIMARY KEY (`Id`) '. 184 ') ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 185 $DbResult = $this->Database->select($this->UpdateManager->VersionTable, 'Id'); 186 if ($DbResult->num_rows == 0) 187 { 188 $this->Database->query("INSERT INTO `".$this->UpdateManager->VersionTable. 189 "` (`Id`, `Revision`) VALUES (1, ".$DatabaseRevision.");"); 190 } 113 191 $this->System->ModuleManager->InstallAll(array(ModuleCondition::System)); 114 192 $this->System->ModuleManager->LoadModules(); … … 121 199 $Output .= '<h3>Odinstalace vše</h3>'; 122 200 $this->System->ModuleManager->UninstallAll(array(ModuleCondition::System)); 201 $this->Database->query('DROP TABLE IF EXISTS `'.$this->UpdateManager->VersionTable.'`'); 123 202 $Output .= $this->ControlPanel(); 124 203 } … … 296 375 } 297 376 } 298 299 class ModuleSetup extends AppModule300 {301 public UpdateManager $UpdateManager;302 303 function __construct(System $System)304 {305 global $DatabaseRevision;306 307 parent::__construct($System);308 $this->Name = 'Setup';309 $this->Version = '1.0';310 $this->Creator = 'Chronos';311 $this->License = 'GNU/GPLv3';312 $this->Description = 'Base setup module';313 $this->Dependencies = array();314 $this->Revision = 1;315 $this->Type = ModuleType::System;316 317 // Check database persistence structure318 $this->UpdateManager = new UpdateManager();319 $this->UpdateManager->Database = &$this->Database;320 $this->UpdateManager->Revision = $DatabaseRevision;321 $this->UpdateManager->InstallMethod = 'FullInstall';322 }323 324 static function Cast(AppModule $AppModule): ModuleSetup325 {326 if ($AppModule instanceof ModuleSetup)327 {328 return $AppModule;329 }330 throw new Exception('Expected ModuleSetup type but '.gettype($AppModule));331 }332 333 function DoStart(): void334 {335 Core::Cast($this->System)->RegisterPage([''], 'PageSetupRedirect');336 Core::Cast($this->System)->RegisterPage(['setup'], 'PageSetup');337 }338 339 function DoStop(): void340 {341 unset($this->UpdateManager);342 Core::Cast($this->System)->UnregisterPage(['']);343 Core::Cast($this->System)->UnregisterPage(['setup']);344 }345 346 function CheckState(): bool347 {348 return $this->Database->Connected() and $this->UpdateManager->IsInstalled() and349 $this->UpdateManager->IsUpToDate();350 }351 352 function DoUpgrade(): string353 {354 $Updates = new Updates();355 $this->UpdateManager->Trace = $Updates->Get();356 $Output = $this->UpdateManager->Upgrade();357 return $Output;358 }359 } -
trunk/Packages/Common/System.php
r898 r899 43 43 } 44 44 45 class Application extendsSystem45 class System 46 46 { 47 public Database $Database; 47 48 public string $Name; 48 public AppModuleManager $ModuleManager;49 public ModuleManager $ModuleManager; 49 50 public array $Models; 50 51 public array $CommandLine; … … 53 54 function __construct() 54 55 { 55 parent::__construct();56 $this->Name = ' Application';57 $this->ModuleManager = new AppModuleManager($this);56 $this->Database = new Database(); 57 $this->Name = 'System'; 58 $this->ModuleManager = new ModuleManager($this); 58 59 $this->Models = array(); 59 60 $this->CommandLine = array(); … … 63 64 } 64 65 65 function GetModule(string $Name): AppModule66 function GetModule(string $Name): Module 66 67 { 67 68 if (array_key_exists($Name, $this->ModuleManager->Modules)) … … 87 88 } 88 89 89 function Unr gisterCommandLine(string $Name): void90 function UnregisterCommandLine(string $Name): void 90 91 { 91 92 unset($this->CommandLine[$Name]);
Note:
See TracChangeset
for help on using the changeset viewer.