Version Description
Upgrade to use new leaderboard widet! Also, added ability to reset stats for quizzes from Quiz Options page. Added ability to delete results as well. Minor design changes and bug fixes.
Download this release
Release Info
Developer | fpcorso |
Plugin | Quiz And Survey Master (Formerly Quiz Master Next) |
Version | 0.9.8 |
Comparing to | |
See all releases |
Code changes from version 0.9.7 to 0.9.8
- includes/mlw_dashboard.php +24 -21
- includes/mlw_qmn_widgets.php +116 -0
- includes/mlw_quiz_admin.php +1 -1
- includes/mlw_quiz_options.php +70 -1
- includes/mlw_results.php +64 -3
- includes/mlw_update.php +1 -1
- mlw_quizmaster2.php +3 -1
- readme.txt +13 -2
includes/mlw_dashboard.php
CHANGED
@@ -125,7 +125,7 @@ function mlw_generate_quiz_dashboard(){
|
|
125 |
<h2>Quiz Master Next <?php _e("Dashboard", "mlw_qmn_text_domain"); ?><a id="opener" href="">(?)</a></h2>
|
126 |
|
127 |
<h3>Version <?php echo $mlw_quiz_version; ?></h3>
|
128 |
-
<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
|
129 |
|
130 |
<div style="float:left; width:60%;" class="inner-sidebar1">
|
131 |
<?php do_meta_boxes('quiz_wpss','advanced',''); ?>
|
@@ -188,43 +188,43 @@ function mlw_dashboard_box()
|
|
188 |
{
|
189 |
//Gather the weekly stats, one variable for each day for the graph
|
190 |
global $wpdb;
|
191 |
-
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".date("Y-m-d")." 00:00:00' AND '".date("Y-m-d")." 23:59:59')";
|
192 |
$mlw_quiz_taken_today = $wpdb->get_results($sql);
|
193 |
$mlw_quiz_taken_today = $wpdb->num_rows;
|
194 |
|
195 |
$mlw_yesterday = mktime(0, 0, 0, date("m") , date("d")-1, date("Y"));
|
196 |
$mlw_yesterday = date("Y-m-d", $mlw_yesterday);
|
197 |
-
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_yesterday." 00:00:00' AND '".$mlw_yesterday." 23:59:59')";
|
198 |
$mlw_quiz_taken_yesterday = $wpdb->get_results($sql);
|
199 |
$mlw_quiz_taken_yesterday = $wpdb->num_rows;
|
200 |
|
201 |
$mlw_three_days_ago = mktime(0, 0, 0, date("m") , date("d")-2, date("Y"));
|
202 |
$mlw_three_days_ago = date("Y-m-d", $mlw_three_days_ago);
|
203 |
-
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_three_days_ago." 00:00:00' AND '".$mlw_three_days_ago." 23:59:59')";
|
204 |
$mlw_quiz_taken_three_days = $wpdb->get_results($sql);
|
205 |
$mlw_quiz_taken_three_days = $wpdb->num_rows;
|
206 |
|
207 |
$mlw_four_days_ago = mktime(0, 0, 0, date("m") , date("d")-3, date("Y"));
|
208 |
$mlw_four_days_ago = date("Y-m-d", $mlw_four_days_ago);
|
209 |
-
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_four_days_ago." 00:00:00' AND '".$mlw_four_days_ago." 23:59:59')";
|
210 |
$mlw_quiz_taken_four_days = $wpdb->get_results($sql);
|
211 |
$mlw_quiz_taken_four_days = $wpdb->num_rows;
|
212 |
|
213 |
$mlw_five_days_ago = mktime(0, 0, 0, date("m") , date("d")-4, date("Y"));
|
214 |
$mlw_five_days_ago = date("Y-m-d", $mlw_five_days_ago);
|
215 |
-
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_five_days_ago." 00:00:00' AND '".$mlw_five_days_ago." 23:59:59')";
|
216 |
$mlw_quiz_taken_five_days = $wpdb->get_results($sql);
|
217 |
$mlw_quiz_taken_five_days = $wpdb->num_rows;
|
218 |
|
219 |
$mlw_six_days_ago = mktime(0, 0, 0, date("m") , date("d")-5, date("Y"));
|
220 |
$mlw_six_days_ago = date("Y-m-d", $mlw_six_days_ago);
|
221 |
-
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_six_days_ago." 00:00:00' AND '".$mlw_six_days_ago." 23:59:59')";
|
222 |
$mlw_quiz_taken_six_days = $wpdb->get_results($sql);
|
223 |
$mlw_quiz_taken_six_days = $wpdb->num_rows;
|
224 |
|
225 |
$mlw_last_week = mktime(0, 0, 0, date("m") , date("d")-6, date("Y"));
|
226 |
$mlw_last_week = date("Y-m-d", $mlw_last_week);
|
227 |
-
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_last_week." 00:00:00' AND '".$mlw_last_week." 23:59:59')";
|
228 |
$mlw_quiz_taken_week = $wpdb->get_results($sql);
|
229 |
$mlw_quiz_taken_week = $wpdb->num_rows;
|
230 |
?>
|
@@ -322,7 +322,7 @@ function mlw_dashboard_box_four()
|
|
322 |
global $wpdb;
|
323 |
$mlw_this_week = mktime(0, 0, 0, date("m") , date("d")-6, date("Y"));
|
324 |
$mlw_this_week = date("Y-m-d", $mlw_this_week);
|
325 |
-
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_this_week." 00:00:00' AND '".date("Y-m-d")." 23:59:59')";
|
326 |
$mlw_quiz_taken_this_week = $wpdb->get_results($sql);
|
327 |
$mlw_quiz_taken_this_week = $wpdb->num_rows;
|
328 |
|
@@ -330,7 +330,7 @@ function mlw_dashboard_box_four()
|
|
330 |
$mlw_last_week_first = date("Y-m-d", $mlw_last_week_first);
|
331 |
$mlw_last_week_last = mktime(0, 0, 0, date("m") , date("d")-7, date("Y"));
|
332 |
$mlw_last_week_last = date("Y-m-d", $mlw_last_week_last);
|
333 |
-
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_last_week_first." 00:00:00' AND '".$mlw_last_week_last." 23:59:59')";
|
334 |
$mlw_quiz_taken_last_week = $wpdb->get_results($sql);
|
335 |
$mlw_quiz_taken_last_week = $wpdb->num_rows;
|
336 |
|
@@ -338,7 +338,7 @@ function mlw_dashboard_box_four()
|
|
338 |
$mlw_two_week_first = date("Y-m-d", $mlw_two_week_first);
|
339 |
$mlw_two_week_last = mktime(0, 0, 0, date("m") , date("d")-14, date("Y"));
|
340 |
$mlw_two_week_last = date("Y-m-d", $mlw_two_week_last);
|
341 |
-
$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')";
|
342 |
$mlw_quiz_taken_two_week = $wpdb->get_results($sql);
|
343 |
$mlw_quiz_taken_two_week = $wpdb->num_rows;
|
344 |
|
@@ -346,7 +346,7 @@ function mlw_dashboard_box_four()
|
|
346 |
$mlw_three_week_first = date("Y-m-d", $mlw_three_week_first);
|
347 |
$mlw_three_week_last = mktime(0, 0, 0, date("m") , date("d")-21, date("Y"));
|
348 |
$mlw_three_week_last = date("Y-m-d", $mlw_three_week_last);
|
349 |
-
$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')";
|
350 |
$mlw_quiz_taken_three_week = $wpdb->get_results($sql);
|
351 |
$mlw_quiz_taken_three_week = $wpdb->num_rows;
|
352 |
?>
|
@@ -361,7 +361,7 @@ function mlw_dashboard_box_five()
|
|
361 |
global $wpdb;
|
362 |
$mlw_this_month = mktime(0, 0, 0, date("m") , date("d")-30, date("Y"));
|
363 |
$mlw_this_month = date("Y-m-d", $mlw_this_month);
|
364 |
-
$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')";
|
365 |
$mlw_quiz_taken_this_month = $wpdb->get_results($sql);
|
366 |
$mlw_quiz_taken_this_month = $wpdb->num_rows;
|
367 |
|
@@ -369,7 +369,7 @@ function mlw_dashboard_box_five()
|
|
369 |
$mlw_last_month_first = date("Y-m-d", $mlw_last_month_first);
|
370 |
$mlw_last_month_last = mktime(0, 0, 0, date("m") , date("d")-31, date("Y"));
|
371 |
$mlw_last_month_last = date("Y-m-d", $mlw_last_month_last);
|
372 |
-
$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')";
|
373 |
$mlw_quiz_taken_last_month = $wpdb->get_results($sql);
|
374 |
$mlw_quiz_taken_last_month = $wpdb->num_rows;
|
375 |
|
@@ -377,7 +377,7 @@ function mlw_dashboard_box_five()
|
|
377 |
$mlw_two_month_first = date("Y-m-d", $mlw_two_month_first);
|
378 |
$mlw_two_month_last = mktime(0, 0, 0, date("m") , date("d")-31, date("Y"));
|
379 |
$mlw_two_month_last = date("Y-m-d", $mlw_two_month_last);
|
380 |
-
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_two_month_first." 00:00:00' AND '".$mlw_two_month_last." 23:59:59')";
|
381 |
$mlw_quiz_taken_two_month = $wpdb->get_results($sql);
|
382 |
$mlw_quiz_taken_two_month = $wpdb->num_rows;
|
383 |
|
@@ -385,7 +385,7 @@ function mlw_dashboard_box_five()
|
|
385 |
$mlw_three_month_first = date("Y-m-d", $mlw_three_month_first);
|
386 |
$mlw_three_month_last = mktime(0, 0, 0, date("m") , date("d")-61, date("Y"));
|
387 |
$mlw_three_month_last = date("Y-m-d", $mlw_three_month_last);
|
388 |
-
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_three_month_first." 00:00:00' AND '".$mlw_three_month_last." 23:59:59')";
|
389 |
$mlw_quiz_taken_three_month = $wpdb->get_results($sql);
|
390 |
$mlw_quiz_taken_three_month = $wpdb->num_rows;
|
391 |
|
@@ -393,7 +393,7 @@ function mlw_dashboard_box_five()
|
|
393 |
$mlw_four_month_first = date("Y-m-d", $mlw_four_month_first);
|
394 |
$mlw_four_month_last = mktime(0, 0, 0, date("m") , date("d")-91, date("Y"));
|
395 |
$mlw_four_month_last = date("Y-m-d", $mlw_four_month_last);
|
396 |
-
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_four_month_first." 00:00:00' AND '".$mlw_four_month_last." 23:59:59')";
|
397 |
$mlw_quiz_taken_four_month = $wpdb->get_results($sql);
|
398 |
$mlw_quiz_taken_four_month = $wpdb->num_rows;
|
399 |
|
@@ -410,16 +410,19 @@ function mlw_dashboard_box_six()
|
|
410 |
<div>
|
411 |
<table width='100%'>
|
412 |
<tr>
|
413 |
-
<td align='left'>0.9.
|
414 |
</tr>
|
415 |
<tr>
|
416 |
-
<td align='left'>*
|
417 |
</tr>
|
418 |
<tr>
|
419 |
-
<td align='left'>*
|
420 |
</tr>
|
421 |
<tr>
|
422 |
-
<td align='left'>*
|
|
|
|
|
|
|
423 |
</tr>
|
424 |
<tr>
|
425 |
<td align='left'>* Minor Bug Fixes</td>
|
125 |
<h2>Quiz Master Next <?php _e("Dashboard", "mlw_qmn_text_domain"); ?><a id="opener" href="">(?)</a></h2>
|
126 |
|
127 |
<h3>Version <?php echo $mlw_quiz_version; ?></h3>
|
128 |
+
<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>
|
129 |
|
130 |
<div style="float:left; width:60%;" class="inner-sidebar1">
|
131 |
<?php do_meta_boxes('quiz_wpss','advanced',''); ?>
|
188 |
{
|
189 |
//Gather the weekly stats, one variable for each day for the graph
|
190 |
global $wpdb;
|
191 |
+
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".date("Y-m-d")." 00:00:00' AND '".date("Y-m-d")." 23:59:59') AND deleted=0";
|
192 |
$mlw_quiz_taken_today = $wpdb->get_results($sql);
|
193 |
$mlw_quiz_taken_today = $wpdb->num_rows;
|
194 |
|
195 |
$mlw_yesterday = mktime(0, 0, 0, date("m") , date("d")-1, date("Y"));
|
196 |
$mlw_yesterday = date("Y-m-d", $mlw_yesterday);
|
197 |
+
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_yesterday." 00:00:00' AND '".$mlw_yesterday." 23:59:59') AND deleted=0";
|
198 |
$mlw_quiz_taken_yesterday = $wpdb->get_results($sql);
|
199 |
$mlw_quiz_taken_yesterday = $wpdb->num_rows;
|
200 |
|
201 |
$mlw_three_days_ago = mktime(0, 0, 0, date("m") , date("d")-2, date("Y"));
|
202 |
$mlw_three_days_ago = date("Y-m-d", $mlw_three_days_ago);
|
203 |
+
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_three_days_ago." 00:00:00' AND '".$mlw_three_days_ago." 23:59:59') AND deleted=0";
|
204 |
$mlw_quiz_taken_three_days = $wpdb->get_results($sql);
|
205 |
$mlw_quiz_taken_three_days = $wpdb->num_rows;
|
206 |
|
207 |
$mlw_four_days_ago = mktime(0, 0, 0, date("m") , date("d")-3, date("Y"));
|
208 |
$mlw_four_days_ago = date("Y-m-d", $mlw_four_days_ago);
|
209 |
+
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_four_days_ago." 00:00:00' AND '".$mlw_four_days_ago." 23:59:59') AND deleted=0";
|
210 |
$mlw_quiz_taken_four_days = $wpdb->get_results($sql);
|
211 |
$mlw_quiz_taken_four_days = $wpdb->num_rows;
|
212 |
|
213 |
$mlw_five_days_ago = mktime(0, 0, 0, date("m") , date("d")-4, date("Y"));
|
214 |
$mlw_five_days_ago = date("Y-m-d", $mlw_five_days_ago);
|
215 |
+
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_five_days_ago." 00:00:00' AND '".$mlw_five_days_ago." 23:59:59') AND deleted=0";
|
216 |
$mlw_quiz_taken_five_days = $wpdb->get_results($sql);
|
217 |
$mlw_quiz_taken_five_days = $wpdb->num_rows;
|
218 |
|
219 |
$mlw_six_days_ago = mktime(0, 0, 0, date("m") , date("d")-5, date("Y"));
|
220 |
$mlw_six_days_ago = date("Y-m-d", $mlw_six_days_ago);
|
221 |
+
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_six_days_ago." 00:00:00' AND '".$mlw_six_days_ago." 23:59:59') AND deleted=0";
|
222 |
$mlw_quiz_taken_six_days = $wpdb->get_results($sql);
|
223 |
$mlw_quiz_taken_six_days = $wpdb->num_rows;
|
224 |
|
225 |
$mlw_last_week = mktime(0, 0, 0, date("m") , date("d")-6, date("Y"));
|
226 |
$mlw_last_week = date("Y-m-d", $mlw_last_week);
|
227 |
+
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_last_week." 00:00:00' AND '".$mlw_last_week." 23:59:59') AND deleted=0";
|
228 |
$mlw_quiz_taken_week = $wpdb->get_results($sql);
|
229 |
$mlw_quiz_taken_week = $wpdb->num_rows;
|
230 |
?>
|
322 |
global $wpdb;
|
323 |
$mlw_this_week = mktime(0, 0, 0, date("m") , date("d")-6, date("Y"));
|
324 |
$mlw_this_week = date("Y-m-d", $mlw_this_week);
|
325 |
+
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_this_week." 00:00:00' AND '".date("Y-m-d")." 23:59:59') AND deleted=0";
|
326 |
$mlw_quiz_taken_this_week = $wpdb->get_results($sql);
|
327 |
$mlw_quiz_taken_this_week = $wpdb->num_rows;
|
328 |
|
330 |
$mlw_last_week_first = date("Y-m-d", $mlw_last_week_first);
|
331 |
$mlw_last_week_last = mktime(0, 0, 0, date("m") , date("d")-7, date("Y"));
|
332 |
$mlw_last_week_last = date("Y-m-d", $mlw_last_week_last);
|
333 |
+
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_last_week_first." 00:00:00' AND '".$mlw_last_week_last." 23:59:59') AND deleted=0";
|
334 |
$mlw_quiz_taken_last_week = $wpdb->get_results($sql);
|
335 |
$mlw_quiz_taken_last_week = $wpdb->num_rows;
|
336 |
|
338 |
$mlw_two_week_first = date("Y-m-d", $mlw_two_week_first);
|
339 |
$mlw_two_week_last = mktime(0, 0, 0, date("m") , date("d")-14, date("Y"));
|
340 |
$mlw_two_week_last = date("Y-m-d", $mlw_two_week_last);
|
341 |
+
$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') AND deleted=0";
|
342 |
$mlw_quiz_taken_two_week = $wpdb->get_results($sql);
|
343 |
$mlw_quiz_taken_two_week = $wpdb->num_rows;
|
344 |
|
346 |
$mlw_three_week_first = date("Y-m-d", $mlw_three_week_first);
|
347 |
$mlw_three_week_last = mktime(0, 0, 0, date("m") , date("d")-21, date("Y"));
|
348 |
$mlw_three_week_last = date("Y-m-d", $mlw_three_week_last);
|
349 |
+
$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') AND deleted=0";
|
350 |
$mlw_quiz_taken_three_week = $wpdb->get_results($sql);
|
351 |
$mlw_quiz_taken_three_week = $wpdb->num_rows;
|
352 |
?>
|
361 |
global $wpdb;
|
362 |
$mlw_this_month = mktime(0, 0, 0, date("m") , date("d")-30, date("Y"));
|
363 |
$mlw_this_month = date("Y-m-d", $mlw_this_month);
|
364 |
+
$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') AND deleted=0";
|
365 |
$mlw_quiz_taken_this_month = $wpdb->get_results($sql);
|
366 |
$mlw_quiz_taken_this_month = $wpdb->num_rows;
|
367 |
|
369 |
$mlw_last_month_first = date("Y-m-d", $mlw_last_month_first);
|
370 |
$mlw_last_month_last = mktime(0, 0, 0, date("m") , date("d")-31, date("Y"));
|
371 |
$mlw_last_month_last = date("Y-m-d", $mlw_last_month_last);
|
372 |
+
$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') AND deleted=0";
|
373 |
$mlw_quiz_taken_last_month = $wpdb->get_results($sql);
|
374 |
$mlw_quiz_taken_last_month = $wpdb->num_rows;
|
375 |
|
377 |
$mlw_two_month_first = date("Y-m-d", $mlw_two_month_first);
|
378 |
$mlw_two_month_last = mktime(0, 0, 0, date("m") , date("d")-31, date("Y"));
|
379 |
$mlw_two_month_last = date("Y-m-d", $mlw_two_month_last);
|
380 |
+
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_two_month_first." 00:00:00' AND '".$mlw_two_month_last." 23:59:59') AND deleted=0";
|
381 |
$mlw_quiz_taken_two_month = $wpdb->get_results($sql);
|
382 |
$mlw_quiz_taken_two_month = $wpdb->num_rows;
|
383 |
|
385 |
$mlw_three_month_first = date("Y-m-d", $mlw_three_month_first);
|
386 |
$mlw_three_month_last = mktime(0, 0, 0, date("m") , date("d")-61, date("Y"));
|
387 |
$mlw_three_month_last = date("Y-m-d", $mlw_three_month_last);
|
388 |
+
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_three_month_first." 00:00:00' AND '".$mlw_three_month_last." 23:59:59') AND deleted=0";
|
389 |
$mlw_quiz_taken_three_month = $wpdb->get_results($sql);
|
390 |
$mlw_quiz_taken_three_month = $wpdb->num_rows;
|
391 |
|
393 |
$mlw_four_month_first = date("Y-m-d", $mlw_four_month_first);
|
394 |
$mlw_four_month_last = mktime(0, 0, 0, date("m") , date("d")-91, date("Y"));
|
395 |
$mlw_four_month_last = date("Y-m-d", $mlw_four_month_last);
|
396 |
+
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_four_month_first." 00:00:00' AND '".$mlw_four_month_last." 23:59:59') AND deleted=0";
|
397 |
$mlw_quiz_taken_four_month = $wpdb->get_results($sql);
|
398 |
$mlw_quiz_taken_four_month = $wpdb->num_rows;
|
399 |
|
410 |
<div>
|
411 |
<table width='100%'>
|
412 |
<tr>
|
413 |
+
<td align='left'>0.9.8 (January 25, 2014)</td>
|
414 |
</tr>
|
415 |
<tr>
|
416 |
+
<td align='left'>* Added Leaderboard Widget</td>
|
417 |
</tr>
|
418 |
<tr>
|
419 |
+
<td align='left'>* Added Ability To Reset Quiz Stats On Each Quiz</td>
|
420 |
</tr>
|
421 |
<tr>
|
422 |
+
<td align='left'>* Added Ability To Delete Results</td>
|
423 |
+
</tr>
|
424 |
+
<tr>
|
425 |
+
<td align='left'>* Minor Design Changes</td>
|
426 |
</tr>
|
427 |
<tr>
|
428 |
<td align='left'>* Minor Bug Fixes</td>
|
includes/mlw_qmn_widgets.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
This is the file that contains all the widgets for the plugin
|
4 |
+
*/
|
5 |
+
|
6 |
+
class Mlw_Qmn_Leaderboard_Widget extends WP_Widget {
|
7 |
+
|
8 |
+
// constructor
|
9 |
+
function Mlw_Qmn_Leaderboard_Widget() {
|
10 |
+
parent::WP_Widget(false, $name = __('Quiz Master Next Leaderboard Widget', 'mlw_qmn_text_domain'));
|
11 |
+
}
|
12 |
+
|
13 |
+
// widget form creation
|
14 |
+
function form($instance) {
|
15 |
+
// Check values
|
16 |
+
if( $instance) {
|
17 |
+
$title = esc_attr($instance['title']);
|
18 |
+
$quiz_id = esc_attr($instance['quiz_id']);
|
19 |
+
} else {
|
20 |
+
$title = '';
|
21 |
+
$quiz_id = '';
|
22 |
+
}
|
23 |
+
?>
|
24 |
+
<p>
|
25 |
+
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title', 'mlw_qmn_text_domain'); ?></label>
|
26 |
+
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
|
27 |
+
</p>
|
28 |
+
<p>
|
29 |
+
<label for="<?php echo $this->get_field_id('quiz_id'); ?>"><?php _e('Quiz ID', 'mlw_qmn_text_domain'); ?></label>
|
30 |
+
<input class="widefat" id="<?php echo $this->get_field_id('quiz_id'); ?>" name="<?php echo $this->get_field_name('quiz_id'); ?>" type="number" step="1" min="1" value="<?php echo $quiz_id; ?>" />
|
31 |
+
</p>
|
32 |
+
<?php
|
33 |
+
}
|
34 |
+
|
35 |
+
// widget update
|
36 |
+
function update($new_instance, $old_instance) {
|
37 |
+
$instance = $old_instance;
|
38 |
+
// Fields
|
39 |
+
$instance['title'] = strip_tags($new_instance['title']);
|
40 |
+
$instance['quiz_id'] = strip_tags($new_instance['quiz_id']);
|
41 |
+
return $instance;
|
42 |
+
}
|
43 |
+
|
44 |
+
// widget display
|
45 |
+
function widget($args, $instance) {
|
46 |
+
extract( $args );
|
47 |
+
// these are the widget options
|
48 |
+
$title = apply_filters('widget_title', $instance['title']);
|
49 |
+
$quiz_id = $instance['quiz_id'];
|
50 |
+
echo $before_widget;
|
51 |
+
// Display the widget
|
52 |
+
echo '<div class="widget-text wp_widget_plugin_box">';
|
53 |
+
// Check if title is set
|
54 |
+
if ( $title ) {
|
55 |
+
echo $before_title . $title . $after_title;
|
56 |
+
}
|
57 |
+
$mlw_quiz_id = $quiz_id;
|
58 |
+
$mlw_quiz_leaderboard_display = "";
|
59 |
+
|
60 |
+
|
61 |
+
global $wpdb;
|
62 |
+
$sql = "SELECT * FROM " . $wpdb->prefix . "mlw_quizzes" . " WHERE quiz_id=".$mlw_quiz_id." AND deleted='0'";
|
63 |
+
$mlw_quiz_options = $wpdb->get_results($sql);
|
64 |
+
foreach($mlw_quiz_options as $mlw_eaches) {
|
65 |
+
$mlw_quiz_options = $mlw_eaches;
|
66 |
+
break;
|
67 |
+
}
|
68 |
+
$sql = "SELECT * FROM " . $wpdb->prefix . "mlw_results WHERE quiz_id=".$mlw_quiz_id." AND deleted='0' LIMIT 10";
|
69 |
+
$mlw_result_data = $wpdb->get_results($sql);
|
70 |
+
|
71 |
+
$mlw_quiz_leaderboard_display = $mlw_quiz_options->leaderboard_template;
|
72 |
+
$mlw_quiz_leaderboard_display = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_quiz_leaderboard_display);
|
73 |
+
|
74 |
+
$leader_count = 0;
|
75 |
+
foreach($mlw_result_data as $mlw_eaches) {
|
76 |
+
$leader_count++;
|
77 |
+
if ($leader_count == 1) {$mlw_quiz_leaderboard_display = str_replace( "%FIRST_PLACE_NAME%" , $mlw_eaches->name, $mlw_quiz_leaderboard_display);}
|
78 |
+
if ($leader_count == 2) {$mlw_quiz_leaderboard_display = str_replace( "%SECOND_PLACE_NAME%" , $mlw_eaches->name, $mlw_quiz_leaderboard_display);}
|
79 |
+
if ($leader_count == 3) {$mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_NAME%" , $mlw_eaches->name, $mlw_quiz_leaderboard_display);}
|
80 |
+
if ($leader_count == 4) {$mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_NAME%" , $mlw_eaches->name, $mlw_quiz_leaderboard_display);}
|
81 |
+
if ($leader_count == 5) {$mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_NAME%" , $mlw_eaches->name, $mlw_quiz_leaderboard_display);}
|
82 |
+
if ($mlw_quiz_options->system == 0)
|
83 |
+
{
|
84 |
+
if ($leader_count == 1) {$mlw_quiz_leaderboard_display = str_replace( "%FIRST_PLACE_SCORE%" , $mlw_eaches->correct_score."%", $mlw_quiz_leaderboard_display);}
|
85 |
+
if ($leader_count == 2) {$mlw_quiz_leaderboard_display = str_replace( "%SECOND_PLACE_SCORE%" , $mlw_eaches->correct_score."%", $mlw_quiz_leaderboard_display);}
|
86 |
+
if ($leader_count == 3) {$mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_SCORE%" , $mlw_eaches->correct_score."%", $mlw_quiz_leaderboard_display);}
|
87 |
+
if ($leader_count == 4) {$mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_SCORE%" , $mlw_eaches->correct_score."%", $mlw_quiz_leaderboard_display);}
|
88 |
+
if ($leader_count == 5) {$mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_SCORE%" , $mlw_eaches->correct_score."%", $mlw_quiz_leaderboard_display);}
|
89 |
+
}
|
90 |
+
if ($mlw_quiz_options->system == 1)
|
91 |
+
{
|
92 |
+
if ($leader_count == 1) {$mlw_quiz_leaderboard_display = str_replace( "%FIRST_PLACE_SCORE%" , $mlw_eaches->point_score." Points", $mlw_quiz_leaderboard_display);}
|
93 |
+
if ($leader_count == 2) {$mlw_quiz_leaderboard_display = str_replace( "%SECOND_PLACE_SCORE%" , $mlw_eaches->point_score." Points", $mlw_quiz_leaderboard_display);}
|
94 |
+
if ($leader_count == 3) {$mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_SCORE%" , $mlw_eaches->point_score." Points", $mlw_quiz_leaderboard_display);}
|
95 |
+
if ($leader_count == 4) {$mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_SCORE%" , $mlw_eaches->point_score." Points", $mlw_quiz_leaderboard_display);}
|
96 |
+
if ($leader_count == 5) {$mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_SCORE%" , $mlw_eaches->point_score." Points", $mlw_quiz_leaderboard_display);}
|
97 |
+
}
|
98 |
+
}
|
99 |
+
$mlw_quiz_leaderboard_display = str_replace( "%QUIZ_NAME%" , " ", $mlw_quiz_leaderboard_display);
|
100 |
+
$mlw_quiz_leaderboard_display = str_replace( "%FIRST_PLACE_NAME%" , " ", $mlw_quiz_leaderboard_display);
|
101 |
+
$mlw_quiz_leaderboard_display = str_replace( "%SECOND_PLACE_NAME%" , " ", $mlw_quiz_leaderboard_display);
|
102 |
+
$mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_NAME%" , " ", $mlw_quiz_leaderboard_display);
|
103 |
+
$mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_NAME%" , " ", $mlw_quiz_leaderboard_display);
|
104 |
+
$mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_NAME%" , " ", $mlw_quiz_leaderboard_display);
|
105 |
+
$mlw_quiz_leaderboard_display = str_replace( "%FIRST_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
|
106 |
+
$mlw_quiz_leaderboard_display = str_replace( "%SECOND_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
|
107 |
+
$mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
|
108 |
+
$mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
|
109 |
+
$mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
|
110 |
+
|
111 |
+
echo $mlw_quiz_leaderboard_display;
|
112 |
+
echo '</div>';
|
113 |
+
echo $after_widget;
|
114 |
+
}
|
115 |
+
}
|
116 |
+
?>
|
includes/mlw_quiz_admin.php
CHANGED
@@ -168,7 +168,7 @@ function mlw_generate_quiz_admin()
|
|
168 |
var idHiddenName = document.getElementById("delete_quiz_name");
|
169 |
idText.innerHTML = id;
|
170 |
idHidden.value = id;
|
171 |
-
idHiddenName = quizName;
|
172 |
};
|
173 |
function editQuizName(id, quizName){
|
174 |
$j("#edit_dialog").dialog({
|
168 |
var idHiddenName = document.getElementById("delete_quiz_name");
|
169 |
idText.innerHTML = id;
|
170 |
idHidden.value = id;
|
171 |
+
idHiddenName.value = quizName;
|
172 |
};
|
173 |
function editQuizName(id, quizName){
|
174 |
$j("#edit_dialog").dialog({
|
includes/mlw_quiz_options.php
CHANGED
@@ -230,6 +230,32 @@ function mlw_generate_quiz_options()
|
|
230 |
"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") . "')";
|
231 |
$results = $wpdb->query( $insert );
|
232 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
|
234 |
|
235 |
/*
|
@@ -346,6 +372,24 @@ function mlw_generate_quiz_options()
|
|
346 |
return false;
|
347 |
} );
|
348 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
$j(function() {
|
350 |
$j( "#tabs" ).tabs();
|
351 |
});
|
@@ -555,12 +599,23 @@ function mlw_generate_quiz_options()
|
|
555 |
<?php
|
556 |
}
|
557 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
558 |
<div id="tabs">
|
559 |
<ul>
|
560 |
<li><a href="#tabs-1">Quiz Questions</a></li>
|
561 |
<li><a href="#tabs-2">Quiz Text</a></li>
|
562 |
<li><a href="#tabs-3">Quiz Options</a></li>
|
563 |
<li><a href="#tabs-4">Quiz Leaderboard</a></li>
|
|
|
564 |
</ul>
|
565 |
<div id="tabs-1">
|
566 |
<button id="new_question_button_two">Add Question</button><button id="question_tab_help">Help</button>
|
@@ -572,7 +627,7 @@ function mlw_generate_quiz_options()
|
|
572 |
else $alternate = " class=\"alternate\"";
|
573 |
$question_list .= "<tr{$alternate}>";
|
574 |
$question_list .= "<td><span style='font-size:16px;'>" . $mlw_question_info->question_order . "</span></td>";
|
575 |
-
$question_list .= "<td class='post-title column-title'><span style='font-size:16px;'>" . $mlw_question_info->question_name ."</span><div><span style='color:green;font-size:12px;'><a onclick=\"editQuestion('".$mlw_question_info->question_id."','".str_replace('"', '
|
576 |
$question_list .= "</tr>";
|
577 |
}
|
578 |
|
@@ -1226,6 +1281,20 @@ function mlw_generate_quiz_options()
|
|
1226 |
<button id="save_template_button" onclick="javascript: document.quiz_leaderboard_options_form.submit();">Save Leaderboard Options</button>
|
1227 |
</form>
|
1228 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1229 |
</div>
|
1230 |
|
1231 |
<div id="delete_dialog" title="Delete Question?" style="display:none;">
|
230 |
"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") . "')";
|
231 |
$results = $wpdb->query( $insert );
|
232 |
}
|
233 |
+
|
234 |
+
|
235 |
+
/*
|
236 |
+
Code For Quiz Tools Tab
|
237 |
+
*/
|
238 |
+
|
239 |
+
//Variables from reset stats form
|
240 |
+
$mlw_reset_confirmation = $_POST["mlw_reset_quiz_stats"];
|
241 |
+
$mlw_reset_stats_quiz_id = $_POST["mlw_reset_quiz_id"];
|
242 |
+
|
243 |
+
//Update Quiz Table
|
244 |
+
if ($mlw_reset_confirmation == "confirmation")
|
245 |
+
{
|
246 |
+
$mlw_reset_update_sql = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET quiz_views=0, quiz_taken=0 WHERE quiz_id=".$mlw_reset_stats_quiz_id;
|
247 |
+
$mlw_reset_sql_results = $wpdb->query( $mlw_reset_update_sql );
|
248 |
+
$mlw_hasResetQuizStats = true;
|
249 |
+
|
250 |
+
//Insert Action Into Audit Trail
|
251 |
+
global $current_user;
|
252 |
+
get_currentuserinfo();
|
253 |
+
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
254 |
+
$insert = "INSERT INTO " . $table_name .
|
255 |
+
"(trail_id, action_user, action, time) " .
|
256 |
+
"VALUES (NULL , '" . $current_user->display_name . "' , 'Quiz Stats Have Been Reset For Quiz Number ".$mlw_leaderboard_quiz_id."' , '" . date("h:i:s A m/d/Y") . "')";
|
257 |
+
$results = $wpdb->query( $insert );
|
258 |
+
}
|
259 |
|
260 |
|
261 |
/*
|
372 |
return false;
|
373 |
} );
|
374 |
});
|
375 |
+
$j(function() {
|
376 |
+
$j('#mlw_reset_stats_dialog').dialog({
|
377 |
+
autoOpen: false,
|
378 |
+
show: 'blind',
|
379 |
+
width:700,
|
380 |
+
hide: 'explode',
|
381 |
+
buttons: {
|
382 |
+
Ok: function() {
|
383 |
+
$j(this).dialog('close');
|
384 |
+
}
|
385 |
+
}
|
386 |
+
});
|
387 |
+
|
388 |
+
$j('#mlw_reset_stats_button').click(function() {
|
389 |
+
$j('#mlw_reset_stats_dialog').dialog('open');
|
390 |
+
return false;
|
391 |
+
} );
|
392 |
+
});
|
393 |
$j(function() {
|
394 |
$j( "#tabs" ).tabs();
|
395 |
});
|
599 |
<?php
|
600 |
}
|
601 |
?>
|
602 |
+
<?php if ($mlw_hasResetQuizStats)
|
603 |
+
{
|
604 |
+
?>
|
605 |
+
<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
|
606 |
+
<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
|
607 |
+
<strong>Success!</strong> The stats for this quiz has been reset!</p>
|
608 |
+
</div>
|
609 |
+
<?php
|
610 |
+
}
|
611 |
+
?>
|
612 |
<div id="tabs">
|
613 |
<ul>
|
614 |
<li><a href="#tabs-1">Quiz Questions</a></li>
|
615 |
<li><a href="#tabs-2">Quiz Text</a></li>
|
616 |
<li><a href="#tabs-3">Quiz Options</a></li>
|
617 |
<li><a href="#tabs-4">Quiz Leaderboard</a></li>
|
618 |
+
<li><a href="#tabs-5">Quiz Tools</a></li>
|
619 |
</ul>
|
620 |
<div id="tabs-1">
|
621 |
<button id="new_question_button_two">Add Question</button><button id="question_tab_help">Help</button>
|
627 |
else $alternate = " class=\"alternate\"";
|
628 |
$question_list .= "<tr{$alternate}>";
|
629 |
$question_list .= "<td><span style='font-size:16px;'>" . $mlw_question_info->question_order . "</span></td>";
|
630 |
+
$question_list .= "<td class='post-title column-title'><span style='font-size:16px;'>" . $mlw_question_info->question_name ."</span><div><span style='color:green;font-size:12px;'><a onclick=\"editQuestion('".$mlw_question_info->question_id."','".str_replace('"', '"', str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->question_name, ENT_QUOTES)))."','".str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_one, ENT_QUOTES))."','".$mlw_question_info->answer_one_points."','".str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_two, ENT_QUOTES))."','".$mlw_question_info->answer_two_points."','".str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_three, ENT_QUOTES))."','".$mlw_question_info->answer_three_points."','".str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_four, ENT_QUOTES))."','".$mlw_question_info->answer_four_points."','".str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_five, ENT_QUOTES))."','".$mlw_question_info->answer_five_points."','".str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_six, ENT_QUOTES))."','".$mlw_question_info->answer_six_points."','".$mlw_question_info->correct_answer."','".$mlw_question_info->comments."','".$mlw_question_info->hints."', '".$mlw_question_info->question_order."', '".$mlw_question_info->question_type."')\" href='#'>Edit</a> | <a onclick=\"deleteQuestion('".$mlw_question_info->question_id."')\" href='#'>Delete</a></span></div></td>";
|
631 |
$question_list .= "</tr>";
|
632 |
}
|
633 |
|
1281 |
<button id="save_template_button" onclick="javascript: document.quiz_leaderboard_options_form.submit();">Save Leaderboard Options</button>
|
1282 |
</form>
|
1283 |
</div>
|
1284 |
+
<div id="tabs-5">
|
1285 |
+
<p>Use this button to reset all the stats collected for this quiz (Quiz Views and Times Quiz Has Been Taken). </p>
|
1286 |
+
<button id="mlw_reset_stats_button">Reset Quiz Views And Taken Stats</button>
|
1287 |
+
<div id="mlw_reset_stats_dialog" title="Reset Stats For This Quiz" style="display:none;">
|
1288 |
+
<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>
|
1289 |
+
<?php
|
1290 |
+
echo "<form action='" . $PHP_SELF . "' method='post'>";
|
1291 |
+
echo "<input type='hidden' name='mlw_reset_quiz_stats' value='confirmation' />";
|
1292 |
+
echo "<input type='hidden' name='mlw_reset_quiz_id' value='".$quiz_id."' />";
|
1293 |
+
echo "<p class='submit'><input type='submit' class='button-primary' value='Reset All Stats For Quiz' /></p>";
|
1294 |
+
echo "</form>";
|
1295 |
+
?>
|
1296 |
+
</div>
|
1297 |
+
</div>
|
1298 |
</div>
|
1299 |
|
1300 |
<div id="delete_dialog" title="Delete Question?" style="display:none;">
|
includes/mlw_results.php
CHANGED
@@ -8,7 +8,30 @@ Copyright 2013, My Local Webstop (email : fpcorso@mylocalwebstop.com)
|
|
8 |
|
9 |
function mlw_generate_quiz_results()
|
10 |
{
|
|
|
11 |
$quiz_id = $_GET["quiz_id"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
global $wpdb;
|
14 |
|
@@ -54,6 +77,23 @@ function mlw_generate_quiz_results()
|
|
54 |
$j("button").button();
|
55 |
|
56 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
</script>
|
58 |
<style>
|
59 |
label {
|
@@ -71,6 +111,16 @@ function mlw_generate_quiz_results()
|
|
71 |
<div class="wrap">
|
72 |
<div class='mlw_quiz_options'>
|
73 |
<h2>Quiz Results<a id="opener" href="">(?)</a></h2>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
<?php
|
75 |
$quotes_list = "";
|
76 |
$display = "";
|
@@ -78,7 +128,7 @@ function mlw_generate_quiz_results()
|
|
78 |
if($alternate) $alternate = "";
|
79 |
else $alternate = " class=\"alternate\"";
|
80 |
$quotes_list .= "<tr{$alternate}>";
|
81 |
-
$quotes_list .= "<td><span style='font-size:16px;'><a href='admin.php?page=mlw_quiz_result_details&&result_id=".$mlw_quiz_info->result_id."'>View</a></span></td>";
|
82 |
$quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_name . "</span></td>";
|
83 |
if ($mlw_quiz_info->quiz_system == 0)
|
84 |
{
|
@@ -102,7 +152,7 @@ function mlw_generate_quiz_results()
|
|
102 |
|
103 |
$display .= "<table class=\"widefat\">";
|
104 |
$display .= "<thead><tr>
|
105 |
-
<th>
|
106 |
<th>Quiz Name</th>
|
107 |
<th>Score</th>
|
108 |
<th>Name</th>
|
@@ -121,7 +171,18 @@ function mlw_generate_quiz_results()
|
|
121 |
<p>This page shows all of the results from the taken quizzes.</p>
|
122 |
<p>The table show the result id, the score from the quiz, the contact information provided, and the time the quiz was taken.</p>
|
123 |
<p>To get results to a specific quiz, go to quiz page and click on results from that quiz.</p>
|
124 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
</div>
|
126 |
</div>
|
127 |
<?php
|
8 |
|
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;
|
25 |
+
|
26 |
+
//Insert Action Into Audit Trail
|
27 |
+
global $current_user;
|
28 |
+
get_currentuserinfo();
|
29 |
+
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
30 |
+
$insert = "INSERT INTO " . $table_name .
|
31 |
+
"(trail_id, action_user, action, time) " .
|
32 |
+
"VALUES (NULL , '" . $current_user->display_name . "' , 'Results Has Been Deleted From: ".$mlw_delete_results_name."' , '" . date("h:i:s A m/d/Y") . "')";
|
33 |
+
$results = $wpdb->query( $insert );
|
34 |
+
}
|
35 |
|
36 |
global $wpdb;
|
37 |
|
77 |
$j("button").button();
|
78 |
|
79 |
});
|
80 |
+
function deleteResults(id,quizName){
|
81 |
+
$j("#delete_dialog").dialog({
|
82 |
+
autoOpen: false,
|
83 |
+
show: 'blind',
|
84 |
+
hide: 'explode',
|
85 |
+
buttons: {
|
86 |
+
Cancel: function() {
|
87 |
+
$j(this).dialog('close');
|
88 |
+
}
|
89 |
+
}
|
90 |
+
});
|
91 |
+
$j("#delete_dialog").dialog('open');
|
92 |
+
var idHidden = document.getElementById("result_id");
|
93 |
+
var idHiddenName = document.getElementById("delete_quiz_name");
|
94 |
+
idHidden.value = id;
|
95 |
+
idHiddenName.value = quizName;
|
96 |
+
};
|
97 |
</script>
|
98 |
<style>
|
99 |
label {
|
111 |
<div class="wrap">
|
112 |
<div class='mlw_quiz_options'>
|
113 |
<h2>Quiz Results<a id="opener" href="">(?)</a></h2>
|
114 |
+
<?php if ($mlw_hasDeletedResults)
|
115 |
+
{
|
116 |
+
?>
|
117 |
+
<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
|
118 |
+
<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
|
119 |
+
<strong>Success!</strong> Your results have been deleted.</p>
|
120 |
+
</div>
|
121 |
+
<?php
|
122 |
+
}
|
123 |
+
?>
|
124 |
<?php
|
125 |
$quotes_list = "";
|
126 |
$display = "";
|
128 |
if($alternate) $alternate = "";
|
129 |
else $alternate = " class=\"alternate\"";
|
130 |
$quotes_list .= "<tr{$alternate}>";
|
131 |
+
$quotes_list .= "<td><span style='color:green;font-size:16px;'><a href='admin.php?page=mlw_quiz_result_details&&result_id=".$mlw_quiz_info->result_id."'>View</a>|<a onclick=\"deleteResults('".$mlw_quiz_info->result_id."','".$mlw_quiz_info->quiz_name."')\" href='#'>Delete</a></span></td>";
|
132 |
$quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_name . "</span></td>";
|
133 |
if ($mlw_quiz_info->quiz_system == 0)
|
134 |
{
|
152 |
|
153 |
$display .= "<table class=\"widefat\">";
|
154 |
$display .= "<thead><tr>
|
155 |
+
<th>Actions</th>
|
156 |
<th>Quiz Name</th>
|
157 |
<th>Score</th>
|
158 |
<th>Name</th>
|
171 |
<p>This page shows all of the results from the taken quizzes.</p>
|
172 |
<p>The table show the result id, the score from the quiz, the contact information provided, and the time the quiz was taken.</p>
|
173 |
<p>To get results to a specific quiz, go to quiz page and click on results from that quiz.</p>
|
174 |
+
</div>
|
175 |
+
<div id="delete_dialog" title="Delete Results?" style="display:none;">
|
176 |
+
<h3><b>Are you sure you want to delete these results?</b></h3>
|
177 |
+
<?php
|
178 |
+
echo "<form action='" . $PHP_SELF . "' method='post'>";
|
179 |
+
echo "<input type='hidden' name='delete_results' value='confirmation' />";
|
180 |
+
echo "<input type='hidden' id='result_id' name='result_id' value='' />";
|
181 |
+
echo "<input type='hidden' id='delete_quiz_name' name='delete_quiz_name' value='' />";
|
182 |
+
echo "<p class='submit'><input type='submit' class='button-primary' value='Delete Results' /></p>";
|
183 |
+
echo "</form>";
|
184 |
+
?>
|
185 |
+
</div>
|
186 |
</div>
|
187 |
</div>
|
188 |
<?php
|
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 = "0.9.
|
10 |
if ( ! get_option('mlw_quiz_master_version'))
|
11 |
{
|
12 |
add_option('mlw_quiz_master_version' , $data);
|
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 = "0.9.8";
|
10 |
if ( ! get_option('mlw_quiz_master_version'))
|
11 |
{
|
12 |
add_option('mlw_quiz_master_version' , $data);
|
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.
|
7 |
Author: Frank Corso
|
8 |
Author URI: http://www.mylocalwebstop.com/
|
9 |
Plugin URI: http://www.mylocalwebstop.com/
|
@@ -33,11 +33,13 @@ include("includes/mlw_tools.php");
|
|
33 |
include("includes/mlw_leaderboard.php");
|
34 |
include("includes/mlw_help.php");
|
35 |
include("includes/mlw_update.php");
|
|
|
36 |
|
37 |
|
38 |
///Activation Actions
|
39 |
add_action('admin_menu', 'mlw_add_menu');
|
40 |
add_action('init', 'mlw_quiz_update');
|
|
|
41 |
add_shortcode('mlw_quizmaster', 'mlw_quiz_shortcode');
|
42 |
add_shortcode('mlw_quizmaster_leaderboard', 'mlw_quiz_leaderboard_shortcode');
|
43 |
register_activation_hook( __FILE__, 'mlw_quiz_activate');
|
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.8
|
7 |
Author: Frank Corso
|
8 |
Author URI: http://www.mylocalwebstop.com/
|
9 |
Plugin URI: http://www.mylocalwebstop.com/
|
33 |
include("includes/mlw_leaderboard.php");
|
34 |
include("includes/mlw_help.php");
|
35 |
include("includes/mlw_update.php");
|
36 |
+
include("includes/mlw_qmn_widgets.php");
|
37 |
|
38 |
|
39 |
///Activation Actions
|
40 |
add_action('admin_menu', 'mlw_add_menu');
|
41 |
add_action('init', 'mlw_quiz_update');
|
42 |
+
add_action('widgets_init', create_function('', 'return register_widget("Mlw_Qmn_Leaderboard_Widget");'));
|
43 |
add_shortcode('mlw_quizmaster', 'mlw_quiz_shortcode');
|
44 |
add_shortcode('mlw_quizmaster_leaderboard', 'mlw_quiz_leaderboard_shortcode');
|
45 |
register_activation_hook( __FILE__, 'mlw_quiz_activate');
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: fpcorso
|
|
3 |
Tags: quiz, test, score, survey, contact
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 3.8.1
|
6 |
-
Stable tag: 0.9.
|
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.
|
@@ -31,7 +31,8 @@ Features include:
|
|
31 |
* Customize templates for landing page after the quiz has been taken
|
32 |
* Customize emails that are sent to users and admins
|
33 |
* Questions can be in predetermined order or random
|
34 |
-
* Leaderboards for every quiz
|
|
|
35 |
|
36 |
== Installation ==
|
37 |
|
@@ -61,6 +62,13 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
|
|
61 |
|
62 |
== Changelog ==
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
= 0.9.7 (January 24, 2014) =
|
65 |
* Started Setting Plugin Up For Translations
|
66 |
* Relocated Widgets From Help Page To Quiz Dashboard Page
|
@@ -215,6 +223,9 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
|
|
215 |
|
216 |
== Upgrade Notice ==
|
217 |
|
|
|
|
|
|
|
218 |
= 0.9.7 =
|
219 |
Upgrade to see widgets relocated from help page to quiz dashboard page. Also, began setting plugin up for translations. Updated many help sections throughout plugin. Minor bug fixes.
|
220 |
|
3 |
Tags: quiz, test, score, survey, contact
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 3.8.1
|
6 |
+
Stable tag: 0.9.8
|
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.
|
31 |
* Customize templates for landing page after the quiz has been taken
|
32 |
* Customize emails that are sent to users and admins
|
33 |
* Questions can be in predetermined order or random
|
34 |
+
* Leaderboards for every quiz which can be used as shortcode or in included widget
|
35 |
+
|
36 |
|
37 |
== Installation ==
|
38 |
|
62 |
|
63 |
== Changelog ==
|
64 |
|
65 |
+
= 0.9.8 (January 25, 2014) =
|
66 |
+
* Added Leaderboard Widget
|
67 |
+
* Added Ability To Reset Quiz Stats On Each Quiz
|
68 |
+
* Added Ability To Delete Results
|
69 |
+
* Minor Design Changes
|
70 |
+
* Minor Bug Fixes
|
71 |
+
|
72 |
= 0.9.7 (January 24, 2014) =
|
73 |
* Started Setting Plugin Up For Translations
|
74 |
* Relocated Widgets From Help Page To Quiz Dashboard Page
|
223 |
|
224 |
== Upgrade Notice ==
|
225 |
|
226 |
+
= 0.9.8 =
|
227 |
+
Upgrade to use new leaderboard widet! Also, added ability to reset stats for quizzes from Quiz Options page. Added ability to delete results as well. Minor design changes and bug fixes.
|
228 |
+
|
229 |
= 0.9.7 =
|
230 |
Upgrade to see widgets relocated from help page to quiz dashboard page. Also, began setting plugin up for translations. Updated many help sections throughout plugin. Minor bug fixes.
|
231 |
|