diff --git a/css/qsm-admin.css b/css/qsm-admin.css index 697f16c11..bc5d16234 100644 --- a/css/qsm-admin.css +++ b/css/qsm-admin.css @@ -760,7 +760,8 @@ ul.changelog li.update div.two:before { .admin_page_mlw_quiz_options .update-nag { display: none; } -.admin_page_mlw_quiz_options #wpwrap { +.admin_page_mlw_quiz_options #wpwrap, +#qsm-export-settings-options button { overflow: hidden; } .admin_page_mlw_quiz_options .qsm-info-widget { @@ -907,6 +908,7 @@ ul.changelog li.update div.two:before { padding: 10px 6px; width: 100%; } +.qsm-sub-tab-menu a, .qsm_tab_content a { cursor: pointer; text-decoration: none; @@ -914,11 +916,11 @@ ul.changelog li.update div.two:before { display: inline-block; box-sizing: border-box; } -.qsm_tab_content .subsubsub li:first-child { +.qsm-sub-tab-menu .subsubsub li:first-child { border-left: 0; padding-left: 0; } -.qsm_tab_content .subsubsub li a { +.qsm-sub-tab-menu .subsubsub li a { font-size: 14px; line-height: 1.2; padding: 10px; @@ -929,7 +931,7 @@ ul.changelog li.update div.two:before { text-decoration: none; box-shadow: none; } -.qsm_tab_content .subsubsub li a.current{ +.qsm-sub-tab-menu .subsubsub li a.current{ border-bottom: 3px solid #00BEE9; } /* Popup */ @@ -1177,7 +1179,6 @@ h3.addon_category_name { .qsm_tab_content input[type="number"], .qsm_tab_content input[type="url"], .qsm_global_settings input[type="text"], -.qsm_global_settings input[type="number"], .qsm_global_settings input[type="email"], .qsm_global_settings input[type="url"], .qsm-addon-setting-wrap input[type="email"], @@ -1354,11 +1355,12 @@ tr .qsm-opt-desc { #quiz_settings_wrapper .qsm-opt-desc { display: none !important; } -body:not(.qsm_page_qmn_global_settings) .form-table td fieldset label { +.form-table td fieldset label { margin-right: 20px !important; width: 100%; } -#correct_answer_logic { +#correct_answer_logic, +.qsm-p-b-10 { padding-bottom: 10px; } .qsm-font-light { diff --git a/js/qsm-admin.js b/js/qsm-admin.js index 7df49a6ed..c3beda9b4 100644 --- a/js/qsm-admin.js +++ b/js/qsm-admin.js @@ -167,7 +167,14 @@ var QSMAdmin; let customValue = jQuery(this).val(); jQuery('#preferred_date_format label.qsm-option-label:last input[type="radio"]').val(customValue); }); - + if( jQuery('#qsm-select-quiz-apply').length ) { + jQuery('#qsm-select-quiz-apply').multiselect( { + columns: 1, + search: true, + selectAll: true, + dropdownAutoWidth: false + } ); + } jQuery(document).on('click','.add-more-category', function () { let original = jQuery('div.select-category-question-limit-maindiv'); let lastChild = original.children().last(); @@ -598,41 +605,30 @@ var QSMAdmin; }); //theme option setting image end - $(document).on('change', '.global_form_type_settiong select[name="qsm-quiz-settings[form_type]"]', function () { - var value = $(this).val(); - if (value == '0') { + $(document).on('change', '.qsm_page_qmn_global_settings input[name="qsm-quiz-settings[form_type]"]', function () { + if ( 0 == $(this).val() ) { $('.global_setting_system').parents('tr').show(); - $('.global_setting_score_roundoff').parents('tr').show(); + $('#qsm-score-roundoff').parents('label').show(); + $("#qsm-correct-answer-logic").show(); } else { $('.global_setting_system').parents('tr').hide(); - $('.global_setting_score_roundoff').parents('tr').hide(); - + $('#qsm-score-roundoff').parents('label').hide(); + $("#qsm-correct-answer-logic").hide(); } }); $(document).on('change', '.global_setting_system input[name="qsm-quiz-settings[system]"]', function () { - var value = $('input[name="qsm-quiz-settings[system]"]:checked').val(); - var value1 = $('.global_form_type_settiong select[name="qsm-quiz-settings[form_type]"]').val(); - if (value != '1' && value1 == '0') { - $('.global_setting_score_roundoff').parents('tr').show(); + if ( 1 != $(this).val() && 0 == $('.qsm_page_qmn_global_settings input[name="qsm-quiz-settings[form_type]"]:checked').val() ) { + $('#qsm-score-roundoff').parents('label').show(); + $("#qsm-correct-answer-logic").show(); } else { - $('.global_setting_score_roundoff').parents('tr').hide(); + $('#qsm-score-roundoff').parents('label').hide(); + $("#qsm-correct-answer-logic").hide(); } }); - $('.global_form_type_settiong select[name="qsm-quiz-settings[form_type]"]').trigger('change'); - $('.global_setting_system input[name="qsm-quiz-settings[system]"]').trigger('change'); + $('.qsm_page_qmn_global_settings input[name="qsm-quiz-settings[form_type]"]:checked').trigger('change'); + $('.global_setting_system input[name="qsm-quiz-settings[system]"]:checked').trigger('change'); }); - $(document).on('change', '.global_setting_system input[name="qsm-quiz-settings[system]"]', function () { - var value = $('input[name="qsm-quiz-settings[system]"]:checked').val(); - var value1 = $('.global_form_type_settiong select[name="qsm-quiz-settings[form_type]"]').val(); - if (value != '1' && value1 == '0') { - $('.global_setting_score_roundoff').parents('tr').show(); - } else { - $('.global_setting_score_roundoff').parents('tr').hide(); - } - }); - $('.global_form_type_settiong select[name="qsm-quiz-settings[form_type]"]').trigger('change'); - $('.global_setting_system input[name="qsm-quiz-settings[system]"]').trigger('change'); $(document).on('click', '#the-list .delete_table_quiz_results_item', function (e) { e.preventDefault(); diff --git a/mlw_quizmaster2.php b/mlw_quizmaster2.php index 628392474..0ec267422 100644 --- a/mlw_quizmaster2.php +++ b/mlw_quizmaster2.php @@ -370,7 +370,7 @@ public function qsm_admin_scripts_style( $hook ) { } } // load admin JS after all dependencies are loaded - wp_enqueue_script( 'qsm_admin_js', plugins_url( 'js/qsm-admin.js', __FILE__ ), array( 'jquery', 'backbone', 'underscore', 'wp-util', 'jquery-ui-sortable', 'jquery-touch-punch' ), $this->version, true ); + wp_enqueue_script( 'qsm_admin_js', plugins_url( 'js/qsm-admin.js', __FILE__ ), array( 'jquery', 'backbone', 'underscore', 'wp-util', 'jquery-ui-sortable', 'jquery-touch-punch', 'qsm-jquery-multiselect-js' ), $this->version, true ); wp_enqueue_style( 'jquer-multiselect-css', QSM_PLUGIN_CSS_URL . '/jquery.multiselect.min.css', array(), $this->version ); wp_enqueue_script( 'qsm-jquery-multiselect-js', QSM_PLUGIN_JS_URL . '/jquery.multiselect.min.js', array( 'jquery' ), $this->version, true ); wp_enqueue_script( 'micromodal_script', plugins_url( 'js/micromodal.min.js', __FILE__ ), array( 'jquery', 'qsm_admin_js' ), $this->version, true ); diff --git a/php/admin/settings-page.php b/php/admin/settings-page.php index 0c9a05609..f526267db 100644 --- a/php/admin/settings-page.php +++ b/php/admin/settings-page.php @@ -154,55 +154,31 @@ public static function default_settings() { */ public function quiz_default_global_option_init() { register_setting( 'qsm-quiz-settings-group', 'qsm-quiz-settings' ); - add_settings_section( 'qmn-global-section', __( 'Quiz Settings', 'quiz-master-next' ), array( $this, 'global_section' ), 'qsm_default_global_option_general' ); - add_settings_section( 'qmn-global-section', __( 'Quiz Settings', 'quiz-master-next' ), array( $this, 'global_section' ), 'qsm_default_global_option_quiz_submission' ); - add_settings_section( 'qmn-global-section', __( 'Quiz Settings', 'quiz-master-next' ), array( $this, 'global_section' ), 'qsm_default_global_option_display' ); - add_settings_section( 'qmn-global-section', __( 'Quiz Settings', 'quiz-master-next' ), array( $this, 'global_section' ), 'qsm_default_global_option_contact' ); - add_settings_field( 'quiz-type', __( 'Quiz Type', 'quiz-master-next' ), array( $this, 'qsm_global_quiz_type' ), 'qsm_default_global_option_general', 'qmn-global-section' ); + add_settings_section( 'qmn-global-section', '', array( $this, 'global_section' ), 'qsm_default_global_option_general' ); + add_settings_section( 'qmn-global-section', '', array( $this, 'global_section' ), 'qsm_default_global_option_quiz_submission' ); + add_settings_section( 'qmn-global-section', '', array( $this, 'global_section' ), 'qsm_default_global_option_display' ); + add_settings_section( 'qmn-global-section', '', array( $this, 'global_section' ), 'qsm_default_global_option_contact' ); + add_settings_field( 'quiz-type', __( 'Select Type', 'quiz-master-next' ), array( $this, 'qsm_global_quiz_type' ), 'qsm_default_global_option_general', 'qmn-global-section' ); add_settings_field( 'grading-system', __( 'Grading System', 'quiz-master-next' ), array( $this, 'qsm_global_grading_system' ), 'qsm_default_global_option_general', 'qmn-global-section' ); - add_settings_field( 'correct_answer_logic', __( 'Correct Answer Logic', 'quiz-master-next' ), array( $this, 'correct_answer_logic' ), 'qsm_default_global_option_general', 'qmn-global-section' ); - add_settings_field( 'default_answers', __( 'Default Number of Answers', 'quiz-master-next' ), array( $this, 'default_answers' ), 'qsm_default_global_option_general', 'qmn-global-section' ); - add_settings_field( 'allow-score-round-off', __( 'Allow Score Round-off', 'quiz-master-next' ), array( $this, 'qsm_global_score_roundoff' ), 'qsm_default_global_option_general', 'qmn-global-section' ); - add_settings_field( 'show-progress-bar', __( 'Show progress bar', 'quiz-master-next' ), array( $this, 'qsm_global_show_progress_bar' ), 'qsm_default_global_option_display', 'qmn-global-section' ); - add_settings_field( 'require-user-login', __( 'Require User Login', 'quiz-master-next' ), array( $this, 'qsm_global_require_user_login' ), 'qsm_default_global_option_general', 'qmn-global-section' ); - add_settings_field( 'questions-per-page', __( 'Questions Per Page', 'quiz-master-next' ), array( $this, 'qsm_global_questions_per_page' ), 'qsm_default_global_option_display', 'qmn-global-section' ); - add_settings_field( 'time-limit-in-minutes', __( 'Time Limit (in minutes)', 'quiz-master-next' ), array( $this, 'qsm_global_time_limit_in_minutes' ), 'qsm_default_global_option_quiz_submission', 'qmn-global-section' ); - add_settings_field( 'force-submit-after-timer-expiry', __( 'Force submit after timer expiry', 'quiz-master-next' ), array( $this, 'qsm_global_force_submit_after_timer_expiry' ), 'qsm_default_global_option_quiz_submission', 'qmn-global-section' ); - add_settings_field( 'skip-validations-when-time-expire', __( 'Skip validations when time expire', 'quiz-master-next' ), array( $this, 'qsm_global_skip_validations_when_time_expire' ), 'qsm_default_global_option_quiz_submission', 'qmn-global-section' ); - add_settings_field( 'limit-attempts', __( 'Limit Attempts', 'quiz-master-next' ), array( $this, 'qsm_global_limit_attempts' ), 'qsm_default_global_option_quiz_submission', 'qmn-global-section' ); - add_settings_field( 'limit-entries', __( 'Limit Entries', 'quiz-master-next' ), array( $this, 'qsm_global_limit_entries' ), 'qsm_default_global_option_quiz_submission', 'qmn-global-section' ); - add_settings_field( 'limit-number-of-questions', __( 'Limit number of Questions', 'quiz-master-next' ), array( $this, 'qsm_global_limit_number_of_questions' ), 'qsm_default_global_option_general', 'qmn-global-section' ); - add_settings_field( 'limit-number-of-questions-per-category', __( 'Limit number of Questions Per Category', 'quiz-master-next' ), array( $this, 'qsm_global_limit_number_of_questions_per_category' ), 'qsm_default_global_option_general', 'qmn-global-section' ); - add_settings_field( 'quiz-dates', __( 'Quiz Dates', 'quiz-master-next' ), array( $this, 'qsm_global_quiz_dates' ), 'qsm_default_global_option_general', 'qmn-global-section' ); - add_settings_field( 'can-submit-after-end-date', "", array( $this, 'qsm_global_do_not_allow_quiz_submission_after_the_end_datetime' ), 'qsm_default_global_option_general', 'qmn-global-section' ); + add_settings_field( 'correct_answer_logic', __( 'Answer Settings', 'quiz-master-next' ), array( $this, 'correct_answer_logic' ), 'qsm_default_global_option_general', 'qmn-global-section' ); add_settings_field( 'random-questions', __( 'Random Questions', 'quiz-master-next' ), array( $this, 'qsm_global_random_questions' ), 'qsm_default_global_option_general', 'qmn-global-section' ); - add_settings_field( 'contact-form-position', __( 'Contact form position', 'quiz-master-next' ), array( $this, 'qsm_global_contact_form_position' ), 'qsm_default_global_option_contact', 'qmn-global-section' ); - add_settings_field( 'show-contact-form-to-logged-in-users', __( 'Show contact form to logged in users', 'quiz-master-next' ), array( $this, 'qsm_global_show_contact_form_to_logged_in_users' ), 'qsm_default_global_option_contact', 'qmn-global-section' ); + add_settings_field( 'quiz-dates', __( 'Quiz Dates', 'quiz-master-next' ), array( $this, 'qsm_global_quiz_dates' ), 'qsm_default_global_option_general', 'qmn-global-section' ); + add_settings_field( 'limit-number-of-questions', __( 'Limit number of Questions', 'quiz-master-next' ), array( $this, 'qsm_global_limit_number_of_questions' ), 'qsm_default_global_option_general', 'qmn-global-section' ); + add_settings_field( 'default_answers', __( 'Default Number of Answers', 'quiz-master-next' ), array( $this, 'default_answers' ), 'qsm_default_global_option_general', 'qmn-global-section' ); add_settings_field( 'enable-comments', __( 'Enable comments', 'quiz-master-next' ), array( $this, 'qsm_global_enable_comments' ), 'qsm_default_global_option_general', 'qmn-global-section' ); - add_settings_field( 'show-question-numbers', __( 'Show question numbers', 'quiz-master-next' ), array( $this, 'qsm_global_show_question_numbers' ), 'qsm_default_global_option_display', 'qmn-global-section' ); - add_settings_field( 'show-opt-in-answers-default', __( 'Show Opt-in type Answers to user', 'quiz-master-next' ), array( $this, 'qsm_global_show_optin_answers' ), 'qsm_default_global_option_display', 'qmn-global-section' ); - add_settings_field( 'show-text-html-in-answers-default', __( 'Show Text/HTML type section in result page', 'quiz-master-next' ), array( $this, 'qsm_global_show_text_html_answers' ), 'qsm_default_global_option_display', 'qmn-global-section' ); + add_settings_field( 'time-limit-in-minutes', __( 'Timer Settings', 'quiz-master-next' ), array( $this, 'qsm_global_time_limit_in_minutes' ), 'qsm_default_global_option_quiz_submission', 'qmn-global-section' ); + add_settings_field( 'end-quiz-if-there-is-wrong-answer', __( 'Answer Controls', 'quiz-master-next' ), array( $this, 'qsm_global_end_quiz_if_there_is_wrong_answer' ), 'qsm_default_global_option_quiz_submission', 'qmn-global-section' ); + add_settings_field( 'limit-attempts', __( 'Quiz Controls', 'quiz-master-next' ), array( $this, 'qsm_global_limit_attempts' ), 'qsm_default_global_option_quiz_submission', 'qmn-global-section' ); add_settings_field( 'save-responses', __( 'Submit Actions', 'quiz-master-next' ), array( $this, 'qsm_global_save_responses' ), 'qsm_default_global_option_quiz_submission', 'qmn-global-section' ); - add_settings_field( 'disable-change-of-answers', __( 'Disable change of answers', 'quiz-master-next' ), array( $this, 'qsm_global_disable_change_of_answers' ), 'qsm_default_global_option_quiz_submission', 'qmn-global-section' ); - add_settings_field( 'add-class-for-correct-incorrect-answers', __( 'Add class for correct/incorrect answers', 'quiz-master-next' ), array( $this, 'qsm_global_add_class_for_correct_incorrect_answers' ), 'qsm_default_global_option_display', 'qmn-global-section' ); + add_settings_field( 'show-progress-bar', __( 'Progress Controls', 'quiz-master-next' ), array( $this, 'qsm_global_show_progress_bar' ), 'qsm_default_global_option_display', 'qmn-global-section' ); + add_settings_field( 'questions-per-page', __( 'Question Settings', 'quiz-master-next' ), array( $this, 'qsm_global_questions_per_page' ), 'qsm_default_global_option_display', 'qmn-global-section' ); + add_settings_field( 'show-opt-in-answers-default', __( 'Result Page Controls', 'quiz-master-next' ), array( $this, 'qsm_global_show_optin_answers' ), 'qsm_default_global_option_display', 'qmn-global-section' ); + add_settings_field( 'quiz-animation', __( 'Quiz Page Settings', 'quiz-master-next' ), array( $this, 'qsm_global_quiz_animation' ), 'qsm_default_global_option_display', 'qmn-global-section' ); + add_settings_field( 'logo-url', __( 'Advanced Settings', 'quiz-master-next' ), array( $this, 'qsm_global_logo_url' ), 'qsm_default_global_option_display', 'qmn-global-section' ); + add_settings_field( 'contact-form-position', __( 'Contact form position', 'quiz-master-next' ), array( $this, 'qsm_global_contact_form_position' ), 'qsm_default_global_option_contact', 'qmn-global-section' ); + add_settings_field( 'show-contact-form-to-logged-in-users', __( 'Show contact form to logged in users', 'quiz-master-next' ), array( $this, 'qsm_global_show_contact_form_to_logged_in_users' ), 'qsm_default_global_option_contact', 'qmn-global-section' ); add_settings_field( 'disable-auto-fill-for-contact-input', __( 'Disable auto fill for contact input', 'quiz-master-next' ), array( $this, 'qsm_global_disable_auto_fill_for_contact_input' ), 'qsm_default_global_option_contact', 'qmn-global-section' ); - add_settings_field( 'disable-auto-fill-for-quiz-input', __( 'Disable auto fill for Quiz input', 'quiz-master-next' ), array( $this, 'qsm_global_disable_auto_fill_for_quiz_input' ), 'qsm_default_global_option_display', 'qmn-global-section' ); - add_settings_field( 'display-category-name-on-front-end', __( 'Display category name on front end', 'quiz-master-next' ), array( $this, 'qsm_global_display_category_name_on_front_end' ), 'qsm_default_global_option_display', 'qmn-global-section' ); - add_settings_field( 'hide-correct-answer', __( 'Hide Correct Answer', 'quiz-master-next' ), array( $this, 'qsm_global_hide_correct_answer' ), 'qsm_default_global_option_display', 'qmn-global-section' ); - add_settings_field( 'show-results-inline', __( 'Show results inline', 'quiz-master-next' ), array( $this, 'qsm_global_show_results_inline' ), 'qsm_default_global_option_display', 'qmn-global-section' ); - add_settings_field( 'end-quiz-if-there-is-wrong-answer', __( 'End quiz', 'quiz-master-next' ), array( $this, 'qsm_global_end_quiz_if_there_is_wrong_answer' ), 'qsm_default_global_option_quiz_submission', 'qmn-global-section' ); - add_settings_field( 'show-correct-answer-inline', __( 'Show correct answer inline', 'quiz-master-next' ), array( $this, 'qsm_global_show_correct_answer_inline' ), 'qsm_default_global_option_display', 'qmn-global-section' ); - add_settings_field( 'retake-quiz', __( 'Retake Quiz', 'quiz-master-next' ), array( $this, 'qsm_global_retake_quiz' ), 'qsm_default_global_option_quiz_submission', 'qmn-global-section' ); - add_settings_field( 'show-current-page-number', __( 'Show current page number', 'quiz-master-next' ), array( $this, 'qsm_global_show_current_page_number' ), 'qsm_default_global_option_display', 'qmn-global-section' ); - add_settings_field( 'show-current-page-number', __( 'Show question featured image in results page', 'quiz-master-next' ), array( $this, 'qsm_global_show_question_featured_image_in_result' ), 'qsm_default_global_option_display', 'qmn-global-section' ); - add_settings_field( 'deselect-answer', __( 'Deselect Answer', 'quiz-master-next' ), array( $this, 'qsm_global_deselect_answer' ), 'qsm_default_global_option_general', 'qmn-global-section' ); - add_settings_field( 'disable-description-on-quiz-result-page', __( 'Disable description on quiz result page?', 'quiz-master-next' ), array( $this, 'qsm_global_disable_description_on_quiz_result_page' ), 'qsm_default_global_option_general', 'qmn-global-section' ); - add_settings_field( 'disable_mathjax', __( 'Disable MathJax?', 'quiz-master-next' ), array( $this, 'qsm_global_disable_mathjax' ), 'qsm_default_global_option_general', 'qmn-global-section' ); - add_settings_field( 'disable-scroll-on-next-and-previous-button-click', __( 'Disable scroll on next and previous button click?', 'quiz-master-next' ), array( $this, 'qsm_global_disable_scroll_on_next_and_previous_button_click' ), 'qsm_default_global_option_display', 'qmn-global-section' ); add_settings_field( 'disable-first-page', __( 'Disable first page on quiz', 'quiz-master-next' ), array( $this, 'qsm_global_disable_first_page' ), 'qsm_default_global_option_contact', 'qmn-global-section' ); - add_settings_field( 'quiz-animation', __( 'Quiz Animation', 'quiz-master-next' ), array( $this, 'qsm_global_quiz_animation' ), 'qsm_default_global_option_display', 'qmn-global-section' ); - add_settings_field( 'logo-url', __( 'Logo URL', 'quiz-master-next' ), array( $this, 'qsm_global_logo_url' ), 'qsm_default_global_option_display', 'qmn-global-section' ); - add_settings_field( 'preferred_date_format', __( 'Preferred Date Format', 'quiz-master-next' ), array( $this, 'preferred_date_format' ), 'qsm_default_global_option_display', 'qmn-global-section' ); global $globalQuizsetting; $get_default_value = self::default_settings(); $get_saved_value = get_option( 'qsm-quiz-settings' ); @@ -224,7 +200,6 @@ public static function get_global_quiz_settings() { * @return void */ public function global_section() { - esc_html_e( 'These settings are applied to the entire plugin and all quizzes.', 'quiz-master-next' ); $enabled = get_option( 'qsm_multiple_category_enabled' ); if ( 'cancelled' === $enabled ) { ?> @@ -559,78 +534,105 @@ public function ip_collection_field() { */ public static function display_page() { global $mlwQuizMasterNext; - $active_tab = 'qmn_global_settings'; - if ( isset( $_GET['tab'] ) ) { - if ( sanitize_text_field( wp_unslash( $_GET['tab'] ) ) == 'qmn_global_settings' ) { - $active_tab = 'qmn_global_settings'; - } else { - $active_tab = 'quiz-default-options'; - } - } - $g_class = $d_class = ''; - if ( 'qmn_global_settings' === $active_tab ) { - $g_class = 'nav-tab-active'; - } - if ( 'quiz-default-options' === $active_tab ) { - $d_class = 'nav-tab-active'; - } ?>
'; + } + if ( empty( $_GET['tab'] ) || 'qmn_global_settings' === $_GET['tab'] ) { + settings_fields( 'qmn-settings-group' ); + do_settings_sections( 'qmn_global_settings' ); + } + if ( ! empty( $_GET['tab'] ) && 'quiz-default-options' === $_GET['tab'] ) { + settings_fields( 'qsm-quiz-settings-group' ); + ?> + + +