diff --git a/js/qsm-quiz.js b/js/qsm-quiz.js index 2e55c05c3..405c13483 100644 --- a/js/qsm-quiz.js +++ b/js/qsm-quiz.js @@ -781,6 +781,18 @@ jQuery(function() { }); } }); + + jQuery('.qmn_radio_answers > .qmn_mc_answer_wrap').on('click',function(event){ + var radButton = jQuery(this).find('input[type=radio]'); + if(event.target.className == 'qmn_quiz_radio'){ + return true; + } + if(radButton.is(':checked')){ + jQuery(radButton).prop("checked", false); + } else { + jQuery(radButton).prop("checked", true); + } + }); }); var qsmTimerInterval = setInterval( qmnTimeTakenTimer, 1000 ); diff --git a/php/admin/admin-results-details-page.php b/php/admin/admin-results-details-page.php index 15c289eb5..c6f341230 100644 --- a/php/admin/admin-results-details-page.php +++ b/php/admin/admin-results-details-page.php @@ -27,8 +27,23 @@ function qsm_generate_result_details() { } ?> -
- + .result-tab-content p{ + font-size: 16px; + } + .qmn_question_answer b { + font-size: 18px; + margin-bottom: 0; + display: block; + } + .qmn_question_answer{ + margin-bottom: 30px; + font-size: 16px; + line-height: 1.5; + } + +
+ get_var( "SELECT result_id FROM {$wpdb->prefix}mlw_results WHERE result_id = (SELECT MIN(result_id) FROM {$wpdb->prefix}mlw_results WHERE deleted = 0 AND result_id > $result_id)" ); // If there is previous or next results, show buttons. + echo '
'; if ( ! is_null( $previous_results ) && $previous_results ) { echo "View Previous Results "; } if ( ! is_null( $next_results ) && $next_results ) { echo " View Next Results"; } + echo '
'; // Get template for admin results. $settings = (array) get_option( 'qmn-settings' ); - if ( isset( $settings['results_details_template'] ) ) { + if ( isset( $settings['results_details_template'] ) ) { $template = htmlspecialchars_decode( $settings['results_details_template'], ENT_QUOTES ); } else { $template = "

Quiz Results for %QUIZ_NAME%

