You are here

function qformat_default::readdata in Quiz 6.6

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

Return complete file within an array, one item per line

Parameters

string filename name of file:

Return value

mixed contents array or false on failure

1 call to qformat_default::readdata()
qformat_default::importprocess in includes/moodle/question/format.php
Process the file This method should not normally be overidden
1 method overrides qformat_default::readdata()
qformat_blackboard_6::readdata in includes/moodle/question/format/blackboard_6/format.php
Return complete file within an array, one item per line

File

includes/moodle/question/format.php, line 425

Class

qformat_default
Base class for question import and export formats.

Code

function readdata($filename) {
  if (is_readable($filename)) {
    $filearray = file($filename);

    /// Check for Macintosh OS line returns (ie file on one line), and fix
    if (ereg("\r", $filearray[0]) and !ereg("\n", $filearray[0])) {
      return explode("\r", $filearray[0]);
    }
    else {
      return $filearray;
    }
  }
  return false;
}