Addons.php
2 years ago
Admin.php
2 years ago
Ajax.php
2 years ago
Announcements.php
3 years ago
Assets.php
2 years ago
Backend_Page_Trait.php
3 years ago
Course.php
1 year ago
Course_Embed.php
3 years ago
Course_Filter.php
1 year ago
Course_List.php
1 year ago
Course_Settings_Tabs.php
3 years ago
Course_Widget.php
3 years ago
Custom_Validation.php
3 years ago
Dashboard.php
3 years ago
FormHandler.php
2 years ago
Frontend.php
2 years ago
Gutenberg.php
3 years ago
Input.php
3 years ago
Instructor.php
2 years ago
Instructors_List.php
1 year ago
Lesson.php
2 years ago
Options_V2.php
1 year ago
Permalink.php
2 years ago
Post_types.php
2 years ago
Private_Course_Access.php
3 years ago
Q_And_A.php
1 year ago
Question_Answers_List.php
3 years ago
Quiz.php
2 years ago
Quiz_Attempts_List.php
2 years ago
RestAPI.php
2 years ago
Reviews.php
3 years ago
Rewrite_Rules.php
2 years ago
Shortcode.php
1 year ago
Student.php
2 years ago
Students_List.php
3 years ago
Taxonomies.php
3 years ago
Template.php
2 years ago
Theme_Compatibility.php
3 years ago
Tools.php
3 years ago
Tools_V2.php
2 years ago
Tutor.php
2 years ago
TutorEDD.php
2 years ago
Tutor_Base.php
2 years ago
Tutor_Setup.php
2 years ago
Upgrader.php
2 years ago
User.php
2 years ago
Utils.php
1 year ago
Video_Stream.php
3 years ago
WhatsNew.php
2 years ago
Withdraw.php
2 years ago
Withdraw_Requests_List.php
3 years ago
WooCommerce.php
2 years ago
Tutor_Setup.php
939 lines
| 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 | */ |
| 10 | |
| 11 | namespace TUTOR; |
| 12 | |
| 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | exit; |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Manage setup functionalities |
| 19 | * |
| 20 | * @since 1.0.0 |
| 21 | */ |
| 22 | class Tutor_Setup { |
| 23 | |
| 24 | /** |
| 25 | * Register hooks |
| 26 | * |
| 27 | * @since 1.0.0 |
| 28 | */ |
| 29 | public function __construct() { |
| 30 | add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
| 31 | add_action( 'admin_init', array( $this, 'setup_wizard' ) ); |
| 32 | add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
| 33 | add_action( 'wp_ajax_setup_action', array( $this, 'tutor_setup_action' ) ); |
| 34 | add_filter( 'tutor_wizard_attributes', array( $this, 'tutor_setup_attributes_callback' ) ); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Tutor setup attr callback |
| 39 | * |
| 40 | * @since 1.0.0 |
| 41 | * |
| 42 | * @param mixed $attr attr. |
| 43 | * |
| 44 | * @return array |
| 45 | */ |
| 46 | public function tutor_setup_attributes_callback( $attr ) { |
| 47 | $options = (array) maybe_unserialize( get_option( 'tutor_option' ) ); |
| 48 | $final_arr = array(); |
| 49 | $data_arr = $this->tutor_setup_attributes(); |
| 50 | foreach ( $data_arr as $key => $section ) { |
| 51 | foreach ( $section['attr'] as $k => $val ) { |
| 52 | $final_arr[ $k ] = isset( $options[ $k ] ) ? $options[ $k ] : ''; |
| 53 | } |
| 54 | } |
| 55 | return $final_arr; |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Setup action |
| 60 | * |
| 61 | * @since 1.0.0 |
| 62 | * |
| 63 | * @return void send wp_json response |
| 64 | */ |
| 65 | public function tutor_setup_action() { |
| 66 | tutor_utils()->checking_nonce(); |
| 67 | |
| 68 | $options = (array) maybe_unserialize( get_option( 'tutor_option' ) ); |
| 69 | $action = Input::post( 'action', '' ); |
| 70 | if ( 'setup_action' !== $action || ! current_user_can( 'manage_options' ) ) { |
| 71 | return; |
| 72 | } |
| 73 | |
| 74 | // General Settings. |
| 75 | $change_data = apply_filters( 'tutor_wizard_attributes', array() ); |
| 76 | foreach ( $change_data as $key => $value ) { |
| 77 | $post_key = Input::post( $key, '' ); |
| 78 | if ( Input::has( $key ) ) { |
| 79 | if ( $post_key != $change_data[ $key ] ) { |
| 80 | if ( '' === $post_key ) { |
| 81 | unset( $options[ $key ] ); |
| 82 | } else { |
| 83 | $options[ $key ] = $post_key; |
| 84 | } |
| 85 | } |
| 86 | $options_preset[ $key ] = $post_key; |
| 87 | } else { |
| 88 | unset( $options[ $key ] ); |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | update_option( 'tutor_default_option', $options_preset ); |
| 93 | update_option( 'tutor_option', $options ); |
| 94 | |
| 95 | // Payment Settings. |
| 96 | $payments = (array) maybe_unserialize( get_option( 'tutor_withdraw_options' ) ); |
| 97 | $payments_data = array( 'bank_transfer_withdraw', 'echeck_withdraw', 'paypal_withdraw' ); |
| 98 | foreach ( $payments_data as $key ) { |
| 99 | $post_key = Input::post( $key, '' ); |
| 100 | if ( Input::has( $key ) ) { |
| 101 | $payments[ $key ]['enabled'] = 1; |
| 102 | } else { |
| 103 | if ( 'bank_transfer_withdraw' === $key ) { |
| 104 | unset( $payments[ $key ]['enabled'] ); |
| 105 | } else { |
| 106 | unset( $payments[ $key ] ); |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | update_option( 'tutor_withdraw_options', $payments ); |
| 111 | |
| 112 | do_action( 'tutor_setup_finished' ); |
| 113 | |
| 114 | // Add wizard flag. |
| 115 | wp_send_json_success( array( 'status' => 'success' ) ); |
| 116 | } |
| 117 | |
| 118 | /** |
| 119 | * Add dashboard page without title |
| 120 | * |
| 121 | * @since 1.0.0 |
| 122 | * |
| 123 | * @return void |
| 124 | */ |
| 125 | public function admin_menus() { |
| 126 | add_dashboard_page( '', '', 'manage_options', 'tutor-setup', '' ); |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Setup wizard |
| 131 | * |
| 132 | * @since 1.0.0 |
| 133 | * |
| 134 | * @return void |
| 135 | */ |
| 136 | public function setup_wizard() { |
| 137 | $setup_page = Input::get( 'page', '' ); |
| 138 | if ( 'tutor-setup' === $setup_page ) { |
| 139 | $this->tutor_setup_wizard_header(); |
| 140 | $this->tutor_setup_wizard_boarding(); |
| 141 | $this->tutor_setup_wizard_type(); |
| 142 | $this->tutor_setup_wizard_settings(); |
| 143 | $this->tutor_setup_wizard_footer(); |
| 144 | exit; |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * Undocumented function |
| 150 | * |
| 151 | * @return void |
| 152 | */ |
| 153 | public function tutor_setup_generator() { |
| 154 | $i = 1; |
| 155 | $html = ''; |
| 156 | $options = (array) maybe_unserialize( get_option( 'tutor_option' ) ); |
| 157 | $payments = (array) maybe_unserialize( get_option( 'tutor_withdraw_options' ) ); |
| 158 | $field_arr = $this->tutor_setup_attributes(); |
| 159 | |
| 160 | $down_desc_fields = array( 'rows', 'slider', 'text', 'radio', 'dropdown', 'range', 'payments' ); |
| 161 | $full_width_fields = array( 'rows', 'slider', 'radio', 'range', 'payments', 'dropdown' ); |
| 162 | |
| 163 | foreach ( $field_arr as $key_parent => $field_parent ) { |
| 164 | $html .= '<li class="' . ( 1 == $i ? 'active' : '' ) . '">'; |
| 165 | $html .= '<div class="tutor-setup-content-heading heading">'; |
| 166 | $html .= '<div class="setup-section-title tutor-fs-6 tutor-fw-medium tutor-color-black">' . $field_parent['lable'] . '</div>'; |
| 167 | $html .= '<div class="step-info">'; |
| 168 | $html .= '<span class="tutor-fs-7 tutor-color-muted">' . __( 'Step', 'tutor' ) . ':</span> <strong class="tutor-color-black">' . $i . '/' . count( $field_arr ) . ' </strong>'; |
| 169 | $html .= '</div>'; |
| 170 | $html .= '<div class="tutor-reset-section tutor-text-btn-small tutor-color-secondary tutor-d-flex tutor-align-center">' . __( 'Reset Default', 'tutor' ) . '</div>'; |
| 171 | $html .= '</div>'; |
| 172 | $html .= '<div class="tutor-setup-content-heading body">'; |
| 173 | |
| 174 | foreach ( $field_parent['attr'] as $key => $field ) { |
| 175 | if ( ! isset( $field['lable'] ) ) { |
| 176 | continue; } |
| 177 | |
| 178 | // Generate data attributes if necessary. |
| 179 | $data_attr = ''; |
| 180 | if ( isset( $field['data'] ) && is_array( $field['data'] ) ) { |
| 181 | foreach ( $field['data'] as $data_key => $data_value ) { |
| 182 | $data_attr .= ' data-' . $data_key . '="' . $data_value . '" '; |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | $html .= '<div class="tutor-setting' . ( in_array( $field['type'], $full_width_fields ) ? ' course-setting-wrapper' : '' ) . ' ' . ( isset( $field['class'] ) ? $field['class'] : '' ) . '">'; |
| 187 | $html .= isset( $field['lable'] ) ? '<div class="tutor-fs-6 tutor-color-black ______">' . $field['lable'] : ''; |
| 188 | |
| 189 | $html .= isset( $field['tooltip'] ) ? '<span class="tooltip-wrap tooltip-icon"><span class="tooltip-txt tooltip-right">' . $field['tooltip'] . '</span></span>' : ''; |
| 190 | $html .= isset( $field['lable'] ) ? '</div>' : ''; |
| 191 | |
| 192 | if ( ! in_array( $field['type'], $down_desc_fields ) ) { |
| 193 | $html .= isset( $field['desc'] ) ? '<div class="content tutor-fs-7 tutor-color-secondary">' . $field['desc'] . '</div>' : ''; |
| 194 | } |
| 195 | |
| 196 | $html .= '<div class="settings">'; |
| 197 | |
| 198 | switch ( $field['type'] ) { |
| 199 | |
| 200 | case 'switch': |
| 201 | $html .= '<label for="' . $key . '" class="switch-label input-switch-label">'; |
| 202 | $html .= '<span class="label-off">' . __( 'OFF', 'tutor' ) . '</span>'; |
| 203 | $html .= '<div class="switchbox-wrapper">'; |
| 204 | $html .= '<input ' . $data_attr . ' id="' . $key . '" class="input-switchbox" type="checkbox" name="' . $key . '" value="on" ' . ( isset( $options[ $key ] ) && $options[ $key ] ? 'checked' : '' ) . '/>'; |
| 205 | $html .= '<span class="switchbox-icon"></span>'; |
| 206 | $html .= '</div>'; |
| 207 | $html .= '<span class="label-on">' . __( 'ON', 'tutor' ) . '</span>'; |
| 208 | $html .= '</label>'; |
| 209 | break; |
| 210 | |
| 211 | case 'text': |
| 212 | $html .= '<input type="text" name="' . $key . '" class="lesson-permalink" value="' . ( isset( $options[ $key ] ) ? $options[ $key ] : '' ) . '" />'; |
| 213 | break; |
| 214 | |
| 215 | case 'rows': |
| 216 | $html .= '<div class="content">'; |
| 217 | $html .= '<div class="course-per-row">'; |
| 218 | $html .= '<div class="wrapper">'; |
| 219 | $html .= '<label for="' . $key . '1">'; |
| 220 | $html .= '<input type="radio" value="1" name="' . $key . '" class="course" id="' . $key . '1" ' . ( isset( $options[ $key ] ) && 1 == $options[ $key ] ? 'checked' : '' ) . '>'; |
| 221 | $html .= '<span class="span"><span>1</span></span>'; |
| 222 | $html .= '</label>'; |
| 223 | $html .= '</div>'; |
| 224 | $html .= '<div class="wrapper">'; |
| 225 | $html .= '<label for="' . $key . '2">'; |
| 226 | $html .= '<input type="radio" value="2" name="' . $key . '" class="course" id="' . $key . '2" ' . ( isset( $options[ $key ] ) && 2 == $options[ $key ] ? 'checked' : '' ) . '>'; |
| 227 | $html .= '<span class="span"><span>2</span><span>2</span></span>'; |
| 228 | $html .= '</label>'; |
| 229 | $html .= '</div>'; |
| 230 | $html .= '<div class="wrapper">'; |
| 231 | $html .= '<label for="' . $key . '3">'; |
| 232 | $html .= '<input type="radio" value="3" name="' . $key . '" class="course" id="' . $key . '3" ' . ( isset( $options[ $key ] ) && 3 == $options[ $key ] ? 'checked' : '' ) . '>'; |
| 233 | $html .= '<span class="span"><span>3</span><span>3</span><span>3</span></span>'; |
| 234 | $html .= '</label>'; |
| 235 | $html .= '</div>'; |
| 236 | $html .= '<div class="wrapper">'; |
| 237 | $html .= '<label for="' . $key . '4">'; |
| 238 | $html .= '<input type="radio" value="4" name="' . $key . '" class="course" id="' . $key . '4" ' . ( isset( $options[ $key ] ) && 4 == $options[ $key ] ? 'checked' : '' ) . '>'; |
| 239 | $html .= '<span class="span"><span>4</span><span>4</span><span>4</span><span>4</span></span>'; |
| 240 | $html .= '</label>'; |
| 241 | $html .= '</div>'; |
| 242 | $html .= '</div>'; |
| 243 | $html .= '</div>'; |
| 244 | break; |
| 245 | |
| 246 | case 'radio': |
| 247 | if ( isset( $field['options'] ) ) { |
| 248 | foreach ( $field['options'] as $k => $val ) { |
| 249 | $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>'; |
| 250 | $html .= $val . '</label>'; |
| 251 | } |
| 252 | } |
| 253 | break; |
| 254 | |
| 255 | case 'slider': |
| 256 | $available_times = array( |
| 257 | 'seconds' => __( 'seconds', 'tutor' ), |
| 258 | 'minutes' => __( 'minutes', 'tutor' ), |
| 259 | 'hours' => __( 'hours', 'tutor' ), |
| 260 | 'days' => __( 'days', 'tutor' ), |
| 261 | 'weeks' => __( 'weeks', 'tutor' ), |
| 262 | ); |
| 263 | $html .= '<div class="limit-slider">'; |
| 264 | if ( isset( $field['time'] ) ) { |
| 265 | $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"/>'; |
| 266 | $html .= '<input type="hidden" name="' . $key . '[time]" value="' . ( isset( $options[ $key ]['time'] ) ? $options[ $key ]['time'] : __( 'minutes', 'tutor' ) ) . '" class="range-input"/>'; |
| 267 | $html .= '<span class=""><span class="range-value">' . ( isset( $options[ $key ]['value'] ) ? $options[ $key ]['value'] : '' ) . '</span>'; |
| 268 | $html .= isset( $options[ $key ]['time'] ) ? $available_times[ $options[ $key ]['time'] ] : ''; |
| 269 | $html .= '</span>'; |
| 270 | } else { |
| 271 | $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"/>'; |
| 272 | $html .= ' <strong class="range-value">' . ( isset( $options[ $key ] ) ? $options[ $key ] : '' ) . '</strong>'; |
| 273 | } |
| 274 | $html .= '</div>'; |
| 275 | break; |
| 276 | |
| 277 | case 'dropdown': |
| 278 | $html .= '<div class="grade-calculation"><div class="select-box"><div class="options-container">'; |
| 279 | $selected_data = ''; |
| 280 | if ( isset( $field['options'] ) ) { |
| 281 | foreach ( $field['options'] as $val ) { |
| 282 | $html .= '<div class="option">'; |
| 283 | $html .= '<input type="radio" class="radio" id="' . $val['value'] . '" name="' . $key . '" value="' . $val['value'] . '" ' . ( isset( $options[ $key ] ) && $options[ $key ] == $val['value'] ? 'checked' : '' ) . ' />'; |
| 284 | $html .= '<label for="' . $val['value'] . '">'; |
| 285 | $html .= '<h3>' . $val['title'] . '</h3>'; |
| 286 | $html .= '<h5>' . $val['desc'] . '</h5>'; |
| 287 | $html .= '</label>'; |
| 288 | $html .= '</div>'; |
| 289 | |
| 290 | if ( isset( $options[ $key ] ) && $options[ $key ] == $val['value'] ) { |
| 291 | $selected_data .= '<div class="selected">'; |
| 292 | $selected_data .= '<h3>' . $val['title'] . '</h3>'; |
| 293 | $selected_data .= '<h5>' . $val['desc'] . '</h5>'; |
| 294 | $selected_data .= '</div>'; |
| 295 | } |
| 296 | } |
| 297 | } |
| 298 | $html .= '</div>'; |
| 299 | $html .= $selected_data ? $selected_data : '<div class="selected"><h3>' . $field['options'][0]['title'] . '</h3><h5>' . $field['options'][0]['desc'] . '</h5></div>'; |
| 300 | $html .= '</div></div>'; |
| 301 | break; |
| 302 | |
| 303 | case 'payments': |
| 304 | $html .= '<div class="checkbox-wrapper column-3">'; |
| 305 | $available_withdraw_methods = get_tutor_all_withdrawal_methods(); |
| 306 | if ( ! empty( $available_withdraw_methods ) ) { |
| 307 | foreach ( $available_withdraw_methods as $key => $value ) { |
| 308 | $html .= '<div class="payment-setting">'; |
| 309 | $html .= '<label for="' . $key . '" class="label">'; |
| 310 | $html .= '<div>'; |
| 311 | $html .= '<input type="checkbox" name="' . $key . '" id="' . $key . '" class="checkbox payment" ' . ( isset( $payments[ $key ]['enabled'] ) && $payments[ $key ]['enabled'] ? 'checked' : '' ) . ' />'; |
| 312 | $html .= '<span class="check-icon round"></span>'; |
| 313 | $html .= '</div>'; |
| 314 | $html .= '<div>'; |
| 315 | $html .= '<img src="' . $value['image'] . '" alt="' . $value['method_name'] . '">'; |
| 316 | $html .= '<h4>' . $value['method_name'] . '</h4>'; |
| 317 | $html .= '</div>'; |
| 318 | $html .= '</label>'; |
| 319 | $html .= '</div>'; |
| 320 | } |
| 321 | } |
| 322 | $html .= '</div>'; |
| 323 | break; |
| 324 | |
| 325 | case 'range': |
| 326 | $earning_instructor = isset( $options['earning_instructor_commission'] ) ? $options['earning_instructor_commission'] : 80; |
| 327 | $earning_admin = isset( $options['earning_admin_commission'] ) ? $options['earning_admin_commission'] : 20; |
| 328 | $html .= '<div class="limit-slider column-1">'; |
| 329 | $html .= '<div class="limit-slider-has-parent">'; |
| 330 | $html .= '<input type="range" min="0" max="100" step="1" value="' . $earning_instructor . '" class="range-input double-range-slider" name=""/>'; |
| 331 | $html .= '</div>'; |
| 332 | $html .= '<div class="commision-data">'; |
| 333 | $html .= '<div class="data">'; |
| 334 | $html .= '<h4 class="range-value-1">' . $earning_instructor . '%</h4>'; |
| 335 | $html .= '<h5>' . __( 'Instructor', 'tutor' ) . '</h5>'; |
| 336 | $html .= '<input type="hidden" min="0" max="100" step="1" value="' . $earning_instructor . '" class="range-value-data-1 range-input" name="earning_instructor_commission"/>'; |
| 337 | $html .= '</div>'; |
| 338 | $html .= '<div class="data">'; |
| 339 | $html .= '<h4 class="range-value-2">' . $earning_admin . '%</h4>'; |
| 340 | $html .= '<h5>' . __( 'Admin / Owner', 'tutor' ) . '</h5>'; |
| 341 | $html .= '<input type="hidden" min="0" max="100" step="1" value="' . $earning_admin . '" class="range-value-data-2 range-input" name="earning_admin_commission"/>'; |
| 342 | $html .= '</div>'; |
| 343 | $html .= '</div>'; |
| 344 | $html .= '</div> '; |
| 345 | break; |
| 346 | |
| 347 | case 'checkbox': |
| 348 | $html .= '<div class="checkbox-wrapper column-2">'; |
| 349 | if ( isset( $field['options'] ) ) { |
| 350 | foreach ( $field['options'] as $k => $val ) { |
| 351 | $html .= '<div class="email-notification">'; |
| 352 | $html .= '<label for="' . $key . $k . '" class="label">'; |
| 353 | $html .= '<div>'; |
| 354 | $html .= '<input type="checkbox" value="' . $k . '" ' . ( isset( $options[ $key ] ) && $options[ $key ] == $k ? 'checked' : '' ) . ' name="' . $key . '" id="' . $key . $k . '" class="checkbox" />'; |
| 355 | $html .= '<span class="check-icon square"></span>'; |
| 356 | $html .= '</div>'; |
| 357 | $html .= '<div>'; |
| 358 | $html .= '<h4>' . $val . '</h4>'; |
| 359 | $html .= '</div>'; |
| 360 | $html .= '</label>'; |
| 361 | $html .= '</div>'; |
| 362 | } |
| 363 | } |
| 364 | $html .= '</div>'; |
| 365 | break; |
| 366 | |
| 367 | case 'attempt': |
| 368 | $html .= '<div class="tutor-setting course-setting-wrapper">'; |
| 369 | |
| 370 | $html .= '<input type="hidden" name="quiz_attempts_allowed" value="' . ( isset( $options[ $key ] ) ? $options[ $key ] : 'off' ) . '">'; |
| 371 | |
| 372 | $html .= '<div class="content">'; |
| 373 | $html .= '<div class="course-per-page attempts-allowed">'; |
| 374 | $html .= '<div class="wrapper">'; |
| 375 | $html .= '<label for="attempts-allowed-1">'; |
| 376 | $html .= '<input type="radio" value="single" name="attempts-allowed" class="course-p" id="attempts-allowed-1" ' . ( isset( $options[ $key ] ) && $options[ $key ] ? 'checked' : '' ) . '>'; |
| 377 | $html .= '<span class="radio-icon"></span>'; |
| 378 | $html .= '<span class="label-text label-text-2">'; |
| 379 | $html .= '<input type="number" value="' . $options[ $key ] . '" name="attempts-allowed-number" class="attempts tutor-form-number-verify" id="attempts-allowed-1" min="' . ( isset( $field['min'] ) ? $field['min'] : 0 ) . '" max="' . ( isset( $field['max'] ) ? $field['max'] : 30 ) . '">'; |
| 380 | $html .= '</span>'; |
| 381 | $html .= '</label>'; |
| 382 | $html .= '</div>'; |
| 383 | $html .= '<div class="wrapper tutor-unlimited-value">'; |
| 384 | $html .= '<label for="attempts-allowed-2">'; |
| 385 | $html .= '<input type="radio" name="attempts-allowed" value="unlimited" class="course-p" id="attempts-allowed-2" ' . ( ( ! isset( $options[ $key ] ) ) || $options[ $key ] == 0 ? 'checked' : '' ) . '>';//phpcs:ignore |
| 386 | $html .= '<span class="radio-icon"></span>'; |
| 387 | $html .= '<span class="label-text">' . __( 'Unlimited', 'tutor' ) . '</span>'; |
| 388 | $html .= '</label>'; |
| 389 | $html .= '</div>'; |
| 390 | $html .= '</div>'; |
| 391 | $html .= '</div>'; |
| 392 | $html .= '</div>'; |
| 393 | break; |
| 394 | |
| 395 | default: |
| 396 | // code... |
| 397 | break; |
| 398 | } |
| 399 | |
| 400 | if ( in_array( $field['type'], $down_desc_fields ) ) { |
| 401 | $html .= isset( $field['desc'] ) ? '<div class="content">' . $field['desc'] . '</div>' : ''; |
| 402 | } |
| 403 | $html .= '</div>'; |
| 404 | $html .= '</div>'; |
| 405 | |
| 406 | } |
| 407 | $html .= '</div>'; |
| 408 | if ( 'payments' !== $field['type'] ) { |
| 409 | $html .= $this->tutor_setup_wizard_action(); |
| 410 | } else { |
| 411 | $html .= $this->tutor_setup_wizard_action_final(); |
| 412 | } |
| 413 | $html .= '</li>'; |
| 414 | $i++; |
| 415 | } |
| 416 | |
| 417 | echo tutor_kses_html( $html );//phpcs:ignore |
| 418 | } |
| 419 | |
| 420 | /** |
| 421 | * Setup attrs |
| 422 | * |
| 423 | * @since 1.0.0 |
| 424 | * |
| 425 | * @return array |
| 426 | */ |
| 427 | public function tutor_setup_attributes() { |
| 428 | $general_fields = array( |
| 429 | |
| 430 | 'general' => array( |
| 431 | 'lable' => __( 'General Settings', 'tutor' ), |
| 432 | 'attr' => array( |
| 433 | 'enable_course_marketplace' => array( |
| 434 | 'type' => 'marketplace', |
| 435 | ), |
| 436 | 'public_profile_layout' => array( |
| 437 | 'type' => 'switch', |
| 438 | 'data' => array( |
| 439 | 'off' => 'private', |
| 440 | 'on' => 'pp-rectangle', |
| 441 | ), |
| 442 | 'lable' => __( 'Instructor Profile', 'tutor' ), |
| 443 | 'desc' => __( 'Allow users to have a instructor profile to showcase awards and completed courses.', 'tutor' ), |
| 444 | ), |
| 445 | 'student_public_profile_layout' => array( |
| 446 | 'type' => 'switch', |
| 447 | 'data' => array( |
| 448 | 'off' => 'private', |
| 449 | 'on' => 'pp-rectangle', |
| 450 | ), |
| 451 | 'lable' => __( 'Student Profile', 'tutor' ), |
| 452 | 'desc' => __( 'Allow users to have a student profile to showcase awards and completed courses.', 'tutor' ), |
| 453 | ), |
| 454 | 'lesson_permalink_base' => array( |
| 455 | 'type' => 'text', |
| 456 | 'max' => 50, |
| 457 | 'lable' => __( 'Lesson permalink', 'tutor' ), |
| 458 | /* translators: %s: sample permalink */ |
| 459 | 'desc' => sprintf( __( 'Example: %s', 'tutor' ), get_home_url() . '/' . tutor()->course_post_type . '/sample-course/<strong>' . ( tutor_utils()->get_option( 'lesson_permalink_base', 'lessons' ) ) . '</strong>/sample-lesson/' ),//phpcs:ignore |
| 460 | ), |
| 461 | ), |
| 462 | ), |
| 463 | |
| 464 | 'course' => array( |
| 465 | 'lable' => __( 'Course Settings', 'tutor' ), |
| 466 | 'attr' => array( |
| 467 | 'display_course_instructors' => array( |
| 468 | 'type' => 'switch', |
| 469 | 'lable' => __( 'Show Instructor Bio', 'tutor' ), |
| 470 | 'desc' => __( 'Let the students know the instructor(s). Display their credentials, professional experience, and more.', 'tutor' ), |
| 471 | ), |
| 472 | 'enable_q_and_a_on_course' => array( |
| 473 | 'type' => 'switch', |
| 474 | 'lable' => __( 'Question and Answer', 'tutor' ), |
| 475 | 'desc' => __( 'Allows a Q&A forum on each course.', 'tutor' ), |
| 476 | ), |
| 477 | 'courses_col_per_row' => array( |
| 478 | 'type' => 'rows', |
| 479 | 'lable' => __( 'Courses Per Row', 'tutor' ), |
| 480 | 'tooltip' => __( 'How many courses per row on the archive pages.', 'tutor' ), |
| 481 | ), |
| 482 | 'courses_per_page' => array( |
| 483 | 'type' => 'slider', |
| 484 | 'lable' => __( 'Courses Per Page', 'tutor' ), |
| 485 | 'tooltip' => __( 'How many courses per page on the archive pages.', 'tutor' ), |
| 486 | ), |
| 487 | ), |
| 488 | ), |
| 489 | |
| 490 | 'instructor' => array( |
| 491 | 'lable' => __( 'Instructor Settings', 'tutor' ), |
| 492 | 'attr' => array( |
| 493 | 'enable_become_instructor_btn' => array( |
| 494 | 'type' => 'switch', |
| 495 | 'lable' => __( 'New Signup', 'tutor' ), |
| 496 | 'desc' => __( 'Choose between open and closed instructor signup. If you’re creating a course marketplace, instructor signup should be open.', 'tutor' ), |
| 497 | ), |
| 498 | 'instructor_can_publish_course' => array( |
| 499 | 'type' => 'switch', |
| 500 | 'lable' => __( 'Earning', 'tutor' ), |
| 501 | 'desc' => __( 'Enable earning for instructors?', 'tutor' ), |
| 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 | 'tooltip' => __( 'Control revenue sharing between admin and instructor.', 'tutor' ), |
| 518 | ), |
| 519 | 'earning_instructor_commission' => array( |
| 520 | 'type' => 'commission', |
| 521 | ), |
| 522 | 'earning_admin_commission' => array( |
| 523 | 'type' => 'commission', |
| 524 | ), |
| 525 | 'withdraw_split' => array( |
| 526 | 'type' => 'payments', |
| 527 | 'lable' => __( 'Payment Withdrawal Method', 'tutor' ), |
| 528 | 'desc' => __( 'Choose your preferred withdrawal method from the options.', 'tutor' ), |
| 529 | ), |
| 530 | |
| 531 | ), |
| 532 | ), |
| 533 | |
| 534 | ); |
| 535 | |
| 536 | return $general_fields; |
| 537 | } |
| 538 | |
| 539 | /** |
| 540 | * Wizard settings |
| 541 | * |
| 542 | * @since 1.0.0 |
| 543 | * |
| 544 | * @return void |
| 545 | */ |
| 546 | public function tutor_setup_wizard_settings() { |
| 547 | $options = (array) maybe_unserialize( get_option( 'tutor_option' ) ); |
| 548 | ?> |
| 549 | <div class="tutor-wizard-container"> |
| 550 | <div class="tutor-wrapper-boarding tutor-setup-wizard-settings"> |
| 551 | <div class="tutor-setup-wrapper"> |
| 552 | <ul class="tutor-setup-title"> |
| 553 | <li data-url="general" class="general active current"> |
| 554 | <?php esc_html_e( 'General', 'tutor' ); ?> |
| 555 | </li> |
| 556 | <li data-url="course" class="course"> |
| 557 | <?php esc_html_e( 'Course', 'tutor' ); ?> |
| 558 | </li> |
| 559 | <li data-url="instructor" class="instructor"> |
| 560 | <?php esc_html_e( 'Instructor', 'tutor' ); ?> |
| 561 | </li> |
| 562 | <li data-url="payment" class="payment"> |
| 563 | <?php esc_html_e( 'Payment', 'tutor' ); ?> |
| 564 | </li> |
| 565 | <li data-url="finish" style="display:none" class="finish"> |
| 566 | <?php esc_html_e( 'Finish', 'tutor' ); ?> |
| 567 | </li> |
| 568 | </ul> |
| 569 | |
| 570 | |
| 571 | <form id="tutor-setup-form" method="post"> |
| 572 | <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?> |
| 573 | <input type="hidden" name="action" value="setup_action"> |
| 574 | |
| 575 | <?php $course_marketplace = tutor_utils()->get_option( 'enable_course_marketplace' ); ?> |
| 576 | <input type="hidden" name="enable_course_marketplace" class="enable_course_marketplace_data" value="<?php echo ( $course_marketplace ? 'on' : 'off' ); ?>"> |
| 577 | |
| 578 | <ul class="tutor-setup-content"> |
| 579 | <?php $this->tutor_setup_generator(); ?> |
| 580 | <li> |
| 581 | <div class="tutor-setup-content-heading greetings"> |
| 582 | <div class="header"> |
| 583 | <img src="<?php echo esc_url( tutor()->url ) . 'assets/images/greeting-img.png'; ?>" alt="greeting"> |
| 584 | </div> |
| 585 | <div class="content"> |
| 586 | <h2> |
| 587 | <?php esc_html_e( 'Congratulations, you’re all set!', 'tutor' ); ?> |
| 588 | </h2> |
| 589 | <p> |
| 590 | <?php esc_html_x( 'Tutor LMS is up and running on your website! If you really want to become a Tutor LMS genius, read our ', 'tutor setup content', 'tutor' ); ?> |
| 591 | <a target="_blank" href="https://docs.themeum.com/tutor-lms/"> |
| 592 | <?php esc_html_x( 'documentation', 'tutor setup content', 'tutor' ); ?> |
| 593 | </a> |
| 594 | <?php esc_html_x( 'that covers everything!', 'tutor setup content', 'tutor' ); ?> |
| 595 | </p> |
| 596 | <p> |
| 597 | <?php esc_html_x( 'If you need further assistance, please don’t hesitate to contact us via our ', 'tutor-setup-assistance', 'tutor' ); ?> |
| 598 | <a target="_blank" href="https://www.themeum.com/contact-us/"> |
| 599 | <?php esc_html_x( 'contact form.', 'tutor-setup-assistance', 'tutor' ); ?> |
| 600 | </a> |
| 601 | </p> |
| 602 | </div> |
| 603 | <div class="tutor-setup-content-footer footer"> |
| 604 | <?php |
| 605 | $welcome_url = admin_url( 'admin.php?page=tutor&welcome=1' ); |
| 606 | $addons_url = admin_url( 'admin.php?page=tutor-addons' ); |
| 607 | $course_url = admin_url( 'admin.php?page=tutor' ); |
| 608 | ?> |
| 609 | <a class="tutor-btn tutor-btn-primary" href="<?php echo esc_url( ! self::is_welcome_page_visited() ? $welcome_url : $course_url ); ?>"> |
| 610 | <?php esc_html_e( 'Create a New Course', 'tutor' ); ?> |
| 611 | </a> |
| 612 | <a class="tutor-btn tutor-btn-outline-primary" href="<?php echo esc_url( ! self::is_welcome_page_visited() ? $welcome_url : $addons_url ); ?>"> |
| 613 | <?php esc_html_e( 'Explore Addons', 'tutor' ); ?> |
| 614 | </a> |
| 615 | </div> |
| 616 | </div> |
| 617 | </li> |
| 618 | </ul> |
| 619 | </form> |
| 620 | </div> |
| 621 | </div> |
| 622 | </div> |
| 623 | <?php |
| 624 | } |
| 625 | |
| 626 | /** |
| 627 | * Setup wizard action |
| 628 | * |
| 629 | * @since 1.0.0 |
| 630 | * |
| 631 | * @return string |
| 632 | */ |
| 633 | public function tutor_setup_wizard_action() { |
| 634 | $html = '<div class="tutor-setup-content-footer footer">'; |
| 635 | $html .= '<div class="tutor-setup-btn-wrapper">'; |
| 636 | $html .= '<button class="tutor-btn tutor-btn-outline-primary tutor-btn-md tutor-setup-previous">'; |
| 637 | $html .= '<span>←</span> <span>' . __( 'Previous', 'tutor' ) . '</span>'; |
| 638 | $html .= '</button>'; |
| 639 | $html .= '</div>'; |
| 640 | $html .= '<div class="tutor-setup-btn-wrapper">'; |
| 641 | $html .= '<button class="tutor-setup-skip tutor-btn tutor-btn-ghost">' . __( 'Skip this step', 'tutor' ) . '</button>'; |
| 642 | $html .= '</div>'; |
| 643 | $html .= '<div class="tutor-setup-btn-wrapper">'; |
| 644 | $html .= '<button class="tutor-btn tutor-btn-primary tutor-btn-md tutor-setup-next">'; |
| 645 | $html .= '<span>' . __( 'Next', 'tutor' ) . '</span> <span>→</span>'; |
| 646 | $html .= '</button>'; |
| 647 | $html .= '</div>'; |
| 648 | $html .= '</div>'; |
| 649 | |
| 650 | return $html; |
| 651 | } |
| 652 | |
| 653 | /** |
| 654 | * Setup wizard action final |
| 655 | * |
| 656 | * @since 1.0.0 |
| 657 | * |
| 658 | * @return string |
| 659 | */ |
| 660 | public function tutor_setup_wizard_action_final() { |
| 661 | $welcome_url = admin_url( 'admin.php?page=tutor&welcome=1' ); |
| 662 | |
| 663 | $html = '<div class="tutor-setup-content-footer footer">'; |
| 664 | $html .= '<div class="tutor-setup-btn-wrapper">'; |
| 665 | $html .= '<button class="tutor-btn tutor-btn-outline-primary tutor-btn-md tutor-setup-previous">'; |
| 666 | $html .= '<span>←</span> <span>' . __( 'Previous', 'tutor' ) . '</span>'; |
| 667 | $html .= '</button>'; |
| 668 | $html .= '</div>'; |
| 669 | $html .= '<div class="tutor-setup-btn-wrapper">'; |
| 670 | $html .= '<a href="' . esc_url( $welcome_url ) . '" class="tutor-btn tutor-btn-ghost">' . __( 'Skip this step', 'tutor' ) . '</a>'; |
| 671 | $html .= '</div>'; |
| 672 | $html .= '<div class="tutor-setup-btn-wrapper">'; |
| 673 | $html .= '<a href="' . esc_url( $welcome_url ) . '" class="tutor-btn tutor-btn-primary tutor-btn-md">' . __( 'Finish Setup', 'tutor' ) . '</a>'; |
| 674 | $html .= '</div>'; |
| 675 | $html .= '</div>'; |
| 676 | |
| 677 | return $html; |
| 678 | } |
| 679 | |
| 680 | /** |
| 681 | * Setup wizard boarding |
| 682 | * |
| 683 | * @since 1.0.0 |
| 684 | * |
| 685 | * @return void |
| 686 | */ |
| 687 | public function tutor_setup_wizard_boarding() { |
| 688 | global $current_user; |
| 689 | ?> |
| 690 | <div class="tutor-wizard-container"> |
| 691 | <div class="tutor-wrapper-boarding tutor-setup-wizard-boarding active"> |
| 692 | <div class="wizard-boarding-header"> |
| 693 | <div> |
| 694 | <img src="<?php echo esc_url( tutor()->url ) . 'assets/images/tutor-logo.svg'; ?>" /> |
| 695 | </div> |
| 696 | <div> |
| 697 | <div class="wizard-boarding-header-sub tutor-fs-5 tutor-color-black"> |
| 698 | <?php |
| 699 | $greeting = _x( 'Hello ', 'tutor-wizard-greeting', 'tutor' ); |
| 700 | $greeting .= tutor_utils()->display_name( $current_user->ID ); |
| 701 | $greeting .= _x( ' welcome to Tutor LMS!', 'tutor-wizard-greeting', 'tutor' ); |
| 702 | echo esc_html( $greeting ); |
| 703 | ?> |
| 704 | </div> |
| 705 | <div class="wizard-boarding-header-main tutor-fs-3 tutor-fw-medium tutor-color-black tutor-mt-10"> |
| 706 | <?php esc_html_e( 'Thank You for Choosing Us', 'tutor' ); ?> |
| 707 | </div> |
| 708 | </div> |
| 709 | </div> |
| 710 | <div class="wizard-boarding-body tutor-mt-60"> |
| 711 | <ul class="slider tutor-boarding"> |
| 712 | <li> |
| 713 | <div class="slide-thumb"> |
| 714 | <img src="<?php echo esc_url( tutor()->url ) . 'assets/images/scalable_lms_solution.jpg'; ?>" alt="<?php esc_html_e( 'A Powerful, Smart, and Scalable LMS Solution', 'tutor' ); ?>"/> |
| 715 | </div> |
| 716 | <div class="slide-title tutor-fs-5 tutor-fw-medium tutor-color-black"><?php esc_html_e( 'A Powerful, Smart, and Scalable LMS Solution', 'tutor' ); ?></div> |
| 717 | <div class="slide-subtitle tutor-fs-6 tutor-color-secondary tutor-mt-16"> |
| 718 | <?php esc_html_e( 'From individual instructors to vast eLearning platforms, Tutor LMS grows with you to create your ideal vision of an LMS website.', 'tutor' ); ?> |
| 719 | </div> |
| 720 | </li> |
| 721 | <li> |
| 722 | <div class="slide-thumb"> |
| 723 | <img src="<?php echo esc_url( tutor()->url ) . 'assets/images/extensive_course_builder.jpg'; ?>" alt="<?php esc_html_e( 'Extensive Course Builder', 'tutor' ); ?>"/> |
| 724 | </div> |
| 725 | <div class="slide-title tutor-fs-5 tutor-fw-medium tutor-color-black"><?php esc_html_e( 'Extensive Course Builder', 'tutor' ); ?></div> |
| 726 | <div class="slide-subtitle tutor-fs-6 tutor-color-secondary tutor-mt-16"> |
| 727 | <?php esc_html_e( 'Tutor LMS comes with a state-of-the-art frontend course builder. Construct rich and resourceful courses with ease.', 'tutor' ); ?> |
| 728 | </div> |
| 729 | </li> |
| 730 | <li> |
| 731 | <div class="slide-thumb"> |
| 732 | <img src="<?php echo esc_url( tutor()->url ) . 'assets/images/advanced_quiz_creator.jpg'; ?>" alt="<?php esc_html_e( 'Advanced Quiz Creator', 'tutor' ); ?>"/> |
| 733 | </div> |
| 734 | <div class="slide-title tutor-fs-5 tutor-fw-medium tutor-color-black"><?php esc_html_e( 'Advanced Quiz Creator', 'tutor' ); ?></div> |
| 735 | <div class="slide-subtitle tutor-fs-6 tutor-color-secondary tutor-mt-16"> |
| 736 | <?php esc_html_e( 'Build interactive quizzes with the vast selection of question types and verify the learning of your students.', 'tutor' ); ?> |
| 737 | </div> |
| 738 | </li> |
| 739 | <li> |
| 740 | <div class="slide-thumb"> |
| 741 | <img src="<?php echo esc_url( tutor()->url ) . 'assets/images/freedom_with_ecommerce.jpg'; ?>" alt="<?php esc_html_e( 'Freedom With eCommerce', 'tutor' ); ?>"/> |
| 742 | </div> |
| 743 | <div class="slide-title tutor-fs-5 tutor-fw-medium tutor-color-black"><?php esc_html_e( 'Freedom With eCommerce', 'tutor' ); ?></div> |
| 744 | <div class="slide-subtitle tutor-fs-6 tutor-color-secondary tutor-mt-16"> |
| 745 | <?php esc_html_e( 'Select an eCommerce plugin and sell courses any way you like and use any payment gateway you want!', 'tutor' ); ?> |
| 746 | </div> |
| 747 | </li> |
| 748 | <li> |
| 749 | <div class="slide-thumb"> |
| 750 | <img src="<?php echo esc_url( tutor()->url ) . 'assets/images/reports_and_analytics.jpg'; ?>" alt="<?php esc_html_e( 'Reports and Analytics', 'tutor' ); ?>"/> |
| 751 | </div> |
| 752 | <div class="slide-title tutor-fs-5 tutor-fw-medium tutor-color-black"><?php esc_html_e( 'Reports and Analytics', 'tutor' ); ?></div> |
| 753 | <div class="slide-subtitle tutor-fs-6 tutor-color-secondary tutor-mt-16"> |
| 754 | <?php esc_html_e( 'Track what type of courses sell the most! Gain insights on user purchases, manage reviews and track quiz attempts.', 'tutor' ); ?> |
| 755 | </div> |
| 756 | </li> |
| 757 | </ul> |
| 758 | </div> |
| 759 | <div class="wizard-boarding-footer"> |
| 760 | <div class=""> |
| 761 | <button class="tutor-btn tutor-btn-primary tutor-btn-md tutor-boarding-next"> |
| 762 | <?php esc_html_e( 'Let’s Start', 'tutor' ); ?> |
| 763 | </button> |
| 764 | </div> |
| 765 | <div> |
| 766 | <a href="<?php echo esc_url( admin_url( 'admin.php?page=tutor' ) ); ?>" class="tutor-text-btn-medium"> |
| 767 | <?php esc_html_e( 'I already know, skip it!', 'tutor' ); ?> |
| 768 | </a> |
| 769 | </div> |
| 770 | </div> |
| 771 | </div> |
| 772 | </div> |
| 773 | <?php |
| 774 | } |
| 775 | |
| 776 | /** |
| 777 | * Setup wizard type |
| 778 | * |
| 779 | * @since 1.0.0 |
| 780 | * |
| 781 | * @return void |
| 782 | */ |
| 783 | public function tutor_setup_wizard_type() { |
| 784 | $course_marketplace = tutor_utils()->get_option( 'enable_course_marketplace' ); |
| 785 | $course_marketplace = 1 === $course_marketplace ? 'on' : 'off'; |
| 786 | ?> |
| 787 | <div class="tutor-wizard-container"> |
| 788 | <div class="tutor-wrapper-type tutor-setup-wizard-type"> |
| 789 | <div class="wizard-type-header"> |
| 790 | <div class="logo"><img src="<?php echo esc_url( tutor()->url . 'assets/images/tutor-logo.svg' ); ?>" /></div> |
| 791 | <div class="title"><?php esc_html_e( 'Let’s get the platform up and running', 'tutor' ); ?></div> |
| 792 | <div class="subtitle"><?php esc_html_e( 'Pick a category for your LMS platform. You can always update this later.', 'tutor' ); ?></div> |
| 793 | </div> |
| 794 | <div class="wizard-type-body"> |
| 795 | <div class="wizard-type-item"> |
| 796 | <input id="enable_course_marketplace-0" type="radio" name="enable_course_marketplace" value="off" |
| 797 | <?php |
| 798 | if ( ! $course_marketplace ) { |
| 799 | echo 'checked'; } |
| 800 | ?> |
| 801 | /> |
| 802 | <span class="icon"></span> |
| 803 | <label for="enable_course_marketplace-0"> |
| 804 | <img src="<?php echo esc_url( tutor()->url . 'assets/images/single-marketplace.svg' ); ?>" /> |
| 805 | <div class="title"><?php esc_html_e( 'Individual', 'tutor' ); ?></div> |
| 806 | <div class="subtitle"><?php esc_html_e( 'Share solo journey as an educator and spread knowledge', 'tutor' ); ?></div> |
| 807 | <div class="action"> |
| 808 | <button class="tutor-btn tutor-btn-primary tutor-btn-md tutor-type-next"> |
| 809 | <?php esc_html_e( 'Next', 'tutor' ); ?> |
| 810 | </button> |
| 811 | </div> |
| 812 | </label> |
| 813 | </div> |
| 814 | |
| 815 | <div class="wizard-type-item"> |
| 816 | <input id="enable_course_marketplace-1" type="radio" name="enable_course_marketplace" value="on" |
| 817 | <?php |
| 818 | if ( $course_marketplace ) { |
| 819 | echo 'checked'; } |
| 820 | ?> |
| 821 | /> |
| 822 | <span class="icon"></span> |
| 823 | <label for="enable_course_marketplace-1"> |
| 824 | <img src="<?php echo esc_url( tutor()->url . 'assets/images/multiple-marketplace.svg' ); ?>" /> |
| 825 | <div class="title"><?php esc_html_e( 'Marketplace', 'tutor' ); ?></div> |
| 826 | <div class="subtitle"><?php esc_html_e( 'Create an eLearning platform to let anyone earn by teaching online', 'tutor' ); ?></div> |
| 827 | <div class="action"> |
| 828 | <button class="tutor-btn tutor-btn-primary tutor-btn-md tutor-type-next"> |
| 829 | <?php esc_html_e( 'Next', 'tutor' ); ?> |
| 830 | </button> |
| 831 | </div> |
| 832 | </label> |
| 833 | </div> |
| 834 | </div> |
| 835 | |
| 836 | <div class="wizard-type-footer"> |
| 837 | <div class="tutor-fs-7"> |
| 838 | <span><?php esc_html_e( 'Not sure?', 'tutor' ); ?></span> |
| 839 | <a href="#" class="tutor-type-skip" class=""> |
| 840 | <?php esc_html_e( 'Let’s go to the next step.', 'tutor' ); ?> |
| 841 | </a> |
| 842 | </div> |
| 843 | </div> |
| 844 | </div> |
| 845 | </div> |
| 846 | <?php |
| 847 | } |
| 848 | |
| 849 | /** |
| 850 | * Setup wizard header |
| 851 | * |
| 852 | * @since 1.0.0 |
| 853 | * |
| 854 | * @return void |
| 855 | */ |
| 856 | public function tutor_setup_wizard_header() { |
| 857 | set_current_screen(); |
| 858 | ?> |
| 859 | <!DOCTYPE html> |
| 860 | <html <?php language_attributes(); ?>> |
| 861 | <head> |
| 862 | <meta name="viewport" content="width=device-width" /> |
| 863 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 864 | <title><?php esc_html_e( 'Tutor › Setup Wizard', 'tutor' ); ?></title> |
| 865 | <?php |
| 866 | try { |
| 867 | do_action( 'admin_enqueue_scripts' ); |
| 868 | } catch ( \Throwable $th ) { //phpcs:ignore |
| 869 | } |
| 870 | ?> |
| 871 | <?php wp_print_scripts( 'tutor-plyr' ); ?> |
| 872 | <?php wp_print_scripts( 'tutor-slick' ); ?> |
| 873 | <?php wp_print_scripts( 'tutor-setup' ); ?> |
| 874 | <?php do_action( 'admin_print_styles' ); ?> |
| 875 | <?php do_action( 'admin_head' ); ?> |
| 876 | </head> |
| 877 | <body class="tutor-setup wp-core-ui"> |
| 878 | <?php |
| 879 | } |
| 880 | |
| 881 | /** |
| 882 | * Setup wizard footer |
| 883 | * |
| 884 | * @since 1.0.0 |
| 885 | * |
| 886 | * @return void |
| 887 | */ |
| 888 | public function tutor_setup_wizard_footer() { |
| 889 | ?> |
| 890 | </body> |
| 891 | </html> |
| 892 | <?php |
| 893 | } |
| 894 | |
| 895 | /** |
| 896 | * Enqueue scripts |
| 897 | * |
| 898 | * @since 1.0.0 |
| 899 | * |
| 900 | * @return void |
| 901 | */ |
| 902 | public function enqueue_scripts() { |
| 903 | $page = Input::get( 'page', '' ); |
| 904 | if ( 'tutor-setup' === $page ) { |
| 905 | wp_enqueue_style( 'tutor-setup', tutor()->url . 'assets/css/tutor-setup.min.css', array(), TUTOR_VERSION ); |
| 906 | wp_enqueue_style( 'tutor-slick', tutor()->url . 'assets/packages/slick/slick.css', array(), TUTOR_VERSION ); |
| 907 | wp_enqueue_style( 'tutor-slick-theme', tutor()->url . 'assets/packages/slick/slick-theme.css', array(), TUTOR_VERSION ); |
| 908 | wp_register_script( 'tutor-slick', tutor()->url . 'assets/packages/slick/slick.min.js', array( 'jquery' ), TUTOR_VERSION, true ); |
| 909 | wp_register_script( 'tutor-setup-v2', tutor()->url . 'assets/js/tutor.min.js', array( 'jquery', 'wp-i18n' ), TUTOR_VERSION, true ); |
| 910 | wp_register_script( 'tutor-setup', tutor()->url . 'assets/js/tutor-setup.min.js', array( 'jquery', 'tutor-slick', 'wp-i18n' ), TUTOR_VERSION, true ); |
| 911 | wp_localize_script( 'tutor-setup', '_tutorobject', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) ); |
| 912 | } |
| 913 | } |
| 914 | |
| 915 | |
| 916 | /** |
| 917 | * Check if welcome page already visited |
| 918 | * |
| 919 | * @since 1.0.0 |
| 920 | * |
| 921 | * @return bool |
| 922 | */ |
| 923 | public static function is_welcome_page_visited(): bool { |
| 924 | return false; |
| 925 | } |
| 926 | |
| 927 | /** |
| 928 | * Mark as welcome page visited |
| 929 | * |
| 930 | * @since 1.0.0 |
| 931 | * |
| 932 | * @return void |
| 933 | */ |
| 934 | public static function mark_as_visited() { |
| 935 | update_option( 'tutor_welcome_page_visited', true ); |
| 936 | } |
| 937 | } |
| 938 | |
| 939 |