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