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

Version Description

Upgrade for new Accept and Number question types. Also, now you have the ability to duplicate individual questions!

Download this release

Release Info

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

Code changes from version 3.0.1 to 3.1.1

includes/mlw_qmn_credits.php CHANGED
@@ -89,35 +89,35 @@ function mlw_generate_about_page()
89
  <div class="mlw_qmn_icon_wrap">Version <?php echo $mlw_quiz_version; ?></div>
90
  <h2 class="nav-tab-wrapper">
91
  <a href="javascript:mlw_qmn_setTab(1);" id="mlw_qmn_tab_1" class="nav-tab nav-tab-active">
92
- What&#8217;s New In 3.0</a>
93
  <a href="javascript:mlw_qmn_setTab(2);" id="mlw_qmn_tab_2" class="nav-tab">
94
  Changelog For <?php echo $mlw_quiz_version; ?> </a>
95
  <a href="javascript:mlw_qmn_setTab(3);" id="mlw_qmn_tab_3" class="nav-tab">
96
  Requested Features</a>
97
  </h2>
98
  <div id="mlw_quiz_what_new">
99
- <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">New Style Manager</h2>
100
- <p style="text-align: center;">I just finished the basics of the new style manager. On the Quiz Styling tab, you will see the style you have currently selected. The new style manager makes it easier to shares styles. In future versions, I will add ability to import and export the styles to make this process even easier.</p>
101
- <br />
102
- <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Quiz Master Next Can Now Handle Non-Question Question Types</h2>
103
- <p style="text-align: center;">In previous versions, to add elements to your quiz in the questions that are not part of the question was very difficult. I have changed the way the plugin handles the question types so that I can create question types that are not questions. In future versions, you will be able to add a video, images, and more using the new question type system. These non-questions will not be part of the quiz but will be able to be placed between questions!</p>
104
  <br />
105
  <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>
106
- <p style="text-align: center;">The first of the non-question question types is the new Text Block. With this type, you can create a block of text that supports HTML and have it inbetween your questions!</p>
 
 
 
 
 
 
107
  <br />
108
  <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>
109
  <p style="text-align: center;">We have several new premium add-ons in our WordPress Store: 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>
110
  </div>
111
  <div id="mlw_quiz_changelog" style="display: none;">
112
- <h3><?php echo $mlw_quiz_version; ?> (August 28, 2014)</h3>
113
  <ul>
114
- <li>* Added New Style Manager</li>
115
- <li>* Added Ability For Non-Question Question Types</li>
116
- <li>* Added New Text Block Question Type</li>
117
- <li>* Added Question Type Column To Question List</li>
118
- <li>* Minor Design Changes To Quiz Questions Tab</li>
119
- <li>* Fixed Results Delete Link Not Working Bug</li>
120
- <li>* Fixed Quiz Name Showing Escaped Values Bug</li>
121
  </ul>
122
  </div>
123
  <div id="mlw_quiz_requested" style="display: none;">
89
  <div class="mlw_qmn_icon_wrap">Version <?php echo $mlw_quiz_version; ?></div>
90
  <h2 class="nav-tab-wrapper">
91
  <a href="javascript:mlw_qmn_setTab(1);" id="mlw_qmn_tab_1" class="nav-tab nav-tab-active">
92
+ What&#8217;s New In 3.1</a>
93
  <a href="javascript:mlw_qmn_setTab(2);" id="mlw_qmn_tab_2" class="nav-tab">
94
  Changelog For <?php echo $mlw_quiz_version; ?> </a>
95
  <a href="javascript:mlw_qmn_setTab(3);" id="mlw_qmn_tab_3" class="nav-tab">
96
  Requested Features</a>
97
  </h2>
98
  <div id="mlw_quiz_what_new">
99
+ <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Duplicate Individual Questions</h2>
100
+ <p style="text-align: center;">You now have the ability to duplicate a question on a quiz. If most of your questions will be similar, you can use the duplicate option on the Quiz Questions tab to make copies of an individual question.</p>
 
 
 
101
  <br />
102
  <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>
103
+ <p style="text-align: center;">You can now use the number input for when you require a numeric answer. This input has a small spinner attached.</p>
104
+ <br />
105
+ <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">New Non-Question Type</h2>
106
+ <p style="text-align: center;">Several people have asked for a way to have a checkbox for terms and conditions or similar. The new Accept question type will allow you to place a checkbox with some text into your quiz.</p>
107
+ <br />
108
+ <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">First Stage Of Mandatory Questions</h2>
109
+ <p style="text-align: center;">Many people have been asking for the ability to make questions mandatory. This version brings the initial system for requiring questions to be answered. In this version only Number, Accept, and Open Answer types are supported.</p>
110
  <br />
111
  <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>
112
  <p style="text-align: center;">We have several new premium add-ons in our WordPress Store: 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>
113
  </div>
114
  <div id="mlw_quiz_changelog" style="display: none;">
115
+ <h3><?php echo $mlw_quiz_version; ?> (September 15, 2014)</h3>
116
  <ul>
117
+ <li>* Added Ability To Duplicate Individual Questions</li>
118
+ <li>* Added Ability To Require Accept, Number, And Open Answer Question Types</li>
119
+ <li>* Added Number Question Type</li>
120
+ <li>* Added Accept Non-Question Type</li>
 
 
 
121
  </ul>
122
  </div>
123
  <div id="mlw_quiz_requested" style="display: none;">
includes/mlw_quiz.php CHANGED
@@ -353,7 +353,7 @@ function mlw_quiz_shortcode($atts)
353
  $results = $wpdb->query( $update );
354
 
355
  //Form validation script
356
- $mlw_display .= "
357
  <script>
358
  function clear_field(field)
