Changeset 738 for trunk/Modules/OpeningHours/OpeningHours.php
- Timestamp:
- Apr 14, 2015, 10:20:16 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/OpeningHours/OpeningHours.php
r586 r738 10 10 var $EventType = array('Žádný', 'Otevřeno', 'Zavřeno'); 11 11 var $ParentClass = 'PagePortal'; 12 12 13 13 function ToHumanTime($Time) 14 14 { 15 15 $Hours = floor($Time / 60); 16 16 $Minutes = $Time - $Hours * 60; 17 if($Minutes < 10) $Minutes = '0'.$Minutes; 17 if($Minutes < 10) $Minutes = '0'.$Minutes; 18 18 $Hours = $Hours % 24; 19 19 return($Hours.':'.$Minutes); 20 } 20 } 21 21 22 22 function ToHumanTime2($Time) … … 33 33 return($Output); 34 34 } 35 35 36 36 function EditSubject($Id) 37 37 { … … 72 72 return($Output); 73 73 } 74 74 75 75 function SaveSubject($Id) 76 76 { 77 77 global $Config; 78 78 79 79 $Output = ''; 80 80 if($this->System->User->CheckPermission('OpeningHours', 'Edit')) … … 97 97 $Day['Close2'] = $_POST['day'.$Index.'_close2_m'] + $_POST['day'.$Index.'_close2_h'] * 60; 98 98 $this->Database->insert('SubjectOpenTimeDay', $Day); 99 } 100 $Output .= 'Uloženo'; 101 99 } 100 $Output .= 'Uloženo'; 101 102 102 $File = new File($this->Database); 103 103 … … 112 112 } else $Output = 'Nemáte oprávnění'; 113 113 return($Output); 114 } 115 114 } 115 116 116 function ShowAll() 117 117 { … … 121 121 { 122 122 $Output .= '<strong>'.$Subject['Name'].':</strong><br />'; 123 123 124 124 // Load time event list 125 125 $Events = array(); … … 139 139 } 140 140 //print_r($Events); 141 141 142 142 // Calculate time to next event 143 143 if(count($Events) > 0) 144 144 { 145 145 $CurrentTime = ((date('w') + 6) % 7) * 24 * 60 + date('G') * 60 + date('i'); 146 146 147 147 $I = 0; 148 while(($I < count($Events)) and ($Events[$I]['Time'] < $CurrentTime)) 148 while(($I < count($Events)) and ($Events[$I]['Time'] < $CurrentTime)) 149 149 $I++; 150 150 if($I < count($Events)) … … 152 152 $NextTime = $Events[$I]['Time']; 153 153 $NextEventType = $Events[$I]['Type']; 154 } else 154 } else 155 155 { 156 156 $NextTime = $Events[0]['Time'] + 7 * 24 * 60; 157 157 $NextEventType = $Events[0]['Type']; 158 158 } 159 159 160 160 $TimeDelta = $NextTime - $CurrentTime; 161 161 //$Output .= $CurrentTime.' '.$NextTime; … … 163 163 else $Output .= 'Otevírá za '.$this->ToHumanTime2($TimeDelta); 164 164 } 165 166 // Show time inteval table 165 166 // Show time inteval table 167 167 $Output .= '<table class="WideTable"><tr><th>Den</th><th>Čas</th></tr>'; 168 168 foreach($this->DaysOfWeek as $DayIndex => $DayOfWeek) … … 187 187 $Output .= '</table>Aktualizováno: '.$Subject['UpdateTime'].'<br />'; 188 188 if($Subject['Notice'] != '') $Output .= 'Poznámka: '.$Subject['Notice'].'<br />'; 189 189 190 190 if($Subject['Photo'] != 0) $Output .= '<a href="file?id='.$Subject['Photo'].'">Fotka</a> '; 191 191 192 192 if($this->System->User->CheckPermission('SubjectOpenTime', 'Edit')) 193 193 $Output .= '<a href="edit?Subject='.$Subject['Id'].'">Editovat</a><br />'; … … 197 197 return($Output); 198 198 } 199 199 200 200 function Show() 201 201 { 202 202 if(count($this->System->PathItems) > 1) 203 { 203 { 204 204 if($this->System->PathItems[1] == 'edit') $Output = $this->EditSubject($_GET['Subject']); 205 else if($this->System->PathItems[1] == 'save') 205 else if($this->System->PathItems[1] == 'save') 206 206 { 207 207 $Output = $this->SaveSubject($_GET['Subject']); 208 208 $Output .= $this->ShowAll(); 209 } else $Output = PAGE_NOT_FOUND; 210 } else $Output = $this->ShowAll(); 209 } else $Output = PAGE_NOT_FOUND; 210 } else $Output = $this->ShowAll(); 211 211 return($Output); 212 212 } … … 225 225 $this->Dependencies = array(); 226 226 } 227 227 228 228 function DoStart() 229 229 { 230 230 $this->System->Pages['otviraci-doby'] = 'PageSubjectOpenTime'; 231 231 } 232 232 233 233 function DoInstall() 234 234 {
Note:
See TracChangeset
for help on using the changeset viewer.