announcements
5 years ago
assignments
5 years ago
earning
5 years ago
enrolled-courses
5 years ago
instructor
5 years ago
my-quiz-attempts
5 years ago
notifications
5 years ago
question-answer
5 years ago
quiz-attempts
5 years ago
reviews
5 years ago
settings
5 years ago
withdraw-method-fields
5 years ago
announcements.php
5 years ago
assignments.php
5 years ago
create-course.php
5 years ago
dashboard.php
5 years ago
earning.php
5 years ago
enrolled-courses.php
5 years ago
index.php
5 years ago
logged-in.php
5 years ago
my-courses.php
5 years ago
my-profile.php
5 years ago
my-quiz-attempts.php
5 years ago
purchase_history.php
5 years ago
question-answer.php
5 years ago
quiz-attempts.php
5 years ago
registration.php
5 years ago
reviews.php
5 years ago
settings.php
5 years ago
wishlist.php
5 years ago
withdraw.php
5 years ago
announcements.php
201 lines
| 1 | <?php |
| 2 | if (!defined('ABSPATH')) |
| 3 | exit; |
| 4 | /** |
| 5 | * Template for displaying Announcements |
| 6 | * |
| 7 | * @since v.1.7.9 |
| 8 | * |
| 9 | * @author Themeum |
| 10 | * @url https://themeum.com |
| 11 | * |
| 12 | * @package TutorLMS/Templates |
| 13 | * @version 1.7.9 |
| 14 | */ |
| 15 | $per_page = 10; |
| 16 | $paged = max(1, tutor_utils()->avalue_dot('current_page', $_GET)); |
| 17 | |
| 18 | $order_filter = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
| 19 | $search_filter = isset($_GET['search']) ? sanitize_text_field($_GET['search']) : ''; |
| 20 | //announcement's parent |
| 21 | $course_id = isset($_GET['course-id']) ? sanitize_text_field($_GET['course-id']) : ''; |
| 22 | $date_filter = isset($_GET['date']) ? sanitize_text_field($_GET['date']) : ''; |
| 23 | |
| 24 | $year = date('Y', strtotime($date_filter)); |
| 25 | $month = date('m', strtotime($date_filter)); |
| 26 | $day = date('d', strtotime($date_filter)); |
| 27 | |
| 28 | $args = array( |
| 29 | 'post_type' => 'tutor_announcements', |
| 30 | 'post_status' => 'publish', |
| 31 | 's' => sanitize_text_field($search_filter), |
| 32 | 'post_parent' => sanitize_text_field($course_id), |
| 33 | 'posts_per_page' => sanitize_text_field($per_page), |
| 34 | 'paged' => sanitize_text_field($paged), |
| 35 | 'orderBy' => 'ID', |
| 36 | 'order' => sanitize_text_field($order_filter), |
| 37 | |
| 38 | ); |
| 39 | if (!empty($date_filter)) { |
| 40 | $args['date_query'] = array( |
| 41 | array( |
| 42 | 'year' => $year, |
| 43 | 'month' => $month, |
| 44 | 'day' => $day |
| 45 | ) |
| 46 | ); |
| 47 | } |
| 48 | if (!current_user_can('administrator')) { |
| 49 | $args['author'] = get_current_user_id(); |
| 50 | } |
| 51 | $the_query = new WP_Query($args); |
| 52 | |
| 53 | //get courses |
| 54 | $courses = (current_user_can('administrator')) ? tutils()->get_courses() : tutils()->get_courses_by_instructor(); |
| 55 | $image_base = tutor()->url . '/assets/images/'; |
| 56 | $notify_checked = tutils()->get_option('email_to_students.new_announcement_posted'); |
| 57 | ?> |
| 58 | |
| 59 | <div class="tutor-dashboard-content-inner tutor-frontend-dashboard-withdrawal"> |
| 60 | <h4><?php echo __('Announcement', 'tutor'); ?></h4> |
| 61 | <!--notice--> |
| 62 | <div class="withdraw-page-current-balance new-announcement-wrap"> |
| 63 | <div class="balance-info new-announcement-content"> |
| 64 | <div class="tutor-announcement-big-icon"> |
| 65 | <i class="tutor-icon-speaker"></i> |
| 66 | </div> |
| 67 | <div> |
| 68 | <small><?php _e('Create Announcement', 'tutor'); ?></small> |
| 69 | <p> |
| 70 | <strong> |
| 71 | <?php _e('Notify all students of your course', 'tutor'); ?> |
| 72 | </strong> |
| 73 | </p> |
| 74 | </div> |
| 75 | </div> |
| 76 | <div class="new-announcement-button"> |
| 77 | <button type="button" class="tutor-btn tutor-announcement-add-new"> |
| 78 | <?php _e('Add New Announcement', 'tutor'); ?> |
| 79 | </button> |
| 80 | </div> |
| 81 | </div> |
| 82 | <!--notice end--> |
| 83 | |
| 84 | </div> |
| 85 | <!--sorting--> |
| 86 | <div class="tutor-dashboard-announcement-sorting-wrap"> |
| 87 | <div class="tutor-form-group"> |
| 88 | <label for=""> |
| 89 | <?php _e('Courses', 'tutor'); ?> |
| 90 | </label> |
| 91 | <select class="tutor-report-category tutor-announcement-course-sorting ignore-nice-select"> |
| 92 | |
| 93 | <option value=""><?php _e('All', 'tutor'); ?></option> |
| 94 | |
| 95 | <?php if ($courses) : ?> |
| 96 | <?php foreach ($courses as $course) : ?> |
| 97 | <option value="<?php echo esc_attr($course->ID) ?>" <?php selected($course_id, $course->ID, 'selected') ?>> |
| 98 | <?php echo $course->post_title; ?> |
| 99 | </option> |
| 100 | <?php endforeach; ?> |
| 101 | <?php else : ?> |
| 102 | <option value=""><?php _e('No course found', 'tutor'); ?></option> |
| 103 | <?php endif; ?> |
| 104 | </select> |
| 105 | </div> |
| 106 | |
| 107 | <div class="tutor-form-group"> |
| 108 | <label><?php _e('Sort By', 'tutor'); ?></label> |
| 109 | <select class="tutor-announcement-order-sorting ignore-nice-select"> |
| 110 | <option <?php selected($order_filter, 'ASC'); ?>><?php _e('ASC', 'tutor'); ?></option> |
| 111 | <option <?php selected($order_filter, 'DESC'); ?>><?php _e('DESC', 'tutor'); ?></option> |
| 112 | </select> |
| 113 | </div> |
| 114 | |
| 115 | <div class="tutor-form-group tutor-announcement-datepicker"> |
| 116 | <label><?php _e('Date', 'tutor'); ?></label> |
| 117 | <input type="text" class="tutor-announcement-date-sorting" id="tutor-announcement-datepicker" value="<?php echo $date_filter; ?>" autocomplete="off" /> |
| 118 | <i class="tutor-icon-calendar"></i> |
| 119 | </div> |
| 120 | </div> |
| 121 | <!--sorting end--> |
| 122 | <div class="tutor-announcement-table-wrap"> |
| 123 | <table class="tutor-dashboard-announcement-table" width="100%"> |
| 124 | <thead> |
| 125 | <tr> |
| 126 | <th style="width:24%"><?php _e('Date', 'tutor'); ?></th> |
| 127 | <th style="text-align:left"><?php _e('Announcements', 'tutor'); ?></th> |
| 128 | </tr> |
| 129 | </thead> |
| 130 | <tbody> |
| 131 | <?php if ($the_query->have_posts()) : ?> |
| 132 | <?php foreach ($the_query->posts as $post) : ?> |
| 133 | <?php |
| 134 | $course = get_post($post->post_parent); |
| 135 | $dateObj = date_create($post->post_date); |
| 136 | $date_format = date_format($dateObj, 'j M, Y,<\b\r>h:i a'); |
| 137 | ?> |
| 138 | <tr id="tutor-announcement-tr-<?php echo $post->ID; ?>"> |
| 139 | <td class="tutor-announcement-date"><?php echo $date_format; ?></td> |
| 140 | <td class="tutor-announcement-content-wrap"> |
| 141 | <div class="tutor-announcement-content"> |
| 142 | <h4><?php echo esc_html($post->post_title); ?></h4> |
| 143 | <p><?php echo $course ? $course->post_title : ''; ?></p> |
| 144 | </div> |
| 145 | <div class="tutor-announcement-buttons"> |
| 146 | <li> |
| 147 | <button type="button" course-name="<?php echo esc_attr($course->post_title) ?>" announcement-date="<?php echo esc_attr($date_format) ?>" 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-details"> |
| 148 | <?php _e('Details', 'tutor'); ?> |
| 149 | </button> |
| 150 | </li> |
| 151 | <li class="tutor-dropdown"> |
| 152 | <i class="tutor-icon-action"></i> |
| 153 | <ul class="tutor-dropdown-menu"> |
| 154 | <li announcement-title="<?php echo $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-announcement-edit"> |
| 155 | <i class="tutor-icon-pencil"></i> |
| 156 | <?php _e('Edit', 'tutor'); ?> |
| 157 | </li> |
| 158 | <li class="tutor-announcement-delete" announcement-id="<?php echo $post->ID; ?>"> |
| 159 | <i class="tutor-icon-garbage"></i> |
| 160 | <?php _e('Delete', 'tutor'); ?> |
| 161 | </li> |
| 162 | </ul> |
| 163 | </li> |
| 164 | </div> |
| 165 | </td> |
| 166 | </tr> |
| 167 | <?php endforeach; ?> |
| 168 | <?php else : ?> |
| 169 | <tr> |
| 170 | <td colspan="2"> |
| 171 | <?php _e('Announcements not found', 'tutor'); ?> |
| 172 | </td> |
| 173 | </tr> |
| 174 | <?php endif; ?> |
| 175 | </tbody> |
| 176 | </table> |
| 177 | |
| 178 | </div> |
| 179 | |
| 180 | <!--pagination--> |
| 181 | <div class="tutor-pagination"> |
| 182 | <?php |
| 183 | $big = 999999999; // need an unlikely integer |
| 184 | |
| 185 | echo paginate_links( array( |
| 186 | |
| 187 | 'format' => '?current_page=%#%', |
| 188 | 'current' => $paged, |
| 189 | 'total' => $the_query->max_num_pages |
| 190 | ) ); |
| 191 | |
| 192 | ?> |
| 193 | </div> |
| 194 | <!--pagination end--> |
| 195 | |
| 196 | <?php |
| 197 | include 'announcements/create.php'; |
| 198 | include 'announcements/update.php'; |
| 199 | include 'announcements/details.php'; |
| 200 | ?> |
| 201 |