. /** * Rendering of files viewer related widgets. * * @package theme_bootstrap * @copyright 2012 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); require_once($CFG->dirroot . "/files/renderer.php"); class theme_bootstrap_core_files_renderer extends core_files_renderer { /** * Returns html for displaying one file manager * * The main element in HTML must have id="filemanager-{$client_id}" and * class="filemanager fm-loading"; * After all necessary code on the page (both html and javascript) is loaded, * the class fm-loading will be removed and added class fm-loaded; * The main element (class=filemanager) will be assigned the following classes: * 'fm-maxfiles' - when filemanager has maximum allowed number of files; * 'fm-nofiles' - when filemanager has no files at all (although there might be folders); * 'fm-noitems' - when current view (folder) has no items - neither files nor folders; * 'fm-updating' - when current view is being updated (usually means that loading icon is to be displayed); * 'fm-nomkdir' - when 'Make folder' action is unavailable (empty($fm->options->subdirs) == true) * * Element with class 'filemanager-container' will be holding evens for dnd upload (dragover, etc.). * It will have class: * 'dndupload-ready' - when a file is being dragged over the browser * 'dndupload-over' - when file is being dragged over this filepicker (additional to 'dndupload-ready') * 'dndupload-uploading' - during the upload process (note that after dnd upload process is * over, the file manager will refresh the files list and therefore will have for a while class * fm-updating. Both waiting processes should look similar so the images don't jump for user) * * If browser supports Drag-and-drop, the body element will have class 'dndsupported', * otherwise - 'dndnotsupported'; * * Element with class 'fp-content' will be populated with files list; * Element with class 'fp-btn-add' will hold onclick event for adding a file (opening filepicker); * Element with class 'fp-btn-mkdir' will hold onclick event for adding new folder; * Element with class 'fp-btn-download' will hold onclick event for download action; * * Element with class 'fp-path-folder' is a template for one folder in path toolbar. * It will hold mouse click event and will be assigned classes first/last/even/odd respectfully. * Parent element will receive class 'empty' when there are no folders to be displayed; * The content of subelement with class 'fp-path-folder-name' will be substituted with folder name; * * Element with class 'fp-viewbar' will have the class 'enabled' or 'disabled' when view mode * can be changed or not; * Inside element with class 'fp-viewbar' there are expected elements with classes * 'fp-vb-icons', 'fp-vb-tree' and 'fp-vb-details'. They will handle onclick events to switch * between the view modes, the last clicked element will have the class 'checked'; * * @param form_filemanager $fm * @return string */ private function fm_print_generallayout($fm) { global $OUTPUT; $options = $fm->options; $client_id = $options->client_id; $straddfile = get_string('addfile', 'repository'); $strmakedir = get_string('makeafolder', 'moodle'); $strdownload = get_string('downloadfolder', 'repository'); $strloading = get_string('loading', 'repository'); $strdroptoupload = get_string('droptoupload', 'moodle'); $icon_progress = $OUTPUT->pix_icon('i/loading_small', $strloading).''; $restrictions = $this->fm_print_restrictions($fm); $strdndnotsupported = get_string('dndnotsupported_insentence', 'moodle').$OUTPUT->help_icon('dndnotsupported'); $strdndenabledinbox = get_string('dndenabled_inbox', 'moodle'); $loading = get_string('loading', 'repository'); $html = '