announcements
4 years ago
assignments
4 years ago
elements
4 years ago
enrolled-courses
4 years ago
instructor
4 years ago
my-courses
4 years ago
my-quiz-attempts
4 years ago
notifications
4 years ago
question-answer
4 years ago
quiz-attempts
4 years ago
reviews
4 years ago
settings
4 years ago
withdraw-method-fields
4 years ago
announcements.php
4 years ago
assignments.php
4 years ago
create-course.php
4 years ago
dashboard.php
4 years ago
enrolled-courses.php
4 years ago
index.php
4 years ago
logged-in.php
4 years ago
my-courses.php
4 years ago
my-profile.php
4 years ago
my-quiz-attempts.php
4 years ago
purchase_history.php
4 years ago
question-answer.php
4 years ago
quiz-attempts.php
4 years ago
registration.php
4 years ago
reviews.php
4 years ago
settings.php
4 years ago
wishlist.php
4 years ago
withdraw.php
4 years ago
create-course.php
299 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package TutorLMS/Templates |
| 5 | * @version 1.4.3 |
| 6 | */ |
| 7 | |
| 8 | |
| 9 | if (!defined('ABSPATH')) { |
| 10 | exit; |
| 11 | } |
| 12 | |
| 13 | global $post; |
| 14 | |
| 15 | get_tutor_header(true); |
| 16 | do_action('tutor_load_template_before', 'dashboard.create-course', null); |
| 17 | |
| 18 | $course_id = get_the_ID(); |
| 19 | $can_publish_course = (bool) tutor_utils()->get_option('instructor_can_publish_course') || current_user_can('administrator'); |
| 20 | ?> |
| 21 | |
| 22 | <?php |
| 23 | if (!tutor_utils()->is_instructor(get_current_user_id(), true) || !tutor_utils()->can_user_edit_course(get_current_user_id(), $course_id)) { |
| 24 | $args = array( |
| 25 | 'headline' => __('Permission Denied', 'tutor'), |
| 26 | 'message' => __('You don\'t have the right to edit this course', 'tutor'), |
| 27 | 'description' => __('Please make sure you are logged in to correct account', 'tutor'), |
| 28 | 'button' => array( |
| 29 | 'url' => get_permalink($course_id), |
| 30 | 'text' => __('View Course', 'tutor'), |
| 31 | ), |
| 32 | ); |
| 33 | |
| 34 | tutor_load_template('permission-denied', $args); |
| 35 | return; |
| 36 | } |
| 37 | ?> |
| 38 | |
| 39 | <?php do_action('tutor/dashboard_course_builder_before'); ?> |
| 40 | <form action="" id="tutor-frontend-course-builder" method="post" enctype="multipart/form-data"> |
| 41 | <?php wp_nonce_field(tutor()->nonce_action, tutor()->nonce); ?> |
| 42 | |
| 43 | <!-- Sticky header with course action buttons --> |
| 44 | <header class="tutor-dashboard-builder-header tutor-mb-32"> |
| 45 | <div class="tutor-container-fluid"> |
| 46 | <div class="tutor-row tutor-align-center"> |
| 47 | <div class="tutor-col-auto"> |
| 48 | <div class="tutor-dashboard-builder-header-left"> |
| 49 | <div class="tutor-dashboard-builder-logo"> |
| 50 | <?php $tutor_course_builder_logo_src = apply_filters('tutor_course_builder_logo_src', tutor()->url . 'assets/images/tutor-logo.png'); ?> |
| 51 | <img src="<?php echo esc_url($tutor_course_builder_logo_src); ?>" alt=""> |
| 52 | </div> |
| 53 | <button type="submit" class="tutor-dashboard-builder-draft-btn" name="course_submit_btn" value="save_course_as_draft"> |
| 54 | <!-- @TODO: Icon must be chenged --> |
| 55 | <i class="tutor-icon-save-line tutor-fs-5 tutor-mr-8"></i> |
| 56 | <span class="tutor-color-secondary"><?php _e('Save', 'tutor'); ?></span> |
| 57 | </button> |
| 58 | </div> |
| 59 | </div> |
| 60 | <div class="tutor-col tutor-mt-12 tutor-mb-12"> |
| 61 | <div class="tutor-dashboard-builder-header-right tutor-d-flex tutor-align-center tutor-justify-end"> |
| 62 | <a class="tutor-btn tutor-btn-outline-primary tutor-btn-md" href="<?php echo esc_url( get_the_permalink($course_id) ); ?>" target="_blank"> |
| 63 | <?php _e('Preview', 'tutor'); ?> |
| 64 | </a> |
| 65 | <?php if ($can_publish_course): ?> |
| 66 | <button class="tutor-btn tutor-btn-primary tutor-btn-md tutor-ml-16" type="submit" name="course_submit_btn" value="publish_course"> |
| 67 | <?php _e('Publish', 'tutor'); ?> |
| 68 | </button> |
| 69 | <?php else: ?> |
| 70 | <button class="tutor-btn tutor-btn-primary tutor-btn-md tutor-ml-16" type="submit" name="course_submit_btn" value="submit_for_review" title="<?php _e('Submit for Review', 'tutor'); ?>"> |
| 71 | <?php _e('Submit', 'tutor'); ?> |
| 72 | </button> |
| 73 | <?php endif; ?> |
| 74 | <a href="<?php echo tutor_utils()->tutor_dashboard_url(); ?>" class="tutor-iconic-btn tutor-iconic-btn-md tutor-ml-16" title="<?php _e('Exit', 'tutor'); ?>"><i class="tutor-icon-times" area-hidden="true"></i></a> |
| 75 | </div> |
| 76 | </div> |
| 77 | </div> |
| 78 | </div> |
| 79 | </header> |
| 80 | |
| 81 | <!-- Course builder body --> |
| 82 | <div class="tutor-container"> |
| 83 | <div class="tutor-row"> |
| 84 | <div class="tutor-col-12 tutor-col-lg-8 tutor-mb-32 tutor-pr-32"> |
| 85 | <input type="hidden" value="tutor_add_course_builder" name="tutor_action" /> |
| 86 | <input type="hidden" name="course_ID" id="course_ID" value="<?php echo get_the_ID(); ?>"> |
| 87 | <input type="hidden" name="post_ID" id="post_ID" value="<?php echo get_the_ID(); ?>"> |
| 88 | |
| 89 | <!--since 1.8.0 alert message --> |
| 90 | <?php |
| 91 | $user_id = get_current_user_id(); |
| 92 | $expires = get_user_meta($user_id, 'tutor_frontend_course_message_expires', true); |
| 93 | $message = get_user_meta($user_id, 'tutor_frontend_course_action_message', true); |
| 94 | |
| 95 | if ($message && $expires && $expires > time()) { |
| 96 | $show_modal = $message['show_modal']; |
| 97 | $message = $message['message']; |
| 98 | |
| 99 | if (!$show_modal) { |
| 100 | ?> |
| 101 | <div class="tutor-alert tutor-alert-info"> |
| 102 | <?php echo $message; ?> |
| 103 | </div> |
| 104 | <?php } else { ?> |
| 105 | <!-- @todo: move to toast --> |
| 106 | <div id="modal-course-save-feedback" class="tutor-modal tutor-is-active"> |
| 107 | <span class="tutor-modal-overlay"></span> |
| 108 | <div class="tutor-modal-window tutor-modal-window-md"> |
| 109 | <div class="tutor-modal-content tutor-modal-content-white"> |
| 110 | <button class="tutor-iconic-btn tutor-modal-close-o" data-tutor-modal-close> |
| 111 | <span class="tutor-icon-times" area-hidden="true"></span> |
| 112 | </button> |
| 113 | |
| 114 | <div class="tutor-modal-body tutor-text-center"> |
| 115 | <div class="tutor-py-48"> |
| 116 | <img class="tutor-d-inline-block" src="<?php echo tutor()->url; ?>assets/images/icon-cup.svg" /> |
| 117 | <div class="tutor-fs-3 tutor-fw-medium tutor-color-black tutor-mb-12"><?php _e('Thank You!', 'tutor'); ?></div> |
| 118 | <div class="tutor-fs-6 tutor-color-muted"><?php echo $message; ?></div> |
| 119 | </div> |
| 120 | </div> |
| 121 | </div> |
| 122 | </div> |
| 123 | </div> |
| 124 | <script> |
| 125 | const alertBox = document.getElementById('modal-course-save-feedback'); |
| 126 | setTimeout(() => { |
| 127 | if (alertBox) alertBox.classList.remove('tutor-is-active'); |
| 128 | }, 5000) |
| 129 | </script> |
| 130 | <?php |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | if ($message || $expires) { |
| 135 | delete_user_meta($user_id, 'tutor_frontend_course_message_expires'); |
| 136 | delete_user_meta($user_id, 'tutor_frontend_course_action_message'); |
| 137 | } |
| 138 | ?> |
| 139 | <!--alert message end --> |
| 140 | <?php do_action('tutor/dashboard_course_builder_form_field_before'); ?> |
| 141 | |
| 142 | <div class="tutor-course-builder-section tutor-course-builder-info"> |
| 143 | <div class="tutor-course-builder-section-title"> |
| 144 | <span class="tutor-fs-5 tutor-fw-bold tutor-color-secondary"> |
| 145 | <i class="color-text-brand tutor-icon-angle-up tutor-fs-5" area-hidden="true"></i> |
| 146 | <span><?php esc_html_e('Course Info', 'tutor'); ?></span> |
| 147 | </span> |
| 148 | </div> |
| 149 | <!--.tutor-course-builder-section-title--> |
| 150 | <div class="tutor-course-builder-section-content"> |
| 151 | <div class="tutor-mb-32"> |
| 152 | <label class="tutor-course-field-label tutor-fs-6 tutor-color-black"><?php _e('Course Title', 'tutor'); ?></label> |
| 153 | <div id="tutor-course-create-title-tooltip-wrapper" class="tooltip-wrap tutor-d-block"> |
| 154 | <span class="tooltip-txt tooltip-right tutor-mt-12"> |
| 155 | <?php _e('255', 'tutor'); ?> |
| 156 | </span> |
| 157 | <input id="tutor-course-create-title" type="text" name="title" class="tutor-form-control" value="<?php echo get_the_title(); ?>" placeholder="<?php _e('ex. Learn Photoshop CS6 from scratch', 'tutor'); ?>" maxlength="255"> |
| 158 | </div> |
| 159 | </div> |
| 160 | |
| 161 | <div class="tutor-mb-32"> |
| 162 | <label class="tutor-course-field-label tutor-fs-6 tutor-color-black"><?php _e('About Course', 'tutor'); ?></label> |
| 163 | <div class="tutor-mb-16"> |
| 164 | <?php |
| 165 | $editor_settings = array( |
| 166 | 'media_buttons' => false, |
| 167 | 'quicktags' => false, |
| 168 | 'editor_height' => 150, |
| 169 | 'textarea_name' => 'content', |
| 170 | 'statusbar' => false, |
| 171 | ); |
| 172 | wp_editor($post->post_content, 'course_description', $editor_settings); |
| 173 | ?> |
| 174 | </div> |
| 175 | </div> |
| 176 | |
| 177 | <?php do_action('tutor/frontend_course_edit/after/description', $post); ?> |
| 178 | |
| 179 | <div class="tutor-frontend-builder-item-scope"> |
| 180 | <div class="tutor-form-group"> |
| 181 | <label class="tutor-form-label tutor-fs-6"> |
| 182 | <?php _e('Choose a category', 'tutor'); ?> |
| 183 | </label> |
| 184 | <div class="tutor-form-field-course-categories"> |
| 185 | <?php |
| 186 | // echo tutor_course_categories_checkbox($course_id); |
| 187 | echo tutor_course_categories_dropdown($course_id, array('classes' => 'tutor_select2')); |
| 188 | ?> |
| 189 | </div> |
| 190 | </div> |
| 191 | </div> |
| 192 | |
| 193 | <?php do_action('tutor/frontend_course_edit/after/category', $post); ?> |
| 194 | |
| 195 | <?php |
| 196 | $monetize_by = tutils()->get_option('monetize_by'); |
| 197 | if ($monetize_by === 'wc' || $monetize_by === 'edd') { |
| 198 | $course_price = tutor_utils()->get_raw_course_price(get_the_ID()); |
| 199 | $currency_symbol = tutor_utils()->currency_symbol(); |
| 200 | |
| 201 | $_tutor_course_price_type = tutils()->price_type(); |
| 202 | ?> |
| 203 | <div class="tutor-row tutor-align-center tutor-mb-32"> |
| 204 | <div class="tutor-col-12"> |
| 205 | <label class="tutor-form-label tutor-fs-6"><?php _e('Course Price', 'tutor'); ?></label> |
| 206 | </div> |
| 207 | <div class="tutor-col-6 tutor-col-sm-5 tutor-col-lg-4"> |
| 208 | <div class="tutor-form-check tutor-align-center tutor-d-flex"> |
| 209 | <input type="radio" id="tutor_price_paid" class="tutor-form-check-input tutor-flex-shrink-0" name="tutor_course_price_type" value="paid" <?php checked($_tutor_course_price_type, 'paid'); ?> /> |
| 210 | <label for="tutor_price_paid" class="tutor-amount-field"> |
| 211 | <div class="tutor-input-group"> |
| 212 | <span class="tutor-input-group-addon"> |
| 213 | <?php echo $currency_symbol; ?> |
| 214 | </span> |
| 215 | <input type="number" class="tutor-form-number-verify tutor-form-control" name="course_price" value="<?php echo $course_price->regular_price; ?>" placeholder="<?php _e('Set course price', 'tutor'); ?>" step="0.1" min="0"> |
| 216 | </div> |
| 217 | </label> |
| 218 | </div> |
| 219 | </div> |
| 220 | <div class="tutor-col-6 tutor-col-sm-5 tutor-col-lg-4"> |
| 221 | <div class="tutor-form-check tutor-align-center"> |
| 222 | <input type="radio" id="tutor_price_free" class="tutor-form-check-input tutor-flex-shrink-0" name="tutor_course_price_type" value="free" <?php $_tutor_course_price_type ? checked($_tutor_course_price_type, 'free') : checked('true', 'true'); ?> /> |
| 223 | <label for="tutor_price_free" class="tutor-fs-6"> |
| 224 | <?php _e('Free', 'tutor'); ?> |
| 225 | </label> |
| 226 | </div> |
| 227 | </div> |
| 228 | </div> |
| 229 | <?php |
| 230 | } |
| 231 | ?> |
| 232 | |
| 233 | <div class="tutor-mb-32"> |
| 234 | <label class="tutor-course-field-label tutor-fs-6"><?php _e('Course Thumbnail', 'tutor'); ?></label> |
| 235 | <div class="tutor-mb-16"> |
| 236 | <?php |
| 237 | tutor_load_template_from_custom_path( |
| 238 | tutor()->path . '/views/fragments/thumbnail-uploader.php', |
| 239 | array( |
| 240 | 'media_id' => get_post_thumbnail_id($course_id), |
| 241 | 'input_name' => 'tutor_course_thumbnail_id', |
| 242 | 'placeholder' => tutor()->url . '/assets/images/thumbnail-placeholder.svg', |
| 243 | 'borderless' => true, |
| 244 | 'background' => '#E3E6EB', |
| 245 | 'border' => '#E3E6EB', |
| 246 | ), |
| 247 | false |
| 248 | ); |
| 249 | ?> |
| 250 | </div> |
| 251 | </div> |
| 252 | <?php do_action('tutor/frontend_course_edit/after/thumbnail', $post); ?> |
| 253 | </div> |
| 254 | </div> |
| 255 | |
| 256 | <?php do_action('tutor/dashboard_course_builder_form_field_after', $post); ?> |
| 257 | |
| 258 | <div class="tutor-form-row"> |
| 259 | <div class="tutor-form-col-12"> |
| 260 | <div class="tutor-form-group"> |
| 261 | <div class="tutor-form-field tutor-course-builder-btn-group"> |
| 262 | <button type="submit" class="tutor-btn tutor-btn-outline-primary tutor-btn-sm" name="course_submit_btn" value="save_course_as_draft"><?php _e('Save as Draft', 'tutor'); ?></button> |
| 263 | <?php if ($can_publish_course) { ?> |
| 264 | <button class="tutor-btn tutor-btn-primary" type="submit" name="course_submit_btn" value="publish_course"><?php _e('Publish Course', 'tutor'); ?></button> |
| 265 | <?php } else { ?> |
| 266 | <button class="tutor-btn" type="submit" name="course_submit_btn" value="submit_for_review"><?php _e('Submit for Review', 'tutor'); ?></button> |
| 267 | <?php } ?> |
| 268 | </div> |
| 269 | </div> |
| 270 | </div> |
| 271 | </div> |
| 272 | </div> |
| 273 | |
| 274 | <!-- Course builder tips right sidebar --> |
| 275 | <div class="tutor-col-12 tutor-col-lg-4 tutor-mb-32 tutor-pl-40"> |
| 276 | <div class="tutor-course-builder-upload-tips"> |
| 277 | <h3 class="tutor-fs-5 tutor-fw-medium tutor-color-secondary tutor-mb-20"> |
| 278 | <?php _e('Course Upload Tips', 'tutor'); ?> |
| 279 | </h3> |
| 280 | <ul> |
| 281 | <li class="tutor-mb-20"><?php _e('Set the Course Price option or make it free.', 'tutor'); ?></li> |
| 282 | <li class="tutor-mb-20"><?php _e('Standard size for the course thumbnail is 700x430.', 'tutor'); ?></li> |
| 283 | <li class="tutor-mb-20"><?php _e('Video section controls the course overview video.', 'tutor'); ?></li> |
| 284 | <li class="tutor-mb-20"><?php _e('Course Builder is where you create & organize a course.', 'tutor'); ?></li> |
| 285 | <li class="tutor-mb-20"><?php _e('Add Topics in the Course Builder section to create lessons, quizzes, and assignments.', 'tutor'); ?></li> |
| 286 | <li class="tutor-mb-20"><?php _e('Prerequisites refers to the fundamental courses to complete before taking this particular course.', 'tutor'); ?></li> |
| 287 | <li class="tutor-mb-20"><?php _e('Information from the Additional Data section shows up on the course single page.', 'tutor'); ?></li> |
| 288 | </ul> |
| 289 | </div> |
| 290 | </div> |
| 291 | </div> |
| 292 | </div> |
| 293 | </form> |
| 294 | <?php do_action('tutor/dashboard_course_builder_after'); ?> |
| 295 | |
| 296 | |
| 297 | <?php |
| 298 | do_action('tutor_load_template_after', 'dashboard.create-course', null); |
| 299 | get_tutor_footer(true); ?> |