. /** * Print private files tree * * @package core_user * @copyright 2010 Dongsheng Cai * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); class core_user_renderer extends plugin_renderer_base { /** * Prints user files tree view * @return string */ public function user_files_tree() { return $this->render(new user_files_tree); } public function render_user_files_tree(user_files_tree $tree) { if (empty($tree->dir['subdirs']) && empty($tree->dir['files'])) { $html = $this->output->box(get_string('nofilesavailable', 'repository')); } else { $htmlid = 'user_files_tree_'.uniqid(); $module = array('name'=>'core_user', 'fullpath'=>'/user/module.js'); $this->page->requires->js_init_call('M.core_user.init_tree', array(false, $htmlid), false, $module); $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 user_files_tree implements renderable { public $context; public $dir; public function __construct() { global $USER; $this->context = get_context_instance(CONTEXT_USER, $USER->id); $fs = get_file_storage(); $this->dir = $fs->get_area_tree($this->context->id, 'user', 'private', 0); } }