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