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.2 3.5.0 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 3.9.1 3.9.10 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9
tutor / views / pages / announcements.php
tutor / views / pages Last commit date
tools 5 years ago add_new_instructor.php 5 years ago addons.php 5 years ago announcements.php 5 years ago answer.php 5 years ago enable_disable_addons.php 5 years ago get-pro.php 5 years ago instructors.php 5 years ago question_answer.php 5 years ago quiz_attempts.php 5 years ago students.php 5 years ago tools.php 5 years ago tutor-pro-addons.php 5 years ago uninstall.php 5 years ago view_attempt.php 5 years ago withdraw_requests.php 5 years ago
announcements.php
352 lines
1 <?php
2 if (!defined('ABSPATH'))
3 exit;
4
5 /**
6 * Since 1.7.9
7 * configure query with get params
8 */
9 $per_page = 10;
10 $paged = (isset($_GET['paged']) && is_numeric($_GET['paged']) && $_GET['paged']>=1) ? $_GET['paged'] : 1;
11
12 $order_filter = (isset($_GET['order']) && strtolower($_GET['order'])=='asc') ? 'ASC' : 'DESC';
13 $search_filter = sanitize_text_field( tutor_utils()->array_get('search', $_GET, '') );
14 //announcement's parent
15 $course_id = sanitize_text_field( tutor_utils()->array_get('course-id', $_GET, '') );
16 $date_filter = sanitize_text_field( tutor_utils()->array_get('date', $_GET, '') );
17
18 $year = date('Y', strtotime($date_filter));
19 $month = date('m', strtotime($date_filter));
20 $day = date('d', strtotime($date_filter));
21
22 $args = array(
23 'post_type' => 'tutor_announcements',
24 'post_status' => 'publish',
25 's' => $search_filter,
26 'post_parent' => $course_id,
27 'posts_per_page' => sanitize_text_field($per_page),
28 'paged' => sanitize_text_field($paged),
29 'orderBy' => 'ID',
30 'order' => sanitize_text_field($order_filter),
31
32 );
33 if (!empty($date_filter)) {
34 $args['date_query'] = array(
35 array(
36 'year' => $year,
37 'month' => $month,
38 'day' => $day
39 )
40 );
41 }
42 if (!current_user_can('administrator')) {
43 $args['author'] = get_current_user_id();
44 }
45 $the_query = new WP_Query($args);
46 ?>
47
48 <div class="tutor-admin-search-box-container">
49
50 <div>
51 <div class="menu-label"><?php _e('Search', 'tutor'); ?></div>
52 <div>
53 <input type="text" class="tutor-report-search tutor-announcement-search-field" value="<?php echo $search_filter; ?>" autocomplete="off" placeholder="<?php _e('Search Announcements', 'tutor'); ?>" />
54 <button class="tutor-report-search-btn tutor-announcement-search-sorting"><i class="tutor-icon-magnifying-glass-1"></i></button>
55 </div>
56 </div>
57
58 <div>
59 <div class="menu-label"><?php _e('Courses', 'tutor'); ?></div>
60 <div>
61 <?php
62 //get courses
63 $courses = (current_user_can('administrator')) ? tutils()->get_courses() : tutils()->get_courses_by_instructor();
64 ?>
65
66 <select class="tutor-report-category tutor-announcement-course-sorting">
67
68 <option value=""><?php _e('All', 'tutor'); ?></option>
69
70 <?php if ($courses) : ?>
71 <?php foreach ($courses as $course) : ?>
72 <option value="<?php echo esc_attr($course->ID) ?>" <?php selected($course_id, $course->ID, 'selected') ?>>
73 <?php echo $course->post_title; ?>
74 </option>
75 <?php endforeach; ?>
76 <?php else : ?>
77 <option value=""><?php _e('No course found', 'tutor'); ?></option>
78 <?php endif; ?>
79 </select>
80 </div>
81 </div>
82
83 <div>
84 <div class="menu-label"><?php _e('Sort By', 'tutor'); ?></div>
85 <div>
86 <select class="tutor-report-sort tutor-announcement-order-sorting">
87 <option <?php selected($order_filter, 'ASC'); ?>>ASC</option>
88 <option <?php selected($order_filter, 'DESC'); ?>>DESC</option>
89 </select>
90 </div>
91 </div>
92
93 <div>
94 <div class="menu-label"><?php _e('Date', 'tutor'); ?></div>
95 <div class="date-range-input">
96 <input type="text" class="tutor-announcement-date-sorting" id="tutor-announcement-datepicker" value="<?php echo $date_filter; ?>" autocomplete="off" />
97 <i class="tutor-icon-calendar"></i>
98 </div>
99 </div>
100 </div>
101
102 <div class="tutor-list-wrap tutor-report-course-list">
103 <div class="tutor-list-header tutor-announcements-header">
104 <div class="heading"><?php _e('Announcements', 'tutor'); ?></div>
105 <button type="button" class="tutor-btn bordered-btn tutor-announcement-add-new">
106 <?php _e('Add new', 'tutor'); ?>
107 </button>
108 </div>
109
110 <table class="tutor-list-table tutor-announcement-table">
111 <thead>
112 <tr>
113 <th style="width:20%"><?php _e('Date', 'tutor'); ?></th>
114 <th><?php _e('Announcements', 'tutor'); ?></th>
115 </tr>
116 </thead>
117 <tbody>
118 <?php if ($the_query->have_posts()) : ?>
119 <?php foreach ($the_query->posts as $post) : ?>
120 <?php
121 $course = get_post($post->post_parent);
122 $dateObj = date_create($post->post_date);
123 $date_format = date_format($dateObj, 'F j, Y, g:i a');
124 ?>
125 <tr id="tutor-announcement-tr-<?php echo $post->ID; ?>">
126 <td class="tutor-announcement-date"><?php echo esc_html($date_format); ?></td>
127 <td class="tutor-announcement-content-wrap">
128 <div class="tutor-announcement-content">
129 <span>
130 <?php echo esc_html($post->post_title); ?>
131 </span>
132 <p>
133 <?php echo $course ? $course->post_title : ''; ?>
134 </p>
135 </div>
136 <div class="tutor-announcement-buttons">
137
138 <button type="button" announcement-title="<?php echo esc_attr($post->post_title); ?>" announcement-summary="<?php echo $post->post_content; ?>" course-id="<?php echo $post->post_parent; ?>" announcement-id="<?php echo $post->ID; ?>" class="tutor-btn bordered-btn tutor-announcement-edit">
139 <?php _e('Edit', 'tutor'); ?>
140 </button>
141 <button type="button" class="tutor-btn bordered-btn tutor-announcement-delete" announcement-id="<?php echo $post->ID; ?>">
142 <?php _e('Delete', 'tutor'); ?>
143 </button>
144
145 </div>
146 </td>
147 </tr>
148 <?php endforeach; ?>
149 <?php else : ?>
150 <tr>
151 <td colspan="2">
152 <?php _e('Announcements not found', 'tutor'); ?>
153 </td>
154 </tr>
155 <?php endif; ?>
156 </tbody>
157 </table>
158
159 </div>
160
161 <!--pagination-->
162 <div class="tutor-announcement-pagination">
163 <?php
164 $big = 999999999; // need an unlikely integer
165
166 echo paginate_links(array(
167 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
168 'format' => '?paged=%#%',
169 'current' => $paged,
170 'total' => $the_query->max_num_pages
171 ));
172 ?>
173 </div>
174 <!--pagination end-->
175
176 <?php
177 $notify_checked = tutils()->get_option('email_to_students.new_announcement_posted');
178 ?>
179 <!--create announcements modal-->
180 <div class="tutor-modal-wrap tutor-announcements-modal-wrap tutor-announcement-create-modal" id="tutor-annoucement-backend-create-modal">
181 <div class="tutor-modal-content">
182 <div class="modal-header">
183 <div class="modal-title">
184 <h1><?php _e('Create New Announcement', 'tutor'); ?></h1>
185 </div>
186 <div class="tutor-announcements-modal-close-wrap">
187 <a href="#" class="tutor-announcement-close-btn">
188 <i class="tutor-icon-line-cross"></i>
189 </a>
190 </div>
191 </div>
192 <div class="modal-container">
193 <form action="" class="tutor-announcements-form">
194 <?php tutor_nonce_field(); ?>
195 <div class="tutor-option-field-row">
196 <label for="tutor_announcement_course">
197 <?php _e('Select Course', 'tutor'); ?>
198 </label>
199
200 <div class="tutor-announcement-form-control">
201 <select name="tutor_announcement_course" id="" required>
202 <?php if ($courses) : ?>
203 <?php foreach ($courses as $course) : ?>
204
205 <option value="<?php echo esc_attr($course->ID) ?>">
206 <?php echo $course->post_title; ?>
207 </option>
208 <?php endforeach; ?>
209 <?php else : ?>
210 <option value="">No course found</option>
211 <?php endif; ?>
212 </select>
213
214 </div>
215 </div>
216
217 <div class="tutor-option-field-row">
218 <label for="tutor_announcement_course">
219 <?php _e('Announcement Title', 'tutor'); ?>
220 </label>
221
222 <div class="tutor-announcement-form-control">
223 <input type="text" name="tutor_announcement_title" value="" placeholder="<?php _e('Announcement title', 'tutor'); ?>" required>
224 </div>
225 </div>
226
227 <div class="tutor-option-field-row">
228 <label for="tutor_announcement_course">
229 <?php _e('Summary', 'tutor'); ?>
230 </label>
231
232 <div class="tutor-announcement-form-control">
233 <textarea rows="6" type="text" name="tutor_announcement_summary" value="" placeholder="<?php _e('Summary...', 'tutor'); ?>" required></textarea>
234 </div>
235 </div>
236 <?php if ($notify_checked) : ?>
237 <div class="tutor-option-field-row">
238
239 <label for="notify_student">
240 <input type="checkbox" name="tutor_notify_students" id="notify_student" checked>
241 <?php _e('Notify to all students of this course.', 'tutor'); ?>
242 </label>
243
244 </div>
245 <?php endif; ?>
246 <div class="tutor-option-field-row">
247 <div class="tutor-announcements-create-alert"></div>
248 </div>
249
250 <div class="modal-footer">
251 <div class="tutor-quiz-builder-modal-control-btn-group">
252 <div class="quiz-builder-btn-group-left">
253 <button type="submit" class="tutor-btn"><?php _e('Publish', 'tutor') ?></button>
254 </div>
255 <div class="quiz-builder-btn-group-right">
256 <button type="button" class="quiz-modal-tab-navigation-btn quiz-modal-btn-cancel tutor-announcement-close-btn"><?php _e('Cancel', 'tutor') ?></button>
257 </div>
258 </div>
259 </div>
260 </form>
261 </div>
262 </div>
263 </div>
264 <!--create announcements modal end-->
265
266 <!--update announcements modal-->
267 <div class="tutor-modal-wrap tutor-announcements-modal-wrap tutor-accouncement-update-modal">
268 <div class="tutor-modal-content">
269 <div class="modal-header">
270 <div class="modal-title">
271 <h1><?php _e('Update Announcement', 'tutor'); ?></h1>
272 </div>
273 <div class="tutor-announcements-modal-close-wrap">
274 <a href="#" class="tutor-announcement-close-btn">
275 <i class="tutor-icon-line-cross"></i>
276 </a>
277 </div>
278 </div>
279
280 <div class="modal-container">
281 <form action="" class="tutor-announcements-update-form">
282 <?php tutor_nonce_field(); ?>
283 <input type="hidden" name="announcement_id" id="announcement_id">
284 <div class="tutor-option-field-row">
285 <label for="tutor_announcement_course">
286 <?php _e('Select Course', 'tutor'); ?>
287 </label>
288
289 <div class="tutor-announcement-form-control">
290 <select name="tutor_announcement_course" id="tutor-announcement-course-id" required>
291 <?php if ($courses) : ?>
292 <?php foreach ($courses as $course) : ?>
293
294 <option value="<?php echo esc_attr($course->ID) ?>">
295 <?php echo $course->post_title; ?>
296 </option>
297 <?php endforeach; ?>
298 <?php else : ?>
299 <option value="">No course found</option>
300 <?php endif; ?>
301 </select>
302
303 </div>
304 </div>
305
306 <div class="tutor-option-field-row">
307 <label for="tutor_announcement_course">
308 <?php _e('Announcement Title', 'tutor'); ?>
309 </label>
310
311 <div class="tutor-announcement-form-control">
312 <input type="text" name="tutor_announcement_title" id="tutor-announcement-title" value="" placeholder="<?php _e('Announcement title', 'tutor'); ?>" required>
313 </div>
314 </div>
315
316 <div class="tutor-option-field-row">
317 <label for="tutor_announcement_course">
318 <?php _e('Summary', 'tutor'); ?>
319 </label>
320
321 <div class="tutor-announcement-form-control">
322 <textarea rows="6" type="text" id="tutor-announcement-summary" name="tutor_announcement_summary" value="" placeholder="<?php _e('Summary...', 'tutor'); ?>" required></textarea>
323 </div>
324 </div>
325 <?php if ($notify_checked) : ?>
326 <div class="tutor-option-field-row">
327 <label for="notify_student_upate">
328 <input type="checkbox" name="tutor_notify_students" id="notify_student_upate">
329 <?php _e('Notify to all students of this course.', 'tutor'); ?>
330 </label>
331 </div>
332 <?php endif; ?>
333
334 <div class="tutor-option-field-row">
335 <div class="tutor-announcements-update-alert"></div>
336 </div>
337
338 <div class="modal-footer">
339 <div class="tutor-quiz-builder-modal-control-btn-group">
340 <div class="quiz-builder-btn-group-left">
341 <button type="submit" class="tutor-btn"><?php _e('Update', 'tutor') ?></button>
342 </div>
343 <div class="quiz-builder-btn-group-right">
344 <button type="button" class="quiz-modal-tab-navigation-btn quiz-modal-btn-cancel tutor-announcement-close-btn"><?php _e('Cancel', 'tutor') ?></button>
345 </div>
346 </div>
347 </div>
348 </form>
349 </div>
350 </div>
351 </div>
352 <!--update announcements modal end-->