Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/tutor-pro/templates/frontend-course-builder.php

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + <?php
2 + /**
3 + * Frontend course builder.
4 + *
5 + * @package TutorPro\Templates
6 + * @author Themeum <support@themeum.com>
7 + * @link https://themeum.com
8 + * @since 2.0.7
9 + */
10 +
11 + if ( ! defined( 'ABSPATH' ) ) {
12 + exit;
13 + }
14 + use TUTOR\Input;
15 +
16 + $course_id = Input::get( 'course_id', 0, Input::TYPE_INT );
17 + global $post;
18 + if ( ! $course_id || tutor()->course_post_type !== get_post_type( $post ) ) {
19 + tutor_permission_denied_template( $course_id );
20 + return;
21 + }
22 +
23 +
24 + $can_publish_course = (bool) tutor_utils()->get_option( 'instructor_can_publish_course' ) || current_user_can( 'administrator' );
25 +
26 + $course_slug = $post->post_name;
27 + $course_permalink = get_the_permalink();
28 + ?>
29 +
30 + <?php
31 + if ( ! tutor_utils()->is_instructor( get_current_user_id(), true ) || ! tutor_utils()->can_user_edit_course( get_current_user_id(), $course_id ) ) {
32 + tutor_permission_denied_template( $course_id );
33 + return;
34 + }
35 + ?>
36 +
37 + <?php do_action( 'tutor/dashboard_course_builder_before' ); ?>
38 + <form action="" id="tutor-frontend-course-builder" method="post" enctype="multipart/form-data">
39 + <?php
40 + wp_nonce_field( tutor()->nonce_action, tutor()->nonce );
41 + if ( 'draft' === $post->post_status ) {
42 + ?>
43 + <input name="original_publish" type="hidden" id="original_publish" value="Publish">
44 + <?php } ?>
45 +
46 +
47 + <!-- Sticky header with course action buttons -->
48 + <?php require 'components/sticky-header.php'; ?>
49 +
50 + <!-- Course builder body -->
51 + <div class="tutor-container">
52 + <div class="tutor-row">
53 + <div class="tutor-col-12 tutor-col-lg-8 tutor-mb-32 tutor-pr-32">
54 + <input type="hidden" value="tutor_add_course_builder" name="tutor_action" />
55 + <input type="hidden" name="course_ID" id="course_ID" value="<?php echo get_the_ID(); ?>">
56 + <input type="hidden" name="post_ID" id="post_ID" value="<?php echo get_the_ID(); ?>">
57 +
58 + <!--since 1.8.0 alert message -->
59 + <?php
60 + $user_id = get_current_user_id();
61 + $expires = get_user_meta( $user_id, 'tutor_frontend_course_message_expires', true );
62 + $message = get_user_meta( $user_id, 'tutor_frontend_course_action_message', true );
63 +
64 + if ( $message && $expires && $expires > time() ) {
65 + $show_modal = $message['show_modal'];
66 + $message = $message['message'];
67 +
68 + if ( ! $show_modal ) {
69 + ?>
70 + <div class="tutor-alert tutor-alert-info">
71 + <?php echo wp_kses_post( $message ); ?>
72 + </div>
73 + <?php } else { ?>
74 + <!-- @todo: move to toast -->
75 + <div id="modal-course-save-feedback" class="tutor-modal tutor-is-active">
76 + <span class="tutor-modal-overlay"></span>
77 + <div class="tutor-modal-window tutor-modal-window-md">
78 + <div class="tutor-modal-content tutor-modal-content-white">
79 + <button class="tutor-iconic-btn tutor-modal-close-o" data-tutor-modal-close>
80 + <span class="tutor-icon-times" area-hidden="true"></span>
81 + </button>
82 +
83 + <div class="tutor-modal-body tutor-text-center">
84 + <div class="tutor-py-48">
85 + <img class="tutor-d-inline-block" src="<?php echo esc_url( tutor()->url . 'assets/images/icon-cup.svg' ); ?>" />
86 + <div class="tutor-fs-3 tutor-fw-medium tutor-color-black tutor-mb-12">
87 + <?php esc_html_e( 'Thank You!', 'tutor-pro' ); ?>
88 + </div>
89 + <div class="tutor-fs-6 tutor-color-muted">
90 + <?php echo esc_textarea( $message ); ?></div>
91 + </div>
92 + </div>
93 + </div>
94 + </div>
95 + </div>
96 + <script>
97 + const alertBox = document.getElementById('modal-course-save-feedback');
98 + setTimeout(() => {
99 + if (alertBox) alertBox.classList.remove('tutor-is-active');
100 + }, 5000)
101 + </script>
102 + <?php
103 + }
104 + }
105 +
106 + if ( $message || $expires ) {
107 + delete_user_meta( $user_id, 'tutor_frontend_course_message_expires' );
108 + delete_user_meta( $user_id, 'tutor_frontend_course_action_message' );
109 + }
110 + ?>
111 + <!--alert message end -->
112 + <?php do_action( 'tutor/dashboard_course_builder_form_field_before' ); ?>
113 +
114 + <div class="tutor-course-builder-section tutor-course-builder-info">
115 + <div class="tutor-course-builder-section-title">
116 + <span class="tutor-fs-5 tutor-fw-bold tutor-color-secondary">
117 + <i class="color-text-brand tutor-icon-angle-up tutor-fs-5" area-hidden="true"></i>
118 + <span><?php esc_html_e( 'Course Info', 'tutor-pro' ); ?></span>
119 + </span>
120 + </div>
121 + <!--.tutor-course-builder-section-title-->
122 + <div class="tutor-course-builder-section-content">
123 + <div class="tutor-mb-32">
124 + <label class="tutor-course-field-label tutor-fs-6 tutor-color-black"><?php esc_html_e( 'Course Title', 'tutor-pro' ); ?></label>
125 + <div id="tutor-course-create-title-tooltip-wrapper" class="tooltip-wrap tutor-d-block">
126 + <span class="tooltip-txt tooltip-right tutor-mt-12">
127 + <?php esc_html_e( '255', 'tutor-pro' ); ?>
128 + </span>
129 + <input id="tutor-course-create-title" type="text" name="title" class="tutor-form-control" value="<?php the_title(); ?>" placeholder="<?php esc_html_e( 'ex. Learn Photoshop CS6 from scratch', 'tutor-pro' ); ?>" maxlength="255">
130 + </div>
131 + </div>
132 + <div class="tutor-mb-32">
133 + <label class="tutor-course-field-label tutor-fs-6 tutor-color-black"><?php esc_html_e( 'Course Slug', 'tutor-pro' ); ?></label>
134 + <div id="tutor-course-create-slug-tooltip-wrapper" class="tooltip-wrap tutor-d-block">
135 + <span class="tooltip-txt tooltip-right tutor-mt-12">
136 + <?php esc_html_e( '255', 'tutor-pro' ); ?>
137 + </span>
138 + <input id="tutor-course-slug" type="text" name="post_name" class="tutor-form-control" placeholder="<?php esc_html_e( 'Please enter the course page slug here', 'tutor-pro' ); ?>" value="<?php echo esc_html( $course_slug ); ?>" maxlength="255">
139 + <div class="tutor-fs-7 tutor-has-icon tutor-color-muted tutor-mt-12">
140 + <?php esc_html_e( 'Permalink: ', 'tutor-pro' ); ?>
141 + <a href="<?php echo esc_url( $course_permalink ); ?>" target="_blank">
142 + <?php echo esc_url( $course_permalink ); ?>
143 + </a>
144 + </div>
145 + </div>
146 + </div>
147 +
148 + <div class="tutor-mb-32">
149 + <label class="tutor-course-field-label tutor-fs-6 tutor-color-black"><?php esc_html_e( 'About Course', 'tutor-pro' ); ?></label>
150 + <div class="tutor-mb-16">
151 + <?php
152 + $editor_settings = array(
153 + 'media_buttons' => false,
154 + 'quicktags' => false,
155 + 'editor_height' => 150,
156 + 'textarea_name' => 'content',
157 + 'statusbar' => false,
158 + );
159 + wp_editor( $post->post_content, 'course_description', $editor_settings );
160 + ?>
161 + </div>
162 + </div>
163 +
164 + <?php do_action( 'tutor/frontend_course_edit/after/description', $post ); ?>
165 +
166 + <div class="tutor-frontend-builder-item-scope">
167 + <div class="tutor-form-group">
168 + <label class="tutor-form-label tutor-fs-6">
169 + <?php esc_html_e( 'Choose a category', 'tutor-pro' ); ?>
170 + </label>
171 + <div class="tutor-form-field-course-categories">
172 + <?php
173 + // echo tutor_course_categories_checkbox($course_id).
174 + echo tutor_course_categories_dropdown( $course_id, array( 'classes' => 'tutor_select2' ) ); //phpcs:ignore
175 + ?>
176 + </div>
177 + </div>
178 + </div>
179 +
180 + <?php do_action( 'tutor/frontend_course_edit/after/category', $post ); ?>
181 +
182 + <?php
183 + $monetize_by = tutils()->get_option( 'monetize_by' );
184 + if ( 'wc' === $monetize_by || 'edd' === $monetize_by ) {
185 + $course_price = tutor_utils()->get_raw_course_price( get_the_ID() );
186 + $currency_symbol = tutor_utils()->currency_symbol();
187 + $_tutor_course_price_type = tutils()->price_type();
188 + ?>
189 + <div class="tutor-course-price-wrapper tutor-mb-32 tutor-row tutor-align-center">
190 + <div class="tutor-mb-20">
191 + <div class="tutor-course-field-label tutor-fs-6 tutor-mb-3"><?php esc_html_e( 'Course Price', 'tutor-pro' ); ?></div>
192 + <div class="tutor-d-flex tutor-mt-20 tutor-course-price-toggle">
193 + <div class="tutor-form-check tutor-align-center">
194 + <input type="radio" id="tutor_input_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' ); ?> />
195 + <label for="tutor_input_price_free" class="tutor-fs-6">
196 + <?php esc_html_e( 'Free', 'tutor-pro' ); ?>
197 + </label>
198 + </div>
199 + <div class="tutor-form-check tutor-align-center">
200 + <input type="radio" id="tutor_input_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' ); ?> />
201 + <label for="tutor_input_price_paid" class="tutor-fs-6">
202 + <?php esc_html_e( 'Paid', 'tutor-pro' ); ?>
203 + </label>
204 + </div>
205 + </div>
206 + </div>
207 + <div class="tutor-mb-12">
208 + <div class="tutor-course-price-row tutor-row <?php echo 'paid' === $_tutor_course_price_type ? 'is-paid tutor-mb-20' : null; ?>">
209 + <div class="tutor-col-6 tutor-col-sm-6 tutor-col-lg-4 tutor-course-price-row-regular">
210 + <div class="tutor-form-label"><?php esc_html_e( 'Regular Price', 'tutor-pro' ); ?></div>
211 + <div class="tutor-form-check tutor-align-center tutor-d-flex">
212 + <label for="tutor_price_paid" class="tutor-amount-field">
213 + <div class="tutor-input-group">
214 + <span class="tutor-input-group-addon">
215 + <?php echo $currency_symbol; //phpcs:ignore ?>
216 + </span>
217 + <input type="number" class="tutor-form-number-verify tutor-form-control" name="course_price" value="<?php echo esc_attr( $course_price->regular_price ); ?>" placeholder="<?php esc_attr_e( 'Set course price', 'tutor-pro' ); ?>" step="any" min="0" pattern="^\d*(\.\d{0,2})?$">
218 + </div>
219 + </label>
220 + </div>
221 + </div>
222 + <div class="tutor-col-6 tutor-col-sm-6 tutor-col-lg-6 tutor-course-price-paid">
223 + <div class="tutor-form-label"><?php esc_html_e( 'Discounted Price', 'tutor-pro' ); ?></div>
224 + <div class="tutor-form-check tutor-align-center tutor-d-flex">
225 + <label class="tutor-amount-field">
226 + <div class="tutor-input-group">
227 + <span class="tutor-input-group-addon">
228 + <?php echo $currency_symbol; //phpcs:ignore ?>
229 + </span>
230 + <input type="number" class="tutor-form-number-verify tutor-form-control" name="course_sale_price" value="<?php echo esc_attr( $course_price->sale_price ); ?>" placeholder="<?php esc_attr_e( 'Set course sale price', 'tutor-pro' ); ?>" step="any" min="0" pattern="^\d*(\.\d{0,2})?$">
231 + </div>
232 + </label>
233 + </div>
234 + </div>
235 + </div>
236 + </div>
237 + </div>
238 + <?php
239 + }
240 + ?>
241 +
242 + <div class="tutor-mb-32">
243 + <label class="tutor-course-field-label tutor-fs-6"><?php esc_html_e( 'Course Thumbnail', 'tutor-pro' ); ?></label>
244 + <div class="tutor-mb-16">
245 + <?php
246 + tutor_load_template_from_custom_path(
247 + tutor()->path . '/views/fragments/thumbnail-uploader.php',
248 + array(
249 + 'media_id' => get_post_thumbnail_id( $course_id ),
250 + 'input_name' => 'tutor_course_thumbnail_id',
251 + 'placeholder' => tutor()->url . '/assets/images/thumbnail-placeholder.svg',
252 + 'borderless' => true,
253 + 'background' => '#E3E6EB',
254 + 'border' => '#E3E6EB',
255 + ),
256 + false
257 + );
258 + ?>
259 + </div>
260 + </div>
261 + <?php do_action( 'tutor/frontend_course_edit/after/thumbnail', $post ); ?>
262 + </div>
263 + </div>
264 +
265 + <?php do_action( 'tutor/dashboard_course_builder_form_field_after', $post ); ?>
266 +
267 + </div>
268 +
269 + <!-- Course builder tips right sidebar -->
270 + <div class="tutor-col-12 tutor-col-lg-4 tutor-mb-32 tutor-pl-40">
271 + <div class="tutor-course-builder-upload-tips">
272 + <h3 class="tutor-fs-5 tutor-fw-medium tutor-color-secondary tutor-mb-20">
273 + <?php esc_html_e( 'Course Upload Tips', 'tutor-pro' ); ?>
274 + </h3>
275 + <ul>
276 + <li class="tutor-mb-20"><?php esc_html_e( 'Set the Course Price option or make it free.', 'tutor-pro' ); ?></li>
277 + <li class="tutor-mb-20"><?php esc_html_e( 'Standard size for the course thumbnail is 700x430.', 'tutor-pro' ); ?></li>
278 + <li class="tutor-mb-20"><?php esc_html_e( 'Video section controls the course overview video.', 'tutor-pro' ); ?></li>
279 + <li class="tutor-mb-20"><?php esc_html_e( 'Course Builder is where you create & organize a course.', 'tutor-pro' ); ?></li>
280 + <li class="tutor-mb-20"><?php esc_html_e( 'Add Topics in the Course Builder section to create lessons, quizzes, and assignments.', 'tutor-pro' ); ?></li>
281 + <li class="tutor-mb-20"><?php esc_html_e( 'Prerequisites refers to the fundamental courses to complete before taking this particular course.', 'tutor-pro' ); ?></li>
282 + <li class="tutor-mb-20"><?php esc_html_e( 'Information from the Additional Data section shows up on the course single page.', 'tutor-pro' ); ?></li>
283 + </ul>
284 + </div>
285 + </div>
286 + </div>
287 + </div>
288 + </form>
289 + <?php do_action( 'tutor/dashboard_course_builder_after' ); ?>
290 +