Skip to content

Commit

Permalink
Removing some more references to quiz from import/export code
Browse files Browse the repository at this point in the history
  • Loading branch information
gustav_delius committed Mar 1, 2006
1 parent 28dad8b commit f5565b6
Show file tree
Hide file tree
Showing 20 changed files with 800 additions and 787 deletions.
10 changes: 10 additions & 0 deletions lib/questionlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,16 @@ function print_question(&$question, &$state, $number, $cmoptions, $options=null)
$QTYPES[$question->qtype]->print_question($question, $state, $number,
$cmoptions, $options);
}
/**
* Saves question options
*
* Simply calls the question type specific save_question_options() method.
*/
function save_question_options($question) {
global $QTYPES;

$QTYPES[$question->qtype]->save_question_options($question);
}

/**
* Gets all teacher stored answers for a given question
Expand Down
12 changes: 6 additions & 6 deletions question/category_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Class question_category_object
*
* Used for handling changes to the quiz categories
* Used for handling changes to the question categories
*
* @version $Id$
* @author Martin Dougiamas and many others. {@link http://moodle.org}
Expand Down Expand Up @@ -255,7 +255,7 @@ function build_edit_table_body($categories, $page = 0, $firstcat = 1, $lastcat =
$up = $first ? false : true;
$down = $last ? false : true;
$first = false;
$this->quiz_edit_category_row($category, $depth, $up, $down, $page);
$this->edit_question_category_row($category, $depth, $up, $down, $page);
if (isset($category->children)) {
$this->build_edit_table_body($category->children, $page, $firstcat, $lastcat, $depth + 1);
}
Expand Down Expand Up @@ -289,7 +289,7 @@ function get_course_ids($categories) {
* @param boolean down can it be moved down?
* @param int page page number
*/
function quiz_edit_category_row($category, $depth, $up = false, $down = false, $page = 0) {
function edit_question_category_row($category, $depth, $up = false, $down = false, $page = 0) {
global $USER;
$fill = str_repeat($this->tab, $depth);

Expand Down Expand Up @@ -546,7 +546,7 @@ function set_viable_parents(&$parentstrings, $category) {
}

/**
* Gets quiz categories
* Gets question categories
*
* @param int parent - if given, restrict records to those with this parent id.
* @param string sort - [[sortfield [,sortfield]] {ASC|DESC}]
Expand All @@ -565,7 +565,7 @@ function get_question_categories($parent=null, $sort="sortorder ASC") {


/**
* Deletes an existing quiz category
* Deletes an existing question category
*
* @param int deletecat id of category to delete
* @param int destcategoryid id of category which will inherit the orphans of deletecat
Expand Down Expand Up @@ -740,7 +740,7 @@ function add_category($newparent, $newcategory, $newinfo, $newpublish, $newcours
$cat->sortorder = 999;
$cat->stamp = make_unique_id_code();
if (!insert_record("question_categories", $cat)) {
error("Could not insert the new quiz category '$newcategory'", "category.php?id={$newcourse}");
error("Could not insert the new question category '$newcategory'", "category.php?id={$newcourse}");
} else {
notify(get_string("categoryadded", "quiz", $newcategory), 'green');
}
Expand Down
12 changes: 6 additions & 6 deletions question/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,27 @@
require("format.php"); // Parent class
require("format/$format/format.php");

$classname = "quiz_format_$format";
$quiz_format = new $classname();
$classname = "qformat_$format";
$qformat = new $classname();

if (! $quiz_format->exportpreprocess($category, $course)) { // Do anything before that we need to
if (! $qformat->exportpreprocess($category, $course)) { // Do anything before that we need to
error("Error occurred during pre-processing!",
"$CFG->wwwroot/mod/quiz/export.php?category=$category->id");
}

if (! $quiz_format->exportprocess($exportfilename)) { // Process the export data
if (! $qformat->exportprocess($exportfilename)) { // Process the export data
error("Error occurred during processing!",
"$CFG->wwwroot/mod/quiz/export.php?category=$category->id");
}

if (! $quiz_format->exportpostprocess()) { // In case anything needs to be done after
if (! $qformat->exportpostprocess()) { // In case anything needs to be done after
error("Error occurred during post-processing!",
"$CFG->wwwroot/mod/quiz/export.php?category=$category->id");
}
echo "<hr />";

// link to download the finished file
$file_ext = $quiz_format->export_file_extension();
$file_ext = $qformat->export_file_extension();
$download_str = get_string( 'download', 'quiz' );
$downloadextra_str = get_string( 'downloadextra','quiz' );
if ($CFG->slasharguments) {
Expand Down
2 changes: 1 addition & 1 deletion question/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

// Included by import.php and export.php

class quiz_default_format {
class qformat_default {

var $displayerrors = true;
var $category = NULL;
Expand Down
2 changes: 1 addition & 1 deletion question/format/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ For correct operation the class name must be based on the
name of the containing directory, e.g.,

directory: webct
class: class quiz_format_webct extends quiz_default_format {
class: class qformat_webct extends qformat_default {

Most of them are based on the class found in mod/quiz/format.php.
See the comments therein for more information.
Expand Down
2 changes: 1 addition & 1 deletion question/format/aiken/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

// Based on format.php, included by ../../import.php

class quiz_format_aiken extends quiz_default_format {
class qformat_aiken extends qformat_default {

function provide_import() {
return true;
Expand Down
4 changes: 2 additions & 2 deletions question/format/aon/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

// Based on format.php, included by ../../import.php

class quiz_format_aon extends quiz_default_format {
class qformat_aon extends qformat_default {

function provide_import() {
return true;
Expand Down Expand Up @@ -181,7 +181,7 @@ function importpostprocess() {
$question->subanswers[] = addslashes($shortanswer->answer);
}

$result = quiz_save_question_options($question);
$result = save_question_options($question);

if (!empty($result->error)) {
notify("Error: $result->error");
Expand Down
2 changes: 1 addition & 1 deletion question/format/blackboard/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

require_once ("$CFG->libdir/xmlize.php");

class quiz_format_blackboard extends quiz_default_format {
class qformat_blackboard extends qformat_default {

function provide_import() {
return true;
Expand Down
4 changes: 2 additions & 2 deletions question/format/coursetestmanager/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Based on format.php, included by ../../import.php
require_once($CFG->dirroot.'/lib/uploadlib.php');

class quiz_format_coursetestmanager extends quiz_default_format {
class qformat_coursetestmanager extends qformat_default {

function provide_import() {
return true;
Expand Down Expand Up @@ -248,7 +248,7 @@ function importprocess($filename) {
}
$this->questionids[] = $question->id;
// Now to save all the answers and type-specific options
$result = quiz_save_question_options($question);
$result = save_question_options($question);
if (!empty($result->error)) {
notify($result->error);
$this->deletedatabase($filename);
Expand Down
5 changes: 4 additions & 1 deletion question/format/examview/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
** Support of rejoinders
**
** $Log$
** Revision 1.2 2006/03/01 07:36:08 gustav_delius
** Removing some more references to quiz from import/export code
**
** Revision 1.1 2006/02/24 15:14:04 thepurpleblob
** Moving quiz import/export files to new question area.
**
Expand Down Expand Up @@ -45,7 +48,7 @@
define("CALCULATED", "10");
*/

class quiz_format_examview extends quiz_default_format {
class qformat_examview extends qformat_default {

var $qtypes = array('tf' => TRUEFALSE,
'mc' => MULTICHOICE,
Expand Down
2 changes: 1 addition & 1 deletion question/format/gift/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
//////////////////////////////////////////////////////////////////////////
// Based on default.php, included by ../import.php

class quiz_format_gift extends quiz_default_format {
class qformat_gift extends qformat_default {

function provide_import() {
return true;
Expand Down
Loading

0 comments on commit f5565b6

Please sign in to comment.