ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilUploadDirFilesTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Table/classes/class.ilTable2GUI.php");
5 
15 {
16 
20  function __construct($a_parent_obj, $a_parent_cmd, $a_files)
21  {
22  global $ilCtrl, $lng, $ilAccess, $lng;
23 
24  $mset = new ilSetting("mobs");
25  $this->upload_dir = trim($mset->get("upload_dir"));
26 
27 //var_dump($_POST);
28  parent::__construct($a_parent_obj, $a_parent_cmd);
29  $this->setData($this->getFiles($a_files));
30  $this->setTitle($lng->txt("mep_upload_dir_files"));
31  $this->setLimit(9999);
32 
33  $this->addColumn("", "", "1", true);
34  $this->addColumn($this->lng->txt("mep_file"));
35  $this->setOpenFormTag(false);
36 
37  $this->setEnableHeader(true);
38  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
39  $this->setRowTemplate("tpl.upload_dir_files_row.html", "Modules/MediaPool");
40  $this->disable("footer");
41  $this->setEnableTitle(true);
42  $this->setSelectAllCheckbox("file[]");
43 
44  $this->addMultiCommand("createMediaFromUploadDir", $lng->txt("mep_create_media_files"));
45  //$this->addCommandButton("", $lng->txt(""));
46  }
47 
51  function getFiles($a_files)
52  {
53  $files = array();
54  foreach ($a_files as $f)
55  {
56  if (is_file($this->upload_dir."/".$f))
57  {
58  $files[] = $f;
59  }
60  else if (is_dir($this->upload_dir."/".$f))
61  {
62  $dir = ilUtil::getDir($this->upload_dir."/".$f, true);
63  foreach ($dir as $d)
64  {
65  if ($d["type"] == "file")
66  {
67  $files[] = $f.$d["subdir"]."/".$d["entry"];
68  }
69  }
70  }
71  }
72 
73  return $files;
74  }
75 
79  protected function fillRow($a_set)
80  {
81  global $lng;
82 
83  $this->tpl->setVariable("TXT_FILE", $a_set);
84  $this->tpl->setVariable("VAL_FILE", $a_set);
85  }
86 
87 }
88 ?>