Commit 605462fd authored by ggeller's avatar ggeller

New quiz editor. Under construction.

parent 8522d4cd
<?php
// $Header: /cvsroot/tikiwiki/tiki/lib/quizzes/quizlib.php,v 1.30 2004-05-26 20:52:37 ggeller Exp $
// $Header: /cvsroot/tikiwiki/tiki/lib/quizzes/quizlib.php,v 1.31 2004-05-28 14:05:15 ggeller Exp $
// Copyright (c) 2002-2004, Luis Argerich, Garland Foster, Eduardo Polidor,
// George G. Geller et. al.
......@@ -518,9 +518,24 @@ class QuizLib extends TikiLib {
return true;
}
// function quiz_fetch($_REQUEST["quizId"]);
function quiz_fetch($id){
if ($id == 0){
$quiz = new Quiz;
}
else {
echo __FILE__." line: ".__LINE__." : Need to fetch a quiz from the database"."<br />";
}
return $quiz;
}
// $quiz is a quiz object
function quiz_store($quiz){
echo __FILE__." line: ".__LINE__.": in quizlib->quiz_store<br />";
foreach($quiz as $key => $val){
echo $key." = ".$val."<br />";
}
die;
}
// Function for Quizzes end ////
}
......@@ -729,6 +744,7 @@ class HW_QuizQuestionYesNo extends HW_QuizQuestion {
class Quiz {
var $id;
var $deleted;
var $author; // id of the author (index into the users_users table)
var $version;
var $timestamp;
......@@ -760,6 +776,7 @@ class Quiz {
global $user;
global $userlib;
$this->id = 0;
$this->deleted = 0;
$this->author = $userlib->get_user_id($user);
$this->authorLogin = $user;
$this->version = 1;
......@@ -775,7 +792,7 @@ class Quiz {
$this->limitDisplay = "y";
$this->questionsPerPage = 1;
$this->timeLimited = "n";
$this->timeLimit = "0";
$this->timeLimit = "1";
$this->multiSession = "n";
$this->canRepeat = "y";
$this->repetitions = 'unlimited';
......@@ -794,6 +811,7 @@ class Quiz {
global $userlib;
$lines = array();
$lines[] = "id = ".$this->id."<br />";
$lines[] = "deleted = ".$this->deleted."<br />";
$authorInfo = $userlib->get_userid_info($this->author);
$lines[] = "author id = ".$this->author."; author login = ".$authorInfo["login"]."<br />";
$lines[] = "version = ".$this->version."<br />";
......@@ -824,11 +842,19 @@ class Quiz {
return $lines;
}
function getQuestion(){
return $this->question;
// Use any data in the array to replace the instance data.
function data_load($data){
// echo __FILE__." line:".__LINE__."<br />";
foreach($this as $key => $val){
if (isset($data[$key]) && ($data[$key] != $val)){
// echo "old: ".$key." = ".$val;
$this->$key = $data[$key];
// echo ", new: ".$this->$key."<br />";
}
}
}
function to_text(){
function compare($quiz){
// Export the question to an array of text lines.
}
......
{* $Header: /cvsroot/tikiwiki/tiki/templates/tiki-quiz_edit.tpl,v 1.12 2004-05-26 20:52:37 ggeller Exp $ *}
{* $Header: /cvsroot/tikiwiki/tiki/templates/tiki-quiz_edit.tpl,v 1.13 2004-05-28 14:04:18 ggeller Exp $ *}
{* Copyright (c) 2004 George G. Geller et. al. *}
{* All Rights Reserved. See copyright.txt for details and a complete list of authors. *}
......@@ -102,14 +102,14 @@
<td class="formcolor"><input type="checkbox" name=quiz.limitDisplay id="quiz-display-limit" {if $quiz->limitDisplay eq 'y'}checked="checked"{/if} /><label for="quiz-display-limit">{tr}Limit questions displayed per page to {/tr}</label><select name=quiz.questionsPerPage id="quiz-perpage">{html_options values=$tpl.qpp selected=$quiz->questionsPerPage output=$tpl.qpp}</select>{tr}&nbsp question(s).{/tr}</td>
</tr>
<tr>
<td class="formcolor"><input type="checkbox" name=quiz.timeLimited id="timelimit" {if $quiz->timeLimited eq 'y'}checked="checked"{/if} /><label for="timelimit">{tr}Impose a time limit of {/tr}</label><select name=quiz.timeLimit id="quiz-maxtime">{html_options values=$mins selected=$quiz->timeLimit output=$mins}</select> {tr}minutes{/tr}</td>
<td class="formcolor"><input type="checkbox" name=quiz.timeLimited id="timelimit" {if $quiz->timeLimited eq 'y'}checked="checked"{/if} /><label for="timelimit">{tr}Impose a time limit of {/tr}</label><select name=quiz.timeLimit id="quiz-maxtime">{html_options values=$tpl.mins selected=$quiz->timeLimit output=$tpl.mins}</select> {tr}minutes{/tr}</td>
</tr>
<tr>
<td class="formcolor"><input type="checkbox" name=quiz.multiSession id="quiz-multi-session" {if $quiz->multiSession eq 'y'}checked="checked"{/if} /><label for="quiz-multi-session">{tr}Allow students to store partial results and return to quiz.{/tr}</td>
</tr>
<tr>
<td class="formcolor"><input type="checkbox" name=quiz.canRepeat id="repeat" {if $quiz->canRepeat eq 'y'}checked="checked"{/if} /><label for="repeat">{tr}Allow students to retake this quiz {/tr}</label>
<select name=quiz.repetitions id="quiz-repeat">{html_options values=$repetitions selected=$quiz->repetitions output=$repetitions}</select> {tr}times{/tr}</td>
<select name=quiz.repetitions id="quiz-repeat">{html_options values=$tpl.repetitions selected=$quiz->repetitions output=$tpl.repetitions}</select> {tr}times{/tr}</td>
</tr>
</table>
</div>
......
This diff is collapsed.
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