4 include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
20 function __construct($a_parent_obj, $a_parent_cmd, $a_cur_dir,
21 $a_cur_subdir, $a_label_enable =
false,
22 $a_file_labels, $a_label_header =
"", $a_commands = array(),
23 $a_post_dir_path =
false)
27 $this->cur_dir = $a_cur_dir;
28 $this->cur_subdir = $a_cur_subdir;
29 $this->label_enable = $a_label_enable;
30 $this->label_header = $a_label_header;
31 $this->file_labels = $a_file_labels;
32 $this->post_dir_path = $a_post_dir_path;
35 $this->
setTitle($lng->txt(
"cont_files").
" ".$this->cur_subdir);
40 if ($this->label_enable)
42 $this->
addColumn($lng->txt(
"cont_dir_file"),
"name",
"50%");
43 $this->
addColumn($lng->txt(
"cont_size"),
"size",
"20%");
44 $this->
addColumn($this->label_header,
"",
"30%");
48 $this->
addColumn($lng->txt(
"cont_dir_file"),
"name",
"60%");
49 $this->
addColumn($lng->txt(
"cont_size"),
"size",
"40%");
58 "Services/FileSystem");
65 for ($i=0; $i < count($a_commands); $i++)
67 if ($a_commands[
"int"])
70 $a_commands[$i][
"name"]);
81 if ($a_field ==
"size")
103 if (is_dir($this->cur_dir))
109 $entries = array(array(
"type" =>
"dir",
"entry" =>
".."));
113 foreach ($entries as $e)
115 if(($e[
"entry"] ==
".") || ($e[
"entry"] ==
".." && empty($this->cur_subdir)))
119 $cfile = (!empty($this->cur_subdir))
120 ? $this->cur_subdir.
"/".$e[
"entry"]
123 if ($this->label_enable)
125 $label = (is_array($this->file_labels[$cfile]))
126 ? implode($this->file_labels[$cfile],
", ")
130 $pref = ($e[
"type"] ==
"dir")
133 $items[] = array(
"file" => $cfile,
"entry" => $e[
"entry"],
134 "type" => $e[
"type"],
"label" => $label,
"size" => $e[
"size"],
135 "name" => $pref.$e[
"entry"]);
149 if ($a_set[
"entry"] !=
"..")
151 if ($this->post_dir_path)
153 $this->tpl->setVariable(
"CHECKBOX_ID", $a_set[
"file"]);
157 $this->tpl->setVariable(
"CHECKBOX_ID", $a_set[
"entry"]);
162 if ($this->label_enable)
164 $this->tpl->setCurrentBlock(
"Label");
165 $this->tpl->setVariable(
"TXT_LABEL", $a_set[
"label"]);
166 $this->tpl->parseCurrentBlock();
170 if($a_set[
"type"] ==
"dir")
172 $this->tpl->setCurrentBlock(
"FileLink");
173 $ilCtrl->setParameter($this->parent_obj,
"cdir", $this->cur_subdir);
174 $ilCtrl->setParameter($this->parent_obj,
"newdir", $a_set[
"entry"]);
175 $ilCtrl->setParameter($this->parent_obj,
"resetoffset", 1);
176 $this->tpl->setVariable(
"LINK_FILENAME",
177 $ilCtrl->getLinkTarget($this->parent_obj,
"listFiles"));
178 $this->tpl->setVariable(
"TXT_FILENAME", $a_set[
"entry"]);
179 $this->tpl->parseCurrentBlock();
181 $this->tpl->setVariable(
"ICON",
"<img src=\"".
183 $ilCtrl->setParameter($this->parent_obj,
"resetoffset",
"");
187 $this->tpl->setCurrentBlock(
"File");
188 $this->tpl->setVariable(
"TXT_FILENAME2", $a_set[
"entry"]);
189 $this->tpl->parseCurrentBlock();
192 $this->tpl->setVariable(
"TXT_SIZE", $a_set[
"size"]);
194 $ilCtrl->setParameter($this->parent_obj,
"cdir",
$_GET[
"cdir"]);
195 $ilCtrl->setParameter($this->parent_obj,
"newdir",
$_GET[
"newdir"]);