Changeset 900
- Timestamp:
- Feb 17, 2021, 5:15:29 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Config/Config.php
r899 r900 6 6 { 7 7 parent::__construct($System); 8 $this->Name = ' Desc';8 $this->Name = 'Config'; 9 9 $this->Version = '1.0'; 10 10 $this->Creator = 'Chronos'; -
trunk/Modules/Finance/Finance.php
r899 r900 267 267 'Table' => 'FinanceTreasuryCheck', 268 268 'DefaultSortColumn' => 'Time', 269 'DefaultSortOrder' => 1, 269 270 'Items' => array( 270 271 'Treasury' => array('Type' => 'TFinanceTreasury', 'Caption' => 'Pokladna', 'Default' => ''), -
trunk/Modules/Portal/Portal.php
r899 r900 17 17 } 18 18 19 function DoInstall(): void 20 { 21 /* $this->Database->query("INSERT INTO `PanelColumn` (`Id`, `Width`) VALUES 22 (1, ''), 23 (2, ''), 24 (3, '70%');"); 25 $this->Database->query("INSERT INTO `Panel` (`Id`, `Module`, `Parameters`, `Order`, `PanelColumn`) VALUES 26 (1, 'ActionGroup', 1, 2, 1), 27 (2, 'ActionGroup', 4, 1, 2), 28 (3, 'ActionGroup', 5, 2, 2), 29 (4, 'ActionGroup', 6, 3, 2), 30 (5, 'ActionGroup', 2, 4, 2), 31 (6, 'ActionGroup', 3, 5, 2), 32 (7, 'NewsGroupList', '', 2, 3), 33 (8, 'Webcam', '', 3, 1), 34 (9, 'UserOptions', '', 1, 3), 35 (10, 'ActionGroup', 9, 1, 1), 36 (11, 'Meteo', '', 4, 1);");*/ 19 function DoInsertSampleData(): void 20 { 21 $ActionGroup1 = $this->Database->insert('ActionGroup', array('Name' => 'Síť')); 22 $ActionGroup2 = $this->Database->insert('ActionGroup', array('Name' => 'Místní organizace')); 23 $ActionGroup3 = $this->Database->insert('ActionGroup', array('Name' => 'Stránky občanů')); 24 $ActionGroup4 = $this->Database->insert('ActionGroup', array('Name' => 'Vyhledávání')); 25 $ActionGroup5 = $this->Database->insert('ActionGroup', array('Name' => 'Užitečné')); 26 $ActionGroup6 = $this->Database->insert('ActionGroup', array('Name' => 'Zábava')); 27 $ActionGroup7 = $this->Database->insert('ActionGroup', array('Name' => 'Hostované stránky')); 28 $ActionGroup8 = $this->Database->insert('ActionGroup', array('Name' => 'Prodej počítačů')); 29 $ActionGroup9 = $this->Database->insert('ActionGroup', array('Name' => 'Různé')); 30 31 $PanelColumn1 = $this->Database->insert('PanelColumn', array('Width' => '')); 32 $PanelColumn2 = $this->Database->insert('PanelColumn', array('Width' => '')); 33 $PanelColumn3 = $this->Database->insert('PanelColumn', array('Width' => '70%')); 34 35 $this->Database->insert('Panel', array('Module' => 'ActionGroup', 'Parameters' => $ActionGroup1, 'Order' => 2, 'PanelColumn' => $PanelColumn1)); 36 $this->Database->insert('Panel', array('Module' => 'ActionGroup', 'Parameters' => $ActionGroup4, 'Order' => 1, 'PanelColumn' => $PanelColumn2)); 37 $this->Database->insert('Panel', array('Module' => 'ActionGroup', 'Parameters' => $ActionGroup5, 'Order' => 2, 'PanelColumn' => $PanelColumn2)); 38 $this->Database->insert('Panel', array('Module' => 'ActionGroup', 'Parameters' => $ActionGroup6, 'Order' => 3, 'PanelColumn' => $PanelColumn2)); 39 $this->Database->insert('Panel', array('Module' => 'ActionGroup', 'Parameters' => $ActionGroup2, 'Order' => 4, 'PanelColumn' => $PanelColumn2)); 40 $this->Database->insert('Panel', array('Module' => 'ActionGroup', 'Parameters' => $ActionGroup3, 'Order' => 5, 'PanelColumn' => $PanelColumn2)); 41 $this->Database->insert('Panel', array('Module' => 'NewsGroupList', 'Parameters' => '', 'Order' => 2, 'PanelColumn' => $PanelColumn3)); 42 $this->Database->insert('Panel', array('Module' => 'Webcam', 'Parameters' => '', 'Order' => 3, 'PanelColumn' => $PanelColumn1)); 43 $this->Database->insert('Panel', array('Module' => 'UserOptions', 'Parameters' => '', 'Order' => 1, 'PanelColumn' => $PanelColumn3)); 44 $this->Database->insert('Panel', array('Module' => 'ActionGroup', 'Parameters' => $ActionGroup9, 'Order' => 1, 'PanelColumn' => $PanelColumn1)); 45 $this->Database->insert('Panel', array('Module' => 'Meteo', 'Parameters' => '', 'Order' => 4, 'PanelColumn' => $PanelColumn1)); 37 46 } 38 47 … … 297 306 $Output = ''; 298 307 $DbResult = $this->Database->query('SELECT * FROM `ActionGroup`'); 308 $ActionGroups = array(); 299 309 while ($DbRow = $DbResult->fetch_assoc()) 300 310 $ActionGroups[$DbRow['Id']] = $DbRow; -
trunk/Modules/System/System.php
r899 r900 16 16 $this->Description = 'Base system module'; 17 17 $this->Type = ModuleType::System; 18 $this->Dependencies = array(ModuleModuleManager::GetName()); 18 19 $this->Models = array(UnitOfMeasure::GetClassName(), ActionIcon::GetClassName(), ActionGroup::GetClassName(), 19 20 ActionType::GetClassName(), Action::GetClassName(), Language::GetClassName(), Country::GetClassName()); -
trunk/Modules/User/User.php
r899 r900 27 27 function DoInstall(): void 28 28 { 29 $this->Database->insert('PermissionGroup', array('Id' => 1, 'Description' => 'Ostatní')); 30 $this->Database->insert('PermissionGroup', array('Id' => 2, 'Description' => 'Registrovaní uživatelé')); 31 $this->Database->insert('PermissionGroup', array('Id' => 3, 'Description' => 'Zákazníci')); 32 $this->Database->insert('PermissionGroup', array('Id' => 4, 'Description' => 'Správci sítě')); 33 $this->Database->insert('PermissionGroup', array('Id' => 5, 'Description' => 'Systémoví správci')); 29 } 30 31 function DoInsertSampleData(): void 32 { 33 $DbResult = $this->Database->select('User', 'Id', 'Login="admin"'); 34 if ($DbResult->num_rows == 0) 35 { 36 $UserId = $this->Database->insert('User', array('Id' => 1, 'Login' => 'admin', 'Name' => 'Admin', 'Password' => 'd04b7c77a814de3207315c2f82dcd97a90ed33ca', 37 'Salt' => 'd5d8eb61e1a20d98b45b415ccd2fae802cb41294', 'Email' => 'admin@localhost', 'LastIpAddress' => null, 'LastLoginTime' => null, 38 'RegistrationTime' => '2021-02-17 14:56:22', 'Locked' => 0, 'InitPassword' => null)); 39 40 $PermissionGroup1 = $this->Database->insert('PermissionGroup', array('Description' => 'Ostatní')); 41 $PermissionGroup2 = $this->Database->insert('PermissionGroup', array('Description' => 'Registrovaní uživatelé')); 42 $PermissionGroup3 = $this->Database->insert('PermissionGroup', array('Description' => 'Zákazníci')); 43 $PermissionGroup4 = $this->Database->insert('PermissionGroup', array('Description' => 'Správci sítě')); 44 $PermissionGroup5 = $this->Database->insert('PermissionGroup', array('Description' => 'Systémoví správci')); 45 46 $this->Database->insert('PermissionUserAssignment', array('User' => $UserId, 'AssignedGroup' => $PermissionGroup5)); 47 } 34 48 } 35 49 -
trunk/Modules/User/UserModel.php
r899 r900 505 505 { 506 506 $Desc = new ModelDesc(self::GetClassName()); 507 //$Desc->AddReference('Module', Module::GetClassName());507 $Desc->AddReference('Module', Module::GetClassName()); 508 508 $Desc->AddString('Operation'); 509 509 $Desc->AddString('Item'); -
trunk/Packages/Common/Database.php
r898 r900 134 134 } 135 135 136 function insert(string $Table, array $Data): void136 function insert(string $Table, array $Data): int 137 137 { 138 138 $this->query($this->GetInsert($Table, $Data)); 139 139 $this->insert_id = $this->PDO->lastInsertId(); 140 return $this->insert_id; 140 141 } 141 142 -
trunk/Packages/Common/Module.php
r899 r900 17 17 const Enable = 5; 18 18 const Disable = 6; 19 const InsertSampleData = 7; 19 20 } 20 21 … … 141 142 } 142 143 144 function InsertSampleData(): void 145 { 146 $this->DoInsertSampleData(); 147 } 148 143 149 function Reinstall(): void 144 150 { … … 224 230 } 225 231 232 protected function DoInsertSampleData(): void 233 { 234 } 235 226 236 function AddModel(Model $Model): void 227 237 { -
trunk/Packages/Common/ModuleManager.php
r899 r900 57 57 if ($Action == ModuleAction::Disable) $Module->Disable(); 58 58 if ($Action == ModuleAction::Upgrade) $Module->Upgrade(); 59 if ($Action == ModuleAction::InsertSampleData) $Module->InsertSampleData(); 59 60 } 60 61 } … … 227 228 function RegisterModule(Module $Module): void 228 229 { 230 if (array_key_exists($Module->Name, $this->Modules)) 231 die('Can\'t register module '.$Module->Name.' because it already exists.'); 229 232 $this->Modules[$Module->Name] = &$Module; 230 233 $Module->Manager = &$this; -
trunk/Packages/Common/Modules/ModuleManager.php
r899 r900 260 260 $ModelId = $DbRow['Id']; 261 261 $DbResult = $this->Database->delete('ModelField', '(Model='.$ModelId.')'); 262 }263 $this->Database->delete('Model', '(Id='.$ModelId.')');262 $this->Database->delete('Model', '(Id='.$ModelId.')'); 263 } else echo('Can\'t remove model '.$ModelDesc->Name.'<br/>'); 264 264 $this->RemoveModelDatabase($ModelDesc); 265 265 } -
trunk/Packages/Common/Modules/Setup.php
r899 r900 59 59 $Output = $this->UpdateManager->Upgrade(); 60 60 return $Output; 61 }62 63 function InsertSampleData(): void64 {65 61 } 66 62 } … … 81 77 $this->FullTitle = T('Application setup'); 82 78 $this->ShortTitle = T('Application setup'); 83 //$this->ParentClass = 'Page Portal';79 //$this->ParentClass = 'PageSetupRedirect'; 84 80 $this->ConfigDir = dirname(dirname(dirname(__FILE__))).'/Config'; 85 81 $this->YesNo = array(false => T('No'), true => T('Yes')); … … 212 208 { 213 209 $Output .= '<h3>Vložení vzorových dat</h3>'; 214 ModuleSetup::Cast($this->System->GetModule('Setup'))->InsertSampleData();210 $this->System->ModuleManager->Perform(array(ModuleAction::InsertSampleData), array(ModuleCondition::Installed)); 215 211 $Output .= $this->ControlPanel(); 216 212 }
Note:
See TracChangeset
for help on using the changeset viewer.