ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLearningProgressBaseGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
35 define("LP_MODE_PERSONAL_DESKTOP",1);
36 define("LP_MODE_ADMINISTRATION",2);
37 define("LP_MODE_REPOSITORY",3);
38 define("LP_MODE_USER_FOLDER",4);
39 
40 define("LP_ACTIVE_SETTINGS",1);
41 define("LP_ACTIVE_OBJECTS",2);
42 define("LP_ACTIVE_PROGRESS",3);
43 define("LP_ACTIVE_LM_STATISTICS",4);
44 define("LP_ACTIVE_USERS",5);
45 define("LP_ACTIVE_SUMMARY",6);
46 define("LP_ACTIVE_OBJSTATACCESS",7);
47 define("LP_ACTIVE_OBJSTATTYPES",8);
48 define("LP_ACTIVE_OBJSTATDAILY",9);
49 define("LP_ACTIVE_OBJSTATADMIN",10);
50 
51 include_once 'Services/Tracking/classes/class.ilObjUserTracking.php';
52 
53 /* Base class for all Learning progress gui classes.
54  * Defines modes for presentation according to the context in which it was called
55  * E.g: mode LP_MODE_PERSONAL_DESKTOP displays only listOfObjects.
56  */
57 
59 {
60  var $tpl = null;
61  var $ctrl = null;
62  var $lng = null;
63 
64  var $ref_id = 0;
65 
66  var $mode = 0;
67 
68  var $statistics_activated = false; // show sub tab for access statistics
69 
70  function ilLearningProgressBaseGUI($a_mode,$a_ref_id = 0,$a_usr_id = 0)
71  {
72  global $tpl,$ilCtrl,$lng,$ilObjDataCache,$ilTabs;
73 
74  $this->tpl =& $tpl;
75  $this->ctrl =& $ilCtrl;
76  $this->lng =& $lng;
77  $this->lng->loadLanguageModule('trac');
78  $this->tabs_gui =& $ilTabs;
79 
80  $this->mode = $a_mode;
81  $this->ref_id = $a_ref_id;
82  $this->obj_id = $ilObjDataCache->lookupObjId($this->ref_id);
83  $this->obj_type = $ilObjDataCache->lookupType($this->obj_id);
84  $this->usr_id = $a_usr_id;
85 
86  $this->anonymized = (bool) !ilObjUserTracking::_enabledUserRelatedData();
87  }
88 
89  function isAnonymized()
90  {
91  return $this->anonymized;
92  }
93 
94  function isObjectAnonymized()
95  {
96  switch($this->obj_type)
97  {
98  case 'tst':
99  include_once './Modules/Test/classes/class.ilObjTest.php';
100  if(ilObjTest::_lookupAnonymity($this->obj_id))
101  {
102  return true;
103  }
104  default:
105  return false;
106  }
107  return false;
108  }
109 
110  function getMode()
111  {
112  return $this->mode;
113  }
114 
115  function getRefId()
116  {
117  return $this->ref_id;
118  }
119 
120  function getObjId()
121  {
122  return $this->obj_id;
123  }
124 
125  function getUserId()
126  {
127  if($this->usr_id)
128  {
129  return $this->usr_id;
130  }
131  if((int) $_GET['user_id'])
132  {
133  return (int) $_GET['user_id'];
134  }
135  return 0;
136  }
137 
138  function activateStatistics($a_act = true)
139  {
140  $this->statistics_activated = $a_act;
141  }
142 
143  // Protected
145  {
146  if(strlen($cmd = $this->ctrl->getCmd()))
147  {
148  return $cmd;
149  }
150  return 'show';
151  }
152 
153  function __setSubTabs($a_active)
154  {
155  global $rbacsystem,$ilObjDataCache,$lng,$ilUser;
156 
157 
158 
159  switch($this->getMode())
160  {
162 
163  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
166  {
167  $this->tabs_gui->addTarget('trac_progress',
168  $this->ctrl->getLinkTargetByClass('illplistofprogressgui',''),
169  "","","",$a_active == LP_ACTIVE_PROGRESS);
170  }
171 
173  {
174  $this->tabs_gui->addTarget('trac_objects',
175  $this->ctrl->getLinkTargetByClass("illplistofobjectsgui",''),
176  "","","",$a_active == LP_ACTIVE_OBJECTS);
177  }
178  break;
179 
180 
181  case LP_MODE_REPOSITORY:
182 
183  if($rbacsystem->checkAccess('edit_learning_progress',$this->getRefId()))
184  {
185  // #12771 - do not show status if learning progress is deactivated
186  $mode = ilLPObjSettings::_lookupMode($this->obj_id);
187  if($mode != LP_MODE_DEACTIVATED && $mode != LP_MODE_LP_MODE_UNDEFINED)
188  {
189  if($this->isAnonymized() || $this->isObjectAnonymized())
190  {
191  $this->ctrl->setParameterByClass('illplistofprogressgui','user_id',$this->getUserId());
192  $this->tabs_gui->addSubTabTarget('trac_progress',
193  $this->ctrl->getLinkTargetByClass('illplistofprogressgui',''),
194  "","","",$a_active == LP_ACTIVE_PROGRESS);
195  }
196  else
197  {
198  // Check if it is a course
199  $sub_tab = ($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->getRefId())) == 'crs') ?
200  'trac_crs_objects' :
201  'trac_objects';
202 
203  $this->tabs_gui->addSubTabTarget($sub_tab,
204  $this->ctrl->getLinkTargetByClass("illplistofobjectsgui",''),
205  "","","",$a_active == LP_ACTIVE_OBJECTS);
206 
207  }
208 
209  if ($this->statistics_activated)
210  {
211  $this->tabs_gui->addSubTabTarget('trac_lm_statistics',
212  $this->ctrl->getLinkTargetByClass('illmstatisticsgui',''),
213  "","","",$a_active == LP_ACTIVE_LM_STATISTICS);
214  }
215 
216  if(!$this->isAnonymized() && !in_array($this->obj_type, array('tst', 'lm', 'htlm', 'exc')))
217  {
218  $this->tabs_gui->addSubTabTarget("trac_matrix",
219  $this->ctrl->getLinkTargetByClass("illplistofobjectsgui", 'showUserObjectMatrix'),
220  "", "", "", $a_active == LP_ACTIVE_MATRIX);
221  }
222 
223  $this->tabs_gui->addSubTabTarget("trac_summary",
224  $this->ctrl->getLinkTargetByClass("illplistofobjectsgui", 'showObjectSummary'),
225  "", "", "", $a_active == LP_ACTIVE_SUMMARY);
226  }
227 
228  $this->tabs_gui->addSubTabTarget('trac_settings',
229  $this->ctrl->getLinkTargetByClass('illplistofsettingsgui',''),
230  "","","",$a_active == LP_ACTIVE_SETTINGS);
231  }
232  break;
233 
235  /*
236  $this->tabs_gui->addSubTabTarget('trac_progress',
237  $this->ctrl->getLinkTargetByClass('illplistofprogressgui',''),
238  "","","",$a_active == LP_ACTIVE_PROGRESS);
239  */
240  $this->tabs_gui->addSubTabTarget('trac_objects',
241  $this->ctrl->getLinkTargetByClass("illplistofobjectsgui",''),
242  "","","",$a_active == LP_ACTIVE_OBJECTS);
243  break;
244 
245  case LP_MODE_USER_FOLDER:
246 
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  function __buildFooter()
259  {
260  switch($this->getMode())
261  {
263 
264  $this->tpl->show(true);
265  }
266  }
267 
268  function __buildHeader()
269  {
270  if($this->getMode() == LP_MODE_PERSONAL_DESKTOP)
271  {
272  //$this->tpl->setCurrentBlock("header_image");
273  //$this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_pd_b.png"));
274  //$this->tpl->parseCurrentBlock();
275  //$this->tpl->setVariable("HEADER",$this->lng->txt("personal_desktop"));
276  $this->tpl->setTitle($this->lng->txt("learning_progress"));
277 
278  // set locator
279 /*
280  $this->tpl->setVariable("TXT_LOCATOR", $this->lng->txt("locator"));
281  $this->tpl->touchBlock("locator_separator");
282  $this->tpl->touchBlock("locator_item");
283  //$this->tpl->setCurrentBlock("locator_item");
284  //$this->tpl->setVariable("ITEM", $this->lng->txt("personal_desktop"));
285  //$this->tpl->setVariable("LINK_ITEM",
286  // $this->ctrl->getLinkTargetByClass("ilpersonaldesktopgui"));
287  //$this->tpl->parseCurrentBlock();
288 
289  $this->tpl->setCurrentBlock("locator_item");
290  $this->tpl->setVariable("ITEM", $this->lng->txt("learning_progress"));
291  $this->tpl->setVariable("LINK_ITEM",
292  $this->ctrl->getLinkTargetByClass('illearningprogressgui'));
293  $this->tpl->parseCurrentBlock();
294 */
295 
296  // display infopanel if something happened
298  }
299 
300  }
301 
305  function __insertPath(&$a_tpl,$a_ref_id)
306  {
307  global $tree;
308 
309  $path_arr = $tree->getPathFull($a_ref_id);
310  $counter = 0;
311  foreach($tree->getPathFull($a_ref_id) as $data)
312  {
313  if($counter++)
314  {
315  $path .= " -> ";
316  }
317  $path .= $data['title'];
318  }
319  $a_tpl->setCurrentBlock("path_item");
320  $a_tpl->setVariable("PATH_ITEM",$path);
321  $a_tpl->parseCurrentBlock();
322 
323  $a_tpl->setCurrentBlock("path");
324  $a_tpl->parseCurrentBlock();
325 
326  return $path;
327  }
328 
329  function __showImageByStatus(&$tpl,$a_status,$tpl_prefix = "")
330  {
331  return ilLearningProgressBaseGUI::_showImageByStatus($tpl,$a_status,$tpl_prefix);
332  }
333 
334  // we need this public in table classes
335  public static function _showImageByStatus(&$tpl,$a_status,$tpl_prefix = "")
336  {
337  global $lng;
338 
339  $tpl->setVariable($tpl_prefix."STATUS_IMG",
341  $tpl->setVariable($tpl_prefix."STATUS_ALT",$lng->txt($a_status));
342 
343  return true;
344  }
345 
349  function _getImagePathForStatus($a_status)
350  {
351  include_once("./Services/Tracking/classes/class.ilLPStatus.php");
352 
353  // constants are either number or string, so make comparison string-based
354  switch((string)$a_status)
355  {
359  return ilUtil::getImagePath('scorm/incomplete.png');
360  break;
361 
363  case LP_STATUS_COMPLETED:
365  return ilUtil::getImagePath('scorm/complete.png');
366  break;
367 
371  return ilUtil::getImagePath('scorm/not_attempted.png');
372  break;
373 
375  case LP_STATUS_FAILED:
376  return ilUtil::getImagePath('scorm/failed.png');
377  break;
378 
379  default:
380  return ilUtil::getImagePath('scorm/not_attempted.png');
381  break;
382  }
383  }
384 
388  function _getStatusText($a_status)
389  {
390  global $lng;
391 
392  include_once("./Services/Tracking/classes/class.ilLPStatus.php");
393 //echo "#".$a_status."#";
394  switch($a_status)
395  {
397  return $lng->txt(LP_STATUS_IN_PROGRESS);
398 
400  return $lng->txt(LP_STATUS_COMPLETED);
401 
403  return $lng->txt(LP_STATUS_FAILED);
404 
405  default:
406  if ($a_status === LP_STATUS_NOT_ATTEMPTED_NUM)
407  {
408  return $lng->txt(LP_STATUS_NOT_ATTEMPTED);
409  }
410  return $lng->txt($a_status);
411  }
412  }
413 
414 
415  // Protected Table gui methods
416  function &__initTableGUI()
417  {
418  include_once "./Services/Table/classes/class.ilTableGUI.php";
419 
420  return new ilTableGUI(0,false);
421  }
422 
423 
427  function __showObjectDetails(&$info,$item_id = 0)
428  {
429  global $ilObjDataCache;
430 
431  $details_id = $item_id ? $item_id : $this->details_id;
432 
433  include_once './Services/MetaData/classes/class.ilMDEducational.php';
434  if(ilLPObjSettings::_lookupMode($details_id) == LP_MODE_VISITS ||
436  {
437 
438  // Section object details
439  $info->addSection($this->lng->txt('details'));
440 
441  /*
442  $info->addProperty($this->lng->txt('title'),$ilObjDataCache->lookupTitle($details_id));
443 
444  // :TODO: event title
445 
446  if(strlen($desc = $ilObjDataCache->lookupDescription($details_id)))
447  {
448  $info->addProperty($this->lng->txt('description'),$desc);
449  }
450  $info->addProperty($this->lng->txt('trac_mode'),ilLPObjSettings::_mode2Text(ilLPObjSettings::_lookupMode($details_id)));
451  */
452 
453  if(ilLPObjSettings::_lookupMode($details_id) == LP_MODE_VISITS)
454  {
455  $info->addProperty($this->lng->txt('trac_required_visits'),ilLPObjSettings::_lookupVisits($details_id));
456  }
457 
458  if($seconds = ilMDEducational::_getTypicalLearningTimeSeconds($details_id))
459  {
460  $info->addProperty($this->lng->txt('meta_typical_learning_time'),ilFormat::_secondsToString($seconds));
461  }
462 
463  return true;
464  }
465  return false;
466  }
467 
468  function __appendUserInfo(&$info, $a_user)
469  {
470  global $ilUser;
471 
472  // #13525 - irrelevant personal data is not to be presented
473  return;
474 
475  if(!is_object($a_user))
476  {
477  $a_user = ilObjectFactory::getInstanceByObjId($a_user);
478  }
479 
480  if($a_user->getId() != $ilUser->getId())
481  {
482  $info->addSection($this->lng->txt("trac_user_data"));
483  // $info->addProperty($this->lng->txt('username'),$a_user->getLogin());
484  // $info->addProperty($this->lng->txt('name'),$a_user->getFullname());
485  $info->addProperty($this->lng->txt('last_login'),
486  ilDatePresentation::formatDate(new ilDateTime($a_user->getLastLogin(),IL_CAL_DATETIME)));
487  $info->addProperty($this->lng->txt('trac_total_online'),
488  ilFormat::_secondsToString(ilOnlineTracking::getOnlineTime($a_user->getId())));
489  return true;
490  }
491  }
492 
493  function __appendLPDetails(&$info,$item_id,$user_id)
494  {
495  global $ilObjDataCache;
496 
497  $type = $ilObjDataCache->lookupType($item_id);
498 
499  // Section learning_progress
500  $info->addSection($this->lng->txt('trac_learning_progress'));
501 
502  switch($type)
503  {
504  case 'lm':
505  case 'htlm':
506  include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
507  $progress = ilLearningProgress::_getProgress($user_id,$item_id);
508 
509  if($progress['access_time'])
510  {
511  $info->addProperty($this->lng->txt('last_access'),
512  ilDatePresentation::formatDate(new ilDateTime($progress['access_time'],IL_CAL_DATETIME)));
513  }
514  else
515  {
516  $info->addProperty($this->lng->txt('last_access'),$this->lng->txt('trac_not_accessed'));
517  }
518  $info->addProperty($this->lng->txt('trac_visits'),(int) $progress['visits']);
519  if($type == 'lm')
520  {
521  $info->addProperty($this->lng->txt('trac_spent_time'),ilFormat::_secondsToString($progress['spent_seconds']));
522  }
523 
524  // display status as image
525  include_once("./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
526  $status = $this->__readStatus($item_id,$user_id);
528  $status_text = ilLearningProgressBaseGUI::_getStatusText($status);
529  $info->addProperty($this->lng->txt('trac_status'),
530  ilUtil::img($status_path, $status_text)." ".$status_text);
531  break;
532 
533  case 'exc':
534  case 'tst':
535  case 'crs':
536  case 'sahs':
537  case 'grp':
538  // display status as image
539  include_once("./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
540  $status = $this->__readStatus($item_id,$user_id);
542  $status_text = ilLearningProgressBaseGUI::_getStatusText($status);
543  $info->addProperty($this->lng->txt('trac_status'),
544  ilUtil::img($status_path, $status_text)." ".$status_text);
545  break;
546 
547  }
548 
549  include_once 'Services/Tracking/classes/class.ilLPMarks.php';
550  if(strlen($mark = ilLPMarks::_lookupMark($user_id,$item_id)))
551  {
552  $info->addProperty($this->lng->txt('trac_mark'),$mark);
553  }
554  if(strlen($comment = ilLPMarks::_lookupComment($user_id,$item_id)))
555  {
556  $info->addProperty($this->lng->txt('trac_comment'),$comment);
557  }
558  }
559 
560  function __readStatus($a_obj_id,$user_id)
561  {
562  include_once 'Services/Tracking/classes/class.ilLPStatus.php';
563  $status = ilLPStatus::_lookupStatus($a_obj_id, $user_id);
564 
565  include_once("./Services/Tracking/classes/class.ilLPStatus.php");
566  switch($status)
567  {
569  return LP_STATUS_IN_PROGRESS;
570 
572  return LP_STATUS_COMPLETED;
573 
575  return LP_STATUS_FAILED;
576 
579 
580  default:
581  return $status;
582  }
583  }
584 
585 
586  function __showButton($a_link,$a_text,$a_target = '')
587  {
588  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
589 
590  // display button
591  $this->tpl->setCurrentBlock("btn_cell");
592  $this->tpl->setVariable("BTN_LINK",$a_link);
593  $this->tpl->setVariable("BTN_TXT",$a_text);
594  if($a_target)
595  {
596  $this->tpl->setVariable("BTN_TARGET",$a_target);
597  }
598 
599  $this->tpl->parseCurrentBlock();
600  }
601 
602 
615  function __sort($a_ids,$a_table,$a_field,$a_id_name)
616  {
617  global $ilDB;
618 
619  if(!$a_ids)
620  {
621  return array();
622  }
623 
624  // comment by mjansen: Requesting database in gui classes?
625 
626  // use database to sort user array
627  $where = "WHERE ".$ilDB->in($a_id_name, $a_ids, false, 'integer')." ";
628 
629  $query = "SELECT ".$a_id_name." FROM ".$a_table." ".
630  $where.
631  "ORDER BY ".$a_field;
632 
633  $res = $ilDB->query($query);
634  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
635  {
636  $ids[] = $row->$a_id_name;
637  }
638  return $ids ? $ids : array();
639  }
640 
641  function __getPercent($max,$reached)
642  {
643  if(!$max)
644  {
645  return "0%";
646  }
647 
648  return sprintf("%d%%",$reached / $max * 100);
649  }
650 
651  function __readItemStatusInfo($a_items)
652  {
653  global $ilObjDataCache;
654 
655  foreach($a_items as $item_id)
656  {
657  $this->obj_data[$item_id]['mode'] = ilLPObjSettings::_lookupMode($item_id);
658  $this->obj_data[$item_id]['type'] = $ilObjDataCache->lookupType($item_id);
659  if($this->obj_data[$item_id]['mode'] == LP_MODE_TLT)
660  {
661  include_once './Services/MetaData/classes/class.ilMDEducational.php';
662  $this->obj_data[$item_id]['tlt'] = ilMDEducational::_getTypicalLearningTimeSeconds($item_id);
663  }
664  if($this->obj_data[$item_id]['mode'] == LP_MODE_VISITS)
665  {
666  include_once './Services/Tracking/classes/class.ilLPObjSettings.php';
667  $this->obj_data[$item_id]['visits'] = ilLPObjSettings::_lookupVisits($item_id);
668  }
669  if($this->obj_data[$item_id]['mode'] == LP_MODE_SCORM)
670  {
671  include_once './Services/Tracking/classes/class.ilLPCollectionCache.php';
672  $this->obj_data[$item_id]['scos'] = count(ilLPCollectionCache::_getItems($item_id));
673  }
674  }
675  }
676 
677  function __getLegendHTML()
678  {
679  global $lng;
680 
681  $tpl = new ilTemplate("tpl.lp_legend.html", true, true, "Services/Tracking");
682  $tpl->setVariable("IMG_NOT_ATTEMPTED",
683  ilUtil::getImagePath("scorm/not_attempted.png"));
684  $tpl->setVariable("IMG_IN_PROGRESS",
685  ilUtil::getImagePath("scorm/incomplete.png"));
686  $tpl->setVariable("IMG_COMPLETED",
687  ilUtil::getImagePath("scorm/completed.png"));
688  $tpl->setVariable("IMG_FAILED",
689  ilUtil::getImagePath("scorm/failed.png"));
690  $tpl->setVariable("TXT_NOT_ATTEMPTED",
691  $lng->txt("trac_not_attempted"));
692  $tpl->setVariable("TXT_IN_PROGRESS",
693  $lng->txt("trac_in_progress"));
694  $tpl->setVariable("TXT_COMPLETED",
695  $lng->txt("trac_completed"));
696  $tpl->setVariable("TXT_FAILED",
697  $lng->txt("trac_failed"));
698  return $tpl->get();
699  }
700 
701  function __showEditUser($a_user_id, $a_ref_id, $a_cancel, $a_sub_id = false)
702  {
703  global $ilObjDataCache, $lng, $ilCtrl;
704 
705  include_once 'Services/Tracking/classes/class.ilLPMarks.php';
706 
707  if(!$a_sub_id)
708  {
709  $obj_id = $ilObjDataCache->lookupObjId($a_ref_id);
710  }
711  else
712  {
713  $ilCtrl->setParameter($this,'userdetails_id',$a_sub_id);
714  $obj_id = $ilObjDataCache->lookupObjId($a_sub_id);
715  }
716 
717  $marks = new ilLPMarks($obj_id, $a_user_id);
718 
719  $tpl = new ilTemplate('tpl.lp_edit_user.html', true, true, 'Services/Tracking');
720 
721  $tpl->setVariable("OBJ_TITLE", $lng->txt("edit").": ".$ilObjDataCache->lookupTitle($obj_id));
722  $tpl->setVariable("OBJ_SUBTITLE", $this->lng->txt('trac_mode').": ".ilLPObjSettings::_mode2Text(ilLPObjSettings::_lookupMode($obj_id)));
723 
724  $ilCtrl->setParameter($this,'user_id',$a_user_id);
725  $ilCtrl->setParameter($this,'details_id',$a_ref_id);
726  $tpl->setVariable("FORMACTION",$ilCtrl->getFormAction($this));
727 
728  $tpl->setVariable("TYPE_IMG",ilObjUser::_getPersonalPicturePath($a_user_id,'xxsmall'));
729  $tpl->setVariable("ALT_IMG",$ilObjDataCache->lookupTitle($a_user_id));
730  $tpl->setVariable("TXT_LP",$lng->txt('trac_learning_progress_tbl_header'));
731 
732  $tpl->setVariable("COMMENT",ilUtil::prepareFormOutput($marks->getComment(),false));
733 
734  $type = $ilObjDataCache->lookupType($obj_id);
735  if($type != 'lm')
736  {
737  $tpl->setVariable("TXT_MARK",$lng->txt('trac_mark'));
738  $tpl->setVariable("MARK",ilUtil::prepareFormOutput($marks->getMark(),false));
739  }
740 
741  $tpl->setVariable("TXT_COMMENT",$lng->txt('trac_comment'));
742 
745  {
746  include_once("./Services/Tracking/classes/class.ilLPStatus.php");
747  $completed = ilLPStatus::_lookupStatus($obj_id, $a_user_id);
748 
749  $tpl->setVariable("mode_manual");
750  $tpl->setVariable("TXT_COMPLETED",$lng->txt('trac_completed'));
751  $tpl->setVariable("CHECK_COMPLETED",ilUtil::formCheckbox(($completed == LP_STATUS_COMPLETED_NUM),
752  'completed',
753  '1'));
754  }
755 
756  $tpl->setVariable("TXT_CANCEL",$lng->txt('cancel'));
757  $tpl->setVariable("TXT_SAVE",$lng->txt('save'));
758  $tpl->setVariable("CMD_CANCEL", $a_cancel);
759 
760  return $tpl->get();
761  }
762 
763  function __updateUser($user_id, $obj_id)
764  {
765  global $ilUser;
766 
767  include_once 'Services/Tracking/classes/class.ilLPMarks.php';
768 
769  $marks = new ilLPMarks($obj_id, $user_id);
770  $marks->setMark(ilUtil::stripSlashes($_POST['mark']));
771  $marks->setComment(ilUtil::stripSlashes($_POST['comment']));
772 
773  $do_lp = false;
774  if($marks->getCompleted() != (bool) $_POST['completed'])
775  {
776  $marks->setCompleted((bool) $_POST['completed']);
777  $do_lp = true;
778  }
779 
780  $marks->update();
781 
782  // #11600
783  if($do_lp)
784  {
785  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
786  ilLPStatusWrapper::_updateStatus($obj_id, $user_id);
787  }
788  }
789 
790  static function isObjectOffline($a_obj_id, $a_type = null)
791  {
792  global $objDefinition, $ilObjDataCache;
793 
794  if(!$a_type)
795  {
796  $a_type = $ilObjDataCache->lookupType($a_obj_id);
797  }
798 
799  if($objDefinition->isPluginTypeName($a_type))
800  {
801  return false;
802  }
803 
804  $class = "ilObj".$objDefinition->getClassName($a_type)."Access";
805  include_once $objDefinition->getLocation($a_type)."/class.".$class.".php";
806  return call_user_func(array($class,'_isOffline'), $a_obj_id);
807 
808  // PHP 5.3 only ?
809  //return $class::_isOffline($obj_id);
810  }
811 }
812 
813 ?>