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

Version Description

Upgrade for several enhanced stat widgets and the ability to edit leaderboard templates!

Download this release

Release Info

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

Code changes from version 0.9.1 to 0.9.2

includes/mlw_dashboard.php CHANGED
@@ -14,6 +14,7 @@ function mlw_generate_quiz_dashboard(){
14
  add_meta_box("wpss_mrts", 'Help', "mlw_dashboard_box_two", "quiz_wpss2");
15
  add_meta_box("wpss_mrts", 'Quiz Total Stats', "mlw_dashboard_box_three", "quiz_wpss3");
16
  add_meta_box("wpss_mrts", 'Quiz Weekly Stats - Times Taken', "mlw_dashboard_box_four", "quiz_wpss4");
 
17
  ?>
18
  <!-- css -->
19
  <link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css" rel="stylesheet" />
@@ -83,6 +84,13 @@ function mlw_generate_quiz_dashboard(){
83
  </div>
84
 
85
  <!--<div style="clear:both"></div>-->
 
 
 
 
 
 
 
86
  <div id="dialog" title="Help">
87
  <h3><b>Help</b></h3>
88
  <p>This page is the main admin page for the Quiz Master Next.</p>
@@ -282,9 +290,41 @@ function mlw_dashboard_box_four()
282
  $sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_two_week_first." 00:00:00' AND '".$mlw_two_week_last." 23:59:59')";
283
  $mlw_quiz_taken_two_week = $wpdb->get_results($sql);
284
  $mlw_quiz_taken_two_week = $wpdb->num_rows;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  ?>
286
  <div>
287
- <span class="inlinesparkline"><?php echo $mlw_quiz_taken_two_week.",".$mlw_quiz_taken_last_week.",".$mlw_quiz_taken_this_week; ?></span>
288
  </div>
289
  <?php
290
  }
14
  add_meta_box("wpss_mrts", 'Help', "mlw_dashboard_box_two", "quiz_wpss2");
15
  add_meta_box("wpss_mrts", 'Quiz Total Stats', "mlw_dashboard_box_three", "quiz_wpss3");
16
  add_meta_box("wpss_mrts", 'Quiz Weekly Stats - Times Taken', "mlw_dashboard_box_four", "quiz_wpss4");
17
+ add_meta_box("wpss_mrts", 'Quiz Monthly Stats - Times Taken', "mlw_dashboard_box_five", "quiz_wpss5");
18
  ?>
19
  <!-- css -->
20
  <link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css" rel="stylesheet" />
84
  </div>
85
 
86
  <!--<div style="clear:both"></div>-->
87
+
88
+ <div style="float:left; width:60%;" class="inner-sidebar1">
89
+ <?php do_meta_boxes('quiz_wpss5','advanced',''); ?>
90
+ </div>
91
+
92
+ <!--<div style="clear:both"></div>-->
93
+
94
  <div id="dialog" title="Help">
95
  <h3><b>Help</b></h3>
96
  <p>This page is the main admin page for the Quiz Master Next.</p>
290
  $sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_two_week_first." 00:00:00' AND '".$mlw_two_week_last." 23:59:59')";
291
  $mlw_quiz_taken_two_week = $wpdb->get_results($sql);
292
  $mlw_quiz_taken_two_week = $wpdb->num_rows;
293
+
294
+ $mlw_three_week_first = mktime(0, 0, 0, date("m") , date("d")-27, date("Y"));
295
+ $mlw_three_week_first = date("Y-m-d", $mlw_three_week_first);
296
+ $mlw_three_week_last = mktime(0, 0, 0, date("m") , date("d")-21, date("Y"));
297
+ $mlw_three_week_last = date("Y-m-d", $mlw_three_week_last);
298
+ $sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_three_week_first." 00:00:00' AND '".$mlw_three_week_last." 23:59:59')";
299
+ $mlw_quiz_taken_three_week = $wpdb->get_results($sql);
300
+ $mlw_quiz_taken_three_week = $wpdb->num_rows;
301
+ ?>
302
+ <div>
303
+ <span class="inlinesparkline"><?php echo $mlw_quiz_taken_three_week.",".$mlw_quiz_taken_two_week.",".$mlw_quiz_taken_last_week.",".$mlw_quiz_taken_this_week; ?></span>
304
+ </div>
305
+ <?php
306
+ }
307
+ function mlw_dashboard_box_five()
308
+ {
309
+ //Gather the monthly stats, one variable for each day for the graph
310
+ global $wpdb;
311
+ $mlw_this_month = mktime(0, 0, 0, date("m") , date("d")-30, date("Y"));
312
+ $mlw_this_month = date("Y-m-d", $mlw_this_month);
313
+ $sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_this_month." 00:00:00' AND '".date("Y-m-d")." 23:59:59')";
314
+ $mlw_quiz_taken_this_month = $wpdb->get_results($sql);
315
+ $mlw_quiz_taken_this_month = $wpdb->num_rows;
316
+
317
+ $mlw_last_month_first = mktime(0, 0, 0, date("m") , date("d")-60, date("Y"));
318
+ $mlw_last_month_first = date("Y-m-d", $mlw_last_month_first);
319
+ $mlw_last_month_last = mktime(0, 0, 0, date("m") , date("d")-31, date("Y"));
320
+ $mlw_last_month_last = date("Y-m-d", $mlw_last_month_last);
321
+ $sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_last_month_first." 00:00:00' AND '".$mlw_last_month_last." 23:59:59')";
322
+ $mlw_quiz_taken_last_month = $wpdb->get_results($sql);
323
+ $mlw_quiz_taken_last_month = $wpdb->num_rows;
324
+
325
  ?>
326
  <div>
327
+ <span class="inlinesparkline"><?php echo $mlw_quiz_taken_last_month.",".$mlw_quiz_taken_this_month; ?></span>
328
  </div>
329
  <?php
330
  }
