| Línea 70... |
Línea 70... |
| 70 |
|
70 |
|
| 71 |
$downloadable = folder_archive_available($folder, $cm);
|
71 |
$downloadable = folder_archive_available($folder, $cm);
|
| 72 |
if ($downloadable) {
|
72 |
if ($downloadable) {
|
| 73 |
$downloadbutton = new single_button(new moodle_url('/mod/folder/download_folder.php', ['id' => $cm->id]),
|
73 |
$downloadbutton = new single_button(new moodle_url('/mod/folder/download_folder.php', ['id' => $cm->id]),
|
| 74 |
get_string('downloadfolder', 'folder'), 'get');
|
74 |
get_string('downloadfolder', 'folder'), 'get');
|
| 75 |
$downloadbutton->class = 'navitem ml-auto';
|
75 |
$downloadbutton->class = 'navitem ms-auto';
|
| 76 |
$data['download_button'] = $downloadbutton->export_for_template($this->output);
|
76 |
$data['download_button'] = $downloadbutton->export_for_template($this->output);
|
| 77 |
$data['hasbuttons'] = true;
|
77 |
$data['hasbuttons'] = true;
|
| Línea 78... |
Línea 78... |
| 78 |
}
|
78 |
}
|
| Línea 89... |
Línea 89... |
| 89 |
|
89 |
|
| 90 |
return $this->render_from_template('mod_folder/folder', $data);
|
90 |
return $this->render_from_template('mod_folder/folder', $data);
|
| Línea 91... |
Línea 91... |
| 91 |
}
|
91 |
}
|
| 92 |
|
- |
|
| 93 |
/**
|
- |
|
| 94 |
* Internal function - creates htmls structure suitable for YUI tree.
|
92 |
|
| 95 |
*
|
93 |
/**
|
| 96 |
* @deprecated since Moodle 4.3
|
- |
|
| 97 |
*/
|
- |
|
| 98 |
protected function htmllize_tree($tree, $dir) {
|
- |
|
| 99 |
global $CFG;
|
- |
|
| 100 |
|
- |
|
| 101 |
debugging(
|
- |
|
| 102 |
'Method htmllize_tree() is deprecated. Please use renderable_tree_elements instead',
|
- |
|
| 103 |
DEBUG_DEVELOPER
|
- |
|
| 104 |
);
|
- |
|
| 105 |
|
- |
|
| 106 |
if (empty($dir['subdirs']) and empty($dir['files'])) {
|
- |
|
| 107 |
return '';
|
- |
|
| 108 |
}
|
- |
|
| 109 |
$result = '<ul>';
|
- |
|
| 110 |
foreach ($dir['subdirs'] as $subdir) {
|
- |
|
| 111 |
$image = $this->output->pix_icon(file_folder_icon(), $subdir['dirname'], 'moodle');
|
- |
|
| 112 |
$filename = html_writer::tag('span', $image, array('class' => 'fp-icon')).
|
- |
|
| 113 |
html_writer::tag('span', s($subdir['dirname']), array('class' => 'fp-filename'));
|
- |
|
| 114 |
$filename = html_writer::tag('div', $filename, array('class' => 'fp-filename-icon'));
|
- |
|
| 115 |
$result .= html_writer::tag('li', $filename. $this->htmllize_tree($tree, $subdir));
|
- |
|
| 116 |
}
|
- |
|
| 117 |
foreach ($dir['files'] as $file) {
|
- |
|
| 118 |
$filename = $file->get_filename();
|
94 |
* @deprecated since Moodle 4.3
|
| 119 |
$url = moodle_url::make_pluginfile_url($file->get_contextid(), $file->get_component(),
|
- |
|
| 120 |
$file->get_filearea(), $file->get_itemid(), $file->get_filepath(), $filename, false);
|
- |
|
| 121 |
$filenamedisplay = clean_filename($filename);
|
- |
|
| 122 |
if (file_extension_in_typegroup($filename, 'web_image')) {
|
- |
|
| 123 |
$image = $url->out(false, array('preview' => 'tinyicon', 'oid' => $file->get_timemodified()));
|
- |
|
| 124 |
$image = html_writer::empty_tag('img', array('src' => $image));
|
- |
|
| 125 |
} else {
|
- |
|
| 126 |
$image = $this->output->pix_icon(file_file_icon($file), $filenamedisplay, 'moodle');
|
- |
|
| 127 |
}
|
- |
|
| 128 |
$filename = html_writer::tag('span', $image, array('class' => 'fp-icon')).
|
- |
|
| 129 |
html_writer::tag('span', $filenamedisplay, array('class' => 'fp-filename'));
|
- |
|
| 130 |
$urlparams = null;
|
- |
|
| 131 |
if ($tree->folder->forcedownload) {
|
- |
|
| 132 |
$urlparams = ['forcedownload' => 1];
|
95 |
*/
|
| 133 |
}
|
96 |
#[\core\attribute\deprecated('renderable_tree_elements()', since: '4.3', mdl: 'MDL-78847', final: true)]
|
| 134 |
$filename = html_writer::tag('span',
|
- |
|
| 135 |
html_writer::link($url->out(false, $urlparams), $filename),
|
- |
|
| 136 |
['class' => 'fp-filename-icon']
|
- |
|
| 137 |
);
|
- |
|
| 138 |
$result .= html_writer::tag('li', $filename);
|
- |
|
| 139 |
}
|
- |
|
| 140 |
$result .= '</ul>';
|
- |
|
| 141 |
|
97 |
protected function htmllize_tree() {
|
| Línea 142... |
Línea 98... |
| 142 |
return $result;
|
98 |
\core\deprecation::emit_deprecation([self::class, __FUNCTION__]);
|
| 143 |
}
|
99 |
}
|
| 144 |
|
100 |
|