diff --git a/lib/weblib.php b/lib/weblib.php index 267e95166ca..36af76872b5 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -2707,6 +2707,90 @@ function print_maintenance_message() { die; } +/** + * this function is used to print a filemanager + * + * @param $options array options to setup filemanager + * @param $return bool If true output is returned rather than printed out + * @return string + */ +function print_filemanager($options, $return = false) { + global $PAGE, $CFG; + // start to setup filemanager + // loading filemanager language string + $PAGE->requires->string_for_js('loading', 'repository'); + $PAGE->requires->string_for_js('nomorefiles', 'repository'); + $PAGE->requires->string_for_js('confirmdeletefile', 'repository'); + $PAGE->requires->string_for_js('add', 'repository'); + $PAGE->requires->string_for_js('accessiblefilepicker', 'repository'); + $PAGE->requires->string_for_js('move', 'moodle'); + $PAGE->requires->string_for_js('cancel', 'moodle'); + $PAGE->requires->string_for_js('download', 'moodle'); + $PAGE->requires->string_for_js('ok', 'moodle'); + $PAGE->requires->string_for_js('emptylist', 'repository'); + $PAGE->requires->string_for_js('entername', 'repository'); + $PAGE->requires->string_for_js('enternewname', 'repository'); + $PAGE->requires->string_for_js('zip', 'editor'); + $PAGE->requires->string_for_js('unzip', 'moodle'); + $PAGE->requires->string_for_js('rename', 'moodle'); + $PAGE->requires->string_for_js('delete', 'moodle'); + $PAGE->requires->string_for_js('setmainfile', 'resource'); + $PAGE->requires->string_for_js('cannotdeletefile', 'error'); + $PAGE->requires->string_for_js('confirmdeletefile', 'repository'); + $PAGE->requires->string_for_js('nopathselected', 'repository'); + $PAGE->requires->string_for_js('popupblockeddownload', 'repository'); + $PAGE->requires->string_for_js('path', 'moodle'); + // language strings + $straddfile = get_string('add', 'repository') . '...'; + $strmakedir = get_string('makeafolder', 'moodle'); + $strdownload = get_string('downloadfolder', 'repository'); + + $client_id = $options->client_id; + $itemid = $options->itemid; + + $html = ''; + + $html .= <<