ILIAS  eassessment Revision 61809
 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-2009 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 
92  $types = array();
93  foreach ($this->parent_obj->getFormats() as $f)
94  {
95  $types[] = $f["key"];
96  }
97  include_once("./Services/Export/classes/class.ilExport.php");
98  $files = ilExport::_getExportFiles($this->obj->getId(),
99  $types, $this->obj->getType());
100  return $files;
101  }
102 
106  protected function fillRow($a_set)
107  {
108  global $lng;
109 
110  foreach ($this->getCustomColumns() as $c)
111  {
112  $this->tpl->setCurrentBlock("custom");
113  $this->tpl->setVariable("VAL_CUSTOM",
114  $c["obj"]->$c["func"]($a_set["type"], $a_set["file"])." ");
115  $this->tpl->parseCurrentBlock();
116  }
117 
118  $this->tpl->setVariable("VAL_ID", $a_set["type"].":".$a_set["file"]);
119  $this->tpl->setVariable("VAL_TYPE", $a_set["type"]);
120  $this->tpl->setVariable("VAL_FILE", $a_set["file"]);
121  $this->tpl->setVariable("VAL_SIZE", $a_set["size"]);
122  $this->tpl->setVariable("VAL_DATE",
123  ilDatePresentation::formatDate(new ilDateTime($a_set["timestamp"],IL_CAL_UNIX)));
124 
125  }
126 
127 }
128 
129 ?>