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