Changeset 948896
- Timestamp:
- 07/15/2014 03:29:57 PM (12 years ago)
- Location:
- wp-survey-and-quiz-tool
- Files:
-
- 29 edited
- 3 copied
-
tags/2.14.1 (copied) (copied from wp-survey-and-quiz-tool/trunk)
-
tags/2.14.1/js/generic.js (modified) (1 diff)
-
tags/2.14.1/lib/Wpsqt/Core.php (modified) (1 diff)
-
tags/2.14.1/lib/Wpsqt/Export/Csv.php (modified) (1 diff)
-
tags/2.14.1/lib/Wpsqt/Page/Main/Results/Mark.php (modified) (1 diff)
-
tags/2.14.1/lib/Wpsqt/Question.php (modified) (1 diff)
-
tags/2.14.1/lib/Wpsqt/Question/Freetext.php (modified) (1 diff)
-
tags/2.14.1/lib/Wpsqt/Question/Likert.php (modified) (1 diff)
-
tags/2.14.1/lib/Wpsqt/Question/Likertmatrix.php (modified) (1 diff)
-
tags/2.14.1/lib/Wpsqt/Question/Multiple.php (modified) (1 diff)
-
tags/2.14.1/lib/Wpsqt/Shortcode.php (modified) (5 diffs)
-
tags/2.14.1/lib/Wpsqt/Tokens.php (modified) (1 diff)
-
tags/2.14.1/pages/admin/forms/question.multiple.php (modified) (1 diff)
-
tags/2.14.1/pages/admin/poll/result.php (modified) (1 diff)
-
tags/2.14.1/pages/admin/surveys/result.list.php (modified) (1 diff)
-
tags/2.14.1/readme.txt (copied) (copied from wp-survey-and-quiz-tool/trunk/readme.txt) (2 diffs)
-
tags/2.14.1/wp-survey-and-quiz-tool.php (copied) (copied from wp-survey-and-quiz-tool/trunk/wp-survey-and-quiz-tool.php)
-
trunk/js/generic.js (modified) (1 diff)
-
trunk/lib/Wpsqt/Core.php (modified) (1 diff)
-
trunk/lib/Wpsqt/Export/Csv.php (modified) (1 diff)
-
trunk/lib/Wpsqt/Page/Main/Results/Mark.php (modified) (1 diff)
-
trunk/lib/Wpsqt/Question.php (modified) (1 diff)
-
trunk/lib/Wpsqt/Question/Freetext.php (modified) (1 diff)
-
trunk/lib/Wpsqt/Question/Likert.php (modified) (1 diff)
-
trunk/lib/Wpsqt/Question/Likertmatrix.php (modified) (1 diff)
-
trunk/lib/Wpsqt/Question/Multiple.php (modified) (1 diff)
-
trunk/lib/Wpsqt/Shortcode.php (modified) (5 diffs)
-
trunk/lib/Wpsqt/Tokens.php (modified) (1 diff)
-
trunk/pages/admin/forms/question.multiple.php (modified) (1 diff)
-
trunk/pages/admin/poll/result.php (modified) (1 diff)
-
trunk/pages/admin/surveys/result.list.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-survey-and-quiz-tool/tags/2.14.1/js/generic.js
r553819 r948896 160 160 var html = ''; 161 161 html += '<tr>'; 162 html += '<td><input type="text" name="multiple_name['+rowCount+']" value="" /></td>';162 html += '<td><input type="text" name="multiple_name['+rowCount+']" value="" style="width: 98%;" /></td>'; // mod: width added 163 163 html += '<td><input type="checkbox" name="multiple_correct['+rowCount+']" value="yes" /></td>'; 164 164 html += '<td><input type="checkbox" name="multiple_delete['+rowCount+']" value="yes" /></td>'; -
wp-survey-and-quiz-tool/tags/2.14.1/lib/Wpsqt/Core.php
r931176 r948896 168 168 $blog_id.'/'.$_SESSION['wpsqt']['current_type'].'-'.$_SESSION['wpsqt']['item_id'].'/' : ''; 169 169 170 if ( file_exists(WPSQT_DIR.'pages/custom/'.$quizPath.$file) ){ 170 $themeFile = get_template_directory() . '/wpsqt/' . $file; 171 172 if ( file_exists($themeFile) ) { 173 return $themeFile; 174 } elseif ( file_exists(WPSQT_DIR.'pages/custom/'.$quizPath.$file) ){ 171 175 return WPSQT_DIR.'pages/custom/'.$quizPath.$file; 172 176 } elseif (file_exists(WPSQT_DIR.'pages/custom/'.$blog_id.'/shared/'.$file)) { -
wp-survey-and-quiz-tool/tags/2.14.1/lib/Wpsqt/Export/Csv.php
r931176 r948896 29 29 public function generate($id) { 30 30 global $wpdb; 31 32 $type = $wpdb->get_row($wpdb->prepare("SELECT `type` FROM `".WPSQT_TABLE_QUIZ_SURVEYS."` WHERE id = %d", array($id)),ARRAY_A); 31 33 32 $results = $wpdb->get_results('SELECT * FROM '.WPSQT_TABLE_RESULTS.' WHERE item_id = "'.$id.'"', ARRAY_A); 34 switch ($type['type']){ 35 case 'quiz': 36 $results = $wpdb->get_results('SELECT * FROM '.WPSQT_TABLE_RESULTS.' WHERE item_id = "'.$id.'"', ARRAY_A); 37 $this->csvLines[] = 'id, Name, Score, Total, Percentage, Pass/Fail, Status, Date'; 38 foreach( $results as $result ){ 39 $csvline = $result['id'].","; 40 $csvline .= $result['person_name'].','; 41 if($result['total'] == 0) {$csvline .= ',,';} else {$csvline .= $result['score'].",".$result['total'].",";} 42 if($result['total'] == 0) {$csvline .= ',';} else {$csvline .= $result['percentage']."%,";} 43 if ($result['pass'] == 1) {$csvline .= "Pass,";} else {$csvline .= "Fail,";} 44 $csvline .= ucfirst($result['status']).","; 45 if (!empty($result['datetaken'])) { $csvline .= date('d-m-y G:i:s',$result['datetaken']); }; 46 $this->csvLines[] = $csvline; 47 } 48 break; 49 case 'survey': 50 case 'poll': 51 $results = $wpdb->get_row($wpdb->prepare("SELECT * FROM `".WPSQT_TABLE_SURVEY_CACHE."` WHERE item_id = %d",array($id)), ARRAY_A); 52 $sections = unserialize($results['sections']); 53 $this->csvLines[] = 'Question Name,Answer,Votes,Percentages'; 33 54 34 $this->csvLines[] = 'id, Name, Score, Total, Percentage, Pass/Fail, Status, Date'; 35 foreach( $results as $result ){ 36 $csvline = $result['id'].","; 37 $csvline .= $result['person_name'].','; 38 if($result['total'] == 0) {$csvline .= ',,';} else {$csvline .= $result['score'].",".$result['total'].",";} 39 if($result['total'] == 0) {$csvline .= ',';} else {$csvline .= $result['percentage']."%,";} 40 if ($result['pass'] == 1) {$csvline .= "Pass,";} else {$csvline .= "Fail,";} 41 $csvline .= ucfirst($result['status']).","; 42 if (!empty($result['datetaken'])) { $csvline .= date('d-m-y G:i:s',$result['datetaken']); }; 43 $this->csvLines[] = $csvline; 55 if (empty($sections) || !is_array($sections)) { 56 break; 57 } 58 59 foreach ($sections as $section) { 60 foreach ($section['questions'] as $question) { 61 $answers_display = array(); 62 if (!empty($question['answers']) && is_array($question['answers'])) { 63 switch ($question['type']){ 64 case 'Likert Matrix': 65 $total = array(); 66 foreach($question['answers'] as $answer_name => $values) { 67 //TODO: Look up this other 68 if ($answer_name == 'other') continue; 69 $answers_display[$answer_name] = array(); 70 $total[$answer_name] =0; 71 foreach ($values as $value){ 72 $answers_display[$answer_name][] = $value['count']; 73 $total[$answer_name] += $value['count']; 74 } 75 } 76 break; 77 case 'Likert': 78 $total = 0; 79 foreach($question['answers'] as $answer_name => $values) { 80 $answers_display[$answer_name] = $values['count']; 81 $total += $values['count']; 82 } 83 break; 84 default: 85 $total = 0; 86 foreach($question['answers'] as $answer) { 87 $answers_display[$answer['text']] = $answer['count']; 88 $total += $answer['count']; 89 } 90 break; 91 } 92 } 93 if ($question['type'] == 'Free Text') { 94 $csvLine .= $question['name'].',This question has free text answers which cannot be shown,,,'; 95 $this->csvLines[] = $csvLine; 96 continue; 97 }else{ 98 foreach ($answers_display as $name => $count) { 99 $csvLine = $question['name']; 100 $question['name'] = str_repeat(' ',strlen($question['name'])); //After the first use, we left it blank to avoid repetitions 101 $csvLine .= ','.$name.''; 102 if ($question['type'] == 'Likert Matrix'){ 103 $porcentage = array(); 104 105 $csvLine .= ','; 106 foreach ($count as $c){ 107 $csvLine .= $c.'|'; 108 $porcentage[] = $total[$name] ? round($c / $total[$name] * 100, 2) : 0; 109 } 110 111 $csvLine .= ','.implode('%|', $porcentage).'%"'; 112 }else{ 113 $percentage = round($count / $total * 100, 2); 114 $csvLine .= ','.$count; 115 $csvLine .= ','.$percentage.'%'; 116 } 117 $this->csvLines[] = $csvLine; 118 } 119 } 120 } 121 } 122 break; 123 default: 124 break; 44 125 } 126 45 127 46 128 return $this->csvLines; -
wp-survey-and-quiz-tool/tags/2.14.1/lib/Wpsqt/Page/Main/Results/Mark.php
r931176 r948896 87 87 $wpdb->query( 88 88 $wpdb->prepare('UPDATE '.WPSQT_TABLE_RESULTS.' SET sections=%s,status=%s,score=%d,total=%d,percentage=%d,pass=%d WHERE id = %d', 89 array( serialize($ser),$_POST['status'],$currentPoints,$totalPoints,$percentage,$pass_fail,$_GET['resultid']) )89 array( $ser,$_POST['status'],$currentPoints,$totalPoints,$percentage,$pass_fail,$_GET['resultid']) ) 90 90 ); 91 91 $this->redirect(WPSQT_URL_MAIN."§ion=results"."&subsection=quiz&id=".$_GET['id']."&marked=true"); -
wp-survey-and-quiz-tool/tags/2.14.1/lib/Wpsqt/Question.php
r931176 r948896 91 91 return "Someone has dun goof'd! No question form view!"; 92 92 } 93 if ( !isset(self::$_called[$this ::$_id])){93 if ( !isset(self::$_called[$this->_id])){ 94 94 ob_start(); 95 95 extract($this->_questionVars); 96 96 require $this->_formView; 97 self::$_called[$this ::$_id] = true;97 self::$_called[$this->_id] = true; 98 98 return ob_get_clean(); 99 99 } -
wp-survey-and-quiz-tool/tags/2.14.1/lib/Wpsqt/Question/Freetext.php
r931176 r948896 16 16 17 17 $this->_questionVars = $value; 18 $this ::$_id = "freetext";18 $this->_id = "freetext"; 19 19 $this->_formView = WPSQT_DIR."pages/admin/forms/question.freetext.php"; 20 20 $this->_displayView = WPSQT_DIR."pages/site/questions/textarea.php"; -
wp-survey-and-quiz-tool/tags/2.14.1/lib/Wpsqt/Question/Likert.php
r931176 r948896 14 14 public function __construct(array $values = array()){ 15 15 16 $this ::$_id = "likert";16 $this->_id = "likert"; 17 17 $this->_formView = WPSQT_DIR."pages/admin/forms/question.likert.php"; 18 18 $this->_displayView = WPSQT_DIR."pages/site/questions/likert.php"; -
wp-survey-and-quiz-tool/tags/2.14.1/lib/Wpsqt/Question/Likertmatrix.php
r931176 r948896 14 14 public function __construct(array $values = array()){ 15 15 16 $this ::$_id = "likertmatrix";16 $this->_id = "likertmatrix"; 17 17 $this->_questionVars['answers'] = array('text' => false); 18 18 $this->_formView = WPSQT_DIR."pages/admin/forms/question.likertmatrix.php"; -
wp-survey-and-quiz-tool/tags/2.14.1/lib/Wpsqt/Question/Multiple.php
r931176 r948896 17 17 18 18 $this->_questionVars['answers'] = array( array( "text" => false, "correct" => false) ); 19 $this ::$_id = "multiple";19 $this->_id = "multiple"; 20 20 $this->_formView = WPSQT_DIR."pages/admin/forms/question.multiple.php"; 21 21 $this->_displayView = WPSQT_DIR."pages/site/questions/multiple.php"; -
wp-survey-and-quiz-tool/tags/2.14.1/lib/Wpsqt/Shortcode.php
r931176 r948896 304 304 $timerVal = $timerVal - $_POST['wpsqt_time_elapsed']; 305 305 } 306 echo '<div class="timer" style="float: right;"> </div>';306 echo '<div class="timer" style="float: right;"> </div>'; 307 307 $timerStrings = array( 308 308 'timeleft' => __('Time Left:', 'wp-survey-and-quiz-tool'), … … 395 395 if ( $subCorrect === $subNumOfCorrect && $subIncorrect === 0 ){ 396 396 $correct += $questionData["points"]; 397 $answerMarked['mark'] = __('correct', 'wp-survey-and-quiz-tool'); 397 __('correct', 'wp-survey-and-quiz-tool'); 398 $answerMarked['mark'] = 'correct'; 398 399 } 399 400 else { … … 401 402 402 403 $incorrect += $questionData["points"]; 403 $answerMarked['mark'] = __('incorrect', 'wp-survey-and-quiz-tool'); 404 __('incorrect', 'wp-survey-and-quiz-tool'); 405 $answerMarked['mark'] = 'incorrect'; 404 406 } 405 407 } else { … … 611 613 612 614 if ( $canAutoMark === true ){ 613 $_SESSION['wpsqt']['current_score'] = $correctAnswers." correct out of ".$totalPoints; 615 $_SESSION['wpsqt']['current_score'] = sprintf( __("%d correct out of %d", 'wp-survey-and-quiz-tool'), $correctAnswers, $totalPoints ); 616 617 $_SESSION['wpsqt']['correct_answers'] = $correctAnswers; 618 $_SESSION['wpsqt']['total_points'] = $totalPoints; 614 619 } else { 615 620 $_SESSION['wpsqt']['current_score'] = __('Quiz can\'t be auto marked', 'wp-survey-and-quiz-tool'); … … 838 843 } else { 839 844 $givenAnswerData = explode("_", $givenAnswerData); 840 $cachedSections[$sectionKey]['questions'][$question['id']]['answers'][$givenAnswerData[0]][$givenAnswerData[1]]['count'] += 1; 845 if(isset($cachedSections[$sectionKey]['questions'][$question['id']]['answers'][$givenAnswerData[0]][$givenAnswerData[1]]['count'])){ 846 $cachedSections[$sectionKey]['questions'][$question['id']]['answers'][$givenAnswerData[0]][$givenAnswerData[1]]['count'] += 1; 847 } else { 848 $cachedSections[$sectionKey]['questions'][$question['id']]['answers'][$givenAnswerData[0]][$givenAnswerData[1]]['count'] = 1; 849 } 841 850 } 842 851 } -
wp-survey-and-quiz-tool/tags/2.14.1/lib/Wpsqt/Tokens.php
r931176 r948896 122 122 if ($_SESSION['wpsqt']['current_type'] == 'quiz' && isset($_SESSION['wpsqt']['current_score'])) { 123 123 // Calculate percentage 124 preg_match('$(\d*)\scorrect\sout\sof\s(\d*)$', $_SESSION['wpsqt']['current_score'], $score); 125 if (isset($score) && is_array($score) && isset($score[2]) && $score[2] != 0) { 126 $percentage = $score[1] / $score[2] * 100; 124 if ( isset($_SESSION['wpsqt']['correct_answers']) && isset($_SESSION['wpsqt']['total_points']) ) { 125 $percentage = $_SESSION['wpsqt']['correct_answers'] / $_SESSION['wpsqt']['total_points'] * 100; 127 126 $percentage = number_format($percentage, 1) . '%'; 128 127 } else { -
wp-survey-and-quiz-tool/tags/2.14.1/pages/admin/forms/question.multiple.php
r424718 r948896 15 15 foreach( $answers as $key => $answer ) { ?> 16 16 <tr> 17 <td><input type="text" name="multiple_name[<?php echo $i; ?>]" value="<?php echo esc_attr(wp_kses_stripslashes($answer["text"])); ?>" /></td>17 <td><input type="text" name="multiple_name[<?php echo $i; ?>]" value="<?php echo esc_attr(wp_kses_stripslashes($answer["text"])); ?>" style="width: 98%;" /></td> 18 18 <td><input type="checkbox" name="multiple_correct[<?php echo $i; ?>]" <?php if ( $answer["correct"] == "yes" ){ ?> checked="checked"<?php }?> value="yes" /></td> 19 19 <td><input type="radio" name="multiple_default" <?php if ( isset($answer["default"]) && $answer["default"] == "yes" ){ ?> checked="checked"<?php }?> value="<?php echo $i; ?>" /></td> -
wp-survey-and-quiz-tool/tags/2.14.1/pages/admin/poll/result.php
r575966 r948896 10 10 <input type="submit" name="deleteall" value="Delete All Results" /> 11 11 </form> 12 12 <div class="tablenav"> 13 <div class="tablenav-pages"> 14 <a href="<?php echo WPSQT_URL_MAIN; ?>§ion=results&subsection=quiz&id=<?php echo urlencode($_GET['id']); ?>&wpsqt-download=<?php echo urlencode($_GET['id']); ?>">Export CSV</a> 15 </div> 16 </div> 13 17 <?php if ( isset($message) ) { ?> 14 18 <div class="updated"> -
wp-survey-and-quiz-tool/tags/2.14.1/pages/admin/surveys/result.list.php
r455948 r948896 17 17 18 18 <div class="tablenav-pages"> 19 <a href="<?php echo WPSQT_URL_MAIN; ?>§ion=results&subsection=survey&id=<?php echo urlencode($_GET['id']); ?>&wpsqt-download=<?php echo urlencode($_GET['id']); ?>">Export CSV</a> 19 20 <?php echo Wpsqt_Core::getPaginationLinks($currentPage, $numberOfPages); ?> 20 21 </div> -
wp-survey-and-quiz-tool/tags/2.14.1/readme.txt
r931670 r948896 6 6 Tested up to: 3.9.1 7 7 Text Domain: wp-survey-and-quiz-tool 8 Stable tag: 2.14 8 Stable tag: 2.14.1 9 9 A highly customisable Quiz, Survey and Poll plugin to which allows for unlimited questions and sections. 10 10 … … 64 64 65 65 == ChangeLog == 66 67 = 2.14.1 = 68 * Fixed compatiblity issues with PHP 5.2 69 * Fixing double serialization bug for quiz results 70 * Added export poll to csv feature 71 * Other minors bugs fixed 66 72 67 73 = 2.14 = -
wp-survey-and-quiz-tool/trunk/js/generic.js
r553819 r948896 160 160 var html = ''; 161 161 html += '<tr>'; 162 html += '<td><input type="text" name="multiple_name['+rowCount+']" value="" /></td>';162 html += '<td><input type="text" name="multiple_name['+rowCount+']" value="" style="width: 98%;" /></td>'; // mod: width added 163 163 html += '<td><input type="checkbox" name="multiple_correct['+rowCount+']" value="yes" /></td>'; 164 164 html += '<td><input type="checkbox" name="multiple_delete['+rowCount+']" value="yes" /></td>'; -
wp-survey-and-quiz-tool/trunk/lib/Wpsqt/Core.php
r931176 r948896 168 168 $blog_id.'/'.$_SESSION['wpsqt']['current_type'].'-'.$_SESSION['wpsqt']['item_id'].'/' : ''; 169 169 170 if ( file_exists(WPSQT_DIR.'pages/custom/'.$quizPath.$file) ){ 170 $themeFile = get_template_directory() . '/wpsqt/' . $file; 171 172 if ( file_exists($themeFile) ) { 173 return $themeFile; 174 } elseif ( file_exists(WPSQT_DIR.'pages/custom/'.$quizPath.$file) ){ 171 175 return WPSQT_DIR.'pages/custom/'.$quizPath.$file; 172 176 } elseif (file_exists(WPSQT_DIR.'pages/custom/'.$blog_id.'/shared/'.$file)) { -
wp-survey-and-quiz-tool/trunk/lib/Wpsqt/Export/Csv.php
r931176 r948896 29 29 public function generate($id) { 30 30 global $wpdb; 31 32 $type = $wpdb->get_row($wpdb->prepare("SELECT `type` FROM `".WPSQT_TABLE_QUIZ_SURVEYS."` WHERE id = %d", array($id)),ARRAY_A); 31 33 32 $results = $wpdb->get_results('SELECT * FROM '.WPSQT_TABLE_RESULTS.' WHERE item_id = "'.$id.'"', ARRAY_A); 34 switch ($type['type']){ 35 case 'quiz': 36 $results = $wpdb->get_results('SELECT * FROM '.WPSQT_TABLE_RESULTS.' WHERE item_id = "'.$id.'"', ARRAY_A); 37 $this->csvLines[] = 'id, Name, Score, Total, Percentage, Pass/Fail, Status, Date'; 38 foreach( $results as $result ){ 39 $csvline = $result['id'].","; 40 $csvline .= $result['person_name'].','; 41 if($result['total'] == 0) {$csvline .= ',,';} else {$csvline .= $result['score'].",".$result['total'].",";} 42 if($result['total'] == 0) {$csvline .= ',';} else {$csvline .= $result['percentage']."%,";} 43 if ($result['pass'] == 1) {$csvline .= "Pass,";} else {$csvline .= "Fail,";} 44 $csvline .= ucfirst($result['status']).","; 45 if (!empty($result['datetaken'])) { $csvline .= date('d-m-y G:i:s',$result['datetaken']); }; 46 $this->csvLines[] = $csvline; 47 } 48 break; 49 case 'survey': 50 case 'poll': 51 $results = $wpdb->get_row($wpdb->prepare("SELECT * FROM `".WPSQT_TABLE_SURVEY_CACHE."` WHERE item_id = %d",array($id)), ARRAY_A); 52 $sections = unserialize($results['sections']); 53 $this->csvLines[] = 'Question Name,Answer,Votes,Percentages'; 33 54 34 $this->csvLines[] = 'id, Name, Score, Total, Percentage, Pass/Fail, Status, Date'; 35 foreach( $results as $result ){ 36 $csvline = $result['id'].","; 37 $csvline .= $result['person_name'].','; 38 if($result['total'] == 0) {$csvline .= ',,';} else {$csvline .= $result['score'].",".$result['total'].",";} 39 if($result['total'] == 0) {$csvline .= ',';} else {$csvline .= $result['percentage']."%,";} 40 if ($result['pass'] == 1) {$csvline .= "Pass,";} else {$csvline .= "Fail,";} 41 $csvline .= ucfirst($result['status']).","; 42 if (!empty($result['datetaken'])) { $csvline .= date('d-m-y G:i:s',$result['datetaken']); }; 43 $this->csvLines[] = $csvline; 55 if (empty($sections) || !is_array($sections)) { 56 break; 57 } 58 59 foreach ($sections as $section) { 60 foreach ($section['questions'] as $question) { 61 $answers_display = array(); 62 if (!empty($question['answers']) && is_array($question['answers'])) { 63 switch ($question['type']){ 64 case 'Likert Matrix': 65 $total = array(); 66 foreach($question['answers'] as $answer_name => $values) { 67 //TODO: Look up this other 68 if ($answer_name == 'other') continue; 69 $answers_display[$answer_name] = array(); 70 $total[$answer_name] =0; 71 foreach ($values as $value){ 72 $answers_display[$answer_name][] = $value['count']; 73 $total[$answer_name] += $value['count']; 74 } 75 } 76 break; 77 case 'Likert': 78 $total = 0; 79 foreach($question['answers'] as $answer_name => $values) { 80 $answers_display[$answer_name] = $values['count']; 81 $total += $values['count']; 82 } 83 break; 84 default: 85 $total = 0; 86 foreach($question['answers'] as $answer) { 87 $answers_display[$answer['text']] = $answer['count']; 88 $total += $answer['count']; 89 } 90 break; 91 } 92 } 93 if ($question['type'] == 'Free Text') { 94 $csvLine .= $question['name'].',This question has free text answers which cannot be shown,,,'; 95 $this->csvLines[] = $csvLine; 96 continue; 97 }else{ 98 foreach ($answers_display as $name => $count) { 99 $csvLine = $question['name']; 100 $question['name'] = str_repeat(' ',strlen($question['name'])); //After the first use, we left it blank to avoid repetitions 101 $csvLine .= ','.$name.''; 102 if ($question['type'] == 'Likert Matrix'){ 103 $porcentage = array(); 104 105 $csvLine .= ','; 106 foreach ($count as $c){ 107 $csvLine .= $c.'|'; 108 $porcentage[] = $total[$name] ? round($c / $total[$name] * 100, 2) : 0; 109 } 110 111 $csvLine .= ','.implode('%|', $porcentage).'%"'; 112 }else{ 113 $percentage = round($count / $total * 100, 2); 114 $csvLine .= ','.$count; 115 $csvLine .= ','.$percentage.'%'; 116 } 117 $this->csvLines[] = $csvLine; 118 } 119 } 120 } 121 } 122 break; 123 default: 124 break; 44 125 } 126 45 127 46 128 return $this->csvLines; -
wp-survey-and-quiz-tool/trunk/lib/Wpsqt/Page/Main/Results/Mark.php
r931176 r948896 87 87 $wpdb->query( 88 88 $wpdb->prepare('UPDATE '.WPSQT_TABLE_RESULTS.' SET sections=%s,status=%s,score=%d,total=%d,percentage=%d,pass=%d WHERE id = %d', 89 array( serialize($ser),$_POST['status'],$currentPoints,$totalPoints,$percentage,$pass_fail,$_GET['resultid']) )89 array( $ser,$_POST['status'],$currentPoints,$totalPoints,$percentage,$pass_fail,$_GET['resultid']) ) 90 90 ); 91 91 $this->redirect(WPSQT_URL_MAIN."§ion=results"."&subsection=quiz&id=".$_GET['id']."&marked=true"); -
wp-survey-and-quiz-tool/trunk/lib/Wpsqt/Question.php
r931176 r948896 91 91 return "Someone has dun goof'd! No question form view!"; 92 92 } 93 if ( !isset(self::$_called[$this ::$_id])){93 if ( !isset(self::$_called[$this->_id])){ 94 94 ob_start(); 95 95 extract($this->_questionVars); 96 96 require $this->_formView; 97 self::$_called[$this ::$_id] = true;97 self::$_called[$this->_id] = true; 98 98 return ob_get_clean(); 99 99 } -
wp-survey-and-quiz-tool/trunk/lib/Wpsqt/Question/Freetext.php
r931176 r948896 16 16 17 17 $this->_questionVars = $value; 18 $this ::$_id = "freetext";18 $this->_id = "freetext"; 19 19 $this->_formView = WPSQT_DIR."pages/admin/forms/question.freetext.php"; 20 20 $this->_displayView = WPSQT_DIR."pages/site/questions/textarea.php"; -
wp-survey-and-quiz-tool/trunk/lib/Wpsqt/Question/Likert.php
r931176 r948896 14 14 public function __construct(array $values = array()){ 15 15 16 $this ::$_id = "likert";16 $this->_id = "likert"; 17 17 $this->_formView = WPSQT_DIR."pages/admin/forms/question.likert.php"; 18 18 $this->_displayView = WPSQT_DIR."pages/site/questions/likert.php"; -
wp-survey-and-quiz-tool/trunk/lib/Wpsqt/Question/Likertmatrix.php
r931176 r948896 14 14 public function __construct(array $values = array()){ 15 15 16 $this ::$_id = "likertmatrix";16 $this->_id = "likertmatrix"; 17 17 $this->_questionVars['answers'] = array('text' => false); 18 18 $this->_formView = WPSQT_DIR."pages/admin/forms/question.likertmatrix.php"; -
wp-survey-and-quiz-tool/trunk/lib/Wpsqt/Question/Multiple.php
r931176 r948896 17 17 18 18 $this->_questionVars['answers'] = array( array( "text" => false, "correct" => false) ); 19 $this ::$_id = "multiple";19 $this->_id = "multiple"; 20 20 $this->_formView = WPSQT_DIR."pages/admin/forms/question.multiple.php"; 21 21 $this->_displayView = WPSQT_DIR."pages/site/questions/multiple.php"; -
wp-survey-and-quiz-tool/trunk/lib/Wpsqt/Shortcode.php
r931176 r948896 304 304 $timerVal = $timerVal - $_POST['wpsqt_time_elapsed']; 305 305 } 306 echo '<div class="timer" style="float: right;"> </div>';306 echo '<div class="timer" style="float: right;"> </div>'; 307 307 $timerStrings = array( 308 308 'timeleft' => __('Time Left:', 'wp-survey-and-quiz-tool'), … … 395 395 if ( $subCorrect === $subNumOfCorrect && $subIncorrect === 0 ){ 396 396 $correct += $questionData["points"]; 397 $answerMarked['mark'] = __('correct', 'wp-survey-and-quiz-tool'); 397 __('correct', 'wp-survey-and-quiz-tool'); 398 $answerMarked['mark'] = 'correct'; 398 399 } 399 400 else { … … 401 402 402 403 $incorrect += $questionData["points"]; 403 $answerMarked['mark'] = __('incorrect', 'wp-survey-and-quiz-tool'); 404 __('incorrect', 'wp-survey-and-quiz-tool'); 405 $answerMarked['mark'] = 'incorrect'; 404 406 } 405 407 } else { … … 611 613 612 614 if ( $canAutoMark === true ){ 613 $_SESSION['wpsqt']['current_score'] = $correctAnswers." correct out of ".$totalPoints; 615 $_SESSION['wpsqt']['current_score'] = sprintf( __("%d correct out of %d", 'wp-survey-and-quiz-tool'), $correctAnswers, $totalPoints ); 616 617 $_SESSION['wpsqt']['correct_answers'] = $correctAnswers; 618 $_SESSION['wpsqt']['total_points'] = $totalPoints; 614 619 } else { 615 620 $_SESSION['wpsqt']['current_score'] = __('Quiz can\'t be auto marked', 'wp-survey-and-quiz-tool'); … … 838 843 } else { 839 844 $givenAnswerData = explode("_", $givenAnswerData); 840 $cachedSections[$sectionKey]['questions'][$question['id']]['answers'][$givenAnswerData[0]][$givenAnswerData[1]]['count'] += 1; 845 if(isset($cachedSections[$sectionKey]['questions'][$question['id']]['answers'][$givenAnswerData[0]][$givenAnswerData[1]]['count'])){ 846 $cachedSections[$sectionKey]['questions'][$question['id']]['answers'][$givenAnswerData[0]][$givenAnswerData[1]]['count'] += 1; 847 } else { 848 $cachedSections[$sectionKey]['questions'][$question['id']]['answers'][$givenAnswerData[0]][$givenAnswerData[1]]['count'] = 1; 849 } 841 850 } 842 851 } -
wp-survey-and-quiz-tool/trunk/lib/Wpsqt/Tokens.php
r931176 r948896 122 122 if ($_SESSION['wpsqt']['current_type'] == 'quiz' && isset($_SESSION['wpsqt']['current_score'])) { 123 123 // Calculate percentage 124 preg_match('$(\d*)\scorrect\sout\sof\s(\d*)$', $_SESSION['wpsqt']['current_score'], $score); 125 if (isset($score) && is_array($score) && isset($score[2]) && $score[2] != 0) { 126 $percentage = $score[1] / $score[2] * 100; 124 if ( isset($_SESSION['wpsqt']['correct_answers']) && isset($_SESSION['wpsqt']['total_points']) ) { 125 $percentage = $_SESSION['wpsqt']['correct_answers'] / $_SESSION['wpsqt']['total_points'] * 100; 127 126 $percentage = number_format($percentage, 1) . '%'; 128 127 } else { -
wp-survey-and-quiz-tool/trunk/pages/admin/forms/question.multiple.php
r424718 r948896 15 15 foreach( $answers as $key => $answer ) { ?> 16 16 <tr> 17 <td><input type="text" name="multiple_name[<?php echo $i; ?>]" value="<?php echo esc_attr(wp_kses_stripslashes($answer["text"])); ?>" /></td>17 <td><input type="text" name="multiple_name[<?php echo $i; ?>]" value="<?php echo esc_attr(wp_kses_stripslashes($answer["text"])); ?>" style="width: 98%;" /></td> 18 18 <td><input type="checkbox" name="multiple_correct[<?php echo $i; ?>]" <?php if ( $answer["correct"] == "yes" ){ ?> checked="checked"<?php }?> value="yes" /></td> 19 19 <td><input type="radio" name="multiple_default" <?php if ( isset($answer["default"]) && $answer["default"] == "yes" ){ ?> checked="checked"<?php }?> value="<?php echo $i; ?>" /></td> -
wp-survey-and-quiz-tool/trunk/pages/admin/poll/result.php
r575966 r948896 10 10 <input type="submit" name="deleteall" value="Delete All Results" /> 11 11 </form> 12 12 <div class="tablenav"> 13 <div class="tablenav-pages"> 14 <a href="<?php echo WPSQT_URL_MAIN; ?>§ion=results&subsection=quiz&id=<?php echo urlencode($_GET['id']); ?>&wpsqt-download=<?php echo urlencode($_GET['id']); ?>">Export CSV</a> 15 </div> 16 </div> 13 17 <?php if ( isset($message) ) { ?> 14 18 <div class="updated"> -
wp-survey-and-quiz-tool/trunk/pages/admin/surveys/result.list.php
r455948 r948896 17 17 18 18 <div class="tablenav-pages"> 19 <a href="<?php echo WPSQT_URL_MAIN; ?>§ion=results&subsection=survey&id=<?php echo urlencode($_GET['id']); ?>&wpsqt-download=<?php echo urlencode($_GET['id']); ?>">Export CSV</a> 19 20 <?php echo Wpsqt_Core::getPaginationLinks($currentPage, $numberOfPages); ?> 20 21 </div> -
wp-survey-and-quiz-tool/trunk/readme.txt
r931670 r948896 6 6 Tested up to: 3.9.1 7 7 Text Domain: wp-survey-and-quiz-tool 8 Stable tag: 2.14 8 Stable tag: 2.14.1 9 9 A highly customisable Quiz, Survey and Poll plugin to which allows for unlimited questions and sections. 10 10 … … 64 64 65 65 == ChangeLog == 66 67 = 2.14.1 = 68 * Fixed compatiblity issues with PHP 5.2 69 * Fixing double serialization bug for quiz results 70 * Added export poll to csv feature 71 * Other minors bugs fixed 66 72 67 73 = 2.14 =
Note: See TracChangeset
for help on using the changeset viewer.