You are here

function qformat_coursetestmanager::getquestioncategories in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/moodle/question/format/coursetestmanager/format.php \qformat_coursetestmanager::getquestioncategories()
1 call to qformat_coursetestmanager::getquestioncategories()
qformat_coursetestmanager::importprocess in includes/moodle/question/format/coursetestmanager/format.php
Process the file This method should not normally be overidden

File

includes/moodle/question/format/coursetestmanager/format.php, line 338

Class

qformat_coursetestmanager

Code

function getquestioncategories($filename, $mdapath = "", $hostname = "") {
  global $CFG, $result;
  $sql = "SELECT Distinct module FROM TBQuestions";
  if (PHP_OS == "WINNT") {
    $ldb =& $this
      ->connect_win($filename);
    $qset = $ldb
      ->Execute("{$sql}");
    if (!$qset->EOF) {
      $records = $qset
        ->GetArray(true);
      foreach ($records as $record) {
        $categories[$record[0]] = $record[0];
      }
    }
    else {

      // if recordcount
      $this
        ->err("There were no records in the database.", $dsn);
      $ldb
        ->Close();
      return false;
    }
    $ldb
      ->Close();
  }
  else {

    // if PHP_OS == WINNT
    // we have a linux installation
    $result = $this
      ->query_linux($sql, $filename, $mdapath, $hostname);
    for ($i = 0; $i < count($result); $i++) {
      $categories[$result[$i][0]] = $result[$i][0];
    }
  }

  // PHP_OS TEST
  return $categories;
}