ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLPListOfProgressGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
17 include_once './Services/Tracking/classes/class.ilLearningProgressBaseGUI.php';
18 include_once './Services/Tracking/classes/class.ilLPStatusWrapper.php';
19 
21 {
22  var $tracked_user = null;
23  var $details_id = 0;
24  var $details_type = '';
25  var $details_mode = 0;
26 
27  function ilLPListOfProgressGUI($a_mode,$a_ref_id,$a_user_id = 0)
28  {
29  parent::ilLearningProgressBaseGUI($a_mode,$a_ref_id,$a_user_id);
30  // $this->__checkPDF();
31 
32  $this->__initUser($a_user_id);
33 
34  // Set item id for details
35  $this->__initDetails((int) $_GET['details_id']);
36  $this->ctrl->saveParameter($this,'details_id',$_REQUEST['details_id']);
37  }
38 
39 
43  function &executeCommand()
44  {
45  global $ilUser;
46 
47  $this->ctrl->setReturn($this, "show");
48  $this->ctrl->saveParameter($this,'user_id',$this->getUserId());
49  switch($this->ctrl->getNextClass())
50  {
51  case 'illpprogresstablegui':
52  include_once './Services/Tracking/classes/class.ilLPProgressTableGUI.php';
53  $table_gui = new ilLPProgressTableGUI($this, "", $this->tracked_user);
54  $this->ctrl->setReturn($this,'show');
55  $this->ctrl->forwardCommand($table_gui);
56  break;
57 
58  /*
59  case 'ilpdfpresentation':
60  include_once './Services/Tracking/classes/class.ilPDFPresentation.php';
61  $pdf_gui = new ilPDFPresentation($this->getMode(),$this->details_id,$this->getUserId(),$this->tracked_user->getId());
62  $pdf_gui->setType(LP_ACTIVE_PROGRESS);
63  $this->ctrl->setReturn($this,'show');
64  $this->ctrl->forwardCommand($pdf_gui);
65  break;
66  */
67 
68  default:
69  $cmd = $this->__getDefaultCommand();
70  $this->$cmd();
71 
72  }
73  return true;
74  }
75 
76  function show()
77  {
78  global $ilObjDataCache;
79 
80  switch($this->getMode())
81  {
82  // Show only detail of current repository item if called from repository
83  case LP_MODE_REPOSITORY:
84  $this->__initDetails($this->getRefId());
85  return $this->details();
86 
88  // if called from user folder obj_id is id of current user
89  $this->__initUser($this->getUserId());
90  break;
91  }
92 
93  // not called from repository
94  $this->__showProgressList();
95  }
96 
97  function details()
98  {
99  global $ilObjDataCache, $ilCtrl, $rbacsystem;
100 
101  // Show back button to crs if called from crs. Otherwise if called from personal desktop or administration
102  // show back to list
103  if((int)$_GET['crs_id'])
104  {
105  $this->ctrl->setParameter($this,'details_id',(int) $_GET['crs_id']);
106  $this->__showButton($this->ctrl->getLinkTarget($this,'details'),$this->lng->txt('trac_view_crs'));
107  }
108  elseif($this->getMode() == LP_MODE_PERSONAL_DESKTOP or
109  $this->getMode() == LP_MODE_ADMINISTRATION or
110  $this->getMode() == LP_MODE_USER_FOLDER)
111  {
112  $this->__showButton($this->ctrl->getLinkTarget($this,'show'),$this->lng->txt('trac_view_list'));
113  }
114 
115  /*
116  if($this->activePDF())
117  {
118  $this->__showButton($this->ctrl->getLinkTargetByClass('ilpdfpresentation','createDetails'),$this->lng->txt('pdf_export'));
119  }
120  */
121 
122  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.lp_progress_container.html','Services/Tracking');
123 
124  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
125  $info = new ilInfoScreenGUI($this);
126  $info->setFormAction($ilCtrl->getFormAction($this));
127  $this->__appendUserInfo($info, $this->tracked_user);
128  $this->__showObjectDetails($info,$this->details_obj_id);
129  $this->__appendLPDetails($info,$this->details_obj_id,$this->tracked_user->getId());
130 
131  // Finally set template variable
132  $this->tpl->setVariable("LM_INFO",$info->getHTML());
133 
134  include_once './Services/Tracking/classes/class.ilLPCollectionCache.php';
135  $obj_ids = array();
136  foreach(ilLPCollectionCache::_getItems($this->details_obj_id) as $ref_id)
137  {
138  switch($this->details_mode)
139  {
140  case LP_MODE_SCORM:
141  case LP_MODE_OBJECTIVES:
142  $obj_ids[] = $ref_id;
143  break;
144 
145  default:
146  $obj_ids[ilObject::_lookupObjectId($ref_id)] = array($ref_id);
147  break;
148  }
149  }
150 
151  $personal_only = !$rbacsystem->checkAccess('edit_learning_progress',$this->getRefId());
152 
153  include_once("./Services/Tracking/classes/class.ilLPProgressTableGUI.php");
154  $lp_table = new ilLPProgressTableGUI($this, "details", $this->tracked_user, $obj_ids, true, $this->details_mode, $personal_only, $this->details_obj_id);
155  $this->tpl->setVariable("LP_OBJECTS", $lp_table->getHTML());
156 
157  $this->tpl->setVariable("LEGEND",$this->__getLegendHTML());
158  }
159 
161  {
162  global $ilUser,$ilObjDataCache,$ilCtrl;
163 
164  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.lp_list_progress.html','Services/Tracking');
165 
166  // User info
167  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
168  $info = new ilInfoScreenGUI($this);
169  $info->setFormAction($ilCtrl->getFormAction($this));
170 
171  if ($this->__appendUserInfo($info, $this->tracked_user))
172  {
173  $this->tpl->setCurrentBlock("info_user");
174  $this->tpl->setVariable("USER_INFO",$info->getHTML());
175  $this->tpl->parseCurrentBlock();
176  }
177 
178  /*
179  if($this->activePDF())
180  {
181  $this->__showButton($this->ctrl->getLinkTargetByClass('ilpdfpresentation','createList'),$this->lng->txt('pdf_export'));
182  }
183  */
184 
185  /*
186  // Output filter limit info
187  if($this->filter->limitReached())
188  {
189  $info = sprintf($this->lng->txt('trac_filter_limit_reached'),$this->filter->getLimit());
190  $tpl->setVariable("LIMIT_REACHED",$info);
191  }
192  */
193 
194  include_once("./Services/Tracking/classes/class.ilLPProgressTableGUI.php");
195  $lp_table = new ilLPProgressTableGUI($this, "", $this->tracked_user);
196  $this->tpl->setVariable("LP_OBJECTS", $lp_table->getHTML());
197 
198  $this->tpl->setVariable("LEGEND", $this->__getLegendHTML());
199  }
200 
201  function __initUser($a_usr_id = 0)
202  {
203  global $ilUser,$rbacreview;
204 
205  if($_POST['user_id'])
206  {
207  $a_usr_id = $_POST['user_id'];
208  $this->ctrl->setParameter($this,'user_id',$_POST['user_id']);
209  }
210 
211  if($a_usr_id)
212  {
213  $this->tracked_user = ilObjectFactory::getInstanceByObjId($a_usr_id);
214  }
215  else
216  {
217  $this->tracked_user = $ilUser;
218  }
219 
220  // Check access
221  if(!$rbacreview->isAssigned($ilUser->getId(),SYSTEM_ROLE_ID))
222  {
223  $this->tracked_user = $ilUser;
224  }
225 
226  return true;
227  }
228 
229  function __initDetails($a_details_id)
230  {
231  global $ilObjDataCache;
232 
233  if(!$a_details_id)
234  {
235  $a_details_id = $this->getRefId();
236  }
237  if($a_details_id)
238  {
239  $ref_ids = ilObject::_getAllReferences($a_details_id);
240 
241  $this->details_id = $a_details_id;
242  $this->details_obj_id = $ilObjDataCache->lookupObjId($this->details_id);
243  $this->details_type = $ilObjDataCache->lookupType($this->details_obj_id);
244  $this->details_mode = ilLPObjSettings::_lookupMode($this->details_obj_id);
245  }
246  }
247 }
248 
249 ?>