4 include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
22 function __construct($a_parent_obj, $a_parent_cmd, $a_cur_dir,
23 $a_cur_subdir, $a_label_enable =
false,
24 $a_file_labels, $a_label_header =
"", $a_commands =
array(),
25 $a_post_dir_path =
false, $a_table_id =
"")
29 $this->
setId($a_table_id);
30 $this->cur_dir = $a_cur_dir;
31 $this->cur_subdir = $a_cur_subdir;
32 $this->label_enable = $a_label_enable;
33 $this->label_header = $a_label_header;
34 $this->file_labels = $a_file_labels;
35 $this->post_dir_path = $a_post_dir_path;
37 parent::__construct($a_parent_obj, $a_parent_cmd);
38 $this->
setTitle($lng->txt(
"cont_files").
" ".$this->cur_subdir);
40 $this->has_multi =
false;
41 for ($i=0; $i < count($a_commands); $i++)
43 if (!$a_commands[$i][
"single"])
47 $this->has_multi =
true;
51 $this->row_commands[] =
array(
52 "cmd" =>
"extCommand_".$i,
53 "caption" => $a_commands[$i][
"name"],
54 "allow_dir" => $a_commands[$i][
"allow_dir"]
65 $this->
addColumn($lng->txt(
"cont_dir_file"),
"name");
66 $this->
addColumn($lng->txt(
"cont_size"),
"size");
68 if ($this->label_enable)
70 $this->
addColumn($this->label_header,
"label");
73 if(
sizeof($this->row_commands))
76 include_once
"Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
85 "Services/FileSystem");
91 if ($a_field ==
"size")
113 if (is_dir($this->cur_dir))
119 $entries =
array(
array(
"type" =>
"dir",
"entry" =>
".."));
123 foreach ($entries as $e)
125 if(($e[
"entry"] ==
".") || ($e[
"entry"] ==
".." && empty($this->cur_subdir)))
129 $cfile = (!empty($this->cur_subdir))
130 ? $this->cur_subdir.
"/".$e[
"entry"]
133 if ($this->label_enable)
135 $label = (is_array($this->file_labels[$cfile]))
136 ? implode($this->file_labels[$cfile],
", ")
140 $pref = ($e[
"type"] ==
"dir")
143 $items[] =
array(
"file" => $cfile,
"entry" => $e[
"entry"],
144 "type" => $e[
"type"],
"label" => $label,
"size" => $e[
"size"],
145 "name" => $pref.$e[
"entry"]);
158 return (is_array($entry) && isset($entry) && $entry[
'entry'] ===
'..');
169 $hash = $this->post_dir_path
170 ? md5($a_set[
"file"])
171 : md5($a_set[
"entry"]);
176 $this->tpl->touchBlock(
'no_checkbox');
178 $this->tpl->setVariable(
"CHECKBOX_ID", $hash);
183 if ($this->label_enable)
185 $this->tpl->setCurrentBlock(
"Label");
186 $this->tpl->setVariable(
"TXT_LABEL", $a_set[
"label"]);
187 $this->tpl->parseCurrentBlock();
190 $ilCtrl->setParameter($this->parent_obj,
"cdir", $this->cur_subdir);
193 if($a_set[
"type"] ==
"dir")
195 $this->tpl->setCurrentBlock(
"FileLink");
196 $ilCtrl->setParameter($this->parent_obj,
"newdir", $a_set[
"entry"]);
197 $ilCtrl->setParameter($this->parent_obj,
"resetoffset", 1);
198 $this->tpl->setVariable(
"LINK_FILENAME",
199 $ilCtrl->getLinkTarget($this->parent_obj,
"listFiles"));
200 $ilCtrl->setParameter($this->parent_obj,
"newdir",
"");
201 $this->tpl->setVariable(
"TXT_FILENAME", $a_set[
"entry"]);
202 $this->tpl->parseCurrentBlock();
204 $this->tpl->setVariable(
"ICON",
"<img src=\"".
206 $ilCtrl->setParameter($this->parent_obj,
"resetoffset",
"");
210 $this->tpl->setCurrentBlock(
"File");
211 $this->tpl->setVariable(
"TXT_FILENAME2", $a_set[
"entry"]);
212 $this->tpl->parseCurrentBlock();
215 if($a_set[
"type"] !=
"dir")
221 if(
sizeof($this->row_commands) &&
222 !($a_set[
"type"] ==
"dir" && $a_set[
"entry"] ==
".."))
226 foreach($this->row_commands as $rcom)
228 if($rcom[
"allow_dir"] || $a_set[
"type"] !=
"dir")
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);
237 $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 getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
__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.
addMultiCommand($a_cmd, $a_text)
Add Command button.
prepareOutput()
Get data just before output.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
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.
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.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
setEnableTitle($a_enabletitle)
Set Enable Title.
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.
isDoubleDotDirectory($entry)
TableGUI class for file system.