- Timestamp:
- Jan 4, 2021, 9:55:40 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/API/API.php
r890 r893 33 33 } 34 34 35 function DoInstall(): void35 function GetModels(): array 36 36 { 37 $this->InstallModel(APIToken::GetDesc()); 38 } 39 40 function DoUninstall(): void 41 { 42 $this->UninstallModel(APIToken::GetDesc()); 37 return array('APIToken'); 43 38 } 44 39 } -
trunk/Modules/Customer/Customer.php
r891 r893 191 191 } 192 192 193 static function GetModels(): array 194 { 195 return array( 196 'Member', 197 'MemberPayment', 198 'SupportActivity', 199 'ServiceCategory', 200 'Service', 201 'ServiceCustomerRel', 202 ); 193 function GetModels(): array 194 { 195 return array('Member', 'MemberPayment', 'SupportActivity', 'ServiceCategory', 'Service', 'ServiceCustomerRel'); 203 196 } 204 197 -
trunk/Modules/Document/Document.php
r891 r893 63 63 ), 64 64 //'AfterInsert' => array($this, 'AfterInsertFinanceYear'), 65 )); 65 )); 66 66 $this->System->FormManager->RegisterFormType('TDocumentLine', array( 67 67 'Type' => 'Reference', … … 77 77 'Name' => 'Name', 78 78 'Filter' => '1', 79 )); 79 )); 80 80 } 81 81 82 function DoInstall(): void82 function GetModels(): array 83 83 { 84 $this->InstallModel(FinanceYear::GetDesc()); 85 $this->InstallModel(DocumentLineCode::GetDesc()); 86 $this->InstallModel(DocumentLine::GetDesc()); 87 $this->InstallModel(DocumentLineSequence::GetDesc()); 88 } 89 90 function DoUninstall(): void 91 { 92 $this->UninstallModel(DocumentLineSequence::GetDesc()); 93 $this->UninstallModel(DocumentLine::GetDesc()); 94 $this->UninstallModel(DocumentLineCode::GetDesc()); 95 $this->UninstallModel(FinanceYear::GetDesc()); 84 return array('FinanceYear', 'DocumentLineCode', 'DocumentLine', 'DocumentLineSequence'); 96 85 } 97 86 } -
trunk/Modules/EmailQueue/EmailQueue.php
r888 r893 19 19 } 20 20 21 class EmailQueue extends Model 22 { 23 static function GetDesc(): ModelDesc 24 { 25 $Desc = new ModelDesc('EmailQueue'); 26 $Desc->AddDateTime('Time'); 27 $Desc->AddString('To'); 28 $Desc->AddString('Subject'); 29 $Desc->AddText('Content'); 30 $Desc->AddString('Headers'); 31 $Desc->AddBoolean('Archive'); 32 $Desc->AddString('From'); 33 $Desc->AddReference('AttachmentFile', 'File'); 34 return $Desc; 35 } 36 } 37 21 38 class ModuleEmailQueue extends AppModule 22 39 { … … 32 49 } 33 50 34 function DoInstall(): void51 function GetModels(): array 35 52 { 36 } 37 38 function DoUninstall(): void 39 { 53 return array('EmailQueue'); 40 54 } 41 55 … … 72 86 ), 73 87 )); 74 }75 76 function DoStop(): void77 {78 88 } 79 89 -
trunk/Modules/Employee/Employee.php
r887 r893 1 1 <?php 2 3 class Employee extends Model 4 { 5 static function GetDesc(): ModelDesc 6 { 7 $Desc = new ModelDesc('Employee'); 8 $Desc->AddDateTime('Time'); 9 $Desc->AddString('To'); 10 $Desc->AddString('Subject'); 11 $Desc->AddText('Content'); 12 $Desc->AddString('Headers'); 13 $Desc->AddBoolean('Archive'); 14 $Desc->AddString('From'); 15 $Desc->AddReference('AttachmentFile', 'File'); 16 return $Desc; 17 } 18 } 19 20 class EmployeeSalary extends Model 21 { 22 static function GetDesc(): ModelDesc 23 { 24 $Desc = new ModelDesc('EmployeeSalary'); 25 $Desc->AddDate('Date'); 26 $Desc->AddReference('Employee', 'Employee'); 27 $Desc->AddInteger('Amount'); 28 $Desc->AddReference('Contract', 'Contract'); 29 return $Desc; 30 } 31 } 2 32 3 33 class ModuleEmployee extends AppModule … … 11 41 $this->License = 'GNU/GPL'; 12 42 $this->Description = 'Employee wages management'; 13 $this->Dependencies = array('User'); 43 $this->Dependencies = array('User', 'Finance'); 44 } 45 46 function GetModels(): array 47 { 48 return array('Employee', 'EmployeeSalary'); 14 49 } 15 50 -
trunk/Modules/Error/Error.php
r887 r893 18 18 $this->ErrorHandler = new ErrorHandler(); 19 19 $this->Encoding = 'utf-8'; 20 }21 22 function DoInstall(): void23 {24 }25 26 function DoUnInstall(): void27 {28 20 } 29 21 -
trunk/Modules/File/File.php
r891 r893 19 19 $Desc->AddInteger('Size'); 20 20 $Desc->AddReference('Directory', 'FileDirectory', true); 21 $Desc->AddDateTime('Time'); 21 $Desc->AddDateTime('Time'); 22 22 return $Desc; 23 23 } … … 192 192 } 193 193 194 function DoInstall(): void 195 { 196 $this->InstallModel(FileDirectory::GetDesc()); 197 $this->InstallModel(File::GetDesc()); 198 } 199 200 function DoUninstall(): void 201 { 202 $this->UninstallModel(File::GetDesc()); 203 $this->UninstallModel(FileDirectory::GetDesc()); 194 function GetModels(): array 195 { 196 return array('FileDirectory', 'File'); 204 197 } 205 198 -
trunk/Modules/Finance/Finance.php
r891 r893 483 483 } 484 484 485 staticfunction GetModels(): array485 function GetModels(): array 486 486 { 487 487 return array( … … 503 503 'Contract' 504 504 ); 505 }506 507 function DoInstall(): void508 {509 foreach (self::GetModels() as $Model)510 {511 $this->InstallModel($Model::GetDesc());512 }513 }514 515 function DoUninstall(): void516 {517 foreach (array_reverse(self::GetModels()) as $Model)518 {519 $this->UninstallModel($Model::GetDesc());520 }521 505 } 522 506 -
trunk/Modules/FinanceBankAPI/FinanceBankAPI.php
r887 r893 5 5 include_once(dirname(__FILE__).'/ImportFio.php'); 6 6 include_once(dirname(__FILE__).'/../Scheduler/Scheduler.php'); 7 8 class FinanceBankImport extends Model 9 { 10 static function GetDesc(): ModelDesc 11 { 12 $Desc = new ModelDesc('FinanceBankImport'); 13 $Desc->AddReference('BankAccount', 'BankAccount'); 14 $Desc->AddDate('Time'); 15 $Desc->AddString('Identification'); 16 $Desc->AddString('AccountNumber'); 17 $Desc->AddString('BankCode'); 18 $Desc->AddString('VariableSymbol'); 19 $Desc->AddString('ConstantSymbol'); 20 $Desc->AddString('SpecificSymbol'); 21 $Desc->AddFloat('Value'); 22 $Desc->AddReference('Currency', 'Currency'); 23 $Desc->AddString('OffsetAccountName'); 24 $Desc->AddReference('FinanceOperation', 'FinanceOperation'); 25 return $Desc; 26 } 27 } 7 28 8 29 class ModuleFinanceBankAPI extends AppModule … … 19 40 } 20 41 21 function DoInstall(): void42 function GetModels(): array 22 43 { 23 } 24 25 function DoUninstall(): void 26 { 44 return array('FinanceBankImport'); 27 45 } 28 46 … … 65 83 ModuleIS::Cast($this->System->GetModule('IS'))->RegisterDashboardItem('FinanceBankAPI', 66 84 array($this, 'ShowDashboardItem')); 67 }68 69 function DoStop(): void70 {71 85 } 72 86 -
trunk/Modules/IS/IS.php
r888 r893 843 843 } 844 844 845 class Menu extends Model 846 { 847 static function GetDesc(): ModelDesc 848 { 849 $Desc = new ModelDesc('Menu'); 850 $Desc->AddString('Name'); 851 return $Desc; 852 } 853 } 854 855 class MenuItem extends Model 856 { 857 static function GetDesc(): ModelDesc 858 { 859 $Desc = new ModelDesc('MenuItem'); 860 $Desc->AddString('Name'); 861 $Desc->AddReference('Parent', 'MenuItem'); 862 $Desc->AddReference('Action', 'Action'); 863 $Desc->AddReference('Menu', 'Menu'); 864 return $Desc; 865 } 866 } 867 868 class MenuItemFavorite extends Model 869 { 870 static function GetDesc(): ModelDesc 871 { 872 $Desc = new ModelDesc('MenuItemFavorite'); 873 $Desc->AddReference('User', 'User'); 874 $Desc->AddReference('MenuItem', 'MenuItem'); 875 return $Desc; 876 } 877 } 878 845 879 class ModuleIS extends AppModule 846 880 { … … 861 895 } 862 896 863 function DoInstall(): void 864 { 865 } 866 867 function DoUninstall(): void 868 { 897 function GetModels(): array 898 { 899 return array('Menu', 'MenuItem', 'MenuItemFavorite'); 869 900 } 870 901 … … 915 946 } 916 947 917 function DoStop(): void918 {919 }920 921 948 function RegisterDashboardItem(string $Name, callable $Callback): void 922 949 { -
trunk/Modules/News/News.php
r891 r893 28 28 } 29 29 30 static function GetModels(): array 31 { 32 return array( 33 'NewsCategory', 34 'News', 35 ); 30 function GetModels(): array 31 { 32 return array('NewsCategory', 'News'); 36 33 } 37 34 -
trunk/Modules/Notify/Notify.php
r891 r893 128 128 } 129 129 130 static function GetModels(): array 131 { 132 return array( 133 'NotifyCategory', 134 'NotifyUser', 135 ); 130 function GetModels(): array 131 { 132 return array('NotifyCategory', 'NotifyUser'); 136 133 } 137 134 138 135 function DoInstall(): void 139 136 { 140 foreach (self::GetModels() as $Model)141 {142 $this->InstallModel($Model::GetDesc());143 }144 145 137 $this->Database->query("INSERT INTO `NotifyCategory` (`Id`, `Name`, `SysName`) VALUES 146 138 (1, 'Dostupnost zařízení (ping)', 'NetworkReachability'), … … 152 144 } 153 145 154 function DoUninstall(): void155 {156 foreach (array_reverse(self::GetModels()) as $Model)157 {158 $this->UninstallModel($Model::GetDesc());159 }160 }161 162 146 function ShowLogRSS(): string 163 147 { -
trunk/Modules/Portal/Portal.php
r887 r893 14 14 $this->Description = 'Community portal.'; 15 15 $this->Dependencies = array('News', 'User'); 16 }17 18 function DoInstall(): void19 {20 }21 22 function DoUninstall(): void23 {24 16 } 25 17 … … 43 35 )); 44 36 ModuleUser::Cast($this->System->GetModule('User'))->UserPanel[] = array('PagePortal', 'UserPanel'); 45 }46 47 function DoStop(): void48 {49 37 } 50 38 } -
trunk/Modules/Scheduler/Scheduler.php
r887 r893 50 50 $this->System->RegisterCommandLine('run-scheduler', 'Runs scheduled tasks', 51 51 array(ModuleScheduler::Cast($this->System->GetModule('Scheduler')), 'Run')); 52 }53 54 function DoInstall(): void55 {56 }57 58 function DoUnInstall(): void59 {60 52 } 61 53 -
trunk/Modules/Stock/Stock.php
r887 r893 12 12 $this->Description = 'Stock and products'; 13 13 $this->Dependencies = array('User', 'Customer', 'Network'); 14 } 15 16 function GetModels(): array 17 { 18 return array('Product', 'StockSerialNumber', 'Stock', 'StockMoveGroup', 'StockMove', 'StockMoveItem', 19 'StockItemHistory', 'StockMoveItemSerialRel'); 14 20 } 15 21 … … 256 262 } 257 263 } 264 265 class Product extends Model 266 { 267 static function GetDesc(): ModelDesc 268 { 269 $Desc = new ModelDesc('Product'); 270 $Desc->AddReference('Manufacturer', 'Subject'); 271 $Desc->AddString('Code'); 272 $Desc->AddString('Name'); 273 $Desc->AddInteger('SellPrice'); 274 $Desc->AddInteger('BuyPrice'); 275 $Desc->AddInteger('VAT'); 276 $Desc->AddInteger('Consumption'); 277 $Desc->AddReference('Supplier', 'Subject'); 278 $Desc->AddReference('UnitOfMeasure', 'UnitOfMeasure'); 279 $Desc->AddInteger('StockMinCount'); 280 return $Desc; 281 } 282 } 283 284 class StockSerialNumber extends Model 285 { 286 static function GetDesc(): ModelDesc 287 { 288 $Desc = new ModelDesc('StockSerialNumber'); 289 $Desc->AddReference('Stock', 'Stock'); 290 $Desc->AddReference('Product', 'Product'); 291 $Desc->AddDate('TimeEnlistment'); 292 $Desc->AddDate('TimeElimination'); 293 $Desc->AddInteger('SellPrice'); 294 $Desc->AddInteger('BuyPrice'); 295 $Desc->AddInteger('Amount'); 296 $Desc->AddString('SerialNumber'); 297 $Desc->AddString('RegNumber'); 298 $Desc->AddReference('Location', 'Member'); 299 $Desc->AddReference('Esemble', 'StockSerialNumber'); 300 return $Desc; 301 } 302 } 303 304 class Stock extends Model 305 { 306 static function GetDesc(): ModelDesc 307 { 308 $Desc = new ModelDesc('Stock'); 309 $Desc->AddReference('Location', 'Member'); 310 return $Desc; 311 } 312 } 313 314 class StockMove extends Model 315 { 316 static function GetDesc(): ModelDesc 317 { 318 $Desc = new ModelDesc('StockMove'); 319 $Desc->AddReference('Group', 'StockMoveGroup'); 320 $Desc->AddDateTime('Time'); 321 $Desc->AddReference('Stock', 'Stock'); 322 $Desc->AddReference('File', 'File'); 323 return $Desc; 324 } 325 } 326 327 class StockMoveItem extends Model 328 { 329 static function GetDesc(): ModelDesc 330 { 331 $Desc = new ModelDesc('StockMoveItem'); 332 $Desc->AddReference('StockMove', 'StockMove'); 333 $Desc->AddReference('Product', 'Product'); 334 $Desc->AddInteger('UnitPrice'); 335 $Desc->AddInteger('Amount'); 336 return $Desc; 337 } 338 } 339 340 class StockMoveGroup extends Model 341 { 342 static function GetDesc(): ModelDesc 343 { 344 $Desc = new ModelDesc('StockMoveGroup'); 345 $Desc->AddString('Name'); 346 $Desc->AddReference('DocumentLine', 'DocumentLine'); 347 $Desc->AddInteger('ValueSign'); 348 $Desc->AddInteger('Direction'); 349 return $Desc; 350 } 351 } 352 353 class StockItemHistory extends Model 354 { 355 static function GetDesc(): ModelDesc 356 { 357 $Desc = new ModelDesc('StockItemHistory'); 358 $Desc->AddDateTime('Time'); 359 $Desc->AddReference('StockSerialNumber', 'StockSerialNumber'); 360 $Desc->AddText('Text'); 361 return $Desc; 362 } 363 } 364 365 class StockMoveItemSerialRel extends Model 366 { 367 static function GetDesc(): ModelDesc 368 { 369 $Desc = new ModelDesc('StockMoveItemSerialRel'); 370 $Desc->AddReference('StockMoveItem', 'StockMoveItem'); 371 $Desc->AddReference('StockSerialNumber', 'StockSerialNumber'); 372 return $Desc; 373 } 374 } -
trunk/Modules/Subject/Subject.php
r891 r893 131 131 } 132 132 133 function DoInstall(): void 134 { 135 $this->InstallModel(Country::GetDesc()); 136 $this->InstallModel(Subject::GetDesc()); 137 $this->InstallModel(ContactCategory::GetDesc()); 138 $this->InstallModel(Contact::GetDesc()); 139 } 140 141 function DoUninstall(): void 142 { 143 $this->UninstallModel(Contact::GetDesc()); 144 $this->UninstallModel(ContactCategory::GetDesc()); 145 $this->UninstallModel(Subject::GetDesc()); 146 $this->UninstallModel(Country::GetDesc()); 133 function GetModels(): array 134 { 135 return array('Country', 'Subject', 'ContactCategory', 'Contact'); 147 136 } 148 137 -
trunk/Modules/System/System.php
r887 r893 400 400 } 401 401 402 function DoStop(): void403 {404 }405 406 402 function IsInstalled(): bool 407 403 { -
trunk/Modules/TV/TV.php
r887 r893 112 112 } 113 113 114 function DoInstall(): void114 function GetModels(): array 115 115 { 116 } 117 118 function DoUninstall(): void 119 { 116 return array('TVGroup', 'TV'); 120 117 } 121 118 … … 165 162 )); 166 163 } 164 } 167 165 168 function DoStop(): void 166 class TVGroup extends Model 167 { 168 static function GetDesc(): ModelDesc 169 169 { 170 $Desc = new ModelDesc('TVGroup'); 171 $Desc->AddString('Name'); 172 return $Desc; 170 173 } 171 174 } 175 176 class TV extends Model 177 { 178 static function GetDesc(): ModelDesc 179 { 180 $Desc = new ModelDesc('TV'); 181 $Desc->AddString('Name'); 182 $Desc->AddInteger('Frequency'); 183 $Desc->AddString('Norm'); 184 $Desc->AddString('Homepage'); 185 $Desc->AddReference('Language', 'Language'); 186 $Desc->AddString('ShortName'); 187 $Desc->AddString('Stream'); 188 $Desc->AddString('StreamWeb'); 189 $Desc->AddString('SourceType'); 190 $Desc->AddReference('Category', 'TVGroup'); 191 return $Desc; 192 } 193 } -
trunk/Modules/Task/Task.php
r887 r893 12 12 $this->Description = 'Work and task management'; 13 13 $this->Dependencies = array('User'); 14 } 15 16 function GetModels(): array 17 { 18 return array('TaskGroup', 'Task', 'Work'); 14 19 } 15 20 … … 93 98 } 94 99 95 function DoInstall(): void96 {97 }98 99 100 function ShowDashboardItem(): string 100 101 { … … 105 106 } 106 107 } 108 109 class Task extends Model 110 { 111 static function GetDesc(): ModelDesc 112 { 113 $Desc = new ModelDesc('Task'); 114 $Desc->AddString('Name'); 115 $Desc->AddDate('TimeCreate'); 116 $Desc->AddDate('TimeDue'); 117 $Desc->AddDate('TimeClose'); 118 $Desc->AddEnum('Priority', array('Nízká', 'Střední', 'Vysoká')); 119 $Desc->AddBoolean('Public'); 120 $Desc->AddInteger('Progress'); 121 $Desc->AddReference('Group', 'TaskGroup'); 122 $Desc->AddString('Description'); 123 $Desc->AddText('Conclusion'); 124 $Desc->AddReference('AssignedTo', 'User'); 125 return $Desc; 126 } 127 } 128 129 class TaskGroup extends Model 130 { 131 static function GetDesc(): ModelDesc 132 { 133 $Desc = new ModelDesc('TaskGroup'); 134 $Desc->AddString('Name'); 135 $Desc->AddText('Description'); 136 $Desc->AddReference('Parent', 'TaskGroup'); 137 return $Desc; 138 } 139 } 140 141 class Work extends Model 142 { 143 static function GetDesc(): ModelDesc 144 { 145 $Desc = new ModelDesc('Work'); 146 $Desc->AddString('Name'); 147 $Desc->AddText('Description'); 148 $Desc->AddDateTime('TimeStart'); 149 $Desc->AddFloat('Duration'); 150 $Desc->AddReference('User', 'User'); 151 $Desc->AddReference('Task', 'Task'); 152 return $Desc; 153 } 154 } -
trunk/Modules/TimeMeasure/Measure.php
r888 r893 11 11 public int $DivisionCount = 500; 12 12 public array $ValueTypes = array('Min', 'Avg', 'Max'); 13 14 static function GetDesc(): ModelDesc 15 { 16 $Desc = new ModelDesc('Measure'); 17 $Desc->AddString('Name'); 18 $Desc->AddString('Title'); 19 $Desc->AddString('Description'); 20 $Desc->AddString('Unit'); 21 $Desc->AddBoolean('Continuity'); 22 $Desc->AddInteger('Period'); 23 $Desc->AddString('PermissionAdd'); 24 $Desc->AddString('PermissionView'); 25 $Desc->AddBoolean('Enabled'); 26 $Desc->AddString('DataType'); 27 $Desc->AddString('DataTable'); 28 return $Desc; 29 } 13 30 14 31 function Load(int $Id): void -
trunk/Modules/TimeMeasure/TimeMeasure.php
r887 r893 18 18 } 19 19 20 function DoInstall(): void20 function GetModels(): array 21 21 { 22 } 23 24 function DoUnInstall(): void 25 { 22 return array('Measure'); 26 23 } 27 24 … … 49 46 )); 50 47 } 51 52 function DoStop(): void53 {54 }55 48 } -
trunk/Modules/User/User.php
r890 r893 23 23 } 24 24 25 function DoInstall(): void 26 { 27 $this->InstallModel(User::GetDesc()); 28 $this->InstallModel(UserOnline::GetDesc()); 29 $this->InstallModel(PermissionGroup::GetDesc()); 30 $this->InstallModel(PermissionOperation::GetDesc()); 31 $this->InstallModel(PermissionGroupAssignment::GetDesc()); 32 $this->InstallModel(PermissionUserAssignment::GetDesc()); 33 } 34 35 function DoUninstall(): void 36 { 37 $this->UninstallModel(PermissionUserAssignment::GetDesc()); 38 $this->UninstallModel(PermissionGroupAssignment::GetDesc()); 39 $this->UninstallModel(PermissionOperation::GetDesc()); 40 $this->UninstallModel(PermissionGroup::GetDesc()); 41 $this->UninstallModel(UserOnline::GetDesc()); 42 $this->UninstallModel(User::GetDesc()); 25 function GetModels(): array 26 { 27 return array('User', 'UserOnline', 'PermissionGroup', 'PermissionOperation', 'PermissionGroupAssignment', 'PermissionUserAssignment'); 43 28 } 44 29 -
trunk/Modules/Wiki/Wiki.php
r887 r893 15 15 } 16 16 17 function DoInstall(): void 18 { 19 parent::Install(); 20 $this->Database->Query('CREATE TABLE IF NOT EXISTS `WikiPage` ( 21 `Id` int(11) NOT NULL AUTO_INCREMENT, 22 `Name` varchar(255) NOT NULL, 23 `NormalizedName` varchar(255) NOT NULL, 24 `VisibleInMenu` int(11) NOT NULL, 25 PRIMARY KEY (`Id`), 26 UNIQUE KEY `Name` (`Name`), 27 KEY `VisibleInMenu` (`VisibleInMenu`) 28 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1'); 29 $this->Database->Query('CREATE TABLE IF NOT EXISTS `WikiPageContent` ( 30 `Id` int(11) NOT NULL AUTO_INCREMENT, 31 `Page` int(11) NOT NULL, 32 `Time` datetime NOT NULL, 33 `Content` text NOT NULL, 34 `User` int(11) NOT NULL, 35 PRIMARY KEY (`Id`), 36 KEY `User` (`User`), 37 KEY `Page` (`Page`) 38 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1'); 39 $this->Database->Query('ALTER TABLE `WikiPageContent` 40 ADD CONSTRAINT `WikiPageContent_ibfk_2` FOREIGN KEY (`Page`) REFERENCES `WikiPage` (`Id`), 41 ADD CONSTRAINT `WikiPageContent_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`ID`)'); 42 } 43 44 function DoUnInstall(): void 45 { 46 $this->Database->query('DELETE TABLE `WikiPageContent`'); 47 $this->Database->query('DELETE TABLE `WikiPage`;'); 17 function GetModels(): array 18 { 19 return array('WikiPage', 'WikiPageContent'); 48 20 } 49 21 … … 51 23 { 52 24 $this->LoadPages(); 53 }54 55 function DoStop(): void56 {57 25 } 58 26 … … 71 39 ), 2); 72 40 } 41 } 42 } 43 44 class WikiPage extends Model 45 { 46 static function GetDesc(): ModelDesc 47 { 48 $Desc = new ModelDesc('WikiPage'); 49 $Desc->AddString('Name'); 50 $Desc->AddString('NormalizedName'); 51 $Desc->AddBoolean('VisibleInMenu'); 52 return $Desc; 53 } 54 } 55 56 class WikiPageContent extends Model 57 { 58 static function GetDesc(): ModelDesc 59 { 60 $Desc = new ModelDesc('WikiPageContent'); 61 $Desc->AddReference('Page', 'Page'); 62 $Desc->AddDateTime('Time'); 63 $Desc->AddText('Content'); 64 $Desc->AddReference('User', 'User'); 65 return $Desc; 73 66 } 74 67 } -
trunk/Packages/Common/AppModule.php
r891 r893 73 73 } 74 74 75 staticfunction GetModels(): array75 function GetModels(): array 76 76 { 77 77 return array(); … … 84 84 $this->Manager->EnumDependenciesCascade($this, $List, array(ModuleCondition::NotInstalled)); 85 85 $this->Manager->Perform($List, array(ModuleAction::Install), array(ModuleCondition::NotInstalled)); 86 $this->InstallModels(); 86 87 $this->DoInstall(); 87 88 $this->Installed = true; … … 99 100 $this->Manager->Perform($List, array(ModuleAction::Uninstall), array(ModuleCondition::Installed)); 100 101 $this->DoUninstall(); 102 $this->UninstallModels(); 101 103 } 102 104 … … 188 190 { 189 191 $this->Models[get_class($Model)] = $Model; 192 } 193 194 function InstallModels(): void 195 { 196 foreach ($this->GetModels() as $Model) 197 { 198 $this->InstallModel($Model::GetDesc()); 199 } 200 } 201 202 function UninstallModels(): void 203 { 204 foreach (array_reverse($this->GetModels()) as $Model) 205 { 206 $this->UninstallModel($Model::GetDesc()); 207 } 190 208 } 191 209 … … 242 260 $Query .= "ALTER TABLE `".$ModelDesc->Name."` ". 243 261 "ADD CONSTRAINT `".$ModelDesc->Name."_ibfk_".$I."` FOREIGN KEY (`".$Column->Name."`) REFERENCES `".$Column->RefTable."` (`Id`);"; 262 $I++; 244 263 } 245 264 $this->Database->query($Query);
Note:
See TracChangeset
for help on using the changeset viewer.