PluginProbe
ShiftController Employee Shift Scheduling / 4.9.24
ShiftController Employee Shift Scheduling v4.9.24
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 / reminders / html / admin.php

admin.php in ShiftController Employee Shift Scheduling 4.9.24, at sh4/reminders/html/admin.php

189 lines 4.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 class SH4_Reminders_Html_Admin
3 {
4 public function __construct(
5 HC3_UriAction $uriAction,
6 HC3_Uri $uri,
7 HC3_Post $post,
8 SH4_Reminders_Sms $sms,
9
10 HC3_Settings $settings,
11 HC3_Request $request,
12 HC3_Ui_Layout1 $layout,
13 HC3_Hooks $hooks
14 )
15 {
16 $this->sms = $hooks->wrap( $sms );
17 $this->settings = $hooks->wrap( $settings );
18 $this->post = $hooks->wrap( $post );
19 $this->uriAction = $uriAction;
20 $this->uri = $uri;
21 $this->layout = $layout;
22 $this->request = $request;
23 $this->self = $hooks->wrap( $this );
24 }
25
26 public function breadcrumbs()
27 {
28 $ret = array();
29 $ret['admin'] = array( 'admin', '__Administration__' );
30 return $ret;
31 }
32
33 public function header()
34 {
35 $ret = '__Reminders__';
36 return $ret;
37 }
38
39 public function menu()
40 {
41 $ret = array();
42
43 $ret['templates'] = array( 'admin/reminders/templates', '__Edit Templates__' );
44 $ret['review'] = array( 'admin/reminders/review', '__Review Reminders__' );
45 $ret['sms'] = array( 'admin/reminders/sms', '__SMS__' );
46
47 return $ret;
48 }
49
50 public function post()
51 {
52 $take = array(
53 'reminders_setup', 'reminders_daily', 'reminders_weekly', 'reminders_monthly',
54 );
55
56 if( $this->sms->isEnabled() ){
57 $take[] = 'reminders_daily_sms';
58 }
59
60 foreach( $take as $k ){
61 $v = $this->post->get($k);
62 $this->settings->set( $k, $v );
63 }
64
65 $return = array( 'admin/reminders', '__Settings Updated__' );
66 return $return;
67 }
68
69 public function render()
70 {
71 $values = array();
72 $pnames = array(
73 'reminders_setup', 'reminders_daily', 'reminders_weekly', 'reminders_monthly',
74 );
75
76 if( $this->sms->isEnabled() ){
77 $pnames[] = 'reminders_daily_sms';
78 }
79
80 foreach( $pnames as $pname ){
81 $values[$pname] = $this->settings->get($pname);
82 }
83
84 // cron link
85 $cronParams = array();
86 $cronSlug = 'cron';
87 // $cronLink = $this->uriAction->makeUrl( array($cronSlug, $cronParams) );
88 $cronLink = site_url( '/?hcs=sh4&hca=' . $cronSlug );
89
90 // post to
91 $slug = $this->request->getSlug();
92 $to = $this->uri->makeUrl( $slug );
93
94 ob_start();
95 ?>
96
97 <form action="<?php echo $to; ?>" method="post" accept-charset="utf-8">
98
99 <?php if( 1 OR ! $values['reminders_setup'] ) : ?>
100 <p>
101 <mark class="hc-p1">__Please Note__</mark>
102 </p>
103
104 <p>
105 For shifts reminders to work, you'll need to set up a cron job. Cron job is a process that runs periodically at your web server.
106 Log in to your web hosting control panel and go to Cron Jobs. Add a cron job that will be pulling the following command every day once a day.
107 </p>
108
109 <p>
110 <code>
111 wget -O /dev/null '<?php echo $cronLink; ?>'
112 </code>
113 </p>
114
115 <p>
116 Alternatively, you can make use of a web cron service (search the web for <i>web cron</i>) and make them pull the following link every day once a day.
117 </p>
118
119 <p>
120 <code>
121 <?php echo $cronLink; ?>
122 </code>
123 </p>
124
125 <?php endif; ?>
126
127 <p>
128 <label>
129 <input type="checkbox" name="hc-reminders_setup" value="1"<?php if( $values['reminders_setup'] ) : ?> checked<?php endif; ?>/>
130 __Yes, I've set up the cron job__
131 </label>
132 </p>
133
134 <?php if( $values['reminders_setup'] ) : ?>
135 <p>
136 <label>
137 <input type="checkbox" name="hc-reminders_daily" value="1"<?php if( $values['reminders_daily'] ) : ?> checked<?php endif; ?>/>
138 __Tomorrow Active Shift Reminder__
139 </label>
140 </p>
141
142 <?php if( $this->sms->isEnabled() ) : ?>
143 <p>
144 <label>
145 <input type="checkbox" name="hc-reminders_daily_sms" value="1"<?php if( $values['reminders_daily_sms'] ) : ?> checked<?php endif; ?>/>
146 __Tomorrow Active Shift Reminder SMS Text__
147 </label>
148 </p>
149 <?php endif; ?>
150
151 <p>
152 <label>
153 <input type="checkbox" name="hc-reminders_weekly" value="1"<?php if( $values['reminders_weekly'] ) : ?> checked<?php endif; ?>/>
154 __Next Week Active Shift Reminder__
155 </label>
156 </p>
157
158 <p>
159 <label>
160 <input type="checkbox" name="hc-reminders_monthly" value="1"<?php if( $values['reminders_monthly'] ) : ?> checked<?php endif; ?>/>
161 __Next Month Active Shift Reminder__
162 </label>
163 </p>
164 <?php endif; ?>
165
166 <p>
167 <?php if( $values['reminders_setup'] ) : ?>
168 <button type="submit" class="button button-primary button-large hc-xs-block">__Save__</button>
169 <?php else: ?>
170 <button type="submit" class="button button-primary button-large hc-xs-block">__Continue__</button>
171 <?php endif; ?>
172 </p>
173
174 </form>
175
176 <?php
177 $ret = trim( ob_get_clean() );
178
179 $this->layout
180 ->setContent( $ret )
181 ->setHeader( $this->self->header() )
182 ->setMenu( $this->self->menu() )
183 ->setBreadcrumb( $this->self->breadcrumbs() )
184 ;
185
186 $ret = $this->layout->render();
187 return $ret;
188 }
189 }