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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 / fragments / announcement-list.php
tutor / views / fragments Last commit date
announcement-list.php 4 years ago attachments.php 4 years ago quiz-list-single.php 4 years ago thumbnail-uploader.php 4 years ago
announcement-list.php
355 lines
1 <?php
2
3 function tutor_announcement_modal( $id, $title, $courses, $announcement = null ) {
4 $course_id = $announcement ? $announcement->post_parent : null;
5 $announcment_id = $announcement ? $announcement->ID : null;
6 $announcment_title = $announcement ? $announcement->post_title : '';
7 $summary = $announcement ? $announcement->post_content : '';
8 // Assign fallback course id
9 ( ! $course_id && count( $courses ) ) ? $course_id = $courses[0]->ID : 0;
10 ?>
11 <form class="tutor-modal tutor-modal-scrollable tutor-announcements-form" id="<?php echo $id; ?>">
12 <div class="tutor-modal-overlay"></div>
13 <div class="tutor-modal-window">
14 <div class="tutor-modal-content">
15 <div class="tutor-modal-header">
16 <div class="tutor-modal-title">
17 <?php echo esc_html( $title ); ?>
18 </div>
19 <button class="tutor-modal-close tutor-iconic-btn" data-tutor-modal-close role="button">
20 <span class="tutor-icon-times" area-hidden="true"></span>
21 </button>
22 </div>
23
24 <div class="tutor-modal-body">
25 <?php tutor_nonce_field(); ?>
26 <input type="hidden" name="announcement_id" value="<?php echo esc_attr( $announcment_id ); ?>">
27 <input type="hidden" name="action" value="tutor_announcement_create"/>
28 <input type="hidden" name="action_type" value="<?php echo esc_attr( $announcement ? 'update' : 'create' ); ?>"/>
29 <div class="tutor-mb-32">
30 <label class="tutor-form-label">
31 <?php esc_html_e( 'Select Course', 'tutor' ); ?>
32 </label>
33 <select class="tutor-form-select" name="tutor_announcement_course" required>
34 <?php if ( $courses ) : ?>
35 <?php foreach ( $courses as $course ) : ?>
36 <option value="<?php echo esc_attr( $course->ID ); ?>" <?php selected( $course_id, $course->ID ); ?>>
37 <?php echo esc_html( $course->post_title ); ?>
38 </option>
39 <?php endforeach; ?>
40 <?php else : ?>
41 <option value=""><?php esc_html_e( 'No course found', 'tutor' ); ?></option>
42 <?php endif; ?>
43 </select>
44 </div>
45
46 <div class="tutor-mb-32">
47 <label class="tutor-form-label">
48 <?php esc_html_e( 'Announcement Title', 'tutor' ); ?>
49 </label>
50 <input class="tutor-form-control" type="text" name="tutor_announcement_title" value="<?php echo $announcment_title; ?>" placeholder="<?php esc_html_e( 'Announcement title', 'tutor' ); ?>" maxlength="255" required>
51 </div>
52
53 <div class="tutor-mb-32">
54 <label class="tutor-form-label" for="tutor_announcement_course">
55 <?php esc_html_e( 'Summary', 'tutor' ); ?>
56 </label>
57 <textarea style="resize: unset;" class="tutor-form-control" rows="6" type="text" name="tutor_announcement_summary" placeholder="<?php esc_html_e( 'Summary...', 'tutor' ); ?>" required><?php echo esc_textarea( $summary ); ?></textarea>
58 </div>
59
60 <?php do_action( 'tutor_announcement_editor/after' ); ?>
61 </div>
62
63 <div class="tutor-modal-footer">
64 <button data-tutor-modal-close type="button" data-action="back" class="tutor-btn tutor-btn-outline-primary">
65 <?php esc_html_e( 'Cancel', 'tutor' ); ?>
66 </button>
67 <button type="submit" data-action="next" class="tutor-btn tutor-btn-primary">
68 <?php esc_html_e( 'Publish', 'tutor' ); ?>
69 </button>
70 </div>
71 </div>
72 </div>
73 </form>
74 <?php
75 }
76
77 function tutor_announcement_modal_details( $id, $update_modal_id, $delete_modal_id, $announcement, $course_title, $publish_date, $publish_time ) {
78 ?>
79 <div id="<?php echo $id; ?>" class="tutor-modal">
80 <div class="tutor-modal-overlay"></div>
81 <div class="tutor-modal-window">
82 <div class="tutor-modal-content tutor-modal-content-white">
83 <button class="tutor-iconic-btn tutor-modal-close-o" data-tutor-modal-close>
84 <span class="tutor-icon-times" area-hidden="true"></span>
85 </button>
86
87 <div class="tutor-modal-body">
88 <div class="tutor-py-20 tutor-px-24">
89 <span class="tutor-round-box tutor-round-box-lg tutor-mb-32">
90 <i class="tutor-icon-bullhorn" area-hidden="true"></i>
91 </span>
92 <div class="tutor-fs-4 tutor-fw-medium tutor-color-black tutor-mb-24"><?php echo $announcement->post_title; ?></div>
93 <div class="tutor-fs-6 tutor-color-muted"><?php echo $announcement->post_content; ?></div>
94 </div>
95
96 <div class="tutor-mx-n32 tutor-my-32"><div class="tutor-hr" area-hidden="true"></div></div>
97
98 <div class="tutor-py-20 tutor-px-24">
99 <div class="tutor-row tutor-mb-60">
100 <div class="tutor-col-lg-7 tutor-mb-16 tutor-mb-lg-0">
101 <div class="tutor-fs-7 tutor-color-secondary">
102 <?php _e( 'Course', 'tutor' ); ?>
103 </div>
104 <div class="tutor-fs-6 tutor-fw-bold tutor-color-black tutor-mt-4">
105 <?php echo $course_title; ?>
106 </div>
107 </div>
108
109 <div class="tutor-col-lg-5">
110 <div class="tutor-fs-7 tutor-color-secondary">
111 <?php _e( 'Published Date', 'tutor' ); ?>
112 </div>
113 <div class="tutor-fs-6 tutor-fw-bold tutor-color-black tutor-mt-4">
114 <?php echo $publish_date . ', ' . $publish_time; ?>
115 </div>
116 </div>
117 </div>
118
119 <div class="tutor-row">
120 <div class="tutor-col-6 tutor-col-lg-7">
121 <button class="tutor-btn tutor-btn-outline-primary tutor-btn-md" data-tutor-modal-close>
122 <?php _e( 'Cancel', 'tutor' ); ?>
123 </button>
124 </div>
125
126 <div class="tutor-col-6 tutor-col-lg-5">
127 <div class="tutor-d-flex tutor-justify-end">
128 <button data-tutor-modal-target="<?php echo $delete_modal_id; ?>" class="tutor-btn tutor-btn-secondary tutor-btn-md tutor-modal-btn-delete">
129 <?php _e( 'Delete', 'tutor' ); ?>
130 </button>
131 <button data-tutor-modal-target="<?php echo $update_modal_id; ?>" class="tutor-btn tutor-btn-primary tutor-btn-md tutor-modal-btn-edit tutor-ml-16">
132 <?php _e( 'Edit', 'tutor' ); ?>
133 </button>
134 </div>
135 </div>
136 </div>
137 </div>
138 </div>
139 </div>
140 </div>
141 </div>
142 <?php
143 }
144
145 function tutor_announcement_modal_delete( $id, $announcment_id, $row_id ) {
146 ?>
147 <div id="<?php echo $id; ?>" class="tutor-modal">
148 <div class="tutor-modal-overlay"></div>
149 <div class="tutor-modal-window">
150 <div class="tutor-modal-content tutor-modal-content-white">
151 <button class="tutor-iconic-btn tutor-modal-close-o" data-tutor-modal-close>
152 <span class="tutor-icon-times" area-hidden="true"></span>
153 </button>
154
155 <div class="tutor-modal-body tutor-text-center">
156 <div class="tutor-mt-48">
157 <img class="tutor-d-inline-block" src="<?php echo tutor()->url; ?>assets/images/icon-trash.svg" />
158 </div>
159
160 <div class="tutor-fs-3 tutor-fw-medium tutor-color-black tutor-mb-12"><?php _e( 'Delete This Announcement?', 'tutor' ); ?></div>
161 <div class="tutor-fs-6 tutor-color-muted"><?php _e( 'Are you sure you want to delete this Announcement permanently from the site? Please confirm your choice.', 'tutor' ); ?></div>
162
163 <div class="tutor-d-flex tutor-justify-center tutor-my-48">
164 <button class="tutor-btn tutor-btn-outline-primary" data-tutor-modal-close>
165 <?php esc_html_e('Cancel', 'tutor'); ?>
166 </button>
167 <button class="tutor-btn tutor-btn-primary tutor-list-ajax-action tutor-ml-20" data-request_data='{"announcement_id":<?php echo $announcment_id; ?>, "action":"tutor_announcement_delete"}' data-delete_element_id="<?php echo $row_id; ?>">
168 <?php esc_html_e('Yes, Delete This', 'tutor'); ?>
169 </button>
170 </div>
171 </div>
172 </div>
173 </div>
174 </div>
175 <?php
176 }
177
178 extract( $data );
179 $courses = ( current_user_can( 'administrator' ) ) ? tutor_utils()->get_courses() : tutor_utils()->get_courses_by_instructor();
180 ?>
181
182 <!-- Now Load The View -->
183 <div class="tutor-table-wrapper">
184 <table class="tutor-table tutor-table-responsive">
185 <thead>
186 <tr>
187 <?php if ( is_admin() ) : ?>
188 <th width="2%">
189 <div class="tutor-d-flex">
190 <input type="checkbox" id="tutor-bulk-checkbox-all" class="tutor-form-check-input">
191 </div>
192 </th>
193 <th width="17%">
194 <div class="tutor-fs-7 tutor-color-secondary">
195 <?php esc_html_e( 'Date', 'tutor-pro'); ?>
196 </div>
197 </th>
198 <?php else : ?>
199 <th width="17%" class="tutor-shrink">
200 <span class="tutor-fs-7 tutor-color-secondary">
201 <?php esc_html_e( 'Date', 'tutor'); ?>
202 </span>
203 </th>
204 <?php endif; ?>
205 <th>
206 <div class="tutor-color-secondary tutor-fs-7">
207 <?php esc_html_e( 'Announcements', 'tutor' ); ?>
208 </div>
209 </th>
210 <th class="tutor-shrink"></th>
211 </tr>
212 </thead>
213 <tbody>
214 <?php if ( is_array( $announcements ) && count( $announcements ) ) : ?>
215 <?php foreach ( $announcements as $announcement ) : ?>
216 <?php
217 $course = get_post( $announcement->post_parent );
218 $date_format = tutor_get_formated_date( get_option( 'date_format' ), $announcement->post_date );
219 $time_format = tutor_get_formated_date( get_option( 'time_format' ), $announcement->post_date );
220
221 $update_modal_id = 'tutor_announcement_' . $announcement->ID;
222 $details_modal_id = $update_modal_id . '_details';
223 $delete_modal_id = $update_modal_id . '_delete';
224 $row_id = 'tutor-announcement-tr-' . $announcement->ID;
225 ?>
226 <tr id="<?php echo $row_id; ?>">
227 <?php if ( is_admin() ) : ?>
228 <td data-th="<?php esc_html_e( 'Select', 'tutor' ); ?>" class="v-align-top">
229 <div class="tutor-form-check">
230 <input
231 id="tutor-admin-list-<?php esc_attr_e( $announcement->ID ); ?>"
232 type="checkbox"
233 class="tutor-form-check-input tutor-bulk-checkbox"
234 name="tutor-bulk-checkbox-all"
235 value="<?php esc_attr_e( $announcement->ID ); ?>"
236 />
237 </div>
238 </td>
239 <td data-th="<?php esc_html_e( 'Date', 'tutor' ); ?>" width="17%" class="v-align-top">
240 <div class="td-datetime tutor-fs-7 tutor-color-black">
241 <div class="tutor-fw-medium"><?php echo esc_html( $date_format ); ?></div>
242 <div><?php echo esc_html( $time_format ); ?></div>
243 </div>
244 </td>
245 <?php else : ?>
246 <td data-th="<?php esc_html_e( 'Date', 'tutor' ); ?>" width="17%" class="tutor-nowrap-ellipsis">
247 <div class="td-datetime">
248 <div class="tutor-date tutor-fs-7 tutor-fw-medium tutor-color-black"><?php echo esc_html( $date_format ); ?></div>
249 <div class="tutor-fs-7 tutor-color-black"><?php echo esc_html( $time_format ); ?></div>
250 </div>
251 </td>
252 <?php endif; ?>
253
254 <td data-th="<?php esc_html_e( 'Announcement', 'tutor' ); ?>">
255 <div>
256 <div class="td-course tutor-color-black tutor-fs-6 tutor-fw-medium">
257 <?php echo esc_html( $announcement->post_title ); ?>
258 </div>
259 <div class="tutor-fs-7 tutor-fw-medium tutor-color-secondary" style="margin-top: 3px;">
260 <?php esc_html_e( 'Course', 'tutor' ); ?>: <?php echo esc_html( $course ? $course->post_title : '' ); ?>
261 </div>
262 </div>
263 </td>
264 <td data-th="<?php esc_html_e( 'Action', 'tutor' ); ?>">
265 <div class="tutor-d-flex tutor-align-center tutor-justify-end">
266 <div class="tutor-d-inline-flex tutor-align-center td-action-btns tutor-mr-4">
267 <button class="tutor-btn tutor-btn-outline-primary tutor-btn-sm tutor-announcement-details" data-tutor-modal-target="<?php echo $details_modal_id; ?>">
268 <?php esc_html_e( 'Details', 'tutor' ); ?>
269 </button>
270 </div>
271
272 <div class="tutor-dropdown-parent">
273 <button type="button" class="tutor-iconic-btn" action-tutor-dropdown="toggle">
274 <span class="tutor-icon-kebab-menu" area-hidden="true"></span>
275 </button>
276 <ul class="tutor-dropdown tutor-dropdown-dark">
277 <li>
278 <a href="#" class="tutor-dropdown-item" data-tutor-modal-target="<?php echo $update_modal_id; ?>">
279 <i class="tutor-icon-edit tutor-mr-8" area-hidden="true"></i>
280 <span><?php _e( 'Edit', 'tutor' ); ?></span>
281 </a>
282 </li>
283 <li>
284 <a href="#" class="tutor-dropdown-item" data-tutor-modal-target="<?php echo $delete_modal_id; ?>">
285 <i class="tutor-icon-trash-can-bold tutor-mr-8" area-hidden="true"></i>
286 <span><?php _e( 'Delete', 'tutor' ); ?></span>
287 </a>
288 </li>
289 </ul>
290 </div>
291 </div>
292
293 <?php
294 $course_title = isset($course->post_title)?$course->post_title:'';
295 tutor_announcement_modal( $update_modal_id, __( 'Edit Announcement', 'tutor' ), $courses, $announcement );
296 tutor_announcement_modal_details( $details_modal_id, $update_modal_id, $delete_modal_id, $announcement, $course_title, $date_format, $time_format );
297 tutor_announcement_modal_delete( $delete_modal_id, $announcement->ID, $row_id );
298 ?>
299 </td>
300 </tr>
301 <?php endforeach; ?>
302 <?php else : ?>
303 <tr>
304 <td colspan="100%" class="column-empty-state">
305 <?php tutor_utils()->tutor_empty_state( tutor_utils()->not_found_text() ); ?>
306 </td>
307 </tr>
308 <?php endif; ?>
309 </tbody>
310 </table>
311 </div>
312
313 <div class="tutor-pagination-wrapper tutor-mt-40 <?php echo esc_attr( is_admin() ? 'tutor-mt-20' : '' ); ?>">
314 <?php
315 // Need an unlikely integer.
316 // $big = 999999999;
317 // $pages = paginate_links( array(
318 // 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
319 // 'format' => '?current_page=%#%',
320 // 'current' => $paged,
321 // 'total' => $the_query->max_num_pages,
322 // 'type' => 'array',
323 // 'previous_text' => '<span class="tutor-icon-angle-left"></span>',
324 // 'next_text' => '<span class="tutor-icon-angle-right"></span>'
325 // ));
326
327 /**
328 * Prepare pagination data & load template
329 */
330 $limit = tutor_utils()->get_option( 'pagination_per_page' );
331 if($the_query->found_posts > $limit) {
332 $pagination_data = array(
333 'total_items' => $the_query->found_posts,
334 'per_page' => $limit,
335 'paged' => $paged,
336 );
337
338 $pagination_template = tutor()->path . 'views/elements/pagination.php';
339 if ( is_admin() ) {
340 tutor_load_template_from_custom_path( $pagination_template, $pagination_data );
341 } else {
342 $pagination_template_frontend = tutor()->path . 'templates/dashboard/elements/pagination.php';
343 tutor_load_template_from_custom_path( $pagination_template_frontend, $pagination_data );
344 }
345 }
346
347 ?>
348 </div>
349
350
351
352 <?php
353 tutor_announcement_modal( 'tutor_announcement_new', __( 'Create Announcement' ), $courses );
354 ?>
355