From 0d6dedcabb6c77c894359ad9e3fb9f0d2279d1ef Mon Sep 17 00:00:00 2001 From: etchirag Date: Thu, 1 Feb 2024 16:03:14 +0530 Subject: [PATCH] Fixed inline result issue and fix phpcs issues --- php/admin/options-page-questions-tab.php | 2 +- php/classes/class-qmn-quiz-creator.php | 3 +++ .../qsm-question-type-fill-in-the-blanks.php | 4 ++-- php/question-types/qsm-question-type-number.php | 8 ++++---- php/question-types/qsm-question-type-paragraph.php | 4 ++-- php/question-types/qsm-question-type-short-answer.php | 10 +++++----- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/php/admin/options-page-questions-tab.php b/php/admin/options-page-questions-tab.php index b1cd72763..cefb13904 100644 --- a/php/admin/options-page-questions-tab.php +++ b/php/admin/options-page-questions-tab.php @@ -485,7 +485,7 @@ class="save-page-button button button-primary"> '3, 5, 7, 14' . $show_limit_text, 'documentation_link' => qsm_get_plugin_link( 'docs/creating-quizzes-and-surveys/adding-and-editing-questions/', 'quiz_editor', 'limit_text', 'quizsurvey-limit_text_doc' ), ), - 'min_text_length' => array( + 'min_text_length' => array( 'heading' => __( 'Minimum Characters', 'quiz-master-next' ), 'label' => __( 'Minimum number of characters required', 'quiz-master-next' ), 'type' => 'text', diff --git a/php/classes/class-qmn-quiz-creator.php b/php/classes/class-qmn-quiz-creator.php index 91e0498af..048276e73 100644 --- a/php/classes/class-qmn-quiz-creator.php +++ b/php/classes/class-qmn-quiz-creator.php @@ -524,6 +524,7 @@ public function duplicate_quiz( $quiz_id, $quiz_name, $is_duplicating_questions // Update quiz settings $update_quiz_settings = maybe_unserialize( $mlw_qmn_duplicate_data->quiz_settings ); $update_pages = maybe_unserialize( $update_quiz_settings['pages'] ); + $update_q_pages = maybe_unserialize( $update_quiz_settings['qpages'] ); // get logic data from logic table first or else from quiz_settings if ( ! is_null( $logic_table_exists ) ) { $query = $wpdb->prepare( "SELECT * FROM $logic_table WHERE quiz_id = %d", $quiz_id ); @@ -633,6 +634,7 @@ public function duplicate_quiz( $quiz_id, $quiz_name, $is_duplicating_questions foreach ( $pages_value as $pages_k_q => $page_q_id ) { if ( intval($page_q_id) === intval($mlw_question->question_id) ) { $update_pages[ $pages_key ][ $pages_k_q ] = $wpdb->insert_id; + $update_q_pages[ $pages_key ]['questions'][ $pages_k_q ] = $wpdb->insert_id; } } } @@ -681,6 +683,7 @@ public function duplicate_quiz( $quiz_id, $quiz_name, $is_duplicating_questions } } $update_quiz_settings['pages'] = maybe_serialize( $update_pages ); + $update_quiz_settings['qpages'] = maybe_serialize( $update_q_pages ); // saves data in logic table first or else in quiz_settings. $value_array = array(); if ( is_array( $logic_rules ) && ! empty( $logic_rules ) ) { diff --git a/php/question-types/qsm-question-type-fill-in-the-blanks.php b/php/question-types/qsm-question-type-fill-in-the-blanks.php index 45b539cfb..fd40ace25 100644 --- a/php/question-types/qsm-question-type-fill-in-the-blanks.php +++ b/php/question-types/qsm-question-type-fill-in-the-blanks.php @@ -36,10 +36,10 @@ function qmn_fill_blank_display( $id, $question, $answers ) { $required = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'required' ); $autofill = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'autofill' ); $limit_text = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'limit_text' ); - $min_fill_text = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'min_text_length' ); + $min_fill_text = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'min_text_length' ); $autofill_att = $autofill ? "autocomplete='off' " : ''; $limit_text_att = $limit_text ? "maxlength='" . $limit_text . "' " : ''; - $min_fill_text_att = $min_fill_text ? "minlength='" . $min_fill_text . "' " : ''; + $min_fill_text_att = $min_fill_text ? "minlength='" . $min_fill_text . "' " : ''; if ( 0 == $required ) { $mlw_require_class = 'mlwRequiredText'; } else { diff --git a/php/question-types/qsm-question-type-number.php b/php/question-types/qsm-question-type-number.php index 6a3a723ea..1d442a582 100644 --- a/php/question-types/qsm-question-type-number.php +++ b/php/question-types/qsm-question-type-number.php @@ -14,10 +14,10 @@ */ function qmn_number_display( $id, $question, $answers ) { global $mlwQuizMasterNext; - $required = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'required' ); - $limit_text = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'limit_text' ); - $min_num_text = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'min_text_length' ); - $min_num_attr = $min_num_text ? "minlength=" . $min_num_text . "" : ''; + $required = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'required' ); + $limit_text = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'limit_text' ); + $min_num_text = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'min_text_length' ); + $min_num_attr = $min_num_text ? "minlength=" . $min_num_text . "" : ''; if ( 0 == $required ) { $mlw_require_class = 'mlwRequiredNumber'; } else { diff --git a/php/question-types/qsm-question-type-paragraph.php b/php/question-types/qsm-question-type-paragraph.php index 37a488889..4a9f85825 100644 --- a/php/question-types/qsm-question-type-paragraph.php +++ b/php/question-types/qsm-question-type-paragraph.php @@ -16,8 +16,8 @@ function qmn_large_open_display( $id, $question, $answers ) { global $mlwQuizMasterNext; $required = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'required' ); $limit_text = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'limit_text' ); - $min_length = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'min_text_length' ); - $min_length_attr = $min_length ? "minlength=" . $min_length . "" : ''; + $min_length = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'min_text_length' ); + $min_length_attr = $min_length ? "minlength=" . $min_length . "" : ''; if ( 0 == $required ) { $mlw_require_class = 'mlwRequiredText'; } else { diff --git a/php/question-types/qsm-question-type-short-answer.php b/php/question-types/qsm-question-type-short-answer.php index 63f947901..b3830805f 100644 --- a/php/question-types/qsm-question-type-short-answer.php +++ b/php/question-types/qsm-question-type-short-answer.php @@ -14,12 +14,12 @@ */ function qmn_small_open_display( $id, $question, $answers ) { global $mlwQuizMasterNext; - $required = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'required' ); - $autofill = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'autofill' ); - $limit_text = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'limit_text' ); - $min_text_length = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'min_text_length' ); + $required = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'required' ); + $autofill = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'autofill' ); + $limit_text = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'limit_text' ); + $min_text_length = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'min_text_length' ); $autofill_att = $autofill ? "autocomplete='off' " : ''; - $min_text_attr = $min_text_length ? "minlength=" . $min_text_length . "" : ''; + $min_text_attr = $min_text_length ? "minlength=" . $min_text_length . "" : ''; if ( 0 == $required ) { $mlw_require_class = 'mlwRequiredText'; } else {