$CFG->zip='/usr/bin/zip';// FIXME doesn't work on Windows
/** Converts the text format from the value to the 'internal'
* name or vice versa. $key can either be the value or the name
* and you get the other back.
*
* @param mixed int 0-4 or string one of 'moodle','html','plain','markdown'
* @return mixed as above but the other way around!
*/
functiontext_format_name($key){
$lookup=array();
$lookup[FORMAT_MOODLE]='moodle';
$lookup[FORMAT_HTML]='html';
$lookup[FORMAT_PLAIN]='plain';
$lookup[FORMAT_MARKDOWN]='markdown';
$lookup[FORMAT_LATEX]='latex';// added by turadg 2009-05-26
$value="error";
if(!is_numeric($key)){
$key=strtolower($key);
$value=array_search($key,$lookup);
}
else{
if(isset($lookup[$key])){
$value=$lookup[$key];
}
}
return$value;
}
/**#@+
* The core question types.
*/
// from moodle/lib/questionlib.php
define("SHORTANSWER","shortanswer");
define("TRUEFALSE","truefalse");
define("MULTICHOICE","multichoice");
define("RANDOM","random");
define("MATCH","match");
define("RANDOMSAMATCH","randomsamatch");
define("DESCRIPTION","description");
define("NUMERICAL","numerical");
define("MULTIANSWER","multianswer");
define("CALCULATED","calculated");
define("ESSAY","essay");
/**#@-*/
/**
* Moodle text formats from moodle/lib/weblib.php
* plus LaTeX format
*/
define('FORMAT_MOODLE',0);// Does all sorts of transformations and filtering
define('FORMAT_HTML',1);// Plain HTML (with some tags stripped)
define('FORMAT_PLAIN',2);// Plain text (even tags are printed in full)
define('FORMAT_WIKI',3);// Wiki-formatted text @deprecated
define('FORMAT_MARKDOWN',4);// Markdown-formatted text http://daringfireball.net/projects/markdown/
define('FORMAT_LATEX',314);
/**
* Moodle localized string function from moodle/lib/moodlelib.php
* reimplemented hackedly for within the Drupal Quiz module
* e.g. get_string("wronggrade", "quiz", $nLineCounter).' '.get_string("fractionsnomax", "quiz", $maxfraction);
*
* @param string $identifier The key identifier for the localized string
* @param string $module The module where the key identifier is stored, usually expressed as the filename in the language pack without the .php on the end but can also be written as mod/forum or grade/export/xls. If none is specified then moodle.php is used.
* @param mixed $a An object, string or number that can be used
* within translation strings
* @param array $extralocations An array of strings with other locations to look for string files