-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #149 from CCALI/quizwright/release
Quizwright/release
- Loading branch information
Showing
10 changed files
with
235 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
<html><body><h1>CALI QuizWright® Report</h1> | ||
<?php | ||
/* | ||
06/17/19 Short form LessonText of the Quiz including all meta, introduction/concllusion and question/answers. | ||
*/ | ||
require ("user-session.php"); | ||
$lid = intval($_GET['lid']); | ||
// Note: user id is required so only author can see report | ||
$sql="select info.data, people.profile from info,people where info.uid = '$uid' and lid = $lid and info.uid = people.uid"; | ||
|
||
// Load author/quiz info | ||
if ($result = $mysqli->query($sql)) | ||
{ | ||
if ($row = $result->fetch_assoc()) | ||
{ | ||
$data = json_decode($row['data'], TRUE); | ||
$profile = json_decode($row['profile'], TRUE); | ||
//$published=$row['location']; | ||
//$publishdate=$row['publishdate']; | ||
//$numPages = count($data['pages']); // .pages is array of pid's, order matches lesson order. | ||
PrintLessonText($mysqli,$lid,$data,$profile); | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
function PrintLessonText($mysqli,$lid,$data,$author) | ||
{ // 06/18/19 | ||
echo '<table>'; | ||
$qwinfo='<p>Quiz automatically generated by QuizWright®.</p>'; | ||
niceTuples(['Title'=>htmlspecialchars($data['title'])]); | ||
|
||
alt(); | ||
niceTuples([ | ||
'Description'=> textBlock($data['calidescription'] ), | ||
'Subject Area'=>htmlspecialchars($data['subjectarea']), | ||
'Completion Time'=>htmlspecialchars($data['completiontime']), | ||
'Author Name'=>htmlspecialchars($author['authorfullname']), | ||
'Title'=>htmlspecialchars($author['authortitle']), | ||
'School'=>htmlspecialchars($author['authorschool']), | ||
'Version'=> date("Y-m-d H:i:s"), | ||
'Notes'=>$qwinfo]); | ||
|
||
// 05/11/2017 SJG Introduction and conclusion are optional, grab them and incorporate at the right spots. | ||
$pageIntroText = textBlock($data['quiz-intro']); | ||
$pageConclusionText = textBlock($data['quiz-conclusion']); | ||
$numPages = count($data['pages']); | ||
if( $pageIntroText != "") | ||
{ | ||
alt(); | ||
niceTuples(['Introduction'=>$pageIntroText]); | ||
} | ||
$pageNum=0; | ||
if ($numPages>0) | ||
{ | ||
// Load each question for this quiz. | ||
foreach ($data['pages'] as $pid) | ||
{ | ||
$pid=intval($pid); | ||
$sql = "SELECT data FROM `page` WHERE pid = $pid"; | ||
if ($result = $mysqli->query($sql)) | ||
{ | ||
if ($row = $result->fetch_assoc()) | ||
{ | ||
// Check page type so we get accurate detail (but as of 3/2017 there are all quiz type) which translates to Multiple Choice type. | ||
$page = json_decode($row['data'], TRUE); | ||
$pagetype = $page['page-type']; | ||
$pageNum += 1; | ||
$pageTypeText=''; | ||
$pageCorrect=''; | ||
$pageChoices=''; | ||
alt(); | ||
niceTuples([ | ||
'Question' => $pageNum, | ||
'Text'=>textBlock($page['page-question'])]); | ||
switch ($pagetype) | ||
{ | ||
case 'quiz-yn': // ### Yes/No style of quiz question | ||
$pageTypeText='Yes/No'; | ||
$isyes = $page['yes-is-correct']=='true'; | ||
$pageCorrect=$isyes?"Yes":"No"; | ||
niceTuples(['Correct'=>$pageCorrect]); | ||
break; | ||
|
||
case 'quiz-tf': // ### True/False style of quiz question | ||
$istrue = $page['true-is-correct']=='true'; | ||
$pageCorrect=$istrue?'True':'False';; | ||
niceTuples(['Correct'=>$pageCorrect]); | ||
break; | ||
|
||
case 'Quiz':// ### Standard quiz question which is multiple choice: | ||
case 'quiz-mc': | ||
case '': | ||
$pageCorrect=$page['page-choice-correct-text']; | ||
niceTuples(['Correct'=>$pageCorrect]); | ||
for ($wrong=1;$wrong<=7;$wrong++) | ||
{ | ||
if (isset($page['page-choice-wrong-'.$wrong.'-text'])) | ||
{ | ||
$wrongText = $page['page-choice-wrong-'.$wrong.'-text']; | ||
if ($wrongText!='') | ||
{ | ||
niceTuples(['Wrong #'.$wrong=>textBlock ($wrongText)]); | ||
} | ||
} | ||
} | ||
break; | ||
|
||
default: | ||
// Should not get here. | ||
} | ||
niceTuples([ | ||
'Feedback'=>textBlock($page['page-feedback']), | ||
'Notes'=>textBlock(htmlspecialchars('Topic: '. $page['page-topic'])), | ||
'Attribution'=>$page['page-attribution'] | ||
]); | ||
} | ||
} | ||
} | ||
} | ||
if($pageConclusionText != "") | ||
{ | ||
alt(); | ||
niceTuples(['Conclusion'=>$pageConclusionText]); | ||
} | ||
} | ||
|
||
function alt() | ||
{ | ||
echo '<tr bgcolor=#888><td colspan=2> </td></tr>'; | ||
} | ||
function textBlock($text) | ||
{ // 05/11/2017 SJG Helper function | ||
return HTML2XML($text); | ||
} | ||
function HTML2XML($str) | ||
{ // Convert HTML encoding (clean CKEditor HTML markup) into XML encodings. | ||
$str = str_replace( array('<','>','&'),array(chr(1),chr(2),chr(3)),$str); | ||
$str= html_entity_decode($str,0,'UTF-8'); | ||
$str = str_replace(array(chr(1),chr(2),chr(3)),array('<','>','&'),$str); | ||
//$str = '<![CDATA['.$str.']]>'; Would be best but Viewer doesn't understand it.?? | ||
return $str; | ||
} | ||
|
||
function niceTuples($tuples) | ||
{ | ||
foreach ($tuples as $key=>$value) | ||
{ | ||
if ($value!='') | ||
{ | ||
echo '<tr valign=top><td align=right>'.$key.':</td><td>'.$value.'</td></tr>'; | ||
} | ||
} | ||
} | ||
|
||
|
||
?> | ||
|
||
|
||
</body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.