Update of /cvsroot/stack/stack-1-0/frontend_general
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24515/frontend_general
Added Files:
Tag: frontend_dev
edit_quiz_util.php
Log Message:
Added file forgot to add previously.
--- NEW FILE: edit_quiz_util.php ---
<?php
/**
*
* Welcome to STACK. A system for teaching and assessment using a
* computer algebra kernel.
* <br>
* This file is licensed under the GPL License.
* <br>
* A copy of the license is in your STACK distribution called
* license.txt. If you are missing this file you can obtain
* it from:
* http://www.stack.bham.ac.uk/license.txt
* <br>
* Copyright (c) 2005, Christopher James Sangwin
*
* @author Chris Sangwin C.J...@bh...
* @author Laura Naismith L.N...@bh...
* @author Juliette White jv...@jv...
* @package Stack
*
* This file contains utility functions used by edit_quiz.php
* TO DO: Some of these functions needs to be consolidated with the functions
* in the other utility files.
*/
/*
* Gets the question bank filter
* @param string $source - Must be 'post' or 'session'
* @return array $question_bank_filter
*/
function stack_get_qb_filter($source) {
if ('post' == $source) {
$question_bank_filter = nsf($_POST, 'bank_filter');
} else if ('session' == $source) {
$question_bank_filter = nsf($_SESSION, 'bank_filter');
}
return $question_bank_filter;
}
/*
* Sets the session question bank field
* @param array $question_bank_filter
* @return void
*/
function stack_set_qb_filter_in_session($question_bank_filter) {
$_SESSION['bank_filter'] = $question_bank_filter;
}
// $quizid only set if $sourc eis 'database'
/*
* Gets the quiz
* @param string $source - Must be 'post' or 'database'
* @param int $quizid This is only set if the $source is 'database', is set
* to the quiz id
* @return array $quiz
*/
function stack_get_quiz($source, $quizid) {
if ('post' == $source) {
$quiz = nsf($_POST, 'quiz');
} else if ('database' == $source) {
$quiz = stack_db_quiz_get($quizid);
}
return $quiz;
}
/*
* Gets the quiz id
* @param string $source - Must be 'post', 'database' or 'quiz'
* @param int $quiz This is only set if the $source is 'quiz', is set
* to the quiz to get the quiz id from
* @return array $quiz
*/
function stack_get_quizid($source, $quiz) {
$quizid = '';
if ('quiz' == $source) {
$quizid = nsf($quiz,'quizid');
} else if ('database' == $source) {
$quizid = stack_db_quiz_update(array());
} else if ('post' == $source) {
$quizid = nsf($_POST, 'quizid');
}
return $quizid;
}
?>
|