Changeset 896
- Timestamp:
- Jan 14, 2021, 7:38:26 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Core.php
r895 r896 85 85 { 86 86 return $this->RootURLFolder.$Target; 87 }88 89 function ShowAction(string $Id): string90 {91 $Output = '';92 $DbResult = $this->Database->query('SELECT *, `ActionIcon`.`Name` AS `Icon` FROM `Action` '.93 'LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '.94 'WHERE (`Action`.`Id`='.$Id.')');95 if ($DbResult->num_rows > 0)96 {97 $Action = $DbResult->fetch_assoc();98 if ($Action['Icon'] == '') $Action['Icon'] = 'clear.png';99 if (substr($Action['URL'], 0, 4) != 'http') $Action['URL'] = $this->Link($Action['URL']);100 if (!defined('NEW_PERMISSION') or ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission('System', 'Read', 'Item', $Id))101 $Output .= '<img alt="'.$Action['Title'].'" src="'.$this->Link('/images/favicons/'.$Action['Icon']).102 '" width="16" height="16" /> <a href="'.$Action['URL'].'">'.$Action['Title'].'</a>';103 }104 return $Output;105 87 } 106 88 … … 233 215 unset($this->PageHeaders[$Name]); 234 216 } 217 218 static function Cast(System $System): Core 219 { 220 if ($System instanceof Core) 221 { 222 return $System; 223 } 224 throw new Exception('Expected ModuleSetup type but '.gettype($System)); 225 } 235 226 } 236 227 -
trunk/Application/View.php
r887 r896 119 119 $Output .= '<div id="Footer">'. 120 120 '<i>| Správa webu: '.$this->System->Config['Web']['Admin'].' | e-mail: '.$this->System->Config['Web']['AdminEmail'].' | '. 121 ' Verze: '.$Revision.' ('. $this->System->HumanDate($ReleaseTime).') |';121 ' Verze: '.$Revision.' ('.Core::Cast($this->System)->HumanDate($ReleaseTime).') |'; 122 122 if ($this->ShowRuntimeInfo == true) $Output .= ' Doba generování: '.$Time.' s / '.ini_get('max_execution_time'). 123 123 ' s | Použitá paměť: '.HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B |'; -
trunk/Modules/Customer/Customer.php
r894 r896 195 195 )); 196 196 197 ModuleIS::Cast( $this->System->GetModule('IS'))->RegisterDashboardItem('Customer',197 ModuleIS::Cast(Core::Cast($this->System)->GetModule('IS'))->RegisterDashboardItem('Customer', 198 198 array($this, 'ShowDashboardItem')); 199 199 } -
trunk/Modules/Portal/Portal.php
r895 r896 43 43 function DoStart(): void 44 44 { 45 $this->System->RegisterPage([''], 'PagePortal');45 Core::Cast($this->System)->RegisterPage([''], 'PagePortal'); 46 46 $this->System->FormManager->RegisterClass('MemberOptions', array( 47 47 'Title' => 'Nastavení zákazníka', … … 59 59 ), 60 60 )); 61 ModuleUser::Cast( $this->System->GetModule('User'))->UserPanel[] = array('PagePortal', 'UserPanel');61 ModuleUser::Cast(Core::Cast($this->System)->GetModule('User'))->UserPanel[] = array('PagePortal', 'UserPanel'); 62 62 } 63 63 } … … 102 102 while ($Action = $DbResult->fetch_assoc()) 103 103 { 104 $Output .= $this->System->ShowAction($Action['Id']).'<br/>';104 $Output .= ModuleSystem::Cast($this->System->GetModule('System'))->ShowAction($Action['Id']).'<br/>'; 105 105 } 106 106 return $this->Panel($ActionGroup['Name'], $Output); -
trunk/Modules/System/System.php
r895 r896 202 202 $this->Manager->OnUninstallModel = array($this, 'UninstallModel'); 203 203 204 $this->System->RegisterPage(['module'], 'PageModules');204 Core::Cast($this->System)->RegisterPage(['module'], 'PageModules'); 205 205 $this->System->FormManager->RegisterClass('Action', array( 206 206 'Title' => 'Akce', … … 624 624 throw new Exception('Expected ModuleSystem type but got '.gettype($AppModule)); 625 625 } 626 627 function ShowAction(string $Id): string 628 { 629 $Output = ''; 630 $DbResult = $this->Database->query('SELECT *, `ActionIcon`.`Name` AS `Icon` FROM `Action` '. 631 'LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '. 632 'WHERE (`Action`.`Id`='.$Id.')'); 633 if ($DbResult->num_rows > 0) 634 { 635 $Action = $DbResult->fetch_assoc(); 636 if ($Action['Icon'] == '') $Action['Icon'] = 'clear.png'; 637 if (substr($Action['URL'], 0, 4) != 'http') $Action['URL'] = Core::Cast($this->System)->Link($Action['URL']); 638 if (!defined('NEW_PERMISSION') or ModuleUser::Cast(Core::Cast($this->System)->GetModule('User'))->User->CheckPermission('System', 'Read', 'Item', $Id)) 639 $Output .= '<img alt="'.$Action['Title'].'" src="'.Core::Cast($this->System)->Link('/images/favicons/'.$Action['Icon']). 640 '" width="16" height="16" /> <a href="'.$Action['URL'].'">'.$Action['Title'].'</a>'; 641 } 642 return $Output; 643 } 626 644 } -
trunk/Modules/User/User.php
r895 r896 41 41 { 42 42 if (isset($_SERVER['REMOTE_ADDR'])) $this->User->Check(); 43 $this->System->RegisterPage(['userlist'], 'PageUserList');44 $this->System->RegisterPage(['user'], 'PageUser');45 $this->System->RegisterPageBarItem('Top', 'User', array($this, 'TopBarCallback'));43 Core::Cast($this->System)->RegisterPage(['userlist'], 'PageUserList'); 44 Core::Cast($this->System)->RegisterPage(['user'], 'PageUser'); 45 Core::Cast($this->System)->RegisterPageBarItem('Top', 'User', array($this, 'TopBarCallback')); 46 46 $this->System->FormManager->RegisterClass('UserLogin', array( 47 47 'Title' => 'Přihlášení uživatele', … … 180 180 'Filter' => '1', 181 181 )); 182 ModuleIS::Cast( $this->System->GetModule('IS'))->RegisterDashboardItem('User',182 ModuleIS::Cast(Core::Cast($this->System)->GetModule('IS'))->RegisterDashboardItem('User', 183 183 array($this, 'ShowDashboardItem')); 184 184 } … … 196 196 if ($this->User->User['Id'] == null) 197 197 { 198 $Output = '<a href="'. $this->System->Link('/user/?Action=LoginForm').'">Přihlášení</a> '.199 '<a href="'. $this->System->Link('/user/?Action=UserRegister').'">Registrace</a>';198 $Output = '<a href="'.Core::Cast($this->System)->Link('/user/?Action=LoginForm').'">Přihlášení</a> '. 199 '<a href="'.Core::Cast($this->System)->Link('/user/?Action=UserRegister').'">Registrace</a>'; 200 200 } else 201 201 { 202 202 $Output = $this->User->User['Name']. 203 ' <a href="'. $this->System->Link('/user/?Action=UserMenu').'">Nabídka</a>'.204 ' <a href="'. $this->System->Link('/user/?Action=Logout').'">Odhlásit</a>';203 ' <a href="'.Core::Cast($this->System)->Link('/user/?Action=UserMenu').'">Nabídka</a>'. 204 ' <a href="'.Core::Cast($this->System)->Link('/user/?Action=Logout').'">Odhlásit</a>'; 205 205 // <a href="'.$this->System->Link('/?Action=UserOptions').'">Nastavení</a>'; 206 206 } -
trunk/Packages/Common/AppModule.php
r895 r896 53 53 public array $Dependencies; 54 54 public Database $Database; 55 public Application$System;55 public System $System; 56 56 public AppModuleManager $Manager; 57 57 public $OnChange; -
trunk/Packages/Common/Setup.php
r895 r896 425 425 function DoStart(): void 426 426 { 427 $this->System->RegisterPage([''], 'PageSetupRedirect');428 $this->System->RegisterPage(['setup'], 'PageSetup');429 $this->System->RegisterPage(['setup', 'modules'], 'PageSetupModules');427 Core::Cast($this->System)->RegisterPage([''], 'PageSetupRedirect'); 428 Core::Cast($this->System)->RegisterPage(['setup'], 'PageSetup'); 429 Core::Cast($this->System)->RegisterPage(['setup', 'modules'], 'PageSetupModules'); 430 430 } 431 431 … … 433 433 { 434 434 unset($this->UpdateManager); 435 $this->System->UnregisterPage(['']);436 $this->System->UnregisterPage(['setup']);437 $this->System->UnregisterPage(['setup', 'modules']);435 Core::Cast($this->System)->UnregisterPage(['']); 436 Core::Cast($this->System)->UnregisterPage(['setup']); 437 Core::Cast($this->System)->UnregisterPage(['setup', 'modules']); 438 438 } 439 439
Note:
See TracChangeset
for help on using the changeset viewer.