PluginProbe ʕ •ᴥ•ʔ
Daily Prayer Time / 2020.05.04
Daily Prayer Time v2020.05.04
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 / Models / DigitalScreen.php
daily-prayer-time-for-mosques / Models Last commit date
Processors 6 years ago AssetsLoader.php 6 years ago DPTAjaxHandler.php 7 years ago DSTemplateLoader.php 7 years ago DailyShortCode.php 6 years ago DigitalScreen.php 6 years ago HijriDate.php 7 years ago Init.php 6 years ago MonthlyShortCode.php 7 years ago MonthlyTimeTable.php 6 years ago UpdateStyles.php 7 years ago Validator.php 7 years ago db.php 6 years ago dptWidget.php 7 years ago
DigitalScreen.php
452 lines
1 <?php
2
3 class DigitalScreen extends DailyShortCode
4 {
5 /** @var array */
6 protected $row = array();
7
8 /** @var bool */
9 private $isPortrait;
10
11 private $isPresentation;
12
13 /** @var int */
14 private $screenTimeout;
15
16 /** @var string */
17 private $scrollText;
18
19 /** @var array */
20 private $presentationSlides;
21
22
23 /** @var string */
24 private $blinkText = 'WELCOME TO HOUSE OF ALLAH';
25
26 /** @var string */
27 private $blinkUrl;
28
29 /** @var string */
30 private $scrollUrl;
31
32 public function __construct($attr=array())
33 {
34 parent::__construct();
35 if ( isset($attr['view']) ) {
36 $this->isPortrait = ( strtolower($attr['view']) == 'vertical' );
37 $this->isPresentation = ( strtolower($attr['view']) == 'presentation' );
38 }
39
40 if ( isset($attr['dim']) ) {
41 $this->screenTimeout = $attr['dim'];
42 }
43
44 if ( isset($attr['scroll']) ) {
45 $this->scrollText = $attr['scroll'];
46 }
47
48 if ( isset($attr['scroll_link']) ) {
49 $this->scrollUrl = $attr['scroll_link'];
50 }
51
52 if ( isset($attr['blink']) ) {
53 $this->blinkText = $attr['blink'];
54 }
55
56 if ( isset($attr['blink_link']) ) {
57 $this->blinkUrl = $attr['blink_link'];
58 }
59
60 if ( isset($attr['slides']) ) {
61 $this->presentationSlides = explode(',', $attr['slides']);
62 }
63 }
64
65 public function displayDigitalScreen()
66 {
67 $html = $this->getTopRow();
68
69 if ($this->isPresentation) {
70 $html .= $this->getPresentationRow();
71 } else {
72 $html .= $this->getMiddleRow();
73 }
74
75 $html .= $this->getBottomRow();
76
77 return $html;
78 }
79
80 private function getTopRow()
81 {
82 $timeClass = "col-sm-3 ";
83 $dateClass = "col-sm-7 ";
84 $height = "height-100";
85 $verticalClass = "";
86 if ( $this->isPortrait ) {
87 $timeClass = "col-xs-12 vertical-time ";
88 $dateClass = "col-xs-12 vertical-date";
89 $height = "height-50 ";
90 $verticalClass = "vertical";
91 }
92
93 if ( get_option('hijri-chbox')) {
94 $date = date_i18n( 'D jS M' );
95 } else {
96 $date = date_i18n( 'l ' . get_option( 'date_format' ) );
97 }
98
99 $html = '
100 <div class="container-fluid x-board">
101 <input type="hidden" value="' . $this->screenTimeout . '" id="screenTimeout">
102 <input type="hidden" value="' . htmlspecialchars(json_encode($this->getRefreshPoints())) . '" id="refreshPoint">
103 <input type="hidden" value="' . htmlspecialchars(json_encode($this->getOtherAdhanTimes())) . '" id="otherAdhanTimes">
104 <input type="hidden" value="' . htmlspecialchars(json_encode($this->getFajrAdhanTime())) . '" id="fajrAdhanTime">
105 <div class="row top-row">
106 <div class="time ' . $timeClass . 'col-xs-12 text-center ' . $height . '">
107 <div class="clock align-middle">
108 <ul class="clock">
109 <li id="hours"></li>
110 <li id="point">:</li>
111 <li id="min"></li>
112 <li id="ampm"></li>
113 </ul>
114 </div>
115 </div>
116 <div class="' . $dateClass . ' col-xs-12 text-center bg-white ' . $height . '">
117 <div class="align-middle">
118 <span id="dsDate" class="date-eng h6 ' . $verticalClass . '">' . $date. '</span>
119 <span id="dsHijriDate" class="'. $verticalClass . 'hijri">
120 ' . $this->getHijriDate(date("d"), date("m"), date("Y"), $this->getRow()) . '
121 </span>
122 </div>
123 </div>
124 <div class="col-sm-2 col-xs-12 text-right align-middle padding-null">';
125 $isLogo = get_option('ds-logo');
126 if ( $isLogo && ! $this->isPortrait) {
127 $html .= '<img class="logo" src="' . $isLogo . '">';
128 }
129 $html .=
130 '</div>
131 </div>';
132 return $html;
133 }
134
135 private function getPresentationRow()
136 {
137 $transitionEffect = get_option('transitionEffect');
138 $transitionSpeed = get_option('transitionSpeed');
139
140 $html ='
141 <div class="row middle-row bg-red">
142 <div class="col-sm-12 col-xs-12 padding-null text-center bg-green height-100 padding-null">
143 <div id="text-carousel" class="carousel slide ' . $transitionEffect . '
144 height-100" data-ride="carousel" data-interval="'. $transitionSpeed .'" data-pause="false">
145 <div class="carousel-inner height-100">
146 ' . $this->getPresentationSlides() . '
147 </div>
148 </div>
149 </div>
150 </div>
151 ';
152
153 return $html;
154 }
155
156 private function getPresentationSlides()
157 {
158 if (!$this->presentationSlides) {
159 return "<h1>add slides option, ie. <br/>
160 <i><pre> [digital_screen view='presentation' slides=imageLink,imageLink,imageLink]</pre></i></h1>";
161 }
162
163 $html = '
164 <div class="item active" >
165 <img class="carousel-slide" src="' . array_shift($this->presentationSlides) . '">
166 </div>';
167
168 foreach ($this->presentationSlides as $i => $slideUrl) {
169 $html .= '
170 <div class="item" >
171 <img class="carousel-slide" src="' . $slideUrl . '">
172 </div>
173 ';
174 }
175
176 return $html;
177 }
178
179 private function getMiddleRow()
180 {
181 $leftClass = "col-sm-5 col-xs-12 bg-red height-100 padding-null text-center";
182 $rightClass = "col-sm-7 col-xs-12 padding-null text-center bg-green height-100 padding-null";
183 $verticalClass = "";
184
185 if ( $this->isPortrait ) {
186 $verticalClass = "vertical";
187 $leftClass = "col-sm-12 bg-red padding-null text-center height-60";
188 $rightClass = "col-sm-12 padding-null text-center bg-green height-40";
189 }
190
191 $html = '
192 <div class="row middle-row bg-red">
193 <div class="'. $leftClass .'">
194 <table id="dsPrayerTimetable" class="table height-100 '. $verticalClass .'">
195 <thead class="bg-dark">
196 <tr>
197 <th class="dsPrayerName">
198 <span class="dpt_start">' . strtoupper($this->getLocalHeaders()['prayer']) . '</span>
199 </th>
200 <th class="dsBegins">
201 <span class="dpt_start">' . strtoupper($this->getLocalHeaders()['begins']) . '</span>
202 </th>
203 <th class="dsIqamah">
204 <span class="dpt_jamah">' . strtoupper($this->getLocalHeaders()['iqamah']) . '</span>
205 </th>
206 </tr>
207 </thead>
208 <tbody>
209 <tr>
210 <td class="prayerName">
211 <span>' . $this->getLocalPrayerNames()['fajr'] . '</span>
212 </td>
213 <td class="l-red">' . do_shortcode("[fajr_start]") . '</td>
214 <td>' . do_shortcode("[fajr_prayer]") . '</td>
215 </tr>
216 <tr>
217 <td class="prayerName"><span>' . $this->getLocalPrayerNames()['sunrise'] . '</span></td>
218 <td class="prayerName sunrise" colspan="2">' . do_shortcode("[sunrise]") . '</td>
219 </tr>';
220
221 if ( get_option('jumuah') && $this->todayIsFriday() && $this->isJumahDisplay($this->row)) {
222 $html .= '<tr>
223 <td class="prayerName"><span>' . stripslashes($this->getLocalHeaders()['jumuah']) . '</span></td>
224 <td colspan="2" class="prayerName sunrise"><span>' . get_option('jumuah') . '</span></td>
225 </tr>';
226 } else {
227 $html .= '
228 <tr>
229 <td class="prayerName"><span>' . $this->getLocalPrayerNames()['zuhr'] . '</span></td>
230 <td class="l-red">' . do_shortcode("[zuhr_start]") . '</td>
231 <td>' . do_shortcode("[zuhr_prayer]") . '</td>
232 </tr>
233 ';
234 }
235
236 $html .= '<tr>
237 <td class="prayerName"><span>' . $this->getLocalPrayerNames()['asr'] . '</span></td>
238 <td class="l-red">' . do_shortcode("[asr_start]") . '</td>
239 <td>' . do_shortcode("[asr_prayer]") . '</td>
240 </tr>
241 <tr>
242 <td class="prayerName"><span>' . $this->getLocalPrayerNames()['maghrib'] . '</span></td>
243 <td class="l-red">' . do_shortcode("[maghrib_start]") . '</td>
244 <td>' . do_shortcode("[maghrib_prayer]") . '</td>
245 </tr>
246 <tr>
247 <td class="prayerName"><span>' . $this->getLocalPrayerNames()['isha'] . '</span></td>
248 <td class="l-red">' . do_shortcode("[isha_start]") . '</td>
249 <td>' . do_shortcode("[isha_prayer]") . '</td>
250 </tr>';
251 if ( get_option('jumuah') && (! $this->todayIsFriday() || ! $this->isJumahDisplay($this->row)) ) {
252 $html .= '
253 <tr>
254 <td class="prayerName"><span>' . stripslashes($this->getLocalHeaders()['jumuah']) . '</span></td>
255 <td colspan="2" class="prayerName sunrise"><span>' . get_option('jumuah') . '</span></td>
256 </tr>';
257 }
258 $html .= '
259 </tbody>
260 </table>
261 </div>';
262
263 $transitionEffect = get_option('transitionEffect');
264 $transitionSpeed = get_option('transitionSpeed');
265 $html .='
266 <div class="'. $rightClass .'">
267 <div id="text-carousel" class="carousel slide ' . $transitionEffect . '
268 height-100" data-ride="carousel" data-interval="'. $transitionSpeed .'" data-pause="false">
269 <div class="carousel-inner height-100">
270 <div class="item active height-100">
271 ' . $this->getFirstSlide() . '
272 </div>
273 ' . $this->getOtherSlides() . '
274 </div>
275 </div>
276 </div>
277 </div>
278 ';
279
280 return $html;
281 }
282
283 private function getBottomRow()
284 {
285 $verticalClass = "";
286
287 if ( $this->isPortrait ) {
288 $verticalClass = "vertical";
289 }
290
291 $html = '
292 <div class="row bottom-row">
293 <div class="notificationBackground col-sm-3 col-xs-12 text-center height-100 align-middle">
294 <div class="align-middle">
295 <span id="dsBlink" class="blink">' . $this->getBlink() . '</span>
296 </div>
297 </div>
298 <div class="col-sm-9 col-xs-12 height-100">
299 <div class="align-middle">
300 <h3 class="text-primary scrolling">
301 <marquee id="dsIqamahUpdate" scrollamount="11">' . $this->getIqamahUpdate() . '</marquee>
302 </h3>
303 </div>
304 </div>
305 </div>
306 </div>
307 ';
308
309 if ($this->isPortrait) {
310 $html = '
311 <div class="row bottom-row">
312 <div class="col-sm-12 col-xs-12 height-24">
313 <div class="align-middle">
314 <h3 class="text-primary scrolling-vertical">
315 <marquee id="dsIqamahUpdate" scrollamount="11">' . $this->getIqamahUpdate() . '</marquee>
316 </h3>
317 </div>
318 </div>
319 <div class="notificationBackground col-sm-12 col-xs-12 text-center height-50 align-middle">
320 <div class="align-middle">
321 <span id="dsBlink" class="blink-'.$verticalClass.'">' . $this->getBlink() . '</span>
322 </div>
323 </div>
324 </div>
325 </div>
326 ';
327 }
328
329 return $html;
330 }
331
332 private function getIqamahUpdate()
333 {
334 if ( $this->scrollText ) {
335 return '<a target="_new" href="'. $this->scrollUrl .'">'. $this->scrollText .'</a>';
336 } else {
337 return do_shortcode("[display_iqamah_update orientation='horizontal']");
338 }
339 }
340
341 private function getBlink()
342 {
343 return '<a target="_new" href="'. $this->blinkUrl .'">'. $this->blinkText .'</a>';
344 }
345
346 private function getFirstSlide()
347 {
348 $verticalClass = "";
349 if ( $this->isPortrait ) {
350 $verticalClass = "vertical";
351 }
352
353 if (get_option('ramadan-chbox')) {
354 $h3 = '<div class="dsRamadan">
355
356 <div class="sehri">' . $this->getLocalHeaders()['fast_begins'] . ': ' . $this->formatDateForPrayer($this->row['fajr_begins'], true) . '</div>
357 <div class="iftar pull-right">' . $this->getLocalHeaders()['fast_ends']. ': ' . do_shortcode("[maghrib_start]") . '</div>
358 </div>';
359 } else {
360 $h3 = '<h3 class="'.$verticalClass.'">'. $this->getLocalTimes()['next prayer'] . '</h3>';
361 }
362
363 $html = '
364 <div class="nextPrayer height-100">
365 <div class="align-middle">'
366 . $h3 .
367 '<h2 id="dsNextPrayer" class="dsNextPrayer '.$verticalClass.'"></h2>
368 </div>
369 </div>';
370
371 return $html;
372 }
373
374 private function getOtherSlides()
375 {
376 $isSlide = get_option('slider-chbox');
377 if ( $isSlide ) {
378 $html = "";
379 $slides = array();
380
381 $slides[] = get_option('slider1Url');
382 $slides[] = get_option('slider2Url');
383 $slides[] = get_option('slider3Url');
384 $slides[] = get_option('slider4Url');
385 $slides[] = get_option('slider5Url');
386 $slides[] = get_option('slider6Url');
387
388 $slides = array_filter($slides);
389 foreach ($slides as $i => $slideUrl) {
390 $html .= '
391 <div class="item" >
392 <img class="carousel-slide" src="' . $slideUrl . '">
393 </div>
394 ';
395
396 if (!$this->isPresentation) {
397 $count = $i + 1;
398 if ( $count % 2 == 0 ) {
399 $html .= '
400 <div class="item">
401 ' . $this->getFirstSlide() . '
402 </div>
403 ';
404 }
405 }
406 }
407
408 return $html;
409 }
410
411 return null;
412 }
413
414 private function getRefreshPoints()
415 {
416 $result = $this->db->getPrayerTimeForToday();
417 $iqamahTimes = array($result['fajr_jamah'], $result['sunrise'], $result['zuhr_jamah'], $result['asr_jamah'], $result['maghrib_jamah'], $result['isha_jamah']);
418
419 $refreshPoints = array();
420 foreach($iqamahTimes as $iqamah) {
421 $refreshPoints[] = date( "H:i:s", strtotime( $iqamah . "-16 minutes" ) );
422 }
423
424 return $refreshPoints;
425 }
426
427 private function getOtherAdhanTimes()
428 {
429 $result = $this->db->getPrayerTimeForToday();
430 $iqamahTimes = array($result['zuhr_jamah'], $result['asr_jamah'], $result['maghrib_begins'], $result['isha_jamah']);
431
432 $adhanTimes = array();
433 $adhanTimes[] = date( "H:i:s", strtotime( $iqamahTimes[0] . "-15 minutes" ) ); // zuhr
434 $adhanTimes[] = date( "H:i:s", strtotime( $iqamahTimes[1] . "-15 minutes" ) ); // asr
435 $adhanTimes[] = date( "H:i:s", strtotime( $iqamahTimes[2] . "0 minutes" ) ); // maghrib
436 $adhanTimes[] = date( "H:i:s", strtotime( $iqamahTimes[3] . "-15 minutes" ) ); // isha
437
438 return $adhanTimes;
439 }
440
441 private function getFajrAdhanTime()
442 {
443 $result = $this->db->getPrayerTimeForToday();
444
445 return date( "H:i:s", strtotime( $result['fajr_jamah'] . "-15 minutes" ) ); // fajr
446 }
447
448
449
450
451 }
452