PluginProbe ʕ •ᴥ•ʔ
Daily Prayer Time / 2025.03.06
Daily Prayer Time v2025.03.06
2026.05.20 2026.05.11 2026.05.09 2026.05.05 2026.05.04 2026.05.03 2026.04.28 2026.04.28.1 trunk 2019.10.16 2019.11.19 2019.2.16 2019.3.1 2019.4.1 2019.4.5 2019.5.12 2019.5.13 2019.5.14 2019.5.19 2019.5.19.1 2019.5.21 2019.5.30 2019.5.5 2019.5.6 2019.5.7 2019.5.8 2019.5.9 2019.6.10 2019.6.2 2019.6.22 2019.7.10 2019.7.25 2019.8.1 2019.8.4 2019.9.16 2020.04.25 2020.04.26 2020.05.01 2020.05.04 2020.05.08 2020.05.17 2020.07.03 2021.01.10 2021.03.28 2021.07.20 2021.07.23 2021.07.24 2021.07.28 2021.08.01 2021.08.06 2021.08.07 2021.08.10 2021.09.12 2021.09.18 2021.09.23 2021.09.24 2021.10.01 2021.10.02 2021.10.10 2021.10.11 2021.10.15 2021.10.21 2021.10.27 2021.10.29 2022.03.24 2022.04.04 2022.04.14 2022.04.15 2022.04.21 2022.04.22 2022.05.04 2022.09.19 2022.11.14 2022.11.16 2022.12.18 2022.12.20 2023.01.27 2023.02.04 2023.02.09 2023.02.21 2023.03.08 2023.03.17 2023.03.18 2023.03.20 2023.05.04 2023.08.03 2023.08.08.16 2023.08.19 2023.08.19.1 2023.10.13 2023.10.21 2023.11.26 2023.12.28 2023.12.31 2024.03.28 2024.03.29 2024.03.30 2024.04.18 2024.04.20 2024.04.22 2024.04.26 2024.08.26 2024.09.12 2024.09.14 2024.09.17 2024.12.29 2024.12.30 2025.01.02 2025.01.17 2025.02.02 2025.03.04 2025.03.06 2025.03.08 2025.03.15 2025.03.20 2025.03.26 2025.03.27 2025.04.03 2025.06.16 2025.06.29 2025.07.15 2025.08.09 2025.10.26 2026.04.26
daily-prayer-time-for-mosques / Views / DailyTimetablePrinter.php
daily-prayer-time-for-mosques / Views Last commit date
Tabs 1 year ago DSTemplate.php 1 year ago DailyTimetablePrinter.php 1 year ago DptApiDoc.php 2 years ago HelpsAndTips.php 3 years ago MonthlyTimetablePrinter.php 1 year ago TimetablePrinter.php 1 year ago dptWidgetForm.php 4 years ago horizontal-div.php 1 year ago widget-admin.php 1 year ago
DailyTimetablePrinter.php
421 lines
1 <?php
2 require_once( 'TimetablePrinter.php' );
3 require_once(__DIR__ . '/../Models/DPTHelper.php');
4
5 class DailyTimetablePrinter extends TimetablePrinter
6 {
7 /** @var DPTHelper */
8 protected $dptHelper;
9
10 public function __construct()
11 {
12 parent::__construct();
13 $this->localPrayerNames = $this->getLocalPrayerNames(false, true);
14 $this->dptHelper = new DPTHelper();
15 }
16
17 public function horizontalTimeDiv($row)
18 {
19 ob_start();
20 include 'horizontal-div.php';
21 return ob_get_clean();
22 }
23
24 /**
25 * @param $row
26 * @return string
27 */
28 public function printHorizontalTime($row)
29 {
30 $table = $this->printHorizontalTableTop( $row );
31
32 $table .= '
33 <tr>
34 <th class="tableHeading prayerName">' . $this->localHeaders['prayer'] . '</th>'
35 . $this->printTableHeading($row) .
36 '</tr>
37 <tr>
38 <th class="tableHeading">' .$this->localHeaders['begins']. '</th>'
39 .$this->printAzanTime($row).
40 '</tr>
41 <tr><th class="tableHeading">' .$this->localHeaders['iqamah']. '</th>'
42 .$this->printJamahTime($row, false).
43 '</tr>';
44
45 if ( get_option('jumuah1') && ! $this->todayIsFriday() ) {
46 $table .= '<tr>
47 <th class="tableHeading">' . stripslashes($this->getLocalHeaders()['jumuah']) . '</th>
48 <td colspan="6" class="jamah">' . $this->getJumuahTimesArray() . '</td>
49 </tr>';
50 }
51
52 $table .= '</table>';
53
54 return $table;
55 }
56
57 public function horizontalTimeJamahOnly($row)
58 {
59 $table = $this->printHorizontalTableTop( $row );
60
61 $table .= '
62 <tr><th>' .$this->localHeaders['prayer']. '</th>'
63 . $this->printTableHeading($row) .
64 '</tr>
65 <tr>
66 <th>'.$this->localHeaders['iqamah'].'</th>'
67 .$this->printJamahTime($row).
68 '</tr>
69 </table>';
70
71 return $table;
72 }
73
74 /**
75 * @param $row
76 *
77 * @return string
78 */
79 public function horizontalTimeAzanOnly($row)
80 {
81 $table = $this->printHorizontalTableTop( $row, true );
82
83 $table .= '
84 <tr><th>' .$this->localHeaders['prayer']. '</th>'
85 . $this->printTableHeading($row) .
86 '</tr>
87 <tr>
88 <th>'.$this->localHeaders['begins'].'</th>'
89 .$this->printAzanTime($row).
90 '</tr>
91 </table>';
92
93 return $table;
94 }
95
96 /**
97 * @param $row
98 * @return string
99 */
100 public function printVerticalTime($row)
101 {
102 $table = $this->printVerticalTableTop( $row , true);
103
104 $table .=
105 '<tr>
106 <th class="tableHeading">' .$this->localHeaders['prayer']. '</th>
107 <th class="tableHeading">' .$this->localHeaders['begins']. '</th>
108 <th class="tableHeading">' .$this->localHeaders['iqamah']. '</th>
109 </tr>'
110 . $this->printVerticalRow( $row, 'both' ) .
111 '</table>';
112
113 return $table;
114 }
115
116 /**
117 * @param array $row
118 * @return string
119 */
120 public function verticalTimeJamahOnly($row)
121 {
122 $table = $this->printVerticalTableTop( $row );
123
124 $table .=
125 '<tr>
126 <th class="tableHeading">' .$this->localHeaders['prayer']. '</th>
127 <th class="tableHeading">' .$this->localHeaders['iqamah']. '</th>
128 </tr>'
129 .$this->printVerticalRow( $row, 'iqamah' ) .
130 '</table>';
131
132 return $table;
133 }
134
135 /**
136 * @param array $row
137 * @return string
138 */
139 public function verticalTimeAzanOnly($row)
140 {
141 $table = $this->printVerticalTableTop( $row, false, true );
142
143 $table .=
144 '<tr>
145 <th class="tableHeading">' .$this->localHeaders['prayer']. '</th>
146 <th class="tableHeading">' .$this->localHeaders['begins']. '</th>
147 </tr>'
148 .$this->printVerticalRow( $row, 'azan' ) .
149 '</table>';
150
151 return $table;
152 }
153
154 /**
155 * @param $row
156 *
157 * @param bool $isAzanOnly
158 *
159 * @return string
160 */
161 private function printHorizontalTableTop($row, $isAzanOnly=false)
162 {
163 $announcement = '';
164 if (! $row['hideTimeRemaining']) {
165 $nextIqamah = $isAzanOnly == true ? '' : $this->getNextIqamahTime($row);
166 }
167 $colspan = 7;
168 $ramadanTds = '<td></td>';
169
170 $ramadan = '';
171 if ($this->isRamadan() && ! $row['hideRamadan']) {
172 $ramadan = '
173 <tr class="">
174 <td colspan="3" class="highlight">'. $this->localHeaders['fast_begins'].': '.$this->formatDateForPrayer($row['fajr_begins'], true).'</td>
175 '. $ramadanTds . '
176 <td colspan="3" class="highlight">'. $this->localHeaders['fast_ends'].': '.$this->formatDateForPrayer($row['maghrib_begins']).'</td>
177 </tr>';
178 }
179
180 if(isset($row['announcement']) && ! empty( $row['announcement'] )) {
181 $announcement = "<tr><th colspan='".$colspan."' style='text-align:center' class='notificationBackground notificationFont'>".$row['announcement']. "</th></tr>";
182 }
183
184 $table = "";
185 $table .=
186 '<table class="customStyles dptUserStyles dptTimetable ' .$this->getTableClass().'"> '.$announcement.'
187 <tr>
188 <th colspan="'. $colspan .'" style="text-align:center">'
189 .$row['widgetTitle']. ' ' . date_i18n( get_option( 'date_format' ) ) .' '. $this->getHijriDate(date("d"), date("m"), date("Y"),$row) .' ' . $nextIqamah .'
190 </th>
191 </tr>'. $ramadan;
192
193 return $table;
194 }
195
196 public function displayRamadanTime($row)
197 {
198 return ' <table class="customStyles dptUserStyles">
199 <tr style="text-align:center">
200 <td colspan="3" class="fasting highlight">'. $this->localHeaders['fast_begins'].': '.$this->formatDateForPrayer($row['fajr_begins'], true).'</td>
201 <td style="border:0px;"></td>
202 <td colspan="3" class="fasting highlight">'. $this->localHeaders['fast_ends'].': '.$this->formatDateForPrayer($row['maghrib_begins']).'</td>
203 </tr></table>';
204 }
205
206 /**
207 * @param $row
208 *
209 * @return string
210 */
211 private function printTableHeading($row)
212 {
213 $ths = '';
214 $nextPrayer = $this->getNextPrayer( $row );
215
216 $localPrayerNames = $this->localPrayerNames;
217
218 if (get_option('zawal')) {
219 $localPrayerNames = $this->toggleSunriseZawal($row, $localPrayerNames);
220 }
221 foreach ($localPrayerNames as $key=>$prayerName) {
222 $class = $nextPrayer == $key ? 'highlight' : '';
223 $ths .= "<th class='tableHeading prayerName" . $this->tableClass . " ". $class."'>".$prayerName."</th>";
224 }
225
226 return $ths;
227 }
228
229 private function toggleSunriseZawal($row, $prayerNames)
230 {
231 if ($this->dptHelper->isZawalTimeNext($row)) {
232 $prayerNames['sunrise'] = $prayerNames['zawal'];
233 unset($prayerNames['zawal']);
234 }
235
236 unset($prayerNames['zawal']);
237
238 return $prayerNames;
239 }
240
241 /**
242 * @param $row
243 *
244 * @return string
245 */
246 private function printAzanTime($row)
247 {
248 $tds = '';
249 $nextPrayer = $this->getNextPrayer( $row );
250 $azanTimings = $this->getAzanTime( $row );
251
252
253 if (get_option('zawal')) {
254 if ($this->dptHelper->isZawalTimeNext($row)) {
255 $azanTimings['sunrise'] = $this->dptHelper->getZawalTime($azanTimings['zuhr']);
256 }
257 }
258
259 foreach ($azanTimings as $key => $azan) {
260
261 $class = $nextPrayer == $key ? 'class=highlight' : '';
262 $rowspan = '';
263 if ($key == 'sunrise')
264 {
265 $rowspan = "rowspan='2'";
266 }
267 $tds .= "<td ". $rowspan ." ".$class.">".$this->getFormattedDateForPrayer( $azan, $key)."</th>";
268 }
269
270 return $tds;
271 }
272
273 /**
274 * @param $row
275 * @param bool $isSunrise
276 *
277 * @return string
278 */
279 private function printJamahTime($row, $isSunrise=true)
280 {
281 $jamahTimes = $this->getJamahTime( $row );
282 if (get_option('zawal')) {
283 if ($this->dptHelper->isZawalTimeNext($row)) {
284 $jamahTimes['sunrise'] = $this->dptHelper->getZawalTime($row['zuhr_begins']);
285 }
286 }
287 if (! $isSunrise) {
288 unset( $jamahTimes['sunrise'] );
289 }
290
291 $tds = '';
292 $nextPrayer = $this->getNextPrayer( $row );
293 foreach ($jamahTimes as $key => $azan) {
294 $class = $nextPrayer == $key ? 'class=highlight' : 'class=jamah';
295 $tds .= "<td ".$class.">".$this->getFormattedDateForPrayer( $azan, $key, true )."</th>";
296 }
297
298 return $tds;
299 }
300
301 /**
302 * @param $row
303 * @param bool $isFullTable
304 *
305 * @return string
306 */
307 private function printVerticalTableTop($row, $isFullTable=false, $isAzanOnly=false)
308 {
309 if (! $row['hideTimeRemaining']) {
310 $nextIqamah = $isAzanOnly == true ? '' : $this->getNextIqamahTime($row);
311 }
312
313 $colspan = ( $isFullTable == true ) ? 3 : 2;
314
315 $colspanRamadan = $isFullTable == true ? "colspan='2'" : '';
316
317
318 $ramadan = '';
319 if ($this->isRamadan() && ! $row['hideRamadan']) {
320 $ramadan = '
321 <tr>
322 <th class="highlight">' .$this->localHeaders['fast_begins']. '</th>
323 <th '.$colspanRamadan.' class="highlight">' .$this->formatDateForPrayer($row['fajr_begins'], true). '</th>
324 </tr>
325 <tr>
326 <th class="highlight">'.$this->localHeaders['fast_ends'].'</th>
327 <th '.$colspanRamadan.' class="highlight">'.$this->formatDateForPrayer($row['maghrib_begins']).'</th>
328 </tr>
329 ';
330 }
331 $table = "";
332 $announcement = '';
333 if(isset($row['announcement']) && ! empty( $row['announcement'] )) {
334 $announcement = "<tr><th colspan=".$colspan." style='text-align:center' class='notificationBackground notificationFont'>".$row['announcement']. "</th></tr>";
335 }
336
337 $table .=
338 '<table class="dptTimetable ' .$this->getTableClass().' customStyles dptUserStyles"> '.$announcement.'
339 <tr>
340 <th colspan='.$colspan.' style="text-align:center">'
341 .$row['widgetTitle']. ' '. date_i18n( get_option( 'date_format' ) ) .' '. $this->getHijriDate(date("d"), date("m"), date("Y"), $row).'' . $nextIqamah . '
342 </th>
343 </tr>'
344 .$ramadan;
345
346 return $table;
347 }
348
349 /**
350 * @param $row
351 * @param $display // i.e both, azan, iqamah
352 *
353 * @return string
354 */
355 private function printVerticalRow($row, $display)
356 {
357 $trs = '';
358 $nextPrayer = $this->getNextPrayer( $row );
359
360 $localPrayerNames = $this->localPrayerNames;
361 if (get_option('zawal')) {
362 if ($this->dptHelper->isZawalTimeNext($row)) {
363 $localPrayerNames = $this->toggleSunriseZawal($row, $localPrayerNames);
364 $row['sunrise'] = $this->dptHelper->getZawalTime($row['zuhr_begins']);
365 } else {
366 unset($localPrayerNames['zawal']);
367 }
368 } else {
369 unset($localPrayerNames['zawal']);
370 }
371
372 foreach ($localPrayerNames as $key=>$prayerName) {
373 $begins = $key != 'sunrise' ? lcfirst( $key ).'_begins' : 'sunrise';
374 $jamah = $key != 'sunrise' ? lcfirst( $key ).'_jamah' : 'sunrise';
375
376 $class = $nextPrayer == $key ? 'highlight' : '';
377 $highlightForJamah = $nextPrayer == $key ? 'highlight' : '';
378
379 $trs .= '<tr>
380 <th class="prayerName ' .$class.'">' . $prayerName . '</th>';
381 if ( ($key == 'sunrise') && $display == 'both') {
382 $trs .= '<td colspan="2" class="' . $class . '">'.$this->getFormattedDateForPrayer($row[$jamah], $key).'</td>';
383 } elseif ($display == 'azan') {
384 $trs .='<td class="begins '.$class.'">'.$this->getFormattedDateForPrayer($row[$begins], $key).'</td>
385 </tr>';
386 } elseif ($display == 'iqamah') {
387 $trs .='<td class="begins '.$class.'">'.$this->getFormattedDateForPrayer($row[$jamah], $key, true).'</td>
388 </tr>';
389 } else {
390 $trs .='<td class="begins '.$class.'">'.$this->getFormattedDateForPrayer($row[$begins], $key).'</td>
391 <td class="jamah '.$highlightForJamah.'">'.$this->getFormattedDateForPrayer($row[$jamah], $key, true).'</td>
392 </tr>';
393 }
394 }
395
396 if ( get_option('jumuah1') && $display != 'azan' ) {
397 $trs .= '<tr>
398 <th class="prayerName"><span>' . stripslashes($this->getLocalHeaders()['jumuah']) . '</span></th>
399 <td colspan="2" class="jamah">' . $this->getJumuahTimesArray() . '</td>
400 </tr>';
401 }
402
403 return $trs;
404 }
405
406 private function getFormattedDateForPrayer($time, $prayerName, $isJamatTime=false)
407 {
408 // $jumuahTime = get_option('jumuah1');
409 // if ( ($prayerName === 'zuhr' && $this->todayIsFriday()) && $isJamatTime && $jumuahTime) {
410 // return $this->getJumuahTimesArray();
411 // }
412 return $this->formatDateForPrayer($time);
413 }
414
415 public function displayNextPrayer($row)
416 {
417 return $this->getNextIqamahTime($row);
418
419 }
420 }
421