From df560bcd927046762f3673b3d934c68dcc748543 Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Thu, 23 May 2024 17:46:45 +0530 Subject: [PATCH 1/4] Multi slide polar question code changes --- js/qsm-admin.js | 6 +++++- js/qsm-common.js | 6 ++++-- php/question-types/qsm-question-type-polar.php | 8 ++++++-- php/template-variables.php | 3 ++- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/js/qsm-admin.js b/js/qsm-admin.js index d366354e5..31a458fb3 100644 --- a/js/qsm-admin.js +++ b/js/qsm-admin.js @@ -3209,7 +3209,11 @@ var import_button; var questionType = $('#question_type').val(); var answer_length = $('#answers').find('.answers-single').length; var answerType = $('#change-answer-editor').val(); - if (answer_length > 1 && $('#question_type').val() == 13) { + let isMultiPolar = { + isActive: false, + } + jQuery(document).trigger('qsm_new_answer_button_before', [isMultiPolar, question_id]); + if (answer_length > 1 && $('#question_type').val() == 13 && !isMultiPolar.isActive) { alert(qsm_admin_messages.polar_options_validation); return; } diff --git a/js/qsm-common.js b/js/qsm-common.js index 936a1eb97..bd79f5398 100644 --- a/js/qsm-common.js +++ b/js/qsm-common.js @@ -51,8 +51,10 @@ function qsmPolarSlider(page , polarQuestions){ polarQuestions.each( function(){ let polarQuestion = jQuery(this).find('.slider-main-wrapper div'); - let questionID = polarQuestion.attr('id').replace('slider-',''); - qsmPolarSliderEach(polarQuestion,questionID,page); + if(polarQuestion.length > 0){ + let questionID = polarQuestion.attr('id').replace('slider-',''); + qsmPolarSliderEach(polarQuestion,questionID,page); + } }); } diff --git a/php/question-types/qsm-question-type-polar.php b/php/question-types/qsm-question-type-polar.php index 2d562ca16..ddc26ad4d 100644 --- a/php/question-types/qsm-question-type-polar.php +++ b/php/question-types/qsm-question-type-polar.php @@ -41,9 +41,12 @@ function qmn_polar_display( $id, $question, $answers ) { } $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' ); qsm_question_title_func( $question, '', $new_question_title, $id ); - + $show = true; + $show = apply_filters( 'qsm_check_advance_polar_show_status', $show, $id ); ?> +
+
"; $question = $input_text; $question_display .= "" . do_shortcode( htmlspecialchars_decode( $question, ENT_QUOTES ) ) . ''; - return apply_filters( 'qmn_polar_display_front', $question_display, $id, $question, $answers ); + // return apply_filters( 'qmn_polar_display_front', $question_display, $id, $question, $answers ); + return apply_filters( 'qmn_polar_display_result_page', $question_display, $id, $question, $answers, $answer ); } /** From 653528c18f9e4c3c20c1012fadf6279304caa544 Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Thu, 13 Jun 2024 16:29:06 +0530 Subject: [PATCH 2/4] code changes for Advance polar --- js/qsm-common.js | 6 ++---- php/question-types/qsm-question-type-polar.php | 5 ++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/js/qsm-common.js b/js/qsm-common.js index 6c6431c89..c2e254bc4 100644 --- a/js/qsm-common.js +++ b/js/qsm-common.js @@ -51,10 +51,8 @@ function qsmPolarSlider(page , polarQuestions){ polarQuestions.each( function(){ let polarQuestion = jQuery(this).find('.slider-main-wrapper div'); - if(polarQuestion.length > 0){ - let questionID = polarQuestion.attr('id').replace('slider-',''); - qsmPolarSliderEach(polarQuestion,questionID,page); - } + let questionID = polarQuestion.attr('id').replace('slider-',''); + qsmPolarSliderEach(polarQuestion,questionID,page); }); } diff --git a/php/question-types/qsm-question-type-polar.php b/php/question-types/qsm-question-type-polar.php index b94e88823..d078b7a5d 100644 --- a/php/question-types/qsm-question-type-polar.php +++ b/php/question-types/qsm-question-type-polar.php @@ -43,10 +43,9 @@ function qmn_polar_display( $id, $question, $answers ) { qsm_question_title_func( $question, '', $new_question_title, $id ); $show = true; $show = apply_filters( 'qsm_check_advance_polar_show_status', $show, $id ); + if ( $show ) { ?> -
-
Date: Fri, 14 Jun 2024 16:08:21 +0530 Subject: [PATCH 3/4] Added hook and code changes for Advance Polar --- php/question-types/qsm-question-type-polar.php | 1 + php/template-variables.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/php/question-types/qsm-question-type-polar.php b/php/question-types/qsm-question-type-polar.php index d078b7a5d..3113fe1cc 100644 --- a/php/question-types/qsm-question-type-polar.php +++ b/php/question-types/qsm-question-type-polar.php @@ -43,6 +43,7 @@ function qmn_polar_display( $id, $question, $answers ) { qsm_question_title_func( $question, '', $new_question_title, $id ); $show = true; $show = apply_filters( 'qsm_check_advance_polar_show_status', $show, $id ); + echo apply_filters( 'qmn_polar_display_front_before', '', $id, $question, $answers ); if ( $show ) { ?> diff --git a/php/template-variables.php b/php/template-variables.php index 351c26142..bd1545d11 100644 --- a/php/template-variables.php +++ b/php/template-variables.php @@ -1557,7 +1557,7 @@ function qmn_polar_display_on_resultspage( $id, $question, $answers, $answer ) { $input_text .= ""; $question = $input_text; $question_display .= "" . do_shortcode( htmlspecialchars_decode( $question, ENT_QUOTES ) ) . ''; - // return apply_filters( 'qmn_polar_display_front', $question_display, $id, $question, $answers ); + $question_display = apply_filters( 'qmn_polar_display_front', $question_display, $id, $question, $answers ); return apply_filters( 'qmn_polar_display_result_page', $question_display, $id, $question, $answers, $answer ); } From 9edbbcfe013930e35e348404f8e95bf543c8ebbc Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Fri, 14 Jun 2024 16:12:46 +0530 Subject: [PATCH 4/4] Added hook and code changes for Advance Polar --- php/question-types/qsm-question-type-polar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/question-types/qsm-question-type-polar.php b/php/question-types/qsm-question-type-polar.php index 3113fe1cc..d471991dc 100644 --- a/php/question-types/qsm-question-type-polar.php +++ b/php/question-types/qsm-question-type-polar.php @@ -145,5 +145,5 @@ function qmn_polar_review( $id, $question, $answers ) { /** * Hook to filter answers array */ - return apply_filters( 'qmn_polar_review', $return_array, $id, $question, $answers ); + return apply_filters( 'qmn_polar_review', $return_array, $answers ); } \ No newline at end of file