diff --git a/php/classes/class-qmn-quiz-manager.php b/php/classes/class-qmn-quiz-manager.php index afcb2a859..2944b9412 100644 --- a/php/classes/class-qmn-quiz-manager.php +++ b/php/classes/class-qmn-quiz-manager.php @@ -803,6 +803,17 @@ public function ajax_submit_results() { 'quiz_system' => $options->system, 'quiz_payment_id' => isset($_POST['main_payment_id']) ? $_POST['main_payment_id'] : '' ); + $post_data = $_POST; + if(class_exists('QSM_Recaptcha')){ + $verified = qsm_verify_recaptcha($post_data); + if(!$verified){ + echo json_encode(array( + 'display' => htmlspecialchars_decode('ReCaptcha Validation failed'), + 'redirect' => FALSE, + )); + exit; + } + } echo json_encode($this->submit_results($options, $data)); die(); } @@ -887,9 +898,8 @@ 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); - - if ( is_plugin_active( 'qsm-save-resume/qsm-save-resume.php' ) != 1 ) { - $result_display .= 'Retake Quiz'; + if ( is_plugin_active( 'qsm-save-resume/qsm-save-resume.php' ) != 1 && $qmn_quiz_options->enable_retake_quiz_button == 1 ) { + $result_display .= ''. __('Retake Quiz','quiz-master-next') .''; } // If the store responses in database option is set to Yes. if (0 != $qmn_quiz_options->store_responses) { @@ -1227,10 +1237,7 @@ public function display_social($qmn_quiz_options, $qmn_array_for_variables) { } $qmn_social_media_text["twitter"] = apply_filters('mlw_qmn_template_variable_results_page', $qmn_social_media_text["twitter"], $qmn_array_for_variables); $qmn_social_media_text["facebook"] = apply_filters('mlw_qmn_template_variable_results_page', $qmn_social_media_text["facebook"], $qmn_array_for_variables); - $social_display .= "
- quiz_name) . "', '$facebook_app_id');\">Facebook - quiz_name) . "');\">Twitter -
"; + $social_display .= "
quiz_name) . "', '$facebook_app_id');\">Facebookquiz_name) . "');\">Twitter
"; } return apply_filters('qmn_returned_social_buttons', $social_display, $qmn_quiz_options, $qmn_array_for_variables); } diff --git a/php/classes/class-qsm-install.php b/php/classes/class-qsm-install.php index 497f6f043..535abd688 100644 --- a/php/classes/class-qsm-install.php +++ b/php/classes/class-qsm-install.php @@ -531,7 +531,27 @@ public function register_default_settings() { 'default' => 0 ); $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' ); - + + //Setting for retake quiz + // Settings for quick result + $field_array = array( + 'id' => 'enable_retake_quiz_button', + 'label' => __('Show RETAKE QUIZ button on result page', 'quiz-master-next'), + 'type' => 'radio', + 'options' => array( + array( + 'label' => __('No', 'quiz-master-next'), + 'value' => 0 + ), + array( + 'label' => __('Yes', 'quiz-master-next'), + 'value' => 1 + ) + ), + 'default' => 0 + ); + $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' ); + // Registers message_before setting $field_array = array( 'id' => 'message_before', diff --git a/php/template-variables.php b/php/template-variables.php index 975a2df94..13203bf3f 100644 --- a/php/template-variables.php +++ b/php/template-variables.php @@ -295,7 +295,7 @@ function mlw_qmn_variable_question_answers( $content, $mlw_quiz_array ) { foreach ( $questions as $question ) { $qmn_questions[ $question['question_id'] ] = $question['question_answer_info']; } - + // Cycles through each answer in the responses. foreach ( $mlw_quiz_array['question_answers_array'] as $answer ) { if ( $answer["correct"] === "correct" ){ @@ -306,7 +306,7 @@ function mlw_qmn_variable_question_answers( $content, $mlw_quiz_array ) { $question_answer_class = "qmn_question_answer_incorrect"; } $mlw_question_answer_display = htmlspecialchars_decode($qmn_question_answer_template, ENT_QUOTES); - $mlw_question_answer_display = str_replace( "%QUESTION%" , htmlspecialchars_decode($answer[0], ENT_QUOTES), $mlw_question_answer_display); + $mlw_question_answer_display = str_replace( "%QUESTION%" , '' . htmlspecialchars_decode($answer[0], ENT_QUOTES) . '', $mlw_question_answer_display); $mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "".htmlspecialchars_decode($answer[1], ENT_QUOTES).'', $mlw_question_answer_display); $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER%" , htmlspecialchars_decode($answer[2], ENT_QUOTES), $mlw_question_answer_display); $mlw_question_answer_display = str_replace( "%USER_COMMENTS%" , $answer[3], $mlw_question_answer_display); diff --git a/templates/qmn_primary.css b/templates/qmn_primary.css index d2f74525a..ad8cee3ac 100644 --- a/templates/qmn_primary.css +++ b/templates/qmn_primary.css @@ -145,6 +145,10 @@ label.inline .mlw_qmn_question, margin: 5px 0 5px 0; } +.qmn_radio_answers .qmn_mc_answer_wrap { + cursor: pointer; +} + .quiz_section .qmn_radio_answers label, .quiz_section .qmn_check_answers label, .quiz_section .qmn_accept_answers label { @@ -443,4 +447,12 @@ border: 1px solid #e3e3e3; padding: 5px 10px; margin: 0; border-radius: 5px; +} + +.mlw_qmn_quiz_link{ + cursor: pointer; +} + +.qsm-results-page .qmn_question_answer{ + margin-bottom: 30px; } \ No newline at end of file