ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLPObjectStatisticsGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once "Services/Tracking/classes/class.ilLearningProgressBaseGUI.php";
6 
20 {
21  function ilLPObjectStatisticsGUI($a_mode,$a_ref_id = 0)
22  {
23  parent::ilLearningProgressBaseGUI($a_mode,$a_ref_id);
24  }
25 
26  protected function setTabs()
27  {
28  $this->tabs_gui->addSubTab('trac_object_stat_access',
29  $this->lng->txt('trac_object_stat_access'),
30  $this->ctrl->getLinkTarget($this, 'access'));
31  $this->tabs_gui->addSubTab('trac_object_stat_daily',
32  $this->lng->txt('trac_object_stat_daily'),
33  $this->ctrl->getLinkTarget($this, 'daily'));
34  $this->tabs_gui->addSubTab('trac_object_stat_types',
35  $this->lng->txt('trac_object_stat_types'),
36  $this->ctrl->getLinkTarget($this, 'types'));
37  $this->tabs_gui->addSubTab('trac_object_stat_admin',
38  $this->lng->txt('trac_object_stat_admin'),
39  $this->ctrl->getLinkTarget($this, 'admin'));
40  }
41 
45  function executeCommand()
46  {
47  $this->ctrl->setReturn($this, "");
48 
49  $this->setTabs();
50 
51  switch($this->ctrl->getNextClass())
52  {
53  default:
54  $cmd = $this->__getDefaultCommand();
55  $this->$cmd();
56  }
57 
58  return true;
59  }
60 
61  function applyAccessFilter()
62  {
63  include_once("./Services/Tracking/classes/class.ilLPObjectStatisticsTableGUI.php");
64  $lp_table = new ilLPObjectStatisticsTableGUI($this, "access", null, false);
65  $lp_table->resetOffset();
66  $lp_table->writeFilterToSession();
67  $this->access();
68  }
69 
70  function resetAccessFilter()
71  {
72  include_once("./Services/Tracking/classes/class.ilLPObjectStatisticsTableGUI.php");
73  $lp_table = new ilLPObjectStatisticsTableGUI($this, "access", null, false);
74  $lp_table->resetOffset();
75  $lp_table->resetFilter();
76  $this->access();
77  }
78 
79  function access()
80  {
81  global $tpl;
82 
83  $this->tabs_gui->activateSubTab('trac_object_stat_access');
84 
85  include_once("./Services/Tracking/classes/class.ilLPObjectStatisticsTableGUI.php");
86  $lp_table = new ilLPObjectStatisticsTableGUI($this, "access");
87 
88  $tpl->setContent($lp_table->getHTML());
89  }
90 
91  function showAccessGraph()
92  {
93  global $lng, $tpl;
94 
95  if(!$_POST["item_id"])
96  {
97  ilUtil::sendFailure($lng->txt("no_checkbox"));
98  return $this->access();
99  }
100 
101  $this->tabs_gui->activateSubTab('trac_object_stat_access');
102 
103  include_once("./Services/Tracking/classes/class.ilLPObjectStatisticsTableGUI.php");
104  $lp_table = new ilLPObjectStatisticsTableGUI($this, "access", $_POST["item_id"]);
105 
106  $tpl->setContent($lp_table->getGraph($_POST["item_id"]).$lp_table->getHTML());
107  }
108 
109  function applyTypesFilter()
110  {
111  include_once("./Services/Tracking/classes/class.ilLPObjectStatisticsTypesTableGUI.php");
112  $lp_table = new ilLPObjectStatisticsTypesTableGUI($this, "types", null, false);
113  $lp_table->resetOffset();
114  $lp_table->writeFilterToSession();
115  $this->types();
116  }
117 
118  function resetTypesFilter()
119  {
120  include_once("./Services/Tracking/classes/class.ilLPObjectStatisticsTypesTableGUI.php");
121  $lp_table = new ilLPObjectStatisticsTypesTableGUI($this, "types", null, false);
122  $lp_table->resetOffset();
123  $lp_table->resetFilter();
124  $this->types();
125  }
126 
127  function types()
128  {
129  global $tpl;
130 
131  $this->tabs_gui->activateSubTab('trac_object_stat_types');
132 
133  include_once("./Services/Tracking/classes/class.ilLPObjectStatisticsTypesTableGUI.php");
134  $lp_table = new ilLPObjectStatisticsTypesTableGUI($this, "types");
135 
136  $tpl->setContent($lp_table->getHTML());
137  }
138 
139  function showTypesGraph()
140  {
141  global $lng, $tpl;
142 
143  if(!$_POST["item_id"])
144  {
145  ilUtil::sendFailure($lng->txt("no_checkbox"));
146  return $this->types();
147  }
148 
149  $this->tabs_gui->activateSubTab('trac_object_stat_types');
150 
151  include_once("./Services/Tracking/classes/class.ilLPObjectStatisticsTypesTableGUI.php");
152  $lp_table = new ilLPObjectStatisticsTypesTableGUI($this, "types", $_POST["item_id"]);
153 
154  $tpl->setContent($lp_table->getGraph($_POST["item_id"]).$lp_table->getHTML());
155  }
156 
157  function applyDailyFilter()
158  {
159  include_once("./Services/Tracking/classes/class.ilLPObjectStatisticsDailyTableGUI.php");
160  $lp_table = new ilLPObjectStatisticsDailyTableGUI($this, "daily", null, false);
161  $lp_table->resetOffset();
162  $lp_table->writeFilterToSession();
163  $this->daily();
164  }
165 
166  function resetDailyFilter()
167  {
168  include_once("./Services/Tracking/classes/class.ilLPObjectStatisticsDailyTableGUI.php");
169  $lp_table = new ilLPObjectStatisticsDailyTableGUI($this, "daily", null, false);
170  $lp_table->resetOffset();
171  $lp_table->resetFilter();
172  $this->daily();
173  }
174 
175  function daily()
176  {
177  global $tpl;
178 
179  $this->tabs_gui->activateSubTab('trac_object_stat_daily');
180 
181  include_once("./Services/Tracking/classes/class.ilLPObjectStatisticsDailyTableGUI.php");
182  $lp_table = new ilLPObjectStatisticsDailyTableGUI($this, "daily");
183 
184  $tpl->setContent($lp_table->getHTML());
185  }
186 
187  function showDailyGraph()
188  {
189  global $lng, $tpl;
190 
191  if(!$_POST["item_id"])
192  {
193  ilUtil::sendFailure($lng->txt("no_checkbox"));
194  return $this->daily();
195  }
196 
197  $this->tabs_gui->activateSubTab('trac_object_stat_daily');
198 
199  include_once("./Services/Tracking/classes/class.ilLPObjectStatisticsDailyTableGUI.php");
200  $lp_table = new ilLPObjectStatisticsDailyTableGUI($this, "daily", $_POST["item_id"]);
201 
202  $tpl->setContent($lp_table->getGraph($_POST["item_id"]).$lp_table->getHTML());
203  }
204 
205  function admin()
206  {
207  global $tpl, $ilToolbar, $lng, $ilCtrl;
208 
209  $this->tabs_gui->activateSubTab('trac_object_stat_admin');
210 
211  $ilToolbar->addButton($lng->txt("trac_sync_obj_stats"),
212  $ilCtrl->getLinkTarget($this, "adminSync"));
213 
214  include_once("./Services/Tracking/classes/class.ilLPObjectStatisticsAdminTableGUI.php");
215  $lp_table = new ilLPObjectStatisticsAdminTableGUI($this, "admin");
216 
217  $tpl->setContent($lp_table->getHTML());
218  }
219 
220  function adminSync()
221  {
222  global $ilCtrl, $lng;
223 
224  include_once "Services/Tracking/classes/class.ilChangeEvent.php";
226 
227  ilUtil::sendSuccess($lng->txt("trac_sync_obj_stats_success"), true);
228  $ilCtrl->redirect($this, "admin");
229  }
230 
231  function confirmDeleteData()
232  {
233  global $lng, $tpl, $ilTabs, $ilCtrl;
234 
235  if(!$_POST["item_id"])
236  {
237  ilUtil::sendFailure($lng->txt("no_checkbox"));
238  return $this->admin();
239  }
240 
241  $ilTabs->setBackTarget($lng->txt("back"),
242  $ilCtrl->getLinkTarget($this, "admin"));
243 
244  // display confirmation message
245  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
246  $cgui = new ilConfirmationGUI();
247  $cgui->setFormAction($ilCtrl->getFormAction($this));
248  $cgui->setHeaderText($lng->txt("trac_sure_delete_data"));
249  $cgui->setCancel($lng->txt("cancel"), "admin");
250  $cgui->setConfirm($lng->txt("delete"), "deleteData");
251 
252  // list objects that should be deleted
253  foreach ($_POST["item_id"] as $i)
254  {
255  $caption = $lng->txt("month_".str_pad(substr($i, 5), 2, "0", STR_PAD_LEFT)."_long").
256  " ".substr($i, 0, 4);
257 
258  $cgui->addItem("item_id[]", $i, $caption);
259  }
260 
261  $tpl->setContent($cgui->getHTML());
262  }
263 
264  function deleteData()
265  {
266  global $lng;
267 
268  if(!$_POST["item_id"])
269  {
270  ilUtil::sendFailure($lng->txt("no_checkbox"));
271  return $this->admin();
272  }
273 
274  include_once "Services/Tracking/classes/class.ilTrQuery.php";
276  ilUtil::sendSuccess($lng->txt("trac_data_deleted"));
277  $this->admin();
278  }
279 }
280 
281 ?>