You are here

function qformat_xml::trans_format in Quiz 6.5

Same name and namespace in other branches
  1. 6.6 includes/moodle/question/format/xml/format.php \qformat_xml::trans_format()

Translate human readable format name into internal Moodle code number

Parameters

string name format name from xml file:

Return value

int Moodle format code

File

includes/moodle/question/format/xml/format.php, line 33

Class

qformat_xml

Code

function trans_format($name) {
  $name = trim($name);
  if ($name == 'moodle_auto_format') {
    $id = 0;
  }
  elseif ($name == 'html') {
    $id = 1;
  }
  elseif ($name == 'plain_text') {
    $id = 2;
  }
  elseif ($name == 'wiki_like') {
    $id = 3;
  }
  elseif ($name == 'markdown') {
    $id = 4;
  }
  else {
    $id = 0;

    // or maybe warning required
  }
  return $id;
}