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 / templates.php

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

201 lines 4.9 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_Templates
3 {
4 public function __construct(
5 HC3_Ui $ui,
6 HC3_Time $t,
7 HC3_Uri $uri,
8 HC3_Post $post,
9
10 HC3_Settings $settings,
11 SH4_Reminders_Sms $sms,
12 SH4_Notifications_Template $notificationsTemplate,
13
14 HC3_Request $request,
15 HC3_Ui_Layout1 $layout,
16 HC3_Hooks $hooks
17 )
18 {
19 $this->ui = $ui;
20 $this->t = $t;
21 $this->post = $hooks->wrap( $post );
22 $this->settings = $hooks->wrap( $settings );
23 $this->sms = $hooks->wrap( $sms );
24
25 $this->notificationsTemplate = $hooks->wrap( $notificationsTemplate );
26
27 $this->uri = $uri;
28 $this->layout = $layout;
29 $this->request = $request;
30 $this->self = $hooks->wrap( $this );
31 }
32
33 public function breadcrumbs()
34 {
35 $ret = array();
36 $ret['admin'] = array( 'admin', '__Administration__' );
37 $ret['admin/reminders'] = array( 'admin/reminders', '__Reminders__' );
38 return $ret;
39 }
40
41 public function header()
42 {
43 $ret = '__Edit Templates__';
44 return $ret;
45 }
46
47 public function pnames()
48 {
49 $ret = [
50 'reminders_template_subject_daily',
51 'reminders_template_subject_weekly',
52 'reminders_template_subject_monthly'
53 ];
54
55 $smsEnabled = $this->sms->isEnabled();
56 if( $smsEnabled ){
57 $ret[] = 'reminders_template_subject_dailysms';
58 $ret[] = 'reminders_template_body_dailysms';
59 }
60
61 return $ret;
62 }
63
64 public function post()
65 {
66 $pnames = $this->self->pnames();
67 foreach( $pnames as $pname ){
68 $this->settings->set( $pname, $this->post->get($pname) );
69 }
70
71 $to = 'admin/reminders/templates';
72 $msg = '__Settings Updated__';
73 $ret = array( $to, $msg );
74
75 return $ret;
76 }
77
78 public function postReset()
79 {
80 $pnames = $this->self->pnames();
81 foreach( $pnames as $pname ){
82 $this->settings->reset( $pname );
83 }
84
85 $to = 'admin/reminders/templates';
86 $msg = '__Settings Updated__';
87 $ret = array( $to, $msg );
88
89 return $ret;
90 }
91
92 public function render()
93 {
94 $pnames = $this->self->pnames();
95
96 $v = array();
97 foreach( $pnames as $pname ){
98 $v[ $pname ] = $this->settings->get( $pname );
99 }
100
101 // post to
102 $slug = $this->request->getSlug();
103 $to = $this->uri->makeUrl( $slug );
104 $toReset = $this->uri->makeUrl( $slug . '/reset' );
105
106 $smsEnabled = $this->sms->isEnabled();
107
108 // $tags = $this->notificationsTemplate->getTags( $calendar );
109 // $tags = $this->notificationsTemplate->getTags( );
110
111 ob_start();
112 ?>
113
114 <form action="<?php echo $to; ?>" method="post" accept-charset="utf-8">
115
116 <div class="hc-clearfix hc-mxn2">
117 <div class="hc-col hc-col-9 hc-px2">
118 <div class="hc-mb2">
119 <b><u>__Email__</u></b>
120 </div>
121
122 <div class="hc-mb2">
123 <label>
124 <b>__Subject__: __Tomorrow Active Shift Reminder__</b>
125 <input type="text" class="hc-block" name="hc-reminders_template_subject_daily" value="<?php echo esc_attr($v['reminders_template_subject_daily']); ?>">
126 </label>
127 </div>
128
129 <div class="hc-mb2">
130 <label>
131 <b>__Subject__: __Next Week Active Shift Reminder__</b>
132 <input type="text" class="hc-block" name="hc-reminders_template_subject_weekly" value="<?php echo esc_attr($v['reminders_template_subject_weekly']); ?>">
133 </label>
134 </div>
135
136 <div class="hc-mb2">
137 <label>
138 <b>__Subject__: __Next Month Active Shift Reminder__</b>
139 <input type="text" class="hc-block" name="hc-reminders_template_subject_monthly" value="<?php echo esc_attr($v['reminders_template_subject_monthly']); ?>">
140 </label>
141 </div>
142
143 <div class="hc-mb2">
144 <b>__Each Shift Details__</b>
145 <br/>
146 __It depends on the shift calendar, the following notification template is used__: <strong>__Email__: __Shift Published__ (__Employee__)</strong>
147 </div>
148
149 <?php if( $smsEnabled ) : ?>
150 <div class="hc-mb2">
151 <b><u>__SMS__</u></b>
152 </div>
153
154 <div class="hc-mb2">
155 <label>
156 <b>__Tomorrow Active Shift Reminder__</b>
157 <input type="text" class="hc-block" name="hc-reminders_template_subject_dailysms" value="<?php echo esc_attr($v['reminders_template_subject_dailysms']); ?>">
158 </label>
159 </div>
160 <?php endif; ?>
161 </div>
162
163 <div class="hc-col hc-col-3 hc-px2">
164 <ul>
165 <li>
166 <strong>__Template Tags__</strong>
167 </li>
168 <li>{DATELABEL}</li>
169 <li>{EMPLOYEE_ID}</li>
170 <li>{EMPLOYEE_NAME}</li>
171 </ul>
172 </div>
173 </div>
174
175 <p>
176 <button type="submit" class="button button-primary hc-xs-block">__Save__</button>
177 </p>
178
179 </form>
180
181 <form action="<?php echo $toReset; ?>" method="post" accept-charset="utf-8">
182
183 <p>
184 <button type="submit" class="button button-secondary hc-xs-block">&times; __Reset To Defaults__</button>
185 </p>
186
187 </form>
188
189 <?php
190 $ret = trim( ob_get_clean() );
191
192 $this->layout
193 ->setContent( $ret )
194 ->setHeader( $this->self->header() )
195 ->setBreadcrumb( $this->self->breadcrumbs() )
196 ;
197
198 $ret = $this->layout->render();
199 return $ret;
200 }
201 }