PluginProbe ʕ •ᴥ•ʔ
Tutor LMS – eLearning and online course solution / 1.9.5
Tutor LMS – eLearning and online course solution v1.9.5
3.9.14 3.9.13 3.9.12 3.9.11 trunk 1.0.0 1.0.0-alpha 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.2.0 1.2.1 1.2.11 1.2.12 1.2.13 1.2.20 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.15 1.9.16 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.10 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.1.10 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.3.0 2.4.0 2.5.0 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.1.0 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.4.0 3.4.1 3.4.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 / classes / Tutor_Setup.php
tutor / classes Last commit date
Addons.php 4 years ago Admin.php 4 years ago Ajax.php 4 years ago Assets.php 4 years ago Course.php 4 years ago Course_Filter.php 4 years ago Course_Settings_Tabs.php 5 years ago Course_Widget.php 5 years ago Custom_Validation.php 5 years ago Dashboard.php 5 years ago Email.php 5 years ago FormHandler.php 5 years ago Frontend.php 5 years ago Gutenberg.php 4 years ago Instructor.php 4 years ago Instructors_List.php 4 years ago Lesson.php 4 years ago Options.php 4 years ago Post_types.php 4 years ago Private_Course_Access.php 5 years ago Q_and_A.php 5 years ago Question_Answers_List.php 4 years ago Quiz.php 5 years ago Quiz_Attempts_List.php 4 years ago RestAPI.php 5 years ago Rewrite_Rules.php 5 years ago Shortcode.php 4 years ago Student.php 5 years ago Students_List.php 5 years ago Taxonomies.php 5 years ago Template.php 4 years ago Theme_Compatibility.php 5 years ago Tools.php 5 years ago Tutor.php 4 years ago TutorEDD.php 5 years ago Tutor_Base.php 5 years ago Tutor_List_Table.php 4 years ago Tutor_Setup.php 5 years ago Upgrader.php 5 years ago User.php 4 years ago Utils.php 4 years ago Video_Stream.php 5 years ago Withdraw.php 5 years ago Withdraw_Requests_List.php 4 years ago WooCommerce.php 4 years ago
Tutor_Setup.php
784 lines
1 <?php
2 namespace TUTOR;
3
4 if ( ! defined( 'ABSPATH' ) )
5 exit;
6
7
8 class Tutor_Setup {
9
10 public function __construct() {
11 add_action( 'admin_menu', array( $this, 'admin_menus' ) );
12 add_action( 'admin_init', array( $this, 'setup_wizard' ) );
13 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
14 add_action( 'wp_ajax_setup_action', array( $this, 'tutor_setup_action' ) );
15 add_filter( 'tutor_wizard_attributes', array( $this, 'tutor_setup_attributes_callback' ) );
16 }
17
18 function tutor_setup_attributes_callback($attr) {
19 $options = (array) maybe_unserialize(get_option('tutor_option'));
20 $final_arr = array();
21 $data_arr = $this->tutor_setup_attributes();
22 foreach ($data_arr as $key => $section) {
23 foreach ($section['attr'] as $k => $val) {
24 $final_arr[$k] = isset($options[$k]) ? $options[$k] : '';
25 }
26 }
27 return $final_arr;
28 }
29
30
31 public function tutor_setup_action(){
32 tutils()->checking_nonce();
33
34 $options = (array) maybe_unserialize(get_option('tutor_option'));
35 if (!isset($_POST['action']) || $_POST['action'] != 'setup_action' || !current_user_can( 'manage_options' )) {
36 return;
37 }
38
39 // General Settings
40 $change_data = apply_filters('tutor_wizard_attributes', array());
41 foreach ($change_data as $key => $value) {
42 if ( isset($_POST[$key]) ) {
43 if ($_POST[$key] != $change_data[$key]) {
44 if ($_POST[$key] == '') {
45 unset($options[$key]);
46 } else {
47 $options[$key] = $_POST[$key];
48 }
49 }
50 } else {
51 unset($options[$key]);
52 }
53 }
54 update_option('tutor_option', $options);
55
56
57 // Payment Settings
58 $payments = (array) maybe_unserialize(get_option('tutor_withdraw_options'));
59 $payments_data = array( 'bank_transfer_withdraw', 'echeck_withdraw', 'paypal_withdraw' );
60 foreach ($payments_data as $key) {
61 if(isset($_POST[$key])){
62 $payments[$key]['enabled'] = 1;
63 } else {
64 if ($key == 'bank_transfer_withdraw') {
65 unset($payments[$key]['enabled']);
66 } else {
67 unset($payments[$key]);
68 }
69 }
70 }
71 update_option('tutor_withdraw_options', $payments);
72
73 // Add wizard flug
74 update_option('tutor_wizard', 'active');
75
76 wp_send_json_success(array('status' => 'success'));
77 }
78
79
80 public function admin_menus() {
81 add_dashboard_page( '', '', 'manage_options', 'tutor-setup', '' );
82 }
83
84 public function setup_wizard() {
85 if( isset($_GET['page']) ) {
86 if( $_GET['page'] == 'tutor-setup' ) {
87 $this->tutor_setup_wizard_header();
88 $this->tutor_setup_wizard_boarding();
89 $this->tutor_setup_wizard_type();
90 $this->tutor_setup_wizard_settings();
91 $this->tutor_setup_wizard_footer();
92 exit;
93 }
94 }
95 }
96
97 public function tutor_setup_generator() {
98
99 $i = 1;
100 $html = '';
101 $options = (array) maybe_unserialize(get_option('tutor_option'));
102 $payments = (array) maybe_unserialize(get_option('tutor_withdraw_options'));
103 $field_arr = $this->tutor_setup_attributes();
104
105 $down_desc_fields = array('rows', 'slider', 'text', 'radio', 'dropdown', 'range', 'payments');
106 $full_width_fields = array('rows', 'slider', 'radio', 'range', 'payments', 'dropdown');
107
108 foreach ($field_arr as $key_parent => $field_parent) {
109
110 $html .= '<li class="'.($i==1 ? "active" : "").'">';
111 $html .= '<div class="tutor-setup-content-heading heading">';
112 $html .= '<div>'.$field_parent['lable'].'</div>';
113 $html .= '<div>';
114 $html .= '<strong class="tutor-steps-current">'.$i.'</strong> / <span class="tutor-steps">'.count($field_arr).'</span> ';
115 if ($i > 1) {
116 $html .= __('Steps Completed', 'tutor');
117 } else {
118 $html .= __('Step Completed', 'tutor');
119 }
120 $html .= '</div>';
121 $html .= '<div class="tutor-reset-section">'.__('Reset Default', 'tutor').'</div>';
122 $html .= '</div>';
123 $html .= '<div class="tutor-setup-content-heading body">';
124
125 foreach ($field_parent['attr'] as $key => $field) {
126 if(!isset($field['lable'])){ continue; }
127 $html .= '<div class="tutor-setting'.(in_array( $field['type'], $full_width_fields ) ? " course-setting-wrapper" : "").' '.(isset($field['class']) ? $field['class'] : '').'">';
128 $html .= isset( $field['lable'] ) ? '<div class="title">'.$field['lable'] : '';
129 $html .= isset( $field['tooltip'] ) ? '<span id="tooltip-btn" class="tooltip-btn" data-tooltip="'.$field['tooltip'].'"><span></span></span>' : '';
130 $html .= isset( $field['lable'] ) ? '</div>' : '';
131
132 if(!in_array($field['type'], $down_desc_fields)) {
133 $html .= isset( $field['desc'] ) ? '<div class="content">'.$field['desc'].'</div>' : '';
134 }
135
136 $html .= '<div class="settings">';
137
138 switch ($field['type']) {
139
140 case 'switch':
141 $html .= '<label for="'.$key.'" class="switch-label input-switch-label">';
142 $html .= '<span class="label-off">'.__('OFF', 'tutor').'</span>';
143 $html .= '<div class="switchbox-wrapper">';
144 $html .= '<input id="'.$key.'" class="input-switchbox" type="checkbox" name="'.$key.'" value="1" '.(isset($options[$key]) && $options[$key] ? 'checked' : '').'/>';
145 $html .= '<span class="switchbox-icon"></span>';
146 $html .= '</div>';
147 $html .= '<span class="label-on">'.__('ON', 'tutor').'</span>';
148 $html .= '</label>';
149 break;
150
151 case 'text':
152 $html .= '<input type="text" name="'.$key.'" class="lesson-permalink" value="'.(isset($options[$key]) ? $options[$key] : '').'" />';
153 break;
154
155 case 'rows':
156 $html .= '<div class="content">';
157 $html .= '<div class="course-per-row">';
158 $html .= '<div class="wrapper">';
159 $html .= '<label for="'.$key.'1">';
160 $html .= '<input type="radio" value="1" name="'.$key.'" class="course" id="'.$key.'1" '.( isset($options[$key]) && $options[$key] == 1 ? 'checked' : '' ).'>';
161 $html .= '<span class="span"><span>1</span></span>';
162 $html .= '</label>';
163 $html .= '</div>';
164 $html .= '<div class="wrapper">';
165 $html .= '<label for="'.$key.'2">';
166 $html .= '<input type="radio" value="2" name="'.$key.'" class="course" id="'.$key.'2" '.( isset($options[$key]) && $options[$key] == 2 ? 'checked' : '' ).'>';
167 $html .= '<span class="span"><span>2</span><span>2</span></span>';
168 $html .= '</label>';
169 $html .= '</div>';
170 $html .= '<div class="wrapper">';
171 $html .= '<label for="'.$key.'3">';
172 $html .= '<input type="radio" value="3" name="'.$key.'" class="course" id="'.$key.'3" '.( isset($options[$key]) && $options[$key] == 3 ? 'checked' : '' ).'>';
173 $html .= '<span class="span"><span>3</span><span>3</span><span>3</span></span>';
174 $html .= '</label>';
175 $html .= '</div>';
176 $html .= '<div class="wrapper">';
177 $html .= '<label for="'.$key.'4">';
178 $html .= '<input type="radio" value="4" name="'.$key.'" class="course" id="'.$key.'4" '.( isset($options[$key]) && $options[$key] == 4 ? 'checked' : '' ).'>';
179 $html .= '<span class="span"><span>4</span><span>4</span><span>4</span><span>4</span></span>';
180 $html .= '</label>';
181 $html .= '</div>';
182 $html .= '</div>';
183 $html .= '</div>';
184 break;
185
186 case 'radio':
187 if ( isset($field['options']) ) {
188 foreach ($field['options'] as $k => $val) {
189 $html .= '<label for="'.$key.$k.'" class="time-expires"><input type="radio" id="'.$key.$k.'" name="'.$key.'" value="'.$k.'" '.( isset($options[$key]) && $options[$key] == $k ? 'checked' : '' ).' /> '.'<span class="radio-icon"></span>';
190 $html .= $val.'</label>';
191 }
192 }
193 break;
194
195 case 'slider':
196 $html .= '<div class="limit-slider">';
197 if (isset($field['time'])) {
198 $html .= '<input type="range" name="'.$key.'[value]" min="'.(isset($field['min']) ? $field['min'] : 0).'" max="'.(isset($field['max']) ? $field['max'] : 60).'" step="1" value="'.(isset($options[$key]['value']) ? $options[$key]['value'] : '').'" class="range-input"/>';
199 $html .= '<input type="hidden" name="'.$key.'[time]" value="'.(isset($options[$key]['time']) ? $options[$key]['time'] : 'minutes').'" class="range-input"/>';
200 $html .= '<span class=""><span class="range-value">'.(isset($options[$key]['value']) ? $options[$key]['value'] : '').'</span>';
201 $html .= isset($options[$key]['time']) ? $options[$key]['time'] : '';
202 $html .= '</span>';
203 } else {
204 $html .= '<input type="range" name="'.$key.'" min="'.(isset($field['min']) ? $field['min'] : "").'" max="'.(isset($field['max']) ? $field['max'] : 30 ).'" step="1" value="'.(isset($options[$key]) ? $options[$key] : '').'" class="range-input"/>';
205 $html .= ' <strong class="range-value">'.(isset($options[$key]) ? $options[$key] : '').'</strong>';
206 }
207 $html .= '</div>';
208 break;
209
210 case 'dropdown':
211 $html .= '<div class="grade-calculation"><div class="select-box"><div class="options-container">';
212 $selected_data = '';
213 if (isset($field['options'])) {
214 foreach ($field['options'] as $val) {
215 $html .= '<div class="option">';
216 $html .= '<input type="radio" class="radio" id="'.$val['value'].'" name="'.$key.'" value="'.$val['value'].'" '.( isset($options[$key]) && $options[$key] == $val['value'] ? 'checked' : '' ).' />';
217 $html .= '<label for="'.$val['value'].'">';
218 $html .= '<h3>'.$val['title'].'</h3>';
219 $html .= '<h5>'.$val['desc'].'</h5>';
220 $html .= '</label>';
221 $html .= '</div>';
222
223 if (isset($options[$key]) && $options[$key] == $val['value']) {
224 $selected_data .= '<div class="selected">';
225 $selected_data .= '<h3>'.$val['title'].'</h3>';
226 $selected_data .= '<h5>'.$val['desc'].'</h5>';
227 $selected_data .= '</div>';
228 }
229 }
230 }
231 $html .= '</div>';
232 $html .= $selected_data ? $selected_data : '<div class="selected"><h3>'.$field['options'][0]['title'].'</h3><h5>'.$field['options'][0]['desc'].'</h5></div>';
233 $html .= '</div></div>';
234 break;
235
236 case 'payments':
237 $html .= '<div class="checkbox-wrapper column-3">';
238 $available_withdraw_methods = get_tutor_all_withdrawal_methods();
239 if ( !empty($available_withdraw_methods) ) {
240 foreach ($available_withdraw_methods as $key => $value) {
241 $html .= '<div class="payment-setting">';
242 $html .= '<label for="'.$key.'" class="label">';
243 $html .= '<div>';
244 $html .= '<input type="checkbox" name="'.$key.'" id="'.$key.'" class="checkbox payment" '.(isset($payments[$key]['enabled']) && $payments[$key]['enabled'] ? 'checked' : '').' />';
245 $html .= '<span class="check-icon round"></span>';
246 $html .= '</div>';
247 $html .= '<div>';
248 $html .= '<img src="'.$value["image"]. '" alt="'.$value["method_name"].'">';
249 $html .= '<h4>'.$value["method_name"].'</h4>';
250 $html .= '</div>';
251 $html .= '</label>';
252 $html .= '</div>';
253 }
254 }
255 $html .= '</div>';
256 break;
257
258 case 'range':
259 $earning_instructor = isset($options["earning_instructor_commission"]) ? $options["earning_instructor_commission"] : 80;
260 $earning_admin = isset($options["earning_admin_commission"]) ? $options["earning_admin_commission"] : 20;
261 $html .= '<div class="limit-slider column-1">';
262 $html .= '<div class="limit-slider-has-parent">';
263 $html .= '<input type="range" min="0" max="100" step="1" value="'.$earning_instructor.'" class="range-input double-range-slider" name=""/>';
264 $html .= '</div>';
265 $html .= '<div class="commision-data">';
266 $html .= '<div class="data">';
267 $html .= '<h4 class="range-value-1">'.$earning_instructor.'%</h4>';
268 $html .= '<h5>'.__('Instructor', 'tutor').'</h5>';
269 $html .= '<input type="hidden" min="0" max="100" step="1" value="'.$earning_instructor.'" class="range-value-data-1 range-input" name="earning_instructor_commission"/>';
270 $html .= '</div>';
271 $html .= '<div class="data">';
272 $html .= '<h4 class="range-value-2">'.$earning_admin.'%</h4>';
273 $html .= '<h5>'.__('Admin / Owner', 'tutor').'</h5>';
274 $html .= '<input type="hidden" min="0" max="100" step="1" value="'.$earning_admin.'" class="range-value-data-2 range-input" name="earning_admin_commission"/>';
275 $html .= '</div>';
276 $html .= '</div>';
277 $html .= '</div> ';
278 break;
279
280 case 'checkbox':
281 $html .= '<div class="checkbox-wrapper column-2">';
282 if (isset($field['options'])) {
283 foreach ($field['options'] as $k => $val) {
284 $html .= '<div class="email-notification">';
285 $html .= '<label for="'.$key.$k.'" class="label">';
286 $html .= '<div>';
287 $html .= '<input type="checkbox" value="'.$k.'" '.( isset($options[$key]) && $options[$key] == $k ? 'checked' : '' ).' name="'.$key.'" id="'.$key.$k.'" class="checkbox" />';
288 $html .= '<span class="check-icon square"></span>';
289 $html .= '</div>';
290 $html .= '<div>';
291 $html .= '<h4>'.$val.'</h4>';
292 $html .= '</div>';
293 $html .= '</label>';
294 $html .= '</div>';
295 }
296 }
297 $html .= '</div>';
298 break;
299
300 case 'attempt':
301 $html .= '<div class="tutor-setting course-setting-wrapper">';
302
303 $html .= '<input type="hidden" name="quiz_attempts_allowed" value="'.$options[$key].'">';
304
305 $html .= '<div class="content">';
306 $html .= '<div class="course-per-page attempts-allowed">';
307 $html .= '<div class="wrapper">';
308 $html .= '<label for="attempts-allowed-1">';
309 $html .= '<input type="radio" value="single" name="attempts-allowed" class="course-p" id="attempts-allowed-1" '.( isset($options[$key]) && $options[$key] ? 'checked' : '' ).'>';
310 $html .= '<span class="radio-icon"></span>';
311 $html .= '<span class="label-text label-text-2">';
312 $html .= '<input type="number" value="'.$options[$key].'" name="attempts-allowed-number" class="attempts" id="attempts-allowed-1" min="'.(isset($field['min']) ? $field['min'] : 0).'" max="'.(isset($field['max']) ? $field['max'] : 30 ).'">';
313 $html .= '</span>';
314 $html .= '</label>';
315 $html .= '</div>';
316 $html .= '<div class="wrapper tutor-unlimited-value">';
317 $html .= '<label for="attempts-allowed-2">';
318 $html .= '<input type="radio" name="attempts-allowed" value="unlimited" class="course-p" id="attempts-allowed-2" '.( (!isset($options[$key])) || $options[$key] == 0 ? 'checked' : '' ).'>';
319 $html .= '<span class="radio-icon"></span>';
320 $html .= '<span class="label-text">'.__('Unlimited' ,'tutor').'</span>';
321 $html .= '</label>';
322 $html .= '</div>';
323 $html .= '</div>';
324 $html .= '</div>';
325 $html .= '</div>';
326 break;
327
328 default:
329 # code...
330 break;
331 }
332
333 if (in_array($field['type'], $down_desc_fields)) {
334 $html .= isset($field['desc']) ? '<div class="content">'.$field['desc'].'</div>' : '';
335 }
336 $html .= '</div>';
337 $html .= '</div>';
338
339 }
340 $html .= '</div>';
341 $html .= $this->tutor_setup_wizard_action();
342 $html .= '</li>';
343 $i++;
344 }
345
346 echo $html;
347 }
348
349
350 public function tutor_setup_attributes() {
351 $general_fields = array(
352
353 'general' => array(
354 'lable' => __('General Settings', 'tutor'),
355 'attr' => array(
356 'enable_course_marketplace' => array(
357 'type' => 'marketplace'
358 ),
359 'enable_tutor_earning' => array(
360 'type' => 'earning'
361 ),
362 'enable_public_profile' => array(
363 'type' => 'switch',
364 'lable' => __('Public Profile', 'tutor'),
365 'desc' => __('Allow users to have a public profile to showcase awards and completed courses.', 'tutor'),
366 ),
367 'enable_spotlight_mode' => array(
368 'type' => 'switch',
369 'lable' => __('Spotlight Mode', 'tutor'),
370 'desc' => __('Create a focused learning environment. Block out all the distractions around your course content.', 'tutor'),
371 ),
372 'disable_default_player_youtube' => array(
373 'type' => 'switch',
374 'lable' => __('YouTube Player', 'tutor'),
375 'desc' => __('Toggle to use the default YouTube player.', 'tutor'),
376 ),
377 'disable_default_player_vimeo' => array(
378 'type' => 'switch',
379 'lable' => __('Vimeo Player', 'tutor'),
380 'desc' => __('Toggle to use the default Vimeo player.', 'tutor'),
381 ),
382 'lesson_permalink_base' => array(
383 'type' => 'text',
384 'max' => 50,
385 'lable' => __('Lesson Slug', 'tutor'),
386 'desc' => __('Pick the URL prefix you want for your lessons.', 'tutor'),
387 )
388 )
389 ),
390
391
392 'course' => array(
393 'lable' => __('Course Settings', 'tutor'),
394 'attr' => array(
395 'display_course_instructors' => array(
396 'type' => 'switch',
397 'lable' => __('Show Instructor Bio', 'tutor'),
398 'desc' => __('Let the students know the instructor(s). Display their credentials, professional experience, and more.', 'tutor'),
399 ),
400 'enable_q_and_a_on_course' => array(
401 'type' => 'switch',
402 'lable' => __('Question and Anwser', 'tutor'),
403 'desc' => __('Allows a Q&A forum on each course.', 'tutor'),
404 ),
405 'courses_col_per_row' => array(
406 'type' => 'rows',
407 'lable' => __('Courses Per Row', 'tutor'),
408 'tooltip' => __('How many courses per row on the archive pages.', 'tutor')
409 ),
410 'courses_per_page' => array(
411 'type' => 'slider',
412 'lable' => __('Courses Per Page', 'tutor'),
413 'tooltip' => __('How many courses per page on the archive pages.', 'tutor'),
414 )
415 )
416 ),
417
418
419 'quiz' => array(
420 'lable' => __('Quiz Settings', 'tutor'),
421 'attr' => array(
422 'quiz_time_limit' => array(
423 'type' => 'slider',
424 'time' => true,
425 'lable' => __('Time Limit', 'tutor'),
426 'tooltip' => __('How much time to complete a quiz?', 'tutor'),
427 ),
428 'quiz_when_time_expires' => array(
429 'type' => 'radio',
430 'lable' => __('When Time Expires', 'tutor'),
431 'options' => array(
432 'autosubmit' => __('The current quiz answers are submitted automatically.', 'tutor'),
433 'graceperiod' => __('The current quiz answers are submitted by students.', 'tutor'),
434 'autoabandon' => __('Attempts must be submitted before time expires, otherwise they will not be counted', 'tutor'),
435 ),
436 'tooltip' => __('What message to display when the quiz time expires?', 'tutor'),
437 ),
438 'quiz_attempts_allowed' => array(
439 'type' => 'attempt',
440 'lable' => __('Attempts Allowed', 'tutor'),
441 'tooltip' => __('How many attempts does a student get to pass a quiz?', 'tutor'),
442 ),
443 'quiz_grade_method' => array(
444 'type' => 'dropdown',
445 'lable' => __('Final Grade Calculation', 'tutor'),
446 'options' => array(
447 array(
448 'title' => __('Highest Grade', 'tutor'),
449 'desc' => __('Pick the student’s best grade', 'tutor'),
450 'value' => 'highest_grade',
451 ),
452 array(
453 'title' => __('Average Grade', 'tutor'),
454 'desc' => __('Use the average score', 'tutor'),
455 'value' => 'average_grade',
456 ),
457 array(
458 'title' => __('First Attempt', 'tutor'),
459 'desc' => __('Pick the first attempt', 'tutor'),
460 'value' => 'first_attempt',
461 ),
462 array(
463 'title' => __('Last Attempt', 'tutor'),
464 'desc' => __('Pick the most recent attempt', 'tutor'),
465 'value' => 'last_attempt',
466 ),
467 ),
468 'tooltip' => __('When you allow multiple quiz attempts, which grade do you want to count?', 'tutor'),
469 )
470 )
471 ),
472
473
474 'instructor' => array(
475 'lable' => __('Instructor Settings', 'tutor'),
476 'attr' => array(
477 'enable_become_instructor_btn' => array(
478 'type' => 'switch',
479 'lable' => __('New Signup', 'tutor'),
480 'desc' => __('Choose between open and closed instructor signup. If you’re creating a course marketplace, instructor signup should be open.', 'tutor'),
481 ),
482 'instructor_can_publish_course' => array(
483 'type' => 'switch',
484 'lable' => __('Earning', 'tutor'),
485 'desc' => __('Enable earning for instructors?', 'tutor'),
486 ),
487 )
488 ),
489
490
491 'profile' => array(
492 'lable' => __('Profile Settings', 'tutor'),
493 'attr' => array(
494 'students_own_review_show_at_profile' => array(
495 'type' => 'switch',
496 'lable' => __('Show Reviews on Profile', 'tutor'),
497 'desc' => __('Choose whether you want to show students’ ratings and reviews.', 'tutor'),
498 ),
499 'show_courses_completed_by_student' => array(
500 'type' => 'switch',
501 'lable' => __('Show Completed Courses', 'tutor'),
502 'desc' => __('Choose whether you want to display a list of a student’s completed courses.', 'tutor'),
503 )
504 )
505 ),
506
507
508 'payment' => array(
509 'lable' => __('Payment Settings ', 'tutor'),
510 'attr' => array(
511 'enable_guest_course_cart' => array(
512 'type' => 'switch',
513 'lable' => __('Guest Checkout', 'tutor'),
514 'desc' => __('Allow users to buy and consume content without logging in.', 'tutor')
515 ),
516 'commission_split' => array(
517 'type' => 'range',
518 'lable' => __('Commission Rate', 'tutor'),
519 'class' => 'tutor-show-hide',
520 'tooltip' => __('Control revenue sharing between admin and instructor.', 'tutor')
521 ),
522 'earning_instructor_commission' => array(
523 'type' => 'commission',
524 ),
525 'earning_admin_commission' => array(
526 'type' => 'commission',
527 ),
528 'withdraw_split' => array(
529 'type' => 'payments',
530 'lable' => __('Payment Withdrawal Method', 'tutor'),
531 'class' => 'tutor-show-hide',
532 'desc' => __('Choose your preferred withdrawal method from the options.', 'tutor')
533 ),
534
535
536 )
537 ),
538
539
540 );
541
542 return $general_fields;
543 }
544
545 public function tutor_setup_wizard_settings() {
546
547 $options = (array) maybe_unserialize(get_option('tutor_option'));
548
549 ?>
550 <div class="tutor-wizard-container">
551 <div class="tutor-wrapper-boarding tutor-setup-wizard-settings">
552 <div class="tutor-setup-wrapper">
553 <ul class="tutor-setup-title">
554 <li data-url="general" class="general active current"><?php _e('General', 'tutor'); ?></li>
555 <li data-url="course" class="course"><?php _e('Course', 'tutor'); ?></li>
556 <li data-url="quiz" class="quiz"><?php _e('Quiz', 'tutor'); ?></li>
557 <li data-url="instructor" class="instructor"><?php _e('Instructor', 'tutor'); ?></li>
558 <li data-url="profile" class="profile"><?php _e('Profile', 'tutor'); ?></li>
559 <li data-url="payment" class="payment"><?php _e('Payment', 'tutor'); ?></li>
560 <li data-url="finish" class="finish"><?php _e('Finish', 'tutor'); ?></li>
561 </ul>
562
563
564 <form id="tutor-setup-form" method="post">
565 <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
566 <input type="hidden" name="action" value="setup_action">
567 <?php $course_marketplace = tutor_utils()->get_option('enable_course_marketplace'); ?>
568 <input type="hidden" name="enable_course_marketplace" class="enable_course_marketplace_data" value="<?php echo ($course_marketplace ? 1 : 0); ?>">
569 <?php $earning = tutor_utils()->get_option('enable_tutor_earning'); ?>
570 <input type="hidden" name="enable_tutor_earning" class="enable_tutor_earning_data" value="<?php echo ($earning ? 1 : 0); ?>">
571 <ul class="tutor-setup-content">
572 <?php $this->tutor_setup_generator(); ?>
573 <li>
574 <div class="tutor-setup-content-heading greetings">
575 <div class="header">
576 <img src="<?php echo tutor()->url . 'assets/images/greeting-img.jpg'; ?>" alt="greeting">
577 </div>
578 <div class="content">
579 <h2><?php _e('Congratulations, you’re all set!', 'tutor'); ?></h2>
580 <p><?php _e( 'Tutor LMS is up and running on your website! If you really want to become a Tutor LMS genius, read our <a target="_blank" href="https://docs.themeum.com/tutor-lms/">documentation</a> that covers everything!', 'tutor' ); ?></p>
581 <p><?php _e( 'If you need further assistance, please don’t hesitate to contact us via our <a target="_blank" href="https://www.themeum.com/contact-us/">contact form.</a>', 'tutor' ); ?></p>
582 </div>
583 <div class="tutor-setup-content-footer footer">
584 <button class="tutor-redirect primary-btn" data-url="<?php echo admin_url('post-new.php?post_type=courses'); ?>"><?php _e('CREATE A NEW COURSE', 'tutor'); ?></button>
585 <button class="tutor-redirect primary-btn" data-url="<?php echo admin_url('admin.php?page=tutor-addons'); ?>"><?php _e('EXPLORE ADDONS', 'tutor'); ?></button>
586 </div>
587 </div>
588 </li>
589 </ul>
590 </form>
591
592
593 </div>
594 </div>
595 </div>
596 <?php
597 }
598
599
600 public function tutor_setup_wizard_action() {
601
602 $html = '<div class="tutor-setup-content-footer footer">';
603 $html .= '<div class="tutor-setup-btn-wrapper">';
604 $html .= '<button class="tutor-setup-previous previous animated-btn">';
605 $html .= '<svg xmlns="http://www.w3.org/2000/svg" id="prev-arrow-1" width="17" height="12">';
606 $html .= '<path fill="#fff" stroke="" d="M11.492.65a.603.603 0 0 0-.86 0 .607.607 0 0 0 0 .85l4.361 4.362H.603A.6.6 0 0 0 0 6.465c0 .335.267.61.602.61h14.391l-4.36 4.353a.617.617 0 0 0 0 .86c.24.241.627.241.86 0l5.393-5.393a.592.592 0 0 0 0-.852L11.492.65z"/>';
607 $html .= '</svg>';
608 $html .= '<span>'.__('Previous', 'tutor').'</span>';
609 $html .= '</button>';
610 $html .= '</div>';
611 $html .= '<div class="tutor-setup-btn-wrapper">';
612 $html .= '<button class="tutor-setup-skip">'.__('Skip This Step', 'tutor').'</button>';
613 $html .= '</div>';
614 $html .= '<div class="tutor-setup-btn-wrapper">';
615 $html .= '<button class="tutor-setup-next next animated-btn">';
616 $html .= '<span>'.__('Next', 'tutor').'</span>';
617 $html .= '<svg xmlns="http://www.w3.org/2000/svg" id="next-arrow-2" width="17" height="12">';
618 $html .= '<path fill="#fff" stroke="" d="M11.492.65a.603.603 0 0 0-.86 0 .607.607 0 0 0 0 .85l4.361 4.362H.603A.6.6 0 0 0 0 6.465c0 .335.267.61.602.61h14.391l-4.36 4.353a.617.617 0 0 0 0 .86c.24.241.627.241.86 0l5.393-5.393a.592.592 0 0 0 0-.852L11.492.65z"/>';
619 $html .= '</svg>';
620 $html .= '</button>';
621 $html .= '</div>';
622 $html .= '</div>';
623
624 return $html;
625 }
626
627 public function tutor_setup_wizard_boarding() {
628 global $current_user;
629 ?>
630 <div class="tutor-wizard-container">
631 <div class="tutor-wrapper-boarding tutor-setup-wizard-boarding active">
632 <div class="wizard-boarding-header">
633 <div><img src="<?php echo tutor()->url.'assets/images/tutor-logo.svg'; ?>" /></div>
634 <div><?php printf(__('Hello %s, welcome to Tutor LMS! Thank you for choosing us.', 'tutor'), $current_user->user_login); ?></div>
635 </div>
636 <div class="wizard-boarding-body">
637 <ul class="slider tutor-boarding">
638 <li>
639
640 <div class="slide-thumb"><img src="<?php echo tutor()->url . 'assets/images/scalable_lms_solution.jpg'; ?>" alt="<?php _e('A Powerful, Smart, and Scalable LMS Solution', 'tutor') ?>"/></div>
641 <div class="slide-title"><?php _e('A Powerful, Smart, and Scalable LMS Solution', 'tutor'); ?></div>
642 <div class="slide-subtitle"><?php _e('From individual instructors to vast eLearning platforms, Tutor LMS grows with you to create your ideal vision of an LMS website.', 'tutor'); ?></div>
643 </li>
644 <li>
645 <div class="slide-thumb"><img src="<?php echo tutor()->url . 'assets/images/extensive_course_builder.jpg'; ?>" alt="<?php _e('Extensive Course Builder', 'tutor') ?>"/></div>
646 <div class="slide-title"><?php _e('Extensive Course Builder', 'tutor'); ?></div>
647 <div class="slide-subtitle"><?php _e('Tutor LMS comes with a state-of-the-art frontend course builder. Construct rich and resourceful courses with ease.', 'tutor'); ?></div>
648 </li>
649 <li>
650 <div class="slide-thumb"><img src="<?php echo tutor()->url . 'assets/images/advanced_quiz_creator.jpg'; ?>" alt="<?php _e('Advanced Quiz Creator', 'tutor'); ?>"/></div>
651 <div class="slide-title"><?php _e('Advanced Quiz Creator', 'tutor'); ?></div>
652 <div class="slide-subtitle"><?php _e('Build interactive quizzes with the vast selection of question types and verify the learning of your students.', 'tutor'); ?></div>
653 </li>
654 <li>
655 <div class="slide-thumb"><img src="<?php echo tutor()->url . 'assets/images/freedom_with_ecommerce.jpg'; ?>" alt="<?php _e('Freedom With eCommerce', 'tutor'); ?>"/></div>
656 <div class="slide-title"><?php _e('Freedom With eCommerce', 'tutor'); ?></div>
657 <div class="slide-subtitle"><?php _e('Select an eCommerce plugin and sell courses any way you like and use any payment gateway you want!', 'tutor'); ?></div>
658 </li>
659 <li>
660 <div class="slide-thumb"><img src="<?php echo tutor()->url . 'assets/images/reports_and_analytics.jpg'; ?>" alt="<?php _e('Reports and Analytics', 'tutor'); ?>"/></div>
661 <div class="slide-title"><?php _e('Reports and Analytics', 'tutor'); ?></div>
662 <div class="slide-subtitle"><?php _e('Track what type of courses sell the most! Gain insights on user purchases, manage reviews and track quiz attempts.', 'tutor'); ?></div>
663 </li>
664 </ul>
665 </div>
666 <div class="wizard-boarding-footer">
667 <div>
668 <button class="tutor-boarding-next next animated-btn">
669 <span><?php _e('Let’s Start', 'tutor'); ?></span>
670 <svg xmlns="http://www.w3.org/2000/svg" id="next-arrow-2" width="17" height="12">
671 <path fill="#fff" stroke="" d="M11.492.65a.603.603 0 0 0-.86 0 .607.607 0 0 0 0 .85l4.361 4.362H.603A.6.6 0 0 0 0 6.465c0 .335.267.61.602.61h14.391l-4.36 4.353a.617.617 0 0 0 0 .86c.24.241.627.241.86 0l5.393-5.393a.592.592 0 0 0 0-.852L11.492.65z"/>
672 </svg>
673 </button>
674 </div>
675 <div><a href="<?php echo admin_url(); ?>"><?php _e('I already know, skip this!', 'tutor'); ?></a></div>
676 </div>
677 </div>
678 </div>
679 <?php
680 }
681
682 public function tutor_setup_wizard_type() {
683 $course_marketplace = tutor_utils()->get_option('enable_course_marketplace');
684 ?>
685 <div class="tutor-wizard-container">
686 <div class="tutor-wrapper-type tutor-setup-wizard-type">
687 <div class="wizard-type-header">
688 <div class="logo"><img src="<?php echo tutor()->url.'assets/images/tutor-logo.svg'; ?>" /></div>
689 <div class="title"><?php _e('Let’s get the platform up and running', 'tutor'); ?></div>
690 <div class="subtitle"><?php _e('Pick a category for your LMS platform. You can always update this later.', 'tutor'); ?></div>
691 </div>
692 <div class="wizard-type-body">
693 <div class="wizard-type-item">
694 <input id="enable_course_marketplace-0" type="radio" name="enable_course_marketplace_setup" value="0" <?php if(!$course_marketplace){ echo 'checked'; } ?> />
695 <span class="icon"></span>
696 <label for="enable_course_marketplace-0">
697 <img src="<?php echo tutor()->url.'assets/images/single-marketplace.png'; ?>" />
698 <div class="title"><?php _e( 'Individual', 'tutor' ); ?></div>
699 <div class="subtitle"><?php _e( 'I want to start my solo journey as an educator and spread my knowledge.', 'tutor' ); ?></div>
700 </label>
701 </div>
702
703 <div class="wizard-type-item">
704 <input id="enable_course_marketplace-1" type="radio" name="enable_course_marketplace_setup" value="1" <?php if($course_marketplace){ echo 'checked'; } ?>/>
705 <span class="icon"></span>
706 <label for="enable_course_marketplace-1">
707 <img src="<?php echo tutor()->url.'assets/images/multiple-marketplace.png'; ?>" />
708 <div class="title"><?php _e( 'Marketplace', 'tutor' ); ?></div>
709 <div class="subtitle"><?php _e( 'I want to create an eLearning platform to let anyone earn by teaching online.', 'tutor' ); ?></div>
710 </label>
711 </div>
712 </div>
713
714 <div class="wizard-type-footer">
715 <div>
716 <button class="tutor-setup-type-previous previous animated-btn">
717 <svg xmlns="http://www.w3.org/2000/svg" id="prev-arrow-1" width="17" height="12">
718 <path fill="#fff" stroke="" d="M11.492.65a.603.603 0 0 0-.86 0 .607.607 0 0 0 0 .85l4.361 4.362H.603A.6.6 0 0 0 0 6.465c0 .335.267.61.602.61h14.391l-4.36 4.353a.617.617 0 0 0 0 .86c.24.241.627.241.86 0l5.393-5.393a.592.592 0 0 0 0-.852L11.492.65z"></path></svg>
719 <?php _e('Previous', 'tutor'); ?>
720 </button>
721
722 <button class="tutor-type-next primary-btn next">
723 <span><?php _e('Next', 'tutor'); ?></span>
724 <svg xmlns="http://www.w3.org/2000/svg" width="17" height="12">
725 <path fill="#fff" stroke="" d="M11.492.65a.603.603 0 0 0-.86 0 .607.607 0 0 0 0 .85l4.361 4.362H.603A.6.6 0 0 0 0 6.465c0 .335.267.61.602.61h14.391l-4.36 4.353a.617.617 0 0 0 0 .86c.24.241.627.241.86 0l5.393-5.393a.592.592 0 0 0 0-.852L11.492.65z"/>
726 </svg>
727 </button>
728 </div>
729 <div>
730 <a href="#" class="tutor-type-skip" class=""><?php _e('Not sure. Let’s go to the next step.', 'tutor'); ?></a>
731 </div>
732 </div>
733 </div>
734 </div>
735 <?php
736 }
737
738
739 public function tutor_setup_wizard_header() {
740 set_current_screen();
741 ?>
742 <!DOCTYPE html>
743 <html <?php language_attributes(); ?>>
744 <head>
745 <meta name="viewport" content="width=device-width" />
746 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
747 <title><?php esc_html_e( 'Tutor &rsaquo; Setup Wizard', 'tutor' ); ?></title>
748 <?php do_action( 'admin_enqueue_scripts' ); ?>
749 <?php wp_print_scripts( 'tutor-plyr' ); ?>
750 <?php wp_print_scripts( 'tutor-slick' ); ?>
751 <?php wp_print_scripts( 'tutor-setup' ); ?>
752 <?php do_action( 'admin_print_styles' ); ?>
753 <?php do_action( 'admin_head' ); ?>
754 </head>
755 <body class="tutor-setup wp-core-ui">
756 <?php
757 }
758
759
760 public function tutor_setup_wizard_footer() {
761 ?>
762 </body>
763 </html>
764 <?php
765 }
766
767
768 public function enqueue_scripts() {
769 if (isset($_GET['page'])) {
770 if ($_GET['page'] == 'tutor-setup') {
771 wp_enqueue_style( 'tutor-setup', tutor()->url . 'assets/css/tutor-setup.css', array(), tutor()->version );
772 wp_enqueue_style( 'tutor-slick', tutor()->url . 'assets/packages/slick/slick.css', array(), tutor()->version );
773 wp_enqueue_style( 'tutor-slick-theme', tutor()->url . 'assets/packages/slick/slick-theme.css', array(), tutor()->version );
774 wp_register_script( 'tutor-slick', tutor()->url . 'assets/packages/slick/slick.min.js', array( 'jquery' ), tutor()->version, true );
775 wp_register_script( 'tutor-setup', tutor()->url . 'assets/js/tutor-setup.js', array( 'jquery', 'tutor-slick' ), tutor()->version, true );
776 wp_localize_script('tutor-setup', '_tutorobject', array('ajaxurl' => admin_url('admin-ajax.php')));
777 }
778 }
779 }
780
781
782 }
783
784