PluginProbe ʕ •ᴥ•ʔ
Daily Prayer Time / 2023.12.31
Daily Prayer Time v2023.12.31
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 / MonthlyTimetablePrinter.php
daily-prayer-time-for-mosques / Views Last commit date
Tabs 2 years ago DSTemplate.php 3 years ago DailyTimetablePrinter.php 3 years ago HelpsAndTips.php 3 years ago MonthlyTimetablePrinter.php 2 years ago TimetablePrinter.php 3 years ago dptWidgetForm.php 4 years ago horizontal-div.php 4 years ago widget-admin.php 3 years ago
MonthlyTimetablePrinter.php
341 lines
1 <?php
2 require_once( 'TimetablePrinter.php' );
3
4 class MonthlyTimetablePrinter extends TimetablePrinter
5 {
6 /**
7 * @param $rows
8 * @param $options
9 *
10 * @return string
11 */
12 public function displayTable($rows, $options)
13 {
14 $table = $this->printFullTableTop($options);
15
16 $table .= $this->printFullTableRow( $rows, $options, 'both' );
17
18 return $table;
19 }
20
21 /**
22 * @param $options
23 *
24 * @return string
25 */
26 private function printFullTableTop($options)
27 {
28 if ($options['isRamadan']) {
29 $monthName = 'Ramadan';
30 if ((int)get_option('imsaq') > 0 ) {
31 $fajrBegins = esc_attr($this->localHeaders['begins']);
32 $fajrColspan = 4;
33 } else {
34 $fajrBegins = esc_attr($this->localHeaders['fast_begins']);
35 $fajrColspan = 3;
36 }
37 $maghribBegins = esc_attr($this->localHeaders['fast_ends']);
38 } else {
39 $fajrBegins = esc_attr($this->localHeaders['begins']);
40 $maghribBegins = esc_attr($this->localHeaders['begins']);
41 $fajrColspan = 3;
42 $dt = DateTime::createFromFormat('!m', $options['monthNumber']);
43 $monthName = $dt->format('F');
44 }
45
46 $fastingClass = $this->getFastingClass( $options );
47 $prayers = $this->getLocalPrayerNames(true);
48
49 $table = "
50 <table class='dptTimetable customStyles dptUserStyles'>
51 <thead class='prayerName'>
52 <th class='prayerName' colspan='2'>" . $monthName . "</th>
53
54 <th class='prayerName' colspan='$fajrColspan'>" . esc_attr($prayers['fajr']) . "</th>
55 <th class='prayerName' colspan='2'>" . esc_attr($prayers['zuhr']) . "</th>";
56 $table .= "<th class='prayerName' colspan=".$this->getAsrMethodColspan().">" . esc_attr($prayers['asr']) . "</th>";
57 $table .= "
58 <th class='prayerName' colspan='2'>" . esc_attr($prayers['maghrib']) . "</th>
59 <th class='prayerName' colspan='2'>" . esc_attr($prayers['isha']) . "</th>
60 </thead>
61 <thead>
62 <th class='tableHeading'>" . esc_attr($this->localTimes['date']) . "</th>
63 <th class='tableHeading'>" . esc_attr($this->localTimes['day']) . "</th>
64 ";
65
66 if ($options['isRamadan'] && (int)get_option('imsaq') > 0) {
67 $table .="<th class='tableHeading ". $fastingClass ."'>" . esc_attr($this->localHeaders['fast_begins']) . "</th>";
68 }
69
70 $table.="
71 <th class='tableHeading ". $fastingClass ."'>" . $fajrBegins . "</th>
72 <th class='tableHeading'>" . esc_attr($this->localHeaders['iqamah']) . "</th>
73 <th class='tableHeading'>" . esc_attr($prayers['sunrise']) . "</th>
74
75 <th class='tableHeading'>" . esc_attr($this->localHeaders['begins']) . "</th>
76 <th class='tableHeading'>" . esc_attr($this->localHeaders['iqamah']) . "</th>";
77
78 $table .= $this->getAsrMethodTh();
79
80 $table .= "<th class='tableHeading'>" . esc_attr($this->localHeaders['iqamah']) . "</th>
81
82 <th class='tableHeading ". $fastingClass ."'>" . $maghribBegins . "</th>
83 <th class='tableHeading'>" . esc_attr($this->localHeaders['iqamah']) . "</th>
84
85 <th class='tableHeading'>" . esc_attr($this->localHeaders['begins']) . "</th>
86 <th class='tableHeading'>" . esc_attr($this->localHeaders['iqamah']) . "</th>
87 </thead>";
88
89 return $table;
90 }
91
92
93 /**
94 * @param array $rows
95 * @param $options
96 * @param string $display
97 *
98 * @return string
99 */
100 private function printFullTableRow(array $rows, $options, $display='both')
101 {
102 $table = '';
103 $asrMethod = get_option('asrSelect');
104 $classFasting = $this->getClassFasting( $options );
105
106 foreach($rows as $day) {
107 $day['asr_begins'] = ($asrMethod == 'hanafi') ? $day['asr_mithl_2'] : $day['asr_mithl_1'];
108
109 $today = explode('-', $day['d_date']);
110 $weekday = date_i18n("l", strtotime($day['d_date']), wp_timezone_string());
111
112 $table .= "
113 <tr " . $this->getClass($today[1], $today[2]) . ">
114 <td>" . date_i18n(get_option( 'date_format' ), strtotime($day['d_date'])). ' '. $this->getHijriDate($today[2], $today[1], $today[0], $day, true) ."</td>
115 <td class=" . $weekday . ">" . $weekday . "</td>
116 ";
117
118 if ($options['isRamadan'] && (int)get_option('imsaq') > 0) {
119 $table .="<td ". $classFasting .">" . $this->formatDateForPrayer($day['fajr_begins'], true). "</td>";
120 }
121
122 $table .= "
123 <td ". $classFasting .">" . $this->formatDateForPrayer($day['fajr_begins']). "</td>
124 <td class='highlight'>" . $this->formatDateForPrayer($day['fajr_jamah']). "</td>
125 <td>" . $this->formatDateForPrayer($day['sunrise']). "</td>
126
127 <td>" . $this->formatDateForPrayer($day['zuhr_begins']). "</td>
128 <td class='highlight'>" . $this->formatDateForPrayer($day['zuhr_jamah']). "</td>";
129
130 if ($asrMethod != 'both') {
131 $table .= "<td>" . $this->formatDateForPrayer($day['asr_begins']). "</td>";
132 } else {
133 $table .= "<td>" . $this->formatDateForPrayer($day['asr_mithl_1']). "</td>
134 <td>" . $this->formatDateForPrayer($day['asr_mithl_2']). "</td>";
135 }
136 $table .= "
137 <td class='highlight'>" . $this->formatDateForPrayer($day['asr_jamah']). "</td>
138
139 <td ". $classFasting .">" . $this->formatDateForPrayer($day['maghrib_begins']). "</td>
140 <td class='highlight'>" . $this->formatDateForPrayer($day['maghrib_jamah']). "</td>
141
142 <td>" . $this->formatDateForPrayer($day['isha_begins']). "</td>
143 <td class='highlight'>" . $this->formatDateForPrayer($day['isha_jamah']). "</td>
144 </tr>";
145 }
146
147 return $table;
148 }
149
150 /**
151 * @param $rows
152 * @param $options
153 *
154 * @return string
155 */
156 public function displayTableJamahOnly($rows, $options)
157 {
158 $table = $this->printTableTop( $options );
159
160 $table .= $this->printTableRow( $rows, $options );
161
162 return $table;
163 }
164
165 /**
166 * @param $rows
167 * @param $options
168 *
169 * @return string
170 */
171 public function displayTableAzanOnly($rows, $options)
172 {
173 $table = $this->printTableTop( $options, true );
174 $asrMethod = get_option('asrSelect');
175
176 foreach($rows as $day) {
177 $day['asr_begins'] = ($asrMethod == 'hanafi') ? $day['asr_mithl_2'] : $day['asr_mithl_1'];
178
179 $today = explode('-', $day['d_date']);
180 $weekday = date("D", strtotime($day['d_date']));
181
182 $table .= "
183 <tr " . $this->getClass($today[1], $today[2]) . ">
184 <td>" . date_i18n(get_option( 'date_format' ), strtotime($day['d_date'])). ' '. $this->getHijriDate($today[2], $today[1], $today[0], $day, true) ."</td>
185
186 <td class=" . $weekday . ">" . $weekday . "</td>"
187 . $this->getFastingTdWithData($options['isRamadan'], $day['fajr_begins'], true, true )."
188 <td>" . $this->formatDateForPrayer($day['sunrise']). "</td>
189 <td>" . $this->formatDateForPrayer($day['zuhr_begins']). "</td>
190 <td>" . $this->formatDateForPrayer($day['asr_begins']). "</td>"
191 . $this->getFastingTdWithData($options['isRamadan'], $day['maghrib_begins'], true )."
192 <td>" . $this->formatDateForPrayer($day['isha_begins']). "</td>
193 </tr>";
194 }
195
196 return $table;
197 }
198
199 /**
200 * @param $options
201 * @param bool $isAzanOnly
202 *
203 * @return string
204 */
205 private function printTableTop($options, $isAzanOnly=false)
206 {
207 $fajr = '';
208 $maghrib = '';
209 $sunrise = '';
210 $fajrJamah = '';
211 $maghribJamah = '';
212 $azanOnlyClass = '';
213
214 $prayers = $this->getLocalPrayerNames(true);
215 if ($isAzanOnly) {
216 $fajr = esc_attr($prayers['fajr']);
217 $maghrib = esc_attr($prayers['maghrib']);
218 $sunrise = "<th class='tableHeading'>" . esc_attr($prayers['sunrise']) . "</th>";
219 $azanOnlyClass = 'azanOnly';
220 } else {
221 $fajrJamah = "<th class='tableHeading'>" . esc_attr($prayers['fajr']) . "</th>";
222 $maghribJamah = "<th class='tableHeading'>" . esc_attr($prayers['maghrib']) . "</th>";
223 }
224
225 if ($options['isRamadan'] && !$isAzanOnly) {
226 $fajr = '';
227 $maghrib = '';
228 $fajrHeading = "<th class='tableHeading fasting ".$azanOnlyClass."'>" . esc_attr($this->localHeaders['fast_begins']) . $fajr . "</th>";
229 $maghribHeading = "<th class='tableHeading fasting ".$azanOnlyClass."'>" . esc_attr($this->localHeaders['fast_ends']) . $maghrib . "</th>";
230 } elseif ($options['isRamadan'] && $isAzanOnly) {
231 $fajrHeading = "<th class='tableHeading fasting ".$azanOnlyClass."'>" . esc_attr($this->localHeaders['fast_begins']) . "</th>";
232 $fajrHeading .= "<th class='tableHeading ".$azanOnlyClass."'>" . $fajr . "</th>";
233 $maghribHeading = "<th class='tableHeading fasting ".$azanOnlyClass."'>" . esc_attr($this->localHeaders['fast_ends']) . '/'. $maghrib . "</th>";
234 } elseif ($isAzanOnly) {
235 $fajrHeading = "<th class='tableHeading'>" . $fajr . "</th>";
236 $maghribHeading = "<th class='tableHeading'>" . $maghrib . "</th>";;
237 }
238
239 $table = "
240 <table class='dptTimetable customStyles'>
241 <tr>
242 <th class='tableHeading'>" . esc_attr($this->localTimes['date']) ."</th>
243 <th class='tableHeading'>" . esc_attr($this->localTimes['day']) ."</th>"
244 . $fajrHeading .""
245 .$fajrJamah.""
246 .$sunrise.
247 "<th class='tableHeading'>" . esc_attr($prayers['zuhr']) . "</th>
248 <th class='tableHeading'>" . esc_attr($prayers['asr']) . "</th>"
249 . $maghribHeading . ""
250 .$maghribJamah ."".
251 "<th class='tableHeading'>" . esc_attr($prayers['isha']) . "</th>
252 </tr>";
253
254 return $table;
255 }
256
257 /**
258 * @param array $rows
259 * @param $options
260 *
261 * @return string
262 */
263 private function printTableRow(array $rows, $options)
264 {
265 $table = '';
266
267 foreach($rows as $day) {
268
269 $today = explode('-', $day['d_date']);
270 $weekday = date("D", strtotime($day['d_date']));
271
272 $table .= "
273 <tr " . $this->getClass($today[1], $today[2]) . ">
274 <td>" . date_i18n(get_option( 'date_format' ), strtotime($day['d_date'])). ' '. $this->getHijriDate($today[2], $today[1], $today[0], $day, true) ."</td>
275
276 <td class=" . $weekday . ">" . $weekday . "</td>"
277 . $this->getFastingTdWithData($options['isRamadan'], $day['fajr_begins'], false, true ) . "
278 <td>" . $this->formatDateForPrayer($day['fajr_jamah']). "</td>
279 <td>" . $this->formatDateForPrayer($day['zuhr_jamah']). "</td>
280 <td>" . $this->formatDateForPrayer($day['asr_jamah']). "</td>"
281 . $this->getFastingTdWithData($options['isRamadan'], $day['maghrib_begins'] ) . "
282 <td>" . $this->formatDateForPrayer($day['maghrib_jamah']). "</td>
283 <td>" . $this->formatDateForPrayer($day['isha_jamah']). "</td>
284 </tr>";
285 }
286
287 return $table;
288 }
289
290 /**
291 * @param $options
292 *
293 * @return string
294 */
295 private function getFastingClass($options)
296 {
297 if ( $options['isRamadan'] ) {
298 return 'fasting';
299 }
300 return '';
301 }
302
303 /**
304 * @param $options
305 *
306 * @return string
307 */
308 private function getClassFasting($options)
309 {
310 if ( $options['isRamadan'] ) {
311 return "class='fasting'";
312 }
313 return '';
314 }
315
316 /**
317 * @return int
318 */
319 private function getAsrMethodColspan()
320 {
321 $asrMethod = get_option('asrSelect');
322 if ($asrMethod != 'both') {
323 return 2;
324 }
325 return 3;
326 }
327
328 /**
329 * @return string
330 */
331 private function getAsrMethodTh()
332 {
333 $asrMethod = get_option('asrSelect');
334
335 if ($asrMethod != 'both') {
336 return "<th class='tableHeading'>" .$this->localHeaders['begins']. "</th>";
337 }
338 return "<th class='tableHeading'>" .$this->localHeaders['standard']. "</th><th class='tableHeading'>" .$this->localHeaders['hanafi']. "</th>";
339 }
340 }
341