ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilExportTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Table/classes/class.ilTable2GUI.php");
5 
15 {
16  protected $custom_columns = array();
17 
21  function __construct($a_parent_obj, $a_parent_cmd, $a_exp_obj)
22  {
23  global $ilCtrl, $lng, $ilAccess, $lng;
24 
25  $this->obj = $a_exp_obj;
26 
27  parent::__construct($a_parent_obj, $a_parent_cmd);
28  $this->setData($this->getExportFiles());
29  $this->setTitle($lng->txt("exp_export_files"));
30 
31  $this->addColumn($this->lng->txt(""), "", "1", true);
32  $this->addColumn($this->lng->txt("type"), "type");
33  $this->addColumn($this->lng->txt("file"), "file");
34  $this->addColumn($this->lng->txt("size"), "size");
35  $this->addColumn($this->lng->txt("date"), "timestamp");
36 
37  $this->setDefaultOrderField("timestamp");
38  $this->setDefaultOrderDirection("desc");
39 
40  $this->setEnableHeader(true);
41  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
42  $this->setRowTemplate("tpl.export_table_row.html", "Services/Export");
43  //$this->disable("footer");
44  //$this->setEnableTitle(true);
45 
46  $this->addMultiCommand("download", $lng->txt("download"));
47  $this->addMultiCommand("confirmDeletion", $lng->txt("delete"));
48  }
49 
56  function addCustomColumn($a_txt, $a_obj, $a_func)
57  {
58  $this->addColumn($a_txt);
59  $this->custom_columns[] = array("txt" => $a_txt,
60  "obj" => $a_obj,
61  "func" => $a_func);
62  }
63 
70  function addCustomMultiCommand($a_txt, $a_cmd)
71  {
72  $this->addMultiCommand($a_cmd, $a_txt);
73  }
74 
81  function getCustomColumns()
82  {
83  return $this->custom_columns;
84  }
85 
89  function getExportFiles()
90  {
91  $types = array();
92  foreach ($this->parent_obj->getFormats() as $f)
93  {
94  $types[] = $f["key"];
95  }
96  include_once("./Services/Export/classes/class.ilExport.php");
97  $files = ilExport::_getExportFiles($this->obj->getId(),
98  $types, $this->obj->getType());
99  return $files;
100  }
101 
105  protected function fillRow($a_set)
106  {
107  global $lng;
108 
109  foreach ($this->getCustomColumns() as $c)
110  {
111  $this->tpl->setCurrentBlock("custom");
112  $this->tpl->setVariable("VAL_CUSTOM",
113  $c["obj"]->$c["func"]($a_set["type"], $a_set["file"])." ");
114  $this->tpl->parseCurrentBlock();
115  }
116 
117  $this->tpl->setVariable("VAL_ID", $a_set["type"].":".$a_set["file"]);
118  $this->tpl->setVariable("VAL_TYPE", $a_set["type"]);
119  $this->tpl->setVariable("VAL_FILE", $a_set["file"]);
120  $this->tpl->setVariable("VAL_SIZE", $a_set["size"]);
121  $this->tpl->setVariable("VAL_DATE",
122  ilDatePresentation::formatDate(new ilDateTime($a_set["timestamp"],IL_CAL_UNIX)));
123 
124  }
125 
126 }
127 
128 ?>