Quiz And Survey Master (Formerly Quiz Master Next) - Version 1.5.1

Version Description

This update allows you to have the quiz only load a set number of questions from your total question bank. Also fixes several minor bugs.

Download this release

Release Info

Developer fpcorso
Plugin Icon 128x128 Quiz And Survey Master (Formerly Quiz Master Next)
Version 1.5.1
Comparing to
See all releases

Code changes from version 1.4.2 to 1.5.1

includes/mlw_dashboard.php CHANGED
@@ -64,8 +64,6 @@ function mlw_generate_quiz_dashboard(){
64
  wp_enqueue_script( 'jquery-effects-blind' );
65
  wp_enqueue_script( 'jquery-effects-explode' );
66
  ?>
67
- <!--<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
68
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>-->
69
  <script type="text/javascript" src="<?php echo plugin_dir_url( $file ); ?>quiz-master-next/includes/jquery_sparkline.js"></script>
70
  <script type="text/javascript">
71
  var $j = jQuery.noConflict();
@@ -133,7 +131,7 @@ function mlw_generate_quiz_dashboard(){
133
  <h2>Quiz Master Next <?php _e("Dashboard", "mlw_qmn_text_domain"); ?><a id="opener" href="">(?)</a></h2>
134
 
135
  <h3>Version <?php echo $mlw_quiz_version; ?></h3>
136
- <p><?php _e("Thank you for trying out this plugin. I hope you find it beneficial to your website. If it is, please consider donating Or, please consider rating this plugin ", "mlw_qmn_text_domain"); ?><a href="http://wordpress.org/support/view/plugin-reviews/quiz-master-next"><?php _e("here", "mlw_qmn_text_domain"); ?></a>.</p>
137
 
138
  <div style="float:left; width:60%;" class="inner-sidebar1">
139
  <?php do_meta_boxes('quiz_wpss','advanced',''); ?>
@@ -418,19 +416,16 @@ function mlw_dashboard_box_six()
418
  <div>
419
  <table width='100%'>
420
  <tr>
421
- <td align='left'>1.4.2 (February 22, 2014)</td>
422
  </tr>
423
  <tr>
424
- <td align='left'>* Fixed Capability Bug</td>
425
  </tr>
426
  <tr>
427
- <td align='left'>* Minor Design Changes To Question Form</td>
428
  </tr>
429
  <tr>
430
- <td align='left'>* Hint Bubble Is Now Wider For Longer Hints</td>
431
- </tr>
432
- <tr>
433
- <td align='left'>* Minor Design Change To Quiz</td>
434
  </tr>
435
  </table>
436
  </div>
64
  wp_enqueue_script( 'jquery-effects-blind' );
65
  wp_enqueue_script( 'jquery-effects-explode' );
66
  ?>
 
 
67
  <script type="text/javascript" src="<?php echo plugin_dir_url( $file ); ?>quiz-master-next/includes/jquery_sparkline.js"></script>
68
  <script type="text/javascript">
69
  var $j = jQuery.noConflict();
131
  <h2>Quiz Master Next <?php _e("Dashboard", "mlw_qmn_text_domain"); ?><a id="opener" href="">(?)</a></h2>
132
 
133
  <h3>Version <?php echo $mlw_quiz_version; ?></h3>
134
+ <p><?php _e("Thank you for trying out this plugin. I hope you find it beneficial to your website. If it is, please consider donating or please consider rating this plugin ", "mlw_qmn_text_domain"); ?><a href="http://wordpress.org/support/view/plugin-reviews/quiz-master-next"><?php _e("here", "mlw_qmn_text_domain"); ?></a>.</p>
135
 
136
  <div style="float:left; width:60%;" class="inner-sidebar1">
137
  <?php do_meta_boxes('quiz_wpss','advanced',''); ?>
416
  <div>
417
  <table width='100%'>
418
  <tr>
419
+ <td align='left'>1.5.1 (February 26, 2014)</td>
420
  </tr>
421
  <tr>
422
+ <td align='left'>* Added Ability To Load Only Set Amount Of Questions From Total Questions</td>
423
  </tr>
424
  <tr>
425
+ <td align='left'>* Fixed PHP Notices Throughout Plugin</td>
426
  </tr>
427
  <tr>
428
+ <td align='left'>* Fixed Hidden Pop-Up Bug</td>
 
 
 
429
  </tr>
430
  </table>
431
  </div>
includes/mlw_help.php CHANGED
@@ -10,7 +10,7 @@ function mlw_generate_help_page()
10
  {
11
  ?>
12
  <!-- css -->
13
- <link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css" rel="stylesheet" />
14
  <!-- jquery scripts -->
15
  <?php
16
  wp_enqueue_script( 'jquery' );
10
  {
11
  ?>
12
  <!-- css -->
13
+ <link type="text/css" href="<?php echo plugin_dir_path( __FILE__ ); ?>/includes/css/redmond/jquery-ui-1.10.4.custom.css" rel="stylesheet" />
14
  <!-- jquery scripts -->
15
  <?php
16
  wp_enqueue_script( 'jquery' );
includes/mlw_quiz.php CHANGED
@@ -38,16 +38,23 @@ function mlw_quiz_shortcode($atts)
38
  {
39
  $sql .= "ORDER BY rand()";
40
  }
 
 
 
 
41
  $mlw_questions = $wpdb->get_results($sql);
42
 
43
 
44
  //Variables to load if quiz has been taken
45
- $mlw_success = $_POST["complete_quiz"];
46
- $mlw_user_name = $_POST["mlwUserName"];
47
- $mlw_user_comp = $_POST["mlwUserComp"];
48
- $mlw_user_email = $_POST["mlwUserEmail"];
49
- $mlw_user_phone = $_POST["mlwUserPhone"];
50
- $mlw_spam_email = $_POST["email"];
 
 
 
51
 
52
  function mlwDisplayContactInfo($mlw_quiz_options)
53
  {
@@ -178,7 +185,7 @@ function mlw_quiz_shortcode($atts)
178
  }
179
 
180
  //Display Quiz
181
- if ($mlw_success != "confirmation" AND $mlw_quiz_options->quiz_name != "")
182
  {
183
  //Update the quiz views
184
  $mlw_views = $mlw_quiz_options->quiz_views;
@@ -263,7 +270,7 @@ function mlw_quiz_shortcode($atts)
263
  $mlw_message_before = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_before);
264
  $mlw_display .= "<span>".$mlw_message_before."</span><br />";
265
  $mlw_display .= "<span name='mlw_error_message' id='mlw_error_message' style='color: red;'></span><br />";
266
- $mlw_display .= "<form name='quizForm' action='" . $PHP_SELF . "' method='post' onsubmit='return mlw_validateForm()' >";
267
 
268
  if ($mlw_quiz_options->contact_info_location == 0)
269
  {
@@ -469,11 +476,20 @@ function mlw_quiz_shortcode($atts)
469
  if ($mlw_question->correct_answer == 5) {$mlw_correct_text = $mlw_question->answer_five;}
470
  if ($mlw_question->correct_answer == 6) {$mlw_correct_text = $mlw_question->answer_six;}
471
 
 
 
 
 
 
 
 
 
 
472
  $mlw_question_answer_display = $mlw_quiz_options->question_answer_template;
473
  $mlw_question_answer_display = str_replace( "%QUESTION%" , htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES), $mlw_question_answer_display);
474
  $mlw_question_answer_display = str_replace( "%USER_ANSWER%" , $mlw_user_text, $mlw_question_answer_display);
475
  $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER%" , $mlw_correct_text, $mlw_question_answer_display);
476
- $mlw_question_answer_display = str_replace( "%USER_COMMENTS%" , $_POST["mlwComment".$mlw_question->question_id], $mlw_question_answer_display);
477
  $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER_INFO%" , $mlw_question->question_answer_info, $mlw_question_answer_display);
478
 
479
  $mlw_question_answers .= $mlw_question_answer_display;
@@ -481,6 +497,16 @@ function mlw_quiz_shortcode($atts)
481
  }
482
  $mlw_total_score = round((($mlw_correct/$mlw_total_questions)*100), 2);
483
 
 
 
 
 
 
 
 
 
 
 
484
  //Prepare the after quiz message
485
  $mlw_message_after = $mlw_quiz_options->message_after;
486
  $mlw_message_after = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message_after);
@@ -494,7 +520,7 @@ function mlw_quiz_shortcode($atts)
494
  $mlw_message_after = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message_after);
495
  $mlw_message_after = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_after);
496
  $mlw_message_after = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message_after);
497
- $mlw_message_after = str_replace( "%COMMENT_SECTION%" , $_POST["mlwQuizComments"], $mlw_message_after);
498
  $mlw_message_after = str_replace( "\n" , "<br>", $mlw_message_after);
499
  $mlw_display .= $mlw_message_after;
500
 
@@ -516,7 +542,7 @@ function mlw_quiz_shortcode($atts)
516
  $mlw_message = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message);
517
  $mlw_message = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message);
518
  $mlw_message = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message);
519
- $mlw_message = str_replace( "%COMMENT_SECTION%" , $_POST["mlwQuizComments"], $mlw_message);
520
  $mlw_message = str_replace( "<br />" , "\n", $mlw_message);
521
  $mlw_headers = 'From: '.$mlw_quiz_options->email_from_text.' <'.$mlw_quiz_options->admin_email.'>' . "\r\n";
522
  wp_mail($mlw_user_email, "Quiz Results For ".$mlw_quiz_options->quiz_name, $mlw_message, $mlw_headers);
@@ -539,7 +565,7 @@ function mlw_quiz_shortcode($atts)
539
  $mlw_message = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message);
540
  $mlw_message = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message);
541
  $mlw_message = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message);
542
- $mlw_message = str_replace( "%COMMENT_SECTION%" , $_POST["mlwQuizComments"], $mlw_message);
543
  $mlw_message .= " This email was generated by the Quiz Master Next script by Frank Corso";
544
  $mlw_message = str_replace( "<br />" , "\n", $mlw_message);
545
  $mlw_headers = 'From: '.$mlw_quiz_options->email_from_text.' <'.$mlw_quiz_options->admin_email.'>' . "\r\n";
