Skip to content

Commit

Permalink
Merge pull request #17 from fpcorso/3.4.1
Browse files Browse the repository at this point in the history
Preparing 3.4.1 For Release
  • Loading branch information
fpcorso committed Nov 19, 2014
2 parents 25d4256 + a825469 commit 4559c62
Show file tree
Hide file tree
Showing 9 changed files with 1,311 additions and 1,471 deletions.
30 changes: 30 additions & 0 deletions includes/mlw_alerts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
class MlwQmnAlertManager {

public $alerts = array();

public function newAlert($message, $type)
{
$this->alerts[] = array( 'message' => $message, 'type' => $type );
}

public function showAlerts()
{
$alert_list = "";
foreach ($this->alerts as $alert)
{
if ($alert['type'] == "success")
{
$alert_list .= "<div id=\"message\" class=\"updated below-h2\"><p><strong>Success! </strong>".$alert["message"]."</p></div>";
}
if ($alert['type'] == "error")
{
$alert_list .= "<div id=\"message\" class=\"error below-h2\"><p><strong>Error! </strong>".$alert["message"]."</p></div>";
}
}
echo $alert_list;
}

}
$mlwQmnAlertManager = new MlwQmnAlertManager();
?>
28 changes: 18 additions & 10 deletions includes/mlw_qmn_credits.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,28 +89,36 @@ function mlw_qmn_setTab(tab) {
<div class="mlw_qmn_icon_wrap">Version <?php echo $mlw_quiz_version; ?></div>
<h2 class="nav-tab-wrapper">
<a href="javascript:mlw_qmn_setTab(1);" id="mlw_qmn_tab_1" class="nav-tab nav-tab-active">
What&#8217;s New In 3.3</a>
What&#8217;s New In 3.4</a>
<a href="javascript:mlw_qmn_setTab(2);" id="mlw_qmn_tab_2" class="nav-tab">
Changelog For <?php echo $mlw_quiz_version; ?> </a>
<a href="javascript:mlw_qmn_setTab(3);" id="mlw_qmn_tab_3" class="nav-tab">
Requested Features</a>
</h2>
<div id="mlw_quiz_what_new">
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Duplicate Questions With Quizzes</h2>
<p style="text-align: center;">You can now duplicate your questions with your quizzes when duplicating!</p>
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Preview Mode</h2>
<p style="text-align: center;">You can now preview your quiz while in the admin side by going to the new Preview tab on the Quiz Settings page!</p>
<br />
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">New Question Type</h2>
<p style="text-align: center;">You can now use the new Horizontal Multiple Response type to have your multiple reponse check boxes go horizontally instead of vertically.</p>
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Design Changes</h2>
<p style="text-align: center;">This version made several design changes to various pages as we continue to redesign our plugin. We also made many design changes in our code!</p>
<br />
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">We Are On GitHub Now</h2>
<p style="text-align: center;">We have had several users ask for this so we thought we would try it out. We now love github! Be sure to <a href="https://github.com/fpcorso/quiz_master_next/">make suggestions or contribute</a>.</p>
<br />
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Our Premium Add-Ons!</h2>
<p style="text-align: center;">We have several new premium add-ons in our WordPress Store: MailPoet Integration (subscribes users to your MailPoet list), MailChimp Integration (subscribes users to your Mailchimp list), Export Results (exports your quiz results), Extra Shortcodes (gives you extra shortcodes to use), User Dashboard (allow users to see the results from all the quizzes they have taken), and Advertisement Be Gone (gets rid of blue-border ads). Visit our <a href="http://mylocalwebstop.com/shop/">WordPress Store</a> for details! </p>
</div>
<div id="mlw_quiz_changelog" style="display: none;">
<h3><?php echo $mlw_quiz_version; ?> (November 14, 2014)</h3>
<h3><?php echo $mlw_quiz_version; ?> (November 20, 2014)</h3>
<ul>
<li>* Minor Backend Change To Quiz Validation</li>
<li>* Disabled Enter Key On Quiz</li>
<li>* Minor Bug Fixes</li>
<li>* Added Preview Mode (Beta)</li>
<li>* Several Design Changes To Quizzes Page</li>
<li>* Minor Design Changes To Quiz Settings Page</li>
<li>* Added Completion Time To Quiz Results Page</li>
<li>* Added Time Taken To Quiz Result Details Page</li>
<li>* Created New Hook On Quiz Settings Page</li>
<li>* Broke Apart Quiz Settings Backend Into Smaller Functions That Hook Into New Hook</li>
<li>* Created New Backend Alert Manager Class To Replace Archaic Old Error System</li>
</ul>
</div>
<div id="mlw_quiz_requested" style="display: none;">
Expand Down Expand Up @@ -146,4 +154,4 @@ function mlw_qmn_setTab(tab) {
</div>
<?php
}
?>
?>
127 changes: 25 additions & 102 deletions includes/mlw_quiz_admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,8 @@
function mlw_generate_quiz_admin()
{
global $wpdb;
global $mlwQmnAlertManager;
$table_name = $wpdb->prefix . "mlw_quizzes";
$hasCreatedQuiz = false;
$hasDeletedQuiz = false;
$hasUpdatedQuizName = false;
$hasDuplicatedQuiz = false;
$mlw_qmn_isQueryError = false;
$mlw_qmn_error_code = '0';

//Create new quiz
if ( isset( $_POST["create_quiz"] ) && $_POST["create_quiz"] == "confirmation" )
Expand Down Expand Up @@ -77,7 +72,7 @@ function mlw_generate_quiz_admin()
$results = $wpdb->query( $insert );
if ($results != false)
{
$hasCreatedQuiz = true;
$mlwQmnAlertManager->newAlert('Your new quiz has been created successfully. To begin editing your quiz, click the Edit link on the new quiz.', 'success');
//Insert Action Into Audit Trail
global $current_user;
get_currentuserinfo();
Expand All @@ -89,8 +84,7 @@ function mlw_generate_quiz_admin()
}
else
{
$mlw_qmn_error_code = '0001';
$mlw_qmn_isQueryError = true;
$mlwQmnAlertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0001.', 'error');
}

}
Expand All @@ -109,7 +103,7 @@ function mlw_generate_quiz_admin()
$delete_question_results = $wpdb->query( $update );
if ($results != false)
{
$hasDeletedQuiz = true;
$mlwQmnAlertManager->newAlert('Your quiz has been deleted successfully.', 'success');

//Insert Action Into Audit Trail
global $current_user;
Expand All @@ -122,8 +116,7 @@ function mlw_generate_quiz_admin()
}
else
{
$mlw_qmn_error_code = '0002';
$mlw_qmn_isQueryError = true;
$mlwQmnAlertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0002.', 'error');
}

}
Expand All @@ -137,7 +130,7 @@ function mlw_generate_quiz_admin()
$results = $wpdb->query( $mlw_update_quiz_table );
if ($results != false)
{
$hasUpdatedQuizName = true;
$mlwQmnAlertManager->newAlert('Your quiz name has been updated successfully.', 'success');

//Insert Action Into Audit Trail
global $current_user;
Expand All @@ -150,8 +143,7 @@ function mlw_generate_quiz_admin()
}
else
{
$mlw_qmn_error_code = '0003';
$mlw_qmn_isQueryError = true;
$mlwQmnAlertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0003.', 'error');
}
}

