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
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
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
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
Options.php
683 lines
| 1 | <?php |
| 2 | namespace Tutor; |
| 3 | |
| 4 | if ( ! defined( 'ABSPATH' ) ) |
| 5 | exit; |
| 6 | |
| 7 | class Options { |
| 8 | |
| 9 | public $option; |
| 10 | public $options_attr; |
| 11 | |
| 12 | public function __construct() { |
| 13 | $this->option = (array) maybe_unserialize(get_option('tutor_option')); |
| 14 | $this->options_attr = $this->options_attr(); |
| 15 | |
| 16 | //Saving option |
| 17 | add_action('wp_ajax_tutor_option_save', array($this, 'tutor_option_save')); |
| 18 | } |
| 19 | |
| 20 | private function get($key = null, $default = false){ |
| 21 | $option = $this->option; |
| 22 | if (empty($option) || ! is_array($option)){ |
| 23 | return $default; |
| 24 | } |
| 25 | if ( ! $key){ |
| 26 | return $option; |
| 27 | } |
| 28 | if (array_key_exists($key, $option)){ |
| 29 | return apply_filters($key, $option[$key]); |
| 30 | } |
| 31 | //Access array value via dot notation, such as option->get('value.subvalue') |
| 32 | if (strpos($key, '.')){ |
| 33 | $option_key_array = explode('.', $key); |
| 34 | $new_option = $option; |
| 35 | foreach ($option_key_array as $dotKey){ |
| 36 | if (isset($new_option[$dotKey])){ |
| 37 | $new_option = $new_option[$dotKey]; |
| 38 | }else{ |
| 39 | return $default; |
| 40 | } |
| 41 | } |
| 42 | return apply_filters($key, $new_option); |
| 43 | } |
| 44 | |
| 45 | return $default; |
| 46 | } |
| 47 | |
| 48 | public function tutor_option_save(){ |
| 49 | if ( ! isset($_POST['_wpnonce']) || ! wp_verify_nonce( $_POST['_wpnonce'], 'tutor_option_save' ) ){ |
| 50 | exit(); |
| 51 | } |
| 52 | |
| 53 | do_action('tutor_option_save_before'); |
| 54 | |
| 55 | $option = (array) isset($_POST['tutor_option']) ? $_POST['tutor_option'] : array(); |
| 56 | $option = apply_filters('tutor_option_input', $option); |
| 57 | update_option('tutor_option', $option); |
| 58 | |
| 59 | do_action('tutor_option_save_after'); |
| 60 | //re-sync settings |
| 61 | //init::tutor_activate(); |
| 62 | |
| 63 | wp_send_json_success( array('msg' => __('Option Updated', 'tutor') ) ); |
| 64 | } |
| 65 | |
| 66 | public function options_attr(){ |
| 67 | $pages = tutor_utils()->get_pages(); |
| 68 | |
| 69 | //$course_base = tutor_utils()->course_archive_page_url(); |
| 70 | $lesson_url = site_url().'/course/'.'sample-course/<code>lessons</code>/sample-lesson/'; |
| 71 | $student_url = tutor_utils()->profile_url(); |
| 72 | $attempts_allowed = array(); |
| 73 | $attempts_allowed['unlimited'] = __('Unlimited' , 'tutor'); |
| 74 | $attempts_allowed = array_merge($attempts_allowed, array_combine(range(1,20), range(1,20))); |
| 75 | |
| 76 | $attr = array( |
| 77 | 'general' => array( |
| 78 | 'label' => __('General', 'tutor'), |
| 79 | 'sections' => array( |
| 80 | 'general' => array( |
| 81 | 'label' => __('General', 'tutor'), |
| 82 | 'desc' => __('General Settings', 'tutor'), |
| 83 | 'fields' => array( |
| 84 | 'tutor_dashboard_page_id' => array( |
| 85 | 'type' => 'select', |
| 86 | 'label' => __('Dashboard Page', 'tutor'), |
| 87 | 'default' => '0', |
| 88 | 'options' => $pages, |
| 89 | 'desc' => __('This page will be used for student and instructor dashboard', 'tutor'), |
| 90 | ), |
| 91 | 'enable_public_profile' => array( |
| 92 | 'type' => 'checkbox', |
| 93 | 'label' => __('Public Profile', 'tutor'), |
| 94 | 'label_title' => __('Enable', 'tutor'), |
| 95 | 'default' => '0', |
| 96 | 'desc' => __('Enable this to make a profile publicly visible', 'tutor')."<br />" .$student_url, |
| 97 | ), |
| 98 | 'load_tutor_css' => array( |
| 99 | 'type' => 'checkbox', |
| 100 | 'label' => __('Load Tutor CSS', 'tutor'), |
| 101 | 'label_title' => __('Enable', 'tutor'), |
| 102 | 'default' => '1', |
| 103 | 'desc' => __('If your theme has its own styling, then you can turn it off to load CSS from the plugin directory', 'tutor'), |
| 104 | ), |
| 105 | 'load_tutor_js' => array( |
| 106 | 'type' => 'checkbox', |
| 107 | 'label' => __('Load Tutor JavaScript', 'tutor'), |
| 108 | 'label_title' => __('Enable', 'tutor'), |
| 109 | 'default' => '1', |
| 110 | 'desc' => __('If you have put required script in your theme javascript file, then you can turn it off to load JavaScript from the plugin directory', 'tutor'), |
| 111 | ), |
| 112 | 'student_must_login_to_view_course' => array( |
| 113 | 'type' => 'checkbox', |
| 114 | 'label' => __('Course Visibility', 'tutor'), |
| 115 | 'label_title' => __('Logged in only', 'tutor'), |
| 116 | 'desc' => __('Students must be logged in to view course', 'tutor'), |
| 117 | ), |
| 118 | 'delete_on_uninstall' => array( |
| 119 | 'type' => 'checkbox', |
| 120 | 'label' => __('Erase upon uninstallation', 'tutor'), |
| 121 | 'label_title' => __('Enable', 'tutor'), |
| 122 | 'desc' => __('Delete all data during uninstallation', 'tutor'), |
| 123 | ), |
| 124 | |
| 125 | 'enable_spotlight_mode' => array( |
| 126 | 'type' => 'checkbox', |
| 127 | 'label' => __('Spotlight mode', 'tutor'), |
| 128 | 'label_title' => __('Enable', 'tutor'), |
| 129 | 'default' => '0', |
| 130 | 'desc' => __('This will hide the header and the footer and enable spotlight (full screen) mode when students view lessons.', 'tutor'), |
| 131 | ), |
| 132 | 'disable_default_player_youtube' => array( |
| 133 | 'type' => 'checkbox', |
| 134 | 'label' => __('YouTube Player', 'tutor'), |
| 135 | 'label_title' => __('Enable', 'tutor'), |
| 136 | 'default' => '0', |
| 137 | 'desc' => __('Disable this option to use Tutor LMS video player.', 'tutor'), |
| 138 | ), |
| 139 | 'disable_default_player_vimeo' => array( |
| 140 | 'type' => 'checkbox', |
| 141 | 'label' => __('Vimeo Player', 'tutor'), |
| 142 | 'label_title' => __('Enable', 'tutor'), |
| 143 | 'default' => '0', |
| 144 | 'desc' => __('Disable this option to use Tutor LMS video player.', 'tutor'), |
| 145 | ), |
| 146 | 'pagination_per_page' => array( |
| 147 | 'type' => 'number', |
| 148 | 'label' => __('Pagination', 'tutor'), |
| 149 | 'default' => '20', |
| 150 | 'desc' => __('Number of items you would like displayed "per page" in the pagination', 'tutor'), |
| 151 | ), |
| 152 | 'enable_tutor_maintenance_mode' => array( |
| 153 | 'type' => 'checkbox', |
| 154 | 'label' => __('Maintenance Mode', 'tutor'), |
| 155 | 'label_title' => __('Enable', 'tutor'), |
| 156 | 'default' => '0', |
| 157 | 'desc' => __('Enabling the maintenance mode allows you to display a custom message on the frontend. During this time, visitors can not access the site content. But the wp-admin dashboard will remain accessible.', 'tutor'), |
| 158 | ), |
| 159 | ) |
| 160 | ) |
| 161 | ), |
| 162 | ), |
| 163 | 'course' => array( |
| 164 | 'label' => __('Course', 'tutor'), |
| 165 | 'sections' => array( |
| 166 | 'general' => array( |
| 167 | 'label' => __('General', 'tutor'), |
| 168 | 'desc' => __('Course Settings', 'tutor'), |
| 169 | 'fields' => array( |
| 170 | 'enable_gutenberg_course_edit' => array( |
| 171 | 'type' => 'checkbox', |
| 172 | 'label' => __('Gutenberg Editor', 'tutor'), |
| 173 | 'label_title' => __('Enable', 'tutor'), |
| 174 | 'desc' => __('Use Gutenberg editor on course description area.', 'tutor'), |
| 175 | ), |
| 176 | ), |
| 177 | ), |
| 178 | 'archive' => array( |
| 179 | 'label' => __('Archive', 'tutor'), |
| 180 | 'desc' => __('Course Archive Settings', 'tutor'), |
| 181 | 'fields' => array( |
| 182 | 'course_archive_page' => array( |
| 183 | 'type' => 'select', |
| 184 | 'label' => __('Course Archive Page', 'tutor'), |
| 185 | 'default' => '0', |
| 186 | 'options' => $pages, |
| 187 | 'desc' => __('This page will be used to list all the published courses.', 'tutor'), |
| 188 | ), |
| 189 | 'courses_col_per_row' => array( |
| 190 | 'type' => 'slider', |
| 191 | 'label' => __('Column Per Row', 'tutor'), |
| 192 | 'default' => '4', |
| 193 | 'options' => array('min'=> 1, 'max' => 6), |
| 194 | 'desc' => __('Define how many column you want to use to display courses.', 'tutor'), |
| 195 | ), |
| 196 | 'courses_per_page' => array( |
| 197 | 'type' => 'slider', |
| 198 | 'label' => __('Courses Per Page', 'tutor'), |
| 199 | 'default' => '12', |
| 200 | 'options' => array('min'=> 1, 'max' => 20), |
| 201 | 'desc' => __('Define how many courses you want to show per page', 'tutor'), |
| 202 | ), |
| 203 | ), |
| 204 | ), |
| 205 | 'enable_disable' => array( |
| 206 | 'label' => __('Enable / Disable', 'tutor'), |
| 207 | 'desc' => __('Course Display Settings', 'tutor'), |
| 208 | 'fields' => array( |
| 209 | 'display_course_instructors' => array( |
| 210 | 'type' => 'checkbox', |
| 211 | 'label' => __('Display Instructor Info', 'tutor'), |
| 212 | 'label_title' => __('Enable', 'tutor'), |
| 213 | 'desc' => __('Show instructor bio on each page', 'tutor'), |
| 214 | ), |
| 215 | 'enable_q_and_a_on_course' => array( |
| 216 | 'type' => 'checkbox', |
| 217 | 'label' => __('Question and Answer', 'tutor'), |
| 218 | 'label_title' => __('Enable','tutor'), |
| 219 | 'default' => '0', |
| 220 | 'desc' => __('Enabling this feature will add a Q&A section on every course.', 'tutor'), |
| 221 | ), |
| 222 | 'disable_course_author' => array( |
| 223 | 'type' => 'checkbox', |
| 224 | 'label' => __('Course Author', 'tutor'), |
| 225 | 'label_title' => __('Disable','tutor'), |
| 226 | 'default' => '0', |
| 227 | 'desc' => __('Disabling this feature will be removed course author name from the course page.', 'tutor'), |
| 228 | ), |
| 229 | 'disable_course_level' => array( |
| 230 | 'type' => 'checkbox', |
| 231 | 'label' => __('Course Level', 'tutor'), |
| 232 | 'label_title' => __('Disable','tutor'), |
| 233 | 'default' => '0', |
| 234 | 'desc' => __('Disabling this feature will be removed course level from the course page.', 'tutor'), |
| 235 | ), |
| 236 | 'disable_course_share' => array( |
| 237 | 'type' => 'checkbox', |
| 238 | 'label' => __('Course Share', 'tutor'), |
| 239 | 'label_title' => __('Disable','tutor'), |
| 240 | 'default' => '0', |
| 241 | 'desc' => __('Disabling this feature will be removed course share option from the course page.', 'tutor'), |
| 242 | ), |
| 243 | 'disable_course_duration' => array( |
| 244 | 'type' => 'checkbox', |
| 245 | 'label' => __('Course Duration', 'tutor'), |
| 246 | 'label_title' => __('Disable','tutor'), |
| 247 | 'default' => '0', |
| 248 | 'desc' => __('Disabling this feature will be removed course duration from the course page.', 'tutor'), |
| 249 | ), |
| 250 | 'disable_course_total_enrolled' => array( |
| 251 | 'type' => 'checkbox', |
| 252 | 'label' => __('Course Total Enrolled', 'tutor'), |
| 253 | 'label_title' => __('Disable','tutor'), |
| 254 | 'default' => '0', |
| 255 | 'desc' => __('Disabling this feature will be removed course total enrolled from the course page.', 'tutor'), |
| 256 | ), |
| 257 | 'disable_course_update_date' => array( |
| 258 | 'type' => 'checkbox', |
| 259 | 'label' => __('Course Update Date', 'tutor'), |
| 260 | 'label_title' => __('Disable','tutor'), |
| 261 | 'default' => '0', |
| 262 | 'desc' => __('Disabling this feature will be removed course update date from the course page.', 'tutor'), |
| 263 | ), |
| 264 | 'disable_course_progress_bar' => array( |
| 265 | 'type' => 'checkbox', |
| 266 | 'label' => __('Course Progress Bar', 'tutor'), |
| 267 | 'label_title' => __('Disable','tutor'), |
| 268 | 'default' => '0', |
| 269 | 'desc' => __('Disabling this feature will be removed completing progress bar from the course page.', 'tutor'), |
| 270 | ), |
| 271 | 'disable_course_material' => array( |
| 272 | 'type' => 'checkbox', |
| 273 | 'label' => __('Course Material', 'tutor'), |
| 274 | 'label_title' => __('Disable','tutor'), |
| 275 | 'default' => '0', |
| 276 | 'desc' => __('Disabling this feature will be removed course material from the course page.', 'tutor'), |
| 277 | ), |
| 278 | 'disable_course_about' => array( |
| 279 | 'type' => 'checkbox', |
| 280 | 'label' => __('Course About', 'tutor'), |
| 281 | 'label_title' => __('Disable','tutor'), |
| 282 | 'default' => '0', |
| 283 | 'desc' => __('Disabling this feature will be removed course about from the course page.', 'tutor'), |
| 284 | ), |
| 285 | 'disable_course_description' => array( |
| 286 | 'type' => 'checkbox', |
| 287 | 'label' => __('Course Description', 'tutor'), |
| 288 | 'label_title' => __('Disable','tutor'), |
| 289 | 'default' => '0', |
| 290 | 'desc' => __('Disabling this feature will be removed course description from the course page.', 'tutor'), |
| 291 | ), |
| 292 | 'disable_course_benefits' => array( |
| 293 | 'type' => 'checkbox', |
| 294 | 'label' => __('Course Benefits', 'tutor'), |
| 295 | 'label_title' => __('Disable','tutor'), |
| 296 | 'default' => '0', |
| 297 | 'desc' => __('Disabling this feature will be removed course benefits from the course page.', 'tutor'), |
| 298 | ), |
| 299 | 'disable_course_requirements' => array( |
| 300 | 'type' => 'checkbox', |
| 301 | 'label' => __('Course Requirements', 'tutor'), |
| 302 | 'label_title' => __('Disable','tutor'), |
| 303 | 'default' => '0', |
| 304 | 'desc' => __('Disabling this feature will be removed course requirements from the course page.', 'tutor'), |
| 305 | ), |
| 306 | 'disable_course_target_audience' => array( |
| 307 | 'type' => 'checkbox', |
| 308 | 'label' => __('Course Target Audience', 'tutor'), |
| 309 | 'label_title' => __('Disable','tutor'), |
| 310 | 'default' => '0', |
| 311 | 'desc' => __('Disabling this feature will be removed course target audience from the course page.', 'tutor'), |
| 312 | ), |
| 313 | 'disable_course_announcements' => array( |
| 314 | 'type' => 'checkbox', |
| 315 | 'label' => __('Course Announcements', 'tutor'), |
| 316 | 'label_title' => __('Disable','tutor'), |
| 317 | 'default' => '0', |
| 318 | 'desc' => __('Disabling this feature will be removed course announcements from the course page.', 'tutor'), |
| 319 | ), |
| 320 | 'disable_course_review' => array( |
| 321 | 'type' => 'checkbox', |
| 322 | 'label' => __('Course Review', 'tutor'), |
| 323 | 'label_title' => __('Disable','tutor'), |
| 324 | 'default' => '0', |
| 325 | 'desc' => __('Disabling this feature will be removed course review system from the course page.', 'tutor'), |
| 326 | ), |
| 327 | ), |
| 328 | ), |
| 329 | ), |
| 330 | ), |
| 331 | 'lesson' => array( |
| 332 | 'label' => __('Lessons', 'tutor'), |
| 333 | 'sections' => array( |
| 334 | 'lesson_settings' => array( |
| 335 | 'label' => __('Lesson Settings', 'tutor'), |
| 336 | 'desc' => __('Lesson settings will be here', 'tutor'), |
| 337 | 'fields' => array( |
| 338 | 'enable_lesson_classic_editor' => array( |
| 339 | 'type' => 'checkbox', |
| 340 | 'label' => __('Classic Editor', 'tutor'), |
| 341 | 'label_title' => __('Enable', 'tutor'), |
| 342 | 'desc' => __('Enable classic editor to get full support of any editor/page builder.', 'tutor'), |
| 343 | ), |
| 344 | 'lesson_permalink_base' => array( |
| 345 | 'type' => 'text', |
| 346 | 'label' => __('Lesson Permalink Base', 'tutor'), |
| 347 | 'default' => 'lessons', |
| 348 | 'desc' => $lesson_url, |
| 349 | ), |
| 350 | ), |
| 351 | ), |
| 352 | |
| 353 | ), |
| 354 | ), |
| 355 | 'quiz' => array( |
| 356 | 'label' => __('Quiz', 'tutor'), |
| 357 | 'sections' => array( |
| 358 | 'general' => array( |
| 359 | 'label' => __('Quiz', 'tutor'), |
| 360 | 'desc' => __('The values you set here define the default values that are used in the settings form when you create a new quiz.', 'tutor'), |
| 361 | 'fields' => array( |
| 362 | 'quiz_time_limit' => array( |
| 363 | 'type' => 'group_fields', |
| 364 | 'label' => __('Time Limit', 'tutor'), |
| 365 | 'desc' => __('0 means unlimited time.', 'tutor'), |
| 366 | 'group_fields' => array( |
| 367 | 'value' => array( |
| 368 | 'type' => 'text', |
| 369 | 'default' => '0', |
| 370 | ), |
| 371 | 'time' => array( |
| 372 | 'type' => 'select', |
| 373 | 'default' => 'minutes', |
| 374 | 'select_options' => false, |
| 375 | 'options' => array( |
| 376 | 'weeks' => __('Weeks', 'tutor'), |
| 377 | 'days' => __('Days', 'tutor'), |
| 378 | 'hours' => __('Hours', 'tutor'), |
| 379 | 'minutes' => __('Minutes', 'tutor'), |
| 380 | 'seconds' => __('Seconds', 'tutor'), |
| 381 | ), |
| 382 | ), |
| 383 | ), |
| 384 | ), |
| 385 | 'quiz_when_time_expires' => array( |
| 386 | 'type' => 'radio', |
| 387 | 'label' => __('When time expires', 'tutor'), |
| 388 | 'default' => 'minutes', |
| 389 | 'select_options' => false, |
| 390 | 'options' => array( |
| 391 | 'autosubmit' => __('The current quiz answers are submitted automatically.', 'tutor'), |
| 392 | 'graceperiod' => __('The current quiz answers are submitted by students.', 'tutor'), |
| 393 | 'autoabandon' => __('Attempts must be submitted before time expires, otherwise they will not be counted', 'tutor'), |
| 394 | ), |
| 395 | 'desc' => __('Choose which action to follow when the quiz time expires.', 'tutor'), |
| 396 | ), |
| 397 | 'quiz_attempts_allowed' => array( |
| 398 | 'type' => 'number', |
| 399 | 'label' => __('Attempts allowed', 'tutor'), |
| 400 | 'default' => '10', |
| 401 | 'desc' => __('The highest number of attempts students are allowed to take for a quiz. 0 means unlimited attempts.', 'tutor'), |
| 402 | ), |
| 403 | 'quiz_grade_method' => array( |
| 404 | 'type' => 'select', |
| 405 | 'label' => __('Final grade calculation', 'tutor'), |
| 406 | 'default' => 'minutes', |
| 407 | 'select_options' => false, |
| 408 | 'options' => array( |
| 409 | 'highest_grade' => __('Highest Grade', 'tutor'), |
| 410 | 'average_grade' => __('Average Grade', 'tutor'), |
| 411 | 'first_attempt' => __('First Attempt', 'tutor'), |
| 412 | 'last_attempt' => __('Last Attempt', 'tutor'), |
| 413 | ), |
| 414 | 'desc' => __('When multiple attempts are allowed, which method should be used to calculate a student\'s final grade for the quiz.', 'tutor'), |
| 415 | ), |
| 416 | ) |
| 417 | ) |
| 418 | ), |
| 419 | ), |
| 420 | 'instructors' => array( |
| 421 | 'label' => __('Instructors', 'tutor'), |
| 422 | 'sections' => array( |
| 423 | 'general' => array( |
| 424 | 'label' => __('Instructor Profile Settings', 'tutor'), |
| 425 | 'desc' => __('Enable Disable Option to on/off notification on various event', 'tutor'), |
| 426 | 'fields' => array( |
| 427 | 'enable_course_marketplace' => array( |
| 428 | 'type' => 'checkbox', |
| 429 | 'label' => __('Course Marketplace', 'tutor'), |
| 430 | 'label_title' => __('Enable', 'tutor'), |
| 431 | 'default' => '0', |
| 432 | 'desc' => __('Allow multiple instructors to upload their courses.', 'tutor'), |
| 433 | ), |
| 434 | 'instructor_register_page' => array( |
| 435 | 'type' => 'select', |
| 436 | 'label' => __('Instructor Registration Page', 'tutor'), |
| 437 | 'default' => '0', |
| 438 | 'options' => $pages, |
| 439 | 'desc' => __('This page will be used to sign up new instructors.', 'tutor'), |
| 440 | ), |
| 441 | 'instructor_can_publish_course' => array( |
| 442 | 'type' => 'checkbox', |
| 443 | 'label' => __('Allow publishing course', 'tutor'), |
| 444 | 'label_title' => __('Enable', 'tutor'), |
| 445 | 'default' => '0', |
| 446 | 'desc' => __('Enable instructors to publish course directly. <strong>Do not select</strong> if admins want to review courses before publishing.', 'tutor'), |
| 447 | ), |
| 448 | 'enable_become_instructor_btn' => array( |
| 449 | 'type' => 'checkbox', |
| 450 | 'label' => __('Become Instructor Button', 'tutor'), |
| 451 | 'label_title' => __('Enable', 'tutor'), |
| 452 | 'default' => '0', |
| 453 | 'desc' => __('Uncheck this option to hide the button from student dashboard.', 'tutor'), |
| 454 | ), |
| 455 | ), |
| 456 | ), |
| 457 | ), |
| 458 | ), |
| 459 | 'students' => array( |
| 460 | 'label' => __('Students', 'tutor'), |
| 461 | 'sections' => array( |
| 462 | 'general' => array( |
| 463 | 'label' => __('Student Profile settings', 'tutor'), |
| 464 | 'desc' => __('Enable Disable Option to on/off notification on various event', 'tutor'), |
| 465 | 'fields' => array( |
| 466 | 'student_register_page' => array( |
| 467 | 'type' => 'select', |
| 468 | 'label' => __('Student Registration Page', 'tutor'), |
| 469 | 'default' => '0', |
| 470 | 'options' => $pages, |
| 471 | 'desc' => __('Choose the page for student registration page', 'tutor'), |
| 472 | ), |
| 473 | 'students_own_review_show_at_profile' => array( |
| 474 | 'type' => 'checkbox', |
| 475 | 'label' => __('Show reviews on profile', 'tutor'), |
| 476 | 'label_title' => __('Enable', 'tutor'), |
| 477 | 'default' => '0', |
| 478 | 'desc' => __('Enabling this will show the reviews written by each student on their profile', 'tutor')."<br />" .$student_url, |
| 479 | ), |
| 480 | 'show_courses_completed_by_student' => array( |
| 481 | 'type' => 'checkbox', |
| 482 | 'label' => __('Show completed courses', 'tutor'), |
| 483 | 'label_title' => __('Enable', 'tutor'), |
| 484 | 'default' => '0', |
| 485 | 'desc' => __('Completed courses will be shown on student profiles. <br/> For example, you can see this link-', 'tutor').$student_url, |
| 486 | ), |
| 487 | ), |
| 488 | ), |
| 489 | ), |
| 490 | ), |
| 491 | 'tutor_earning' => array( |
| 492 | 'label' => __('Earning', 'tutor'), |
| 493 | 'sections' => array( |
| 494 | 'general' => array( |
| 495 | 'label' => __('Earning and commission allocation', 'tutor'), |
| 496 | 'desc' => __('Enable Disable Option to on/off notification on various event', 'tutor'), |
| 497 | 'fields' => array( |
| 498 | 'enable_tutor_earning' => array( |
| 499 | 'type' => 'checkbox', |
| 500 | 'label' => __('Earning', 'tutor'), |
| 501 | 'label_title' => __('Enable', 'tutor'), |
| 502 | 'default' => '0', |
| 503 | 'desc' => __('If disabled, the Admin will receive 100% of the earning', 'tutor'), |
| 504 | ), |
| 505 | 'earning_admin_commission' => array( |
| 506 | 'type' => 'number', |
| 507 | 'label' => __('Admin Commission Percentage', 'tutor'), |
| 508 | 'default' => '20', |
| 509 | 'desc' => __('Define the commission of the Admin from each sale.(after deducting fees)', 'tutor'), |
| 510 | ), |
| 511 | 'earning_instructor_commission' => array( |
| 512 | 'type' => 'number', |
| 513 | 'label' => __('Instructor Commission Percentage', 'tutor'), |
| 514 | 'default' => '80', |
| 515 | 'desc' => __('Define the commission for instructors from each sale.(after deducting fees)', 'tutor'), |
| 516 | ), |
| 517 | 'tutor_earning_fees' => array( |
| 518 | 'type' => 'group_fields', |
| 519 | 'label' => __('Fee Deduction', 'tutor'), |
| 520 | 'desc' => __('Fees are charged from the entire sales amount. The remaining amount will be divided among admin and instructors.', 'tutor'), |
| 521 | 'group_fields' => array( |
| 522 | |
| 523 | 'enable_fees_deducting' => array( |
| 524 | 'type' => 'checkbox', |
| 525 | 'label' => __('Enable', 'tutor'), |
| 526 | 'default' => '0', |
| 527 | ), |
| 528 | 'fees_name' => array( |
| 529 | 'type' => 'text', |
| 530 | 'label' => __('Fee Name', 'tutor'), |
| 531 | 'default' => '', |
| 532 | ), |
| 533 | 'fees_amount' => array( |
| 534 | 'type' => 'number', |
| 535 | 'label' => __('Fee Amount', 'tutor'), |
| 536 | 'default' => '', |
| 537 | ), |
| 538 | 'fees_type' => array( |
| 539 | 'type' => 'select', |
| 540 | 'default' => 'minutes', |
| 541 | 'select_options' => false, |
| 542 | 'options' => array( |
| 543 | '' => __('Select Fees Type', 'tutor'), |
| 544 | 'percent' => __('Percent', 'tutor'), |
| 545 | 'fixed' => __('Fixed', 'tutor'), |
| 546 | ), |
| 547 | ), |
| 548 | |
| 549 | ), |
| 550 | ), |
| 551 | 'statement_show_per_page' => array( |
| 552 | 'type' => 'number', |
| 553 | 'label' => __('Show Statement Per Page', 'tutor'), |
| 554 | 'default' => '20', |
| 555 | 'desc' => __('Define the number of statements to show.', 'tutor'), |
| 556 | ), |
| 557 | ), |
| 558 | ), |
| 559 | ), |
| 560 | ), |
| 561 | 'tutor_withdraw' => array( |
| 562 | 'label' => __('Withdraw', 'tutor'), |
| 563 | 'sections' => array( |
| 564 | 'general' => array( |
| 565 | 'label' => __('Withdrawal Settings', 'tutor'), |
| 566 | 'fields' => array( |
| 567 | 'min_withdraw_amount' => array( |
| 568 | 'type' => 'number', |
| 569 | 'label' => __('Minimum Withdraw Amount', 'tutor'), |
| 570 | 'default' => '80', |
| 571 | 'desc' => __('Instructors should earn equal or above this amount to make a withdraw request.', 'tutor'), |
| 572 | ), |
| 573 | ), |
| 574 | ), |
| 575 | |
| 576 | 'withdraw_methods' => array( |
| 577 | 'label' => __('Withdraw Methods', 'tutor'), |
| 578 | 'desc' => __('Set withdraw settings', 'tutor'), |
| 579 | ), |
| 580 | ), |
| 581 | ), |
| 582 | |
| 583 | 'tutor_style' => array( |
| 584 | 'label' => __('Style', 'tutor'), |
| 585 | 'sections' => array( |
| 586 | 'general' => array( |
| 587 | 'label' => __('Color Style', 'tutor'), |
| 588 | 'fields' => array( |
| 589 | 'tutor_primary_color' => array( |
| 590 | 'type' => 'color', |
| 591 | 'label' => __('Primary Color', 'tutor'), |
| 592 | 'default' => '', |
| 593 | ), |
| 594 | 'tutor_primary_hover_color' => array( |
| 595 | 'type' => 'color', |
| 596 | 'label' => __('Primary Hover Color', 'tutor'), |
| 597 | 'default' => '', |
| 598 | ), |
| 599 | 'tutor_text_color' => array( |
| 600 | 'type' => 'color', |
| 601 | 'label' => __('Text color', 'tutor'), |
| 602 | 'default' => '', |
| 603 | ), |
| 604 | 'tutor_light_color' => array( |
| 605 | 'type' => 'color', |
| 606 | 'label' => __('Light color', 'tutor'), |
| 607 | 'default' => '', |
| 608 | ), |
| 609 | ), |
| 610 | ), |
| 611 | |
| 612 | ), |
| 613 | ), |
| 614 | |
| 615 | 'monetization' => array( |
| 616 | 'label' => __('Monetization', 'tutor'), |
| 617 | 'sections' => array( |
| 618 | 'general' => array( |
| 619 | 'label' => __('Monetization', 'tutor'), |
| 620 | 'desc' => __('You can monetize your LMS website by selling courses in a various way.', 'tutor'), |
| 621 | 'fields' => array( |
| 622 | |
| 623 | 'monetize_by' => array( |
| 624 | 'type' => 'radio', |
| 625 | 'label' => __('Monetize Option', 'tutor'), |
| 626 | 'default' => 'free', |
| 627 | 'select_options' => false, |
| 628 | 'options' => apply_filters('tutor_monetization_options', array( |
| 629 | 'free' => __('Disable Monetization', 'tutor'), |
| 630 | )), |
| 631 | 'desc' => __('Select a monetization option to generate revenue by selling courses. Supports: WooCommerce, Easy Digital Downloads, Paid Memberships Pro', 'tutor'), |
| 632 | ), |
| 633 | |
| 634 | ) |
| 635 | ) |
| 636 | ), |
| 637 | ), |
| 638 | |
| 639 | ); |
| 640 | |
| 641 | $attrs = apply_filters('tutor/options/attr', $attr); |
| 642 | $extends = apply_filters('tutor/options/extend/attr', array()); |
| 643 | |
| 644 | if (tutils()->count($extends)){ |
| 645 | foreach ($extends as $extend_key => $extend_option){ |
| 646 | if (isset($attrs[$extend_key])&& tutils()->count($extend_option['sections']) ){ |
| 647 | $sections = $attrs[$extend_key]['sections']; |
| 648 | $sections = array_merge($sections, $extend_option['sections']); |
| 649 | $attrs[$extend_key]['sections'] = $sections; |
| 650 | } |
| 651 | } |
| 652 | } |
| 653 | |
| 654 | return $attrs; |
| 655 | |
| 656 | } |
| 657 | |
| 658 | /** |
| 659 | * @param array $field |
| 660 | * |
| 661 | * @return string |
| 662 | * |
| 663 | * Generate Option Field |
| 664 | */ |
| 665 | public function generate_field($field = array()){ |
| 666 | ob_start(); |
| 667 | include tutor()->path.'views/options/option_field.php'; |
| 668 | return ob_get_clean(); |
| 669 | } |
| 670 | |
| 671 | public function field_type($field = array()){ |
| 672 | ob_start(); |
| 673 | include tutor()->path."views/options/field-types/{$field['type']}.php"; |
| 674 | return ob_get_clean(); |
| 675 | } |
| 676 | |
| 677 | public function generate(){ |
| 678 | ob_start(); |
| 679 | include tutor()->path.'views/options/options_generator.php'; |
| 680 | return ob_get_clean(); |
| 681 | } |
| 682 | |
| 683 | } |