Tabs
1 month ago
DSTemplate.php
1 month ago
DailyTimetablePrinter.php
1 month ago
DptApiDoc.php
2 months ago
HelpsAndTips.php
1 month ago
MonthlyTimetablePrinter.php
2 months ago
TimetablePrinter.php
1 month ago
dptWidgetForm.php
4 years ago
horizontal-div.php
1 month ago
widget-admin.php
1 month ago
DailyTimetablePrinter.php
523 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 | $nextPrayer = $this->getNextPrayer( $row ); |
| 46 | |
| 47 | // Determine whether to show Jumuah row: only when jumuah times are configured |
| 48 | // and current time is before the last configured Jumuah time (on Fridays). |
| 49 | $jumuahOptions = array_filter([ get_option('jumuah1'), get_option('jumuah2'), get_option('jumuah3') ]); |
| 50 | $showJumuah = !empty($row['showJumuah']); |
| 51 | $isFriday = $this->todayIsFriday(); |
| 52 | if (! $showJumuah && ! empty($jumuahOptions) && $isFriday) { |
| 53 | $nowTs = strtotime( user_current_time('H:i') ); |
| 54 | $lastJumuahTs = max( array_map('strtotime', $jumuahOptions) ); |
| 55 | if ($nowTs < $lastJumuahTs) { |
| 56 | $showJumuah = true; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | $shouldHighlightJumuah = ($nextPrayer == 'jumuah') || ($isFriday && $showJumuah); |
| 61 | if ( $shouldHighlightJumuah || $showJumuah ) { |
| 62 | $jumuahClass = $shouldHighlightJumuah ? 'highlight' : ''; |
| 63 | $table .= '<tr class="' . $jumuahClass . '"> |
| 64 | <th class="tableHeading">' . stripslashes($this->getLocalHeaders()['jumuah']) . '</th> |
| 65 | <td colspan="6" class="jamah">' . $this->getJumuahTimesArray() . '</td> |
| 66 | </tr>'; |
| 67 | } |
| 68 | |
| 69 | $table .= '</table>'; |
| 70 | |
| 71 | return $table; |
| 72 | } |
| 73 | |
| 74 | public function horizontalTimeJamahOnly($row) |
| 75 | { |
| 76 | $table = $this->printHorizontalTableTop( $row ); |
| 77 | |
| 78 | $table .= ' |
| 79 | <tr><th>' .$this->localHeaders['prayer']. '</th>' |
| 80 | . $this->printTableHeading($row) . |
| 81 | '</tr> |
| 82 | <tr> |
| 83 | <th>'.$this->localHeaders['iqamah'].'</th>' |
| 84 | .$this->printJamahTime($row). |
| 85 | '</tr> |
| 86 | </table>'; |
| 87 | |
| 88 | return $table; |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * @param $row |
| 93 | * |
| 94 | * @return string |
| 95 | */ |
| 96 | public function horizontalTimeAzanOnly($row) |
| 97 | { |
| 98 | $table = $this->printHorizontalTableTop( $row, true ); |
| 99 | |
| 100 | $table .= ' |
| 101 | <tr><th>' .$this->localHeaders['prayer']. '</th>' |
| 102 | . $this->printTableHeading($row) . |
| 103 | '</tr> |
| 104 | <tr> |
| 105 | <th>'.$this->localHeaders['begins'].'</th>' |
| 106 | .$this->printAzanTime($row). |
| 107 | '</tr> |
| 108 | </table>'; |
| 109 | |
| 110 | return $table; |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * @param $row |
| 115 | * @return string |
| 116 | */ |
| 117 | public function printVerticalTime($row) |
| 118 | { |
| 119 | $table = $this->printVerticalTableTop( $row , true); |
| 120 | |
| 121 | $table .= |
| 122 | '<tr> |
| 123 | <th class="tableHeading">' .$this->localHeaders['prayer']. '</th> |
| 124 | <th class="tableHeading">' .$this->localHeaders['begins']. '</th> |
| 125 | <th class="tableHeading">' .$this->localHeaders['iqamah']. '</th> |
| 126 | </tr>' |
| 127 | . $this->printVerticalRow( $row, 'both' ) . |
| 128 | '</table>'; |
| 129 | |
| 130 | return $table; |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * @param array $row |
| 135 | * @return string |
| 136 | */ |
| 137 | public function verticalTimeJamahOnly($row) |
| 138 | { |
| 139 | $table = $this->printVerticalTableTop( $row ); |
| 140 | |
| 141 | $table .= |
| 142 | '<tr> |
| 143 | <th class="tableHeading">' .$this->localHeaders['prayer']. '</th> |
| 144 | <th class="tableHeading">' .$this->localHeaders['iqamah']. '</th> |
| 145 | </tr>' |
| 146 | .$this->printVerticalRow( $row, 'iqamah' ) . |
| 147 | '</table>'; |
| 148 | |
| 149 | return $table; |
| 150 | } |
| 151 | |
| 152 | /** |
| 153 | * @param array $row |
| 154 | * @return string |
| 155 | */ |
| 156 | public function verticalTimeAzanOnly($row) |
| 157 | { |
| 158 | $table = $this->printVerticalTableTop( $row, false, true ); |
| 159 | |
| 160 | $table .= |
| 161 | '<tr> |
| 162 | <th class="tableHeading">' .$this->localHeaders['prayer']. '</th> |
| 163 | <th class="tableHeading">' .$this->localHeaders['begins']. '</th> |
| 164 | </tr>' |
| 165 | .$this->printVerticalRow( $row, 'azan' ) . |
| 166 | '</table>'; |
| 167 | |
| 168 | return $table; |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * @param $row |
| 173 | * |
| 174 | * @param bool $isAzanOnly |
| 175 | * |
| 176 | * @return string |
| 177 | */ |
| 178 | private function printHorizontalTableTop($row, $isAzanOnly=false) |
| 179 | { |
| 180 | $announcement = ''; |
| 181 | if (! $row['hideTimeRemaining']) { |
| 182 | $nextIqamah = $isAzanOnly == true ? '' : $this->getNextIqamahTime($row); |
| 183 | } |
| 184 | $colspan = 8; |
| 185 | $ramadanTds = '<td></td>'; |
| 186 | |
| 187 | $ramadan = ''; |
| 188 | if ($this->isRamadan() && ! $row['hideRamadan']) { |
| 189 | $ramadan = ' |
| 190 | <tr class=""> |
| 191 | <td colspan="3" class="highlight">'. $this->localHeaders['fast_begins'].': '.$this->formatDateForPrayer($row['fajr_begins'], true).'</td> |
| 192 | '. $ramadanTds . ' |
| 193 | <td colspan="3" class="highlight">'. $this->localHeaders['fast_ends'].': '.$this->formatDateForPrayer($row['maghrib_begins']).'</td> |
| 194 | </tr>'; |
| 195 | } |
| 196 | |
| 197 | if(isset($row['announcement']) && ! empty( $row['announcement'] )) { |
| 198 | $announcement = "<tr><th colspan='".$colspan."' style='text-align:center' class='notificationBackground notificationFont'>".$row['announcement']. "</th></tr>"; |
| 199 | } |
| 200 | |
| 201 | $table = ""; |
| 202 | $table .= |
| 203 | '<table class="customStyles dptUserStyles dptTimetable ' .$this->getTableClass().'"> '.$announcement.' |
| 204 | <tr> |
| 205 | <th colspan="'. $colspan .'" style="text-align:center">' |
| 206 | .$row['widgetTitle']. ' ' . date_i18n( get_option( 'date_format' ) ) .' '. $this->getHijriDate(date("d"), date("m"), date("Y"),$row) .' ' . $nextIqamah .' |
| 207 | </th> |
| 208 | </tr>'. $ramadan; |
| 209 | |
| 210 | return $table; |
| 211 | } |
| 212 | |
| 213 | public function displayRamadanTime($row) |
| 214 | { |
| 215 | return ' <table class="customStyles dptUserStyles"> |
| 216 | <tr style="text-align:center"> |
| 217 | <td colspan="3" class="fasting highlight">'. $this->localHeaders['fast_begins'].': '.$this->formatDateForPrayer($row['fajr_begins'], true).'</td> |
| 218 | <td style="border:0px;"></td> |
| 219 | <td colspan="3" class="fasting highlight">'. $this->localHeaders['fast_ends'].': '.$this->formatDateForPrayer($row['maghrib_begins']).'</td> |
| 220 | </tr></table>'; |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * @param $row |
| 225 | * |
| 226 | * @return string |
| 227 | */ |
| 228 | private function printTableHeading($row) |
| 229 | { |
| 230 | $ths = ''; |
| 231 | $nextPrayer = $this->getNextPrayer( $row ); |
| 232 | |
| 233 | $localPrayerNames = $this->localPrayerNames; |
| 234 | |
| 235 | // Handle ishraq - merge into sunrise row, show only sunrise |
| 236 | $ishraqMins = get_option('ishraq'); |
| 237 | if ($ishraqMins && $ishraqMins != '0' && isset($localPrayerNames['ishraq'])) { |
| 238 | if ($this->dptHelper->isIshraqTimeNext($row)) { |
| 239 | $localPrayerNames['sunrise'] = $localPrayerNames['ishraq']; |
| 240 | } |
| 241 | } |
| 242 | if (isset($localPrayerNames['ishraq'])) { |
| 243 | unset($localPrayerNames['ishraq']); |
| 244 | } |
| 245 | |
| 246 | // Handle zawal - show zawal instead of sunrise if zawal time is next |
| 247 | if (get_option('zawal') && $this->dptHelper->isZawalTimeNext($row)) { |
| 248 | $localPrayerNames['sunrise'] = $localPrayerNames['zawal'] ?? 'Zawal'; |
| 249 | } |
| 250 | |
| 251 | // Remove zawal - never show as separate prayer name |
| 252 | if (isset($localPrayerNames['zawal'])) { |
| 253 | unset($localPrayerNames['zawal']); |
| 254 | } |
| 255 | |
| 256 | foreach ($localPrayerNames as $key=>$prayerName) { |
| 257 | $shouldHighlight = false; |
| 258 | if ($key == 'sunrise' && $nextPrayer == 'ishraq') { |
| 259 | $shouldHighlight = true; |
| 260 | } elseif ($key != 'sunrise' && $nextPrayer == $key) { |
| 261 | $shouldHighlight = true; |
| 262 | } |
| 263 | // On Friday, don't highlight Zuhr (Jumuah row is highlighted instead) |
| 264 | if ($this->todayIsFriday() && $key == 'zuhr') { |
| 265 | $shouldHighlight = false; |
| 266 | } |
| 267 | $class = $shouldHighlight ? 'highlight' : ''; |
| 268 | $ths .= "<th class='tableHeading prayerName" . $this->tableClass . " ". $class."'>".$prayerName."</th>"; |
| 269 | } |
| 270 | |
| 271 | return $ths; |
| 272 | } |
| 273 | |
| 274 | private function toggleSunriseZawal($row, $prayerNames) |
| 275 | { |
| 276 | unset($prayerNames['zawal']); |
| 277 | return $prayerNames; |
| 278 | } |
| 279 | |
| 280 | /** |
| 281 | * @param $row |
| 282 | * |
| 283 | * @return string |
| 284 | */ |
| 285 | private function printAzanTime($row) |
| 286 | { |
| 287 | $tds = ''; |
| 288 | $nextPrayer = $this->getNextPrayer( $row ); |
| 289 | $azanTimings = $this->getAzanTime( $row ); |
| 290 | |
| 291 | // Handle ishraq - merge into sunrise row (check FIRST) |
| 292 | $ishraqMins = get_option('ishraq'); |
| 293 | if ($ishraqMins && $ishraqMins != '0' && $this->dptHelper->isIshraqTimeNext($row)) { |
| 294 | $azanTimings['sunrise'] = $this->dptHelper->getIshraqTime($row['sunrise']); |
| 295 | } elseif (get_option('zawal') && $this->dptHelper->isZawalTimeNext($row)) { |
| 296 | // Handle zawal - show zawal time instead of sunrise if zawal time is next |
| 297 | $azanTimings['sunrise'] = $this->dptHelper->getZawalTime($row['zuhr_begins']); |
| 298 | } |
| 299 | |
| 300 | foreach ($azanTimings as $key => $azan) { |
| 301 | |
| 302 | $shouldHighlight = false; |
| 303 | if ($key == 'sunrise' && $nextPrayer == 'ishraq') { |
| 304 | $shouldHighlight = true; |
| 305 | } elseif ($key != 'sunrise' && $nextPrayer == $key) { |
| 306 | $shouldHighlight = true; |
| 307 | } |
| 308 | // On Friday, don't highlight Zuhr (Jumuah row is highlighted instead) |
| 309 | if ($this->todayIsFriday() && $key == 'zuhr') { |
| 310 | $shouldHighlight = false; |
| 311 | } |
| 312 | |
| 313 | $class = $shouldHighlight ? "class='highlight'" : ''; |
| 314 | $rowspan = ($key == 'sunrise') ? "rowspan='2'" : ''; |
| 315 | $tds .= "<td ". $rowspan ." ".$class.">".$this->getFormattedDateForPrayer( $azan, $key)."</td>"; |
| 316 | } |
| 317 | |
| 318 | return $tds; |
| 319 | } |
| 320 | |
| 321 | /** |
| 322 | * @param $row |
| 323 | * @param bool $isSunrise |
| 324 | * |
| 325 | * @return string |
| 326 | */ |
| 327 | private function printJamahTime($row, $isSunrise=true) |
| 328 | { |
| 329 | $jamahTimes = $this->getJamahTime( $row ); |
| 330 | |
| 331 | // Handle ishraq - merge into sunrise row (check FIRST) |
| 332 | $ishraqMins = get_option('ishraq'); |
| 333 | if ($ishraqMins && $ishraqMins != '0' && $this->dptHelper->isIshraqTimeNext($row)) { |
| 334 | $jamahTimes['sunrise'] = $this->dptHelper->getIshraqTime($row['sunrise']); |
| 335 | } elseif (get_option('zawal') && $this->dptHelper->isZawalTimeNext($row)) { |
| 336 | // Handle zawal - show zawal time instead of sunrise if zawal time is next |
| 337 | $jamahTimes['sunrise'] = $this->dptHelper->getZawalTime($row['zuhr_begins']); |
| 338 | } |
| 339 | |
| 340 | if (! $isSunrise) { |
| 341 | unset( $jamahTimes['sunrise'] ); |
| 342 | } |
| 343 | |
| 344 | $tds = ''; |
| 345 | $nextPrayer = $this->getNextPrayer( $row ); |
| 346 | |
| 347 | // On Friday, only next prayer (not Zuhr) should be highlighted until Asr |
| 348 | $onFriday = $this->todayIsFriday(); |
| 349 | |
| 350 | foreach ($jamahTimes as $key => $azan) { |
| 351 | $shouldHighlight = false; |
| 352 | if ($key == 'sunrise' && $nextPrayer == 'ishraq') { |
| 353 | $shouldHighlight = true; |
| 354 | } elseif ($key != 'sunrise' && $nextPrayer == $key) { |
| 355 | $shouldHighlight = true; |
| 356 | } |
| 357 | // On Friday, don't highlight Zuhr (Jumuah row is highlighted instead) |
| 358 | if ($onFriday && $key == 'zuhr') { |
| 359 | $shouldHighlight = false; |
| 360 | } |
| 361 | |
| 362 | $class = $shouldHighlight ? 'class=highlight' : 'class=jamah'; |
| 363 | $tds .= "<td ".$class.">".$this->getFormattedDateForPrayer( $azan, $key, true )."</td>"; |
| 364 | } |
| 365 | |
| 366 | return $tds; |
| 367 | } |
| 368 | |
| 369 | /** |
| 370 | * @param $row |
| 371 | * @param bool $isFullTable |
| 372 | * |
| 373 | * @return string |
| 374 | */ |
| 375 | private function printVerticalTableTop($row, $isFullTable=false, $isAzanOnly=false) |
| 376 | { |
| 377 | if (! $row['hideTimeRemaining']) { |
| 378 | $nextIqamah = $isAzanOnly == true ? '' : $this->getNextIqamahTime($row); |
| 379 | } |
| 380 | |
| 381 | $colspan = ( $isFullTable == true ) ? 3 : 2; |
| 382 | |
| 383 | $colspanRamadan = $isFullTable == true ? "colspan='2'" : ''; |
| 384 | |
| 385 | |
| 386 | $ramadan = ''; |
| 387 | if ($this->isRamadan() && ! $row['hideRamadan']) { |
| 388 | $ramadan = ' |
| 389 | <tr> |
| 390 | <th class="highlight">' .$this->localHeaders['fast_begins']. '</th> |
| 391 | <th '.$colspanRamadan.' class="highlight">' .$this->formatDateForPrayer($row['fajr_begins'], true). '</th> |
| 392 | </tr> |
| 393 | <tr> |
| 394 | <th class="highlight">'.$this->localHeaders['fast_ends'].'</th> |
| 395 | <th '.$colspanRamadan.' class="highlight">'.$this->formatDateForPrayer($row['maghrib_begins']).'</th> |
| 396 | </tr> |
| 397 | '; |
| 398 | } |
| 399 | $table = ""; |
| 400 | $announcement = ''; |
| 401 | if(isset($row['announcement']) && ! empty( $row['announcement'] )) { |
| 402 | $announcement = "<tr><th colspan=".$colspan." style='text-align:center' class='notificationBackground notificationFont'>".$row['announcement']. "</th></tr>"; |
| 403 | } |
| 404 | |
| 405 | $table .= |
| 406 | '<table class="dptTimetable ' .$this->getTableClass().' customStyles dptUserStyles"> '.$announcement.' |
| 407 | <tr> |
| 408 | <th colspan='.$colspan.' style="text-align:center">' |
| 409 | .$row['widgetTitle']. ' '. date_i18n( get_option( 'date_format' ) ) .' '. $this->getHijriDate(date("d"), date("m"), date("Y"), $row).'' . $nextIqamah . ' |
| 410 | </th> |
| 411 | </tr>' |
| 412 | .$ramadan; |
| 413 | |
| 414 | return $table; |
| 415 | } |
| 416 | |
| 417 | /** |
| 418 | * @param $row |
| 419 | * @param $display // i.e both, azan, iqamah |
| 420 | * |
| 421 | * @return string |
| 422 | */ |
| 423 | private function printVerticalRow($row, $display) |
| 424 | { |
| 425 | $trs = ''; |
| 426 | $nextPrayer = $this->getNextPrayer( $row ); |
| 427 | $isFriday = $this->todayIsFriday(); |
| 428 | |
| 429 | $localPrayerNames = $this->localPrayerNames; |
| 430 | |
| 431 | // Handle ishraq - ONLY if ishraq is NEXT (not yet passed) - check FIRST |
| 432 | $ishraqMins = get_option('ishraq'); |
| 433 | if ($ishraqMins && $ishraqMins != '0' && isset($localPrayerNames['ishraq'])) { |
| 434 | if ($this->dptHelper->isIshraqTimeNext($row)) { |
| 435 | $localPrayerNames['sunrise'] = $localPrayerNames['ishraq']; |
| 436 | $row['sunrise'] = $this->dptHelper->getIshraqTime($row['sunrise']); |
| 437 | } |
| 438 | } |
| 439 | if (isset($localPrayerNames['ishraq'])) { |
| 440 | unset($localPrayerNames['ishraq']); |
| 441 | } |
| 442 | |
| 443 | // Handle zawal - show zawal instead of sunrise if zawal time is next (only if ishraq not next) |
| 444 | if (!$this->dptHelper->isIshraqTimeNext($row) && get_option('zawal') && $this->dptHelper->isZawalTimeNext($row)) { |
| 445 | $localPrayerNames['sunrise'] = $localPrayerNames['zawal'] ?? 'Zawal'; |
| 446 | $row['sunrise'] = $this->dptHelper->getZawalTime($row['zuhr_begins']); |
| 447 | } |
| 448 | |
| 449 | // Remove zawal - never show as separate prayer name |
| 450 | if (isset($localPrayerNames['zawal'])) { |
| 451 | unset($localPrayerNames['zawal']); |
| 452 | } |
| 453 | |
| 454 | foreach ($localPrayerNames as $key=>$prayerName) { |
| 455 | $begins = $key != 'sunrise' ? lcfirst( $key ).'_begins' : 'sunrise'; |
| 456 | $jamah = $key != 'sunrise' ? lcfirst( $key ).'_jamah' : 'sunrise'; |
| 457 | |
| 458 | $shouldHighlight = false; |
| 459 | if ($key == 'sunrise' && $nextPrayer == 'ishraq') { |
| 460 | $shouldHighlight = true; |
| 461 | } elseif ($key != 'sunrise' && $nextPrayer == $key) { |
| 462 | $shouldHighlight = true; |
| 463 | } |
| 464 | // On Friday, don't highlight Zuhr (Jumuah row is highlighted instead) |
| 465 | if ($isFriday && $key == 'zuhr') { |
| 466 | $shouldHighlight = false; |
| 467 | } |
| 468 | $class = $shouldHighlight ? 'highlight' : ''; |
| 469 | $highlightForJamah = $shouldHighlight ? 'highlight' : ''; |
| 470 | |
| 471 | $trs .= '<tr> |
| 472 | <th class="prayerName ' .$class.'">' . $prayerName . '</th>'; |
| 473 | if ( ($key == 'sunrise') && $display == 'both') { |
| 474 | $trs .= '<td colspan="2" class="' . $class . '">'.$this->getFormattedDateForPrayer($row[$jamah], $key).'</td>'; |
| 475 | } elseif ($display == 'azan') { |
| 476 | $trs .='<td class="begins '.$class.'">'.$this->getFormattedDateForPrayer($row[$begins], $key).'</td> |
| 477 | </tr>'; |
| 478 | } elseif ($display == 'iqamah') { |
| 479 | $trs .='<td class="begins '.$class.'">'.$this->getFormattedDateForPrayer($row[$jamah], $key, true).'</td> |
| 480 | </tr>'; |
| 481 | } else { |
| 482 | $trs .='<td class="begins '.$class.'">'.$this->getFormattedDateForPrayer($row[$begins], $key).'</td> |
| 483 | <td class="jamah '.$highlightForJamah.'">'.$this->getFormattedDateForPrayer($row[$jamah], $key, true).'</td> |
| 484 | </tr>'; |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Determine whether to show Jumuah row: only when jumuah times are configured |
| 489 | // and current time is before the last configured Jumuah time (on Fridays). |
| 490 | $jumuahOptions = array_filter([ get_option('jumuah1'), get_option('jumuah2'), get_option('jumuah3') ]); |
| 491 | $showJumuah = !empty($row['showJumuah']); |
| 492 | if (! $showJumuah && ! empty($jumuahOptions) && $isFriday) { |
| 493 | $nowTs = strtotime( user_current_time('H:i') ); |
| 494 | $lastJumuahTs = max( array_map('strtotime', $jumuahOptions) ); |
| 495 | if ($nowTs < $lastJumuahTs) { |
| 496 | $showJumuah = true; |
| 497 | } |
| 498 | } |
| 499 | |
| 500 | $shouldHighlightJumuah = ($nextPrayer == 'jumuah') || ($isFriday && $showJumuah); |
| 501 | if ($shouldHighlightJumuah || $showJumuah) { |
| 502 | $jumuahClass = $shouldHighlightJumuah ? 'highlight' : ''; |
| 503 | $trs .= '<tr> |
| 504 | <th class="prayerName ' . $jumuahClass . '"><span>' . stripslashes($this->getLocalHeaders()['jumuah']) . '</span></th> |
| 505 | <td colspan="2" class="jamah ' . $jumuahClass . '">' . $this->getJumuahTimesArray() . '</td> |
| 506 | </tr>'; |
| 507 | } |
| 508 | |
| 509 | return $trs; |
| 510 | } |
| 511 | |
| 512 | private function getFormattedDateForPrayer($time, $prayerName, $isJamatTime=false) |
| 513 | { |
| 514 | return $this->formatDateForPrayer($time); |
| 515 | } |
| 516 | |
| 517 | public function displayNextPrayer($row) |
| 518 | { |
| 519 | return $this->getNextIqamahTime($row); |
| 520 | |
| 521 | } |
| 522 | } |
| 523 |