Changeset 887 for trunk/Modules/Portal/Portal.php
- Timestamp:
- Nov 20, 2020, 12:08:12 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Portal/Portal.php
r874 r887 5 5 class ModulePortal extends AppModule 6 6 { 7 function __construct( $System)7 function __construct(System $System) 8 8 { 9 9 parent::__construct($System); … … 16 16 } 17 17 18 function DoInstall() 19 { 20 } 21 22 function DoUninstall() 23 { 24 } 25 26 function DoStart() 27 { 28 $this->System->RegisterPage( '', 'PagePortal');18 function DoInstall(): void 19 { 20 } 21 22 function DoUninstall(): void 23 { 24 } 25 26 function DoStart(): void 27 { 28 $this->System->RegisterPage([''], 'PagePortal'); 29 29 $this->System->FormManager->RegisterClass('MemberOptions', array( 30 30 'Title' => 'Nastavení zákazníka', … … 42 42 ), 43 43 )); 44 $this->System->ModuleManager->Modules['User']->UserPanel[] = array('PagePortal', 'UserPanel');45 } 46 47 function DoStop() 44 ModuleUser::Cast($this->System->GetModule('User'))->UserPanel[] = array('PagePortal', 'UserPanel'); 45 } 46 47 function DoStop(): void 48 48 { 49 49 } … … 52 52 class PagePortal extends Page 53 53 { 54 var $FullTitle = 'Zděchovský rozcestník'; 55 var $ShortTitle = 'Rozcestník'; 56 57 function ShowActions($ActionGroup) 54 function __construct(System $System) 55 { 56 parent::__construct($System); 57 $this->FullTitle = 'Zděchovský rozcestník'; 58 $this->ShortTitle = 'Rozcestník'; 59 } 60 61 function ShowActions(array $ActionGroup): string 58 62 { 59 63 $Output = ''; … … 67 71 } 68 72 69 function InfoBar() 73 function InfoBar(): string 70 74 { 71 75 $Output2 = ''; … … 98 102 //$Output .= 'Server běží: '.$this->GetServerUptime().' '; 99 103 100 if ( $this->System->User->CheckPermission('Finance', 'DisplaySubjectState'))101 { 102 $DbResult = $this->Database->select('MemberPayment', 'Cash', 'Member=(SELECT Customer FROM UserCustomerRel WHERE Id='. $this->System->User->User['Id'].')');104 if (ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission('Finance', 'DisplaySubjectState')) 105 { 106 $DbResult = $this->Database->select('MemberPayment', 'Cash', 'Member=(SELECT Customer FROM UserCustomerRel WHERE Id='.ModuleUser::Cast($this->System->GetModule('User'))->User->User['Id'].')'); 103 107 if ($DbResult->num_rows > 0) 104 108 { … … 112 116 } 113 117 114 function UserPanel() 115 { 118 function UserPanel(): string 119 { 120 $User = &ModuleUser::Cast($this->System->GetModule('User'))->User; 116 121 $Output = '<a href="'.$this->System->Link('/user/?Action=UserOptions').'">Profil</a><br />'; 117 if ($ this->System->User->CheckPermission('Finance', 'MemberOptions'))122 if ($User->CheckPermission('Finance', 'MemberOptions')) 118 123 $Output .= '<a href="'.$this->System->Link('/?Action=MemberOptions').'">Fakturační adresa</a><br />'; 119 if ($ this->System->User->CheckPermission('Finance', 'DisplaySubjectState'))124 if ($User->CheckPermission('Finance', 'DisplaySubjectState')) 120 125 $Output .= '<a href="'.$this->System->Link('/finance/platby/').'">Finance</a><br />'; 121 if ($ this->System->User->CheckPermission('Network', 'RegistredHostList'))126 if ($User->CheckPermission('Network', 'RegistredHostList')) 122 127 $Output .= '<a href="'.$this->System->Link('/network/user-hosts/').'">Počítače</a><br />'; 123 if ($ this->System->User->CheckPermission('News', 'Insert'))128 if ($User->CheckPermission('News', 'Insert')) 124 129 $Output .= '<a href="'.$this->System->Link('/aktuality/?action=add').'">Vložení aktuality</a><br />'; 125 if ($ this->System->User->CheckPermission('EatingPlace', 'Edit'))130 if ($User->CheckPermission('EatingPlace', 'Edit')) 126 131 $Output .= '<a href="'.$this->System->Link('/jidelna/menuedit.php').'">Úprava jídelníčků</a><br />'; 127 if ($ this->System->User->CheckPermission('Finance', 'Manage'))132 if ($User->CheckPermission('Finance', 'Manage')) 128 133 $Output .= '<a href="'.$this->System->Link('/finance/sprava/').'">Správa financí</a><br />'; 129 if ($ this->System->User->CheckPermission('IS', 'Manage'))134 if ($User->CheckPermission('IS', 'Manage')) 130 135 $Output .= '<a href="'.$this->System->Link('/is/').'">Správa dat</a><br />'; 131 136 return $Output; 132 137 } 133 138 134 function WebcamPanel() 135 { 136 $Output = $this->System->ModuleManager->Modules['WebCam']->ShowImage();137 return $Output; 138 } 139 140 function MeteoPanel() 139 function WebcamPanel(): string 140 { 141 $Output = ModuleWebCam::Cast($this->System->GetModule('WebCam'))->ShowImage(); 142 return $Output; 143 } 144 145 function MeteoPanel(): string 141 146 { 142 147 $Output = '<a href="https://stat.zdechov.net/meteo/?Measure=28" title="Klikněte pro detailní informace a předpověď"><img src="https://www.zdechov.net/meteo/koliba.png" border="0" alt="Počasí - Meteostanice Zděchov" width="150" height="150" /></a>'; … … 144 149 } 145 150 146 function OnlineHostList() 151 function OnlineHostList(): string 147 152 { 148 153 $Output = '<span style="font-size: smaller;">'; … … 158 163 } 159 164 160 function ShowBadPayerList() 161 { 162 $Output .= '<div class="PanelTitle">Dlužníci:</div><span style="font-size: smaller;">';163 $DbResult = $ Database->select('Subject', 'Name', 'Money < 0 ORDER BY Money');165 function ShowBadPayerList(): string 166 { 167 $Output = '<div class="PanelTitle">Dlužníci:</div><span style="font-size: smaller;">'; 168 $DbResult = $this->Database->select('Subject', 'Name', 'Money < 0 ORDER BY Money'); 164 169 while ($Row = $DbResult->fetch_array()) 165 170 { … … 170 175 } 171 176 172 function Panel( $Title, $Content, $Menu = array())177 function Panel(string $Title, string $Content, array $Menu = array()): string 173 178 { 174 179 if (count($Menu) > 0) 180 { 175 181 foreach ($Menu as $Item) 182 { 176 183 $Title .= '<div class="Action">'.$Item.'</div>'; 184 } 185 } 177 186 return '<div class="Panel"><div class="Title">'.$Title.'</div><div class="Content">'.$Content.'</div></div>'; 178 187 } 179 188 180 function Show() 189 function Show(): string 181 190 { 182 191 $Output = ''; … … 186 195 if ($Action == 'CustomizeNewsSave') 187 196 { 188 $Output .= $this->System->ModuleManager->Modules['News']->CustomizeSave();197 $Output .= ModuleNews::Cast($this->System->GetModule('News'))->CustomizeSave(); 189 198 } else 190 199 if ($Action == 'MemberOptions') 191 200 { 192 201 $DbResult = $this->Database->query('SELECT `Customer` FROM `UserCustomerRel` '. 193 'WHERE `User`='. $this->System->User->User['Id']);202 'WHERE `User`='.ModuleUser::Cast($this->System->GetModule('User'))->User->User['Id']); 194 203 while ($CustomerUserRel = $DbResult->fetch_assoc()) 195 204 { … … 218 227 $Form->Values['FamilyMemberCount'] = 0; 219 228 220 $DbResult = $this->Database->update('Member', 'Id='.$this->System->User->User['Member'], 229 $User = &ModuleUser::Cast($this->System->GetModule('User'))->User; 230 $DbResult = $this->Database->update('Member', 'Id='.$User->User['Member'], 221 231 array('FamilyMemberCount' => $Form->Values['FamilyMemberCount'])); 222 $DbResult = $this->Database->query('SELECT Subject FROM Member WHERE Id='.$ this->System->User->User['Member']);232 $DbResult = $this->Database->query('SELECT Subject FROM Member WHERE Id='.$User->User['Member']); 223 233 $Member = $DbResult->fetch_assoc(); 224 234 $DbResult = $this->Database->update('Subject', 'Id='.$Member['Subject'], … … 228 238 'DIC' => $Form->Values['DIC'])); 229 239 $Output .= $this->SystemMessage('Nastavení', 'Nastavení zákazníka uloženo.'); 230 $this->System->ModuleManager->Modules['Log']->NewRecord('Member+Subject', 'Nastavení zákazníka/subjektu změněno',240 ModuleLog::Cast($this->System->GetModule('Log'))->NewRecord('Member+Subject', 'Nastavení zákazníka/subjektu změněno', 231 241 $Form->Values['Name']); 232 242 $DbResult = $this->Database->query('SELECT Member.Id, Member.FamilyMemberCount, '. 233 243 'Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, '. 234 244 'Subject.AddressCountry, Subject.IC, Subject.DIC FROM Member JOIN Subject '. 235 'ON Subject.Id = Member.Subject WHERE Member.Id='.$ this->System->User->User['Member']);245 'ON Subject.Id = Member.Subject WHERE Member.Id='.$User->User['Member']); 236 246 $DbRow = $DbResult->fetch_array(); 237 247 foreach ($Form->Definition['Items'] as $Index => $Item) … … 246 256 } 247 257 248 function ShowMain() 258 function ShowMain(): string 249 259 { 250 260 $Output = ''; … … 270 280 else if ($Panel['Module'] == 'UserOptions') 271 281 { 272 //if ( $this->System->User->User['Id'] != null) $Output .= $this->Panel('Přihlášený uživatel', $this->UserPanel());282 //if (ModuleUser::Cast($this->System->GetModule('User'))->User->User['Id'] != null) $Output .= $this->Panel('Přihlášený uživatel', $this->UserPanel()); 273 283 } else 274 284 if ($Panel['Module'] == 'Webcam') $Output .= $this->Panel('Kamery', $this->WebcamPanel()); 275 285 if ($Panel['Module'] == 'Meteo') $Output .= $this->Panel('Meteostanice', $this->MeteoPanel()); 276 286 else if ($Panel['Module'] == 'NewsGroupList') 277 $Output .= $this->Panel('Aktuality', $this->System->ModuleManager->Modules['News']->Show(), array('<a href="?Action=CustomizeNews">Upravit</a>'));287 $Output .= $this->Panel('Aktuality', ModuleNews::Cast($this->System->GetModule('News'))->Show(), array('<a href="?Action=CustomizeNews">Upravit</a>')); 278 288 } 279 289 $Output .= '</td>';
Note:
See TracChangeset
for help on using the changeset viewer.