ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLearningProgressGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once './Services/Tracking/classes/class.ilLearningProgressBaseGUI.php';
5 
18 {
19  function ilLearningProgressGUI($a_mode,$a_ref_id = 0,$a_user_id = 0)
20  {
21  parent::ilLearningProgressBaseGUI($a_mode,$a_ref_id,$a_user_id);
22  }
23 
27  function &executeCommand()
28  {
29  global $ilBench, $ilHelp;
30 
31  $ilBench->start('LearningProgress','0000_Start');
32 
33 
34  $this->ctrl->setReturn($this, "");
35 
36  // E.g personal desktop mode needs locator header icon ...
37  $this->__buildHeader();
38  switch($this->__getNextClass())
39  {
40  case 'illplistofprogressgui':
41  include_once 'Services/Tracking/classes/class.ilLPListOfProgressGUI.php';
42 
43  $ilHelp->setScreenIdComponent("lp");
44 
46  $this->__setCmdClass('illplistofprogressgui');
47  $lop_gui = new ilLPListOfProgressGUI($this->getMode(),$this->getRefId(),$this->getUserId());
48  $this->ctrl->forwardCommand($lop_gui);
49  break;
50 
51  case 'illplistofobjectsgui':
52  include_once 'Services/Tracking/classes/class.ilLPListOfObjectsGUI.php';
53  if(stristr($this->ctrl->getCmd(), "matrix"))
54  {
55  $this->__setSubTabs(LP_ACTIVE_MATRIX);
56  }
57  else if(stristr($this->ctrl->getCmd(), "summary"))
58  {
60  }
61  else
62  {
64  }
65  $loo_gui = new ilLPListOfObjectsGUI($this->getMode(),$this->getRefId());
66  $this->__setCmdClass('illplistofobjectsgui');
67  $this->ctrl->forwardCommand($loo_gui);
68  break;
69 
70  case 'illplistofsettingsgui':
71  include_once 'Services/Tracking/classes/class.ilLPListOfSettingsGUI.php';
72 
74  $los_gui = new ilLPListOfSettingsGUI($this->getMode(),$this->getRefId());
75  $this->__setCmdClass('illplistofsettingsgui');
76  $this->ctrl->forwardCommand($los_gui);
77  break;
78 
79  case 'illmstatisticsgui':
80  include_once 'Services/Tracking/classes/class.ilLMStatisticsGUI.php';
81 
83  $los_gui = new ilLMStatisticsGUI($this->getMode(),$this->getRefId());
84  $this->__setCmdClass('illmstatisticsgui');
85  $this->ctrl->forwardCommand($los_gui);
86  break;
87 
88  case 'illpobjectstatisticsgui':
89  include_once 'Services/Tracking/classes/class.ilLPObjectStatisticsGUI.php';
90  if(stristr($this->ctrl->getCmd(), "access"))
91  {
93  }
94  else if(stristr($this->ctrl->getCmd(), "types"))
95  {
97  }
98  else if(stristr($this->ctrl->getCmd(), "daily"))
99  {
101  }
102  else
103  {
105  }
106  $this->__setCmdClass('illpobjectstatisticsgui');
107  $ost_gui = new ilLPObjectStatisticsGUI($this->getMode(),$this->getRefId());
108  $this->ctrl->forwardCommand($ost_gui);
109  break;
110 
111  default:
112  die("No mode given");
113  }
114 
115  // E.G personal desktop mode needs $tpl->show();
116  $this->__buildFooter();
117 
118 
119  $ilBench->stop('LearningProgress','0000_Start');
120 
121  return true;
122  }
123 
124  function __setCmdClass($a_class)
125  {
126  // If cmd class == 'illearningprogressgui' the cmd class is set to the the new forwarded class
127  // otherwise e.g illplistofprogressgui tries to forward (back) to illearningprogressgui.
128 
129  if($this->ctrl->getCmdClass() == strtolower(get_class($this)))
130  {
131  $this->ctrl->setCmdClass(strtolower($a_class));
132  }
133  return true;
134  }
135 
136  function __getNextClass()
137  {
138  global $ilAccess, $ilUser;
139 
140  // #9857
142  {
143  return;
144  }
145 
146  if(strlen($next_class = $this->ctrl->getNextClass()))
147  {
148  if($this->getMode() == LP_MODE_PERSONAL_DESKTOP)
149  {
150  $_SESSION['il_lp_history'] = $next_class;
151  }
152  return $next_class;
153  }
154  switch($this->getMode())
155  {
157  return 'illplistofobjectsgui';
158 
159  case LP_MODE_REPOSITORY:
160  // #12771 - do not show status if learning progress is deactivated
161  include_once './Services/Tracking/classes/class.ilLPObjSettings.php';
163  if($mode == LP_MODE_DEACTIVATED || $mode == LP_MODE_LP_MODE_UNDEFINED)
164  {
165  return 'illplistofsettingsgui';
166  }
167 
168  if(!$this->anonymized and
169  !$this->isObjectAnonymized() and
170  $ilAccess->checkAccess('edit_learning_progress','',$this->getRefId()))
171  {
172  return 'illplistofobjectsgui';
173  }
174  return 'illplistofprogressgui';
175 
177 
178  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
181 
182  if($has_edit || $has_personal)
183  {
184  // default (#10928)
185  $tgt = null;
186  if($has_personal)
187  {
188  $tgt = 'illplistofprogressgui';
189  }
190  else if($has_edit)
191  {
192  $tgt = 'illplistofobjectsgui';
193  }
194 
195  // validate session
196  switch($_SESSION['il_lp_history'])
197  {
198  case 'illplistofobjectsgui':
199  if(!$has_edit)
200  {
201  $_SESSION['il_lp_history'] = null;
202  }
203  break;
204 
205  case 'illplistofprogressgui':
206  if(!$has_personal)
207  {
208  $_SESSION['il_lp_history'] = null;
209  }
210  break;
211  }
212 
213  if($_SESSION['il_lp_history'])
214  {
215  return $_SESSION['il_lp_history'];
216  }
217  else if($tgt)
218  {
219  return $tgt;
220  }
221  }
222 
223  // should not happen
224  ilUtil::redirect("ilias.php?baseClass=ilPersonalDesktopGUI");
225 
226  case LP_MODE_USER_FOLDER:
228  {
229  return 'illplistofprogressgui';
230  }
231  }
232  }
233 }
234 ?>