Expand Down Expand Up @@ -265,6 +257,7 @@ function mlw_generate_quiz_admin()
//$results = $wpdb->query( "INSERT INTO ".$table_name." (quiz_id, quiz_name, message_before, message_after, message_comment, message_end_template, user_email_template, admin_email_template, submit_button_text, name_field_text, business_field_text, email_field_text, phone_field_text, comment_field_text, email_from_text, question_answer_template, leaderboard_template, system, randomness_order, loggedin_user_contact, show_score, send_user_email, send_admin_email, contact_info_location, user_name, user_comp, user_email, user_phone, admin_email, comment_section, question_from_total, total_user_tries, total_user_tries_text, certificate_template, social_media, social_media_text, pagination, pagination_text, timer_limit, quiz_stye, question_numbering, quiz_views, quiz_taken, deleted) VALUES (NULL , '".$mlw_duplicate_quiz_name."' , '".$mlw_qmn_duplicate_data->message_before."', '".$mlw_qmn_duplicate_data->message_after."', '".$mlw_qmn_duplicate_data->message_comment."', '".$mlw_qmn_duplicate_data->message_end_template."', '".$mlw_qmn_duplicate_data->user_email_template."', '".$mlw_qmn_duplicate_data->admin_email_template."', '".$mlw_qmn_duplicate_data->submit_button_text."', '".$mlw_qmn_duplicate_data->name_field_text."', '".$mlw_qmn_duplicate_data->business_field_text."', '".$mlw_qmn_duplicate_data->email_field_text."', '".$mlw_qmn_duplicate_data->phone_field_text."', '".$mlw_qmn_duplicate_data->comment_field_text."', '".$mlw_qmn_duplicate_data->email_from_text."', '".$mlw_qmn_duplicate_data->question_answer_template."', '".$mlw_qmn_duplicate_data->leaderboard_template."', ".$mlw_qmn_duplicate_data->system.", ".$mlw_qmn_duplicate_data->randomness_order.", ".$mlw_qmn_duplicate_data->loggedin_user_contact.", ".$mlw_qmn_duplicate_data->show_score.", ".$mlw_qmn_duplicate_data->send_user_email.", ".$mlw_qmn_duplicate_data->send_admin_email.", ".$mlw_qmn_duplicate_data->contact_info_location.", ".$mlw_qmn_duplicate_data->user_name.", ".$mlw_qmn_duplicate_data->user_comp.", ".$mlw_qmn_duplicate_data->user_email.", ".$mlw_qmn_duplicate_data->user_phone.", '".get_option( 'admin_email', 'Enter email' )."', ".$mlw_qmn_duplicate_data->comment_section.", ".$mlw_qmn_duplicate_data->question_from_total.", ".$mlw_qmn_duplicate_data->total_user_tries.", '".$mlw_qmn_duplicate_data->total_user_tries_text."', '".$mlw_qmn_duplicate_data->certificate_template."', ".$mlw_qmn_duplicate_data->social_media.", '".$mlw_qmn_duplicate_data->social_media_text."', ".$mlw_qmn_duplicate_data->pagination.", '".$mlw_qmn_duplicate_data->pagination_text."', ".$mlw_qmn_duplicate_data->timer_limit.", '".$mlw_qmn_duplicate_data->quiz_stye."', ".$mlw_qmn_duplicate_data->question_numbering.", 0, 0, 0)" );
if ($results != false)
{
$mlwQmnAlertManager->newAlert('Your quiz has been duplicated successfully.', 'success');
$hasDuplicatedQuiz = true;

//Insert Action Into Audit Trail
Expand All @@ -278,8 +271,7 @@ function mlw_generate_quiz_admin()
}
else
{
$mlw_qmn_error_code = '0011';
$mlw_qmn_isQueryError = true;
$mlwQmnAlertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0011.', 'error');
}
if (isset($_POST["duplicate_questions"]))
{
Expand Down Expand Up @@ -342,8 +334,7 @@ function mlw_generate_quiz_admin()
);
if ($question_results == false)
{
$mlw_qmn_error_code = '0011';
$mlw_qmn_isQueryError = true;
$mlwQmnAlertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0020.', 'error');
}
}
}
Expand Down Expand Up @@ -386,30 +377,8 @@ function mlw_generate_quiz_admin()
var $j = jQuery.noConflict();
// increase the default animation speed to exaggerate the effect
$j.fx.speeds._default = 1000;
$j(function() {
$j('#dialog').dialog({
autoOpen: false,
show: 'blind',
hide: 'explode',
buttons: {
Ok: function() {
$j(this).dialog('close');
}
}
});

$j('#opener').click(function() {
$j('#dialog').dialog('open');
return false;
} );
});
$j(function() {
$j("#prev_page, #next_page").button();
$j("#new_quiz_button, #new_quiz_button_two").button({
icons: {
primary: "ui-icon-circle-plus"
}
});
});
$j(function() {
$j('#new_quiz_dialog').dialog({
Expand Down Expand Up @@ -490,59 +459,26 @@ function duplicateQuiz(id, quizName){
cursor:hand;
}
</style>
<div class="wrap">
<div class='mlw_quiz_options'>
<h2>Quizzes<a id="opener" href="">(?)</a></h2>
<?php if ($hasCreatedQuiz)
<style>
.linkOptions
{
?>
<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
<strong>Hey!</strong> Your new quiz has been created successfully. To begin editing options and adding questions to your quiz, click on the edit link for that quiz.</p>
</div>
<?php
font-size: 14px !important;
}
if ($hasDuplicatedQuiz)
.linkDelete
{
?>
<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
<strong>Hey!</strong> The quiz has been duplicated successfully.</p>
</div>
<?php
color: red !important;
}
?>
<?php if ($mlw_qmn_isQueryError)
.linkOptions:hover
{
?>
<div class="ui-state-error ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
<strong>Uh-Oh!</strong> There has been an error in this action! Please share this with the developer: Error Code <?php echo $mlw_qmn_error_code; ?></p>
</div>
<?php
background-color: black;
}
if ($hasDeletedQuiz)
{
?>
<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
<strong>Hey!</strong> The quiz has been deleted.</p>
</div>
<?php
}
?>
<?php if ($hasUpdatedQuizName)
{
?>
<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
<strong>Hey!</strong> The quiz name has been updated.</p>
</div>
<?php
}
?>
<button id="new_quiz_button_two">Create New Quiz</button>
</style>
<div class="wrap">
<div class='mlw_quiz_options'>
<h2>Quizzes<a id="new_quiz_button" href="javascript:();" class="add-new-h2">Add New</a></h2>
<?php
$mlwQmnAlertManager->showAlerts();

$quotes_list = "";
$display = "";
$alternate = "";
Expand All @@ -551,7 +487,8 @@ function duplicateQuiz(id, quizName){
else $alternate = " class=\"alternate\"";
$quotes_list .= "<tr{$alternate}>";
$quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_id . "</span></td>";
$quotes_list .= "<td class='post-title column-title'><span style='font-size:16px;'>" . esc_html($mlw_quiz_info->quiz_name) ." </span><span style='color:green;font-size:12px;'><a onclick=\"editQuizName('".$mlw_quiz_info->quiz_id."','".esc_js($mlw_quiz_info->quiz_name)."')\" href='#'>(Edit Name)</a></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."','".esc_js($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> | <a href='#' onclick=\"duplicateQuiz('".$mlw_quiz_info->quiz_id."','".esc_js($mlw_quiz_info->quiz_name)."')\">Duplicate</a></span></div></td>";
$quotes_list .= "<td class='post-title column-title'><span style='font-size:16px;'>" . esc_html($mlw_quiz_info->quiz_name) ." </span><span style='color:green;font-size:12px;'><a onclick=\"editQuizName('".$mlw_quiz_info->quiz_id."','".esc_js($mlw_quiz_info->quiz_name)."')\" href='javascript:();'>(Edit Name)</a></span>";
$quotes_list .= "<div class=\"row-actions\"><a class='linkOptions' href='admin.php?page=mlw_quiz_options&&quiz_id=".$mlw_quiz_info->quiz_id."'>Edit</a> | <a class='linkOptions' href='admin.php?page=mlw_quiz_results&&quiz_id=".$mlw_quiz_info->quiz_id."'>Results</a> | <a href='javascript:();' class='linkOptions' onclick=\"duplicateQuiz('".$mlw_quiz_info->quiz_id."','".esc_js($mlw_quiz_info->quiz_name)."')\">Duplicate</a> | <a class='linkOptions linkDelete' onclick=\"deleteQuiz('".$mlw_quiz_info->quiz_id."','".esc_js($mlw_quiz_info->quiz_name)."')\" href='javascript:();'>Delete</a></div></td>";
$quotes_list .= "<td><span style='font-size:16px;'>[mlw_quizmaster quiz=".$mlw_quiz_info->quiz_id."]</span></td>";
$quotes_list .= "<td><span style='font-size:16px;'>[mlw_quizmaster_leaderboard mlw_quiz=".$mlw_quiz_info->quiz_id."]</span></td>";
$quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_views . "</span></td>";
Expand Down Expand Up @@ -607,9 +544,6 @@ function duplicateQuiz(id, quizName){
$display .= "</table>";
echo $display;
?>

<button id="new_quiz_button">Create New Quiz</button>

<?php echo mlw_qmn_show_adverts(); ?>
<!--Dialogs-->

Expand Down Expand Up @@ -685,17 +619,6 @@ function duplicateQuiz(id, quizName){
?>
</div>

<!--Help Dialog-->
<div id="dialog" title="Help" style="display:none;">
<h3><b>Help</b></h3>
<p>This page shows all of the quizzes currently on your website.</p>
<p>The table shows the quiz id, the name of your quiz, the shortcode to use on your post or page to add the quiz, the shortcode to use on your post or page to add the leaderboard, the amount of views the quiz has had, and the amount of times the quiz was finished</p>
<p>To create a new quiz, click the Create New Quiz button and fill out the name.</p>
<p>To edit a quiz, click the Edit link underneath the name of the quiz.</p>
<p>To edit a quiz's name, click the Edit Name link next to the name of the quiz.</p>
<p>To delete a quiz, click the Delete link underneath the name of the quiz.</p>
<p>To view the results of a quiz, click the Results link underneath the name of the quiz.</p>
</div>
</div>
</div>
<?php
Expand Down
Loading

0 comments on commit 4559c62

Please sign in to comment.