ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLPObjectsTableGUI.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/Tracking/classes/class.ilLPTableBaseGUI.php");
5 
16 {
20  function __construct($a_parent_obj, $a_parent_cmd, $a_type = "")
21  {
22  global $ilCtrl, $lng, $ilAccess, $lng;
23 
24  $this->setId("lpobjtbl");
25 
26  parent::__construct($a_parent_obj, $a_parent_cmd);
27  $this->setTitle($this->lng->txt("learning_progress"));
28  $this->setDescription($this->lng->txt("trac_learning_progress_objects_description"));
29  $this->setLimit(ilSearchSettings::getInstance()->getMaxHits());
30  $this->setLimit(9999);
31 
32  $this->addColumn("", "", "1", true);
33  $this->addColumn($this->lng->txt("trac_title"), "title", "30%");
34 
35  include_once("Services/Tracking/classes/class.ilLPStatus.php");
36  $all_status = array(LP_STATUS_NOT_ATTEMPTED_NUM => "status_not_attempted",
37  LP_STATUS_IN_PROGRESS_NUM => "status_in_progress",
38  LP_STATUS_COMPLETED_NUM => "status_completed",
39  LP_STATUS_FAILED_NUM => "status_failed");
40  foreach($all_status as $status => $column)
41  {
43  $caption = "<img src=\"".ilLearningProgressBaseGUI::_getImagePathForStatus($status)."\" alt=\"".$caption."\" title=\"".$caption."\" /> ".$caption;
44 
45  $this->addColumn($caption, $column, "10%");
46  }
47 
48  $this->addColumn($this->lng->txt("path"), "", "20%");
49  $this->addColumn($this->lng->txt("actions"), "", "10%");
50 
51  $this->setEnableHeader(true);
52  $this->setFormAction($ilCtrl->getFormActionByClass(get_class($this)));
53  $this->setRowTemplate("tpl.lp_object_list_row.html", "Services/Tracking");
54  #$this->disable("footer");
55  $this->setEnableHeader(true);
56  $this->setEnableNumInfo(true);
57  $this->setEnableTitle(true);
58  $this->setShowTemplates(true);
59 
60  $this->initFilter();
61 
62  $this->setSelectAllCheckbox("item_id");
63 
64  $this->addMultiCommand("hideSelected", $lng->txt("trac_hide_selected"));
65 
66  $this->setExportFormats(array(self::EXPORT_CSV, self::EXPORT_EXCEL));
67 
68  $this->getItems();
69  }
70 
71  function getItems()
72  {
73  $obj_ids = $this->obj_ids;
74  if(!$obj_ids)
75  {
76  $obj_ids = $this->searchObjects($this->getCurrentFilter(true), "edit_learning_progress");
77  }
78  if($obj_ids)
79  {
80  $this->is_anonymized = !ilObjUserTracking::_enabledUserRelatedData();
81 
82  include_once("./Services/Tracking/classes/class.ilTrQuery.php");
84  $this->setData($data);
85  }
86  }
87 
91  protected function fillRow($a_set)
92  {
93  global $lng, $ilObjDataCache, $ilCtrl;
94 
95  $this->tpl->setVariable("OBJ_ID", $a_set["obj_id"]);
96  $this->tpl->setVariable("ICON_SRC", ilUtil::getTypeIconPath($a_set["type"], $a_set["obj_id"], "tiny"));
97  $this->tpl->setVariable("ICON_ALT", $lng->txt($a_set["type"]));
98  $this->tpl->setVariable("TITLE_TEXT", $a_set["title"]);
99 
100  $this->tpl->setVariable("STATUS_NOT_ATTEMPTED_VALUE", $a_set["status_not_attempted"]);
101  $this->tpl->setVariable("STATUS_IN_PROGRESS_VALUE", $a_set["status_in_progress"]);
102  $this->tpl->setVariable("STATUS_COMPLETED_VALUE", $a_set["status_completed"]);
103  $this->tpl->setVariable("STATUS_FAILED_VALUE", $a_set["status_failed"]);
104 
105  // path
106  $path = $this->buildPath($a_set["ref_ids"]);
107  if($path)
108  {
109  $this->tpl->setCurrentBlock("item_path");
110  foreach($path as $path_item)
111  {
112  $this->tpl->setVariable("PATH_ITEM", $path_item);
113  $this->tpl->parseCurrentBlock();
114  }
115  }
116 
117  // hide / unhide?!
118  $this->tpl->setCurrentBlock("item_command");
119  $ilCtrl->setParameterByClass(get_class($this),'hide', $a_set["obj_id"]);
120  $this->tpl->setVariable("HREF_COMMAND", $ilCtrl->getLinkTargetByClass(get_class($this),'hide'));
121  $this->tpl->setVariable("TXT_COMMAND", $lng->txt('trac_hide'));
122  $this->tpl->parseCurrentBlock();
123 
124  if(!$this->is_anonymized)
125  {
126  $ref_id = $a_set["ref_ids"];
127  $ref_id = array_shift($ref_id);
128  $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(), 'details_id', $ref_id);
129  $this->tpl->setVariable("HREF_COMMAND", $ilCtrl->getLinkTargetByClass($ilCtrl->getCmdClass(), 'details'));
130  $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(), 'details_id', '');
131  $this->tpl->setVariable("TXT_COMMAND", $lng->txt('trac_participants'));
132  $this->tpl->parseCurrentBlock();
133  }
134  }
135 
136  protected function fillHeaderExcel($worksheet, &$a_row)
137  {
138  $worksheet->write($a_row, 0, $this->lng->txt("type"));
139  $worksheet->write($a_row, 1, $this->lng->txt("trac_title"));
144  // $worksheet->write($a_row, 6, $this->lng->txt("path"));
145  }
146 
147  protected function fillRowExcel($worksheet, &$a_row, $a_set)
148  {
149  $worksheet->write($a_row, 0, $this->lng->txt($a_set["type"]));
150  $worksheet->write($a_row, 1, $a_set["title"]);
151  $worksheet->write($a_row, 2, $a_set["status_not_attempted"]);
152  $worksheet->write($a_row, 3, $a_set["status_in_progress"]);
153  $worksheet->write($a_row, 4, $a_set["status_completed"]);
154  $worksheet->write($a_row, 5, $a_set["status_failed"]);
155 
156  /*
157  // path
158  $path = $this->buildPath($a_set["ref_ids"]);
159  if($path)
160  {
161  $col = 6;
162  foreach($path as $path_item)
163  {
164  $worksheet->write($a_row, $col, strip_tags($path_item));
165  $col++;
166  }
167  }
168  */
169 
170  }
171 
172  protected function fillHeaderCSV($a_csv)
173  {
174  $a_csv->addColumn($this->lng->txt("type"));
175  $a_csv->addColumn($this->lng->txt("trac_title"));
180  // $a_csv->addColumn($this->lng->txt("path"));
181  $a_csv->addRow();
182  }
183 
184  protected function fillRowCSV($a_csv, $a_set)
185  {
186  $a_csv->addColumn($this->lng->txt($a_set["type"]));
187  $a_csv->addColumn($a_set["title"]);
188  $a_csv->addColumn($a_set["status_not_attempted"]);
189  $a_csv->addColumn($a_set["status_in_progress"]);
190  $a_csv->addColumn($a_set["status_completed"]);
191  $a_csv->addColumn($a_set["status_failed"]);
192 
193  /*
194  // path
195  $path = $this->buildPath($a_set["ref_ids"]);
196  if($path)
197  {
198  $col = 6;
199  foreach($path as $path_item)
200  {
201  $a_csv->addColumn(strip_tags($path_item));
202  $col++;
203  }
204  }
205  */
206 
207  $a_csv->addRow();
208  }
209 }
210 
211 ?>