ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilLearningProgressBaseGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once 'Services/Tracking/classes/class.ilObjUserTracking.php';
6 
22 {
23  var $tpl = null;
24  var $ctrl = null;
25  var $lng = null;
26  var $ref_id = 0;
27  var $mode = 0;
28 
29  protected $anonymized;
30 
36 
37  const LP_ACTIVE_SETTINGS = 1;
38  const LP_ACTIVE_OBJECTS = 2;
39  const LP_ACTIVE_PROGRESS = 3;
40  // const LP_ACTIVE_LM_STATISTICS = 4; obsolete
41  const LP_ACTIVE_USERS = 5;
42  const LP_ACTIVE_SUMMARY = 6;
47  const LP_ACTIVE_MATRIX = 11;
48 
49  function ilLearningProgressBaseGUI($a_mode,$a_ref_id = 0,$a_usr_id = 0)
50  {
51  global $tpl,$ilCtrl,$lng,$ilObjDataCache,$ilTabs;
52 
53  $this->tpl =& $tpl;
54  $this->ctrl =& $ilCtrl;
55  $this->lng =& $lng;
56  $this->lng->loadLanguageModule('trac');
57  $this->tabs_gui =& $ilTabs;
58 
59  $this->mode = $a_mode;
60  $this->ref_id = $a_ref_id;
61  $this->obj_id = $ilObjDataCache->lookupObjId($this->ref_id);
62  $this->obj_type = $ilObjDataCache->lookupType($this->obj_id);
63  $this->usr_id = $a_usr_id;
64 
65  $this->anonymized = (bool)!ilObjUserTracking::_enabledUserRelatedData();
66  if(!$this->anonymized && $this->obj_id)
67  {
68  include_once "Services/Object/classes/class.ilObjectLP.php";
69  $olp = ilObjectLP::getInstance($this->obj_id);
70  $this->anonymized = $olp->isAnonymized();
71  }
72  }
73 
74  function isAnonymized()
75  {
76  return $this->anonymized;
77  }
78 
79  function getMode()
80  {
81  return $this->mode;
82  }
83 
84  function getRefId()
85  {
86  return $this->ref_id;
87  }
88 
89  function getObjId()
90  {
91  return $this->obj_id;
92  }
93 
94  function getUserId()
95  {
96  if($this->usr_id)
97  {
98  return $this->usr_id;
99  }
100  if((int) $_GET['user_id'])
101  {
102  return (int) $_GET['user_id'];
103  }
104  return 0;
105  }
106 
107  // Protected
109  {
110  if(strlen($cmd = $this->ctrl->getCmd()))
111  {
112  return $cmd;
113  }
114  return 'show';
115  }
116 
117  function __setSubTabs($a_active)
118  {
119  global $rbacsystem,$ilObjDataCache;
120 
121 
122 
123  switch($this->getMode())
124  {
125  case self::LP_CONTEXT_PERSONAL_DESKTOP:
126 
127  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
130  {
131  $this->tabs_gui->addTarget('trac_progress',
132  $this->ctrl->getLinkTargetByClass('illplistofprogressgui',''),
133  "","","",$a_active == self::LP_ACTIVE_PROGRESS);
134  }
135 
137  {
138  $this->tabs_gui->addTarget('trac_objects',
139  $this->ctrl->getLinkTargetByClass("illplistofobjectsgui",''),
140  "","","",$a_active == self::LP_ACTIVE_OBJECTS);
141  }
142  break;
143 
144 
145  case self::LP_CONTEXT_REPOSITORY:
146  // #12771 - do not show status if learning progress is deactivated
147  include_once './Services/Object/classes/class.ilObjectLP.php';
148  $olp = ilObjectLP::getInstance($this->obj_id);
149  if($olp->isActive())
150  {
151  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
152  $has_read = ilLearningProgressAccess::checkPermission('read_learning_progress', $this->getRefId());
153 
154  if($this->isAnonymized() || !$has_read)
155  {
156  $this->ctrl->setParameterByClass('illplistofprogressgui','user_id',$this->getUserId());
157  $this->tabs_gui->addSubTabTarget('trac_progress',
158  $this->ctrl->getLinkTargetByClass('illplistofprogressgui',''),
159  "","","",$a_active == self::LP_ACTIVE_PROGRESS);
160  }
161  else
162  {
163  // Check if it is a course
164  $sub_tab = ($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->getRefId())) == 'crs') ?
165  'trac_crs_objects' :
166  'trac_objects';
167 
168  $this->tabs_gui->addSubTabTarget($sub_tab,
169  $this->ctrl->getLinkTargetByClass("illplistofobjectsgui",''),
170  "","","",$a_active == self::LP_ACTIVE_OBJECTS);
171  }
172 
173  if($has_read)
174  {
175  if(!$this->isAnonymized() &&
176  !($olp instanceof ilPluginLP) &&
177  ilObjectLP::supportsMatrixView($this->obj_type))
178  {
179  $this->tabs_gui->addSubTabTarget("trac_matrix",
180  $this->ctrl->getLinkTargetByClass("illplistofobjectsgui", 'showUserObjectMatrix'),
181  "", "", "", $a_active == self::LP_ACTIVE_MATRIX);
182  }
183 
184  $this->tabs_gui->addSubTabTarget("trac_summary",
185  $this->ctrl->getLinkTargetByClass("illplistofobjectsgui", 'showObjectSummary'),
186  "", "", "", $a_active == self::LP_ACTIVE_SUMMARY);
187  }
188  }
189  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
190  if(!($olp instanceof ilPluginLP) &&
191  ilLearningProgressAccess::checkPermission('edit_learning_progress', $this->getRefId()))
192  {
193  $this->tabs_gui->addSubTabTarget('trac_settings',
194  $this->ctrl->getLinkTargetByClass('illplistofsettingsgui',''),
195  "","","",$a_active == self::LP_ACTIVE_SETTINGS);
196  }
197  break;
198 
199  case self::LP_CONTEXT_ADMINISTRATION:
200  /*
201  $this->tabs_gui->addSubTabTarget('trac_progress',
202  $this->ctrl->getLinkTargetByClass('illplistofprogressgui',''),
203  "","","",$a_active == self::LP_ACTIVE_PROGRESS);
204  */
205  $this->tabs_gui->addSubTabTarget('trac_objects',
206  $this->ctrl->getLinkTargetByClass("illplistofobjectsgui",''),
207  "","","",$a_active == self::LP_ACTIVE_OBJECTS);
208  break;
209 
210  case self::LP_CONTEXT_USER_FOLDER:
211  case self::LP_CONTEXT_ORG_UNIT:
212  // No tabs default class is lpprogressgui
213  break;
214 
215  default:
216  die ('No valid mode given');
217  break;
218  }
219 
220  return true;
221  }
222 
223  function __buildFooter()
224  {
225  switch($this->getMode())
226  {
227  case self::LP_CONTEXT_PERSONAL_DESKTOP:
228 
229  $this->tpl->show(true);
230  }
231  }
232 
233  function __buildHeader()
234  {
235  if($this->getMode() == self::LP_CONTEXT_PERSONAL_DESKTOP)
236  {
237  $this->tpl->setTitle($this->lng->txt("learning_progress"));
238 
239  // set locator
240 /*
241  $this->tpl->setVariable("TXT_LOCATOR", $this->lng->txt("locator"));
242  $this->tpl->touchBlock("locator_separator");
243  $this->tpl->touchBlock("locator_item");
244  //$this->tpl->setCurrentBlock("locator_item");
245  //$this->tpl->setVariable("ITEM", $this->lng->txt("personal_desktop"));
246  //$this->tpl->setVariable("LINK_ITEM",
247  // $this->ctrl->getLinkTargetByClass("ilpersonaldesktopgui"));
248  //$this->tpl->parseCurrentBlock();
249 
250  $this->tpl->setCurrentBlock("locator_item");
251  $this->tpl->setVariable("ITEM", $this->lng->txt("learning_progress"));
252  $this->tpl->setVariable("LINK_ITEM",
253  $this->ctrl->getLinkTargetByClass('illearningprogressgui'));
254  $this->tpl->parseCurrentBlock();
255 */
256 
257  // display infopanel if something happened
259  }
260 
261  }
262 
266  function __insertPath(&$a_tpl,$a_ref_id)
267  {
268  global $tree;
269 
270  $path_arr = $tree->getPathFull($a_ref_id);
271  $counter = 0;
272  foreach($tree->getPathFull($a_ref_id) as $data)
273  {
274  if($counter++)
275  {
276  $path .= " -> ";
277  }
278  $path .= $data['title'];
279  }
280  $a_tpl->setCurrentBlock("path_item");
281  $a_tpl->setVariable("PATH_ITEM",$path);
282  $a_tpl->parseCurrentBlock();
283 
284  $a_tpl->setCurrentBlock("path");
285  $a_tpl->parseCurrentBlock();
286 
287  return $path;
288  }
289 
290  function __showImageByStatus(&$tpl,$a_status,$tpl_prefix = "")
291  {
292  return ilLearningProgressBaseGUI::_showImageByStatus($tpl,$a_status,$tpl_prefix);
293  }
294 
295  // we need this public in table classes
296  public static function _showImageByStatus(&$tpl,$a_status,$tpl_prefix = "")
297  {
298  global $lng;
299 
300  $tpl->setVariable($tpl_prefix."STATUS_IMG",
302  $tpl->setVariable($tpl_prefix."STATUS_ALT",$lng->txt($a_status));
303 
304  return true;
305  }
306 
310  function _getImagePathForStatus($a_status)
311  {
312  include_once("./Services/Tracking/classes/class.ilLPStatus.php");
313 
314  // constants are either number or string, so make comparison string-based
315  switch((string)$a_status)
316  {
320  return ilUtil::getImagePath('scorm/incomplete.svg');
321  break;
322 
326  return ilUtil::getImagePath('scorm/complete.svg');
327  break;
328 
332  return ilUtil::getImagePath('scorm/not_attempted.svg');
333  break;
334 
337  return ilUtil::getImagePath('scorm/failed.svg');
338  break;
339 
340  default:
341  return ilUtil::getImagePath('scorm/not_attempted.svg');
342  break;
343  }
344  }
345 
349  function _getStatusText($a_status, $a_lng = null)
350  {
351  global $lng;
352 
353  if(!$a_lng)
354  {
355  $a_lng = $lng;
356  }
357 
358  include_once("./Services/Tracking/classes/class.ilLPStatus.php");
359 //echo "#".$a_status."#";
360  switch($a_status)
361  {
363  return $a_lng->txt(ilLPStatus::LP_STATUS_IN_PROGRESS);
364 
366  return $a_lng->txt(ilLPStatus::LP_STATUS_COMPLETED);
367 
369  return $a_lng->txt(ilLPStatus::LP_STATUS_FAILED);
370 
371  default:
372  if ($a_status === ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM)
373  {
374  return $a_lng->txt(ilLPStatus::LP_STATUS_NOT_ATTEMPTED);
375  }
376  return $a_lng->txt($a_status);
377  }
378  }
379 
380 
381  // Protected Table gui methods
382  function &__initTableGUI()
383  {
384  include_once "./Services/Table/classes/class.ilTableGUI.php";
385 
386  return new ilTableGUI(0,false);
387  }
388 
389 
393  function __showObjectDetails(&$info,$item_id = 0,$add_section = true)
394  {
395  global $ilObjDataCache;
396 
397  $details_id = $item_id ? $item_id : $this->details_id;
398 
399  include_once 'Services/Object/classes/class.ilObjectLP.php';
400  $olp = ilObjectLP::getInstance($details_id);
401  $mode = $olp->getCurrentMode();
402 
403  include_once './Services/MetaData/classes/class.ilMDEducational.php';
404  if($mode == ilLPObjSettings::LP_MODE_VISITS ||
406  {
407  // Section object details
408  if($add_section)
409  {
410  $info->addSection($this->lng->txt('details'));
411  }
412 
414  {
415  $info->addProperty($this->lng->txt('trac_required_visits'), ilLPObjSettings::_lookupVisits($details_id));
416  }
417 
418  if($seconds = ilMDEducational::_getTypicalLearningTimeSeconds($details_id))
419  {
420  $info->addProperty($this->lng->txt('meta_typical_learning_time'), ilFormat::_secondsToString($seconds));
421  }
422 
423  return true;
424  }
425  return false;
426  }
427 
428  function __appendUserInfo(&$info, $a_user)
429  {
430  global $ilUser;
431 
432  // #13525 - irrelevant personal data is not to be presented
433  return;
434 
435  if(!is_object($a_user))
436  {
437  $a_user = ilObjectFactory::getInstanceByObjId($a_user);
438  }
439 
440  if($a_user->getId() != $ilUser->getId())
441  {
442  $info->addSection($this->lng->txt("trac_user_data"));
443  // $info->addProperty($this->lng->txt('username'),$a_user->getLogin());
444  // $info->addProperty($this->lng->txt('name'),$a_user->getFullname());
445  $info->addProperty($this->lng->txt('last_login'),
446  ilDatePresentation::formatDate(new ilDateTime($a_user->getLastLogin(),IL_CAL_DATETIME)));
447  $info->addProperty($this->lng->txt('trac_total_online'),
448  ilFormat::_secondsToString(ilOnlineTracking::getOnlineTime($a_user->getId())));
449  return true;
450  }
451  }
452 
453  function __appendLPDetails(&$info,$item_id,$user_id)
454  {
455  global $ilObjDataCache;
456 
457  $type = $ilObjDataCache->lookupType($item_id);
458 
459  // Section learning_progress
460  // $info->addSection($this->lng->txt('trac_learning_progress'));
461  // see ilLPTableBaseGUI::parseTitle();
462  $info->addSection($this->lng->txt("trac_progress").": ".ilObject::_lookupTitle($item_id));
463 
464  $olp = ilObjectLP::getInstance($item_id);
465  $info->addProperty($this->lng->txt('trac_mode'),
466  $olp->getModeText($olp->getCurrentMode()));
467 
468  switch($type)
469  {
470  case 'lm':
471  case 'htlm':
472  include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
473  $progress = ilLearningProgress::_getProgress($user_id,$item_id);
474 
475  if($progress['access_time'])
476  {
477  $info->addProperty($this->lng->txt('last_access'),
478  ilDatePresentation::formatDate(new ilDateTime($progress['access_time'],IL_CAL_UNIX)));
479  }
480  else
481  {
482  $info->addProperty($this->lng->txt('last_access'),$this->lng->txt('trac_not_accessed'));
483  }
484  $info->addProperty($this->lng->txt('trac_visits'),(int) $progress['visits']);
486  {
487  $info->addProperty($this->lng->txt('trac_spent_time'),ilFormat::_secondsToString($progress['spent_seconds']));
488  }
489  // fallthrough
490 
491  case 'exc':
492  case 'tst':
493  case 'file':
494  case 'mcst':
495  case 'svy':
496  case 'crs':
497  case 'sahs':
498  case 'grp':
499  // display status as image
500  include_once("./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
501  $status = $this->__readStatus($item_id,$user_id);
503  $status_text = ilLearningProgressBaseGUI::_getStatusText($status);
504  $info->addProperty($this->lng->txt('trac_status'),
505  ilUtil::img($status_path, $status_text)." ".$status_text);
506 
507  // #15334 - see ilLPTableBaseGUI::isPercentageAvailable()
508  $mode = $olp->getCurrentMode();
509  if(in_array($mode, array(ilLPObjSettings::LP_MODE_TLT,
511  // ilLPObjSettings::LP_MODE_OBJECTIVES,
514  {
515  include_once 'Services/Tracking/classes/class.ilLPStatus.php';
516  $perc = ilLPStatus::_lookupPercentage($item_id, $user_id);
517  $info->addProperty($this->lng->txt('trac_percentage'), (int)$perc."%");
518  }
519  break;
520 
521  }
522 
523  include_once 'Services/Tracking/classes/class.ilLPMarks.php';
524 
525  if(ilObjectLP::supportsMark($type))
526  {
527  if(strlen($mark = ilLPMarks::_lookupMark($user_id,$item_id)))
528  {
529  $info->addProperty($this->lng->txt('trac_mark'),$mark);
530  }
531  }
532 
533  if(strlen($comment = ilLPMarks::_lookupComment($user_id,$item_id)))
534  {
535  $info->addProperty($this->lng->txt('trac_comment'),$comment);
536  }
537  }
538 
539  function __readStatus($a_obj_id,$user_id)
540  {
541  include_once 'Services/Tracking/classes/class.ilLPStatus.php';
542  $status = ilLPStatus::_lookupStatus($a_obj_id, $user_id);
543 
544  include_once("./Services/Tracking/classes/class.ilLPStatus.php");
545  switch($status)
546  {
549 
552 
555 
558 
559  default:
560  return $status;
561  }
562  }
563 
576  function __sort($a_ids,$a_table,$a_field,$a_id_name)
577  {
578  global $ilDB;
579 
580  if(!$a_ids)
581  {
582  return array();
583  }
584 
585  // comment by mjansen: Requesting database in gui classes?
586 
587  // use database to sort user array
588  $where = "WHERE ".$ilDB->in($a_id_name, $a_ids, false, 'integer')." ";
589 
590  $query = "SELECT ".$a_id_name." FROM ".$a_table." ".
591  $where.
592  "ORDER BY ".$a_field;
593 
594  $res = $ilDB->query($query);
595  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
596  {
597  $ids[] = $row->$a_id_name;
598  }
599  return $ids ? $ids : array();
600  }
601 
602  function __getPercent($max,$reached)
603  {
604  if(!$max)
605  {
606  return "0%";
607  }
608 
609  return sprintf("%d%%",$reached / $max * 100);
610  }
611 
612  function __readItemStatusInfo($a_items)
613  {
614  global $ilObjDataCache;
615 
616  include_once 'Services/Object/classes/class.ilObjectLP.php';
617 
618  foreach($a_items as $item_id)
619  {
620  $olp = ilObjectLP::getInstance($item_id);
621 
622  $this->obj_data[$item_id]['type'] = $ilObjDataCache->lookupType($item_id);
623  $this->obj_data[$item_id]['mode'] = $olp->getCurrentMode();
624  if($this->obj_data[$item_id]['mode'] == ilLPObjSettings::LP_MODE_TLT)
625  {
626  include_once './Services/MetaData/classes/class.ilMDEducational.php';
627  $this->obj_data[$item_id]['tlt'] = ilMDEducational::_getTypicalLearningTimeSeconds($item_id);
628  }
629  if($this->obj_data[$item_id]['mode'] == ilLPObjSettings::LP_MODE_VISITS)
630  {
631  $this->obj_data[$item_id]['visits'] = ilLPObjSettings::_lookupVisits($item_id);
632  }
633  if($this->obj_data[$item_id]['mode'] == ilLPObjSettings::LP_MODE_SCORM)
634  {
635  $collection = $olp->getCollectionInstance();
636  if($collection)
637  {
638  $this->obj_data[$item_id]['scos'] = count($collection->getItems());
639  }
640  }
641  }
642  }
643 
644  function __getLegendHTML()
645  {
646  global $lng;
647 
648  $tpl = new ilTemplate("tpl.lp_legend.html", true, true, "Services/Tracking");
649  $tpl->setVariable("IMG_NOT_ATTEMPTED",
650  ilUtil::getImagePath("scorm/not_attempted.svg"));
651  $tpl->setVariable("IMG_IN_PROGRESS",
652  ilUtil::getImagePath("scorm/incomplete.svg"));
653  $tpl->setVariable("IMG_COMPLETED",
654  ilUtil::getImagePath("scorm/completed.svg"));
655  $tpl->setVariable("IMG_FAILED",
656  ilUtil::getImagePath("scorm/failed.svg"));
657  $tpl->setVariable("TXT_NOT_ATTEMPTED",
658  $lng->txt("trac_not_attempted"));
659  $tpl->setVariable("TXT_IN_PROGRESS",
660  $lng->txt("trac_in_progress"));
661  $tpl->setVariable("TXT_COMPLETED",
662  $lng->txt("trac_completed"));
663  $tpl->setVariable("TXT_FAILED",
664  $lng->txt("trac_failed"));
665 
666  include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
667  $panel = ilPanelGUI::getInstance();
668  $panel->setPanelStyle(ilPanelGUI::PANEL_STYLE_SECONDARY);
669  $panel->setBody($tpl->get());
670 
671  return $panel->getHTML();
672  }
673 
674  protected function initEditUserForm($a_user_id, $a_obj_id, $a_cancel = null)
675  {
676  global $lng, $ilCtrl;
677 
678  include_once 'Services/Object/classes/class.ilObjectLP.php';
679  $olp = ilObjectLP::getInstance($a_obj_id);
680  $lp_mode = $olp->getCurrentMode();
681 
682  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
683  $form = new ilPropertyFormGUI();
684 
685  $form->setFormAction($ilCtrl->getFormAction($this, "updateUser"));
686 
687  $form->setTitle($lng->txt("edit").": ".ilObject::_lookupTitle($a_obj_id));
688  $form->setDescription($lng->txt('trac_mode').": ".$olp->getModeText($lp_mode));
689 
690  include_once "Services/User/classes/class.ilUserUtil.php";
691  $user = new ilNonEditableValueGUI($lng->txt("user"), null, true);
692  $user->setValue(ilUserUtil::getNamePresentation($a_user_id, true));
693  $form->addItem($user);
694 
695  include_once 'Services/Tracking/classes/class.ilLPMarks.php';
696  $marks = new ilLPMarks($a_obj_id, $a_user_id);
697 
699  {
700  $mark = new ilTextInputGUI($lng->txt("trac_mark"), "mark");
701  $mark->setValue($marks->getMark());
702  $mark->setMaxLength(32);
703  $form->addItem($mark);
704  }
705 
706  $comm = new ilTextInputGUI($lng->txt("trac_comment"), "comment");
707  $comm->setValue($marks->getComment());
708  $form->addItem($comm);
709 
710  if($lp_mode == ilLPObjSettings::LP_MODE_MANUAL ||
712  {
713  include_once("./Services/Tracking/classes/class.ilLPStatus.php");
714  $completed = ilLPStatus::_lookupStatus($a_obj_id, $a_user_id);
715 
716  $status = new ilCheckboxInputGUI($lng->txt('trac_completed'), "completed");
717  $status->setChecked(($completed == ilLPStatus::LP_STATUS_COMPLETED_NUM));
718  $form->addItem($status);
719  }
720 
721  $form->addCommandButton("updateUser", $lng->txt('save'));
722 
723  if($a_cancel)
724  {
725  $form->addCommandButton($a_cancel, $lng->txt('cancel'));
726  }
727 
728  return $form;
729  }
730 
731  function __showEditUser($a_user_id, $a_ref_id, $a_cancel, $a_sub_id = false)
732  {
733  global $ilCtrl;
734 
735  if(!$a_sub_id)
736  {
737  $obj_id = ilObject::_lookupObjId($a_ref_id);
738  }
739  else
740  {
741  $ilCtrl->setParameter($this,'userdetails_id',$a_sub_id);
742  $obj_id = ilObject::_lookupObjId($a_sub_id);
743  }
744 
745  $ilCtrl->setParameter($this, 'user_id', $a_user_id);
746  $ilCtrl->setParameter($this, 'details_id', $a_ref_id);
747 
748  $form = $this->initEditUserForm($a_user_id, $obj_id, $a_cancel);
749 
750  return $form->getHTML();
751  }
752 
753  function __updateUser($user_id, $obj_id)
754  {
755  $form = $this->initEditUserForm($user_id, $obj_id);
756  if($form->checkInput())
757  {
758  include_once 'Services/Tracking/classes/class.ilLPMarks.php';
759 
760  $marks = new ilLPMarks($obj_id, $user_id);
761  $marks->setMark($form->getInput("mark"));
762  $marks->setComment($form->getInput("comment"));
763 
764  $do_lp = false;
765 
766  // status/completed is optional
767  $status = $form->getItemByPostVar("completed");
768  if(is_object($status))
769  {
770  if($marks->getCompleted() != $form->getInput("completed"))
771  {
772  $marks->setCompleted($form->getInput("completed"));
773  $do_lp = true;
774  }
775  }
776 
777  $marks->update();
778 
779  // #11600
780  if($do_lp)
781  {
782  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
783  ilLPStatusWrapper::_updateStatus($obj_id, $user_id);
784  }
785  }
786  }
787 
788  static function isObjectOffline($a_obj_id, $a_type = null)
789  {
790  global $objDefinition, $ilObjDataCache;
791 
792  if(!$a_type)
793  {
794  $a_type = $ilObjDataCache->lookupType($a_obj_id);
795  }
796 
797  if($objDefinition->isPluginTypeName($a_type))
798  {
799  return false;
800  }
801 
802  $class = "ilObj".$objDefinition->getClassName($a_type)."Access";
803  include_once $objDefinition->getLocation($a_type)."/class.".$class.".php";
804  return call_user_func(array($class,'_isOffline'), $a_obj_id);
805 
806  // PHP 5.3 only ?
807  //return $class::_isOffline($obj_id);
808  }
809 }
810 
811 ?>
const LP_STATUS_COMPLETED_NUM
_getProgress($a_user_id, $a_obj_id)
__showEditUser($a_user_id, $a_ref_id, $a_cancel, $a_sub_id=false)
const IL_CAL_DATETIME
_getTypicalLearningTimeSeconds($a_rbac_id, $a_obj_id=0)
This class represents a property form user interface.
$_GET["client_id"]
const LP_STATUS_PARTICIPATED
_lookupMark($a_usr_id, $a_obj_id)
const LP_STATUS_NOT_ATTEMPTED
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
static _lookupPercentage($a_obj_id, $a_user_id)
Lookup percentage.
$cmd
Definition: sahs_server.php:35
const LP_STATUS_IN_PROGRESS_NUM
_getImagePathForStatus($a_status)
Get image path for status.
This class represents a checkbox property in a property form.
static _lookupTitle($a_id)
lookup object title
Class ilTableGUI.
const IL_CAL_UNIX
__appendLPDetails(&$info, $item_id, $user_id)
_secondsToString($seconds, $force_with_seconds=false, $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
static checkPermission($a_permission, $a_ref_id, $a_user_id=null)
wrapper for rbac access checks
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
__showObjectDetails(&$info, $item_id=0, $add_section=true)
show details about current object.
const LP_STATUS_IN_PROGRESS
global $ilCtrl
Definition: ilias.php:18
setChecked($a_checked)
Set Checked.
static _enabledUserRelatedData()
check wether user related tracking is enabled or not
$info
Definition: example_052.php:80
initEditUserForm($a_user_id, $a_obj_id, $a_cancel=null)
const LP_STATUS_NOT_PARTICIPATED
static getNamePresentation($a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false)
Default behaviour is:
$data
const LP_STATUS_FAILED
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static isObjectOffline($a_obj_id, $a_type=null)
static _lookupObjId($a_id)
_getStatusText($a_status, $a_lng=null)
Get status alt text.
special template class to simplify handling of ITX/PEAR
static _showImageByStatus(&$tpl, $a_status, $tpl_prefix="")
This class represents a text property in a property form.
static formatDate(ilDateTime $date)
Format a date public.
static infoPanel($a_keep=true)
Date and time handling
static supportsMatrixView($a_obj_type)
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
$comment
Definition: buildRTE.php:83
static _lookupType($a_id, $a_reference=false)
lookup object type
static supportsMark($a_obj_type)
const LP_STATUS_NOT_ATTEMPTED_NUM
const LP_STATUS_REGISTERED
static getInstance()
Get instance.
static supportsSpentSeconds($a_obj_type)
__insertPath(&$a_tpl, $a_ref_id)
insert path
_lookupComment($a_usr_id, $a_obj_id)
__showImageByStatus(&$tpl, $a_status, $tpl_prefix="")
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
This class represents a non editable value in a property form.
global $ilUser
Definition: imgupload.php:15
$path
Definition: index.php:22
__sort($a_ids, $a_table, $a_field, $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),&#39;usr_data&#39;,&#39;lastname&#39;,&#39;usr_id&#39;) => sorts by lastname.
global $ilDB
const PANEL_STYLE_SECONDARY
ilLearningProgressBaseGUI($a_mode, $a_ref_id=0, $a_usr_id=0)
setValue($a_value)
Set Value.
const LP_STATUS_COMPLETED
static getInstance($a_obj_id)
const LP_STATUS_NOT_REGISTERED
static _lookupStatus($a_obj_id, $a_user_id, $a_create=true)
Lookup status.
const LP_STATUS_FAILED_NUM