Commit e061ece8 authored by ggeller's avatar ggeller

New quiz editor, work in progress.

parent 8420aa9c
<?php
// $Header: /cvsroot/tikiwiki/tiki/lib/quizzes/quizlib.php,v 1.29 2004-05-24 20:53:06 ggeller Exp $
// $Header: /cvsroot/tikiwiki/tiki/lib/quizzes/quizlib.php,v 1.30 2004-05-26 20:52:37 ggeller Exp $
// Copyright (c) 2002-2004, Luis Argerich, Garland Foster, Eduardo Polidor,
// George G. Geller et. al.
......@@ -729,6 +729,7 @@ class HW_QuizQuestionYesNo extends HW_QuizQuestion {
class Quiz {
var $id;
var $author; // id of the author (index into the users_users table)
var $version;
var $timestamp;
var $online;
......@@ -756,14 +757,18 @@ class Quiz {
var $data;
function Quiz(){
global $user;
global $userlib;
$this->id = 0;
$this->author = $userlib->get_user_id($user);
$this->authorLogin = $user;
$this->version = 1;
$this->timestamp = date('U');
$this->online = 'n';
$this->studentAttempts = 0;
$this->name = "";
$this->description = "";
$this->datePub = mktime(0, 0, 0, 1, 1, date("Y"));
$this->datePub = date("U");
$this->dateExp = mktime(0, 0, 0, 1, 1, date("Y")+10);
$this->shuffleQuestions = "y";
$this->shuffleAnswers = "y";
......@@ -786,8 +791,11 @@ class Quiz {
function show_html(){
// dump as html text
global $userlib;
$lines = array();
$lines[] = "id = ".$this->id."<br />";
$authorInfo = $userlib->get_userid_info($this->author);
$lines[] = "author id = ".$this->author."; author login = ".$authorInfo["login"]."<br />";
$lines[] = "version = ".$this->version."<br />";
$lines[] = "timestamp = ".date("r",$this->timestamp)."<br />";
$lines[] = "online = ".$this->online."<br />";
......
This diff is collapsed.
<?php
// $Header: /cvsroot/tikiwiki/tiki/tiki-quiz_edit.php,v 1.10 2004-05-24 20:53:05 ggeller Exp $
// $Header: /cvsroot/tikiwiki/tiki/tiki-quiz_edit.php,v 1.11 2004-05-26 20:52:36 ggeller Exp $
// Copyright (c) 2002-2004, Luis Argerich, Garland Foster, Eduardo Polidor,
// George G. Geller et. al.
......@@ -95,6 +95,14 @@ function fetchYNOption(&$quiz, $_REQUEST, $option){
if (isset($_REQUEST["save"])) {
check_ticket('edit-quiz-question');
echo __FILE__." line ".__LINE__."<br />";
foreach($_REQUEST as $key => $val){
if (preg_match("/^quiz_/",$key)){
echo $key." = ".$val."<br />";
}
}
die;
// See tiki-edit_quiz_questions.php for how to get import the quiz questions.
// if (isset($_REQUEST["import"])) {
// check_ticket('edit-quiz-question');
......@@ -128,15 +136,15 @@ if (isset($_REQUEST["save"])) {
$quiz = array();
if (!isset($_REQUEST['online']) && !($_REQUEST["online"] =! "choice_online" || $_REQUEST["online"] =! "choice_offline")){
if (!isset($_REQUEST['online']) && !($_REQUEST["online"] =! "online" || $_REQUEST["online"] =! "offline")){
echo "line: ".__LINE__."<br>";
echo 'Invalid value for $_REQUEST["online"]. Is your tpl file correct?<br>';
die;
}
if ($_REQUEST["online"] == "choice_online"){
if ($_REQUEST["online"] == "online"){
$quiz["online"] = "y";
}
else if ($_REQUEST["online"] == "choice_offline"){
else if ($_REQUEST["online"] == "offline"){
$quiz["online"] = "n";
}
......@@ -219,14 +227,15 @@ if (isset($_REQUEST["save"])) {
$quizOld = $quizlib->quiz_fetch($_REQUEST["quizId"]);
}
// Scaffolding
// The taken and history stuff has to come from version and studentAttempts fields in
// the tiki_quiz table in the database.
// $quiz['taken'] = 'y';
// $quiz['history'] = array();
// $quiz['history'][] = "and so on...";
// $quiz['history'][] = "Version 3 was attempted by students 3 time(s).";
// $quiz['history'][] = "Version 2 was attempted by students 2 time(s).";
// $quiz['history'][] = "Version 1 was attempted by students 1 time(s).";
// $quiz->taken = 'y';
// $quiz->history = array();
// $quiz->history[] = "and so on...";
// $quiz->history[] = "Version 3 (date stamp) was attempted by students 3 time(s).";
// $quiz->history[] = "Version 2 (date stamp) was attempted by students 2 time(s).";
// $quiz->history[] = "Version 1 (date stamp) was attempted by students 1 time(s).";
$smarty->assign('quiz', $quiz);
......@@ -234,24 +243,25 @@ $smarty->assign('quiz', $quiz);
// echo '$quiz->id = '.$quiz->id."<br>";
// die;
function setup_options(){
function setup_options(&$tpl){
global $smarty;
global $tikilib;
global $user;
$smarty->assign('online_choices', array('choice_online' => 'Online',
'choice_offline' => 'Offline'));
$tpl['online_choices'] = array('online' => 'Online', 'offline' => 'Offline');
$optionsGrading = array();
$optionsGrading[] = "machine";
$optionsGrading[] = "peer review";
$optionsGrading[] = "teacher";
$smarty->assign('optionsGrading', $optionsGrading);
$tpl['optionsGrading'] = $optionsGrading;
// $smarty->assign('optionsGrading', $optionsGrading);
$optionsShowScore = array();
$optionsShowScore[] = "immediately";
$optionsShowScore[] = "after expire date";
$optionsShowScore[] = "never";
$smarty->assign('optionsShowScore', $optionsShowScore);
$tpl['optionsShowScore'] = $optionsShowScore;
// $smarty->assign('optionsShowScore', $optionsShowScore);
// FIXME - This needs to be limited to the session timeout in php.ini
$mins = array();
......@@ -269,6 +279,7 @@ function setup_options(){
}
$repetitions[] = "unlimited";
$smarty->assign('repetitions', $repetitions);
$tpl['qpp'] = $qpp;
$smarty->assign('qpp', $qpp);
$smarty->assign('questionsPerPage', "Unlimited");
......@@ -279,14 +290,18 @@ function setup_options(){
$tzName = "";
}
$smarty->assign('siteTimeZone', $tzName);
$tpl['siteTimeZone'] = $tzName;
}
setup_options();
$tpl = array();
setup_options(&$tpl);
$smarty->assign('tpl', $tpl);
ask_ticket('edit-quiz-question');
// Display the template
$smarty->assign('mid', 'tiki-quiz_edit.tpl');
$smarty->display("tiki.tpl");
// $smarty->display("tiki.tpl");
$smarty->display("ggg-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