359
  {
@@ -362,52 +362,57 @@ function mlw_quiz_shortcode($atts)
362
 
363
  function mlw_validateForm()
364
  {
365
- ";
366
- if ($mlw_quiz_options->user_name == 1)
367
- {
368
- $mlw_display .= "
 
369
  var x=document.forms['quizForm']['mlwUserName'].value;
370
  if (x==null || x=='')
371
  {
372
  document.getElementById('mlw_error_message').innerHTML = '**Name must be filled out!**';
373
  document.getElementById('mlw_error_message_bottom').innerHTML = '**Name must be filled out!**';
374
- return false;
375
- }";
376
- }
377
- if ($mlw_quiz_options->user_comp == 1)
378
- {
379
- $mlw_display .= "
 
380
  var x=document.forms['quizForm']['mlwUserComp'].value;
381
  if (x==null || x=='')
382
  {
383
  document.getElementById('mlw_error_message').innerHTML = '**Business must be filled out!**';
384
  document.getElementById('mlw_error_message_bottom').innerHTML = '**Business must be filled out!**';
385
- return false;
386
- }";
387
- }
388
- if ($mlw_quiz_options->user_email == 1)
389
- {
390
- $mlw_display .= "
 
391
  var x=document.forms['quizForm']['mlwUserEmail'].value;
392
  if (x==null || x=='')
393
  {
394
  document.getElementById('mlw_error_message').innerHTML = '**Email must be filled out!**';
395
  document.getElementById('mlw_error_message_bottom').innerHTML = '**Email must be filled out!**';
396
- return false;
397
- }";
398
- }
399
- if ($mlw_quiz_options->user_phone == 1)
400
- {
401
- $mlw_display .= "
 
402
  var x=document.forms['quizForm']['mlwUserPhone'].value;
403
  if (x==null || x=='')
404
  {
405
  document.getElementById('mlw_error_message').innerHTML = '**Phone number must be filled out!**';
406
  document.getElementById('mlw_error_message_bottom').innerHTML = '**Phone number must be filled out!**';
407
- return false;
408
- }";
409
- }
410
- $mlw_display .= "
 
411
  if (document.forms['quizForm']['mlwUserEmail'].value != '')
412
  {
413
  var x=document.forms['quizForm']['mlwUserEmail'].value;
@@ -417,22 +422,49 @@ function mlw_quiz_shortcode($atts)
417
  {
418
  document.getElementById('mlw_error_message').innerHTML = '**Not a valid e-mail address!**';
419
  document.getElementById('mlw_error_message_bottom').innerHTML = '**Not a valid e-mail address!**';
420
- return false;
421
  }
422
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
423
  jQuery( '.mlw_qmn_quiz input:radio' ).attr('disabled',false);
424
  jQuery( '.mlw_qmn_quiz input:checkbox' ).attr('disabled',false);
425
  jQuery( '.mlw_qmn_quiz select' ).attr('disabled',false);
426
  jQuery( '.mlw_qmn_question_comment' ).attr('disabled',false);
427
  jQuery( '.mlw_answer_open_text' ).attr('disabled',false);
428
  }
429
- </script>";
 
430
 
431
  if ( $mlw_quiz_options->pagination != 0) { $mlw_display .= "<style>.quiz_section { display: none; }</style>"; }
432
 
433
  //Begin the quiz
434
  $mlw_display .= "<div class='mlw_qmn_quiz'>";
435
- $mlw_display .= "<form name='quizForm' action='' method='post' class='mlw_quiz_form' onsubmit='return mlw_validateForm()' >";
436
  $mlw_display .= "<span id='mlw_top_of_quiz'></span>";
437
  $mlw_display .= "<div class='quiz_section quiz_begin slide".$mlw_qmn_section_count."'>";
438
  $mlw_message_before = htmlspecialchars_decode($mlw_quiz_options->message_before, ENT_QUOTES);
@@ -449,11 +481,21 @@ function mlw_quiz_shortcode($atts)
449
 
450
  //Display the questions
451
  foreach($mlw_questions as $mlw_question) {
 
 
 
 
 
 
 
 
 
 
452
  $mlw_qmn_section_count = $mlw_qmn_section_count + 1;
453
  $mlw_display .= "<div class='quiz_section slide".$mlw_qmn_section_count."'>";
454
- $mlw_display .= "<span class='mlw_qmn_question' style='font-weight:bold;'>";
455
  if ($mlw_question->question_type == 0)
456
  {
 
457
  $mlw_qmn_total_questions = $mlw_qmn_total_questions + 1;
458
  if ($mlw_quiz_options->question_numbering == 1) { $mlw_display .= $mlw_qmn_total_questions.") "; }
459
  $mlw_display .= htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span><br />";
@@ -512,6 +554,7 @@ function mlw_quiz_shortcode($atts)
512
  }
513
  elseif ($mlw_question->question_type == 4)
514
  {
 
515
  $mlw_qmn_total_questions = $mlw_qmn_total_questions + 1;
516
  if ($mlw_quiz_options->question_numbering == 1) { $mlw_display .= $mlw_qmn_total_questions.") "; }
517
  $mlw_display .= htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span><br />";
@@ -537,6 +580,7 @@ function mlw_quiz_shortcode($atts)
537
  }
538
  elseif ($mlw_question->question_type == 1)
539
  {
 
540
  $mlw_qmn_total_questions = $mlw_qmn_total_questions + 1;
541
  if ($mlw_quiz_options->question_numbering == 1) { $mlw_display .= $mlw_qmn_total_questions.") "; }
542
  $mlw_display .= htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span><br />";
@@ -589,6 +633,7 @@ function mlw_quiz_shortcode($atts)
589
  }
590
  elseif ($mlw_question->question_type == 2)
591
  {
 
592
  $mlw_qmn_total_questions = $mlw_qmn_total_questions + 1;
593
  if ($mlw_quiz_options->question_numbering == 1) { $mlw_display .= $mlw_qmn_total_questions.") "; }
594
  $mlw_display .= htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span><br />";
@@ -642,10 +687,12 @@ function mlw_quiz_shortcode($atts)
642
  }
643
  elseif ($mlw_question->question_type == 5)
644
  {
 
645
  $mlw_qmn_total_questions = $mlw_qmn_total_questions + 1;
646
  if ($mlw_quiz_options->question_numbering == 1) { $mlw_display .= $mlw_qmn_total_questions.") "; }
647
  $mlw_display .= htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span><br />";
648
- $mlw_display .= "<textarea class='mlw_answer_open_text' cols='70' rows='5' name='question".$mlw_question->question_id."' /></textarea>";
 
649
  $mlw_display .= "<br />";
650
  }
651
  elseif ($mlw_question->question_type == 6)
@@ -653,12 +700,31 @@ function mlw_quiz_shortcode($atts)
653
  $mlw_display .= htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES);
654
  $mlw_display .= "<br />";
655
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
656
  else
657
  {
 
658
  $mlw_qmn_total_questions = $mlw_qmn_total_questions + 1;
659
  if ($mlw_quiz_options->question_numbering == 1) { $mlw_display .= $mlw_qmn_total_questions.") "; }
660
  $mlw_display .= htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span><br />";
661
- $mlw_display .= "<input type='text' class='mlw_answer_open_text' name='question".$mlw_question->question_id."' />";
 
662
  $mlw_display .= "<br />";
663
  }
664
  if ($mlw_question->comments == 0)
353
  $results = $wpdb->query( $update );
354
 
355
  //Form validation script
356
+ ?>
357
  <script>
358
  function clear_field(field)
359
  {
362
 
363
  function mlw_validateForm()
364
  {
365
+ mlw_validateResult = true;
366
+ <?php
367
+ if ($mlw_quiz_options->user_name == 1)
368
+ {
369
+ ?>
370
  var x=document.forms['quizForm']['mlwUserName'].value;
371
  if (x==null || x=='')
372
  {
373
  document.getElementById('mlw_error_message').innerHTML = '**Name must be filled out!**';
374
  document.getElementById('mlw_error_message_bottom').innerHTML = '**Name must be filled out!**';
375
+ mlw_validateResult = false;
376
+ }
377
+ <?php
378
+ }
379
+ if ($mlw_quiz_options->user_comp == 1)
380
+ {
381
+ ?>
382
  var x=document.forms['quizForm']['mlwUserComp'].value;
383
  if (x==null || x=='')
384
  {
385
  document.getElementById('mlw_error_message').innerHTML = '**Business must be filled out!**';
386
  document.getElementById('mlw_error_message_bottom').innerHTML = '**Business must be filled out!**';
387
+ mlw_validateResult = false;
388
+ }
389
+ <?php
390
+ }
391
+ if ($mlw_quiz_options->user_email == 1)
392
+ {
393
+ ?>
394
  var x=document.forms['quizForm']['mlwUserEmail'].value;
395
  if (x==null || x=='')
396
  {
397
  document.getElementById('mlw_error_message').innerHTML = '**Email must be filled out!**';
398
  document.getElementById('mlw_error_message_bottom').innerHTML = '**Email must be filled out!**';
399
+ mlw_validateResult = false;
400
+ }
401
+ <?php
402
+ }
403
+ if ($mlw_quiz_options->user_phone == 1)
404
+ {
405
+ ?>
406
  var x=document.forms['quizForm']['mlwUserPhone'].value;
407
  if (x==null || x=='')
408
  {
409
  document.getElementById('mlw_error_message').innerHTML = '**Phone number must be filled out!**';
410
  document.getElementById('mlw_error_message_bottom').innerHTML = '**Phone number must be filled out!**';
411
+ mlw_validateResult = false;
412
+ }
413
+ <?php
414
+ }
415
+ ?>
416
  if (document.forms['quizForm']['mlwUserEmail'].value != '')
417
  {
418
  var x=document.forms['quizForm']['mlwUserEmail'].value;
422
  {
423
  document.getElementById('mlw_error_message').innerHTML = '**Not a valid e-mail address!**';
424
  document.getElementById('mlw_error_message_bottom').innerHTML = '**Not a valid e-mail address!**';
425
+ mlw_validateResult = false;
426
  }
427
  }
428
+
429
+ jQuery('#quizForm *').filter(':input').each(function(){
430
+ if (jQuery(this).attr('class'))
431
+ {
432
+ console.log('inside first if');
433
+ if(jQuery(this).attr('class').indexOf('mlwRequiredText') > -1 && this.value == "")
434
+ {
435
+ console.log('inside text if');
436
+ document.getElementById('mlw_error_message').innerHTML = '**Please complete all required fields!**';
437
+ document.getElementById('mlw_error_message_bottom').innerHTML = '**Please complete all required fields!**';
438
+ jQuery(this).css("outline", "2px solid red");
439
+ mlw_validateResult = false;
440
+ }
441
+ if(jQuery(this).attr('class').indexOf('mlwRequiredCheck') > -1 && !this.checked)
442
+ {
443
+ console.log('inside check if');
444
+ document.getElementById('mlw_error_message').innerHTML = '**Please complete all required fields!**';
445
+ document.getElementById('mlw_error_message_bottom').innerHTML = '**Please complete all required fields!**';
446
+ jQuery(this).css("outline", "2px solid red");
447
+ mlw_validateResult = false;
448
+ }
449
+ }
450
+ });
451
+
452
+ if (!mlw_validateResult) {return mlw_validateResult;}
453
+
454
  jQuery( '.mlw_qmn_quiz input:radio' ).attr('disabled',false);
455
  jQuery( '.mlw_qmn_quiz input:checkbox' ).attr('disabled',false);
456
  jQuery( '.mlw_qmn_quiz select' ).attr('disabled',false);
457
  jQuery( '.mlw_qmn_question_comment' ).attr('disabled',false);
458
  jQuery( '.mlw_answer_open_text' ).attr('disabled',false);
459
  }
460
+ </script>
461
+ <?php
462
 
463
  if ( $mlw_quiz_options->pagination != 0) { $mlw_display .= "<style>.quiz_section { display: none; }</style>"; }
464
 
465
  //Begin the quiz
466
  $mlw_display .= "<div class='mlw_qmn_quiz'>";
467
+ $mlw_display .= "<form name='quizForm' id='quizForm' action='' method='post' class='mlw_quiz_form' onsubmit='return mlw_validateForm()' >";
468
  $mlw_display .= "<span id='mlw_top_of_quiz'></span>";
469
  $mlw_display .= "<div class='quiz_section quiz_begin slide".$mlw_qmn_section_count."'>";
470
  $mlw_message_before = htmlspecialchars_decode($mlw_quiz_options->message_before, ENT_QUOTES);
481
 
482
  //Display the questions
483
  foreach($mlw_questions as $mlw_question) {
484
+ $mlw_question_settings = @unserialize($mlw_question->question_settings);
485
+ if (!is_array($mlw_question_settings))
486
+ {
487
+ $mlw_question_settings = array();
488
+ $mlw_question_settings['required'] = 1;
489
+ }
490
+ if ( !isset($mlw_question_settings['required']))
491
+ {
492
+ $mlw_question_settings['required'] = 1;
493
+ }
494
  $mlw_qmn_section_count = $mlw_qmn_section_count + 1;
495
  $mlw_display .= "<div class='quiz_section slide".$mlw_qmn_section_count."'>";
 
496
  if ($mlw_question->question_type == 0)
497
  {
498
+ $mlw_display .= "<span class='mlw_qmn_question' style='font-weight:bold;'>";
499
  $mlw_qmn_total_questions = $mlw_qmn_total_questions + 1;
500
  if ($mlw_quiz_options->question_numbering == 1) { $mlw_display .= $mlw_qmn_total_questions.") "; }
501
  $mlw_display .= htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span><br />";
554
  }
555
  elseif ($mlw_question->question_type == 4)
556
  {
557
+ $mlw_display .= "<span class='mlw_qmn_question' style='font-weight:bold;'>";
558
  $mlw_qmn_total_questions = $mlw_qmn_total_questions + 1;
559
  if ($mlw_quiz_options->question_numbering == 1) { $mlw_display .= $mlw_qmn_total_questions.") "; }
560
  $mlw_display .= htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span><br />";
580
  }
581
  elseif ($mlw_question->question_type == 1)
582
  {
583
+ $mlw_display .= "<span class='mlw_qmn_question' style='font-weight:bold;'>";
584
  $mlw_qmn_total_questions = $mlw_qmn_total_questions + 1;
585
  if ($mlw_quiz_options->question_numbering == 1) { $mlw_display .= $mlw_qmn_total_questions.") "; }
586
  $mlw_display .= htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span><br />";
633
  }
634
  elseif ($mlw_question->question_type == 2)
635
  {
636
+ $mlw_display .= "<span class='mlw_qmn_question' style='font-weight:bold;'>";
637
  $mlw_qmn_total_questions = $mlw_qmn_total_questions + 1;
638
  if ($mlw_quiz_options->question_numbering == 1) { $mlw_display .= $mlw_qmn_total_questions.") "; }
639
  $mlw_display .= htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span><br />";
687
  }
688
  elseif ($mlw_question->question_type == 5)
689
  {
690
+ $mlw_display .= "<span class='mlw_qmn_question' style='font-weight:bold;'>";
691
  $mlw_qmn_total_questions = $mlw_qmn_total_questions + 1;
692
  if ($mlw_quiz_options->question_numbering == 1) { $mlw_display .= $mlw_qmn_total_questions.") "; }
693
  $mlw_display .= htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span><br />";
694
+ if ($mlw_question_settings['required'] == 0) {$mlw_requireClass = "mlwRequiredText";} else {$mlw_requireClass = "";}
695
+ $mlw_display .= "<textarea class='mlw_answer_open_text $mlw_requireClass' cols='70' rows='5' name='question".$mlw_question->question_id."' /></textarea>";
696
  $mlw_display .= "<br />";
697
  }
698
  elseif ($mlw_question->question_type == 6)
700
  $mlw_display .= htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES);
701
  $mlw_display .= "<br />";
702
  }
703
+ elseif ($mlw_question->question_type == 7)
704
+ {
705
+ $mlw_display .= "<span class='mlw_qmn_question' style='font-weight:bold;'>";
706
+ $mlw_qmn_total_questions = $mlw_qmn_total_questions + 1;
707
+ if ($mlw_quiz_options->question_numbering == 1) { $mlw_display .= $mlw_qmn_total_questions.") "; }
708
+ $mlw_display .= htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span><br />";
709
+ if ($mlw_question_settings['required'] == 0) {$mlw_requireClass = "mlwRequiredText";} else {$mlw_requireClass = "";}
710
+ $mlw_display .= "<input type='number' class='mlw_answer_number $mlw_requireClass' name='question".$mlw_question->question_id."' />";
711
+ $mlw_display .= "<br />";
712
+ }
713
+ elseif ($mlw_question->question_type == 8)
714
+ {
715
+ if ($mlw_question_settings['required'] == 0) {$mlw_requireClass = "mlwRequiredCheck";} else {$mlw_requireClass = "";}
716
+ $mlw_display .= "<input type='checkbox' id='mlwAcceptance' class='$mlw_requireClass ' />";
717
+ $mlw_display .= "<label for='mlwAcceptance'><span class='mlw_qmn_question' style='font-weight:bold;'>".htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span></label>";
718
+ $mlw_display .= "<br />";
719
+ }
720
  else
721
  {
722
+ $mlw_display .= "<span class='mlw_qmn_question' style='font-weight:bold;'>";
723
  $mlw_qmn_total_questions = $mlw_qmn_total_questions + 1;
724
  if ($mlw_quiz_options->question_numbering == 1) { $mlw_display .= $mlw_qmn_total_questions.") "; }
725
  $mlw_display .= htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span><br />";
726
+ if ($mlw_question_settings['required'] == 0) {$mlw_requireClass = "mlwRequiredText";} else {$mlw_requireClass = "";}
727
+ $mlw_display .= "<input type='text' class='mlw_answer_open_text $mlw_requireClass' name='question".$mlw_question->question_id."' />";
728
  $mlw_display .= "<br />";
729
  }
730
  if ($mlw_question->comments == 0)
includes/mlw_quiz_install.php CHANGED
@@ -168,6 +168,8 @@ function mlw_quiz_activate()
168
  question_order INT NOT NULL,
169
 
170
  question_type INT NOT NULL,
 
 
171
 
172
  deleted INT NOT NULL,
173
 
168
  question_order INT NOT NULL,
169
 
170
  question_type INT NOT NULL,
171
+
172
+ question_settings TEXT NOT NULL,
173
 
174
  deleted INT NOT NULL,
175
 
includes/mlw_quiz_options.php CHANGED
@@ -17,6 +17,7 @@ function mlw_generate_quiz_options()
17
  $hasUpdatedOptions = false;
18
  $hasUpdatedTemplates = false;
19
  $hasDeletedQuestion = false;
 
20
  $hasUpdatedQuestion = false;
21
  $mlw_UpdatedCertificate = false;
22
  $mlw_hasResetQuizStats = false;
@@ -46,6 +47,19 @@ function mlw_generate_quiz_options()
46
  $edit_hint = htmlspecialchars($_POST["edit_hint"], ENT_QUOTES);
47
  $edit_question_order = intval($_POST["edit_question_order"]);
48
  $mlw_edit_answer_total = intval($_POST["question_".$mlw_edit_question_id."_answer_total"]);
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  $i = 1;
50
  $mlw_qmn_new_answer_array = array();
51
  while ($i <= $mlw_edit_answer_total)
@@ -65,7 +79,7 @@ function mlw_generate_quiz_options()
65
  $mlw_qmn_new_answer_array = serialize($mlw_qmn_new_answer_array);
66
  $quiz_id = $_POST["quiz_id"];
67
 
68
- $update = "UPDATE " . $wpdb->prefix . "mlw_questions" . " SET question_name='".$edit_question_name."',answer_array='".$mlw_qmn_new_answer_array."', question_answer_info='".$edit_question_answer_info."', comments='".$edit_comments."', hints='".$edit_hint."', question_order='".$edit_question_order."', question_type='".$mlw_edit_question_type."' WHERE question_id=".$mlw_edit_question_id;
69
  $results = $wpdb->query( $update );
70
  if ($results != false)
71
  {
@@ -114,7 +128,91 @@ function mlw_generate_quiz_options()
114
  $mlw_qmn_isQueryError = true;
115
  $mlw_qmn_error_code = '0002';
116
  }
117
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
 
119
  //Submit new question into database
120
  if ( isset($_POST["create_question"]) && $_POST["create_question"] == "confirmation")
@@ -127,6 +225,9 @@ function mlw_generate_quiz_options()
127
  $hint = htmlspecialchars($_POST["hint"], ENT_QUOTES);
128
  $new_question_order = intval($_POST["new_question_order"]);
129
  $mlw_answer_total = intval($_POST["new_question_answer_total"]);
 
 
 
130
  $i = 1;
131
  $mlw_qmn_new_answer_array = array();
132
  while ($i <= $mlw_answer_total)
@@ -147,7 +248,7 @@ function mlw_generate_quiz_options()
147
  $quiz_id = $_POST["quiz_id"];
148
  $table_name = $wpdb->prefix . "mlw_questions";
149
  $insert = "INSERT INTO " . $table_name .
150
- " (question_id, quiz_id, question_name, answer_array, question_answer_info, comments, hints, question_order, question_type, deleted) VALUES (NULL , ".$quiz_id.", '" . $question_name . "' , '".$mlw_qmn_new_answer_array."', '".$question_answer_info."', '".$comments."', '".$hint."', ".$new_question_order.", '".$question_type."', 0)";
151
  $results = $wpdb->query( $insert );
152
  if ($results != false)
153
  {
@@ -711,24 +812,6 @@ function mlw_generate_quiz_options()
711
  return false;
712
  } );
713
  });