@@ -547,7 +573,7 @@ function mlw_quiz_shortcode($atts)
547
  }
548
 
549
  //Save the results into database
550
- $mlw_quiz_results = $mlw_question_answers."\n".$_POST["mlwQuizComments"];
551
  $mlw_quiz_results = str_replace( "\n" , "<br>", $mlw_quiz_results);
552
  $mlw_quiz_results = htmlspecialchars($mlw_quiz_results, ENT_QUOTES);
553
  global $wpdb;
38
  {
39
  $sql .= "ORDER BY rand()";
40
  }
41
+ if ($mlw_quiz_options->question_from_total != 0)
42
+ {
43
+ $sql .= " LIMIT ".$mlw_quiz_options->question_from_total;
44
+ }
45
  $mlw_questions = $wpdb->get_results($sql);
46
 
47
 
48
  //Variables to load if quiz has been taken
49
+ if (isset($_POST["complete_quiz"]) && $_POST["complete_quiz"] == "confirmation")
50
+ {
51
+ $mlw_success = $_POST["complete_quiz"];
52
+ $mlw_user_name = $_POST["mlwUserName"];
53
+ $mlw_user_comp = $_POST["mlwUserComp"];
54
+ $mlw_user_email = $_POST["mlwUserEmail"];
55
+ $mlw_user_phone = $_POST["mlwUserPhone"];
56
+ $mlw_spam_email = $_POST["email"];
57
+ }
58
 
59
  function mlwDisplayContactInfo($mlw_quiz_options)
60
  {
185
  }
186
 
187
  //Display Quiz
188
+ if (!isset($_POST["complete_quiz"]) && $mlw_quiz_options->quiz_name != "")
189
  {
190
  //Update the quiz views
191
  $mlw_views = $mlw_quiz_options->quiz_views;
270
  $mlw_message_before = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_before);
271
  $mlw_display .= "<span>".$mlw_message_before."</span><br />";
272
  $mlw_display .= "<span name='mlw_error_message' id='mlw_error_message' style='color: red;'></span><br />";
273
+ $mlw_display .= "<form name='quizForm' action='' method='post' onsubmit='return mlw_validateForm()' >";
274
 
275
  if ($mlw_quiz_options->contact_info_location == 0)
276
  {
476
  if ($mlw_question->correct_answer == 5) {$mlw_correct_text = $mlw_question->answer_five;}
477
  if ($mlw_question->correct_answer == 6) {$mlw_correct_text = $mlw_question->answer_six;}
478
 
479
+ if (isset($_POST["mlwComment".$mlw_question->question_id]))
480
+ {
481
+ $mlw_qm_question_comment = $_POST["mlwComment".$mlw_question->question_id];
482
+ }
483
+ else
484
+ {
485
+ $mlw_qm_question_comment = "";
486
+ }
487
+
488
  $mlw_question_answer_display = $mlw_quiz_options->question_answer_template;
489
  $mlw_question_answer_display = str_replace( "%QUESTION%" , htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES), $mlw_question_answer_display);
490
  $mlw_question_answer_display = str_replace( "%USER_ANSWER%" , $mlw_user_text, $mlw_question_answer_display);
491
  $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER%" , $mlw_correct_text, $mlw_question_answer_display);
492
+ $mlw_question_answer_display = str_replace( "%USER_COMMENTS%" , $mlw_qm_question_comment, $mlw_question_answer_display);
493
  $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER_INFO%" , $mlw_question->question_answer_info, $mlw_question_answer_display);
494
 
495
  $mlw_question_answers .= $mlw_question_answer_display;
497
  }
498
  $mlw_total_score = round((($mlw_correct/$mlw_total_questions)*100), 2);
499
 
500
+ //Prepare comment section if set
501
+ if (isset($_POST["mlwQuizComments"]))
502
+ {
503
+ $mlw_qm_quiz_comments = $_POST["mlwQuizComments"];
504
+ }
505
+ else
506
+ {
507
+ $mlw_qm_quiz_comments = "";
508
+ }
509
+
510
  //Prepare the after quiz message
511
  $mlw_message_after = $mlw_quiz_options->message_after;
512
  $mlw_message_after = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message_after);
520
  $mlw_message_after = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message_after);
521
  $mlw_message_after = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_after);
522
  $mlw_message_after = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message_after);
523
+ $mlw_message_after = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message_after);
524
  $mlw_message_after = str_replace( "\n" , "<br>", $mlw_message_after);
525
  $mlw_display .= $mlw_message_after;
526
 
542
  $mlw_message = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message);
543
  $mlw_message = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message);
544
  $mlw_message = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message);
545
+ $mlw_message = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message);
546
  $mlw_message = str_replace( "<br />" , "\n", $mlw_message);
547
  $mlw_headers = 'From: '.$mlw_quiz_options->email_from_text.' <'.$mlw_quiz_options->admin_email.'>' . "\r\n";
548
  wp_mail($mlw_user_email, "Quiz Results For ".$mlw_quiz_options->quiz_name, $mlw_message, $mlw_headers);
565
  $mlw_message = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message);
566
  $mlw_message = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message);
567
  $mlw_message = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message);
568
+ $mlw_message = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message);
569
  $mlw_message .= " This email was generated by the Quiz Master Next script by Frank Corso";
570
  $mlw_message = str_replace( "<br />" , "\n", $mlw_message);
571
  $mlw_headers = 'From: '.$mlw_quiz_options->email_from_text.' <'.$mlw_quiz_options->admin_email.'>' . "\r\n";
573
  }
574
 
575
  //Save the results into database
576
+ $mlw_quiz_results = $mlw_question_answers."\n".$mlw_qm_quiz_comments;
577
  $mlw_quiz_results = str_replace( "\n" , "<br>", $mlw_quiz_results);
578
  $mlw_quiz_results = htmlspecialchars($mlw_quiz_results, ENT_QUOTES);
579
  global $wpdb;
