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