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