Changeset 887 for trunk/Modules/OpeningHours/OpeningHours.php
- Timestamp:
- Nov 20, 2020, 12:08:12 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/OpeningHours/OpeningHours.php
r874 r887 5 5 class PageSubjectOpenTime extends Page 6 6 { 7 var $FullTitle = 'Otvírací doby místních subjektů'; 8 var $ShortTitle = 'Otvírací doby'; 9 var $DaysOfWeek = array('Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota', 'Neděle'); 10 var $EventType = array('Žádný', 'Otevřeno', 'Zavřeno'); 11 var $ParentClass = 'PagePortal'; 12 13 function ToHumanTime($Time) 7 public array $DaysOfWeek = array('Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota', 'Neděle'); 8 public array $EventType = array('Žádný', 'Otevřeno', 'Zavřeno'); 9 10 function __construct(System $System) 11 { 12 parent::__construct($System); 13 $this->FullTitle = 'Otvírací doby místních subjektů'; 14 $this->ShortTitle = 'Otvírací doby'; 15 $this->ParentClass = 'PagePortal'; 16 } 17 18 function ToHumanTime(float $Time): string 14 19 { 15 20 $Hours = floor($Time / 60); … … 20 25 } 21 26 22 function ToHumanTime2( $Time)27 function ToHumanTime2(float $Time): string 23 28 { 24 29 $Days = floor($Time / 24 / 60); … … 34 39 } 35 40 36 function EditSubject( $Id)37 { 38 if ( $this->System->User->CheckPermission('OpeningHours', 'Edit'))41 function EditSubject(int $Id): string 42 { 43 if (ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission('OpeningHours', 'Edit')) 39 44 { 40 45 $Output = '<div class="Centred">'; … … 73 78 } 74 79 75 function SaveSubject($Id) 76 { 77 global $Config; 78 80 function SaveSubject(int $Id): string 81 { 79 82 $Output = ''; 80 if ( $this->System->User->CheckPermission('OpeningHours', 'Edit'))83 if (ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission('OpeningHours', 'Edit')) 81 84 { 82 85 $this->Database->delete('SubjectOpenTimeDay', 'Subject='.$Id); … … 100 103 $Output .= 'Uloženo'; 101 104 102 $File = new File($this-> Database);105 $File = new File($this->System); 103 106 104 107 // Delete old file … … 114 117 } 115 118 116 function ShowAll() 119 function ShowAll(): string 117 120 { 118 121 $Output = '<div class="Centred">'; … … 138 141 } 139 142 } 140 //print_r($Events);141 143 142 144 // Calculate time to next event … … 190 192 if ($Subject['Photo'] != 0) $Output .= '<a href="file?id='.$Subject['Photo'].'">Fotka</a> '; 191 193 192 if ( $this->System->User->CheckPermission('SubjectOpenTime', 'Edit'))194 if (ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission('SubjectOpenTime', 'Edit')) 193 195 $Output .= '<a href="edit?Subject='.$Subject['Id'].'">Editovat</a><br />'; 194 196 $Output .= '<br />'; … … 198 200 } 199 201 200 function Show() 202 function Show(): string 201 203 { 202 204 if (count($this->System->PathItems) > 1) … … 215 217 class ModuleOpeningHours extends AppModule 216 218 { 217 function __construct( $System)219 function __construct(System $System) 218 220 { 219 221 parent::__construct($System); … … 226 228 } 227 229 228 function DoStart() 229 { 230 $this->System->Pages['otviraci-doby'] = 'PageSubjectOpenTime'; 231 } 232 233 function DoInstall() 234 { 235 } 236 237 function DoUnInstall() 230 function DoStart(): void 231 { 232 $this->System->RegisterPage(['otviraci-doby'], 'PageSubjectOpenTime'); 233 } 234 235 function DoStop(): void 236 { 237 $this->System->UnregisterPage(['otviraci-doby']); 238 } 239 240 function DoInstall(): void 241 { 242 } 243 244 function DoUnInstall(): void 238 245 { 239 246 }
Note:
See TracChangeset
for help on using the changeset viewer.