course
4 years ago
course-add-edd-product-metabox.php
3 years ago
course-add-product-metabox.php
3 years ago
course-additional-data.php
4 years ago
course-contents.php
4 years ago
course-level-metabox.php
4 years ago
course-topics.php
3 years ago
instructors-metabox.php
3 years ago
lesson-attachments-metabox.php
4 years ago
lesson-metabox.php
4 years ago
product-selection.php
3 years ago
settings-tabs.php
3 years ago
user-profile-fields.php
4 years ago
video-metabox.php
4 years ago
course-contents.php
184 lines
| 1 | <div class="wp_editor_config_example" style="display: none;"> |
| 2 | <?php wp_editor('', 'tutor_lesson_editor_config'); ?> |
| 3 | </div> |
| 4 | |
| 5 | <div class="wp_editor_config_example" style="display: none;"> |
| 6 | <?php wp_editor('', 'tutor_assignment_editor_config'); ?> |
| 7 | </div> |
| 8 | |
| 9 | <div class="course-contents"> |
| 10 | |
| 11 | <?php |
| 12 | |
| 13 | $query_topics = new WP_Query(array( |
| 14 | 'post_type' => 'topics', |
| 15 | 'post_parent' => $course_id, |
| 16 | 'orderby' => 'menu_order', |
| 17 | 'order' => 'ASC', |
| 18 | 'posts_per_page' => -1, |
| 19 | )); |
| 20 | |
| 21 | $query_topics = $query_topics->posts; |
| 22 | |
| 23 | // Actually all kind of contents. |
| 24 | // This keyword '_tutor_course_id_for_lesson' used just to support backward compatibillity |
| 25 | global $wpdb; |
| 26 | $unassigned_contents = $wpdb->get_results( |
| 27 | "SELECT content.* FROM {$wpdb->posts} content |
| 28 | INNER JOIN {$wpdb->postmeta} meta ON content.ID=meta.post_id |
| 29 | WHERE content.post_parent=0 |
| 30 | AND meta.meta_key='_tutor_course_id_for_lesson' |
| 31 | AND meta.meta_value=".$course_id |
| 32 | ); |
| 33 | |
| 34 | if(is_array($unassigned_contents) && count($unassigned_contents)) { |
| 35 | |
| 36 | $query_topics[]=(object)array( |
| 37 | 'ID' => 0, |
| 38 | 'post_title' => __('Un-assigned Topic Contents', 'tutor'), |
| 39 | 'contents' => $unassigned_contents |
| 40 | ); |
| 41 | } |
| 42 | |
| 43 | foreach ($query_topics as $topic){ |
| 44 | $is_topic = $topic->ID > 0; |
| 45 | ?> |
| 46 | <div id="tutor-topics-<?php echo $topic->ID; ?>" class="tutor-topics-wrap" data-topic-id="<?php echo $topic->ID; ?>"> |
| 47 | <div class="tutor-topics-top"> |
| 48 | <div class="tutor-topic-title"> |
| 49 | <span class="<?php echo $is_topic ? 'tutor-icon-hamburger-menu course-move-handle' : 'tutor-icon-warning'; ?> tutor-px-12"></span> |
| 50 | <span class="topic-inner-title tutor-fs-6 tutor-fw-bold tutor-color-black tutor-d-flex tutor-align-center"> |
| 51 | <?php echo stripslashes($topic->post_title); ?> |
| 52 | </span> |
| 53 | <?php if($is_topic): ?> |
| 54 | <span class="tutor-iconic-btn" data-tutor-modal-target="tutor-topics-edit-id-<?php echo $topic->ID; ?>"> |
| 55 | <i class="tutor-icon-edit" area-hidden="true"></i> |
| 56 | </span> |
| 57 | <span class="topic-delete-btn tutor-iconic-btn" action-delete-course-topic> |
| 58 | <i class="tutor-icon-trash-can-line" area-hidden="true"></i> |
| 59 | </span> |
| 60 | <?php endif; ?> |
| 61 | <span class="expand-collapse-wrap"> |
| 62 | <i class="tutor-icon-angle-down" area-hidden="true"></i> |
| 63 | </span> |
| 64 | </div> |
| 65 | <?php |
| 66 | if($is_topic) { |
| 67 | tutor_load_template_from_custom_path(tutor()->path.'/views/modal/topic-form.php', array( |
| 68 | 'modal_title' => __('Update Topic', 'tutor'), |
| 69 | 'wrapper_id' => 'tutor-topics-edit-id-' . $topic->ID, |
| 70 | 'topic_id' => $topic->ID, |
| 71 | 'course_id' => $course_id, |
| 72 | 'title' => $topic->post_title, |
| 73 | 'summary' => $topic->post_content, |
| 74 | 'wrapper_class' => 'tutor-topics-edit-form', |
| 75 | 'button_text' => __('Update Topic', 'tutor'), |
| 76 | 'button_class' => 'tutor-save-topic-btn' |
| 77 | ), false); |
| 78 | } |
| 79 | ?> |
| 80 | </div> |
| 81 | <div class="tutor-topics-body" style="display: <?php echo (isset($current_topic_id) && $current_topic_id == $topic->ID) ? 'block' : 'none'; ?>;"> |
| 82 | <div class="tutor-lessons"><?php |
| 83 | $post_type = apply_filters( 'tutor_course_contents_post_types', array( tutor()->lesson_post_type, 'tutor_quiz' ) ); |
| 84 | $course_contents = !$is_topic ? $topic->contents : get_posts(array( |
| 85 | 'post_type' => $post_type, |
| 86 | 'post_parent' => $topic->ID, |
| 87 | 'posts_per_page' => -1, |
| 88 | 'orderby' => 'menu_order', |
| 89 | 'order' => 'ASC', |
| 90 | )); |
| 91 | |
| 92 | $counter = array( |
| 93 | 'lesson' => 0, |
| 94 | 'quiz' => 0, |
| 95 | 'assignment' => 0 |
| 96 | ); |
| 97 | |
| 98 | foreach ($course_contents as $content){ |
| 99 | |
| 100 | if ($content->post_type === 'tutor_quiz'){ |
| 101 | $quiz = $content; |
| 102 | $counter['quiz']++; |
| 103 | tutor_load_template_from_custom_path(tutor()->path.'/views/fragments/quiz-list-single.php', array( |
| 104 | 'quiz_id' => $quiz->ID, |
| 105 | 'topic_id' => $topic->ID, |
| 106 | 'quiz_title' => __('Quiz', 'tutor').' '.$counter['quiz'].': '. $quiz->post_title, |
| 107 | ), false); |
| 108 | |
| 109 | } elseif ($content->post_type === 'tutor_assignments'){ |
| 110 | $counter['assignment']++; |
| 111 | ?> |
| 112 | <div data-course_content_id="<?php echo $content->ID; ?>" id="tutor-assignmentø-<?php echo $content->ID; ?>" class="course-content-item tutor-assignment tutor-assignment-<?php echo $content->ID; ?>"> |
| 113 | <div class="tutor-course-content-top tutor-d-flex tutor-align-center"> |
| 114 | <span class="tutor-icon-hamburger-menu tutor-cursor-move tutor-px-12"></span> |
| 115 | <a href="javascript:;" class="<?php echo $is_topic ? 'open-tutor-assignment-modal' : ''; ?>" data-assignment-id="<?php echo $content->ID; ?>" data-topic-id="<?php echo $topic->ID; ?>"> |
| 116 | <?php echo __('Assignment', 'tutor').' '.$counter['assignment'].': '. $content->post_title; ?> |
| 117 | </a> |
| 118 | <div class="tutor-course-content-top-right-action"> |
| 119 | <?php if($is_topic): ?> |
| 120 | <a href="javascript:;" class="open-tutor-assignment-modal tutor-iconic-btn" data-assignment-id="<?php echo $content->ID; ?>" data-topic-id="<?php echo $topic->ID; ?>"> |
| 121 | <span class="tutor-icon-edit" area-hidden="true"></span> |
| 122 | </a> |
| 123 | <?php endif; ?> |
| 124 | <a href="javascript:;" class="tutor-delete-lesson-btn tutor-iconic-btn" data-lesson-id="<?php echo $content->ID; ?>"> |
| 125 | <span class="tutor-icon-trash-can-line" area-hidden="true"></span> |
| 126 | </a> |
| 127 | </div> |
| 128 | </div> |
| 129 | </div> |
| 130 | <?php |
| 131 | } else if($content->post_type=='lesson') { |
| 132 | $counter['lesson']++; |
| 133 | ?> |
| 134 | <div data-course_content_id="<?php echo $content->ID; ?>" id="tutor-lesson-<?php echo $content->ID; ?>" class="course-content-item tutor-lesson tutor-lesson-<?php echo $content->ID; ?>"> |
| 135 | <div class="tutor-course-content-top tutor-d-flex tutor-align-center"> |
| 136 | <span class="tutor-icon-hamburger-menu tutor-cursor-move tutor-px-12"></span> |
| 137 | <a href="javascript:;" class="<?php echo $is_topic ? 'open-tutor-lesson-modal' : ''; ?>" data-lesson-id="<?php echo $content->ID; ?>" data-topic-id="<?php echo $topic->ID; ?>"> |
| 138 | <?php echo __('Lesson', 'tutor').' '.$counter['lesson'].': '.stripslashes($content->post_title); ?> |
| 139 | </a> |
| 140 | <div class="tutor-course-content-top-right-action"> |
| 141 | <?php if($is_topic): ?> |
| 142 | <a href="javascript:;" class="open-tutor-lesson-modal tutor-iconic-btn" data-lesson-id="<?php echo $content->ID; ?>" data-topic-id="<?php echo $topic->ID; ?>"> |
| 143 | <span class="tutor-icon-edit" area-hidden="true"></span> |
| 144 | </a> |
| 145 | <?php endif; ?> |
| 146 | <a href="javascript:;" class="tutor-delete-lesson-btn tutor-iconic-btn" data-lesson-id="<?php echo $content->ID; ?>"> |
| 147 | <span class="tutor-icon-trash-can-line" area-hidden="true"></span> |
| 148 | </a> |
| 149 | </div> |
| 150 | </div> |
| 151 | </div> |
| 152 | <?php |
| 153 | } else { |
| 154 | !isset($counter[$content->post_type]) ? $counter[$content->post_type]=0 : 0; |
| 155 | $counter[$content->post_type]++; |
| 156 | do_action( 'tutor/course/builder/content/'.$content->post_type, $content, $topic, $course_id, $counter[$content->post_type] ); |
| 157 | } |
| 158 | } |
| 159 | ?></div> |
| 160 | |
| 161 | <?php if($is_topic): ?> |
| 162 | <div class="tutor_add_content_wrap tutor_add_content_wrap_btn_sm" data-topic_id="<?php echo $topic->ID; ?>"> |
| 163 | <?php do_action('tutor_course_builder_before_btn_group', $topic->ID); ?> |
| 164 | |
| 165 | <button class="tutor-btn tutor-btn-outline-primary tutor-btn-sm open-tutor-lesson-modal create-lesson-in-topic-btn" data-topic-id="<?php echo $topic->ID; ?>" data-lesson-id="0" > |
| 166 | <i class="tutor-icon-plus-square tutor-mr-8"></i> |
| 167 | <?php _e('Lesson', 'tutor'); ?> |
| 168 | </button> |
| 169 | |
| 170 | <button class="tutor-btn tutor-btn-outline-primary tutor-btn-sm tutor-add-quiz-btn" data-topic-id="<?php echo $topic->ID; ?>"> |
| 171 | <i class="tutor-icon-plus-square tutor-mr-8"></i> |
| 172 | <?php _e('Quiz', 'tutor'); ?> |
| 173 | </button> |
| 174 | |
| 175 | <?php do_action('tutor_course_builder_after_btn_group', $topic->ID, $course_id); ?> |
| 176 | </div> |
| 177 | <?php endif; ?> |
| 178 | </div> |
| 179 | </div> |
| 180 | <?php |
| 181 | } |
| 182 | ?> |
| 183 | <input type="hidden" id="tutor_topics_lessons_sorting" name="tutor_topics_lessons_sorting" value="" /> |
| 184 | </div> |