announcements
4 years ago
assignments
4 years ago
earning
4 years ago
enrolled-courses
4 years ago
instructor
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-menu.php
4 years ago
dashboard.php
4 years ago
earning.php
4 years ago
enrolled-courses.php
4 years ago
index.php
4 years ago
logged-in.php
5 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
292 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()->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 | <header class="tutor-dashboard-builder-header"> |
| 44 | <div class="tutor-container tutor-fluid"> |
| 45 | <div class="tutor-row tutor-align-items-center"> |
| 46 | <div class="tutor-col-auto"> |
| 47 | <div class="tutor-dashboard-builder-header-left"> |
| 48 | <div class="tutor-dashboard-builder-logo"> |
| 49 | <?php $tutor_course_builder_logo_src = apply_filters( 'tutor_course_builder_logo_src', tutor()->url . 'assets/images/tutor-logo.png' ); ?> |
| 50 | <img src="<?php echo esc_url( $tutor_course_builder_logo_src ); ?>" alt=""> |
| 51 | </div> |
| 52 | <button type="submit" class="tutor-dashboard-builder-draft-btn" name="course_submit_btn" value="save_course_as_draft"> |
| 53 | <!-- @TODO: Icon must be chenged --> |
| 54 | <i class="tutor-icon-save"></i> |
| 55 | <span><?php _e( 'Save', 'tutor' ); ?></span> |
| 56 | </button> |
| 57 | </div> |
| 58 | </div> |
| 59 | <div class="tutor-col-auto"> |
| 60 | <div class="tutor-dashboard-builder-header-right"> |
| 61 | <a href="<?php echo esc_url( get_the_permalink( $course_id ) ); ?>" target="_blank"><i class="tutor-icon-glasses"></i><?php _e( 'Preview', 'tutor' ); ?></a> |
| 62 | <?php |
| 63 | if ( $can_publish_course ) { |
| 64 | ?> |
| 65 | <button class="tutor-button" type="submit" name="course_submit_btn" value="publish_course"><?php _e( 'Publish Course', 'tutor' ); ?></button> |
| 66 | <?php |
| 67 | } else { |
| 68 | ?> |
| 69 | <button class="tutor-button" type="submit" name="course_submit_btn" value="submit_for_review"><?php _e( 'Submit for Review', 'tutor' ); ?></button> |
| 70 | <?php |
| 71 | } |
| 72 | ?> |
| 73 | <a href="<?php echo esc_url( tutor_utils()->tutor_dashboard_url() ); ?>"> <?php _e( 'Exit', 'tutor' ); ?></a> |
| 74 | </div> |
| 75 | </div> |
| 76 | </div> |
| 77 | </div> |
| 78 | </header> |
| 79 | <div class="tutor-frontend-course-builder-section"> |
| 80 | |
| 81 | <div class="tutor-container"> |
| 82 | <div class="tutor-row"> |
| 83 | <div class="tutor-col-8"> |
| 84 | <input type="hidden" value="tutor_add_course_builder" name="tutor_action" /> |
| 85 | <input type="hidden" name="course_ID" id="course_ID" value="<?php echo get_the_ID(); ?>"> |
| 86 | <input type="hidden" name="post_ID" id="post_ID" value="<?php echo get_the_ID(); ?>"> |
| 87 | |
| 88 | <!--since 1.8.0 alert message --> |
| 89 | <?php |
| 90 | $user_id = get_current_user_id(); |
| 91 | $expires = get_user_meta( $user_id, 'tutor_frontend_course_message_expires', true ); |
| 92 | $message = get_user_meta( $user_id, 'tutor_frontend_course_action_message', true ); |
| 93 | |
| 94 | if ( $message && $expires && $expires > time() ) { |
| 95 | ?> |
| 96 | <div class="tutor-alert tutor-alert-info"> |
| 97 | <?php echo esc_html( $message ); ?> |
| 98 | </div> |
| 99 | <?php |
| 100 | } |
| 101 | |
| 102 | if ( $message || $expires ) { |
| 103 | delete_user_meta( $user_id, 'tutor_frontend_course_message_expires' ); |
| 104 | delete_user_meta( $user_id, 'tutor_frontend_course_action_message' ); |
| 105 | } |
| 106 | ?> |
| 107 | <!--alert message end --> |
| 108 | <?php do_action( 'tutor/dashboard_course_builder_form_field_before' ); ?> |
| 109 | |
| 110 | <div class="tutor-course-builder-section tutor-course-builder-info"> |
| 111 | <div class="tutor-course-builder-section-title"> |
| 112 | <h3><i class="tutor-icon-down"></i><span><?php esc_html_e( 'Course Info', 'tutor' ); ?></span></h3> |
| 113 | </div> |
| 114 | <!--.tutor-course-builder-section-title--> |
| 115 | <div class="tutor-course-builder-section-content"> |
| 116 | <div id="tutor-frontend-course-title" class="tutor-frontend-builder-item-scope"> |
| 117 | <div class="tutor-form-group"> |
| 118 | <label class="tutor-builder-item-heading"> |
| 119 | <?php _e( 'Course Title', 'tutor' ); ?> |
| 120 | </label> |
| 121 | <input type="text" name="title" value="<?php echo get_the_title(); ?>" placeholder="<?php _e( 'ex. Learn photoshop CS6 from scratch', 'tutor' ); ?>"> |
| 122 | </div> |
| 123 | </div> |
| 124 | <!--.tutor-frontend-builder-item-scope--> |
| 125 | |
| 126 | <div class="tutor-frontend-builder-item-scope"> |
| 127 | <div class="tutor-form-group"> |
| 128 | <label> <?php _e( 'Description', 'tutor' ); ?></label> |
| 129 | <?php |
| 130 | $editor_settings = array( |
| 131 | 'media_buttons' => false, |
| 132 | 'quicktags' => false, |
| 133 | 'editor_height' => 150, |
| 134 | 'textarea_name' => 'content', |
| 135 | ); |
| 136 | wp_editor( $post->post_content, 'course_description', $editor_settings ); |
| 137 | ?> |
| 138 | </div> |
| 139 | </div> |
| 140 | <!--.tutor-frontend-builder-item-scope--> |
| 141 | |
| 142 | <?php do_action( 'tutor/frontend_course_edit/after/description', $post ); ?> |
| 143 | |
| 144 | <div class="tutor-frontend-builder-item-scope"> |
| 145 | <div class="tutor-form-group"> |
| 146 | <label> |
| 147 | <?php _e( 'Choose a category', 'tutor' ); ?> |
| 148 | </label> |
| 149 | <div class="tutor-form-field-course-categories"> |
| 150 | <?php |
| 151 | // echo tutor_course_categories_checkbox($course_id); |
| 152 | echo tutor_course_categories_dropdown( $course_id, array( 'classes' => 'tutor_select2' ) ); |
| 153 | ?> |
| 154 | </div> |
| 155 | </div> |
| 156 | </div> |
| 157 | |
| 158 | |
| 159 | <div class="tutor-frontend-builder-item-scope"> |
| 160 | <div class="tutor-form-group"> |
| 161 | <label> |
| 162 | <?php _e( 'Choose a tag', 'tutor' ); ?> |
| 163 | </label> |
| 164 | <div class="tutor-form-field-course-tags"> |
| 165 | <?php |
| 166 | // echo tutor_course_tags_checkbox($course_id); |
| 167 | echo tutor_course_tags_dropdown( $course_id, array( 'classes' => 'tutor_select2' ) ); |
| 168 | ?> |
| 169 | </div> |
| 170 | </div> |
| 171 | </div> |
| 172 | |
| 173 | <?php |
| 174 | $monetize_by = tutils()->get_option( 'monetize_by' ); |
| 175 | if ( $monetize_by === 'wc' || $monetize_by === 'edd' ) { |
| 176 | $course_price = tutor_utils()->get_raw_course_price( get_the_ID() ); |
| 177 | $currency_symbol = tutor_utils()->currency_symbol(); |
| 178 | |
| 179 | $_tutor_course_price_type = tutils()->price_type(); |
| 180 | ?> |
| 181 | <div class="tutor-frontend-builder-item-scope tutor-frontend-builder-course-price"> |
| 182 | <label class="tutor-builder-item-heading"> |
| 183 | <?php _e( 'Course Price', 'tutor' ); ?> |
| 184 | </label> |
| 185 | <div class="tutor-row tutor-align-items-center"> |
| 186 | <div class="tutor-col-auto"> |
| 187 | <label for="tutor_course_price_type_pro" class="tutor-styled-radio"> |
| 188 | <input id="tutor_course_price_type_pro" type="radio" name="tutor_course_price_type" value="paid" <?php checked( $_tutor_course_price_type, 'paid' ); ?>> |
| 189 | <span></span> |
| 190 | <div class="tutor-form-group"> |
| 191 | <span class="tutor-input-prepand"> |
| 192 | <?php echo $currency_symbol; ?> |
| 193 | </span> |
| 194 | <input type="text" name="course_price" value="<?php echo $course_price->regular_price; ?>" placeholder="<?php _e( 'Set course price', 'tutor' ); ?>"> |
| 195 | </div> |
| 196 | </label> |
| 197 | </div> |
| 198 | <div class="tutor-col-auto"> |
| 199 | <label class="tutor-styled-radio"> |
| 200 | <input type="radio" name="tutor_course_price_type" value="free" <?php $_tutor_course_price_type ? checked( $_tutor_course_price_type, 'free' ) : checked( 'true', 'true' ); ?>> |
| 201 | <span><?php _e( 'Free', 'tutor' ); ?></span> |
| 202 | </label> |
| 203 | </div> |
| 204 | </div> |
| 205 | </div> |
| 206 | <!--.tutor-frontend-builder-item-scope--> |
| 207 | <?php } ?> |
| 208 | |
| 209 | <div class="tutor-frontend-builder-item-scope"> |
| 210 | <div class="tutor-form-group"> |
| 211 | <label> |
| 212 | <?php _e( 'Course Thumbnail', 'tutor' ); ?> |
| 213 | </label> |
| 214 | <div class="tutor-form-field tutor-form-field-course-thumbnail tutor-thumbnail-wrap"> |
| 215 | <div class="tutor-row tutor-align-items-center"> |
| 216 | <div class="tutor-col-5"> |
| 217 | <div class="builder-course-thumbnail-img-src"> |
| 218 | <?php |
| 219 | $builder_course_img_src = tutor()->url . 'assets/images/placeholder-course.jpg'; |
| 220 | $_thumbnail_url = get_the_post_thumbnail_url( $course_id ); |
| 221 | $post_thumbnail_id = get_post_thumbnail_id( $course_id ); |
| 222 | |
| 223 | if ( ! $_thumbnail_url ) { |
| 224 | $_thumbnail_url = $builder_course_img_src; |
| 225 | } |
| 226 | ?> |
| 227 | <img width="280" src="<?php echo esc_url( $_thumbnail_url ); ?>" class="thumbnail-img" data-placeholder-src="<?php echo esc_url( $builder_course_img_src ); ?>"> |
| 228 | <a href="javascript:;" class="tutor-course-thumbnail-delete-btn" style="display:<?php echo $post_thumbnail_id ? 'block' : 'none'; ?>;"> |
| 229 | <i class="tutor-icon-line-cross"></i> |
| 230 | </a> |
| 231 | </div> |
| 232 | </div> |
| 233 | |
| 234 | <div class="tutor-col-7"> |
| 235 | <div class="builder-course-thumbnail-upload-wrap"> |
| 236 | <div><?php echo wp_sprintf( __( 'Important Guideline: %1$s 700x430 pixels %2$s %3$s File Support: %1$s jpg, .jpeg,. gif, or .png %2$s no text on the image.', 'tutor' ), '<strong>', '</strong>', '<br>' ); ?></div> |
| 237 | <input type="hidden" id="tutor_course_thumbnail_id" name="tutor_course_thumbnail_id" value="<?php echo $post_thumbnail_id; ?>"> |
| 238 | <a href="javascript:;" class="tutor-course-thumbnail-upload-btn tutor-button bordered-button"><?php _e( 'Upload Image', 'tutor' ); ?></a> |
| 239 | </div> |
| 240 | </div> |
| 241 | </div> |
| 242 | |
| 243 | </div> |
| 244 | </div> |
| 245 | </div> |
| 246 | </div> |
| 247 | </div> |
| 248 | |
| 249 | <?php do_action( 'tutor/dashboard_course_builder_form_field_after', $post ); ?> |
| 250 | <div class="tutor-form-row"> |
| 251 | <div class="tutor-form-col-12"> |
| 252 | <div class="tutor-form-group"> |
| 253 | <div class="tutor-form-field tutor-course-builder-btn-group"> |
| 254 | <button type="submit" class="tutor-button" name="course_submit_btn" value="save_course_as_draft"><?php _e( 'Save course as draft', 'tutor' ); ?></button> |
| 255 | <?php if ( $can_publish_course ) { ?> |
| 256 | <button class="tutor-button tutor-button-primary" type="submit" name="course_submit_btn" value="publish_course"><?php _e( 'Publish Course', 'tutor' ); ?></button> |
| 257 | <?php } else { ?> |
| 258 | <button class="tutor-button tutor-button-primary" type="submit" name="course_submit_btn" value="submit_for_review"><?php _e( 'Submit for Review', 'tutor' ); ?></button> |
| 259 | <?php } ?> |
| 260 | </div> |
| 261 | </div> |
| 262 | </div> |
| 263 | </div> |
| 264 | </div> |
| 265 | <!--.tutor-col-8--> |
| 266 | <div class="tutor-col-4"> |
| 267 | <div class="tutor-course-builder-upload-tips"> |
| 268 | <h3 class="tutor-course-builder-tips-title"><i class="tutor-icon-light-bulb"></i><?php _e( 'Course Upload Tips', 'tutor' ); ?></h3> |
| 269 | <ul> |
| 270 | <li><?php _e( 'Set the Course Price option or make it free.', 'tutor' ); ?></li> |
| 271 | <li><?php _e( 'Standard size for the course thumbnail is 700x430.', 'tutor' ); ?></li> |
| 272 | <li><?php _e( 'Video section controls the course overview video.', 'tutor' ); ?></li> |
| 273 | <li><?php _e( 'Course Builder is where you create & organize a course.', 'tutor' ); ?></li> |
| 274 | <li><?php _e( 'Add Topics in the Course Builder section to create lessons, quizzes, and assignments.', 'tutor' ); ?></li> |
| 275 | <li><?php _e( 'Prerequisites refers to the fundamental courses to complete before taking this particular course.', 'tutor' ); ?></li> |
| 276 | <li><?php _e( 'Information from the Additional Data section shows up on the course single page.', 'tutor' ); ?></li> |
| 277 | </ul> |
| 278 | </div> |
| 279 | </div> |
| 280 | <!--.tutor-col-4--> |
| 281 | </div> |
| 282 | <!--.tutor-row--> |
| 283 | </div> |
| 284 | </div> |
| 285 | </form> |
| 286 | <?php do_action( 'tutor/dashboard_course_builder_after' ); ?> |
| 287 | |
| 288 | |
| 289 | <?php |
| 290 | do_action( 'tutor_load_template_after', 'dashboard.create-course', null ); |
| 291 | get_tutor_footer( true ); ?> |
| 292 |