includes/mlw_leaderboard.php CHANGED
@@ -21,21 +21,46 @@ function mlw_quiz_leaderboard_shortcode($atts)
21
  $sql = "SELECT * FROM " . $wpdb->prefix . "mlw_results WHERE quiz_id=".$mlw_quiz_id." AND deleted='0' LIMIT 10";
22
  $mlw_result_data = $wpdb->get_results($sql);
23
 
24
- $mlw_quiz_leaderboard_display .= "<h3>".$mlw_quiz_options->quiz_name."'s Leaderboard</h3>";
 
 
25
  $leader_count = 0;
26
  foreach($mlw_result_data as $mlw_eaches) {
27
  $leader_count++;
 
 
 
 
 
28
  if ($mlw_quiz_options->system == 0)
29
  {
30
- $mlw_quiz_leaderboard_display .= "".$leader_count.".&nbsp;".$mlw_eaches->name."&nbsp; - ".$mlw_eaches->correct_score."%";
 
 
 
 
31
  }
32
  if ($mlw_quiz_options->system == 1)
33
  {
34
- $mlw_quiz_leaderboard_display .= "".$leader_count.".&nbsp;".$mlw_eaches->name."&nbsp; - ".$mlw_eaches->point_score." Points";
 
 
 
 
35
  }
36
- $mlw_quiz_leaderboard_display .= "<br />";
37
  }
38
- $mlw_quiz_leaderboard_display .= "<br />";
 
 
 
 
 
 
 
 
 
 
 
39
  return $mlw_quiz_leaderboard_display;
40
  }
41
  ?>
21
  $sql = "SELECT * FROM " . $wpdb->prefix . "mlw_results WHERE quiz_id=".$mlw_quiz_id." AND deleted='0' LIMIT 10";
22
  $mlw_result_data = $wpdb->get_results($sql);
23
 
24
+ $mlw_quiz_leaderboard_display = $mlw_quiz_options->leaderboard_template;
25
+ $mlw_quiz_leaderboard_display = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_quiz_leaderboard_display);
26
+
27
  $leader_count = 0;
