You are here

function qformat_qti2::init_smarty in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/moodle/question/format/qti2/format.php \qformat_qti2::init_smarty()

gets a new Smarty object, with the template and compile directories set

Return value

object a smarty object

3 calls to qformat_qti2::init_smarty()
qformat_qti2::exportprocess in includes/moodle/question/format/qti2/format.php
exports the questions in a question category to the given location
qformat_qti2::exportprocess_quiz in includes/moodle/question/format/qti2/format.php
This function is called to export a quiz (as opposed to exporting a category of questions)
qformat_qti2::writequestion in includes/moodle/question/format/qti2/format.php
Creates the export text for a question

File

includes/moodle/question/format/qti2/format.php, line 679

Class

qformat_qti2

Code

function &init_smarty() {
  global $CFG;

  // create smarty compile dir in dataroot
  $path = $CFG->dataroot . "/smarty_c";
  if (!is_dir($path)) {
    if (!mkdir($path, $CFG->directorypermissions)) {
      error("Cannot create path: {$path}");
    }
  }
  $smarty = new Smarty();
  $smarty->template_dir = "{$CFG->dirroot}/question/format/qti2/templates";
  $smarty->compile_dir = "{$path}";
  return $smarty;
}