PluginProbe
ShiftController Employee Shift Scheduling / 4.9.95
ShiftController Employee Shift Scheduling v4.9.95
4.9.97 4.9.96 4.9.95 4.9.74 4.9.75 4.9.76 4.9.77 4.9.78 4.9.84 4.9.85 4.9.87 4.9.91 4.9.92 trunk 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 3.2.4 All 38 releases
shiftcontroller / sh4 / notifications / html / admin / view / turnonoff.php

turnonoff.php in ShiftController Employee Shift Scheduling 4.9.95, at sh4/notifications/html/admin/view/turnonoff.php

65 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if (! defined('ABSPATH')) exit; // Exit if accessed directly
2 #[AllowDynamicProperties]
3 class SH4_Notifications_Html_Admin_View_TurnOnOff
4 {
5 public function __construct(
6 HC3_Hooks $hooks,
7 HC3_Ui $ui,
8 HC3_Enqueuer $enqueuer,
9 HC3_Notificator $notificator,
10
11 HC3_Auth $auth,
12 HC3_IPermission $permission
13 )
14 {
15 $this->self = $hooks->wrap( $this );
16 $this->ui = $hooks->wrap( $ui );
17
18 $this->auth = $hooks->wrap( $auth );
19 $this->permission = $hooks->wrap($permission);
20 $this->notificator = $hooks->wrap($notificator);
21 $this->enqueuer = $enqueuer;
22 }
23
24 public function render( $return )
25 {
26 $out = array();
27 $out[] = $this->self->renderInput();
28 $out = $this->ui->makeListInline( $out )->gutter(1);
29
30 $to = 'admin/notifications/turnonoff';
31 $out = $this->ui->makeForm( $to, $out );
32
33 $out = $this->ui->makeBlock( $out )
34 ->addAttr('class', 'sh4-skip-notifications')
35 ;
36
37 if( isset($return[3]) ){
38 $return[3] = $this->ui->makeList( array($return[3], $out) );
39 }
40 else {
41 $return[3] = $out;
42 }
43
44 return $return;
45 }
46
47 public function renderInput()
48 {
49 $return = NULL;
50
51 $currentUser = $this->auth->getCurrentUser();
52 $isAdmin = $this->permission->isAdmin( $currentUser );
53
54 if( ! $isAdmin ){
55 return $return;
56 }
57
58 $this->enqueuer->addScript('notifications', 'sh4/notifications/assets/js/skip-notifications.js?hcver=' . SH4_VERSION);
59
60 $isOff = $this->notificator->isOff();
61 $return = $this->ui->makeInputCheckbox( 'notifications_turnoff', '__Skip Notifications__', 1, $isOff );
62
63 return $return;
64 }
65 }