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())
26 $this->cur_dir = $a_cur_dir;
27 $this->cur_subdir = $a_cur_subdir;
28 $this->label_enable = $a_label_enable;
29 $this->label_header = $a_label_header;
30 $this->file_labels = $a_file_labels;
33 $this->
setTitle($lng->txt(
"cont_files").
" ".$this->cur_subdir);
38 if ($this->label_enable)
40 $this->
addColumn($lng->txt(
"cont_dir_file"),
"name",
"50%");
41 $this->
addColumn($lng->txt(
"cont_size"),
"size",
"20%");
42 $this->
addColumn($this->label_header,
"",
"30%");
46 $this->
addColumn($lng->txt(
"cont_dir_file"),
"name",
"60%");
47 $this->
addColumn($lng->txt(
"cont_size"),
"size",
"40%");
62 for ($i=0; $i < count($a_commands); $i++)
70 if ($a_field ==
"size")
92 if (is_dir($this->cur_dir))
98 $entries = array(array(
"type" =>
"dir",
"entry" =>
".."));
102 foreach ($entries as $e)
104 if(($e[
"entry"] ==
".") || ($e[
"entry"] ==
".." && empty($this->cur_subdir)))
108 $cfile = (!empty($this->cur_subdir))
109 ? $this->cur_subdir.
"/".$e[
"entry"]
112 if ($this->label_enable)
114 $label = (is_array($this->file_labels[$cfile]))
115 ? implode($this->file_labels[$cfile],
", ")
119 $pref = ($e[
"type"] ==
"dir")
122 $items[] = array(
"file" => $cfile,
"entry" => $e[
"entry"],
123 "type" => $e[
"type"],
"label" => $label,
"size" => $e[
"size"],
124 "name" => $pref.$e[
"entry"]);
139 if ($this->label_enable)
141 $this->tpl->setCurrentBlock(
"Label");
142 $this->tpl->setVariable(
"TXT_LABEL", $a_set[
"label"]);
143 $this->tpl->parseCurrentBlock();
147 if($a_set[
"type"] ==
"dir")
149 $this->tpl->setCurrentBlock(
"FileLink");
150 $ilCtrl->setParameter($this->parent_obj,
"cdir", $this->cur_subdir);
151 $ilCtrl->setParameter($this->parent_obj,
"newdir", $a_set[
"entry"]);
152 $ilCtrl->setParameter($this->parent_obj,
"resetoffset", 1);
153 $this->tpl->setVariable(
"LINK_FILENAME",
154 $ilCtrl->getLinkTarget($this->parent_obj,
"listFiles"));
155 $this->tpl->setVariable(
"TXT_FILENAME", $a_set[
"entry"]);
156 $this->tpl->parseCurrentBlock();
158 $this->tpl->setVariable(
"ICON",
"<img src=\"".
160 $ilCtrl->setParameter($this->parent_obj,
"resetoffset",
"");
164 $this->tpl->setCurrentBlock(
"File");
165 $this->tpl->setVariable(
"TXT_FILENAME2", $a_set[
"entry"]);
166 $this->tpl->parseCurrentBlock();
169 $this->tpl->setVariable(
"TXT_SIZE", $a_set[
"size"]);
170 $this->tpl->setVariable(
"CHECKBOX_ID", $a_set[
"entry"]);
172 $ilCtrl->setParameter($this->parent_obj,
"cdir",
$_GET[
"cdir"]);
173 $ilCtrl->setParameter($this->parent_obj,
"newdir",
$_GET[
"newdir"]);