Skip to content

Commit

Permalink
Merge pull request #775 from QuizandSurveyMaster/dev-633
Browse files Browse the repository at this point in the history
v6.3.3 Merge with Master
  • Loading branch information
vikasprogrammer authored Oct 4, 2019
2 parents 7b8756e + 92a26e6 commit 1523d01
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 13 deletions.
12 changes: 12 additions & 0 deletions js/qsm-quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
23 changes: 20 additions & 3 deletions php/admin/admin-results-details-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,23 @@ function qsm_generate_result_details() {
}
?>
</h2>
<div>
<?php
<style type="text/css">
.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;
}
</style>
<div class="result-tab-content">
<?php
foreach( $tab_array as $tab ) {
if ( $active_tab == $tab['slug'] ) {
call_user_func( $tab['function'] );
Expand Down Expand Up @@ -65,16 +80,18 @@ function qsm_generate_results_details_tab() {
$next_results = $wpdb->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 '<div style="text-align:right; margin-top: 10px;">';
if ( ! is_null( $previous_results ) && $previous_results ) {
echo "<a class='button' href=\"?page=qsm_quiz_result_details&&result_id=" . intval( $previous_results ) . "\" >View Previous Results</a> ";
}
if ( ! is_null( $next_results ) && $next_results ) {
echo " <a class='button' href=\"?page=qsm_quiz_result_details&&result_id=" . intval( $next_results ) . "\" >View Next Results</a>";
}
echo '</div>';

// 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 = "<h2>Quiz Results for %QUIZ_NAME%</h2>
Expand Down
21 changes: 14 additions & 7 deletions php/classes/class-qmn-quiz-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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 .= '<a style="float: right;" class="button btn-reload-quiz" data-quiz_id="'. $qmn_array_for_variables['quiz_id'] .'" href="#" >Retake Quiz</a>';
if ( is_plugin_active( 'qsm-save-resume/qsm-save-resume.php' ) != 1 && $qmn_quiz_options->enable_retake_quiz_button == 1 ) {
$result_display .= '<a style="float: right;" class="button btn-reload-quiz" data-quiz_id="'. $qmn_array_for_variables['quiz_id'] .'" href="#" >'. __('Retake Quiz','quiz-master-next') .'</a>';
}
// If the store responses in database option is set to Yes.
if (0 != $qmn_quiz_options->store_responses) {
Expand Down Expand Up @@ -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 .= "<br />
<a class=\"mlw_qmn_quiz_link\" onclick=\"qmnSocialShare('facebook', '" . esc_js($qmn_social_media_text["facebook"]) . "', '" . esc_js($qmn_quiz_options->quiz_name) . "', '$facebook_app_id');\">Facebook</a>
<a class=\"mlw_qmn_quiz_link\" onclick=\"qmnSocialShare('twitter', '" . esc_js($qmn_social_media_text["twitter"]) . "', '" . esc_js($qmn_quiz_options->quiz_name) . "');\">Twitter</a>
<br />";
$social_display .= "<br /><a class=\"mlw_qmn_quiz_link\" onclick=\"qmnSocialShare('facebook', '" . esc_js($qmn_social_media_text["facebook"]) . "', '" . esc_js($qmn_quiz_options->quiz_name) . "', '$facebook_app_id');\">Facebook</a><a class=\"mlw_qmn_quiz_link\" onclick=\"qmnSocialShare('twitter', '" . esc_js($qmn_social_media_text["twitter"]) . "', '" . esc_js($qmn_quiz_options->quiz_name) . "');\">Twitter</a><br />";
}
return apply_filters('qmn_returned_social_buttons', $social_display, $qmn_quiz_options, $qmn_array_for_variables);
}
Expand Down
22 changes: 21 additions & 1 deletion php/classes/class-qsm-install.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions php/template-variables.php
Original file line number Diff line number Diff line change
Expand Up @@ -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" ){
Expand All @@ -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%" , '<b>' . htmlspecialchars_decode($answer[0], ENT_QUOTES) . '</b>', $mlw_question_answer_display);
$mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'>".htmlspecialchars_decode($answer[1], ENT_QUOTES).'</span>', $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);
Expand Down
12 changes: 12 additions & 0 deletions templates/qmn_primary.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}

0 comments on commit 1523d01

Please sign in to comment.