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.2 3.2.3 3.3.0 3.3.1 3.4.0 3.4.1 3.4.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
326 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 <div class="tutor-table-responsive">
183 <table class="tutor-table">
184 <thead>
185 <tr>
186 <?php if ( is_admin() ) : ?>
187 <th width="2%">
188 <div class="tutor-d-flex">
189 <input type="checkbox" id="tutor-bulk-checkbox-all" class="tutor-form-check-input">
190 </div>
191 </th>
192 <th width="17%">
193 <?php esc_html_e( 'Date', 'tutor-pro'); ?>
194 </th>
195 <?php else : ?>
196 <th width="17%">
197 <?php esc_html_e( 'Date', 'tutor'); ?>
198 </th>
199 <?php endif; ?>
200 <th>
201 <?php esc_html_e( 'Announcements', 'tutor' ); ?>
202 </th>
203 <th></th>
204 </tr>
205 </thead>
206 <tbody>
207 <?php if ( is_array( $announcements ) && count( $announcements ) ) : ?>
208 <?php foreach ( $announcements as $announcement ) : ?>
209 <?php
210 $course = get_post( $announcement->post_parent );
211 $date_format = tutor_get_formated_date( get_option( 'date_format' ), $announcement->post_date );
212 $time_format = tutor_get_formated_date( get_option( 'time_format' ), $announcement->post_date );
213
214 $update_modal_id = 'tutor_announcement_' . $announcement->ID;
215 $details_modal_id = $update_modal_id . '_details';
216 $delete_modal_id = $update_modal_id . '_delete';
217 $row_id = 'tutor-announcement-tr-' . $announcement->ID;
218 ?>
219 <tr id="<?php echo $row_id; ?>">
220 <?php if ( is_admin() ) : ?>
221 <td class="v-align-top">
222 <div class="tutor-form-check">
223 <input
224 id="tutor-admin-list-<?php esc_attr_e( $announcement->ID ); ?>"
225 type="checkbox"
226 class="tutor-form-check-input tutor-bulk-checkbox"
227 name="tutor-bulk-checkbox-all"
228 value="<?php esc_attr_e( $announcement->ID ); ?>"
229 />
230 </div>
231 </td>
232 <td width="17%" class="v-align-top">
233 <div><?php echo esc_html( $date_format ); ?></div>
234 <div class="tutor-fw-normal tutor-color-muted"><?php echo esc_html( $time_format ); ?></div>
235 </td>
236 <?php else : ?>
237 <td width="17%" class="tutor-nowrap-ellipsis">
238 <div><?php echo esc_html( $date_format ); ?></div>
239 <div class="tutor-fw-normal tutor-color-muted"><?php echo esc_html( $time_format ); ?></div>
240 </td>
241 <?php endif; ?>
242
243 <td>
244 <div>
245 <div class="td-course tutor-color-black tutor-fs-6 tutor-fw-medium">
246 <?php echo esc_html( $announcement->post_title ); ?>
247 </div>
248 <div class="tutor-fs-7 tutor-fw-medium tutor-color-muted" style="margin-top: 3px;">
249 <?php esc_html_e( 'Course', 'tutor' ); ?>: <?php echo esc_html( $course ? $course->post_title : '' ); ?>
250 </div>
251 </div>
252 </td>
253
254 <td>
255 <div class="tutor-d-flex tutor-align-center tutor-justify-end">
256 <div class="tutor-d-inline-flex tutor-align-center td-action-btns tutor-mr-4">
257 <button class="tutor-btn tutor-btn-outline-primary tutor-btn-sm tutor-announcement-details" data-tutor-modal-target="<?php echo $details_modal_id; ?>">
258 <?php esc_html_e( 'Details', 'tutor' ); ?>
259 </button>
260 </div>
261
262 <div class="tutor-dropdown-parent">
263 <button type="button" class="tutor-iconic-btn" action-tutor-dropdown="toggle">
264 <span class="tutor-icon-kebab-menu" area-hidden="true"></span>
265 </button>
266 <ul class="tutor-dropdown tutor-dropdown-dark">
267 <li>
268 <a href="#" class="tutor-dropdown-item" data-tutor-modal-target="<?php echo $update_modal_id; ?>">
269 <i class="tutor-icon-edit tutor-mr-8" area-hidden="true"></i>
270 <span><?php _e( 'Edit', 'tutor' ); ?></span>
271 </a>
272 </li>
273 <li>
274 <a href="#" class="tutor-dropdown-item" data-tutor-modal-target="<?php echo $delete_modal_id; ?>">
275 <i class="tutor-icon-trash-can-bold tutor-mr-8" area-hidden="true"></i>
276 <span><?php _e( 'Delete', 'tutor' ); ?></span>
277 </a>
278 </li>
279 </ul>
280 </div>
281 </div>
282
283 <?php
284 $course_title = isset($course->post_title)?$course->post_title:'';
285 tutor_announcement_modal( $update_modal_id, __( 'Edit Announcement', 'tutor' ), $courses, $announcement );
286 tutor_announcement_modal_details( $details_modal_id, $update_modal_id, $delete_modal_id, $announcement, $course_title, $date_format, $time_format );
287 tutor_announcement_modal_delete( $delete_modal_id, $announcement->ID, $row_id );
288 ?>
289 </td>
290 </tr>
291 <?php endforeach; ?>
292 <?php else : ?>
293 <tr>
294 <td colspan="100%" class="column-empty-state">
295 <?php tutor_utils()->tutor_empty_state( tutor_utils()->not_found_text() ); ?>
296 </td>
297 </tr>
298 <?php endif; ?>
299 </tbody>
300 </table>
301 </div>
302
303 <div class="tutor-pagination-wrapper <?php echo esc_attr( is_admin() ? 'tutor-mt-20' : 'tutor-mt-40' ); ?>">
304 <?php
305 $limit = tutor_utils()->get_option( 'pagination_per_page' );
306 if ( $the_query->found_posts > $limit ) {
307 $pagination_data = array(
308 'total_items' => $the_query->found_posts,
309 'per_page' => $limit,
310 'paged' => $paged,
311 );
312
313 $pagination_template = tutor()->path . 'views/elements/pagination.php';
314 if ( is_admin() ) {
315 tutor_load_template_from_custom_path( $pagination_template, $pagination_data );
316 } else {
317 $pagination_template_frontend = tutor()->path . 'templates/dashboard/elements/pagination.php';
318 tutor_load_template_from_custom_path( $pagination_template_frontend, $pagination_data );
319 }
320 }
321 ?>
322 </div>
323 <?php
324 tutor_announcement_modal( 'tutor_announcement_new', __( 'Create Announcement' ), $courses );
325 ?>
326