includes/mlw_quiz_admin.php CHANGED
@@ -10,8 +10,6 @@ function mlw_generate_quiz_admin()
10
  {
11
  global $wpdb;
12
  $table_name = $wpdb->prefix . "mlw_quizzes";
13
- $success = $_POST["create_quiz"];
14
- $quiz_name = $_POST["quiz_name"];
15
  $hasCreatedQuiz = false;
16
  $hasDeletedQuiz = false;
17
  $hasUpdatedQuizName = false;
@@ -20,8 +18,9 @@ function mlw_generate_quiz_admin()
20
  $mlw_qmn_error_code = '0';
21
 
22
  //Create new quiz
23
- if ($success == "confirmation")
24
  {
 
25
  //Insert New Quiz Into Table
26
  $mlw_leaderboard_default = "<h3>Leaderboard for %QUIZ_NAME%</h3>
27
  1. %FIRST_PLACE_NAME%-%FIRST_PLACE_SCORE%<br />
@@ -31,8 +30,8 @@ function mlw_generate_quiz_admin()
31
  5. %FIFTH_PLACE_NAME%-%FIFTH_PLACE_SCORE%<br />";
32
  $mlw_question_answer_default = "%QUESTION%<br /> Answer Provided: %USER_ANSWER%<br /> Correct Answer: %CORRECT_ANSWER%<br /> Comments Entered: %USER_COMMENTS%<br />";
33
  $insert = "INSERT INTO " . $table_name .
34
- "(quiz_id, quiz_name, message_before, message_after, message_comment, user_email_template, admin_email_template, submit_button_text, name_field_text, business_field_text, email_field_text, phone_field_text, comment_field_text, email_from_text, question_answer_template, leaderboard_template, system, randomness_order, loggedin_user_contact, show_score, send_user_email, send_admin_email, contact_info_location, user_name, user_comp, user_email, user_phone, admin_email, comment_section, quiz_views, quiz_taken, deleted) " .
35
- "VALUES (NULL , '" . $quiz_name . "' , 'Enter your text here', 'Enter your text here', 'Enter your text here', 'Enter your text here', 'Enter your text here', 'Submit Quiz', 'Name', 'Business', 'Email', 'Phone Number', 'Comments', 'Wordpress', '".$mlw_question_answer_default."', '".$mlw_leaderboard_default."', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '".get_option( 'admin_email', 'Enter email' )."', 0, 0, 0, 0)";
36
  $results = $wpdb->query( $insert );
37
  if ($results != false)
38
  {
@@ -54,14 +53,13 @@ function mlw_generate_quiz_admin()
54
 
55
  }
56
 
57
- //Variables from delete question form
58
- $delete_quiz_success = $_POST["delete_quiz"];
59
- $mlw_quiz_id = $_POST["quiz_id"];
60
- $quiz_name = $_POST["delete_quiz_name"];
61
-
62
  //Delete quiz
63
- if ($delete_quiz_success == "confirmation")
64
  {
 
 
 
 
65
  $quiz_id = $_POST["quiz_id"];
66
  $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET deleted=1 WHERE quiz_id=".$mlw_quiz_id;
67
  $results = $wpdb->query( $update );
@@ -122,7 +120,7 @@ function mlw_generate_quiz_admin()
122
  $mlw_duplicate_quiz_id = $_POST["duplicate_quiz_id"];
123
  $mlw_duplicate_quiz_name = $_POST["duplicate_new_quiz_name"];
124
  $mlw_qmn_duplicate_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "mlw_quizzes WHERE quiz_id=%d", $mlw_duplicate_quiz_id ) );
125
- $results = $wpdb->query( "INSERT INTO ".$table_name." (quiz_id, quiz_name, message_before, message_after, message_comment, user_email_template, admin_email_template, submit_button_text, name_field_text, business_field_text, email_field_text, phone_field_text, comment_field_text, email_from_text, question_answer_template, leaderboard_template, system, randomness_order, loggedin_user_contact, show_score, send_user_email, send_admin_email, contact_info_location, user_name, user_comp, user_email, user_phone, admin_email, comment_section, quiz_views, quiz_taken, deleted) VALUES (NULL , '".$mlw_duplicate_quiz_name."' , '".$mlw_qmn_duplicate_data->message_before."', '".$mlw_qmn_duplicate_data->message_after."', '".$mlw_qmn_duplicate_data->message_comment."', '".$mlw_qmn_duplicate_data->user_email_template."', '".$mlw_qmn_duplicate_data->admin_email_template."', '".$mlw_qmn_duplicate_data->submit_button_text."', '".$mlw_qmn_duplicate_data->name_field_text."', '".$mlw_qmn_duplicate_data->business_field_text."', '".$mlw_qmn_duplicate_data->email_field_text."', '".$mlw_qmn_duplicate_data->phone_field_text."', '".$mlw_qmn_duplicate_data->comment_field_text."', '".$mlw_qmn_duplicate_data->email_from_text."', '".$mlw_qmn_duplicate_data->question_answer_template."', '".$mlw_qmn_duplicate_data->leaderboard_template."', ".$mlw_qmn_duplicate_data->system.", ".$mlw_qmn_duplicate_data->randomness_order.", ".$mlw_qmn_duplicate_data->loggedin_user_contact.", ".$mlw_qmn_duplicate_data->show_score.", ".$mlw_qmn_duplicate_data->send_user_email.", ".$mlw_qmn_duplicate_data->send_admin_email.", ".$mlw_qmn_duplicate_data->contact_info_location.", ".$mlw_qmn_duplicate_data->user_name.", ".$mlw_qmn_duplicate_data->user_comp.", ".$mlw_qmn_duplicate_data->user_email.", ".$mlw_qmn_duplicate_data->user_phone.", '".get_option( 'admin_email', 'Enter email' )."', ".$mlw_qmn_duplicate_data->comment_section.", 0, 0, 0)" );
126
  if ($results != false)
127
  {
128
  $hasDuplicatedQuiz = true;
@@ -346,6 +344,7 @@ function mlw_generate_quiz_admin()
346
  <?php
347
  $quotes_list = "";
348
  $display = "";
 
349
  foreach($mlw_quiz_data as $mlw_quiz_info) {
350
  if($alternate) $alternate = "";
351
  else $alternate = " class=\"alternate\"";
@@ -405,7 +404,7 @@ function mlw_generate_quiz_admin()
405
  <td></td>
406
  </tr>
407
  <?php
408
- echo "<form action='" . $PHP_SELF . "' method='post'>";
409
  echo "<input type='hidden' name='create_quiz' value='confirmation' />";
410
  ?>
411
 
@@ -432,9 +431,7 @@ function mlw_generate_quiz_admin()
432
  </div>
433
  <div id="edit_dialog" title="Edit Quiz Name" style="display:none;">
434
  <h3>Quiz Name:</h3><br />
435
- <?php
436
- echo "<form action='" . $PHP_SELF . "' method='post'>";
437
- ?>
438
  <input type="text" id="edit_quiz_name" name="edit_quiz_name" />
439
  <input type="hidden" id="edit_quiz_id" name="edit_quiz_id" />
440
  <input type='hidden' name='quiz_name_editted' value='confirmation' />
@@ -444,9 +441,7 @@ function mlw_generate_quiz_admin()
444
  <div id="duplicate_dialog" title="Duplicate Quiz" style="display:none;">
445
  <h3>This will create a new quiz with the same settings as <span id="duplicate_quiz_name"></span>. </h3><br />
446
  <p>This does not currently duplicate the questions, only the options, templates, settings, etc...</p>
447
- <?php
448
- echo "<form action='" . $PHP_SELF . "' method='post'>";
449
- ?>
450
  Name Of New Quiz:
451
  <input type="text" id="duplicate_new_quiz_name" name="duplicate_new_quiz_name" />
452
  <input type="hidden" id="duplicate_quiz_id" name="duplicate_quiz_id" />
@@ -457,7 +452,7 @@ function mlw_generate_quiz_admin()
457
  <div id="delete_dialog" title="Delete Quiz?" style="display:none;">
458
  <h3><b>Are you sure you want to delete Quiz <span id="delete_quiz_id"></span>?</b></h3>
459
  <?php
460
- echo "<form action='" . $PHP_SELF . "' method='post'>";
461
  echo "<input type='hidden' name='delete_quiz' value='confirmation' />";
462
  echo "<input type='hidden' id='quiz_id' name='quiz_id' value='' />";
463
  echo "<input type='hidden' id='delete_quiz_name' name='delete_quiz_name' value='' />";
10
  {
11
  global $wpdb;
12
  $table_name = $wpdb->prefix . "mlw_quizzes";
 
 
13
  $hasCreatedQuiz = false;
14
  $hasDeletedQuiz = false;
15
  $hasUpdatedQuizName = false;
18
  $mlw_qmn_error_code = '0';
19
 
20
  //Create new quiz
21
+ if ( isset( $_POST["create_quiz"] ) && $_POST["create_quiz"] == "confirmation" )
22
  {
23
+ $quiz_name = $_POST["quiz_name"];
24
  //Insert New Quiz Into Table
25
  $mlw_leaderboard_default = "<h3>Leaderboard for %QUIZ_NAME%</h3>
26
  1. %FIRST_PLACE_NAME%-%FIRST_PLACE_SCORE%<br />
30
  5. %FIFTH_PLACE_NAME%-%FIFTH_PLACE_SCORE%<br />";
31
  $mlw_question_answer_default = "%QUESTION%<br /> Answer Provided: %USER_ANSWER%<br /> Correct Answer: %CORRECT_ANSWER%<br /> Comments Entered: %USER_COMMENTS%<br />";
32
  $insert = "INSERT INTO " . $table_name .
33
+ "(quiz_id, quiz_name, message_before, message_after, message_comment, user_email_template, admin_email_template, submit_button_text, name_field_text, business_field_text, email_field_text, phone_field_text, comment_field_text, email_from_text, question_answer_template, leaderboard_template, system, randomness_order, loggedin_user_contact, show_score, send_user_email, send_admin_email, contact_info_location, user_name, user_comp, user_email, user_phone, admin_email, comment_section, question_from_total, quiz_views, quiz_taken, deleted) " .
34
+ "VALUES (NULL , '" . $quiz_name . "' , 'Enter your text here', 'Enter your text here', 'Enter your text here', 'Enter your text here', 'Enter your text here', 'Submit Quiz', 'Name', 'Business', 'Email', 'Phone Number', 'Comments', 'Wordpress', '".$mlw_question_answer_default."', '".$mlw_leaderboard_default."', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '".get_option( 'admin_email', 'Enter email' )."', 0, 0, 0, 0, 0)";
35
  $results = $wpdb->query( $insert );
36
  if ($results != false)
37
  {
53
 
54
  }
55
 
 
 
 
 
 
56
  //Delete quiz
57
+ if (isset( $_POST["delete_quiz"] ) && $_POST["delete_quiz"] == "confirmation")
58
  {
59
+
60
+ //Variables from delete question form
61
+ $mlw_quiz_id = $_POST["quiz_id"];
62
+ $quiz_name = $_POST["delete_quiz_name"];
63
  $quiz_id = $_POST["quiz_id"];
64
  $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET deleted=1 WHERE quiz_id=".$mlw_quiz_id;
65
  $results = $wpdb->query( $update );
120
  $mlw_duplicate_quiz_id = $_POST["duplicate_quiz_id"];
121
  $mlw_duplicate_quiz_name = $_POST["duplicate_new_quiz_name"];
122
  $mlw_qmn_duplicate_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "mlw_quizzes WHERE quiz_id=%d", $mlw_duplicate_quiz_id ) );
123
+ $results = $wpdb->query( "INSERT INTO ".$table_name." (quiz_id, quiz_name, message_before, message_after, message_comment, user_email_template, admin_email_template, submit_button_text, name_field_text, business_field_text, email_field_text, phone_field_text, comment_field_text, email_from_text, question_answer_template, leaderboard_template, system, randomness_order, loggedin_user_contact, show_score, send_user_email, send_admin_email, contact_info_location, user_name, user_comp, user_email, user_phone, admin_email, comment_section, question_from_total, quiz_views, quiz_taken, deleted) VALUES (NULL , '".$mlw_duplicate_quiz_name."' , '".$mlw_qmn_duplicate_data->message_before."', '".$mlw_qmn_duplicate_data->message_after."', '".$mlw_qmn_duplicate_data->message_comment."', '".$mlw_qmn_duplicate_data->user_email_template."', '".$mlw_qmn_duplicate_data->admin_email_template."', '".$mlw_qmn_duplicate_data->submit_button_text."', '".$mlw_qmn_duplicate_data->name_field_text."', '".$mlw_qmn_duplicate_data->business_field_text."', '".$mlw_qmn_duplicate_data->email_field_text."', '".$mlw_qmn_duplicate_data->phone_field_text."', '".$mlw_qmn_duplicate_data->comment_field_text."', '".$mlw_qmn_duplicate_data->email_from_text."', '".$mlw_qmn_duplicate_data->question_answer_template."', '".$mlw_qmn_duplicate_data->leaderboard_template."', ".$mlw_qmn_duplicate_data->system.", ".$mlw_qmn_duplicate_data->randomness_order.", ".$mlw_qmn_duplicate_data->loggedin_user_contact.", ".$mlw_qmn_duplicate_data->show_score.", ".$mlw_qmn_duplicate_data->send_user_email.", ".$mlw_qmn_duplicate_data->send_admin_email.", ".$mlw_qmn_duplicate_data->contact_info_location.", ".$mlw_qmn_duplicate_data->user_name.", ".$mlw_qmn_duplicate_data->user_comp.", ".$mlw_qmn_duplicate_data->user_email.", ".$mlw_qmn_duplicate_data->user_phone.", '".get_option( 'admin_email', 'Enter email' )."', ".$mlw_qmn_duplicate_data->comment_section.", ".$mlw_qmn_duplicate_data->question_from_total.", 0, 0, 0)" );
124
  if ($results != false)
125
  {
126
  $hasDuplicatedQuiz = true;
344
  <?php
345
  $quotes_list = "";
346
  $display = "";
347
+ $alternate = "";
348
  foreach($mlw_quiz_data as $mlw_quiz_info) {
349
  if($alternate) $alternate = "";
350
  else $alternate = " class=\"alternate\"";
404
  <td></td>
405
  </tr>
406
  <?php
407
+ echo "<form action='' method='post'>";
408
  echo "<input type='hidden' name='create_quiz' value='confirmation' />";
409
  ?>
410
 
431
  </div>
432
  <div id="edit_dialog" title="Edit Quiz Name" style="display:none;">
433
  <h3>Quiz Name:</h3><br />
434
+ <form action='' method='post'>
 
 
435
  <input type="text" id="edit_quiz_name" name="edit_quiz_name" />
436
  <input type="hidden" id="edit_quiz_id" name="edit_quiz_id" />
437
  <input type='hidden' name='quiz_name_editted' value='confirmation' />
441
  <div id="duplicate_dialog" title="Duplicate Quiz" style="display:none;">
442
  <h3>This will create a new quiz with the same settings as <span id="duplicate_quiz_name"></span>. </h3><br />
443
  <p>This does not currently duplicate the questions, only the options, templates, settings, etc...</p>
444
+ <form action='' method='post'>
 
 
445
  Name Of New Quiz:
446
  <input type="text" id="duplicate_new_quiz_name" name="duplicate_new_quiz_name" />
447
  <input type="hidden" id="duplicate_quiz_id" name="duplicate_quiz_id" />
452
  <div id="delete_dialog" title="Delete Quiz?" style="display:none;">
453
  <h3><b>Are you sure you want to delete Quiz <span id="delete_quiz_id"></span>?</b></h3>
454
  <?php
455
+ echo "<form action='' method='post'>";
456
  echo "<input type='hidden' name='delete_quiz' value='confirmation' />";
457
  echo "<input type='hidden' id='quiz_id' name='quiz_id' value='' />";
458
  echo "<input type='hidden' id='delete_quiz_name' name='delete_quiz_name' value='' />";
includes/mlw_quiz_install.php CHANGED
@@ -71,6 +71,8 @@ function mlw_quiz_activate()
71
  admin_email TEXT NOT NULL,
72
 
73
  comment_section INT NOT NULL,
 
 
74
 
75
  quiz_views INT NOT NULL,
76
 
71
  admin_email TEXT NOT NULL,
72
 
73
  comment_section INT NOT NULL,
74
+
75
+ question_from_total INT NOT NULL,
76
 
77
  quiz_views INT NOT NULL,
78
 
includes/mlw_quiz_options.php CHANGED
@@ -12,6 +12,13 @@ function mlw_generate_quiz_options()
12
  global $wpdb;
13
  $table_name = $wpdb->prefix . "mlw_questions";
14
  $is_new_quiz = 0;
 
 
 
 
 
 
 
15
  $mlw_qmn_isQueryError = false;
16
  $mlw_qmn_error_code = '0000';
17
 
@@ -19,55 +26,32 @@ function mlw_generate_quiz_options()
19
  Code for quiz questions tab
20
  */
21
 
22
- //Variables from new question form
23
- $success = $_POST["create_question"];
24
- $question_name = trim(preg_replace('/\s+/',' ', nl2br(htmlspecialchars($_POST["question_name"], ENT_QUOTES))));
25
- $answer_one = htmlspecialchars($_POST["answer_one"], ENT_QUOTES);
26
- $answer_one_points = $_POST["answer_one_points"];
27
- $answer_two = htmlspecialchars($_POST["answer_two"], ENT_QUOTES);
28
- $answer_two_points = $_POST["answer_two_points"];
29
- $answer_three = htmlspecialchars($_POST["answer_three"], ENT_QUOTES);
30
- $answer_three_points = $_POST["answer_three_points"];
31
- $answer_four = htmlspecialchars($_POST["answer_four"], ENT_QUOTES);
32
- $answer_four_points = $_POST["answer_four_points"];
33
- $answer_five = htmlspecialchars($_POST["answer_five"], ENT_QUOTES);
34
- $answer_five_points = $_POST["answer_five_points"];
35
- $answer_six = htmlspecialchars($_POST["answer_six"], ENT_QUOTES);
36
- $answer_six_points = $_POST["answer_six_points"];
37
- $correct_answer = $_POST["correct_answer"];
38
- $question_answer_info = $_POST["correct_answer_info"];
39
- $question_type = $_POST["question_type"];
40
- $comments = htmlspecialchars($_POST["comments"], ENT_QUOTES);
41
- $hint = htmlspecialchars($_POST["hint"], ENT_QUOTES);
42
- $new_question_order = $_POST["new_question_order"];
43
-
44
- //Variables from edit question form
45
- $edit_question_success = $_POST["edit_question"];
46
- $edit_question_name = trim(preg_replace('/\s+/',' ', nl2br(htmlspecialchars($_POST["edit_question_name"], ENT_QUOTES))));
47
- $edit_answer_one = htmlspecialchars($_POST["edit_answer_one"], ENT_QUOTES);
48
- $edit_answer_one_points = $_POST["edit_answer_one_points"];
49
- $edit_answer_two = htmlspecialchars($_POST["edit_answer_two"], ENT_QUOTES);
50
- $edit_answer_two_points = $_POST["edit_answer_two_points"];
51
- $edit_answer_three = htmlspecialchars($_POST["edit_answer_three"], ENT_QUOTES);
52
- $edit_answer_three_points = $_POST["edit_answer_three_points"];
53
- $edit_answer_four = htmlspecialchars($_POST["edit_answer_four"], ENT_QUOTES);
54
- $edit_answer_four_points = $_POST["edit_answer_four_points"];
55
- $edit_answer_five = htmlspecialchars($_POST["edit_answer_five"], ENT_QUOTES);
56
- $edit_answer_five_points = $_POST["edit_answer_five_points"];
57
- $edit_answer_six = htmlspecialchars($_POST["edit_answer_six"], ENT_QUOTES);
58
- $edit_answer_six_points = $_POST["edit_answer_six_points"];
59
- $edit_correct_answer = $_POST["edit_correct_answer"];
60
- $edit_question_answer_info = $_POST["edit_correct_answer_info"];
61
- $mlw_edit_question_id = $_POST["edit_question_id"];
62
- $mlw_edit_question_type = $_POST["edit_question_type"];
63
- $edit_comments = htmlspecialchars($_POST["edit_comments"], ENT_QUOTES);
64
- $edit_hint = htmlspecialchars($_POST["edit_hint"], ENT_QUOTES);
65
- $edit_question_order = $_POST["edit_question_order"];
66
-
67
  //Edit question
68
- if ($edit_question_success == "confirmation")
69
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  $quiz_id = $_POST["quiz_id"];
 
71
  $update = "UPDATE " . $wpdb->prefix . "mlw_questions" . " SET question_name='".$edit_question_name."', answer_one='".$edit_answer_one."', answer_one_points='".$edit_answer_one_points."', answer_two='".$edit_answer_two."', answer_two_points='".$edit_answer_two_points."', answer_three='".$edit_answer_three."', answer_three_points='".$edit_answer_three_points."', answer_four='".$edit_answer_four."', answer_four_points='".$edit_answer_four_points."', answer_five='".$edit_answer_five."', answer_five_points='".$edit_answer_five_points."', answer_six='".$edit_answer_six."', answer_six_points='".$edit_answer_six_points."', correct_answer='".$edit_correct_answer."', question_answer_info='".$edit_question_answer_info."', comments='".$edit_comments."', hints='".$edit_hint."', question_order='".$edit_question_order."', question_type='".$mlw_edit_question_type."' WHERE question_id=".$mlw_edit_question_id;
72
  $results = $wpdb->query( $update );
73
  if ($results != false)
@@ -90,14 +74,13 @@ function mlw_generate_quiz_options()
90
  }
91
  }
92
 
93
- //Variables from delete question form
94
- $delete_question_success = $_POST["delete_question"];
95
- $mlw_question_id = $_POST["question_id"];
96
-
97
  //Delete question from quiz
98
- if ($delete_question_success == "confirmation")
99
  {
 
 
100
  $quiz_id = $_POST["quiz_id"];
 
101
  $update = "UPDATE " . $wpdb->prefix . "mlw_questions" . " SET deleted=1 WHERE question_id=".$mlw_question_id;
102
  $results = $wpdb->query( $update );
103
  if ($results != false)
@@ -121,8 +104,28 @@ function mlw_generate_quiz_options()
121
  }
122
 
123
  //Submit new question into database
124
- if ($success == "confirmation")
125
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  $quiz_id = $_POST["quiz_id"];
127
  $table_name = $wpdb->prefix . "mlw_questions";
128
  $insert = "INSERT INTO " . $table_name .
@@ -175,27 +178,26 @@ function mlw_generate_quiz_options()
175
  /*
176
  Code for Quiz Text tab
177
  */
178
-
179
- //Variables for save templates form
180
- $save_template_success = $_POST["save_templates"];
181
- $mlw_before_message = $_POST["mlw_quiz_before_message"];
182
- $mlw_after_message = $_POST["mlw_quiz_after_message"];
183
- $mlw_user_email_template = $_POST["mlw_quiz_user_email_template"];
184
- $mlw_admin_email_template = $_POST["mlw_quiz_admin_email_template"];
185
- $mlw_submit_button_text = $_POST["mlw_submitText"];
186
- $mlw_name_field_text = $_POST["mlw_nameText"];
187
- $mlw_business_field_text = $_POST["mlw_businessText"];
188
- $mlw_email_field_text = $_POST["mlw_emailText"];
189
- $mlw_phone_field_text = $_POST["mlw_phoneText"];
190
- $mlw_before_comments = $_POST["mlw_quiz_before_comments"];
191
- $mlw_comment_field_text = $_POST["mlw_commentText"];
192
- $mlw_email_from_text = $_POST["emailFromText"];
193
- $mlw_question_answer_template = $_POST["mlw_quiz_question_answer_template"];
194
 
195
  //Submit saved templates into database
196
- if ($save_template_success == "confirmation")
197
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  $quiz_id = $_POST["quiz_id"];
 
199
  $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET message_before='".$mlw_before_message."', message_comment='".$mlw_before_comments."', comment_field_text='".$mlw_comment_field_text."', email_from_text='".$mlw_email_from_text."', question_answer_template='".$mlw_question_answer_template."', submit_button_text='".$mlw_submit_button_text."', name_field_text='".$mlw_name_field_text."', business_field_text='".$mlw_business_field_text."', email_field_text='".$mlw_email_field_text."', phone_field_text='".$mlw_phone_field_text."', message_after='".$mlw_after_message."', user_email_template='".$mlw_user_email_template."', admin_email_template='".$mlw_admin_email_template."' WHERE quiz_id=".$quiz_id;
200
  $results = $wpdb->query( $update );
201
  if ($results != false)
@@ -223,26 +225,26 @@ function mlw_generate_quiz_options()
223
  Code for Quiz Options tab
224
  */
225
 
226
- //Variables for save options form
227
- $save_options_success = $_POST["save_options"];
228
- $mlw_system = $_POST["system"];
229
- $mlw_randomness_order = $_POST["randomness_order"];
230
- $mlw_send_user_email = $_POST["sendUserEmail"];
231
- $mlw_send_admin_email = $_POST["sendAdminEmail"];
232
- $mlw_contact_location = $_POST["contact_info_location"];
233
- $mlw_user_name = $_POST["userName"];
234
- $mlw_user_comp = $_POST["userComp"];
235
- $mlw_user_email = $_POST["userEmail"];
236
- $mlw_user_phone = $_POST["userPhone"];
237
- $mlw_admin_email = $_POST["adminEmail"];
238
- $mlw_comment_section = $_POST["commentSection"];
239
- $mlw_qmn_loggedin_contact = $_POST["loggedin_user_contact"];
240
-
241
  //Submit saved options into database
242
- if ($save_options_success == "confirmation")
243
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  $quiz_id = $_POST["quiz_id"];
245
- $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET system='".$mlw_system."', send_user_email='".$mlw_send_user_email."', send_admin_email='".$mlw_send_admin_email."', loggedin_user_contact='".$mlw_qmn_loggedin_contact."', contact_info_location=".$mlw_contact_location.", user_name='".$mlw_user_name."', user_comp='".$mlw_user_comp."', user_email='".$mlw_user_email."', user_phone='".$mlw_user_phone."', admin_email='".$mlw_admin_email."', comment_section='".$mlw_comment_section."', randomness_order='".$mlw_randomness_order."' WHERE quiz_id=".$quiz_id;
 
246
  $results = $wpdb->query( $update );
247
  if ($results != false)
248
  {
@@ -268,14 +270,12 @@ function mlw_generate_quiz_options()
268
  Code For Leaderboard Options tab
269
  */
270
 
271
- ///Variables for save leaderboard options form
272
- $mlw_leaderboard_template = $_POST["mlw_quiz_leaderboard_template"];
273
- $mlw_leaderboard_quiz_id = $_POST["leaderboard_quiz_id"];
274
- $mlw_leaderboard_saved = $_POST["save_leaderboard_options"];
275
-
276
  ///Submit saved leaderboard template into database
277
- if ($mlw_leaderboard_saved == "confirmation")
278
  {
 
 
 
279
  $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET leaderboard_template='".$mlw_leaderboard_template."' WHERE quiz_id=".$mlw_leaderboard_quiz_id;
280
  $results = $wpdb->query( $update );
281
  if ($results != false)
@@ -303,13 +303,11 @@ function mlw_generate_quiz_options()
303
  Code For Quiz Tools Tab
304
  */
305
 
306
- //Variables from reset stats form
307
- $mlw_reset_confirmation = $_POST["mlw_reset_quiz_stats"];
308
- $mlw_reset_stats_quiz_id = $_POST["mlw_reset_quiz_id"];
309
-
310
  //Update Quiz Table
311
- if ($mlw_reset_confirmation == "confirmation")
312
  {
 
 
313
  $mlw_reset_update_sql = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET quiz_views=0, quiz_taken=0 WHERE quiz_id=".$mlw_reset_stats_quiz_id;
314
  $mlw_reset_sql_results = $wpdb->query( $mlw_reset_update_sql );
315
  if ($mlw_reset_sql_results != false)
@@ -363,8 +361,6 @@ function mlw_generate_quiz_options()
363
  wp_enqueue_script( 'jquery-effects-blind' );
364
  wp_enqueue_script( 'jquery-effects-explode' );
365
  ?>
366
- <!--<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
367
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>-->
368
  <script type="text/javascript">
369
  var $j = jQuery.noConflict();
370
  // increase the default animation speed to exaggerate the effect
@@ -733,6 +729,7 @@ function mlw_generate_quiz_options()
733
  <?php
734
  $question_list = "";
735
  $display = "";
 
736
  foreach($mlw_question_data as $mlw_question_info) {
737
  if($alternate) $alternate = "";
738
  else $alternate = " class=\"alternate\"";
@@ -777,7 +774,7 @@ function mlw_generate_quiz_options()
777
  <div id="new_question_dialog" title="Create New Question" style="display:none;">
778
 
779
  <?php
780
- echo "<form action='" . $PHP_SELF . "' method='post'>";
781
  echo "<input type='hidden' name='create_question' value='confirmation' />";
782
  echo "<input type='hidden' name='quiz_id' value='".$quiz_id."' />";
783
  ?>
@@ -940,7 +937,7 @@ function mlw_generate_quiz_options()
940
 
941
  <div id="edit_question_dialog" title="Edit Question" style="display:none;">
942
  <?php
943
- echo "<form action='" . $PHP_SELF . "' method='post'>";
944
  echo "<input type='hidden' name='edit_question' value='confirmation' />";
945
  echo "<input type='hidden' id='edit_question_id' name='edit_question_id' value='' />";
946
  echo "<input type='hidden' name='quiz_id' value='".$quiz_id."' />";
@@ -1151,7 +1148,7 @@ function mlw_generate_quiz_options()
1151
  </table>
1152
  <button id="save_template_button" onclick="javascript: document.quiz_template_form.submit();">Save Templates</button><button id="template_tab_help">Help</button>
1153
  <?php
1154
- echo "<form action='" . $PHP_SELF . "' method='post' name='quiz_template_form'>";
1155
  echo "<input type='hidden' name='save_templates' value='confirmation' />";
1156
  echo "<input type='hidden' name='quiz_id' value='".$quiz_id."' />";
1157
  ?>
@@ -1308,7 +1305,7 @@ function mlw_generate_quiz_options()
1308
  <div id="tabs-3">
1309
  <button id="save_options_button" onclick="javascript: document.quiz_options_form.submit();">Save Options</button><button id="options_tab_help">Help</button>
1310
  <?php
1311
- echo "<form action='" . $PHP_SELF . "' method='post' name='quiz_options_form'>";
1312
  echo "<input type='hidden' name='save_options' value='confirmation' />";
1313
  echo "<input type='hidden' name='quiz_id' value='".$quiz_id."' />";
1314
  ?>
@@ -1321,6 +1318,12 @@ function mlw_generate_quiz_options()
1321
  <input type="radio" id="radio3" name="system" <?php if ($mlw_quiz_options->system == 2) {echo 'checked="checked"';} ?> value='2' /><label for="radio3">Not Graded</label>
1322
  </div></td>
1323
  </tr>
 
 
 
 
 
 
1324
  <tr valign="top">
1325
  <th scope="row"><label for="randomness_order">Are the questions random? (Question Order will not apply if this is yes)</label></th>
1326
  <td><div id="randomness_order">
@@ -1437,7 +1440,7 @@ function mlw_generate_quiz_options()
1437
  </table>
1438
  <button id="save_template_button" onclick="javascript: document.quiz_leaderboard_options_form.submit();">Save Leaderboard Options</button><button id="leaderboard_tab_help">Help</button>
1439
  <?php
1440
- echo "<form action='" . $PHP_SELF . "' method='post' name='quiz_leaderboard_options_form'>";
1441
  echo "<input type='hidden' name='save_leaderboard_options' value='confirmation' />";
1442
  echo "<input type='hidden' name='leaderboard_quiz_id' value='".$quiz_id."' />";
1443
  ?>
@@ -1472,7 +1475,7 @@ function mlw_generate_quiz_options()
1472
  <div id="mlw_reset_stats_dialog" title="Reset Stats For This Quiz" style="display:none;">
1473
  <p>Are you sure you want to reset the stats to 0? All views and taken stats for this quiz will be reset. This is permanent and cannot be undone.</p>
1474
  <?php
1475
- echo "<form action='" . $PHP_SELF . "' method='post'>";
1476
  echo "<input type='hidden' name='mlw_reset_quiz_stats' value='confirmation' />";
1477
  echo "<input type='hidden' name='mlw_reset_quiz_id' value='".$quiz_id."' />";
1478
  echo "<p class='submit'><input type='submit' class='button-primary' value='Reset All Stats For Quiz' /></p>";
@@ -1485,7 +1488,7 @@ function mlw_generate_quiz_options()
1485
  <div id="delete_dialog" title="Delete Question?" style="display:none;">
1486
  <h3><b>Are you sure you want to delete Question <span id="delete_question_id"></span>?</b></h3>
1487
  <?php
1488
- echo "<form action='" . $PHP_SELF . "' method='post'>";
1489
  echo "<input type='hidden' name='delete_question' value='confirmation' />";
1490
  echo "<input type='hidden' id='question_id' name='question_id' value='' />";
1491
  echo "<input type='hidden' name='quiz_id' value='".$quiz_id."' />";
12
  global $wpdb;
13
  $table_name = $wpdb->prefix . "mlw_questions";
14
  $is_new_quiz = 0;
15
+ $hasUpdatedLeaderboardOptions = false;
16
+ $hasCreatedQuestion = false;
17
+ $hasUpdatedOptions = false;
18
+ $hasUpdatedTemplates = false;
19
+ $hasDeletedQuestion = false;
20
+ $hasUpdatedQuestion = false;
21
+ $mlw_hasResetQuizStats = false;
22
  $mlw_qmn_isQueryError = false;
23
  $mlw_qmn_error_code = '0000';
24
 
26
  Code for quiz questions tab
27
  */
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  //Edit question
30
+ if ( isset($_POST["edit_question"]) && $_POST["edit_question"] == "confirmation")
31
  {
32
+ //Variables from edit question form
33
+ $edit_question_name = trim(preg_replace('/\s+/',' ', nl2br(htmlspecialchars($_POST["edit_question_name"], ENT_QUOTES))));
34
+ $edit_answer_one = htmlspecialchars($_POST["edit_answer_one"], ENT_QUOTES);
35
+ $edit_answer_one_points = $_POST["edit_answer_one_points"];
36
+ $edit_answer_two = htmlspecialchars($_POST["edit_answer_two"], ENT_QUOTES);
37
+ $edit_answer_two_points = $_POST["edit_answer_two_points"];
38
+ $edit_answer_three = htmlspecialchars($_POST["edit_answer_three"], ENT_QUOTES);
39
+ $edit_answer_three_points = $_POST["edit_answer_three_points"];
40
+ $edit_answer_four = htmlspecialchars($_POST["edit_answer_four"], ENT_QUOTES);
41
+ $edit_answer_four_points = $_POST["edit_answer_four_points"];
42
+ $edit_answer_five = htmlspecialchars($_POST["edit_answer_five"], ENT_QUOTES);
43
+ $edit_answer_five_points = $_POST["edit_answer_five_points"];
44
+ $edit_answer_six = htmlspecialchars($_POST["edit_answer_six"], ENT_QUOTES);
45
+ $edit_answer_six_points = $_POST["edit_answer_six_points"];
46
+ $edit_correct_answer = $_POST["edit_correct_answer"];
47
+ $edit_question_answer_info = $_POST["edit_correct_answer_info"];
48
+ $mlw_edit_question_id = $_POST["edit_question_id"];
49
+ $mlw_edit_question_type = $_POST["edit_question_type"];
50
+ $edit_comments = htmlspecialchars($_POST["edit_comments"], ENT_QUOTES);
51
+ $edit_hint = htmlspecialchars($_POST["edit_hint"], ENT_QUOTES);
52
+ $edit_question_order = $_POST["edit_question_order"];
53
  $quiz_id = $_POST["quiz_id"];
54
+
55
  $update = "UPDATE " . $wpdb->prefix . "mlw_questions" . " SET question_name='".$edit_question_name."', answer_one='".$edit_answer_one."', answer_one_points='".$edit_answer_one_points."', answer_two='".$edit_answer_two."', answer_two_points='".$edit_answer_two_points."', answer_three='".$edit_answer_three."', answer_three_points='".$edit_answer_three_points."', answer_four='".$edit_answer_four."', answer_four_points='".$edit_answer_four_points."', answer_five='".$edit_answer_five."', answer_five_points='".$edit_answer_five_points."', answer_six='".$edit_answer_six."', answer_six_points='".$edit_answer_six_points."', correct_answer='".$edit_correct_answer."', question_answer_info='".$edit_question_answer_info."', comments='".$edit_comments."', hints='".$edit_hint."', question_order='".$edit_question_order."', question_type='".$mlw_edit_question_type."' WHERE question_id=".$mlw_edit_question_id;
56
  $results = $wpdb->query( $update );
57
  if ($results != false)
74
  }
75
  }
76
 
 
 
 
 
77
  //Delete question from quiz
78
+ if ( isset($_POST["delete_question"]) && $_POST["delete_question"] == "confirmation")
79
  {
80
+ //Variables from delete question form
81
+ $mlw_question_id = $_POST["question_id"];
82
  $quiz_id = $_POST["quiz_id"];
83
+
84
  $update = "UPDATE " . $wpdb->prefix . "mlw_questions" . " SET deleted=1 WHERE question_id=".$mlw_question_id;
85
  $results = $wpdb->query( $update );
86
  if ($results != false)
104
  }
105
 
106
  //Submit new question into database
107
+ if ( isset($_POST["create_question"]) && $_POST["create_question"] == "confirmation")
108
  {
109
+ //Variables from new question form
110
+ $question_name = trim(preg_replace('/\s+/',' ', nl2br(htmlspecialchars($_POST["question_name"], ENT_QUOTES))));
111
+ $answer_one = htmlspecialchars($_POST["answer_one"], ENT_QUOTES);
112
+ $answer_one_points = $_POST["answer_one_points"];
113
+ $answer_two = htmlspecialchars($_POST["answer_two"], ENT_QUOTES);
114
+ $answer_two_points = $_POST["answer_two_points"];
115
+ $answer_three = htmlspecialchars($_POST["answer_three"], ENT_QUOTES);
116
+ $answer_three_points = $_POST["answer_three_points"];
117
+ $answer_four = htmlspecialchars($_POST["answer_four"], ENT_QUOTES);
118
+ $answer_four_points = $_POST["answer_four_points"];
119
+ $answer_five = htmlspecialchars($_POST["answer_five"], ENT_QUOTES);
120
+ $answer_five_points = $_POST["answer_five_points"];
121
+ $answer_six = htmlspecialchars($_POST["answer_six"], ENT_QUOTES);
122
+ $answer_six_points = $_POST["answer_six_points"];
123
+ $correct_answer = $_POST["correct_answer"];
124
+ $question_answer_info = $_POST["correct_answer_info"];
125
+ $question_type = $_POST["question_type"];
126
+ $comments = htmlspecialchars($_POST["comments"], ENT_QUOTES);
127
+ $hint = htmlspecialchars($_POST["hint"], ENT_QUOTES);
128
+ $new_question_order = $_POST["new_question_order"];
129
  $quiz_id = $_POST["quiz_id"];
130
  $table_name = $wpdb->prefix . "mlw_questions";
131
  $insert = "INSERT INTO " . $table_name .
178
  /*
179
  Code for Quiz Text tab
180
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
 
182
  //Submit saved templates into database
183
+ if ( isset($_POST["save_templates"]) && $_POST["save_templates"] == "confirmation")
184
  {
185
+ //Variables for save templates form
186
+ $mlw_before_message = $_POST["mlw_quiz_before_message"];
187
+ $mlw_after_message = $_POST["mlw_quiz_after_message"];
188
+ $mlw_user_email_template = $_POST["mlw_quiz_user_email_template"];
189
+ $mlw_admin_email_template = $_POST["mlw_quiz_admin_email_template"];
190
+ $mlw_submit_button_text = $_POST["mlw_submitText"];
191
+ $mlw_name_field_text = $_POST["mlw_nameText"];
192
+ $mlw_business_field_text = $_POST["mlw_businessText"];
193
+ $mlw_email_field_text = $_POST["mlw_emailText"];
194
+ $mlw_phone_field_text = $_POST["mlw_phoneText"];
195
+ $mlw_before_comments = $_POST["mlw_quiz_before_comments"];
196
+ $mlw_comment_field_text = $_POST["mlw_commentText"];
197
+ $mlw_email_from_text = $_POST["emailFromText"];
198
+ $mlw_question_answer_template = $_POST["mlw_quiz_question_answer_template"];
199
  $quiz_id = $_POST["quiz_id"];
200
+
201
  $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET message_before='".$mlw_before_message."', message_comment='".$mlw_before_comments."', comment_field_text='".$mlw_comment_field_text."', email_from_text='".$mlw_email_from_text."', question_answer_template='".$mlw_question_answer_template."', submit_button_text='".$mlw_submit_button_text."', name_field_text='".$mlw_name_field_text."', business_field_text='".$mlw_business_field_text."', email_field_text='".$mlw_email_field_text."', phone_field_text='".$mlw_phone_field_text."', message_after='".$mlw_after_message."', user_email_template='".$mlw_user_email_template."', admin_email_template='".$mlw_admin_email_template."' WHERE quiz_id=".$quiz_id;
202
  $results = $wpdb->query( $update );
203
  if ($results != false)
225
  Code for Quiz Options tab
226
  */
227
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  //Submit saved options into database
229
+ if ( isset($_POST["save_options"]) && $_POST["save_options"] == "confirmation")
230
  {
231
+ //Variables for save options form
232
+ $mlw_system = $_POST["system"];
233
+ $mlw_qmn_questions_from_total = $_POST["question_from_total"];
234
+ $mlw_randomness_order = $_POST["randomness_order"];
235
+ $mlw_send_user_email = $_POST["sendUserEmail"];
236
+ $mlw_send_admin_email = $_POST["sendAdminEmail"];
237
+ $mlw_contact_location = $_POST["contact_info_location"];
238
+ $mlw_user_name = $_POST["userName"];
239
+ $mlw_user_comp = $_POST["userComp"];
240
+ $mlw_user_email = $_POST["userEmail"];
241
+ $mlw_user_phone = $_POST["userPhone"];
242
+ $mlw_admin_email = $_POST["adminEmail"];
243
+ $mlw_comment_section = $_POST["commentSection"];
244
+ $mlw_qmn_loggedin_contact = $_POST["loggedin_user_contact"];
245
  $quiz_id = $_POST["quiz_id"];
246
+
247
+ $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET system='".$mlw_system."', send_user_email='".$mlw_send_user_email."', send_admin_email='".$mlw_send_admin_email."', loggedin_user_contact='".$mlw_qmn_loggedin_contact."', contact_info_location=".$mlw_contact_location.", user_name='".$mlw_user_name."', user_comp='".$mlw_user_comp."', user_email='".$mlw_user_email."', user_phone='".$mlw_user_phone."', admin_email='".$mlw_admin_email."', comment_section='".$mlw_comment_section."', randomness_order='".$mlw_randomness_order."', question_from_total=".$mlw_qmn_questions_from_total." WHERE quiz_id=".$quiz_id;
248
  $results = $wpdb->query( $update );
249
  if ($results != false)
250
  {
270
  Code For Leaderboard Options tab
271
  */
272
 
 
 
 
 
 
273
  ///Submit saved leaderboard template into database
274
+ if ( isset($_POST["save_leaderboard_options"]) && $_POST["save_leaderboard_options"] == "confirmation")
275
  {
276
+ ///Variables for save leaderboard options form
277
+ $mlw_leaderboard_template = $_POST["mlw_quiz_leaderboard_template"];
278
+ $mlw_leaderboard_quiz_id = $_POST["leaderboard_quiz_id"];
279
  $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET leaderboard_template='".$mlw_leaderboard_template."' WHERE quiz_id=".$mlw_leaderboard_quiz_id;
280
  $results = $wpdb->query( $update );
281
  if ($results != false)
303
  Code For Quiz Tools Tab
304
  */
305
 
 
 
 
 
306
  //Update Quiz Table
307
+ if (isset($_POST["mlw_reset_quiz_stats"]) && $_POST["mlw_reset_quiz_stats"] == "confirmation")
308
  {
309
+ //Variables from reset stats form
310
+ $mlw_reset_stats_quiz_id = $_POST["mlw_reset_quiz_id"];
311
  $mlw_reset_update_sql = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET quiz_views=0, quiz_taken=0 WHERE quiz_id=".$mlw_reset_stats_quiz_id;
312
  $mlw_reset_sql_results = $wpdb->query( $mlw_reset_update_sql );
313
  if ($mlw_reset_sql_results != false)
361
  wp_enqueue_script( 'jquery-effects-blind' );
362
  wp_enqueue_script( 'jquery-effects-explode' );
363
  ?>
 
 
364
  <script type="text/javascript">
365
  var $j = jQuery.noConflict();
366
  // increase the default animation speed to exaggerate the effect
729
  <?php
730
  $question_list = "";
731
  $display = "";
732
+ $alternate = "";
733
  foreach($mlw_question_data as $mlw_question_info) {
734
  if($alternate) $alternate = "";
735
  else $alternate = " class=\"alternate\"";
774
  <div id="new_question_dialog" title="Create New Question" style="display:none;">
775
 
776
  <?php
777
+ echo "<form action='' method='post'>";
778
  echo "<input type='hidden' name='create_question' value='confirmation' />";
779
  echo "<input type='hidden' name='quiz_id' value='".$quiz_id."' />";
780
  ?>
937
 
938
  <div id="edit_question_dialog" title="Edit Question" style="display:none;">
939
  <?php
940
+ echo "<form action='' method='post'>";
941
  echo "<input type='hidden' name='edit_question' value='confirmation' />";
942
  echo "<input type='hidden' id='edit_question_id' name='edit_question_id' value='' />";
943
  echo "<input type='hidden' name='quiz_id' value='".$quiz_id."' />";
1148
  </table>
1149
  <button id="save_template_button" onclick="javascript: document.quiz_template_form.submit();">Save Templates</button><button id="template_tab_help">Help</button>
1150
  <?php
1151
+ echo "<form action='' method='post' name='quiz_template_form'>";
1152
  echo "<input type='hidden' name='save_templates' value='confirmation' />";
1153
  echo "<input type='hidden' name='quiz_id' value='".$quiz_id."' />";
1154
  ?>
1305
  <div id="tabs-3">
1306
  <button id="save_options_button" onclick="javascript: document.quiz_options_form.submit();">Save Options</button><button id="options_tab_help">Help</button>
1307
  <?php
1308
+ echo "<form action='' method='post' name='quiz_options_form'>";
1309
  echo "<input type='hidden' name='save_options' value='confirmation' />";
1310
  echo "<input type='hidden' name='quiz_id' value='".$quiz_id."' />";
1311
  ?>
1318
  <input type="radio" id="radio3" name="system" <?php if ($mlw_quiz_options->system == 2) {echo 'checked="checked"';} ?> value='2' /><label for="radio3">Not Graded</label>
1319
  </div></td>
1320
  </tr>
1321
+ <tr valign="top">
1322
+ <th scope="row"><label for="question_from_total">How many questions should be loaded for quiz? (Leave 0 to load all questions)</label></th>
1323
+ <td>
1324
+ <input name="question_from_total" type="number" step="1" min="0" id="question_from_total" value="<?php echo $mlw_quiz_options->question_from_total; ?>" class="regular-text" />
1325
+ </td>
1326
+ </tr>
1327
  <tr valign="top">
1328
  <th scope="row"><label for="randomness_order">Are the questions random? (Question Order will not apply if this is yes)</label></th>
1329
  <td><div id="randomness_order">
1440
  </table>
1441
  <button id="save_template_button" onclick="javascript: document.quiz_leaderboard_options_form.submit();">Save Leaderboard Options</button><button id="leaderboard_tab_help">Help</button>
1442
  <?php
1443
+ echo "<form action='' method='post' name='quiz_leaderboard_options_form'>";
1444
  echo "<input type='hidden' name='save_leaderboard_options' value='confirmation' />";
1445
  echo "<input type='hidden' name='leaderboard_quiz_id' value='".$quiz_id."' />";
1446
  ?>
1475
  <div id="mlw_reset_stats_dialog" title="Reset Stats For This Quiz" style="display:none;">
1476
  <p>Are you sure you want to reset the stats to 0? All views and taken stats for this quiz will be reset. This is permanent and cannot be undone.</p>
1477
  <?php
1478
+ echo "<form action='' method='post'>";
1479
  echo "<input type='hidden' name='mlw_reset_quiz_stats' value='confirmation' />";
1480
  echo "<input type='hidden' name='mlw_reset_quiz_id' value='".$quiz_id."' />";
1481
  echo "<p class='submit'><input type='submit' class='button-primary' value='Reset All Stats For Quiz' /></p>";
1488
  <div id="delete_dialog" title="Delete Question?" style="display:none;">
1489
  <h3><b>Are you sure you want to delete Question <span id="delete_question_id"></span>?</b></h3>
1490
  <?php
1491
+ echo "<form action='' method='post'>";
1492
  echo "<input type='hidden' name='delete_question' value='confirmation' />";
1493
  echo "<input type='hidden' id='question_id' name='question_id' value='' />";
1494
  echo "<input type='hidden' name='quiz_id' value='".$quiz_id."' />";
includes/mlw_results.php CHANGED
@@ -9,16 +9,15 @@ Copyright 2013, My Local Webstop (email : fpcorso@mylocalwebstop.com)
9
  function mlw_generate_quiz_results()
10
  {
11
  global $wpdb;
12
- $quiz_id = $_GET["quiz_id"];
13
-
14
- ///Variables from delete result form
15
- $mlw_delete_results_confirmation = $_POST["delete_results"];
16
- $mlw_delete_results_id = $_POST["result_id"];
17
- $mlw_delete_results_name = $_POST["delete_quiz_name"];
18
 
19
  ///Delete Results Function
20
- if ($mlw_delete_results_confirmation == "confirmation")
21
  {
 
 
 
 
22
  $mlw_delete_results_update_sql = "UPDATE " . $wpdb->prefix . "mlw_results" . " SET deleted=1 WHERE result_id=".$mlw_delete_results_id;
23
  $mlw_delete_results_results = $wpdb->query( $mlw_delete_results_update_sql );
24
  $mlw_hasDeletedResults = true;
@@ -36,7 +35,7 @@ function mlw_generate_quiz_results()
36
  global $wpdb;
37
 
38
  $sql = "SELECT * FROM " . $wpdb->prefix . "mlw_results WHERE deleted='0'";
39
- if ($quiz_id != "")
40
  {
41
  $sql .= " AND quiz_id=".$quiz_id;
42
  }
@@ -132,6 +131,7 @@ function mlw_generate_quiz_results()
132
  <?php
133
  $quotes_list = "";
134
  $display = "";
 
135
  foreach($mlw_quiz_data as $mlw_quiz_info) {
136
  if($alternate) $alternate = "";
137
  else $alternate = " class=\"alternate\"";
@@ -174,7 +174,7 @@ function mlw_generate_quiz_results()
174
  echo $display;
175
  ?>
176
 
177
- <div id="dialog" title="Help">
178
  <h3><b>Help</b></h3>
179
  <p>This page shows all of the results from the taken quizzes.</p>
180
  <p>The table show the result id, the score from the quiz, the contact information provided, and the time the quiz was taken.</p>
@@ -183,7 +183,7 @@ function mlw_generate_quiz_results()
183
  <div id="delete_dialog" title="Delete Results?" style="display:none;">
184
  <h3><b>Are you sure you want to delete these results?</b></h3>
185
  <?php
186
- echo "<form action='" . $PHP_SELF . "' method='post'>";
187
  echo "<input type='hidden' name='delete_results' value='confirmation' />";
188
  echo "<input type='hidden' id='result_id' name='result_id' value='' />";
189
  echo "<input type='hidden' id='delete_quiz_name' name='delete_quiz_name' value='' />";
9
  function mlw_generate_quiz_results()
10
  {
11
  global $wpdb;
12
+ $mlw_hasDeletedResults = false;
 
 
 
 
 
13
 
14
  ///Delete Results Function
15
+ if (isset($_POST["delete_results"]) && $_POST["delete_results"] == "confirmation")
16
  {
17
+ ///Variables from delete result form
18
+ $mlw_delete_results_confirmation = $_POST["delete_results"];
19
+ $mlw_delete_results_id = $_POST["result_id"];
20
+ $mlw_delete_results_name = $_POST["delete_quiz_name"];
21
  $mlw_delete_results_update_sql = "UPDATE " . $wpdb->prefix . "mlw_results" . " SET deleted=1 WHERE result_id=".$mlw_delete_results_id;
22
  $mlw_delete_results_results = $wpdb->query( $mlw_delete_results_update_sql );
23
  $mlw_hasDeletedResults = true;
35
  global $wpdb;
36
 
37
  $sql = "SELECT * FROM " . $wpdb->prefix . "mlw_results WHERE deleted='0'";
38
+ if (isset($_GET["quiz_id"]) && $_GET["quiz_id"] != "")
39
  {
40
  $sql .= " AND quiz_id=".$quiz_id;
41
  }
131
  <?php
132
  $quotes_list = "";
133
  $display = "";
134
+ $alternate = "";
135
  foreach($mlw_quiz_data as $mlw_quiz_info) {
136
  if($alternate) $alternate = "";
137
  else $alternate = " class=\"alternate\"";
174
  echo $display;
175
  ?>
176
 
177
+ <div id="dialog" title="Help" style="display:none;">
178
  <h3><b>Help</b></h3>
179
  <p>This page shows all of the results from the taken quizzes.</p>
180
  <p>The table show the result id, the score from the quiz, the contact information provided, and the time the quiz was taken.</p>
183
  <div id="delete_dialog" title="Delete Results?" style="display:none;">
184
  <h3><b>Are you sure you want to delete these results?</b></h3>
185
  <?php
186
+ echo "<form action='' method='post'>";
187
  echo "<input type='hidden' name='delete_results' value='confirmation' />";
188
  echo "<input type='hidden' id='result_id' name='result_id' value='' />";
189
  echo "<input type='hidden' id='delete_quiz_name' name='delete_quiz_name' value='' />";
includes/mlw_results_details.php CHANGED
@@ -147,7 +147,7 @@ function mlw_generate_result_details()
147
  <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
148
  <strong>Hey!</strong> Please go to the Quiz Results page and click on the View link from the result you wish to see.</p>
149
  </div>
150
- <div id="dialog" title="Help">
151
  <h3><b>Help</b></h3>
152
  <p>You are getting this error page because this page could not find the results.</p>
153
  <p>You must go to the Quiz Results page and click on the result you want to see from that table.</p>
147
  <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
148
  <strong>Hey!</strong> Please go to the Quiz Results page and click on the View link from the result you wish to see.</p>
149
  </div>
150
+ <div id="dialog" title="Help" style="display:none;">
151
  <h3><b>Help</b></h3>
152
  <p>You are getting this error page because this page could not find the results.</p>
153
  <p>You must go to the Quiz Results page and click on the result you want to see from that table.</p>
includes/mlw_tools.php CHANGED
@@ -72,7 +72,7 @@ function mlw_generate_quiz_tools(){
72
 
73
  <!--<div style="clear:both"></div>-->
74
 
75
- <div id="dialog" title="Help">
76
  <h3><b>Help</b></h3>
77
  <p>This page is the tools for the Quiz Master Next.</p>
78
  <p>The first widget lists the audit trail.</p>
@@ -106,6 +106,7 @@ function mlw_tools_box()
106
 
107
  $quotes_list = "";
108
  $display = "";
 
109
  foreach($audit_trails as $quote_data) {
110
  if($alternate) $alternate = "";
111
  else $alternate = " class=\"alternate\"";
72
 
73
  <!--<div style="clear:both"></div>-->
74
 
75
+ <div id="dialog" title="Help" style="display:none;">
76
  <h3><b>Help</b></h3>
77
  <p>This page is the tools for the Quiz Master Next.</p>
78
  <p>The first widget lists the audit trail.</p>
106
 
107
  $quotes_list = "";
108
  $display = "";
109
+ $alternate = "";
110
  foreach($audit_trails as $quote_data) {
111
  if($alternate) $alternate = "";
112
  else $alternate = " class=\"alternate\"";
includes/mlw_update.php CHANGED
@@ -6,7 +6,7 @@ function mlw_quiz_update()
6
  {
7
 
8
  //Update this variable each update. This is what is checked when the plugin is deciding to run the upgrade script or not.
9
- $data = "1.4.2";
10
  if ( ! get_option('mlw_quiz_master_version'))
11
  {
12
  add_option('mlw_quiz_master_version' , $data);
@@ -89,6 +89,15 @@ function mlw_quiz_update()
89
  $results = $wpdb->query( $update_sql );
90
  }
91
 
 
 
 
 
 
 
 
 
 
92
  global $wpdb;
93
  $table_name = $wpdb->prefix . "mlw_questions";
94
  //Update 0.5
6
  {
7
 
8
  //Update this variable each update. This is what is checked when the plugin is deciding to run the upgrade script or not.
9
+ $data = "1.5.1";
10
  if ( ! get_option('mlw_quiz_master_version'))
11
  {
12
  add_option('mlw_quiz_master_version' , $data);
89
  $results = $wpdb->query( $update_sql );
90
  }
91
 
92
+ //Update 1.5.1
93
+ if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_from_total'") != "question_from_total")
94
+ {
95
+ $sql = "ALTER TABLE ".$table_name." ADD question_from_total INT NOT NULL AFTER comment_section";
96
+ $results = $wpdb->query( $sql );
97
+ $update_sql = "UPDATE ".$table_name." SET question_from_total=0";
98
+ $results = $wpdb->query( $update_sql );
99
+ }
100
+
101
  global $wpdb;
102
  $table_name = $wpdb->prefix . "mlw_questions";
103
  //Update 0.5
mlw_quizmaster2.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  Plugin Name: Quiz Master Next
5
  Description: Use this plugin to add multiple quizzes, tests, or surveys to your website.
6
- Version: 1.4.2
7
  Author: Frank Corso
8
  Author URI: http://www.mylocalwebstop.com/
9
  Plugin URI: http://www.mylocalwebstop.com/
@@ -57,7 +57,7 @@ function mlw_add_menu()
57
  {
58
  if (function_exists('add_menu_page'))
59
  {
60
- add_menu_page('Quiz Dashboard', 'Quiz Dashboard', 'manage_options', __FILE__, 'mlw_generate_quiz_dashboard', 'dashicons-feedback');
61
  add_submenu_page(__FILE__, 'Quizzes', 'Quizzes', 'manage_options', 'mlw_quiz_admin', 'mlw_generate_quiz_admin');
62
  add_submenu_page(__FILE__, 'Quiz Options', 'Quiz Options', 'manage_options', 'mlw_quiz_options', 'mlw_generate_quiz_options');
63
  add_submenu_page(__FILE__, 'Quiz Results', 'Quiz Results', 'manage_options', 'mlw_quiz_results', 'mlw_generate_quiz_results');
3
  /*
4
  Plugin Name: Quiz Master Next
5
  Description: Use this plugin to add multiple quizzes, tests, or surveys to your website.
6
+ Version: 1.5.1
7
  Author: Frank Corso
8
  Author URI: http://www.mylocalwebstop.com/
9
  Plugin URI: http://www.mylocalwebstop.com/
57
  {
58
  if (function_exists('add_menu_page'))
59
  {
60
+ add_menu_page('Quiz Master Next', 'Quiz Dashboard', 'manage_options', __FILE__, 'mlw_generate_quiz_dashboard', 'dashicons-feedback');
61
  add_submenu_page(__FILE__, 'Quizzes', 'Quizzes', 'manage_options', 'mlw_quiz_admin', 'mlw_generate_quiz_admin');
62
  add_submenu_page(__FILE__, 'Quiz Options', 'Quiz Options', 'manage_options', 'mlw_quiz_options', 'mlw_generate_quiz_options');
63
  add_submenu_page(__FILE__, 'Quiz Results', 'Quiz Results', 'manage_options', 'mlw_quiz_results', 'mlw_generate_quiz_results');
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: fpcorso
3
  Tags: quiz, test, score, survey, contact, form, email
4
  Requires at least: 3.3
5
  Tested up to: 3.8.1
6
- Stable tag: 1.4.2
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
 
9
  Use this plugin to add multiple quizzes, tests, surveys, or contact forms to your website.
@@ -25,6 +25,7 @@ Use this plugin to add multiple quizzes, tests, and surveys to your website. Thi
25
  * Can enable comment boxes for each question and/or comment section at the end of the quiz
26
  * Can enable hints for questions
27
  * Can show user why the answer is the correct answer
 
28
  * Saves the results after a user takes the quiz
29
  * Saves the users answers and comments after taking the quiz
30
  * Features audit trail so admins can keep track of who adds, edits, or deletes quizzes and questions
@@ -55,9 +56,6 @@ We now offer an installation service to assist you in this process. We will inst
55
  * Activate the plugin through the 'Plugins' menu in WordPress
56
 
57
 
58
-
59
-
60
-
61
  == Frequently Asked Questions ==
62
 
63
  = What does the option do on that page? =
@@ -81,6 +79,14 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
81
 
82
  == Changelog ==
83
 
 
 
 
 
 
 
 
 
84
  = 1.4.2 (February 22, 2014) =
85
  * Fixed Capability Bug
86
  * Minor Design Changes To Question Form
@@ -288,6 +294,9 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
288
 
289
  == Upgrade Notice ==
290
 
 
 
 
291
  = 1.4.2 =
292
  This update brings many minor design changes and minor bug fixes.
293
 
3
  Tags: quiz, test, score, survey, contact, form, email
4
  Requires at least: 3.3
5
  Tested up to: 3.8.1
6
+ Stable tag: 1.5.1
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
 
9
  Use this plugin to add multiple quizzes, tests, surveys, or contact forms to your website.
25
  * Can enable comment boxes for each question and/or comment section at the end of the quiz
26
  * Can enable hints for questions
27
  * Can show user why the answer is the correct answer
28
+ * Can load set number of questions from question bank or all questions
29
  * Saves the results after a user takes the quiz
30
  * Saves the users answers and comments after taking the quiz
31
  * Features audit trail so admins can keep track of who adds, edits, or deletes quizzes and questions
56
  * Activate the plugin through the 'Plugins' menu in WordPress
57
 
58
 
 
 
 
59
  == Frequently Asked Questions ==
60
 
61
  = What does the option do on that page? =
79
 
80
  == Changelog ==
81
 
82
+ = 1.5.1 (February 26, 2014) =
83
+ * Added Ability To Load Only Set Amount Of Questions From Total Questions
84
+ * Fixed PHP Notices On Quizzes Page
85
+ * Fixed PHP Notices On Quiz Options Page
86
+ * Fixed PHP Notices On Quiz Results Page
87
+ * Fixed PHP Notices On Quiz
88
+ * Fixed Hidden Pop-Up Bug
89
+
90
  = 1.4.2 (February 22, 2014) =
91
  * Fixed Capability Bug
92
  * Minor Design Changes To Question Form
294
 
295
  == Upgrade Notice ==
296
 
297
+ = 1.5.1 =
298
+ This update allows you to have the quiz only load a set number of questions from your total question bank. Also fixes several minor bugs.
299
+
300
  = 1.4.2 =
301
  This update brings many minor design changes and minor bug fixes.
302