| @@ -1,182 +1,780 @@ | ||
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * Tutor setup class | |
| 4 | - * | |
| 5 | - * @package Tutor\Setup | |
| 6 | - * @author Themeum <support@themeum.com> | |
| 7 | - * @link https://themeum.com | |
| 8 | - * @since 1.0.0 | |
| 9 | - */ | |
| 2 | +namespace TUTOR; | |
| 10 | 3 | |
| 11 | -namespace TUTOR; | |
| 4 | +if ( ! defined( 'ABSPATH' ) ) | |
| 5 | + exit; | |
| 12 | 6 | |
| 13 | -use Tutor\Helpers\HttpHelper; | |
| 14 | -use Tutor\Traits\JsonResponse; | |
| 15 | 7 | |
| 16 | -defined( 'ABSPATH' ) || exit; | |
| 8 | + class Tutor_Setup { | |
| 17 | 9 | |
| 18 | -/** | |
| 19 | - * Manage setup functionalities | |
| 20 | - * | |
| 21 | - * @since 1.0.0 | |
| 22 | - */ | |
| 23 | -class Tutor_Setup { | |
| 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 | + } | |
| 24 | 17 | |
| 25 | - use JsonResponse; | |
| 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 | + | |
| 26 | 30 | |
| 27 | - /** | |
| 28 | - * Sample courses JSON URL for onboarding import. | |
| 29 | - * | |
| 30 | - * @since 4.0.0 | |
| 31 | - */ | |
| 32 | - const TUTOR_SAMPLE_COURSES_JSON_URL = 'https://tutor-lms.s3.us-east-1.amazonaws.com/courses/onbaord-courses.json'; | |
| 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 | + } | |
| 33 | 36 | |
| 34 | - /** | |
| 35 | - * Register hooks | |
| 36 | - * | |
| 37 | - * @since 1.0.0 | |
| 38 | - */ | |
| 39 | - public function __construct() { | |
| 40 | - add_action( 'admin_menu', array( $this, 'admin_menus' ) ); | |
| 41 | - add_action( 'admin_init', array( $this, 'init_onboarding' ) ); | |
| 42 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_onboard_scripts' ) ); | |
| 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); | |
| 43 | 53 | |
| 44 | - add_action( 'wp_ajax_tutor_onboard_setup', array( $this, 'ajax_onboard_setup' ) ); | |
| 45 | - add_action( 'wp_ajax_tutor_import_sample_courses', array( $this, 'ajax_import_sample_courses' ) ); | |
| 46 | - } | |
| 47 | 54 | |
| 48 | - /** | |
| 49 | - * Add dashboard page without title | |
| 50 | - * | |
| 51 | - * @since 1.0.0 | |
| 52 | - * | |
| 53 | - * @return void | |
| 54 | - */ | |
| 55 | - public function admin_menus() { | |
| 56 | - add_dashboard_page( '', '', 'manage_options', 'tutor-setup', '' ); | |
| 57 | - } | |
| 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'); | |
| 58 | 73 | |
| 59 | - /** | |
| 60 | - * Initialize tutor onboarding | |
| 61 | - * | |
| 62 | - * @since 4.0.0 onboarding | |
| 63 | - * | |
| 64 | - * @return void | |
| 65 | - */ | |
| 66 | - public function init_onboarding() { | |
| 67 | - $setup_page = Input::get( 'page', '' ); | |
| 68 | - if ( 'tutor-setup' === $setup_page ) { | |
| 69 | - include tutor()->path . 'views/onboarding.php'; | |
| 70 | - exit; | |
| 71 | - } | |
| 72 | - } | |
| 74 | + wp_send_json_success(array('status' => 'success')); | |
| 75 | + } | |
| 73 | 76 | |
| 74 | - /** | |
| 75 | - * Tutor Onboarding Setup description | |
| 76 | - * | |
| 77 | - * @return void | |
| 78 | - * | |
| 79 | - * @since 4.0.0 onboarding | |
| 80 | - */ | |
| 81 | - public function ajax_onboard_setup() { | |
| 82 | - try { | |
| 83 | - tutor_utils()->check_nonce(); | |
| 84 | - if ( 'tutor_onboard_setup' !== Input::post( 'action', '' ) || ! current_user_can( 'manage_options' ) ) { | |
| 85 | - $this->response_bad_request( tutor_utils()->error_message() ); | |
| 86 | - } | |
| 87 | 77 | |
| 88 | - $options = get_option( 'tutor_option', array() ); | |
| 78 | + public function admin_menus() { | |
| 79 | + add_dashboard_page( '', '', 'manage_options', 'tutor-setup', '' ); | |
| 80 | + } | |
| 89 | 81 | |
| 90 | - $options['default_theme'] = Input::post( 'default_theme' ); | |
| 91 | - $options['learning_mode'] = Input::post( 'learning_mode' ); | |
| 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 | + } | |
| 92 | 94 | |
| 93 | - update_option( 'tutor_option', $options ); | |
| 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(); | |
| 94 | 102 | |
| 95 | - $this->json_response( __( 'Onboard Successfully', 'tutor' ) ); | |
| 96 | - } catch ( \Exception $e ) { | |
| 97 | - $this->json_response( | |
| 98 | - __( 'Onboard Failed, Try again!', 'tutor' ), | |
| 99 | - null, | |
| 100 | - HttpHelper::STATUS_INTERNAL_SERVER_ERROR | |
| 101 | - ); | |
| 102 | - } | |
| 103 | - } | |
| 103 | + $down_desc_fields = array('rows', 'slider', 'text', 'radio', 'dropdown', 'range', 'payments'); | |
| 104 | + $full_width_fields = array('rows', 'slider', 'radio', 'range', 'payments', 'dropdown'); | |
| 104 | 105 | |
| 105 | - /** | |
| 106 | - * Handle sample courses import. | |
| 107 | - * | |
| 108 | - * @since 4.0.0 | |
| 109 | - */ | |
| 110 | - public function ajax_import_sample_courses() { | |
| 111 | - tutor_utils()->check_nonce(); | |
| 112 | - if ( ! User::can( 'manage_options' ) ) { | |
| 113 | - $this->response_bad_request( tutor_utils()->error_message() ); | |
| 114 | - } | |
| 106 | + foreach ($field_arr as $key_parent => $field_parent) { | |
| 115 | 107 | |
| 116 | - try { | |
| 117 | - ( new SampleCourse() )->import( self::TUTOR_SAMPLE_COURSES_JSON_URL ); | |
| 118 | - $this->json_response( __( 'Sample courses imported successfully', 'tutor' ) ); | |
| 119 | - } catch ( \Throwable $th ) { | |
| 120 | - $this->response_bad_request( tutor_utils()->error_message() ); | |
| 121 | - } | |
| 122 | - } | |
| 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">'; | |
| 123 | 122 | |
| 124 | - /** | |
| 125 | - * Tutor onboarding enqueue scripts | |
| 126 | - * | |
| 127 | - * @since 1.0.0 | |
| 128 | - * | |
| 129 | - * @return void | |
| 130 | - */ | |
| 131 | - public function enqueue_onboard_scripts() { | |
| 132 | - $page = Input::get( 'page', '' ); | |
| 133 | - if ( 'tutor-setup' === $page ) { | |
| 134 | - wp_enqueue_style( 'tutor-setup', tutor()->url . 'assets/css/tutor-setup.min.css', array(), TUTOR_VERSION ); | |
| 135 | - wp_register_script( 'tutor-setup', tutor()->url . 'assets/js/tutor-setup.js', array( 'wp-i18n' ), TUTOR_VERSION, true ); | |
| 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>' : ''; | |
| 136 | 129 | |
| 137 | - if ( is_rtl() ) { | |
| 138 | - wp_enqueue_style( 'tutor', tutor()->url . 'assets/css/tutor-rtl.min.css', array(), TUTOR_VERSION ); | |
| 139 | - } else { | |
| 140 | - wp_enqueue_style( 'tutor', tutor()->url . 'assets/css/tutor.min.css', array(), TUTOR_VERSION ); | |
| 141 | - } | |
| 130 | + if(!in_array($field['type'], $down_desc_fields)) { | |
| 131 | + $html .= isset( $field['desc'] ) ? '<div class="content">'.$field['desc'].'</div>' : ''; | |
| 132 | + } | |
| 142 | 133 | |
| 143 | - wp_enqueue_script( 'tutor-script', tutor()->url . 'assets/js/tutor.js', array( 'wp-i18n' ), TUTOR_VERSION, true ); | |
| 134 | + $html .= '<div class="settings">'; | |
| 144 | 135 | |
| 145 | - // load google inter font. | |
| 146 | - wp_enqueue_style( 'tutor-inter-font', 'https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap', array(), TUTOR_VERSION ); | |
| 136 | + switch ($field['type']) { | |
| 147 | 137 | |
| 148 | - wp_localize_script( | |
| 149 | - 'tutor-setup', | |
| 150 | - '_tutorOnboardObject', | |
| 151 | - array( | |
| 152 | - 'tutor_welcome_page' => admin_url( 'admin.php?page=tutor&welcome=1' ), | |
| 153 | - 'course_data_url' => 'https://tutor-lms.s3.us-east-1.amazonaws.com/courses/workademy/data.json', | |
| 154 | - ) | |
| 155 | - ); | |
| 156 | - wp_set_script_translations( 'tutor-setup', 'tutor', tutor()->path . 'languages/' ); | |
| 157 | - } | |
| 158 | - } | |
| 138 | + case 'switch': | |
| 139 | + $html .= '<label for="'.$key.'" class="switch-label input-switch-label">'; | |
| 140 | + $html .= '<span class="label-off">'.__('OFF', 'tutor').'</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', 'tutor').'</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; | |
| 159 | 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; | |
| 160 | 233 | |
| 161 | - /** | |
| 162 | - * Check if welcome page already visited | |
| 163 | - * | |
| 164 | - * @since 1.0.0 | |
| 165 | - * | |
| 166 | - * @return bool | |
| 167 | - */ | |
| 168 | - public static function is_welcome_page_visited(): bool { | |
| 169 | - return false; | |
| 170 | - } | |
| 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; | |
| 171 | 255 | |
| 172 | - /** | |
| 173 | - * Mark as welcome page visited | |
| 174 | - * | |
| 175 | - * @since 1.0.0 | |
| 176 | - * | |
| 177 | - * @return void | |
| 178 | - */ | |
| 179 | - public static function mark_as_visited() { | |
| 180 | - update_option( 'tutor_welcome_page_visited', true ); | |
| 181 | - } | |
| 182 | -} | |
| 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_tutor_earning' => array( | |
| 358 | + 'type' => 'earning' | |
| 359 | + ), | |
| 360 | + 'enable_public_profile' => array( | |
| 361 | + 'type' => 'switch', | |
| 362 | + 'lable' => __('Public Profile', 'tutor'), | |
| 363 | + 'desc' => __('Allow users to have a public profile to showcase awards and completed courses.', 'tutor'), | |
| 364 | + ), | |
| 365 | + 'enable_spotlight_mode' => array( | |
| 366 | + 'type' => 'switch', | |
| 367 | + 'lable' => __('Spotlight Mode', 'tutor'), | |
| 368 | + 'desc' => __('Create a focused learning environment. Block out all the distractions around your course content.', 'tutor'), | |
| 369 | + ), | |
| 370 | + 'disable_default_player_youtube' => array( | |
| 371 | + 'type' => 'switch', | |
| 372 | + 'lable' => __('YouTube Player', 'tutor'), | |
| 373 | + 'desc' => __('Toggle to use the default YouTube player.', 'tutor'), | |
| 374 | + ), | |
| 375 | + 'disable_default_player_vimeo' => array( | |
| 376 | + 'type' => 'switch', | |
| 377 | + 'lable' => __('Vimeo Player', 'tutor'), | |
| 378 | + 'desc' => __('Toggle to use the default Vimeo player.', 'tutor'), | |
| 379 | + ), | |
| 380 | + 'lesson_permalink_base' => array( | |
| 381 | + 'type' => 'text', | |
| 382 | + 'max' => 50, | |
| 383 | + 'lable' => __('Lesson Slug', 'tutor'), | |
| 384 | + 'desc' => __('Pick the URL prefix you want for your lessons.', 'tutor'), | |
| 385 | + ) | |
| 386 | + ) | |
| 387 | + ), | |
| 388 | + | |
| 389 | + | |
| 390 | + 'course' => array( | |
| 391 | + 'lable' => __('Course Settings', 'tutor'), | |
| 392 | + 'attr' => array( | |
| 393 | + 'display_course_instructors' => array( | |
| 394 | + 'type' => 'switch', | |
| 395 | + 'lable' => __('Show Instructor Bio', 'tutor'), | |
| 396 | + 'desc' => __('Let the students know the instructor(s). Display their credentials, professional experience, and more.', 'tutor'), | |
| 397 | + ), | |
| 398 | + 'enable_q_and_a_on_course' => array( | |
| 399 | + 'type' => 'switch', | |
| 400 | + 'lable' => __('Question and Anwser', 'tutor'), | |
| 401 | + 'desc' => __('Allows a Q&A forum on each course.', 'tutor'), | |
| 402 | + ), | |
| 403 | + 'courses_col_per_row' => array( | |
| 404 | + 'type' => 'rows', | |
| 405 | + 'lable' => __('Courses Per Row', 'tutor'), | |
| 406 | + 'tooltip' => __('How many courses per row on the archive pages.', 'tutor') | |
| 407 | + ), | |
| 408 | + 'courses_per_page' => array( | |
| 409 | + 'type' => 'slider', | |
| 410 | + 'lable' => __('Courses Per Page', 'tutor'), | |
| 411 | + 'tooltip' => __('How many courses per page on the archive pages.', 'tutor'), | |
| 412 | + ) | |
| 413 | + ) | |
| 414 | + ), | |
| 415 | + | |
| 416 | + | |
| 417 | + 'quiz' => array( | |
| 418 | + 'lable' => __('Quiz Settings', 'tutor'), | |
| 419 | + 'attr' => array( | |
| 420 | + 'quiz_time_limit' => array( | |
| 421 | + 'type' => 'slider', | |
| 422 | + 'time' => true, | |
| 423 | + 'lable' => __('Time Limit', 'tutor'), | |
| 424 | + 'tooltip' => __('How much time to complete a quiz?', 'tutor'), | |
| 425 | + ), | |
| 426 | + 'quiz_when_time_expires' => array( | |
| 427 | + 'type' => 'radio', | |
| 428 | + 'lable' => __('When Time Expires', 'tutor'), | |
| 429 | + 'options' => array( | |
| 430 | + 'autosubmit' => __('The current quiz answers are submitted automatically.', 'tutor'), | |
| 431 | + 'graceperiod' => __('The current quiz answers are submitted by students.', 'tutor'), | |
| 432 | + 'autoabandon' => __('Attempts must be submitted before time expires, otherwise they will not be counted', 'tutor'), | |
| 433 | + ), | |
| 434 | + 'tooltip' => __('What message to display when the quiz time expires?', 'tutor'), | |
| 435 | + ), | |
| 436 | + 'quiz_attempts_allowed' => array( | |
| 437 | + 'type' => 'attempt', | |
| 438 | + 'lable' => __('Attempts Allowed', 'tutor'), | |
| 439 | + 'tooltip' => __('How many attempts does a student get to pass a quiz?', 'tutor'), | |
| 440 | + ), | |
| 441 | + 'quiz_grade_method' => array( | |
| 442 | + 'type' => 'dropdown', | |
| 443 | + 'lable' => __('Final Grade Calculation', 'tutor'), | |
| 444 | + 'options' => array( | |
| 445 | + array( | |
| 446 | + 'title' => __('Highest Grade', 'tutor'), | |
| 447 | + 'desc' => __('Pick the student’s best grade', 'tutor'), | |
| 448 | + 'value' => 'highest_grade', | |
| 449 | + ), | |
| 450 | + array( | |
| 451 | + 'title' => __('Average Grade', 'tutor'), | |
| 452 | + 'desc' => __('Use the average score', 'tutor'), | |
| 453 | + 'value' => 'average_grade', | |
| 454 | + ), | |
| 455 | + array( | |
| 456 | + 'title' => __('First Attempt', 'tutor'), | |
| 457 | + 'desc' => __('Pick the first attempt', 'tutor'), | |
| 458 | + 'value' => 'first_attempt', | |
| 459 | + ), | |
| 460 | + array( | |
| 461 | + 'title' => __('Last Attempt', 'tutor'), | |
| 462 | + 'desc' => __('Pick the most recent attempt', 'tutor'), | |
| 463 | + 'value' => 'last_attempt', | |
| 464 | + ), | |
| 465 | + ), | |
| 466 | + 'tooltip' => __('When you allow multiple quiz attempts, which grade do you want to count?', 'tutor'), | |
| 467 | + ) | |
| 468 | + ) | |
| 469 | + ), | |
| 470 | + | |
| 471 | + | |
| 472 | + 'instructor' => array( | |
| 473 | + 'lable' => __('Instructor Settings', 'tutor'), | |
| 474 | + 'attr' => array( | |
| 475 | + 'enable_become_instructor_btn' => array( | |
| 476 | + 'type' => 'switch', | |
| 477 | + 'lable' => __('New Signup', 'tutor'), | |
| 478 | + 'desc' => __('Choose between open and closed instructor signup. If you’re creating a course marketplace, instructor signup should be open.', 'tutor'), | |
| 479 | + ), | |
| 480 | + 'instructor_can_publish_course' => array( | |
| 481 | + 'type' => 'switch', | |
| 482 | + 'lable' => __('Earning', 'tutor'), | |
| 483 | + 'desc' => __('Enable earning for instructors?', 'tutor'), | |
| 484 | + ), | |
| 485 | + ) | |
| 486 | + ), | |
| 487 | + | |
| 488 | + | |
| 489 | + 'profile' => array( | |
| 490 | + 'lable' => __('Profile Settings', 'tutor'), | |
| 491 | + 'attr' => array( | |
| 492 | + 'students_own_review_show_at_profile' => array( | |
| 493 | + 'type' => 'switch', | |
| 494 | + 'lable' => __('Show Reviews on Profile', 'tutor'), | |
| 495 | + 'desc' => __('Choose whether you want to show students’ ratings and reviews.', 'tutor'), | |
| 496 | + ), | |
| 497 | + 'show_courses_completed_by_student' => array( | |
| 498 | + 'type' => 'switch', | |
| 499 | + 'lable' => __('Show Completed Courses', 'tutor'), | |
| 500 | + 'desc' => __('Choose whether you want to display a list of a student’s completed courses.', 'tutor'), | |
| 501 | + ) | |
| 502 | + ) | |
| 503 | + ), | |
| 504 | + | |
| 505 | + | |
| 506 | + 'payment' => array( | |
| 507 | + 'lable' => __('Payment Settings ', 'tutor'), | |
| 508 | + 'attr' => array( | |
| 509 | + 'enable_guest_course_cart' => array( | |
| 510 | + 'type' => 'switch', | |
| 511 | + 'lable' => __('Guest Checkout', 'tutor'), | |
| 512 | + 'desc' => __('Allow users to buy and consume content without logging in.', 'tutor') | |
| 513 | + ), | |
| 514 | + 'commission_split' => array( | |
| 515 | + 'type' => 'range', | |
| 516 | + 'lable' => __('Commission Rate', 'tutor'), | |
| 517 | + 'class' => 'tutor-show-hide', | |
| 518 | + 'tooltip' => __('Control revenue sharing between admin and instructor.', 'tutor') | |
| 519 | + ), | |
| 520 | + 'earning_instructor_commission' => array( | |
| 521 | + 'type' => 'commission', | |
| 522 | + ), | |
| 523 | + 'earning_admin_commission' => array( | |
| 524 | + 'type' => 'commission', | |
| 525 | + ), | |
| 526 | + 'withdraw_split' => array( | |
| 527 | + 'type' => 'payments', | |
| 528 | + 'lable' => __('Payment Withdrawal Method', 'tutor'), | |
| 529 | + 'class' => 'tutor-show-hide', | |
| 530 | + 'desc' => __('Choose your preferred withdrawal method from the options.', 'tutor') | |
| 531 | + ), | |
| 532 | + | |
| 533 | + | |
| 534 | + ) | |
| 535 | + ), | |
| 536 | + | |
| 537 | + | |
| 538 | + ); | |
| 539 | + | |
| 540 | + return $general_fields; | |
| 541 | + } | |
| 542 | + | |
| 543 | + public function tutor_setup_wizard_settings() { | |
| 544 | + | |
| 545 | + $options = (array) maybe_unserialize(get_option('tutor_option')); | |
| 546 | + | |
| 547 | + ?> | |
| 548 | + <div class="tutor-wizard-container"> | |
| 549 | + <div class="tutor-wrapper-boarding tutor-setup-wizard-settings"> | |
| 550 | + <div class="tutor-setup-wrapper"> | |
| 551 | + <ul class="tutor-setup-title"> | |
| 552 | + <li data-url="general" class="general active current"><?php _e('General', 'tutor'); ?></li> | |
| 553 | + <li data-url="course" class="course"><?php _e('Course', 'tutor'); ?></li> | |
| 554 | + <li data-url="quiz" class="quiz"><?php _e('Quiz', 'tutor'); ?></li> | |
| 555 | + <li data-url="instructor" class="instructor"><?php _e('Instructor', 'tutor'); ?></li> | |
| 556 | + <li data-url="profile" class="profile"><?php _e('Profile', 'tutor'); ?></li> | |
| 557 | + <li data-url="payment" class="payment"><?php _e('Payment', 'tutor'); ?></li> | |
| 558 | + <li data-url="finish" class="finish"><?php _e('Finish', 'tutor'); ?></li> | |
| 559 | + </ul> | |
| 560 | + | |
| 561 | + | |
| 562 | + <form id="tutor-setup-form" method="post"> | |
| 563 | + <input type="hidden" name="action" value="setup_action"> | |
| 564 | + <?php $course_marketplace = tutor_utils()->get_option('enable_course_marketplace'); ?> | |
| 565 | + <input type="hidden" name="enable_course_marketplace" class="enable_course_marketplace_data" value="<?php echo ($course_marketplace ? 1 : 0); ?>"> | |
| 566 | + <?php $earning = tutor_utils()->get_option('enable_tutor_earning'); ?> | |
| 567 | + <input type="hidden" name="enable_tutor_earning" class="enable_tutor_earning_data" value="<?php echo ($earning ? 1 : 0); ?>"> | |
| 568 | + <ul class="tutor-setup-content"> | |
| 569 | + <?php $this->tutor_setup_generator(); ?> | |
| 570 | + <li> | |
| 571 | + <div class="tutor-setup-content-heading greetings"> | |
| 572 | + <div class="header"> | |
| 573 | + <img src="<?php echo tutor()->url . 'assets/images/greeting-img.jpg'; ?>" alt="greeting"> | |
| 574 | + </div> | |
| 575 | + <div class="content"> | |
| 576 | + <h2><?php _e('Congratulations, you’re all set!', 'tutor'); ?></h2> | |
| 577 | + <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> | |
| 578 | + <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> | |
| 579 | + </div> | |
| 580 | + <div class="tutor-setup-content-footer footer"> | |
| 581 | + <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> | |
| 582 | + <button class="tutor-redirect primary-btn" data-url="<?php echo admin_url('admin.php?page=tutor-addons'); ?>"><?php _e('EXPLORE ADDONS', 'tutor'); ?></button> | |
| 583 | + </div> | |
| 584 | + </div> | |
| 585 | + </li> | |
| 586 | + </ul> | |
| 587 | + </form> | |
| 588 | + | |
| 589 | + | |
| 590 | + </div> | |
| 591 | + </div> | |
| 592 | + </div> | |
| 593 | + <?php | |
| 594 | + } | |
| 595 | + | |
| 596 | + | |
| 597 | + public function tutor_setup_wizard_action() { | |
| 598 | + | |
| 599 | + $html = '<div class="tutor-setup-content-footer footer">'; | |
| 600 | + $html .= '<div class="tutor-setup-btn-wrapper">'; | |
| 601 | + $html .= '<button class="tutor-setup-previous previous animated-btn">'; | |
| 602 | + $html .= '<svg xmlns="http://www.w3.org/2000/svg" id="prev-arrow-1" width="17" height="12">'; | |
| 603 | + $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"/>'; | |
| 604 | + $html .= '</svg>'; | |
| 605 | + $html .= '<span>'.__('Previous', 'tutor').'</span>'; | |
| 606 | + $html .= '</button>'; | |
| 607 | + $html .= '</div>'; | |
| 608 | + $html .= '<div class="tutor-setup-btn-wrapper">'; | |
| 609 | + $html .= '<button class="tutor-setup-skip">'.__('Skip This Step', 'tutor').'</button>'; | |
| 610 | + $html .= '</div>'; | |
| 611 | + $html .= '<div class="tutor-setup-btn-wrapper">'; | |
| 612 | + $html .= '<button class="tutor-setup-next next animated-btn">'; | |
| 613 | + $html .= '<span>'.__('Next', 'tutor').'</span>'; | |
| 614 | + $html .= '<svg xmlns="http://www.w3.org/2000/svg" id="next-arrow-2" width="17" height="12">'; | |
| 615 | + $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"/>'; | |
| 616 | + $html .= '</svg>'; | |
| 617 | + $html .= '</button>'; | |
| 618 | + $html .= '</div>'; | |
| 619 | + $html .= '</div>'; | |
| 620 | + | |
| 621 | + return $html; | |
| 622 | + } | |
| 623 | + | |
| 624 | + public function tutor_setup_wizard_boarding() { | |
| 625 | + global $current_user; | |
| 626 | + ?> | |
| 627 | + <div class="tutor-wizard-container"> | |
| 628 | + <div class="tutor-wrapper-boarding tutor-setup-wizard-boarding active"> | |
| 629 | + <div class="wizard-boarding-header"> | |
| 630 | + <div><img src="<?php echo tutor()->url.'assets/images/tutor-logo.svg'; ?>" /></div> | |
| 631 | + <div><?php printf(__('Hello %s, welcome to Tutor LMS! Thank you for choosing us.', 'tutor'), $current_user->user_login); ?></div> | |
| 632 | + </div> | |
| 633 | + <div class="wizard-boarding-body"> | |
| 634 | + <ul class="slider tutor-boarding"> | |
| 635 | + <li> | |
| 636 | + | |
| 637 | + <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> | |
| 638 | + <div class="slide-title"><?php _e('A Powerful, Smart, and Scalable LMS Solution', 'tutor'); ?></div> | |
| 639 | + <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> | |
| 640 | + </li> | |
| 641 | + <li> | |
| 642 | + <div class="slide-thumb"><img src="<?php echo tutor()->url . 'assets/images/extensive_course_builder.jpg'; ?>" alt="<?php _e('Extensive Course Builder', 'tutor') ?>"/></div> | |
| 643 | + <div class="slide-title"><?php _e('Extensive Course Builder', 'tutor'); ?></div> | |
| 644 | + <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> | |
| 645 | + </li> | |
| 646 | + <li> | |
| 647 | + <div class="slide-thumb"><img src="<?php echo tutor()->url . 'assets/images/advanced_quiz_creator.jpg'; ?>" alt="<?php _e('Advanced Quiz Creator', 'tutor'); ?>"/></div> | |
| 648 | + <div class="slide-title"><?php _e('Advanced Quiz Creator', 'tutor'); ?></div> | |
| 649 | + <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> | |
| 650 | + </li> | |
| 651 | + <li> | |
| 652 | + <div class="slide-thumb"><img src="<?php echo tutor()->url . 'assets/images/freedom_with_ecommerce.jpg'; ?>" alt="<?php _e('Freedom With eCommerce', 'tutor'); ?>"/></div> | |
| 653 | + <div class="slide-title"><?php _e('Freedom With eCommerce', 'tutor'); ?></div> | |
| 654 | + <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> | |
| 655 | + </li> | |
| 656 | + <li> | |
| 657 | + <div class="slide-thumb"><img src="<?php echo tutor()->url . 'assets/images/reports_and_analytics.jpg'; ?>" alt="<?php _e('Reports and Analytics', 'tutor'); ?>"/></div> | |
| 658 | + <div class="slide-title"><?php _e('Reports and Analytics', 'tutor'); ?></div> | |
| 659 | + <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> | |
| 660 | + </li> | |
| 661 | + </ul> | |
| 662 | + </div> | |
| 663 | + <div class="wizard-boarding-footer"> | |
| 664 | + <div> | |
| 665 | + <button class="tutor-boarding-next next animated-btn"> | |
| 666 | + <span><?php _e('Let’s Start', 'tutor'); ?></span> | |
| 667 | + <svg xmlns="http://www.w3.org/2000/svg" id="next-arrow-2" width="17" height="12"> | |
| 668 | + <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"/> | |
| 669 | + </svg> | |
| 670 | + </button> | |
| 671 | + </div> | |
| 672 | + <div><a href="<?php echo admin_url(); ?>"><?php _e('I already know, skip this!', 'tutor'); ?></a></div> | |
| 673 | + </div> | |
| 674 | + </div> | |
| 675 | + </div> | |
| 676 | + <?php | |
| 677 | + } | |
| 678 | + | |
| 679 | + public function tutor_setup_wizard_type() { | |
| 680 | + $course_marketplace = tutor_utils()->get_option('enable_course_marketplace'); | |
| 681 | + ?> | |
| 682 | + <div class="tutor-wizard-container"> | |
| 683 | + <div class="tutor-wrapper-type tutor-setup-wizard-type"> | |
| 684 | + <div class="wizard-type-header"> | |
| 685 | + <div class="logo"><img src="<?php echo tutor()->url.'assets/images/tutor-logo.svg'; ?>" /></div> | |
| 686 | + <div class="title"><?php _e('Let’s get the platform up and running', 'tutor'); ?></div> | |
| 687 | + <div class="subtitle"><?php _e('Pick a category for your LMS platform. You can always update this later.', 'tutor'); ?></div> | |
| 688 | + </div> | |
| 689 | + <div class="wizard-type-body"> | |
| 690 | + <div class="wizard-type-item"> | |
| 691 | + <input id="enable_course_marketplace-0" type="radio" name="enable_course_marketplace_setup" value="0" <?php if(!$course_marketplace){ echo 'checked'; } ?> /> | |
| 692 | + <span class="icon"></span> | |
| 693 | + <label for="enable_course_marketplace-0"> | |
| 694 | + <img src="<?php echo tutor()->url.'assets/images/single-marketplace.png'; ?>" /> | |
| 695 | + <div class="title"><?php _e( 'Individual', 'tutor' ); ?></div> | |
| 696 | + <div class="subtitle"><?php _e( 'I want to start my solo journey as an educator and spread my knowledge.', 'tutor' ); ?></div> | |
| 697 | + </label> | |
| 698 | + </div> | |
| 699 | + | |
| 700 | + <div class="wizard-type-item"> | |
| 701 | + <input id="enable_course_marketplace-1" type="radio" name="enable_course_marketplace_setup" value="1" <?php if($course_marketplace){ echo 'checked'; } ?>/> | |
| 702 | + <span class="icon"></span> | |
| 703 | + <label for="enable_course_marketplace-1"> | |
| 704 | + <img src="<?php echo tutor()->url.'assets/images/multiple-marketplace.png'; ?>" /> | |
| 705 | + <div class="title"><?php _e( 'Marketplace', 'tutor' ); ?></div> | |
| 706 | + <div class="subtitle"><?php _e( 'I want to create an eLearning platform to let anyone earn by teaching online.', 'tutor' ); ?></div> | |
| 707 | + </label> | |
| 708 | + </div> | |
| 709 | + </div> | |
| 710 | + | |
| 711 | + <div class="wizard-type-footer"> | |
| 712 | + <div> | |
| 713 | + <button class="tutor-setup-type-previous previous animated-btn"> | |
| 714 | + <svg xmlns="http://www.w3.org/2000/svg" id="prev-arrow-1" width="17" height="12"> | |
| 715 | + <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> | |
| 716 | + <?php _e('Previous', 'tutor'); ?> | |
| 717 | + </button> | |
| 718 | + | |
| 719 | + <button class="tutor-type-next primary-btn next"> | |
| 720 | + <span><?php _e('Next', 'tutor'); ?></span> | |
| 721 | + <svg xmlns="http://www.w3.org/2000/svg" width="17" height="12"> | |
| 722 | + <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"/> | |
| 723 | + </svg> | |
| 724 | + </button> | |
| 725 | + </div> | |
| 726 | + <div> | |
| 727 | + <a href="#" class="tutor-type-skip" class=""><?php _e('Not sure. Let’s go to the next step.', 'tutor'); ?></a> | |
| 728 | + </div> | |
| 729 | + </div> | |
| 730 | + </div> | |
| 731 | + </div> | |
| 732 | + <?php | |
| 733 | + } | |
| 734 | + | |
| 735 | + | |
| 736 | + public function tutor_setup_wizard_header() { | |
| 737 | + set_current_screen(); | |
| 738 | + ?> | |
| 739 | + <!DOCTYPE html> | |
| 740 | + <html <?php language_attributes(); ?>> | |
| 741 | + <head> | |
| 742 | + <meta name="viewport" content="width=device-width" /> | |
| 743 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
| 744 | + <title><?php esc_html_e( 'Tutor › Setup Wizard', 'tutor' ); ?></title> | |
| 745 | + <?php do_action( 'admin_enqueue_scripts' ); ?> | |
| 746 | + <?php wp_print_scripts( 'tutor-plyr' ); ?> | |
| 747 | + <?php wp_print_scripts( 'tutor-slick' ); ?> | |
| 748 | + <?php wp_print_scripts( 'tutor-setup' ); ?> | |
| 749 | + <?php do_action( 'admin_print_styles' ); ?> | |
| 750 | + <?php do_action( 'admin_head' ); ?> | |
| 751 | + </head> | |
| 752 | + <body class="tutor-setup wp-core-ui"> | |
| 753 | + <?php | |
| 754 | + } | |
| 755 | + | |
| 756 | + | |
| 757 | + public function tutor_setup_wizard_footer() { | |
| 758 | + ?> | |
| 759 | + </body> | |
| 760 | + </html> | |
| 761 | + <?php | |
| 762 | + } | |
| 763 | + | |
| 764 | + | |
| 765 | + public function enqueue_scripts() { | |
| 766 | + if (isset($_GET['page'])) { | |
| 767 | + if ($_GET['page'] == 'tutor-setup') { | |
| 768 | + wp_enqueue_style( 'tutor-setup', tutor()->url . 'assets/css/tutor-setup.css', array(), tutor()->version ); | |
| 769 | + wp_enqueue_style( 'tutor-slick', tutor()->url . 'assets/packages/slick/slick.css', array(), tutor()->version ); | |
| 770 | + wp_enqueue_style( 'tutor-slick-theme', tutor()->url . 'assets/packages/slick/slick-theme.css', array(), tutor()->version ); | |
| 771 | + wp_register_script( 'tutor-slick', tutor()->url . 'assets/packages/slick/slick.min.js', array( 'jquery' ), tutor()->version, true ); | |
| 772 | + wp_register_script( 'tutor-setup', tutor()->url . 'assets/js/tutor-setup.js', array( 'jquery', 'tutor-slick' ), tutor()->version, true ); | |
| 773 | + wp_localize_script('tutor-setup', '_tutorobject', array('ajaxurl' => admin_url('admin-ajax.php'))); | |
| 774 | + } | |
| 775 | + } | |
| 776 | + } | |
| 777 | + | |
| 778 | + | |
| 779 | + } | |
| 780 | + | |