4 include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
27 $a_label_enable =
false,
30 $a_commands = array(),
31 $a_post_dir_path =
false,
37 $ilAccess = $DIC[
'ilAccess'];
40 $this->
setId($a_table_id);
41 $this->cur_dir = $a_cur_dir;
42 $this->cur_subdir = $a_cur_subdir;
43 $this->label_enable = $a_label_enable;
44 $this->label_header = $a_label_header;
45 $this->file_labels = $a_file_labels;
46 $this->post_dir_path = $a_post_dir_path;
49 parent::__construct($a_parent_obj, $a_parent_cmd);
50 $this->
setTitle(
$lng->txt(
"cont_files") .
" " . $this->cur_subdir);
52 $this->has_multi =
false;
53 for (
$i = 0;
$i < count($a_commands);
$i++) {
54 if (!$a_commands[
$i][
"single"]) {
57 $this->has_multi =
true;
59 $this->row_commands[] = array(
60 "cmd" =>
"extCommand_" . $i,
61 "caption" => $a_commands[$i][
"name"],
62 "allow_dir" => $a_commands[$i][
"allow_dir"]
75 "tpl.directory_row.html",
83 if ($a_field ==
"size") {
104 if (is_dir($this->cur_dir)) {
107 $entries = array(array(
"type" =>
"dir",
"entry" =>
".."));
111 foreach ($entries as $e) {
112 if (($e[
"entry"] ==
".") || ($e[
"entry"] ==
".." && empty($this->cur_subdir))) {
115 $cfile = (!empty($this->cur_subdir))
116 ? $this->cur_subdir .
"/" . $e[
"entry"]
119 if ($this->label_enable) {
120 $label = (is_array($this->file_labels[$cfile]))
121 ? implode(
", ", $this->file_labels[$cfile])
125 $pref = ($e[
"type"] ==
"dir")
128 $items[] = array(
"file" => $cfile,
"entry" => $e[
"entry"],
129 "type" => $e[
"type"],
"label" => $label,
"size" => $e[
"size"],
130 "name" => $pref . $e[
"entry"]);
137 if ($this->has_multi) {
143 $this->
addColumn($this->lng->txt(
"cont_dir_file"),
"name");
144 $this->
addColumn($this->lng->txt(
"cont_size"),
"size");
146 if ($this->label_enable) {
147 $this->
addColumn($this->label_header,
"label");
150 if (
sizeof($this->row_commands)) {
151 $this->
addColumn($this->lng->txt(
"actions"));
152 include_once
"Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
162 return $entry[
'entry'] ===
'..';
173 $hash = $this->post_dir_path
174 ? md5($a_set[
"file"])
175 : md5($a_set[
"entry"]);
177 if ($this->has_multi) {
179 $this->tpl->touchBlock(
'no_checkbox');
181 $this->tpl->setVariable(
"CHECKBOX_ID", $hash);
186 if ($this->label_enable) {
187 $this->tpl->setCurrentBlock(
"Label");
188 $this->tpl->setVariable(
"TXT_LABEL", $a_set[
"label"]);
189 $this->tpl->parseCurrentBlock();
192 $ilCtrl->setParameter($this->parent_obj,
"cdir", $this->cur_subdir);
195 if ($a_set[
"type"] ==
"dir") {
196 $this->tpl->setCurrentBlock(
"FileLink");
197 $ilCtrl->setParameter($this->parent_obj,
"newdir", $a_set[
"entry"]);
198 $ilCtrl->setParameter($this->parent_obj,
"resetoffset", 1);
199 $this->tpl->setVariable(
201 $ilCtrl->getLinkTarget($this->parent_obj,
"listFiles")
203 $ilCtrl->setParameter($this->parent_obj,
"newdir",
"");
204 $this->tpl->setVariable(
"TXT_FILENAME", $a_set[
"entry"]);
205 $this->tpl->parseCurrentBlock();
207 $this->tpl->setVariable(
"ICON",
"<img src=\"" .
209 $ilCtrl->setParameter($this->parent_obj,
"resetoffset",
"");
211 $this->tpl->setCurrentBlock(
"File");
212 $this->tpl->setVariable(
"TXT_FILENAME2", $a_set[
"entry"]);
213 $this->tpl->parseCurrentBlock();
216 if ($a_set[
"type"] !=
"dir") {
221 if (
sizeof($this->row_commands) &&
222 !($a_set[
"type"] ==
"dir" && $a_set[
"entry"] ==
"..")) {
225 foreach ($this->row_commands as $rcom) {
226 if ($rcom[
"allow_dir"] || $a_set[
"type"] !=
"dir") {
227 include_once(
"./Services/Utilities/classes/class.ilMimeTypeUtil.php");
229 if (($rcom[
"caption"] ==
"Unzip" &&
ilMimeTypeUtil::getMimeType($this->cur_dir . $a_set[
'entry']) ==
"application/zip") || $rcom[
"caption"] !=
"Unzip") {
230 $ilCtrl->setParameter($this->parent_obj,
"fhsh", $hash);
231 $url =
$ilCtrl->getLinkTarget($this->parent_obj, $rcom[
"cmd"]);
232 $ilCtrl->setParameter($this->parent_obj,
"fhsh",
"");
234 $advsel->addItem($rcom[
"caption"],
"",
$url);
238 $this->tpl->setVariable(
"ACTIONS", $advsel->getHTML());
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
fillRow($a_set)
Fill table row.
numericOrdering($a_field)
getOrderDirection()
Get order direction.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
static getMimeType($a_file='', $a_filename='', $a_mime='')
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
addMultiCommand($a_cmd, $a_text)
Add Command button.
isDoubleDotDirectory(array $entry)
prepareOutput()
Get data just before output.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
determineOffsetAndOrder($a_omit_offset=false)
Determine offset and order.
User interface class for advanced drop-down selection lists.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setEnableHeader($a_enableheader)
Set Enable Header.
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
setEnableTitle($a_enabletitle)
Set Enable Title.
__construct( $a_parent_obj, $a_parent_cmd, $a_cur_dir, $a_cur_subdir, $a_label_enable=false, $a_file_labels, $a_label_header="", $a_commands=array(), $a_post_dir_path=false, $a_table_id="")
Constructor.
TableGUI class for file system.