714
- $j(function() {
715
- $j('#options_help_dialog').dialog({
716
- autoOpen: false,
717
- show: 'blind',
718
- width:700,
719
- hide: 'explode',
720
- buttons: {
721
- Ok: function() {
722
- $j(this).dialog('close');
723
- }
724
- }
725
- });
726
-
727
- $j('#options_tab_help').click(function() {
728
- $j('#options_help_dialog').dialog('open');
729
- return false;
730
- } );
731
- });
732
  $j(function() {
733
  $j('#leaderboard_help_dialog').dialog({
734
  autoOpen: false,
@@ -808,7 +891,7 @@ function mlw_generate_quiz_options()
808
  $j( "#tabs" ).tabs();
809
  });
810
  $j(function() {
811
- $j( document ).tooltip();
812
  });
813
  $j(function() {
814
  $j("#accordion").accordion({
@@ -909,6 +992,21 @@ function mlw_generate_quiz_options()
909
  idText.innerHTML = id;
910
  idHidden.value = id;
911
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
912
  function editQuestion(id){
913
  $j("#edit_question_dialog_"+id).dialog({
914
  autoOpen: false,
@@ -955,6 +1053,17 @@ function mlw_generate_quiz_options()
955
 
956
  }
957
  </script>
 
 
 
 
 
 
 
 
 
 
 
958
  <div class="wrap">
959
  <div class='mlw_quiz_options'>
960
  <h2>Quiz Settings For <?php echo $mlw_quiz_options->quiz_name; ?><a id="opener" href="">(?)</a></h2>
@@ -967,8 +1076,7 @@ function mlw_generate_quiz_options()
967
  </div>
968
  <?php
969
  }
970
- ?>
971
- <?php if ($mlw_qmn_isQueryError)
972
  {
973
  ?>
974
  <div class="ui-state-error ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
@@ -986,8 +1094,7 @@ function mlw_generate_quiz_options()
986
  </div>
987
  <?php
988
  }
989
- ?>
990
- <?php if ($hasUpdatedTemplates)
991
  {
992
  ?>
993
  <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
@@ -996,8 +1103,7 @@ function mlw_generate_quiz_options()
996
  </div>
997
  <?php
998
  }
999
- ?>
1000
- <?php if ($hasUpdatedOptions)
1001
  {
1002
  ?>
1003
  <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
@@ -1006,8 +1112,7 @@ function mlw_generate_quiz_options()
1006
  </div>
1007
  <?php
1008
  }
1009
- ?>
1010
- <?php if ($hasDeletedQuestion)
1011
  {
1012
  ?>
1013
  <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
@@ -1016,8 +1121,16 @@ function mlw_generate_quiz_options()
1016
  </div>
1017
  <?php
1018
  }
 
 
1019
  ?>
1020
- <?php if ($hasUpdatedQuestion)
 
 
 
 
 
 
1021
  {
1022
  ?>
1023
  <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
@@ -1026,8 +1139,7 @@ function mlw_generate_quiz_options()
1026
  </div>
1027
  <?php
1028
  }
1029
- ?>
1030
- <?php if ($mlw_hasResetQuizStats)
1031
  {
1032
  ?>
1033
  <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
@@ -1111,6 +1223,11 @@ function mlw_generate_quiz_options()
1111
  $display = "";
1112
  $alternate = "";
1113
  foreach($mlw_question_data as $mlw_question_info) {
 
 
 
 
 
1114
  $mlw_question_type_text = "";
1115
  switch ($mlw_question_info->question_type) {
1116
  case 0:
@@ -1134,6 +1251,12 @@ function mlw_generate_quiz_options()
1134
  case 6:
1135
  $mlw_question_type_text = "Text Block";
1136
  break;
 
 
 
 
 
 
1137
  default:
1138
  $mlw_question_type_text = "Error Code ";
1139
  }
@@ -1142,7 +1265,7 @@ function mlw_generate_quiz_options()
1142
  $question_list .= "<tr{$alternate}>";
1143
  $question_list .= "<td><span style='font-size:16px;'>" . $mlw_question_info->question_order . "</span></td>";
1144
  $question_list .= "<td><span style='font-size:16px;'>" . $mlw_question_type_text . "</span></td>";
1145
- $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."')\" href='#'>Edit</a> | <a onclick=\"deleteQuestion('".$mlw_question_info->question_id."')\" href='#'>Delete</a></span></div></td>";
1146
  $question_list .= "</tr>";
1147
 
1148
 
@@ -1230,6 +1353,8 @@ function mlw_generate_quiz_options()
1230
  <option value="5" <?php if ($mlw_question_info->question_type == 5) { echo 'selected="selected"'; } ?>>Open Answer (Large Text Input)</option>
1231
  <option value="4" <?php if ($mlw_question_info->question_type == 4) { echo 'selected="selected"'; } ?>>Multiple Response (Checkbox)</option>
1232
  <option value="6" <?php if ($mlw_question_info->question_type == 6) { echo 'selected="selected"'; } ?>>Text Block</option>
 
 
1233
  </select>
1234
  </div></td>
1235
  </tr>
@@ -1249,6 +1374,15 @@ function mlw_generate_quiz_options()
1249
  cursor:hand;"/>
1250
  </td>
1251
  </tr>
 
 
 
 
 
 
 
 
 
1252
  </table>
1253
  <input type="hidden" name="question_<?php echo $mlw_question_info->question_id; ?>_answer_total" id="question_<?php echo $mlw_question_info->question_id; ?>_answer_total" value="<?php echo $mlw_answer_total; ?>" />
1254
  <p class='submit'><input type='submit' class='button-primary' value='Edit Question' /></p>
@@ -1373,6 +1507,8 @@ function mlw_generate_quiz_options()
1373
  <option value="5">Open Answer (Large Text Input)</option>
1374
  <option value="4">Multiple Response (Checkbox)</option>
1375
  <option value="6">Text Block</option>
 
 
1376
  </select>
1377
  </div></td>
1378
  </tr>
@@ -1392,6 +1528,15 @@ function mlw_generate_quiz_options()
1392
  cursor:hand;"/>
1393
  </td>
1394
  </tr>
 
 
 
 
 
 
 
 
 
1395
  </table>
1396
  <input type="hidden" name="new_question_answer_total" id="new_question_answer_total" value="<?php echo $mlw_answer_total; ?>" />
1397
  <?php
@@ -1585,7 +1730,7 @@ function mlw_generate_quiz_options()
1585
  <?php echo "</form>"; ?>
1586
  </div>
1587
  <div id="tabs-3">
1588
- <button id="save_options_button" onclick="javascript: document.quiz_options_form.submit();">Save Options</button><button id="options_tab_help">Help</button>
1589
  <?php
1590
  echo "<form action='' method='post' name='quiz_options_form'>";
1591
  echo "<input type='hidden' name='save_options' value='confirmation' />";
@@ -2266,26 +2411,23 @@ function mlw_generate_quiz_options()
2266
  ?>
2267
  </div>
2268
 
 
 
 
 
 
 
 
 
 
 
 
 
2269
  <div id="dialog" title="Help" style="display:none;">
2270
  <h3><b>Help</b></h3>
2271
  <p>Having trouble using this page? Be sure to check out our useful <a href='http://mylocalwebstop.com/plugin-documentation/' target="_blank" style="color:blue;">Plugin Documentation</a>!</p>
2272
  </div>
2273
 
2274
- <div id="options_help_dialog" title="Help" style="display:none;">
2275
- <p>This tab is used to edit the different options for the quiz.</p>
2276
- <p>The system option allows you to have the quiz be graded using a correct/incorrect system or the quiz can have each answer worth different amount of points.</p>
2277
- <p>Are the questions random? -> If set to yes, the questions will be random. If set to no, the questions will be shown in the order you have set using the Question Order option.</p>
2278
- <p>Would you like to ask for the contact information at the beginning or at the end of the quiz? -> This option will allow you to choose when to ask for contact information if asked.</p>
2279
- <p>Should we ask for -> The next four options asks whether you want the quiz to ask for the user's name, business, email, and phone number.</p>
2280
- <p>Would you like a place for the user to enter comments? -> If set to yes, a comment section will appear at the end of the quiz for the user to fill out. Customize the text shown above the field by editing
2281
- the "Message Display Before Comment Box" field on the "Quiz Text" tab.</p>
2282
- <p>Send user email upon completion?-> If set to yes, the user will be sent an email after taking the quiz. To customize the text of the email, edit the "Email sent to user after completion"
2283
- field on the "Quiz Text" tab.</p>
2284
- <p>Send admin email upon completion? -> If set to yes, the admin will be sent an email when a quiz has been taken. To customize the text of the email, edit the "Email sent to admin after completion"
2285
- field on the "Quiz Text" tab.</p>
2286
- <p>What email should we send the admin email to? -> This field allows you to set what email address to send the admin emails to.</p>
2287
- </div>
2288
-
2289
  <div id="leaderboard_help_dialog" title="Help" style="display:none;">
2290
  <p>This tab is used to edit the options for the leaderboard for this quiz.</p>
2291
  <p>Currently, you can edit the template for the leaderboard.</p>
17
  $hasUpdatedOptions = false;
18
  $hasUpdatedTemplates = false;
19
  $hasDeletedQuestion = false;
20
+ $hasDuplicatedQuestion = false;
21
  $hasUpdatedQuestion = false;
22
  $mlw_UpdatedCertificate = false;
23
  $mlw_hasResetQuizStats = false;
47
  $edit_hint = htmlspecialchars($_POST["edit_hint"], ENT_QUOTES);
48
  $edit_question_order = intval($_POST["edit_question_order"]);
49
  $mlw_edit_answer_total = intval($_POST["question_".$mlw_edit_question_id."_answer_total"]);
50
+ $mlw_row_settings = $wpdb->get_row( $wpdb->prepare( "SELECT question_settings FROM " . $wpdb->prefix . "mlw_questions" . " WHERE question_id=%d", $mlw_edit_question_id ) );
51
+ $mlw_settings = @unserialize($mlw_row_settings->question_settings);
52
+ if ( !is_array($mlw_settings) )
53
+ {
54
+ $mlw_settings = array();
55
+ $mlw_settings['required'] = intval($_POST["edit_required"]);
56
+ }
57
+ if ( !isset($mlw_settings['required']))
58
+ {
59
+ $mlw_settings['required'] = intval($_POST["edit_required"]);
60
+ }
61
+ $mlw_settings['required'] = intval($_POST["edit_required"]);
62
+ $mlw_settings = serialize($mlw_settings);
63
  $i = 1;
64
  $mlw_qmn_new_answer_array = array();
65
  while ($i <= $mlw_edit_answer_total)
79
  $mlw_qmn_new_answer_array = serialize($mlw_qmn_new_answer_array);
80
  $quiz_id = $_POST["quiz_id"];
81
 
82
+ $update = "UPDATE " . $wpdb->prefix . "mlw_questions" . " SET question_name='".$edit_question_name."',answer_array='".$mlw_qmn_new_answer_array."', question_answer_info='".$edit_question_answer_info."', comments='".$edit_comments."', hints='".$edit_hint."', question_order='".$edit_question_order."', question_type='".$mlw_edit_question_type."', question_settings='".$mlw_settings."' WHERE question_id=".$mlw_edit_question_id;
83
  $results = $wpdb->query( $update );
84
  if ($results != false)
85
  {
128
  $mlw_qmn_isQueryError = true;
129
  $mlw_qmn_error_code = '0002';
130
  }
131
+ }
132
+
133
+ //Duplicate Questions
134
+ if ( isset($_POST["duplicate_question"]) && $_POST["duplicate_question"] == "confirmation")
135
+ {
136
+ //Variables from delete question form
137
+ $mlw_question_id = intval($_POST["duplicate_question_id"]);
138
+ $quiz_id = $_POST["quiz_id"];
139
+
140
+ $mlw_original = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM ".$wpdb->prefix."mlw_questions WHERE question_id=%d", $mlw_question_id ), ARRAY_A );
141
+
142
+ $results = $wpdb->insert(
143
+ $wpdb->prefix."mlw_questions",
144
+ array(
145
+ 'quiz_id' => $mlw_original['quiz_id'],
146
+ 'question_name' => $mlw_original['question_name'],
147
+ 'answer_array' => $mlw_original['answer_array'],
148
+ 'answer_one' => $mlw_original['answer_one'],
149
+ 'answer_one_points' => $mlw_original['answer_one_points'],
150
+ 'answer_two' => $mlw_original['answer_two'],
151
+ 'answer_two_points' => $mlw_original['answer_two_points'],
152
+ 'answer_three' => $mlw_original['answer_three'],
153
+ 'answer_three_points' => $mlw_original['answer_three_points'],
154
+ 'answer_four' => $mlw_original['answer_four'],
155
+ 'answer_four_points' => $mlw_original['answer_four_points'],
156
+ 'answer_five' => $mlw_original['answer_five'],
157
+ 'answer_five_points' => $mlw_original['answer_five_points'],
158
+ 'answer_six' => $mlw_original['answer_six'],
159
+ 'answer_six_points' => $mlw_original['answer_six_points'],
160
+ 'correct_answer' => $mlw_original['correct_answer'],
161
+ 'question_answer_info' => $mlw_original['question_answer_info'],
162
+ 'comments' => $mlw_original['comments'],
163
+ 'hints' => $mlw_original['hints'],
164
+ 'question_order' => $mlw_original['question_order'],
165
+ 'question_type' => $mlw_original['question_type'],
166
+ 'question_settings' => $mlw_original['question_settings'],
167
+ 'deleted' => $mlw_original['deleted']
168
+ ),
169
+ array(
170
+ '%d',
171
+ '%s',
172
+ '%s',
173
+ '%s',
174
+ '%d',
175
+ '%s',
176
+ '%d',
177
+ '%s',
178
+ '%d',
179
+ '%s',
180
+ '%d',
181
+ '%s',
182
+ '%d',
183
+ '%s',
184
+ '%d',
185
+ '%d',
186
+ '%s',
187
+ '%d',
188
+ '%s',
189
+ '%d',
190
+ '%d',
191
+ '%s',
192
+ '%d'
193
+ )
194
+ );
195
+
196
+ if ($results != false)
197
+ {
198
+ $hasDuplicatedQuestion = true;
199
+
200
+ //Insert Action Into Audit Trail
201
+ global $current_user;
202
+ get_currentuserinfo();
203
+ $table_name = $wpdb->prefix . "mlw_qm_audit_trail";
204
+ $insert = "INSERT INTO " . $table_name .
205
+ "(trail_id, action_user, action, time) " .
206
+ "VALUES (NULL , '" . $current_user->display_name . "' , 'Question Has Been Duplicated: ".$mlw_question_id."' , '" . date("h:i:s A m/d/Y") . "')";
207
+ $results = $wpdb->query( $insert );
208
+ }
209
+ else
210
+ {
211
+ $mlw_qmn_isQueryError = true;
212
+ $mlw_qmn_error_code = '0019';
213
+ }
214
+ }
215
+
216
 
217
  //Submit new question into database
218
  if ( isset($_POST["create_question"]) && $_POST["create_question"] == "confirmation")
225
  $hint = htmlspecialchars($_POST["hint"], ENT_QUOTES);
226
  $new_question_order = intval($_POST["new_question_order"]);
227
  $mlw_answer_total = intval($_POST["new_question_answer_total"]);
228
+ $mlw_settings = array();
229
+ $mlw_settings['required'] = intval($_POST["required"]);
230
+ $mlw_settings = serialize($mlw_settings);
231
  $i = 1;
232
  $mlw_qmn_new_answer_array = array();
233
  while ($i <= $mlw_answer_total)
248
  $quiz_id = $_POST["quiz_id"];
249
  $table_name = $wpdb->prefix . "mlw_questions";
250
  $insert = "INSERT INTO " . $table_name .
251
+ " (question_id, quiz_id, question_name, answer_array, question_answer_info, comments, hints, question_order, question_type, question_settings, deleted) VALUES (NULL , ".$quiz_id.", '" . $question_name . "' , '".$mlw_qmn_new_answer_array."', '".$question_answer_info."', '".$comments."', '".$hint."', ".$new_question_order.", '".$question_type."', '".$mlw_settings."', 0)";
252
  $results = $wpdb->query( $insert );
253
  if ($results != false)
254
  {
812
  return false;
813
  } );
814
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
815
  $j(function() {
816
  $j('#leaderboard_help_dialog').dialog({
817
  autoOpen: false,
891
  $j( "#tabs" ).tabs();
892
  });
893
  $j(function() {
894
+ //$j( document ).tooltip();
895
  });
896
  $j(function() {
897
  $j("#accordion").accordion({
992
  idText.innerHTML = id;
993
  idHidden.value = id;
994
  };
995
+ function duplicateQuestion(id){
996
+ $j("#duplicate_dialog").dialog({
997
+ autoOpen: false,
998
+ show: 'blind',
999
+ hide: 'explode',
1000
+ buttons: {
1001
+ Cancel: function() {
1002
+ $j(this).dialog('close');
1003
+ }
1004
+ }
1005
+ });
1006
+ $j("#duplicate_dialog").dialog('open');
1007
+ var idHidden = document.getElementById("duplicate_question_id");
1008
+ idHidden.value = id;
1009
+ };
1010
  function editQuestion(id){
1011
  $j("#edit_question_dialog_"+id).dialog({
1012
  autoOpen: false,
1053
 
1054
  }
1055
  </script>
1056
+ <style>
1057
+ .linkOptions
1058
+ {
1059
+ color: green !important;
1060
+ font-size: 14px !important;
1061
+ }
1062
+ .linkOptions:hover
1063
+ {
1064
+ background-color: black;
1065
+ }
1066
+ </style>
1067
  <div class="wrap">
1068
  <div class='mlw_quiz_options'>
1069
  <h2>Quiz Settings For <?php echo $mlw_quiz_options->quiz_name; ?><a id="opener" href="">(?)</a></h2>
1076
  </div>
1077
  <?php
1078
  }
1079
+ if ($mlw_qmn_isQueryError)
 
1080
  {
1081
  ?>
1082
  <div class="ui-state-error ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
1094
  </div>
1095
  <?php
1096
  }
1097
+ if ($hasUpdatedTemplates)
 
1098
  {
1099
  ?>
1100
  <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
1103
  </div>
1104
  <?php
1105
  }
1106
+ if ($hasUpdatedOptions)
 
1107
  {
1108
  ?>
1109
  <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
1112
  </div>
1113
  <?php
1114
  }
1115
+ if ($hasDeletedQuestion)
 
1116
  {
1117
  ?>
1118
  <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
1121
  </div>
1122
  <?php
1123
  }
1124
+ if ($hasDuplicatedQuestion)
1125
+ {
1126
  ?>
1127
+ <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
1128
+ <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
1129
+ <strong>Success!</strong> The question has been duplicated.</p>
1130
+ </div>
1131
+ <?php
1132
+ }
1133
+ if ($hasUpdatedQuestion)
1134
  {
1135
  ?>
1136
  <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
1139
  </div>
1140
  <?php
1141
  }
1142
+ if ($mlw_hasResetQuizStats)
 
1143
  {
1144
  ?>
1145
  <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
1223
  $display = "";
1224
  $alternate = "";
1225
  foreach($mlw_question_data as $mlw_question_info) {
1226
+ $mlw_question_settings = @unserialize($mlw_question_info->question_settings);
1227
+ if (!is_array($mlw_question_settings)) {
1228
+ $mlw_question_settings = array();
1229
+ $mlw_question_settings['required'] = 1;
1230
+ }
1231
  $mlw_question_type_text = "";
1232
  switch ($mlw_question_info->question_type) {
1233
  case 0:
1251
  case 6:
1252
  $mlw_question_type_text = "Text Block";
1253
  break;
1254
+ case 7:
1255
+ $mlw_question_type_text = "Number";
1256
+ break;
1257
+ case 8:
1258
+ $mlw_question_type_text = "Accept";
1259
+ break;
1260
  default:
1261
  $mlw_question_type_text = "Error Code ";
1262
  }
1265
  $question_list .= "<tr{$alternate}>";
1266
  $question_list .= "<td><span style='font-size:16px;'>" . $mlw_question_info->question_order . "</span></td>";
1267
  $question_list .= "<td><span style='font-size:16px;'>" . $mlw_question_type_text . "</span></td>";
1268
+ $question_list .= "<td class='post-title column-title'><span style='font-size:16px;'>" . $mlw_question_info->question_name ."</span><div><a class='linkOptions' onclick=\"editQuestion('".$mlw_question_info->question_id."')\" href='#'>Edit</a> | <a class='linkOptions' onclick=\"deleteQuestion('".$mlw_question_info->question_id."')\" href='#'>Delete</a> | <a class='linkOptions' onclick=\"duplicateQuestion('".$mlw_question_info->question_id."')\" href='#'>Duplicate</a></span></div></td>";
1269
  $question_list .= "</tr>";
1270
 
1271
 
1353
  <option value="5" <?php if ($mlw_question_info->question_type == 5) { echo 'selected="selected"'; } ?>>Open Answer (Large Text Input)</option>
1354
  <option value="4" <?php if ($mlw_question_info->question_type == 4) { echo 'selected="selected"'; } ?>>Multiple Response (Checkbox)</option>
1355
  <option value="6" <?php if ($mlw_question_info->question_type == 6) { echo 'selected="selected"'; } ?>>Text Block</option>
1356
+ <option value="7" <?php if ($mlw_question_info->question_type == 7) { echo 'selected="selected"'; } ?>>Number</option>
1357
+ <option value="8" <?php if ($mlw_question_info->question_type == 8) { echo 'selected="selected"'; } ?>>Accept</option>
1358
  </select>
1359
  </div></td>
1360
  </tr>
1374
  cursor:hand;"/>
1375
  </td>
1376
  </tr>
1377
+ <tr valign="top">
1378
+ <td><span style='font-weight:bold;'>Required?</span></td>
1379
+ <td colspan="3">
1380
+ <select name="edit_required">
1381
+ <option value="0" <?php if ($mlw_question_settings['required'] == 0) { echo 'selected="selected"'; } ?>>Yes</option>
1382
+ <option value="1" <?php if ($mlw_question_settings['required'] == 1) { echo 'selected="selected"'; } ?>>No</option>
1383
+ </select>
1384
+ </div></td>
1385
+ </tr>
1386
  </table>
1387
  <input type="hidden" name="question_<?php echo $mlw_question_info->question_id; ?>_answer_total" id="question_<?php echo $mlw_question_info->question_id; ?>_answer_total" value="<?php echo $mlw_answer_total; ?>" />
1388
  <p class='submit'><input type='submit' class='button-primary' value='Edit Question' /></p>
1507
  <option value="5">Open Answer (Large Text Input)</option>
1508
  <option value="4">Multiple Response (Checkbox)</option>
1509
  <option value="6">Text Block</option>
1510
+ <option value="7">Number</option>
1511
+ <option value="8">Accept</option>
1512
  </select>
1513
  </div></td>
1514
  </tr>
1528
  cursor:hand;"/>
1529
  </td>
1530
  </tr>
1531
+ <tr valign="top">
1532
+ <td><span style='font-weight:bold;'>Required?</span></td>
1533
+ <td colspan="3">
1534
+ <select name="required">
1535
+ <option value="0" selected="selected">Yes</option>
1536
+ <option value="1">No</option>
1537
+ </select>
1538
+ </div></td>
1539
+ </tr>
1540
  </table>
1541
  <input type="hidden" name="new_question_answer_total" id="new_question_answer_total" value="<?php echo $mlw_answer_total; ?>" />
1542
  <?php
1730
  <?php echo "</form>"; ?>
1731
  </div>
1732
  <div id="tabs-3">
1733
+ <button id="save_options_button" onclick="javascript: document.quiz_options_form.submit();">Save Options</button>
1734
  <?php
1735
  echo "<form action='' method='post' name='quiz_options_form'>";
1736
  echo "<input type='hidden' name='save_options' value='confirmation' />";
2411
  ?>
2412
  </div>
2413
 
2414
+ <div id="duplicate_dialog" title="Duplicate Question?" style="display:none;">
2415
+ <h3><b>Are you sure you want to duplicate this Question?</b></h3>
2416
+ <?php
2417
+ echo "<form action='' method='post'>";
2418
+ echo "<input type='hidden' name='duplicate_question' value='confirmation' />";
2419
+ echo "<input type='hidden' id='duplicate_question_id' name='duplicate_question_id' value='' />";
2420
+ echo "<input type='hidden' name='quiz_id' value='".$quiz_id."' />";
2421
+ echo "<p class='submit'><input type='submit' class='button-primary' value='Duplicate Question' /></p>";
2422
+ echo "</form>";
2423
+ ?>
2424
+ </div>
2425
+
2426
  <div id="dialog" title="Help" style="display:none;">
2427
  <h3><b>Help</b></h3>
2428
  <p>Having trouble using this page? Be sure to check out our useful <a href='http://mylocalwebstop.com/plugin-documentation/' target="_blank" style="color:blue;">Plugin Documentation</a>!</p>
2429
  </div>
2430
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2431
  <div id="leaderboard_help_dialog" title="Help" style="display:none;">
2432
  <p>This tab is used to edit the options for the leaderboard for this quiz.</p>
2433
  <p>Currently, you can edit the template for the leaderboard.</p>
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 = "3.0.1";
10
  if ( ! get_option('mlw_quiz_master_version'))
11
  {
12
  add_option('mlw_quiz_master_version' , $data);
@@ -293,6 +293,15 @@ function mlw_quiz_update()
293
  $results = $wpdb->query( $update_sql );
294
  }
295
 
 
 
 
 
 
 
 
 
 
296
  //Update 2.6.1
297
  $results = $wpdb->query( "ALTER TABLE ".$wpdb->prefix . "mlw_qm_audit_trail CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;" );
298
  $results = $wpdb->query( "ALTER TABLE ".$wpdb->prefix . "mlw_questions CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci" );
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 = "3.1.1";
10
  if ( ! get_option('mlw_quiz_master_version'))
11
  {
12
  add_option('mlw_quiz_master_version' , $data);
293
  $results = $wpdb->query( $update_sql );
294
  }
295
 
296
+ //Update 3.1.1
297
+ if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_settings'") != "question_settings")
298
+ {
299
+ $sql = "ALTER TABLE ".$table_name." ADD question_settings TEXT NOT NULL AFTER question_type";
300
+ $results = $wpdb->query( $sql );
301
+ $update_sql = "UPDATE ".$table_name." SET question_settings=''";
302
+ $results = $wpdb->query( $update_sql );
303
+ }
304
+
305
  //Update 2.6.1
306
  $results = $wpdb->query( "ALTER TABLE ".$wpdb->prefix . "mlw_qm_audit_trail CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;" );
307
  $results = $wpdb->query( "ALTER TABLE ".$wpdb->prefix . "mlw_questions CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci" );
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: 3.0.1
7
  Author: Frank Corso
8
  Author URI: http://www.mylocalwebstop.com/
9
  Plugin URI: http://www.mylocalwebstop.com/
@@ -96,7 +96,7 @@ function mlw_qmn_notice() {
96
  }
97
  </style>";
98
  echo '<div class="help_decide"><p>';
99
- printf(__('You have been using the Quiz Master Next plugin for a while now! Thanks for choosing to use this plugin. If it has benefited your website, please consider purchasing an <a href="http://mylocalwebstop.com/shop/">add-on</a>, a <a href="http://wordpress.org/support/view/plugin-reviews/quiz-master-next">review</a>, or taking this <a href="http://mylocalwebstop.com/sample-survey/" target="_blank">survey</a>. | <a href="%1$s">Hide Notice</a>'), '?page=quiz-master-next/mlw_quizmaster2.php&&mlw_qmn_ignore_notice=0');
100
  echo "</p></div>";
101
  }
102
  }
3
  /*
4
  Plugin Name: Quiz Master Next
5
  Description: Use this plugin to add multiple quizzes, tests, or surveys to your website.
6
+ Version: 3.1.1
7
  Author: Frank Corso
8
  Author URI: http://www.mylocalwebstop.com/
9
  Plugin URI: http://www.mylocalwebstop.com/
96
  }
97
  </style>";
98
  echo '<div class="help_decide"><p>';
99
+ printf(__('You have been using the Quiz Master Next plugin for a while now! Thanks for choosing to use this plugin. If it has benefited your website, please consider purchasing an <a href="http://mylocalwebstop.com/shop/">add-on</a>, giving a <a href="http://wordpress.org/support/view/plugin-reviews/quiz-master-next">review</a>, or taking this <a href="http://mylocalwebstop.com/sample-survey/" target="_blank">survey</a>. | <a href="%1$s">Hide Notice</a>'), '?page=quiz-master-next/mlw_quizmaster2.php&&mlw_qmn_ignore_notice=0');
100
  echo "</p></div>";
101
  }
102
  }
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: fpcorso
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RTGYAETX36ZQJ
4
  Tags: quiz, test, score, exam, survey, contact, form, email, answer, question
5
- Requires at least: 3.7.1
6
- Tested up to: 3.9.2
7
- Stable tag: 3.0.1
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
  The easiest and most flexible way to add multiple quizzes, tests, and surveys to your website.
@@ -104,6 +104,12 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
104
 
105
  == Changelog ==
106
 
 
 
 
 
 
 
107
  = 3.0.1 (August 28, 2014) =
108
  * Added New Style Manager
109
  * Added Ability For Non-Question Question Types
@@ -493,6 +499,9 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
493
 
494
  == Upgrade Notice ==
495
 
 
 
 
496
  = 3.0.1 =
497
  Upgrade for new style manager, new non-question types, text block question type, and various design/bug fixes!
498
 
2
  Contributors: fpcorso
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RTGYAETX36ZQJ
4
  Tags: quiz, test, score, exam, survey, contact, form, email, answer, question
5
+ Requires at least: 3.8.1
6
+ Tested up to: 4.0
7
+ Stable tag: 3.1.1
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
  The easiest and most flexible way to add multiple quizzes, tests, and surveys to your website.
104
 
105
  == Changelog ==
106
 
107
+ = 3.1.1 (September 15, 2014) =
108
+ * Added Ability To Duplicate Individual Questions
109
+ * Added Ability To Require Accept, Number, And Open Answer Question Types
110
+ * Added Number Question Type
111
+ * Added Accept Non-Question Type
112
+
113
  = 3.0.1 (August 28, 2014) =
114
  * Added New Style Manager
115
  * Added Ability For Non-Question Question Types
499
 
500
  == Upgrade Notice ==
501
 
502
+ = 3.1.1 =
503
+ Upgrade for new Accept and Number question types. Also, now you have the ability to duplicate individual questions!
504
+
505
  = 3.0.1 =
506
  Upgrade for new style manager, new non-question types, text block question type, and various design/bug fixes!
507