28
  foreach($mlw_result_data as $mlw_eaches) {
29
  $leader_count++;
30
+ if ($leader_count == 1) {$mlw_quiz_leaderboard_display = str_replace( "%FIRST_PLACE_NAME%" , $mlw_eaches->name, $mlw_quiz_leaderboard_display);}
31
+ if ($leader_count == 2) {$mlw_quiz_leaderboard_display = str_replace( "%SECOND_PLACE_NAME%" , $mlw_eaches->name, $mlw_quiz_leaderboard_display);}
32
+ if ($leader_count == 3) {$mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_NAME%" , $mlw_eaches->name, $mlw_quiz_leaderboard_display);}
33
+ if ($leader_count == 4) {$mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_NAME%" , $mlw_eaches->name, $mlw_quiz_leaderboard_display);}
34
+ if ($leader_count == 5) {$mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_NAME%" , $mlw_eaches->name, $mlw_quiz_leaderboard_display);}
35
  if ($mlw_quiz_options->system == 0)
36
  {
37
+ if ($leader_count == 1) {$mlw_quiz_leaderboard_display = str_replace( "%FIRST_PLACE_SCORE%" , $mlw_eaches->correct_score."%", $mlw_quiz_leaderboard_display);}
38
+ if ($leader_count == 2) {$mlw_quiz_leaderboard_display = str_replace( "%SECOND_PLACE_SCORE%" , $mlw_eaches->correct_score."%", $mlw_quiz_leaderboard_display);}
39
+ if ($leader_count == 3) {$mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_SCORE%" , $mlw_eaches->correct_score."%", $mlw_quiz_leaderboard_display);}
40
+ if ($leader_count == 4) {$mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_SCORE%" , $mlw_eaches->correct_score."%", $mlw_quiz_leaderboard_display);}
41
+ if ($leader_count == 5) {$mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_SCORE%" , $mlw_eaches->correct_score."%", $mlw_quiz_leaderboard_display);}
42
  }
43
  if ($mlw_quiz_options->system == 1)
44
  {
45
+ if ($leader_count == 1) {$mlw_quiz_leaderboard_display = str_replace( "%FIRST_PLACE_SCORE%" , $mlw_eaches->point_score." Points", $mlw_quiz_leaderboard_display);}
46
+ if ($leader_count == 2) {$mlw_quiz_leaderboard_display = str_replace( "%SECOND_PLACE_SCORE%" , $mlw_eaches->point_score." Points", $mlw_quiz_leaderboard_display);}
47
+ if ($leader_count == 3) {$mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_SCORE%" , $mlw_eaches->point_score." Points", $mlw_quiz_leaderboard_display);}
48
+ if ($leader_count == 4) {$mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_SCORE%" , $mlw_eaches->point_score." Points", $mlw_quiz_leaderboard_display);}
49
+ if ($leader_count == 5) {$mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_SCORE%" , $mlw_eaches->point_score." Points", $mlw_quiz_leaderboard_display);}
50
  }
 
51
  }
52
+ $mlw_quiz_leaderboard_display = str_replace( "%QUIZ_NAME%" , " ", $mlw_quiz_leaderboard_display);
53
+ $mlw_quiz_leaderboard_display = str_replace( "%FIRST_PLACE_NAME%" , " ", $mlw_quiz_leaderboard_display);
54
+ $mlw_quiz_leaderboard_display = str_replace( "%SECOND_PLACE_NAME%" , " ", $mlw_quiz_leaderboard_display);
55
+ $mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_NAME%" , " ", $mlw_quiz_leaderboard_display);
56
+ $mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_NAME%" , " ", $mlw_quiz_leaderboard_display);
57
+ $mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_NAME%" , " ", $mlw_quiz_leaderboard_display);
58
+ $mlw_quiz_leaderboard_display = str_replace( "%FIRST_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
59
+ $mlw_quiz_leaderboard_display = str_replace( "%SECOND_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
60
+ $mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
61
+ $mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
62
+ $mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
63
+
64
  return $mlw_quiz_leaderboard_display;
65
  }
66
  ?>
includes/mlw_main_page.php CHANGED
@@ -159,16 +159,19 @@ function quiz_wpss_mrt_meta_box2()
159
  <div>
160
  <table width='100%'>
161
  <tr>
162
- <td align='left'>0.9.1 (January 8, 2014)</td>
163
  </tr>
164
  <tr>
165
- <td align='left'>* Fixed Leaderboard Design Bug</td>
166
  </tr>
167
  <tr>
168
- <td align='left'>* Fixed Contact Information Design Bug</td>
169
  </tr>
170
  <tr>
171
- <td align='left'>* Added Ability To Not Need Contact Info For Logged In Users</td>
 
 
 
172
  </tr>
173
  </table>
174
  </div>
159
  <div>
160
  <table width='100%'>
161
  <tr>
162
+ <td align='left'>0.9.2 (January 12, 2014)</td>
163
  </tr>
164
  <tr>
165
+ <td align='left'>* Updated Weekly Stat Widget</td>
166
  </tr>
167
  <tr>
168
+ <td align='left'>* Begun Work On Monthly Stat Widget</td>
169
  </tr>
170
  <tr>
171
+ <td align='left'>* Added Ability To Edit Leaderboard Template</td>
172
+ </tr>
173
+ <tr>
174
+ <td align='left'>* Bug Fixes</td>
175
  </tr>
176
  </table>
177
  </div>
includes/mlw_quiz_admin.php CHANGED
@@ -19,9 +19,15 @@ function mlw_generate_quiz_admin()
19
  if ($success == "confirmation")
20
  {
21
  //Insert New Quiz Into Table
 
 
 
 
 
 
22
  $insert = "INSERT INTO " . $table_name .
23
- "(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, system, show_score, send_user_email, send_admin_email, user_name, user_comp, user_email, user_phone, admin_email, comment_section, quiz_views, quiz_taken, deleted) " .
24
- "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', 0, 0, 0, 0, 0, 0, 0, 0, '".get_option( 'admin_email', 'Enter email' )."', 0, 0, 0, 0)";
25
  $results = $wpdb->query( $insert );
26
  $hasCreatedQuiz = true;
27
 
19
  if ($success == "confirmation")
20
  {
21
  //Insert New Quiz Into Table
22
+ $mlw_leaderboard_default = "<h3>Leaderboard for %QUIZ_NAME%</h3>
23
+ 1. %FIRST_PLACE_NAME%-%FIRST_PLACE_SCORE%<br />
24
+ 2. %SECOND_PLACE_NAME%-%SECOND_PLACE_SCORE%<br />
25
+ 3. %THIRD_PLACE_NAME%-%THIRD_PLACE_SCORE%<br />
26
+ 4. %FOURTH_PLACE_NAME%-%FOURTH_PLACE_SCORE%<br />
27
+ 5. %FIFTH_PLACE_NAME%-%FIFTH_PLACE_SCORE%<br />";
28
  $insert = "INSERT INTO " . $table_name .
29
+ "(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, leaderboard_template, system, show_score, send_user_email, send_admin_email, user_name, user_comp, user_email, user_phone, admin_email, comment_section, quiz_views, quiz_taken, deleted) " .
30
+ "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', '".$mlw_leaderboard_default."', 0, 0, 0, 0, 0, 0, 0, 0, '".get_option( 'admin_email', 'Enter email' )."', 0, 0, 0, 0)";
31
  $results = $wpdb->query( $insert );
32
  $hasCreatedQuiz = true;
33
 
includes/mlw_quiz_install.php CHANGED
@@ -39,6 +39,8 @@ function mlw_quiz_activate()
39
  phone_field_text TEXT NOT NULL,
40
 
41
  comment_field_text TEXT NOT NULL,
 
 
42
 
43
  system INT NOT NULL,
44
 
39
  phone_field_text TEXT NOT NULL,
40
 
41
  comment_field_text TEXT NOT NULL,
42
+
43
+ leaderboard_template TEXT NOT NULL,
44
 
45
  system INT NOT NULL,
46
 
includes/mlw_quiz_options.php CHANGED
@@ -200,6 +200,32 @@ function mlw_generate_quiz_options()
200
  "VALUES (NULL , '" . $current_user->display_name . "' , 'Options Have Been Edited For Quiz Number ".$quiz_id."' , '" . date("h:i:s A m/d/Y") . "')";
201
  $results = $wpdb->query( $insert );
202
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
 
204
 
205
  /*
@@ -295,6 +321,23 @@ function mlw_generate_quiz_options()
295
  return false;
296
  } );
297
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  $j(function() {
299
  $j( "#tabs" ).tabs();
300
  });
@@ -434,6 +477,16 @@ function mlw_generate_quiz_options()
434
  {
435
  ?>
436
  <h2>Quiz Options For <?php echo $mlw_quiz_options->quiz_name; ?><a id="opener" href="">(?)</a></h2>
 
 
 
 
 
 
 
 
 
 
437
  <?php if ($hasCreatedQuestion)
438
  {
439
  ?>
@@ -489,6 +542,7 @@ function mlw_generate_quiz_options()
489
  <li><a href="#tabs-1">Quiz Questions</a></li>
490
  <li><a href="#tabs-2">Quiz Text</a></li>
491
  <li><a href="#tabs-3">Quiz Options</a></li>
 
492
  </ul>
493
  <div id="tabs-1">
494
  <?php
@@ -1040,8 +1094,69 @@ function mlw_generate_quiz_options()
1040
  </table>
1041
  <?php echo "</form>"; ?>
1042
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1043
  </div>
1044
-
1045
 
1046
  <div id="delete_dialog" title="Delete Question?" style="display:none;">
1047
  <h3><b>Are you sure you want to delete Question <span id="delete_question_id"></span>?</b></h3>
@@ -1054,17 +1169,17 @@ function mlw_generate_quiz_options()
1054
  echo "</form>";
1055
  ?>
1056
  </div>
1057
- <div id="dialog" title="Help">
1058
  <h3><b>Help</b></h3>
1059
  <p>This page is used edit the questions and options for your quiz. Use the help buttons on each tab for assistance.</p>
1060
  </div>
1061
- <div id="questions_help_dialog" title="Help">
1062
  <p>The question table lists the ID of the question and the question itself.</p>
1063
  <p>To edit a question, use the Edit link below the question.</p>
1064
  <p>To add a question, click on the Add Question button. This will open a window for you to add a question. The window will ask for the question and up to 6 answers. If you are using the points system, enter in the amount of points each answer is worth. If you are using the correct system, check the answer that is the correct answer.
1065
  You can choose if you would like a comment field after the question be selecting yes to the Comment question. You can also have a hint displayed to the user. Click create question when you are finished.</p>
1066
  </div>
1067
- <div id="templates_help_dialog" title="Help">
1068
  <p>This tab is used to edit the different messages the user and admin may see.</p>
1069
  <p>The Message Displayed Before Quiz text is shown to the user at the beginning of the quiz.</p>
1070
  <p>The Message Display Before Comment Box is shown to the user right before the section the user can type in comments if that option is enabled.</p>
@@ -1074,7 +1189,7 @@ function mlw_generate_quiz_options()
1074
  <p>The other templates section is for customizing the text on the submit button as well as the fields where are user can input his or her information.</p>
1075
  <p>Some templates are able to have variables inside the text. When the quiz is run, these variables will change to their values.</p>
1076
  </div>
1077
- <div id="options_help_dialog" title="Help">
1078
  <p>This tab is used to edit the different options for the quiz.</p>
1079
  <p>The system option allows you to have the quiz be graded using a correct/incorrect system or the quiz can have each answer worth different amount of points.</p>
1080
  <p>The second option asks whether you want the user to his or her score after completing the quiz.</p>
@@ -1084,6 +1199,11 @@ function mlw_generate_quiz_options()
1084
  <p>The next option asks for the email address of the admin you would like the quiz to email.</p>
1085
  <p>The last option asks if you would like for the user to be able to leave comments at the end of the quiz.</p>
1086
  </div>
 
 
 
 
 
1087
 
1088
  <?php
1089
  }
200
  "VALUES (NULL , '" . $current_user->display_name . "' , 'Options Have Been Edited For Quiz Number ".$quiz_id."' , '" . date("h:i:s A m/d/Y") . "')";
201
  $results = $wpdb->query( $insert );
202
  }
203
+
204
+ /*
205
+ Code For Leaderboard Options tab
206
+ */
207
+
208
+ ///Variables for save leaderboard options form
209
+ $mlw_leaderboard_template = $_POST["mlw_quiz_leaderboard_template"];
210
+ $mlw_leaderboard_quiz_id = $_POST["leaderboard_quiz_id"];
211
+ $mlw_leaderboard_saved = $_POST["save_leaderboard_options"];
212
+
213
+ ///Submit saved options into database
214
+ if ($mlw_leaderboard_saved == "confirmation")
215
+ {
216
+ $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET leaderboard_template='".$mlw_leaderboard_template."' WHERE quiz_id=".$mlw_leaderboard_quiz_id;
217
+ $results = $wpdb->query( $update );
218
+ $hasUpdatedLeaderboardOptions = true;
219
+
220
+ //Insert Action Into Audit Trail
221
+ global $current_user;
222
+ get_currentuserinfo();
223
+ $table_name = $wpdb->prefix . "mlw_qm_audit_trail";
224
+ $insert = "INSERT INTO " . $table_name .
225
+ "(trail_id, action_user, action, time) " .
226
+ "VALUES (NULL , '" . $current_user->display_name . "' , 'Leaderboard Options Have Been Edited For Quiz Number ".$mlw_leaderboard_quiz_id."' , '" . date("h:i:s A m/d/Y") . "')";
227
+ $results = $wpdb->query( $insert );
228
+ }
229
 
230
 
231
  /*
321
  return false;
322
  } );
323
  });
324
+ $j(function() {
325
+ $j('#leaderboard_help_dialog').dialog({
326
+ autoOpen: false,
327
+ show: 'blind',
328
+ hide: 'explode',
329
+ buttons: {
330
+ Ok: function() {
331
+ $j(this).dialog('close');
332
+ }
333
+ }
334
+ });
335
+
336
+ $j('#leaderboard_tab_help').click(function() {
337
+ $j('#leaderboard_help_dialog').dialog('open');
338
+ return false;
339
+ } );
340
+ });
341
  $j(function() {
342
  $j( "#tabs" ).tabs();
343
  });
477
  {
478
  ?>
479
  <h2>Quiz Options For <?php echo $mlw_quiz_options->quiz_name; ?><a id="opener" href="">(?)</a></h2>
480
+ <?php if ($hasUpdatedLeaderboardOptions)
481
+ {
482
+ ?>
483
+ <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
484
+ <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
485
+ <strong>Success!</strong> Your leaderboard options for this quiz have been saved.</p>
486
+ </div>
487
+ <?php
488
+ }
489
+ ?>
490
  <?php if ($hasCreatedQuestion)
491
  {
492
  ?>
542
  <li><a href="#tabs-1">Quiz Questions</a></li>
543
  <li><a href="#tabs-2">Quiz Text</a></li>
544
  <li><a href="#tabs-3">Quiz Options</a></li>
545
+ <li><a href="#tabs-4">Quiz Leaderboard</a></li>
546
  </ul>
547
  <div id="tabs-1">
548
  <?php
1094
  </table>
1095
  <?php echo "</form>"; ?>
1096
  </div>
1097
+ <div id="tabs-4">
1098
+ <h3>Template Variables</h3>
1099
+ <table class="form-table">
1100
+ <tr>
1101
+ <td><strong>%FIRST_PLACE_NAME%</strong> - The name of the user who is in first place</td>
1102
+ <td><strong>%FIRST_PLACE_SCORE%</strong> - The score from the first place's quiz</td>
1103
+ </tr>
1104
+
1105
+ <tr>
1106
+ <td><strong>%SECOND_PLACE_NAME%</strong> - The name of the user who is in second place</td>
1107
+ <td><strong>%SECOND_PLACE_SCORE%</strong> - The score from the second place's quiz</td>
1108
+ </tr>
1109
+
1110
+ <tr>
1111
+ <td><strong>%THIRD_PLACE_NAME%</strong> - The name of the user who is in third place</td>
1112
+ <td><strong>%THIRD_PLACE_SCORE%</strong> - The score from the third place's quiz</td>
1113
+ </tr>
1114
+
1115
+ <tr>
1116
+ <td><strong>%FOURTH_PLACE_NAME%</strong> - The name of the user who is in fourth place</td>
1117
+ <td><strong>%FOURTH_PLACE_SCORE%</strong> - The score from the fourth place's quiz</td>
1118
+ </tr>
1119
+
1120
+ <tr>
1121
+ <td><strong>%FIFTH_PLACE_NAME%</strong> - The name of the user who is in fifth place</td>
1122
+ <td><strong>%FIFTH_PLACE_SCORE%</strong> - The score from the fifth place's quiz</td>
1123
+ </tr>
1124
+
1125
+ <tr>
1126
+ <td><strong>%QUIZ_NAME%</strong> - The name of the quiz</td>
1127
+ </tr>
1128
+ </table>
1129
+ <button id="save_template_button" onclick="javascript: document.quiz_leaderboard_options_form.submit();">Save Leaderboard Options</button><button id="leaderboard_tab_help">Help</button>
1130
+ <?php
1131
+ echo "<form action='" . $PHP_SELF . "' method='post' name='quiz_leaderboard_options_form'>";
1132
+ echo "<input type='hidden' name='save_leaderboard_options' value='confirmation' />";
1133
+ echo "<input type='hidden' name='leaderboard_quiz_id' value='".$quiz_id."' />";
1134
+ ?>
1135
+ <table class="form-table">
1136
+ <tr>
1137
+ <td width="30%">
1138
+ <strong>Leaderboard Template</strong>
1139
+ <br />
1140
+ <p>Allowed Variables: </p>
1141
+ <p style="margin: 2px 0">- %QUIZ_NAME%</p>
1142
+ <p style="margin: 2px 0">- %FIRST_PLACE_NAME%</p>
1143
+ <p style="margin: 2px 0">- %FIRST_PLACE_SCORE%</p>
1144
+ <p style="margin: 2px 0">- %SECOND_PLACE_NAME%</p>
1145
+ <p style="margin: 2px 0">- %SECOND_PLACE_SCORE%</p>
1146
+ <p style="margin: 2px 0">- %THIRD_PLACE_NAME%</p>
1147
+ <p style="margin: 2px 0">- %THIRD_PLACE_SCORE%</p>
1148
+ <p style="margin: 2px 0">- %FOURTH_PLACE_NAME%</p>
1149
+ <p style="margin: 2px 0">- %FOURTH_PLACE_SCORE%</p>
1150
+ <p style="margin: 2px 0">- %FIFTH_PLACE_NAME%</p>
1151
+ <p style="margin: 2px 0">- %FIFTH_PLACE_SCORE%</p>
1152
+ </td>
1153
+ <td><textarea cols="80" rows="15" id="mlw_quiz_leaderboard_template" name="mlw_quiz_leaderboard_template"><?php echo $mlw_quiz_options->leaderboard_template; ?></textarea>
1154
+ </td>
1155
+ </tr>
1156
+ </table>
1157
+ </form>
1158
+ </div>
1159
  </div>
 
1160
 
1161
  <div id="delete_dialog" title="Delete Question?" style="display:none;">
1162
  <h3><b>Are you sure you want to delete Question <span id="delete_question_id"></span>?</b></h3>
1169
  echo "</form>";
1170
  ?>
1171
  </div>
1172
+ <div id="dialog" title="Help" style="display:none;">
1173
  <h3><b>Help</b></h3>
1174
  <p>This page is used edit the questions and options for your quiz. Use the help buttons on each tab for assistance.</p>
1175
  </div>
1176
+ <div id="questions_help_dialog" title="Help" style="display:none;">
1177
  <p>The question table lists the ID of the question and the question itself.</p>
1178
  <p>To edit a question, use the Edit link below the question.</p>
1179
  <p>To add a question, click on the Add Question button. This will open a window for you to add a question. The window will ask for the question and up to 6 answers. If you are using the points system, enter in the amount of points each answer is worth. If you are using the correct system, check the answer that is the correct answer.
1180
  You can choose if you would like a comment field after the question be selecting yes to the Comment question. You can also have a hint displayed to the user. Click create question when you are finished.</p>
1181
  </div>
1182
+ <div id="templates_help_dialog" title="Help" style="display:none;">
1183
  <p>This tab is used to edit the different messages the user and admin may see.</p>
1184
  <p>The Message Displayed Before Quiz text is shown to the user at the beginning of the quiz.</p>
1185
  <p>The Message Display Before Comment Box is shown to the user right before the section the user can type in comments if that option is enabled.</p>
1189
  <p>The other templates section is for customizing the text on the submit button as well as the fields where are user can input his or her information.</p>
1190
  <p>Some templates are able to have variables inside the text. When the quiz is run, these variables will change to their values.</p>
1191
  </div>
1192
+ <div id="options_help_dialog" title="Help" style="display:none;">
1193
  <p>This tab is used to edit the different options for the quiz.</p>
1194
  <p>The system option allows you to have the quiz be graded using a correct/incorrect system or the quiz can have each answer worth different amount of points.</p>
1195
  <p>The second option asks whether you want the user to his or her score after completing the quiz.</p>
1199
  <p>The next option asks for the email address of the admin you would like the quiz to email.</p>
1200
  <p>The last option asks if you would like for the user to be able to leave comments at the end of the quiz.</p>
1201
  </div>
1202
+ <div id="leaderboard_help_dialog" title="Help" style="display:none;">
1203
+ <p>This tab is used to edit the options for the leaderboard for this quiz.</p>
1204
+ <p>Currently, you can edit the template for the leaderboard.</p>
1205
+ <p>The template is able to have variables inside the text. When the quiz is run, these variables will change to their values.</p>
1206
+ </div>
1207
 
1208
  <?php
1209
  }
includes/mlw_update.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  function mlw_quiz_update()
4
  {
5
- $data = "0.9.1";
6
  if ( ! get_option('mlw_quiz_master_version'))
7
  {
8
  add_option('mlw_quiz_master_version' , $data);
@@ -24,6 +24,22 @@ function mlw_quiz_update()
24
  $results = $wpdb->query( $update_sql );
25
  }
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  global $wpdb;
28
  $table_name = $wpdb->prefix . "mlw_questions";
29
  //Update 0.5
2
 
3
  function mlw_quiz_update()
4
  {
5
+ $data = "0.9.2";
6
  if ( ! get_option('mlw_quiz_master_version'))
7
  {
8
  add_option('mlw_quiz_master_version' , $data);
24
  $results = $wpdb->query( $update_sql );
25
  }
26
 
27
+ //Update 0.9.2
28
+ if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'leaderboard_template'") != "leaderboard_template")
29
+ {
30
+ $sql = "ALTER TABLE ".$table_name." ADD leaderboard_template TEXT NOT NULL AFTER comment_field_text";
31
+ $results = $wpdb->query( $sql );
32
+ $mlw_leaderboard_default = "<h3>Leaderboard for %QUIZ_NAME%</h3>
33
+ 1. %FIRST_PLACE_NAME%-%FIRST_PLACE_SCORE%<br />
34
+ 2. %SECOND_PLACE_NAME%-%SECOND_PLACE_SCORE%<br />
35
+ 3. %THIRD_PLACE_NAME%-%THIRD_PLACE_SCORE%<br />
36
+ 4. %FOURTH_PLACE_NAME%-%FOURTH_PLACE_SCORE%<br />
37
+ 5. %FIFTH_PLACE_NAME%-%FIFTH_PLACE_SCORE%<br />";
38
+ $update_sql = "UPDATE ".$table_name." SET leaderboard_template='".$mlw_leaderboard_default."'";
39
+ $results = $wpdb->query( $update_sql );
40
+ }
41
+
42
+
43
  global $wpdb;
44
  $table_name = $wpdb->prefix . "mlw_questions";
45
  //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: 0.9.1
7
  Author: Frank Corso
8
  Author URI: http://www.mylocalwebstop.com/
9
  Plugin URI: http://www.mylocalwebstop.com/
3
  /*
4
  Plugin Name: Quiz Master Next
5
  Description: Use this plugin to add multiple quizzes, tests, or surveys to your website.
6
+ Version: 0.9.2
7
  Author: Frank Corso
8
  Author URI: http://www.mylocalwebstop.com/
9
  Plugin URI: http://www.mylocalwebstop.com/
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Quiz Master Next ===
2
  Contributors: fpcorso
3
- Tags: quiz, test, score, survey
4
  Requires at least: 3.0.1
5
  Tested up to: 3.8
6
- Stable tag: 0.9.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.
@@ -51,6 +51,12 @@ Feel free to use the support option on the main page of the plugin or from the c
51
 
52
  == Changelog ==
53
 
 
 
 
 
 
 
54
  = 0.9.1 (January 8, 2014) =
55
  * Fixed Leaderboard Design Bug
56
  * Fixed Contact Information Design Bug
@@ -171,6 +177,9 @@ Feel free to use the support option on the main page of the plugin or from the c
171
 
172
  == Upgrade Notice ==
173
 
 
 
 
174
  = 0.9.1 =
175
  Upgrade for several bug fixes and new ability to have logged in users not have to enter contact information
176
 
1
  === Quiz Master Next ===
2
  Contributors: fpcorso
3
+ Tags: quiz, test, score, survey, contact
4
  Requires at least: 3.0.1
5
  Tested up to: 3.8
6
+ Stable tag: 0.9.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.
51
 
52
  == Changelog ==
53
 
54
+ = 0.9.2 (January 12, 2014) =
55
+ * Updated Weekly Stat Widget
56
+ * Begun Work On Monthly Stat Widget
57
+ * Added Ability To Edit Leaderboard Template
58
+ * Bug Fixes
59
+
60
  = 0.9.1 (January 8, 2014) =
61
  * Fixed Leaderboard Design Bug
62
  * Fixed Contact Information Design Bug
177
 
178
  == Upgrade Notice ==
179
 
180
+ = 0.9.2 =
181
+ Upgrade for several enhanced stat widgets and the ability to edit leaderboard templates!
182
+
183
  = 0.9.1 =
184
  Upgrade for several bug fixes and new ability to have logged in users not have to enter contact information
185