Commit f279f783 authored by ggeller's avatar ggeller

New quiz editor, named as specified in DevTips on tw.o.

parent 45c5c8e6
......@@ -3795,6 +3795,7 @@ tiki/templates/tiki-print_article.tpl -text
tiki/templates/tiki-print_blog_post.tpl -text
tiki/templates/tiki-print_multi_pages.tpl -text
tiki/templates/tiki-print_pages.tpl -text
tiki/templates/tiki-quiz_edit.tpl -text
tiki/templates/tiki-quiz_result_stats.tpl -text
tiki/templates/tiki-quiz_stats.tpl -text
tiki/templates/tiki-quiz_stats_quiz.tpl -text
......@@ -4205,6 +4206,7 @@ tiki/tiki-print_multi_pages.php -text
tiki/tiki-print_pages.php -text
tiki/tiki-pv_chart.php -text
tiki/tiki-querytable.php -text
tiki/tiki-quiz_edit.php -text
tiki/tiki-quiz_result_stats.php -text
tiki/tiki-quiz_stats.php -text
tiki/tiki-quiz_stats_quiz.php -text
......
{* $Header: /cvsroot/tikiwiki/tiki/templates/tiki-quiz_edit.tpl,v 1.3 2004-05-11 20:13:38 ggeller Exp $ *}
{* Copyright (c) 2004 *}
{* All Rights Reserved. See copyright.txt for details and a complete list of authors. *}
{* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. *}
<!- tiki-quiz_edit.tpl start ->
<a class="pagetitle" href="tiki-quiz_edit.php?quizId={$quizId}">{tr}Edit quiz{/tr}: {$quiz_info.name}</a>
{if $feature_help}
&nbsp &nbsp &nbsp<a title="{tr}help{/tr}" href="http://tikiwiki.org/tiki-index.php?page=QuizQuestionImport" target="help"><img border="0" alt="{tr}Help{/tr}" src="img/icons/help.gif" /></a>
{/if}
<br /><br />
<a class="linkbut" href="tiki-list_quizzes.php">{tr}list quizzes{/tr}</a>
<a class="linkbut" href="tiki-quiz_stats.php">{tr}quiz stats{/tr}</a>
<a class="linkbut" href="tiki-quiz_stats_quiz.php?quizId={$quizId}">{tr}this quiz stats{/tr}</a>
<a class="linkbut" href="tiki-edit_quiz.php">{tr}admin quizzes{/tr}</a>
<a class="linkbut" href="tiki-quiz_edit.php?quizId={$quizId}?view=XML">{tr}View/Edit as XML{/tr}</a>
<br />
<br />
<form enctype="multipart/form-data" method="post" action="tiki-quiz_edit.php?quizId={$quiz_info.quizId}">
<table class="normal">
<tr>
<td class="formcolor"><label for="quiz-name">Name:</label></td>
<td class="formcolor"><input type="text" name="name" id="quiz-name" value="{$quiz_info.name|escape}" size="80"></td>
</tr>
<tr>
<td class="formcolor">
<label for="quiz-desc">Description:</label>
</td>
<td class="formcolor"><input type="text" name="description" id="quiz-desc" value="{$quiz_info.description|escape}" size="80"></td>
</tr>
{include file=categorize.tpl}
<tr class="formcolor">
<td>{tr}Publication Date{/tr}</td>
<td>
{html_select_date prefix="publish_" time=$publishDateSite start_year="-5" end_year="+10"} {tr}at{/tr} <span dir="ltr">{html_select_time prefix="publish_" time=$publishDateSite display_seconds=false}
&nbsp;{$siteTimeZone}</span>
</td>
</tr>
<tr class="formcolor">
<td>{tr}Expiration Date{/tr}</td><td>
{html_select_date prefix="expire_" time=$expireDateSite start_year="-5" end_year="+10"} {tr}at{/tr} <span dir="ltr">{html_select_time prefix="expire_" time=$expireDateSite display_seconds=false}
&nbsp;{$siteTimeZone}</span>
</td>
</tr>
</table>
<table class="normal">
<tr>
<td class="formcolor"><input type="checkbox" name="shuffleQuestions" id="shuffle-questions" {if $shuffleQuestions eq 'y'}checked="checked"{/if} /><label for="shuffle-questions">{tr}Shuffle questions{/tr}</td>
<td class="formcolor"><input type="checkbox" name="shuffleAnswers" id="shuffle-answers" {if $shuffleAnswers eq 'y'}checked="checked"{/if} /><label for="shuffle-answers">{tr}Shuffle answers{/tr}</td>
</tr>
<tr>
<td colspan="2" class="formcolor"><input type="checkbox" name="limitDisplay" id="quiz-display-limit" {if $limitDisplay eq 'y'}checked="checked"{/if} /><label for="quiz-display-limit">{tr}Limit questions displayed per page to {/tr}</label><select name="questionsPerPage" id="quiz-perpage">{html_options values=$qpp selected=$questionsPerPage output=$qpp}</select>{tr}&nbsp question(s).{/tr}</td>
</tr>
<tr><td colspan="2" class="formcolor"><input type="checkbox" name="canRepeat" id="quiz-repeat" {if $canRepeat eq 'y'}checked="checked"{/if} /><label for="quiz-repeat">{tr}Allow students to retake this quiz {/tr}
<label for="quiz-maxtime"></label><select name="timeLimit" id="quiz-maxtime">{html_options values=$repetitions selected=$repetitionLimit output=$repetitions}</select> {tr}times{/tr}</td>
</tr>
<tr>
<td colspan = "2" class="formcolor"><input type="checkbox" name="timeLimited" id="quiz-timelimit" {if $timeLimited eq 'y'}checked="checked"{/if} /><label for="quiz-timelimit">{tr}Impose a time limit of {/tr}</label><label for="quiz-maxtime"></label><select name="timeLimit" id="quiz-maxtime">{html_options values=$mins selected=$timeLimit output=$mins}</select> {tr}minutes{/tr}</td>
</tr>
<tr>
<td colspan="2" class="formcolor"><input type="checkbox" name="storeResults" id="quiz-results" {if $storeResults eq 'y'}checked="checked"{/if} /><label for="quiz-results">{tr}Allow students to store partial results and return to quiz.{/tr}</td>
</tr>
<tr><td class="formcolor"><input type="checkbox" name="immediateFeedback" id="immediate-feedback" {if $immediateFeedback eq 'y'}checked="checked"{/if} /><label for="immediate-feedback">{tr}Immediate feedback{/tr}</td>
<td class="formcolor"><input type="checkbox" name="showAnswers" id="show-answers" {if $showAnswers eq 'y'}checked="checked"{/if} /><label for="show-answers">{tr}Show correct answers{/tr}</td></tr>
<tr>
<td class="formcolor"><input type="checkbox" name="storeResults" id="quiz-results" {if $storeResults eq 'y'}checked="checked"{/if} /><label for="quiz-results">{tr}Store quiz results{/tr}</td>
<td class="formcolor"><input type="checkbox" name="storeResults" id="quiz-results" {if $storeResults eq 'y'}checked="checked"{/if} /><label for="quiz-results">{tr}Solicit additional questions from students.{/tr}</td>
</tr>
</table>
<table class="normal">
<tr>
<td class="formcolor"><input type="checkbox" name="bPeerReview" id="bPeerReview" {if $bPeerReview eq 'y'}checked="checked"{/if} /><label for="bPeerReview">{tr}Use peer review system{/tr}</td>
<td class="formcolor"><input type="checkbox" name="forum" id="forum" {if $forum eq 'y'}checked="checked"{/if} /><label for="forum">{tr}Link quiz to forum named: {/tr}<input type="text" name="forum-name" id="forum-name" value="{$quiz_info.nameForum|escape}" size="40"></td>
</tr>
{*
<tr>
<td colspan = "2" class="formcolor"><input type="checkbox" name="bPeerReview" id="bPeerReview" {if $bPeerReview eq 'y'}checked="checked"{/if} /><label for="bPeerReview">{tr}Use peer review system{/tr}</td>
</tr>
<tr>
<td colspan = "2" class="formcolor"><input type="checkbox" name="forum" id="forum" {if $forum eq 'y'}checked="checked"{/if} /><label for="forum">{tr}Link quiz to forum named: {/tr}<input type="text" name="forum-name" id="forum-name" value="{$quiz_info.nameForum|escape}" size="40"></td>
</tr>
*}
</table>
<table class="normal">
</table>
<table class="normal">
<tr>
<td class="formcolor">
{tr}Edit:{/tr}
</td>
<td class="formcolor">
<textarea class="wikiedit" name="input_data" rows="10" cols="80" id='subheading' wrap="virtual" ></textarea>
</td>
</tr>
<tr class="formcolor">
<td class="formcolor">
</td>
<td class="formcolor">
<input type="submit" class="wikiaction" name="preview" value="{tr}preview{/tr}" />
</td>
</tr>
<tr class="formcolor">
<td class="formcolor">
</td>
<td class="formcolor">
<input type="submit" class="wikiaction" name="save" value="{tr}save{/tr}" /> <a class="link" href="tiki-index.php?page={$page|escape:"url"}">{tr}cancel edit{/tr}</a></td>
</td>
</tr>
</table>
</form>
<!- tiki-quiz_edit end ->
<?php
// $Header: /cvsroot/tikiwiki/tiki/tiki-quiz_edit.php,v 1.3 2004-05-11 20:13:35 ggeller Exp $
// Copyright (c) 2002-2004, Luis Argerich, Garland Foster, Eduardo Polidor,
// George G. Geller et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// include_once ("categorize.php"); put this somewhere for the save.
// Initialization
require_once('tiki-setup.php');
include_once('lib/quizzes/quizlib.php');
if ($feature_quizzes != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_quizzes");
$smarty->display("error.tpl");
die;
}
if ($tiki_p_admin_quizzes != 'y') {
$smarty->assign('msg', tra("You don't have permission to use this feature"));
$smarty->display("error.tpl");
die;
}
if (!isset($_REQUEST["quizId"])) {
$smarty->assign('msg', tra("No quiz indicated"));
$smarty->display("error.tpl");
die;
}
$smarty->assign('quizId', $_REQUEST["quizId"]);
$cat_type = 'quiz';
$cat_objid = $_REQUEST["quizId"];
$smarty->assign('individual', 'n');
if ($userlib->object_has_one_permission($_REQUEST["quizId"], 'quiz')) {
$smarty->assign('individual', 'y');
if ($tiki_p_admin != 'y') {
$perms = $userlib->get_permissions(0, -1, 'permName_desc', '', 'quizzes');
foreach ($perms["data"] as $perm) {
$permName = $perm["permName"];
if ($userlib->object_has_permission($user, $_REQUEST["quizId"], 'quiz', $permName)) {
$$permName = 'y';
$smarty->assign("$permName", 'y');
} else {
$$permName = 'n';
$smarty->assign("$permName", 'n');
}
}
}
}
$quiz_info = $quizlib->get_quiz($_REQUEST["quizId"]);
$quiz_info["name"] = "Chapter 01";
$smarty->assign('quiz_info', $quiz_info);
if (!isset($_REQUEST["questionId"])) {
$_REQUEST["questionId"] = 0;
}
$smarty->assign('questionId', $_REQUEST["questionId"]);
if ($_REQUEST["questionId"]) {
$info = $quizlib->get_quiz_question($_REQUEST["questionId"]);
} else {
$info = array();
$info["question"] = '';
$info["type"] = '';
$info["position"] = '';
}
$smarty->assign('question', $info["question"]);
$smarty->assign('type', $info["type"]);
$smarty->assign('position', $info["position"]);
if (isset($_REQUEST["remove"])) {
$area = 'delquizquestion';
if (isset($_POST['daconfirm']) and isset($_SESSION["ticket_$area"])) {
key_check($area);
$quizlib->remove_quiz_question($_REQUEST["remove"]);
} else {
key_get($area);
}
}
if (isset($_REQUEST["save"])) {
echo "Sorry, this is only a prototype at present.<br>";
die;
echo "line: ".__LINE__."<br>";
echo '$_REQUEST["quizId"] = '.$_REQUEST["quizId"]."<br>";
foreach ($_REQUEST as $request){
echo '$request = '.$request."<br>";
}
foreach ($_REQUEST as $key => $request){
echo $key." = ".$request."<br>";
}
check_ticket('edit-quiz-question');
$quizlib->replace_quiz_question($_REQUEST["questionId"], $_REQUEST["question"],
'o', $_REQUEST["quizId"], $_REQUEST["position"]);
$smarty->assign('question', '');
$smarty->assign('questionId', 0);
}
if (isset($_REQUEST["import"])) {
check_ticket('edit-quiz-question');
$questions = TextToQuestions($_REQUEST["input_data"]);
foreach ($questions as $question){
$question_text = $question->getQuestion();
$id = $quizlib->replace_quiz_question(0, $question_text, 'o', $_REQUEST["quizId"], 0);
for ($i = 0; $i < $question->getChoiceCount(); $i++){
$a = $question->GetChoice($i);
$b = $question->GetCorrect($i);
$quizlib->replace_question_option(0, $a, $b, $id);
}
}
$smarty->assign('question', '');
$smarty->assign('questionId', 0);
}
if (isset($_REQUEST["useQuestion"])) {
check_ticket('edit-quiz-question');
$info = $quizlib->get_quiz_question($_REQUEST["usequestionid"]);
$qid = $quizlib->replace_quiz_question(0, $info["question"], $info["type"], $_REQUEST["quizId"], $_REQUEST["position"]);
$options = $quizlib->list_quiz_question_options($info["questionId"], 0, -1, 'points_desc', '');
foreach ($options["data"] as $opt) {
$quizlib->replace_question_option(0, $opt["optionText"], $opt["points"], $qid);
}
}
if (!isset($_REQUEST["sort_mode"])) {
$sort_mode = 'position_asc';
} else {
$sort_mode = $_REQUEST["sort_mode"];
}
if (!isset($_REQUEST["offset"])) {
$offset = 0;
} else {
$offset = $_REQUEST["offset"];
}
$smarty->assign_by_ref('offset', $offset);
if (isset($_REQUEST["find"])) {
$find = $_REQUEST["find"];
} else {
$find = '';
}
$smarty->assign('find', $find);
$smarty->assign_by_ref('sort_mode', $sort_mode);
$channels = $quizlib->list_quiz_questions($_REQUEST["quizId"], $offset, $maxRecords, $sort_mode, $find);
$cant_pages = ceil($channels["cant"] / $maxRecords);
$smarty->assign_by_ref('cant_pages', $cant_pages);
$smarty->assign('actual_page', 1 + ($offset / $maxRecords));
if ($channels["cant"] > ($offset + $maxRecords)) {
$smarty->assign('next_offset', $offset + $maxRecords);
} else {
$smarty->assign('next_offset', -1);
}
// If offset is > 0 then prev_offset
if ($offset > 0) {
$smarty->assign('prev_offset', $offset - $maxRecords);
} else {
$smarty->assign('prev_offset', -1);
}
$smarty->assign_by_ref('channels', $channels["data"]);
// Fill array with possible number of questions per page
$positions = array();
for ($i = 1; $i < 100; $i++)
$positions[] = $i;
include_once ("categorize_list.php");
$smarty->assign('positions', $positions);
ask_ticket('edit-quiz-question');
// GGG scaffolding
// $smarty->assign('repetitionLimit', "10");
$mins = array();
for ($i = 1; $i <= 20; $i++)
$mins[] = $i;
$smarty->assign('mins', $mins);
$mins = array();
$repetitions = array();
$qpp = array();
for ($i = 1; $i <= 20; $i++){
$mins[] = $i;
}
$smarty->assign('mins', $mins);
for ($i = 1; $i <= 10; $i++){
$qpp[] = $i;
$repetitions[] = $i;
}
$repetitions[] = "Unlimited";
$qpp[] = "Unlimited";
$smarty->assign('repetitions', $repetitions);
$smarty->assign('qpp', $qpp);
$smarty->assign('questionsPerPage', "Unlimited");
$quiz_info["name"] = "Chapter 01";
// Display the template
$smarty->assign('mid', 'tiki-quiz_edit.tpl');
$smarty->display("tiki.tpl");
?>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment