Created
July 11, 2013 14:55
-
-
Save bmbrands/5976154 to your computer and use it in GitHub Desktop.
moodle file stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_content() { | |
global $DB,$USER,$OUTPUT,$CFG; | |
$courseid = $this->page->course->id; | |
//Ensure only teacher can use this block | |
$coursecontext = context_course::instance($courseid); | |
if(has_capability('moodle/course:manage', $coursecontext)){ | |
$this->content = new stdClass; | |
$fs = get_file_storage(); | |
$files = $fs->get_area_files($coursecontext->id, 'course', 'attachment', 0); | |
$table = new html_table(); | |
$table->head = array('filename'); | |
$tabledata = array(); | |
foreach ($files as $f) { | |
// $f is an instance of stored_file | |
$f->get_filename(); | |
array_push($tabledata,$child->get_params()); | |
} | |
$table->data = $tabledata; | |
$this->content = html_writer::table($table); | |
} | |
return $this->content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi