ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 require_once './Modules/OrgUnit/classes/class.ilObjOrgUnitAccess.php';
20 
22 {
23  var $tracked_user = null;
24  var $details_id = 0;
25  var $details_type = '';
26  var $details_mode = 0;
27 
28  function __construct($a_mode,$a_ref_id,$a_user_id = 0)
29  {
30  parent::__construct($a_mode,$a_ref_id,$a_user_id);
31  $this->__initUser($a_user_id);
32 
33  // Set item id for details
34  $this->__initDetails((int) $_GET['details_id']);
35  $this->ctrl->saveParameter($this,'details_id',$_REQUEST['details_id']);
36  }
37 
38 
42  function executeCommand()
43  {
44  global $ilUser;
45 
46  $this->ctrl->setReturn($this, "show");
47  $this->ctrl->saveParameter($this,'user_id',$this->getUserId());
48  switch($this->ctrl->getNextClass())
49  {
50  case 'illpprogresstablegui':
51  include_once './Services/Tracking/classes/repository_statistics/class.ilLPProgressTableGUI.php';
52  $table_gui = new ilLPProgressTableGUI($this, "", $this->tracked_user);
53  $this->ctrl->setReturn($this,'show');
54  $this->ctrl->forwardCommand($table_gui);
55  break;
56 
57  default:
58  $cmd = $this->__getDefaultCommand();
59  $this->$cmd();
60 
61  }
62  return true;
63  }
64 
65  function show()
66  {
67  global $ilObjDataCache;
68 
69  switch($this->getMode())
70  {
71  // Show only detail of current repository item if called from repository
72  case self::LP_CONTEXT_REPOSITORY:
73  $this->__initDetails($this->getRefId());
74  return $this->details();
75 
76  case self::LP_CONTEXT_USER_FOLDER:
77  case self::LP_CONTEXT_ORG_UNIT:
78  // if called from user folder obj_id is id of current user
79  $this->__initUser($this->getUserId());
80  break;
81  }
82 
83  // not called from repository
84  $this->__showProgressList();
85  }
86 
87  function details()
88  {
89  global $ilToolbar,$ilCtrl,$rbacsystem, $ilAccess;
90 
95  // Show back button to crs if called from crs. Otherwise if called from personal desktop or administration
96  // show back to list
97  if((int)$_GET['crs_id'])
98  {
99  $this->ctrl->setParameter($this,'details_id',(int) $_GET['crs_id']);
100 
101  $ilToolbar->addButton($this->lng->txt('trac_view_crs'),
102  $this->ctrl->getLinkTarget($this,'details'));
103  }
104  elseif($this->getMode() == self::LP_CONTEXT_PERSONAL_DESKTOP or
105  $this->getMode() == self::LP_CONTEXT_ADMINISTRATION or
106  $this->getMode() == self::LP_CONTEXT_USER_FOLDER)
107  {
108  $ilToolbar->addButton($this->lng->txt('trac_view_list'),
109  $this->ctrl->getLinkTarget($this,'show'));
110  }
111 
112  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.lp_progress_container.html','Services/Tracking');
113 
114  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
115  $info = new ilInfoScreenGUI($this);
116  $info->setFormAction($ilCtrl->getFormAction($this));
117  $this->__appendUserInfo($info, $this->tracked_user);
118  $this->__appendLPDetails($info,$this->details_obj_id,$this->tracked_user->getId());
119  $this->__showObjectDetails($info,$this->details_obj_id, false);
120 
121  // Finally set template variable
122  $this->tpl->setVariable("LM_INFO",$info->getHTML());
123 
124  include_once './Services/Object/classes/class.ilObjectLP.php';
125  $olp = ilObjectLP::getInstance($this->details_obj_id);
126  $collection = $olp->getCollectionInstance();
127  if($collection)
128  {
129  $obj_ids = array();
130  foreach($collection->getItems() as $item_id)
131  {
132  if($collection instanceof ilLPCollectionOfRepositoryObjects)
133  {
134  $obj_id = ilObject::_lookupObjectId($item_id);
135  if ($ilAccess->checkAccessOfUser($this->tracked_user->getId(), 'visible', '', $item_id)) {
136  $obj_ids[$obj_id] = array( $item_id );
137  }
138  }
139  else
140  {
141  $obj_ids[] = $item_id;
142  }
143  }
144  }
145 
146  // #15247
147  if(sizeof($obj_ids))
148  {
149  // seems obsolete
150  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
151  $personal_only = !ilLearningProgressAccess::checkPermission('read_learning_progress', $this->getRefId());
152 
153  include_once("./Services/Tracking/classes/repository_statistics/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, $this->details_id);
155  $this->tpl->setVariable("LP_OBJECTS", $lp_table->getHTML());
156  }
157 
158  $this->tpl->setVariable("LEGEND",$this->__getLegendHTML());
159  }
160 
162  {
163  global $ilUser,$ilObjDataCache,$ilCtrl;
164 
165  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.lp_list_progress.html','Services/Tracking');
166 
167  // User info
168  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
169  $info = new ilInfoScreenGUI($this);
170  $info->setFormAction($ilCtrl->getFormAction($this));
171 
172  if ($this->__appendUserInfo($info, $this->tracked_user))
173  {
174  $this->tpl->setCurrentBlock("info_user");
175  $this->tpl->setVariable("USER_INFO",$info->getHTML());
176  $this->tpl->parseCurrentBlock();
177  }
178 
179  include_once("./Services/Tracking/classes/repository_statistics/class.ilLPProgressTableGUI.php");
180  $lp_table = new ilLPProgressTableGUI($this, "", $this->tracked_user,null,false,null,false,null,null,$this->getMode());
181  $this->tpl->setVariable("LP_OBJECTS", $lp_table->getHTML());
182 
183  $this->tpl->setVariable("LEGEND", $this->__getLegendHTML());
184  }
185 
186  function __initUser($a_usr_id = 0)
187  {
188  global $ilUser,$rbacreview,$rbacsystem;
189 
190  if($_POST['user_id'])
191  {
192  $a_usr_id = $_POST['user_id'];
193  $this->ctrl->setParameter($this,'user_id',$_POST['user_id']);
194  }
195 
196  if($a_usr_id)
197  {
198  $this->tracked_user = ilObjectFactory::getInstanceByObjId($a_usr_id);
199  }
200  else
201  {
202  $this->tracked_user = $ilUser;
203  }
204 
205  // #8762: see ilObjUserGUI->getTabs()
206  if($this->mode == self::LP_CONTEXT_USER_FOLDER && $rbacsystem->checkAccess('read',$this->ref_id))
207  {
208  return true;
209  }
210 
211  if($this->mode == self::LP_CONTEXT_ORG_UNIT && ilObjOrgUnitAccess::_checkAccessToUserLearningProgress($this->ref_id,$a_usr_id))
212  {
213  return true;
214  }
215 
216  // Check access
217  if(!$rbacreview->isAssigned($ilUser->getId(),SYSTEM_ROLE_ID))
218  {
219  $this->tracked_user = $ilUser;
220  }
221 
222  return true;
223  }
224 
225  function __initDetails($a_details_id)
226  {
227  global $ilObjDataCache;
228 
229  if(!$a_details_id)
230  {
231  $a_details_id = $this->getRefId();
232  }
233  if($a_details_id)
234  {
235  $ref_ids = ilObject::_getAllReferences($a_details_id);
236 
237  $this->details_id = $a_details_id;
238  $this->details_obj_id = $ilObjDataCache->lookupObjId($this->details_id);
239  $this->details_type = $ilObjDataCache->lookupType($this->details_obj_id);
240 
241  include_once 'Services/Object/classes/class.ilObjectLP.php';
242  $olp = ilObjectLP::getInstance($this->details_obj_id);
243  $this->details_mode = $olp->getCurrentMode();
244  }
245  }
246 }
247 
248 ?>
Class ilInfoScreenGUI.
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
__construct($a_mode, $a_ref_id, $a_user_id=0)
__appendLPDetails(&$info, $item_id, $user_id)
static checkPermission($a_permission, $a_ref_id, $a_user_id=null)
wrapper for rbac access checks
TableGUI class for learning progress.
static _getAllReferences($a_id)
get all reference ids of object
__showObjectDetails(&$info, $item_id=0, $add_section=true)
show details about current object.
static _lookupObjectId($a_ref_id)
lookup object id
global $ilCtrl
Definition: ilias.php:18
$info
Definition: example_052.php:80
$ilUser
Definition: imgupload.php:18
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Create styles array
The data for the language used.
static getInstance($a_obj_id)
static _checkAccessToUserLearningProgress($ref_id, $usr_id)
$_POST["username"]