You are here

function get_course_media_files in Quiz 6.6

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

gets a list of all the media files for the given course

@calledfrom type/<typename>/editquestion.php @package questionbank @subpackage importexport

Parameters

int courseid:

Return value

array containing filenames

File

includes/moodle/question/format/qti2/qt_common.php, line 18

Code

function get_course_media_files($courseid) {

  // this code lifted from mod/quiz/question.php and modified
  global $CFG;
  $images = null;
  make_upload_directory("{$course->id}");

  // Just in case
  $coursefiles = get_directory_list("{$CFG->dataroot}/{$courseid}", $CFG->moddata);
  foreach ($coursefiles as $filename) {
    if (is_media_by_extension($filename)) {
      $images["{$filename}"] = $filename;
    }
  }
  return $images;
}