Skip to content

Commit

Permalink
Merge pull request #2537 from QuizandSurveyMaster/CU-85ztkvkek-qsm-ul…
Browse files Browse the repository at this point in the history
…timate-hooks

Cu 85ztkvkek qsm ultimate hooks
  • Loading branch information
zubairraeen authored May 3, 2024
2 parents b4d7569 + 4f37019 commit 6165156
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions js/qsm-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3714,6 +3714,7 @@ var import_button;
'value': $(this).find('.results-page-condition-value').val()
});
});
jQuery(document).trigger('qsm_save_result_page_before', [this, page]);
pages.push(page);
});
let _X_validation = false;
Expand Down
2 changes: 2 additions & 0 deletions js/qsm-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
jQuery('.question-section-id-'+questionID+' .question-type-polar-s').find(
'.right-polar-title img').css('opacity', "0.8");
}
jQuery(document).trigger('qsm_polar_slider_change_after', [ui,questionID, answer1, answer2, value , isReverse]);
}

function qsmPolarSliderQuestionCreate(questionID){
Expand All @@ -187,5 +188,6 @@
'.right-polar-title').css('font-weight', '400');
jQuery('.question-section-id-'+questionID+' .question-type-polar-s img').find(
'.right-polar-title img').css('opacity', "0.5");
jQuery(document).trigger('qsm_polar_slider_create_after', [questionID]);
}
}(jQuery));
6 changes: 3 additions & 3 deletions js/qsm-quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ var qsmTimerInterval = [];
jQuery(document).trigger('qsm_init_progressbar_after', [quizID, qmn_quiz_data]);
}
QSM.goToPage(quizID, 1);
jQuery(document).on('click', '.qsm-quiz-container-' + quizID + ' .qsm-pagination .qsm-next', function (event) {
jQuery(document).on('click', '.qsm-quiz-container-' + quizID + ' .qsm-next', function (event) {
jQuery(document).trigger('qsm_next_button_click_before', [quizID]);
event.preventDefault();
let $quizForm = QSM.getQuizForm(quizID);
Expand All @@ -365,7 +365,7 @@ var qsmTimerInterval = [];
}
jQuery(document).trigger('qsm_next_button_click_after', [quizID]);
});
jQuery(document).on('click', '.qsm-quiz-container-' + quizID + ' .qsm-pagination .qsm-previous', function (event) {
jQuery(document).on('click', '.qsm-quiz-container-' + quizID + ' .qsm-previous', function (event) {
jQuery(document).trigger('qsm_previous_button_click_before', [quizID]);
event.preventDefault();
QSM.prevPage(quizID);
Expand Down Expand Up @@ -1466,7 +1466,7 @@ jQuery(function () {
});
});

jQuery(document).on('change', '.qmn-multiple-choice-input, .qsm_dropdown' , function (e) {
jQuery(document).on('change', '.qmn-multiple-choice-input, .qsm_dropdown, .mlw_answer_date ' , function (e) {
let $i_this = jQuery(this);
var quizID = jQuery(this).parents('.qsm-quiz-container').find('.qmn_quiz_id').val();
var $quizForm = QSM.getQuizForm(quizID);
Expand Down
2 changes: 2 additions & 0 deletions php/admin/options-page-results-page-tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function qsm_options_results_tab_content() {
'rest_user_nonce' => wp_create_nonce( 'wp_rest_nonce_' . $quiz_id . '_' . $user_id ),
);
wp_localize_script( 'qsm_admin_js', 'qsmResultsObject', $js_data );
do_action( 'qsm_options_results_tab_content_before' );
?>

<!-- Results Page Section -->
Expand Down Expand Up @@ -218,6 +219,7 @@ function qsm_options_results_tab_template(){
<?php esc_html_e( 'Mark as default', 'quiz-master-next' ); ?>
</label>
<div class="qsm-actions-link-box">
<?php do_action( 'qsm_add_action_links_before' ); ?>
<a href="javascript:void(0)" class="qsm-delete-result-button"><span class="dashicons dashicons-trash"></span></a>
<a href="javascript:void(0)" class="qsm-duplicate-result-page-button"><span class="dashicons dashicons-admin-page"></span></a>
<a href="javascript:void(0)" class="qsm-toggle-result-page-button"><span class="dashicons dashicons-arrow-down-alt2"></span></a>
Expand Down
1 change: 1 addition & 0 deletions php/classes/class-qmn-quiz-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1912,6 +1912,7 @@ public function submit_results( $qmn_quiz_options, $qmn_array_for_variables ) {

$result_display .= $this->display_social( $qmn_quiz_options, $qmn_array_for_variables );
$result_display = apply_filters( 'qmn_after_social_media', $result_display, $qmn_quiz_options, $qmn_array_for_variables );
$qmn_quiz_options = apply_filters( 'qmn_retake_quiz_button_before', $qmn_quiz_options );
if ( 1 == $qmn_quiz_options->enable_retake_quiz_button ) {
$result_display .= '<form method="POST">';
$result_display .= '<input type="hidden" value="' . $qmn_array_for_variables['quiz_id'] . '" name="qsm_retake_quiz_id" />';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ function qmn_horizontal_multiple_choice_display( $id, $question, $answers ) {
$mrq_checkbox_class = "mrq_checkbox_class";
}
$mlw_answer_total++;
$other_option_class = '';
$other_option_class = apply_filters( 'qsm_multiple_choice_other_option_classes', $other_option_class, $mlw_answer_total, $id, $answers );
if ( '' !== $answer[0] ) {
$answer_class = apply_filters( 'qsm_answer_wrapper_class', '', $answer, $id );
$answer_class .= 'image' === $answerEditor ? ' qmn_image_option' : '';
?>
<span class="mlw_horizontal_choice <?php echo esc_attr( $answer_class.' '.$mrq_checkbox_class ); ?>">
<input type="radio" class="qmn_quiz_radio qmn-multiple-choice-input" name="question<?php echo esc_attr( $id ); ?>" id="question<?php echo esc_attr( $id ) . '_' . esc_attr( $mlw_answer_total ); ?>" value="<?php echo esc_attr( $answer_index ); ?>" />
<input type="radio" class="qmn_quiz_radio qmn-multiple-choice-input <?php echo esc_attr( $other_option_class ); ?>" name="question<?php echo esc_attr( $id ); ?>" id="question<?php echo esc_attr( $id ) . '_' . esc_attr( $mlw_answer_total ); ?>" value="<?php echo esc_attr( $answer_index ); ?>" />
<label class="qsm-input-label" for="question<?php echo esc_attr( $id ) . '_' . esc_attr( $mlw_answer_total ); ?>">
<?php
if ( 'image' === $answerEditor ) {
Expand Down Expand Up @@ -106,6 +108,7 @@ function qmn_horizontal_multiple_choice_display( $id, $question, $answers ) {
*/
function qmn_horizontal_multiple_choice_review( $id, $question, $answers ) {
$current_question = new QSM_Question_Review_Choice( $id, $question, $answers );
$current_question = apply_filters( 'qmn_multiple_choice_review_before', $current_question, $id, $question, $answers );
$user_text_array = $current_question->get_user_answer( 'single_response' );
$correct_text_array = $current_question->get_correct_answer();
$return_array['user_text'] = ! empty( $user_text_array ) ? implode( ', ', $user_text_array ) : '';
Expand Down
6 changes: 5 additions & 1 deletion php/question-types/qsm-question-type-multiple-choice.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ function qmn_multiple_choice_display( $id, $question, $answers ) {
$mrq_checkbox_class = "mrq_checkbox_class";
}
$mlw_answer_total++;
$other_option_class = '';
$other_option_class = apply_filters( 'qsm_multiple_choice_other_option_classes', $other_option_class, $mlw_answer_total, $id, $answers );
if ( '' !== $answer[0] ) {
$answer_class = apply_filters( 'qsm_answer_wrapper_class', '', $answer, $id );
if ( 'rich' === $answerEditor ) {
Expand All @@ -57,7 +59,7 @@ function qmn_multiple_choice_display( $id, $question, $answers ) {
<?php
}
?>
<input type='radio' class='qmn_quiz_radio qmn-multiple-choice-input' name="<?php echo esc_attr( 'question' . $id ); ?>" id="<?php echo esc_attr( 'question' . $id . '_' . $mlw_answer_total ); ?>" value="<?php echo esc_attr( $answer_index ); ?>" />
<input type='radio' class='qmn_quiz_radio qmn-multiple-choice-input <?php echo esc_attr( $other_option_class ); ?>' name="<?php echo esc_attr( 'question' . $id ); ?>" id="<?php echo esc_attr( 'question' . $id . '_' . $mlw_answer_total ); ?>" value="<?php echo esc_attr( $answer_index ); ?>" />
<label class="qsm-input-label" for="<?php echo esc_attr( 'question' . $id . '_' . $mlw_answer_total ); ?>">
<?php
if ( 'image' === $answerEditor ) {
Expand Down Expand Up @@ -93,6 +95,7 @@ function qmn_multiple_choice_display( $id, $question, $answers ) {
}
//}
}
echo apply_filters( 'qsm_multiple_choice_display_after_loop', ' ', $id, $question, $answers );
?>
<input type="radio" style="display: none;" name="<?php echo esc_attr( 'question' . $id ); ?>" id="<?php echo esc_attr( 'question' . $id . '_none' ); ?>" checked="checked" value="" />
<?php
Expand All @@ -114,6 +117,7 @@ function qmn_multiple_choice_display( $id, $question, $answers ) {
*/
function qmn_multiple_choice_review( $id, $question, $answers ) {
$current_question = new QSM_Question_Review_Choice( $id, $question, $answers );
$current_question = apply_filters( 'qmn_multiple_choice_review_before', $current_question, $id, $question, $answers );
$user_text_array = $current_question->get_user_answer();
$correct_text_array = $current_question->get_correct_answer();
$return_array['user_answer'] = $user_text_array;
Expand Down
1 change: 1 addition & 0 deletions php/template-variables/qsm-tempvar-question-answers.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function qsm_tempvar_qa_text_qt_choice( $total_answers, $answers_from_response,
$image_class = '';
$show_user_answer = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $show_user_answer, 'answer-' . $answers_from_response['id'] . '-' . $single_answer_key, 'QSM Answers' );
}
$show_user_answer = apply_filters( 'qsm_show_user_answer_after', $show_user_answer, $single_answer, $user_answer_array, $single_answer_key, $answers_from_response, $grading_system, $question_settings, $form_type, $total_answers );
$close_span = '</span>';
if ( 0 == $form_type && ( 0 === intval( $grading_system ) || 3 === intval( $grading_system ) ) ) {
$hide_correct_answer = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'hide_correct_answer' );
Expand Down

0 comments on commit 6165156

Please sign in to comment.