. /** * A custom renderer class that extends the plugin_renderer_base and * is used by the assignment module. * * @package mod-assignment * @copyright 2010 Dongsheng Cai * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later **/ class mod_assignment_renderer extends plugin_renderer_base { /** * @return string */ public function assignment_files($context, $itemid, $filearea='submission') { return $this->render(new assignment_files($context, $itemid, $filearea)); } public function render_assignment_files(assignment_files $tree) { $module = array('name'=>'mod_assignment_files', 'fullpath'=>'/mod/assignment/assignment.js', 'requires'=>array('yui2-treeview')); $htmlid = 'assignment_files_tree_'.uniqid(); $this->page->requires->js_init_call('M.mod_assignment.init_tree', array(true, $htmlid)); $html = '
'; $html .= $this->htmllize_tree($tree, $tree->dir); $html .= '
'; return $html; } /** * Internal function - creates htmls structure suitable for YUI tree. */ protected function htmllize_tree($tree, $dir) { global $CFG; $yuiconfig = array(); $yuiconfig['type'] = 'html'; if (empty($dir['subdirs']) and empty($dir['files'])) { return ''; } $result = ''; return $result; } } class assignment_files implements renderable { public $context; public $dir; public function __construct($context, $itemid, $filearea='submission') { global $USER; $this->context = $context; $fs = get_file_storage(); $this->dir = $fs->get_area_tree($this->context->id, 'mod_assignment', $filearea, $itemid); } }