Version Description
Upgrade to enjoy three new features and some minor fixes!
Download this release
Release Info
Developer | fpcorso |
Plugin | Quiz And Survey Master (Formerly Quiz Master Next) |
Version | 0.2 |
Comparing to | |
See all releases |
Code changes from version 0.1 to 0.2
- assests/screenshot-2.png +0 -0
- assests/screenshot-3.png +0 -0
- includes/mlw_dashboard.php +187 -6
- includes/mlw_main_page.php +30 -47
- includes/mlw_quiz.php +11 -1
- includes/mlw_quiz_admin.php +26 -3
- includes/mlw_quiz_install.php +29 -0
- includes/mlw_quiz_options.php +53 -2
- includes/mlw_results.php +1 -0
- mlw_quizmaster2.php +3 -3
- readme.txt +12 -2
- uninstall.php +6 -0
assests/screenshot-2.png
CHANGED
Binary file
|
assests/screenshot-3.png
ADDED
Binary file
|
includes/mlw_dashboard.php
CHANGED
@@ -1,14 +1,195 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
This
|
4 |
*/
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
{
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
}
|
9 |
|
10 |
-
function
|
11 |
{
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}
|
14 |
-
?>
|
1 |
<?php
|
2 |
/*
|
3 |
+
This page creates the main dashboard for the Quiz Master Next plugin
|
4 |
*/
|
5 |
+
/*
|
6 |
+
Copyright 2013, My Local Webstop (email : fpcorso@mylocalwebstop.com)
|
7 |
+
*/
|
8 |
+
|
9 |
+
function mlw_generate_quiz_dashboard(){
|
10 |
+
add_meta_box("wpss_mrts", 'Quiz Stats', "mlw_dashboard_box", "quiz_wpss");
|
11 |
+
add_meta_box("wpss_mrts", 'Help', "mlw_dashboard_box_two", "quiz_wpss2");
|
12 |
+
add_meta_box("wpss_mrts", 'Audit Trail', "mlw_dashboard_box_three", "quiz_wpss3");
|
13 |
+
?>
|
14 |
+
<!-- css -->
|
15 |
+
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css" rel="stylesheet" />
|
16 |
+
<!-- jquery scripts -->
|
17 |
+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
|
18 |
+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
|
19 |
+
<script type="text/javascript">
|
20 |
+
var $j = jQuery.noConflict();
|
21 |
+
// increase the default animation speed to exaggerate the effect
|
22 |
+
$j.fx.speeds._default = 1000;
|
23 |
+
$j(function() {
|
24 |
+
$j('#dialog').dialog({
|
25 |
+
autoOpen: false,
|
26 |
+
show: 'blind',
|
27 |
+
hide: 'explode',
|
28 |
+
buttons: {
|
29 |
+
Ok: function() {
|
30 |
+
$j(this).dialog('close');
|
31 |
+
}
|
32 |
+
}
|
33 |
+
});
|
34 |
+
|
35 |
+
$j('#opener').click(function() {
|
36 |
+
$j('#dialog').dialog('open');
|
37 |
+
return false;
|
38 |
+
} );
|
39 |
+
});
|
40 |
+
</script>
|
41 |
+
<style type="text/css">
|
42 |
+
textarea{
|
43 |
+
border-color:#000000;
|
44 |
+
color:#3300CC;
|
45 |
+
cursor:hand;
|
46 |
+
}
|
47 |
+
p em {
|
48 |
+
padding-left: 1em;
|
49 |
+
color: #555;
|
50 |
+
font-weight: bold;
|
51 |
+
}
|
52 |
+
</style>
|
53 |
+
<div class="wrap">
|
54 |
+
<h2>Quiz Master Next Dashboard<a id="opener" href="">(?)</a></h2>
|
55 |
+
|
56 |
+
<h3>Version 0.2</h3>
|
57 |
+
<p>Thank you for trying out my new plugin. I hope you find it beneficial to your website.</p>
|
58 |
+
|
59 |
+
<div style="float:left; width:60%;" class="inner-sidebar1">
|
60 |
+
<?php do_meta_boxes('quiz_wpss','advanced',''); ?>
|
61 |
+
</div>
|
62 |
+
|
63 |
+
<div style="float:right; width:36%; " class="inner-sidebar1">
|
64 |
+
<?php do_meta_boxes('quiz_wpss2','advanced',''); ?>
|
65 |
+
</div>
|
66 |
+
|
67 |
+
<!--<div style="clear:both"></div>-->
|
68 |
+
|
69 |
+
<div style="float:left; width:100%;" class="inner-sidebar1">
|
70 |
+
<?php do_meta_boxes('quiz_wpss3','advanced',''); ?>
|
71 |
+
</div>
|
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 main admin page for the Quiz Master Next.</p>
|
78 |
+
<p>The first widget lists all the statistics collected so far.</p>
|
79 |
+
<p>The second widget lists all the new features added in this update.</p>
|
80 |
+
<p>The third widget lists the audit trail.</p>
|
81 |
+
</div>
|
82 |
+
|
83 |
+
</div>
|
84 |
+
<?php
|
85 |
+
}
|
86 |
+
|
87 |
+
function mlw_dashboard_box()
|
88 |
+
{
|
89 |
+
global $wpdb;
|
90 |
+
$sql = "SELECT SUM(quiz_views) AS QuizViews FROM " . $wpdb->prefix . "mlw_quizzes";
|
91 |
+
$mlw_quiz_views = $wpdb->get_results($sql);
|
92 |
+
|
93 |
+
foreach($mlw_quiz_views as $mlw_eaches) {
|
94 |
+
$mlw_quiz_views = $mlw_eaches->QuizViews;
|
95 |
+
break;
|
96 |
+
}
|
97 |
+
|
98 |
+
$sql = "SELECT SUM(quiz_taken) AS QuizTaken FROM " . $wpdb->prefix . "mlw_quizzes";
|
99 |
+
$mlw_quiz_taken = $wpdb->get_results($sql);
|
100 |
+
|
101 |
+
foreach($mlw_quiz_taken as $mlw_eaches) {
|
102 |
+
$mlw_quiz_taken = $mlw_eaches->QuizTaken;
|
103 |
+
break;
|
104 |
+
}
|
105 |
+
?>
|
106 |
+
<div>
|
107 |
+
<table width='100%'>
|
108 |
+
<tr>
|
109 |
+
<td align='left'>Total Times All Quizzes Have Been Viewed</td>
|
110 |
+
<td align='right'><?php echo $mlw_quiz_views; ?></td>
|
111 |
+
</tr>
|
112 |
+
<tr>
|
113 |
+
<td align='left'>Total Times All Quizzes Have Been Taken</td>
|
114 |
+
<td align='right'><?php echo $mlw_quiz_taken; ?></td>
|
115 |
+
</tr>
|
116 |
+
</table>
|
117 |
+
</div>
|
118 |
+
<?php
|
119 |
+
}
|
120 |
+
|
121 |
+
function mlw_dashboard_box_two()
|
122 |
{
|
123 |
+
?>
|
124 |
+
<div>
|
125 |
+
<table width='100%'>
|
126 |
+
<tr>
|
127 |
+
<td align='left'>There is a (?) next to the title of each page. Click on it to bring up the help for that page.</td>
|
128 |
+
</tr>
|
129 |
+
<tr>
|
130 |
+
<td align='left'></td>
|
131 |
+
</tr>
|
132 |
+
<tr>
|
133 |
+
<td align='left'></td>
|
134 |
+
</tr>
|
135 |
+
<tr>
|
136 |
+
<td align='left'></td>
|
137 |
+
</tr>
|
138 |
+
<tr>
|
139 |
+
<td align='left'></td>
|
140 |
+
</tr>
|
141 |
+
<tr>
|
142 |
+
<td align='left'></td>
|
143 |
+
</tr>
|
144 |
+
<tr>
|
145 |
+
<td align='left'></td>
|
146 |
+
</tr>
|
147 |
+
</table>
|
148 |
+
</div>
|
149 |
+
<?php
|
150 |
}
|
151 |
|
152 |
+
function mlw_dashboard_box_three()
|
153 |
{
|
154 |
+
global $wpdb;
|
155 |
+
|
156 |
+
$sql = "SELECT trail_id, action_user, action, time
|
157 |
+
FROM " . $wpdb->prefix . "mlw_qm_audit_trail ";
|
158 |
+
$sql .= "ORDER BY trail_id DESC";
|
159 |
+
|
160 |
+
$audit_trails = $wpdb->get_results($sql);
|
161 |
+
$quotes_list = "";
|
162 |
+
$display = "";
|
163 |
+
foreach($audit_trails as $quote_data) {
|
164 |
+
if($alternate) $alternate = "";
|
165 |
+
else $alternate = " class=\"alternate\"";
|
166 |
+
$quotes_list .= "<tr{$alternate}>";
|
167 |
+
$quotes_list .= "<td>" . $quote_data->trail_id . "</td>";
|
168 |
+
$quotes_list .= "<td>" . $quote_data->action_user . "</td>";
|
169 |
+
$quotes_list .= "<td>" . $quote_data->action ."</td>";
|
170 |
+
$quotes_list .= "<td>" . $quote_data->time . "</td>";
|
171 |
+
$quotes_list .= "</tr>";
|
172 |
+
}
|
173 |
+
|
174 |
+
$display .= "<table class=\"widefat\">";
|
175 |
+
$display .= "<thead><tr>
|
176 |
+
<th>ID</th>
|
177 |
+
<th>User</th>
|
178 |
+
<th>Action</th>
|
179 |
+
<th>Time</th>
|
180 |
+
</tr></thead>";
|
181 |
+
$display .= "<tbody id=\"the-list\">{$quotes_list}</tbody>";
|
182 |
+
$display .= "</table>";
|
183 |
+
?>
|
184 |
+
<div>
|
185 |
+
<table width='100%'>
|
186 |
+
<tr>
|
187 |
+
<td align='left'>
|
188 |
+
<?php echo $display; ?>
|
189 |
+
</td>
|
190 |
+
</tr>
|
191 |
+
</table>
|
192 |
+
</div>
|
193 |
+
<?php
|
194 |
}
|
195 |
+
?>
|
includes/mlw_main_page.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Generates the
|
4 |
*/
|
5 |
/*
|
6 |
Copyright 2013, My Local Webstop (email : fpcorso@mylocalwebstop.com)
|
@@ -12,8 +12,8 @@ function mlw_generate_main_page()
|
|
12 |
add_meta_box("wpss_mrts", 'Quiz Master Next', "quiz_wpss_mrt_meta_box", "quiz_wpss");
|
13 |
add_meta_box("wpss_mrts", 'In This Update', "quiz_wpss_mrt_meta_box2", "quiz_wpss2");
|
14 |
add_meta_box("wpss_mrts", 'Support', "quiz_wpss_mrt_meta_box3", "quiz_wpss3");
|
15 |
-
add_meta_box("wpss_mrts", '
|
16 |
-
add_meta_box("wpss_mrts", '
|
17 |
add_meta_box("wpss_mrts", 'Brainstorm Idea', "quiz_wpss_mrt_meta_box6", "quiz_wpss6");
|
18 |
?>
|
19 |
<!-- css -->
|
@@ -81,38 +81,30 @@ function mlw_generate_main_page()
|
|
81 |
}
|
82 |
</style>
|
83 |
<div class="wrap">
|
84 |
-
<h2>Quiz Master Next <a id="opener" href="">(?)</a></h2>
|
85 |
|
86 |
-
<h3>Version 0.
|
87 |
<p>Thank you for trying out my new plugin. I hope you find it beneficial to your website.</p>
|
88 |
|
89 |
<div style="float:left; width:60%;" class="inner-sidebar1">
|
90 |
-
<?php do_meta_boxes('
|
91 |
</div>
|
92 |
|
93 |
<div style="float:right; width:36%; " class="inner-sidebar1">
|
94 |
<?php do_meta_boxes('quiz_wpss2','advanced',''); ?>
|
95 |
</div>
|
|
|
|
|
|
|
|
|
96 |
|
97 |
<!--<div style="clear:both"></div>-->
|
98 |
|
99 |
-
<div style="float:left; width:60%;" class="inner-sidebar1">
|
100 |
-
<?php do_meta_boxes('quiz_wpss3','advanced',''); ?>
|
101 |
-
</div>
|
102 |
-
|
103 |
-
<div style="float:right; width:36%; " class="inner-sidebar1">
|
104 |
<?php do_meta_boxes('quiz_wpss4','advanced',''); ?>
|
105 |
</div>
|
106 |
|
107 |
-
<!--<div style="clear:both"></div>-->
|
108 |
-
|
109 |
-
<!--<div style="float:left; width:100%;" class="inner-sidebar1">
|
110 |
-
<?php /* do_meta_boxes('quiz_wpss6','advanced',''); */?>
|
111 |
-
</div>-->
|
112 |
|
113 |
-
<div style="float:right; width:36%; " class="inner-sidebar1">
|
114 |
-
<?php do_meta_boxes('quiz_wpss5','advanced',''); ?>
|
115 |
-
</div>
|
116 |
|
117 |
<div id="dialog" title="Help">
|
118 |
<h3><b>Help</b></h3>
|
@@ -168,28 +160,19 @@ function quiz_wpss_mrt_meta_box2()
|
|
168 |
<div>
|
169 |
<table width='100%'>
|
170 |
<tr>
|
171 |
-
<td align='left'>0.
|
172 |
</tr>
|
173 |
<tr>
|
174 |
-
<td align='left'>*
|
175 |
</tr>
|
176 |
<tr>
|
177 |
-
<td align='left'>*
|
178 |
</tr>
|
179 |
<tr>
|
180 |
-
<td align='left'>* Added
|
181 |
</tr>
|
182 |
<tr>
|
183 |
-
<td align='left'>*
|
184 |
-
</tr>
|
185 |
-
<tr>
|
186 |
-
<td align='left'>* Added questions admin page</td>
|
187 |
-
</tr>
|
188 |
-
<tr>
|
189 |
-
<td align='left'>* Added results page</td>
|
190 |
-
</tr>
|
191 |
-
<tr>
|
192 |
-
<td align='left'>* Added support page</td>
|
193 |
</tr>
|
194 |
</table>
|
195 |
</div>
|
@@ -209,7 +192,7 @@ function quiz_wpss_mrt_meta_box3()
|
|
209 |
$quiz_master_email_message = "";
|
210 |
if ($quiz_master_email_success == update and $user_email != "" and $user_message != "")
|
211 |
{
|
212 |
-
wp_mail('fpcorso@mylocalwebstop.com' ,'Support From Quiz Master
|
213 |
$quiz_master_email_message = "<h3>Message Sent</h3>";
|
214 |
}
|
215 |
else if ($quiz_master_email_success == update and $user_email == "")
|
@@ -257,18 +240,6 @@ function quiz_wpss_mrt_meta_box3()
|
|
257 |
}
|
258 |
|
259 |
function quiz_wpss_mrt_meta_box4()
|
260 |
-
{
|
261 |
-
?>
|
262 |
-
<div>
|
263 |
-
<table width='100%'>
|
264 |
-
<tr>
|
265 |
-
<td align='left'><?php include("http://www.mylocalwebstop.com/mlw_news.html"); ?></td>
|
266 |
-
</tr>
|
267 |
-
</table>
|
268 |
-
</div>
|
269 |
-
<?php
|
270 |
-
}
|
271 |
-
function quiz_wpss_mrt_meta_box5()
|
272 |
{
|
273 |
?>
|
274 |
<div>
|
@@ -310,6 +281,18 @@ function quiz_wpss_mrt_meta_box5()
|
|
310 |
</div>
|
311 |
<?php
|
312 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
313 |
function quiz_wpss_mrt_meta_box6()
|
314 |
{
|
315 |
?>
|
@@ -324,4 +307,4 @@ function quiz_wpss_mrt_meta_box6()
|
|
324 |
</div>
|
325 |
<?php
|
326 |
}
|
327 |
-
?>
|
1 |
<?php
|
2 |
/*
|
3 |
+
Generates the support for Quiz Master Next
|
4 |
*/
|
5 |
/*
|
6 |
Copyright 2013, My Local Webstop (email : fpcorso@mylocalwebstop.com)
|
12 |
add_meta_box("wpss_mrts", 'Quiz Master Next', "quiz_wpss_mrt_meta_box", "quiz_wpss");
|
13 |
add_meta_box("wpss_mrts", 'In This Update', "quiz_wpss_mrt_meta_box2", "quiz_wpss2");
|
14 |
add_meta_box("wpss_mrts", 'Support', "quiz_wpss_mrt_meta_box3", "quiz_wpss3");
|
15 |
+
add_meta_box("wpss_mrts", 'Contribution', "quiz_wpss_mrt_meta_box4", "quiz_wpss4");
|
16 |
+
add_meta_box("wpss_mrts", 'News From My Local Webstop', "quiz_wpss_mrt_meta_box5", "quiz_wpss5");
|
17 |
add_meta_box("wpss_mrts", 'Brainstorm Idea', "quiz_wpss_mrt_meta_box6", "quiz_wpss6");
|
18 |
?>
|
19 |
<!-- css -->
|
81 |
}
|
82 |
</style>
|
83 |
<div class="wrap">
|
84 |
+
<h2>Quiz Master Next Support <a id="opener" href="">(?)</a></h2>
|
85 |
|
86 |
+
<h3>Version 0.2</h3>
|
87 |
<p>Thank you for trying out my new plugin. I hope you find it beneficial to your website.</p>
|
88 |
|
89 |
<div style="float:left; width:60%;" class="inner-sidebar1">
|
90 |
+
<?php do_meta_boxes('quiz_wpss3','advanced',''); ?>
|
91 |
</div>
|
92 |
|
93 |
<div style="float:right; width:36%; " class="inner-sidebar1">
|
94 |
<?php do_meta_boxes('quiz_wpss2','advanced',''); ?>
|
95 |
</div>
|
96 |
+
|
97 |
+
<div style="float:right; width:36%; " class="inner-sidebar1">
|
98 |
+
<?php do_meta_boxes('quiz_wpss5','advanced',''); ?>
|
99 |
+
</div>
|
100 |
|
101 |
<!--<div style="clear:both"></div>-->
|
102 |
|
103 |
+
<div style="float:left; width:60%; " class="inner-sidebar1">
|
|
|
|
|
|
|
|
|
104 |
<?php do_meta_boxes('quiz_wpss4','advanced',''); ?>
|
105 |
</div>
|
106 |
|
|
|
|
|
|
|
|
|
|
|
107 |
|
|
|
|
|
|
|
108 |
|
109 |
<div id="dialog" title="Help">
|
110 |
<h3><b>Help</b></h3>
|
160 |
<div>
|
161 |
<table width='100%'>
|
162 |
<tr>
|
163 |
+
<td align='left'>0.2 (September 9, 2013)</td>
|
164 |
</tr>
|
165 |
<tr>
|
166 |
+
<td align='left'>* Added New Quiz Dashboard Page</td>
|
167 |
</tr>
|
168 |
<tr>
|
169 |
+
<td align='left'>* Created Audit Trail</td>
|
170 |
</tr>
|
171 |
<tr>
|
172 |
+
<td align='left'>* Added Ability to Add Questions/Answers to Templates</td>
|
173 |
</tr>
|
174 |
<tr>
|
175 |
+
<td align='left'>* Minor Spelling/Grammer Fixes</td>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
</tr>
|
177 |
</table>
|
178 |
</div>
|
192 |
$quiz_master_email_message = "";
|
193 |
if ($quiz_master_email_success == update and $user_email != "" and $user_message != "")
|
194 |
{
|
195 |
+
wp_mail('fpcorso@mylocalwebstop.com' ,'Support From Quiz Master Next Plugin','Message from ' . $user_name . ' at ' . $user_email . " It says: " . "\n" . $user_message);
|
196 |
$quiz_master_email_message = "<h3>Message Sent</h3>";
|
197 |
}
|
198 |
else if ($quiz_master_email_success == update and $user_email == "")
|
240 |
}
|
241 |
|
242 |
function quiz_wpss_mrt_meta_box4()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
{
|
244 |
?>
|
245 |
<div>
|
281 |
</div>
|
282 |
<?php
|
283 |
}
|
284 |
+
function quiz_wpss_mrt_meta_box5()
|
285 |
+
{
|
286 |
+
?>
|
287 |
+
<div>
|
288 |
+
<table width='100%'>
|
289 |
+
<tr>
|
290 |
+
<td align='left'><?php include("http://www.mylocalwebstop.com/mlw_news.html"); ?></td>
|
291 |
+
</tr>
|
292 |
+
</table>
|
293 |
+
</div>
|
294 |
+
<?php
|
295 |
+
}
|
296 |
function quiz_wpss_mrt_meta_box6()
|
297 |
{
|
298 |
?>
|
307 |
</div>
|
308 |
<?php
|
309 |
}
|
310 |
+
?>
|
includes/mlw_quiz.php
CHANGED
@@ -154,6 +154,7 @@ function mlw_quiz_shortcode($atts)
|
|
154 |
$mlw_correct = 0;
|
155 |
$mlw_total_questions = 0;
|
156 |
$mlw_total_score = 0;
|
|
|
157 |
|
158 |
//Update the amount of times the quiz has been taken
|
159 |
$mlw_taken = $mlw_quiz_options->quiz_taken;
|
@@ -175,6 +176,11 @@ function mlw_quiz_shortcode($atts)
|
|
175 |
if ($mlw_user_answer == 4) {$mlw_points += $mlw_question->answer_four_points;}
|
176 |
if ($mlw_user_answer == 5) {$mlw_points += $mlw_question->answer_five_points;}
|
177 |
if ($mlw_user_answer == 6) {$mlw_points += $mlw_question->answer_six_points;}
|
|
|
|
|
|
|
|
|
|
|
178 |
}
|
179 |
$mlw_total_score = round((($mlw_correct/$mlw_total_questions)*100), 2);
|
180 |
|
@@ -189,6 +195,8 @@ function mlw_quiz_shortcode($atts)
|
|
189 |
$mlw_message_after = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message_after);
|
190 |
$mlw_message_after = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message_after);
|
191 |
$mlw_message_after = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_after);
|
|
|
|
|
192 |
$mlw_display .= $mlw_message_after;
|
193 |
|
194 |
|
@@ -209,6 +217,7 @@ function mlw_quiz_shortcode($atts)
|
|
209 |
$mlw_message = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message);
|
210 |
$mlw_message = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message);
|
211 |
$mlw_message = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message);
|
|
|
212 |
wp_mail($mlw_user_email, "Quiz Results", $mlw_message);
|
213 |
}
|
214 |
}
|
@@ -227,7 +236,8 @@ function mlw_quiz_shortcode($atts)
|
|
227 |
$mlw_message = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message);
|
228 |
$mlw_message = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message);
|
229 |
$mlw_message = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message);
|
230 |
-
$mlw_message
|
|
|
231 |
wp_mail($mlw_quiz_options->admin_email, "Quiz Results", $mlw_message);
|
232 |
}
|
233 |
|
154 |
$mlw_correct = 0;
|
155 |
$mlw_total_questions = 0;
|
156 |
$mlw_total_score = 0;
|
157 |
+
$mlw_question_answers = "";
|
158 |
|
159 |
//Update the amount of times the quiz has been taken
|
160 |
$mlw_taken = $mlw_quiz_options->quiz_taken;
|
176 |
if ($mlw_user_answer == 4) {$mlw_points += $mlw_question->answer_four_points;}
|
177 |
if ($mlw_user_answer == 5) {$mlw_points += $mlw_question->answer_five_points;}
|
178 |
if ($mlw_user_answer == 6) {$mlw_points += $mlw_question->answer_six_points;}
|
179 |
+
|
180 |
+
$mlw_question_answers .= $mlw_question->question_name . "\n";
|
181 |
+
$mlw_question_answers .= "Your Answer: " . $mlw_user_answer . "\n";
|
182 |
+
$mlw_question_answers .= "Correct Answer: " . $mlw_question->correct_answer . "\n";
|
183 |
+
$mlw_question_answers .= "\n";
|
184 |
}
|
185 |
$mlw_total_score = round((($mlw_correct/$mlw_total_questions)*100), 2);
|
186 |
|
195 |
$mlw_message_after = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message_after);
|
196 |
$mlw_message_after = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message_after);
|
197 |
$mlw_message_after = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_after);
|
198 |
+
$mlw_message_after = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message_after);
|
199 |
+
$mlw_message_after = str_replace( "\n" , "<br>", $mlw_message_after);
|
200 |
$mlw_display .= $mlw_message_after;
|
201 |
|
202 |
|
217 |
$mlw_message = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message);
|
218 |
$mlw_message = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message);
|
219 |
$mlw_message = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message);
|
220 |
+
$mlw_message = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message);
|
221 |
wp_mail($mlw_user_email, "Quiz Results", $mlw_message);
|
222 |
}
|
223 |
}
|
236 |
$mlw_message = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message);
|
237 |
$mlw_message = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message);
|
238 |
$mlw_message = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message);
|
239 |
+
$mlw_message = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message);
|
240 |
+
$mlw_message .= " This email was generated by the Quiz Master Next script by Frank Corso";
|
241 |
wp_mail($mlw_quiz_options->admin_email, "Quiz Results", $mlw_message);
|
242 |
}
|
243 |
|
includes/mlw_quiz_admin.php
CHANGED
@@ -16,16 +16,27 @@ function mlw_generate_quiz_admin()
|
|
16 |
//Create new quiz
|
17 |
if ($success == "confirmation")
|
18 |
{
|
|
|
19 |
$insert = "INSERT INTO " . $table_name .
|
20 |
"(quiz_id, quiz_name, message_before, message_after, user_email_template, admin_email_template, submit_button_text, name_field_text, business_field_text, email_field_text, phone_field_text, system, show_score, send_user_email, user_name, user_comp, user_email, user_phone, admin_email, quiz_views, quiz_taken, deleted) " .
|
21 |
"VALUES (NULL , '" . $quiz_name . "' , 'Enter your text here', 'Enter your text here', 'Enter your text here', 'Enter your text here', 'Submit Quiz', 'Name', 'Business', 'Email', 'Phone Number', 0, 0, 0, 0, 0, 0, 0, '".get_option( 'admin_email', 'Enter email' )."', 0, 0, 0)";
|
22 |
$results = $wpdb->query( $insert );
|
23 |
$hasCreatedQuiz = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
}
|
25 |
|
26 |
//Variables from delete question form
|
27 |
$delete_quiz_success = $_POST["delete_quiz"];
|
28 |
$mlw_quiz_id = $_POST["quiz_id"];
|
|
|
29 |
|
30 |
//Delete quiz
|
31 |
if ($delete_quiz_success == "confirmation")
|
@@ -36,6 +47,15 @@ function mlw_generate_quiz_admin()
|
|
36 |
$update = "UPDATE " . $wpdb->prefix . "mlw_questions" . " SET deleted=1 WHERE quiz_id=".$mlw_quiz_id;
|
37 |
$results = $wpdb->query( $update );
|
38 |
$hasDeletedQuiz = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
40 |
|
41 |
|
@@ -98,7 +118,7 @@ function mlw_generate_quiz_admin()
|
|
98 |
return false;
|
99 |
} );
|
100 |
});
|
101 |
-
function deleteQuiz(id){
|
102 |
$j("#delete_dialog").dialog({
|
103 |
autoOpen: false,
|
104 |
show: 'blind',
|
@@ -112,8 +132,10 @@ function mlw_generate_quiz_admin()
|
|
112 |
$j("#delete_dialog").dialog('open');
|
113 |
var idText = document.getElementById("delete_quiz_id");
|
114 |
var idHidden = document.getElementById("quiz_id");
|
|
|
115 |
idText.innerHTML = id;
|
116 |
-
idHidden.value = id;
|
|
|
117 |
};
|
118 |
</script>
|
119 |
<style>
|
@@ -161,7 +183,7 @@ function mlw_generate_quiz_admin()
|
|
161 |
else $alternate = " class=\"alternate\"";
|
162 |
$quotes_list .= "<tr{$alternate}>";
|
163 |
$quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_id . "</span></td>";
|
164 |
-
$quotes_list .= "<td class='post-title column-title'><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_name ."</span><div><span style='color:green;font-size:12px;'><a href='admin.php?page=mlw_quiz_options&&quiz_id=".$mlw_quiz_info->quiz_id."'>Edit</a> | <a onclick=\"deleteQuiz('".$mlw_quiz_info->quiz_id."')\" href='#'>Delete</a> | <a href='admin.php?page=mlw_quiz_results&&quiz_id=".$mlw_quiz_info->quiz_id."'>Results</a></span></div></td>";
|
165 |
$quotes_list .= "<td><span style='font-size:16px;'>[mlw_quizmaster quiz=".$mlw_quiz_info->quiz_id."]</span></td>";
|
166 |
$quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_views . "</span></td>";
|
167 |
$quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_taken ."</span></td>";
|
@@ -223,6 +245,7 @@ function mlw_generate_quiz_admin()
|
|
223 |
echo "<form action='" . $PHP_SELF . "' method='post'>";
|
224 |
echo "<input type='hidden' name='delete_quiz' value='confirmation' />";
|
225 |
echo "<input type='hidden' id='quiz_id' name='quiz_id' value='' />";
|
|
|
226 |
echo "<p class='submit'><input type='submit' class='button-primary' value='Delete Quiz' /></p>";
|
227 |
echo "</form>";
|
228 |
?>
|
16 |
//Create new quiz
|
17 |
if ($success == "confirmation")
|
18 |
{
|
19 |
+
//Insert New Quiz Into Table
|
20 |
$insert = "INSERT INTO " . $table_name .
|
21 |
"(quiz_id, quiz_name, message_before, message_after, user_email_template, admin_email_template, submit_button_text, name_field_text, business_field_text, email_field_text, phone_field_text, system, show_score, send_user_email, user_name, user_comp, user_email, user_phone, admin_email, quiz_views, quiz_taken, deleted) " .
|
22 |
"VALUES (NULL , '" . $quiz_name . "' , 'Enter your text here', 'Enter your text here', 'Enter your text here', 'Enter your text here', 'Submit Quiz', 'Name', 'Business', 'Email', 'Phone Number', 0, 0, 0, 0, 0, 0, 0, '".get_option( 'admin_email', 'Enter email' )."', 0, 0, 0)";
|
23 |
$results = $wpdb->query( $insert );
|
24 |
$hasCreatedQuiz = 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 . "' , 'New Quiz Has Been Created: ".$quiz_name."' , '" . date("h:i:s A m/d/Y") . "')";
|
33 |
+
$results = $wpdb->query( $insert );
|
34 |
}
|
35 |
|
36 |
//Variables from delete question form
|
37 |
$delete_quiz_success = $_POST["delete_quiz"];
|
38 |
$mlw_quiz_id = $_POST["quiz_id"];
|
39 |
+
$quiz_name = $_POST["delete_quiz_name"];
|
40 |
|
41 |
//Delete quiz
|
42 |
if ($delete_quiz_success == "confirmation")
|
47 |
$update = "UPDATE " . $wpdb->prefix . "mlw_questions" . " SET deleted=1 WHERE quiz_id=".$mlw_quiz_id;
|
48 |
$results = $wpdb->query( $update );
|
49 |
$hasDeletedQuiz = true;
|
50 |
+
|
51 |
+
//Insert Action Into Audit Trail
|
52 |
+
global $current_user;
|
53 |
+
get_currentuserinfo();
|
54 |
+
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
55 |
+
$insert = "INSERT INTO " . $table_name .
|
56 |
+
"(trail_id, action_user, action, time) " .
|
57 |
+
"VALUES (NULL , '" . $current_user->display_name . "' , 'Quiz Has Been Deleted: ".$quiz_name."' , '" . date("h:i:s A m/d/Y") . "')";
|
58 |
+
$results = $wpdb->query( $insert );
|
59 |
}
|
60 |
|
61 |
|
118 |
return false;
|
119 |
} );
|
120 |
});
|
121 |
+
function deleteQuiz(id,quizName){
|
122 |
$j("#delete_dialog").dialog({
|
123 |
autoOpen: false,
|
124 |
show: 'blind',
|
132 |
$j("#delete_dialog").dialog('open');
|
133 |
var idText = document.getElementById("delete_quiz_id");
|
134 |
var idHidden = document.getElementById("quiz_id");
|
135 |
+
var idHiddenName = document.getElementById("delete_quiz_name");
|
136 |
idText.innerHTML = id;
|
137 |
+
idHidden.value = id;
|
138 |
+
idHiddenName = quizName;
|
139 |
};
|
140 |
</script>
|
141 |
<style>
|
183 |
else $alternate = " class=\"alternate\"";
|
184 |
$quotes_list .= "<tr{$alternate}>";
|
185 |
$quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_id . "</span></td>";
|
186 |
+
$quotes_list .= "<td class='post-title column-title'><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_name ."</span><div><span style='color:green;font-size:12px;'><a href='admin.php?page=mlw_quiz_options&&quiz_id=".$mlw_quiz_info->quiz_id."'>Edit</a> | <a onclick=\"deleteQuiz('".$mlw_quiz_info->quiz_id."','".$mlw_quiz_info->quiz_name."')\" href='#'>Delete</a> | <a href='admin.php?page=mlw_quiz_results&&quiz_id=".$mlw_quiz_info->quiz_id."'>Results</a></span></div></td>";
|
187 |
$quotes_list .= "<td><span style='font-size:16px;'>[mlw_quizmaster quiz=".$mlw_quiz_info->quiz_id."]</span></td>";
|
188 |
$quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_views . "</span></td>";
|
189 |
$quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_taken ."</span></td>";
|
245 |
echo "<form action='" . $PHP_SELF . "' method='post'>";
|
246 |
echo "<input type='hidden' name='delete_quiz' value='confirmation' />";
|
247 |
echo "<input type='hidden' id='quiz_id' name='quiz_id' value='' />";
|
248 |
+
echo "<input type='hidden' id='delete_quiz_name' name='delete_quiz_name' value='' />";
|
249 |
echo "<p class='submit'><input type='submit' class='button-primary' value='Delete Quiz' /></p>";
|
250 |
echo "</form>";
|
251 |
?>
|
includes/mlw_quiz_install.php
CHANGED
@@ -172,6 +172,35 @@ function mlw_quiz_activate()
|
|
172 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
173 |
dbDelta($sql);
|
174 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
}
|
176 |
|
177 |
function mlw_quiz_deactivate()
|
172 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
173 |
dbDelta($sql);
|
174 |
}
|
175 |
+
|
176 |
+
global $wpdb;
|
177 |
+
|
178 |
+
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
179 |
+
|
180 |
+
if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name)
|
181 |
+
|
182 |
+
{
|
183 |
+
//Creating the table ... fresh!
|
184 |
+
|
185 |
+
$sql = "CREATE TABLE " . $table_name . " (
|
186 |
+
|
187 |
+
trail_id mediumint(9) NOT NULL AUTO_INCREMENT,
|
188 |
+
|
189 |
+
action_user TEXT NOT NULL,
|
190 |
+
|
191 |
+
action TEXT NOT NULL,
|
192 |
+
|
193 |
+
time TEXT NOT NULL,
|
194 |
+
|
195 |
+
PRIMARY KEY (trail_id)
|
196 |
+
|
197 |
+
);";
|
198 |
+
|
199 |
+
$results = $wpdb->query( $sql );
|
200 |
+
|
201 |
+
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
202 |
+
dbDelta($sql);
|
203 |
+
}
|
204 |
}
|
205 |
|
206 |
function mlw_quiz_deactivate()
|
includes/mlw_quiz_options.php
CHANGED
@@ -58,6 +58,15 @@ function mlw_generate_quiz_options()
|
|
58 |
$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."' WHERE question_id=".$mlw_edit_question_id;
|
59 |
$results = $wpdb->query( $update );
|
60 |
$hasUpdatedQuestion = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
|
63 |
//Variables from delete question form
|
@@ -71,24 +80,44 @@ function mlw_generate_quiz_options()
|
|
71 |
$update = "UPDATE " . $wpdb->prefix . "mlw_questions" . " SET deleted=1 WHERE question_id=".$mlw_question_id;
|
72 |
$results = $wpdb->query( $update );
|
73 |
$hasDeletedQuestion = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
}
|
75 |
|
76 |
//Submit new question into database
|
77 |
if ($success == "confirmation")
|
78 |
{
|
79 |
$quiz_id = $_POST["quiz_id"];
|
|
|
80 |
$insert = "INSERT INTO " . $table_name .
|
81 |
" (question_id, quiz_id, question_name, answer_one, answer_one_points, answer_two, answer_two_points, answer_three, answer_three_points, answer_four, answer_four_points, answer_five, answer_five_points, answer_six, answer_six_points, correct_answer, deleted) VALUES (NULL , ".$quiz_id.", '" . $question_name . "' , '" . $answer_one . "', ".$answer_one_points.", '" . $answer_two . "', ".$answer_two_points.", '" . $answer_three . "', ".$answer_three_points.", '" . $answer_four . "', ".$answer_four_points.", '" . $answer_five . "', ".$answer_five_points.", '" . $answer_six . "', ".$answer_six_points.", ".$correct_answer.", 0)";
|
82 |
$results = $wpdb->query( $insert );
|
83 |
$hasCreatedQuestion = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
|
86 |
//Get table of questions for this quiz
|
|
|
|
|
87 |
$sql = "SELECT * FROM " . $table_name . " WHERE quiz_id=".$quiz_id." AND deleted=0";
|
88 |
$sql .= " ORDER BY question_id ASC";
|
89 |
-
|
90 |
$mlw_question_data = $wpdb->get_results($sql);
|
91 |
-
|
92 |
|
93 |
/*
|
94 |
Code for Quiz Text tab
|
@@ -113,6 +142,15 @@ function mlw_generate_quiz_options()
|
|
113 |
$update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET message_before='".$mlw_before_message."', 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;
|
114 |
$results = $wpdb->query( $update );
|
115 |
$hasUpdatedTemplates = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
|
118 |
|
@@ -138,6 +176,15 @@ function mlw_generate_quiz_options()
|
|
138 |
$update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET system='".$mlw_system."', send_user_email='".$mlw_send_user_email."', send_admin_email='".$mlw_send_admin_email."', 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."' WHERE quiz_id=".$quiz_id;
|
139 |
$results = $wpdb->query( $update );
|
140 |
$hasUpdatedOptions = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
}
|
142 |
|
143 |
|
@@ -699,6 +746,7 @@ function mlw_generate_quiz_options()
|
|
699 |
</tr>
|
700 |
<tr>
|
701 |
<td><strong>%QUIZ_NAME%</strong> - The name of the quiz</td>
|
|
|
702 |
</tr>
|
703 |
</table>
|
704 |
<button id="save_template_button" onclick="javascript: document.quiz_template_form.submit();">Save Templates</button><button id="template_tab_help">Help</button>
|
@@ -735,6 +783,7 @@ function mlw_generate_quiz_options()
|
|
735 |
<p style="margin: 2px 0">- %USER_BUSINESS%</p>
|
736 |
<p style="margin: 2px 0">- %USER_PHONE%</p>
|
737 |
<p style="margin: 2px 0">- %USER_EMAIL%</p>
|
|
|
738 |
</td>
|
739 |
<td><textarea cols="80" rows="15" id="mlw_quiz_after_message" name="mlw_quiz_after_message"><?php echo $mlw_quiz_options->message_after; ?></textarea>
|
740 |
</td>
|
@@ -759,6 +808,7 @@ function mlw_generate_quiz_options()
|
|
759 |
<p style="margin: 2px 0">- %USER_BUSINESS%</p>
|
760 |
<p style="margin: 2px 0">- %USER_PHONE%</p>
|
761 |
<p style="margin: 2px 0">- %USER_EMAIL%</p>
|
|
|
762 |
</td>
|
763 |
<td><textarea cols="80" rows="15" id="mlw_quiz_before_message" name="mlw_quiz_user_email_template"><?php echo $mlw_quiz_options->user_email_template; ?></textarea>
|
764 |
</td>
|
@@ -777,6 +827,7 @@ function mlw_generate_quiz_options()
|
|
777 |
<p style="margin: 2px 0">- %USER_PHONE%</p>
|
778 |
<p style="margin: 2px 0">- %USER_EMAIL%</p>
|
779 |
<p style="margin: 2px 0">- %QUIZ_NAME%</p>
|
|
|
780 |
</td>
|
781 |
<td><textarea cols="80" rows="15" id="mlw_quiz_after_message" name="mlw_quiz_admin_email_template"><?php echo $mlw_quiz_options->admin_email_template; ?></textarea>
|
782 |
</td>
|
58 |
$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."' WHERE question_id=".$mlw_edit_question_id;
|
59 |
$results = $wpdb->query( $update );
|
60 |
$hasUpdatedQuestion = true;
|
61 |
+
|
62 |
+
//Insert Action Into Audit Trail
|
63 |
+
global $current_user;
|
64 |
+
get_currentuserinfo();
|
65 |
+
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
66 |
+
$insert = "INSERT INTO " . $table_name .
|
67 |
+
"(trail_id, action_user, action, time) " .
|
68 |
+
"VALUES (NULL , '" . $current_user->display_name . "' , 'Question Has Been Edited: ".$edit_question_name."' , '" . date("m/d/Y") . "')";
|
69 |
+
$results = $wpdb->query( $insert );
|
70 |
}
|
71 |
|
72 |
//Variables from delete question form
|
80 |
$update = "UPDATE " . $wpdb->prefix . "mlw_questions" . " SET deleted=1 WHERE question_id=".$mlw_question_id;
|
81 |
$results = $wpdb->query( $update );
|
82 |
$hasDeletedQuestion = true;
|
83 |
+
|
84 |
+
//Insert Action Into Audit Trail
|
85 |
+
global $current_user;
|
86 |
+
get_currentuserinfo();
|
87 |
+
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
88 |
+
$insert = "INSERT INTO " . $table_name .
|
89 |
+
"(trail_id, action_user, action, time) " .
|
90 |
+
"VALUES (NULL , '" . $current_user->display_name . "' , 'Question Has Been Deleted: ".$mlw_question_id."' , '" . date("h:i:s A m/d/Y") . "')";
|
91 |
+
$results = $wpdb->query( $insert );
|
92 |
}
|
93 |
|
94 |
//Submit new question into database
|
95 |
if ($success == "confirmation")
|
96 |
{
|
97 |
$quiz_id = $_POST["quiz_id"];
|
98 |
+
$table_name = $wpdb->prefix . "mlw_questions";
|
99 |
$insert = "INSERT INTO " . $table_name .
|
100 |
" (question_id, quiz_id, question_name, answer_one, answer_one_points, answer_two, answer_two_points, answer_three, answer_three_points, answer_four, answer_four_points, answer_five, answer_five_points, answer_six, answer_six_points, correct_answer, deleted) VALUES (NULL , ".$quiz_id.", '" . $question_name . "' , '" . $answer_one . "', ".$answer_one_points.", '" . $answer_two . "', ".$answer_two_points.", '" . $answer_three . "', ".$answer_three_points.", '" . $answer_four . "', ".$answer_four_points.", '" . $answer_five . "', ".$answer_five_points.", '" . $answer_six . "', ".$answer_six_points.", ".$correct_answer.", 0)";
|
101 |
$results = $wpdb->query( $insert );
|
102 |
$hasCreatedQuestion = true;
|
103 |
+
|
104 |
+
//Insert Action Into Audit Trail
|
105 |
+
global $current_user;
|
106 |
+
get_currentuserinfo();
|
107 |
+
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
108 |
+
$insert = "INSERT INTO " . $table_name .
|
109 |
+
"(trail_id, action_user, action, time) " .
|
110 |
+
"VALUES (NULL , '" . $current_user->display_name . "' , 'Question Has Been Added: ".$question_name."' , '" . date("h:i:s A m/d/Y") . "')";
|
111 |
+
$results = $wpdb->query( $insert );
|
112 |
}
|
113 |
|
114 |
//Get table of questions for this quiz
|
115 |
+
global $wpdb;
|
116 |
+
$table_name = $wpdb->prefix . "mlw_questions";
|
117 |
$sql = "SELECT * FROM " . $table_name . " WHERE quiz_id=".$quiz_id." AND deleted=0";
|
118 |
$sql .= " ORDER BY question_id ASC";
|
|
|
119 |
$mlw_question_data = $wpdb->get_results($sql);
|
120 |
+
|
121 |
|
122 |
/*
|
123 |
Code for Quiz Text tab
|
142 |
$update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET message_before='".$mlw_before_message."', 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;
|
143 |
$results = $wpdb->query( $update );
|
144 |
$hasUpdatedTemplates = true;
|
145 |
+
|
146 |
+
//Insert Action Into Audit Trail
|
147 |
+
global $current_user;
|
148 |
+
get_currentuserinfo();
|
149 |
+
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
150 |
+
$insert = "INSERT INTO " . $table_name .
|
151 |
+
"(trail_id, action_user, action, time) " .
|
152 |
+
"VALUES (NULL , '" . $current_user->display_name . "' , 'Templates Have Been Edited For Quiz Number ".$quiz_id."' , '" . date("h:i:s A m/d/Y") . "')";
|
153 |
+
$results = $wpdb->query( $insert );
|
154 |
}
|
155 |
|
156 |
|
176 |
$update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET system='".$mlw_system."', send_user_email='".$mlw_send_user_email."', send_admin_email='".$mlw_send_admin_email."', 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."' WHERE quiz_id=".$quiz_id;
|
177 |
$results = $wpdb->query( $update );
|
178 |
$hasUpdatedOptions = true;
|
179 |
+
|
180 |
+
//Insert Action Into Audit Trail
|
181 |
+
global $current_user;
|
182 |
+
get_currentuserinfo();
|
183 |
+
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
184 |
+
$insert = "INSERT INTO " . $table_name .
|
185 |
+
"(trail_id, action_user, action, time) " .
|
186 |
+
"VALUES (NULL , '" . $current_user->display_name . "' , 'Options Have Been Edited For Quiz Number ".$quiz_id."' , '" . date("h:i:s A m/d/Y") . "')";
|
187 |
+
$results = $wpdb->query( $insert );
|
188 |
}
|
189 |
|
190 |
|
746 |
</tr>
|
747 |
<tr>
|
748 |
<td><strong>%QUIZ_NAME%</strong> - The name of the quiz</td>
|
749 |
+
<td><strong>%QUESTIONS_ANSWERS%</strong> - Shows the question, the answer the user provided, and the correct answer</td>
|
750 |
</tr>
|
751 |
</table>
|
752 |
<button id="save_template_button" onclick="javascript: document.quiz_template_form.submit();">Save Templates</button><button id="template_tab_help">Help</button>
|
783 |
<p style="margin: 2px 0">- %USER_BUSINESS%</p>
|
784 |
<p style="margin: 2px 0">- %USER_PHONE%</p>
|
785 |
<p style="margin: 2px 0">- %USER_EMAIL%</p>
|
786 |
+
<p style="margin: 2px 0">- %QUESTIONS_ANSWERS%</p>
|
787 |
</td>
|
788 |
<td><textarea cols="80" rows="15" id="mlw_quiz_after_message" name="mlw_quiz_after_message"><?php echo $mlw_quiz_options->message_after; ?></textarea>
|
789 |
</td>
|
808 |
<p style="margin: 2px 0">- %USER_BUSINESS%</p>
|
809 |
<p style="margin: 2px 0">- %USER_PHONE%</p>
|
810 |
<p style="margin: 2px 0">- %USER_EMAIL%</p>
|
811 |
+
<p style="margin: 2px 0">- %QUESTIONS_ANSWERS%</p>
|
812 |
</td>
|
813 |
<td><textarea cols="80" rows="15" id="mlw_quiz_before_message" name="mlw_quiz_user_email_template"><?php echo $mlw_quiz_options->user_email_template; ?></textarea>
|
814 |
</td>
|
827 |
<p style="margin: 2px 0">- %USER_PHONE%</p>
|
828 |
<p style="margin: 2px 0">- %USER_EMAIL%</p>
|
829 |
<p style="margin: 2px 0">- %QUIZ_NAME%</p>
|
830 |
+
<p style="margin: 2px 0">- %QUESTIONS_ANSWERS%</p>
|
831 |
</td>
|
832 |
<td><textarea cols="80" rows="15" id="mlw_quiz_after_message" name="mlw_quiz_admin_email_template"><?php echo $mlw_quiz_options->admin_email_template; ?></textarea>
|
833 |
</td>
|
includes/mlw_results.php
CHANGED
@@ -116,6 +116,7 @@ function mlw_generate_quiz_results()
|
|
116 |
<h3><b>Help</b></h3>
|
117 |
<p>This page shows all of the results from the taken quizzes.</p>
|
118 |
<p>The table show the result id, the score from the quiz, the contact information provided, and the time the quiz was taken.</p>
|
|
|
119 |
</div>
|
120 |
</div>
|
121 |
</div>
|
116 |
<h3><b>Help</b></h3>
|
117 |
<p>This page shows all of the results from the taken quizzes.</p>
|
118 |
<p>The table show the result id, the score from the quiz, the contact information provided, and the time the quiz was taken.</p>
|
119 |
+
<p>To get results to a specific quiz, go to quiz page and click on results from that quiz.</p>
|
120 |
</div>
|
121 |
</div>
|
122 |
</div>
|
mlw_quizmaster2.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
Plugin Name: Quiz Master Next
|
5 |
Description: This adds a quiz function to your website. This is the new version of the wildly popular Quiz Master.
|
6 |
-
Version: 0.
|
7 |
Author: Frank Corso
|
8 |
Author URI: http://www.mylocalwebstop.com/
|
9 |
Plugin URI: http://www.mylocalwebstop.com/
|
@@ -34,7 +34,6 @@ include("includes/mlw_results.php");
|
|
34 |
///Activation Actions
|
35 |
add_action('admin_menu', 'mlw_add_menu');
|
36 |
add_shortcode('mlw_quizmaster', 'mlw_quiz_shortcode');
|
37 |
-
//add_action('wp_dashboard_setup', "mlw_add_dashboard_widget"); Commented out until I have a use for it. Creates dashboard widget
|
38 |
register_activation_hook( __FILE__, 'mlw_quiz_activate');
|
39 |
register_deactivation_hook( __FILE__, 'mlw_quiz_deactivate');
|
40 |
|
@@ -44,7 +43,8 @@ function mlw_add_menu()
|
|
44 |
{
|
45 |
if (function_exists('add_menu_page'))
|
46 |
{
|
47 |
-
add_menu_page('
|
|
|
48 |
add_submenu_page(__FILE__, 'Quiz Options', 'Quiz Options', 8, 'mlw_quiz_options', 'mlw_generate_quiz_options');
|
49 |
add_submenu_page(__FILE__, 'Quiz Results', 'Quiz Results', 8, 'mlw_quiz_results', 'mlw_generate_quiz_results');
|
50 |
add_submenu_page(__FILE__, 'Support', 'Support', 8, 'mlw_quiz_tools', 'mlw_generate_main_page');
|
3 |
/*
|
4 |
Plugin Name: Quiz Master Next
|
5 |
Description: This adds a quiz function to your website. This is the new version of the wildly popular Quiz Master.
|
6 |
+
Version: 0.2
|
7 |
Author: Frank Corso
|
8 |
Author URI: http://www.mylocalwebstop.com/
|
9 |
Plugin URI: http://www.mylocalwebstop.com/
|
34 |
///Activation Actions
|
35 |
add_action('admin_menu', 'mlw_add_menu');
|
36 |
add_shortcode('mlw_quizmaster', 'mlw_quiz_shortcode');
|
|
|
37 |
register_activation_hook( __FILE__, 'mlw_quiz_activate');
|
38 |
register_deactivation_hook( __FILE__, 'mlw_quiz_deactivate');
|
39 |
|
43 |
{
|
44 |
if (function_exists('add_menu_page'))
|
45 |
{
|
46 |
+
add_menu_page('Quiz Dashboard', 'Quiz Dashboard', 8, __FILE__, 'mlw_generate_quiz_dashboard');
|
47 |
+
add_submenu_page(__FILE__, 'Quizzes', 'Quizzes', 8, 'mlw_quiz_admin', 'mlw_generate_quiz_admin');
|
48 |
add_submenu_page(__FILE__, 'Quiz Options', 'Quiz Options', 8, 'mlw_quiz_options', 'mlw_generate_quiz_options');
|
49 |
add_submenu_page(__FILE__, 'Quiz Results', 'Quiz Results', 8, 'mlw_quiz_results', 'mlw_generate_quiz_results');
|
50 |
add_submenu_page(__FILE__, 'Support', 'Support', 8, 'mlw_quiz_tools', 'mlw_generate_main_page');
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: fpcorso
|
|
3 |
Tags: quiz, test, score, survey
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 3.6.1
|
6 |
-
Stable tag: 0.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -13,7 +13,7 @@ Use this plugin to add multiple quizzes or tests to your website.
|
|
13 |
|
14 |
This is the successor plugin to the wildly popular Quiz Master plugin I wrote years ago. Re-wrote from the ground up.
|
15 |
|
16 |
-
Use this plugin to add multiple quizzes or tests to your website. This plugin allows for unlimited quizzes each with unlimited amount of questions. The plugin allows you to create the quiz, add it to any page using a customized shortcode, allows the user to take
|
17 |
|
18 |
Features include:
|
19 |
|
@@ -40,9 +40,16 @@ Feel free to use the support option on the main page of the plugin.
|
|
40 |
|
41 |
1. Quiz Admin Page
|
42 |
2. Quiz Options Page
|
|
|
43 |
|
44 |
== Changelog ==
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
= 0.1 (September 1, 2013) =
|
47 |
* Begun Development
|
48 |
* Added ability to create/edit/delete quizzes
|
@@ -53,5 +60,8 @@ Feel free to use the support option on the main page of the plugin.
|
|
53 |
|
54 |
== Upgrade Notice ==
|
55 |
|
|
|
|
|
|
|
56 |
= 0.1 =
|
57 |
Initial Version
|
3 |
Tags: quiz, test, score, survey
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 3.6.1
|
6 |
+
Stable tag: 0.2
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
13 |
|
14 |
This is the successor plugin to the wildly popular Quiz Master plugin I wrote years ago. Re-wrote from the ground up.
|
15 |
|
16 |
+
Use this plugin to add multiple quizzes or tests to your website. This plugin allows for unlimited quizzes each with unlimited amount of questions. The plugin allows you to create the quiz, add it to any page using a customized shortcode, allows the user to take the quiz, and then saves the results.
|
17 |
|
18 |
Features include:
|
19 |
|
40 |
|
41 |
1. Quiz Admin Page
|
42 |
2. Quiz Options Page
|
43 |
+
3. Quiz Dashboard Page
|
44 |
|
45 |
== Changelog ==
|
46 |
|
47 |
+
= 0.2 (September 9, 2013) =
|
48 |
+
* Added New Quiz Dashboard Page
|
49 |
+
* Created Audit Trail
|
50 |
+
* Added Ability to Add Questions/Answers to Templates
|
51 |
+
* Minor Spelling/Grammer Fixes
|
52 |
+
|
53 |
= 0.1 (September 1, 2013) =
|
54 |
* Begun Development
|
55 |
* Added ability to create/edit/delete quizzes
|
60 |
|
61 |
== Upgrade Notice ==
|
62 |
|
63 |
+
= 0.2 =
|
64 |
+
Upgrade to enjoy three new features and some minor fixes!
|
65 |
+
|
66 |
= 0.1 =
|
67 |
Initial Version
|
uninstall.php
CHANGED
@@ -18,4 +18,10 @@ global $wpdb;
|
|
18 |
$sql = "DROP TABLE IF EXISTS ".$table_name;
|
19 |
|
20 |
$results = $wpdb->query( $sql );
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
?>
|
18 |
$sql = "DROP TABLE IF EXISTS ".$table_name;
|
19 |
|
20 |
$results = $wpdb->query( $sql );
|
21 |
+
|
22 |
+
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
23 |
+
|
24 |
+
$sql = "DROP TABLE IF EXISTS ".$table_name;
|
25 |
+
|
26 |
+
$results = $wpdb->query( $sql );
|
27 |
?>
|