ILIAS  Release_4_2_x_branch Revision 61807
 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 activePDF()
90  {
91  return $this->active_pdf;
92  }
93 
94  function __checkPDF()
95  {
96  include_once 'Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
97  $rpc_server = ilRPCServerSettings::getInstance();
98  $this->active_pdf = $rpc_server->getHost() ? true : false;
99  }
100 
101  function isAnonymized()
102  {
103  return $this->anonymized;
104  }
105 
107  {
108  switch($this->obj_type)
109  {
110  case 'tst':
111  include_once './Modules/Test/classes/class.ilObjTest.php';
112  if(ilObjTest::_lookupAnonymity($this->obj_id))
113  {
114  return true;
115  }
116  default:
117  return false;
118  }
119  return false;
120  }
121 
122  function getMode()
123  {
124  return $this->mode;
125  }
126 
127  function getRefId()
128  {
129  return $this->ref_id;
130  }
131 
132  function getObjId()
133  {
134  return $this->obj_id;
135  }
136 
137  function getUserId()
138  {
139  if($this->usr_id)
140  {
141  return $this->usr_id;
142  }
143  if((int) $_GET['user_id'])
144  {
145  return (int) $_GET['user_id'];
146  }
147  return 0;
148  }
149 
150  function activateStatistics($a_act = true)
151  {
152  $this->statistics_activated = $a_act;
153  }
154 
155  // Protected
157  {
158  if(strlen($cmd = $this->ctrl->getCmd()))
159  {
160  return $cmd;
161  }
162  return 'show';
163  }
164 
165  function __setSubTabs($a_active)
166  {
167  global $rbacsystem,$ilObjDataCache,$lng,$ilUser;
168 
169 
170 
171  switch($this->getMode())
172  {
174 
175  $this->tabs_gui->addTarget('trac_progress',
176  $this->ctrl->getLinkTargetByClass('illplistofprogressgui',''),
177  "","","",$a_active == LP_ACTIVE_PROGRESS);
178 
179  // ownership is also checked by this method
180  $types = array("crs", "grp", "exc", "tst", "lm", "sahs", "htlm", "dbk");
181  if(ilUtil::_getObjectsByOperations($types, "edit_learning_progress", $ilUser->getId(), 1))
182  {
183  $this->tabs_gui->addTarget('trac_objects',
184  $this->ctrl->getLinkTargetByClass("illplistofobjectsgui",''),
185  "","","",$a_active == LP_ACTIVE_OBJECTS);
186  }
187  break;
188 
189 
190  case LP_MODE_REPOSITORY:
191 
192  if($rbacsystem->checkAccess('edit_learning_progress',$this->getRefId()))
193  {
194  if($this->isAnonymized() || $this->isObjectAnonymized())
195  {
196  $this->ctrl->setParameterByClass('illplistofprogressgui','user_id',$this->getUserId());
197  $this->tabs_gui->addSubTabTarget('trac_progress',
198  $this->ctrl->getLinkTargetByClass('illplistofprogressgui',''),
199  "","","",$a_active == LP_ACTIVE_PROGRESS);
200  }
201  else
202  {
203  // Check if it is a course
204  $sub_tab = ($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->getRefId())) == 'crs') ?
205  'trac_crs_objects' :
206  'trac_objects';
207 
208  $this->tabs_gui->addSubTabTarget($sub_tab,
209  $this->ctrl->getLinkTargetByClass("illplistofobjectsgui",''),
210  "","","",$a_active == LP_ACTIVE_OBJECTS);
211 
212  }
213 
214  if ($this->statistics_activated)
215  {
216  $this->tabs_gui->addSubTabTarget('trac_lm_statistics',
217  $this->ctrl->getLinkTargetByClass('illmstatisticsgui',''),
218  "","","",$a_active == LP_ACTIVE_LM_STATISTICS);
219  }
220 
221  if(!$this->isAnonymized() && !in_array($this->obj_type, array('tst', 'lm', 'htlm', 'exc')))
222  {
223  $this->tabs_gui->addSubTabTarget("trac_matrix",
224  $this->ctrl->getLinkTargetByClass("illplistofobjectsgui", 'showUserObjectMatrix'),
225  "", "", "", $a_active == LP_ACTIVE_MATRIX);
226  }
227 
228  $this->tabs_gui->addSubTabTarget("trac_summary",
229  $this->ctrl->getLinkTargetByClass("illplistofobjectsgui", 'showObjectSummary'),
230  "", "", "", $a_active == LP_ACTIVE_SUMMARY);
231 
232  $this->tabs_gui->addSubTabTarget('trac_settings',
233  $this->ctrl->getLinkTargetByClass('illplistofsettingsgui',''),
234  "","","",$a_active == LP_ACTIVE_SETTINGS);
235  }
236  break;
237 
239  /*
240  $this->tabs_gui->addSubTabTarget('trac_progress',
241  $this->ctrl->getLinkTargetByClass('illplistofprogressgui',''),
242  "","","",$a_active == LP_ACTIVE_PROGRESS);
243  */
244  $this->tabs_gui->addSubTabTarget('trac_objects',
245  $this->ctrl->getLinkTargetByClass("illplistofobjectsgui",''),
246  "","","",$a_active == LP_ACTIVE_OBJECTS);
247  break;
248 
249  case LP_MODE_USER_FOLDER:
250 
251  // No tabs default class is lpprogressgui
252  break;
253 
254  default:
255  die ('No valid mode given');
256  break;
257  }
258 
259  return true;
260  }
261 
262  function __buildFooter()
263  {
264  switch($this->getMode())
265  {
267 
268  $this->tpl->show(true);
269  }
270  }
271 
272  function __buildHeader()
273  {
274  if($this->getMode() == LP_MODE_PERSONAL_DESKTOP)
275  {
276  //$this->tpl->setCurrentBlock("header_image");
277  //$this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_pd_b.gif"));
278  //$this->tpl->parseCurrentBlock();
279  //$this->tpl->setVariable("HEADER",$this->lng->txt("personal_desktop"));
280  $this->tpl->setTitle($this->lng->txt("learning_progress"));
281 
282  // set locator
283 /*
284  $this->tpl->setVariable("TXT_LOCATOR", $this->lng->txt("locator"));
285  $this->tpl->touchBlock("locator_separator");
286  $this->tpl->touchBlock("locator_item");
287  //$this->tpl->setCurrentBlock("locator_item");
288  //$this->tpl->setVariable("ITEM", $this->lng->txt("personal_desktop"));
289  //$this->tpl->setVariable("LINK_ITEM",
290  // $this->ctrl->getLinkTargetByClass("ilpersonaldesktopgui"));
291  //$this->tpl->parseCurrentBlock();
292 
293  $this->tpl->setCurrentBlock("locator_item");
294  $this->tpl->setVariable("ITEM", $this->lng->txt("learning_progress"));
295  $this->tpl->setVariable("LINK_ITEM",
296  $this->ctrl->getLinkTargetByClass('illearningprogressgui'));
297  $this->tpl->parseCurrentBlock();
298 */
299 
300  // display infopanel if something happened
302  }
303 
304  }
305 
309  function __insertPath(&$a_tpl,$a_ref_id)
310  {
311  global $tree;
312 
313  $path_arr = $tree->getPathFull($a_ref_id);
314  $counter = 0;
315  foreach($tree->getPathFull($a_ref_id) as $data)
316  {
317  if($counter++)
318  {
319  $path .= " -> ";
320  }
321  $path .= $data['title'];
322  }
323  $a_tpl->setCurrentBlock("path_item");
324  $a_tpl->setVariable("PATH_ITEM",$path);
325  $a_tpl->parseCurrentBlock();
326 
327  $a_tpl->setCurrentBlock("path");
328  $a_tpl->parseCurrentBlock();
329 
330  return $path;
331  }
332 
333  function __showImageByStatus(&$tpl,$a_status,$tpl_prefix = "")
334  {
335  return ilLearningProgressBaseGUI::_showImageByStatus($tpl,$a_status,$tpl_prefix);
336  }
337 
338  // we need this public in table classes
339  public static function _showImageByStatus(&$tpl,$a_status,$tpl_prefix = "")
340  {
341  global $lng;
342 
343  $tpl->setVariable($tpl_prefix."STATUS_IMG",
345  $tpl->setVariable($tpl_prefix."STATUS_ALT",$lng->txt($a_status));
346 
347  return true;
348  }
349 
353  function _getImagePathForStatus($a_status)
354  {
355  include_once("./Services/Tracking/classes/class.ilLPStatus.php");
356 
357  // constants are either number or string, so make comparison string-based
358  switch((string)$a_status)
359  {
363  return ilUtil::getImagePath('scorm/incomplete.gif');
364  break;
365 
367  case LP_STATUS_COMPLETED:
369  return ilUtil::getImagePath('scorm/complete.gif');
370  break;
371 
375  return ilUtil::getImagePath('scorm/not_attempted.gif');
376  break;
377 
379  case LP_STATUS_FAILED:
380  return ilUtil::getImagePath('scorm/failed.gif');
381  break;
382 
383  default:
384  return ilUtil::getImagePath('scorm/not_attempted.gif');
385  break;
386  }
387  }
388 
392  function _getStatusText($a_status)
393  {
394  global $lng;
395 
396  include_once("./Services/Tracking/classes/class.ilLPStatus.php");
397 //echo "#".$a_status."#";
398  switch($a_status)
399  {
401  return $lng->txt(LP_STATUS_IN_PROGRESS);
402 
404  return $lng->txt(LP_STATUS_COMPLETED);
405 
407  return $lng->txt(LP_STATUS_FAILED);
408 
409  default:
410  if ($a_status === LP_STATUS_NOT_ATTEMPTED_NUM)
411  {
412  return $lng->txt(LP_STATUS_NOT_ATTEMPTED);
413  }
414  return $lng->txt($a_status);
415  }
416  }
417 
418 
419  // Protected Table gui methods
420  function &__initTableGUI()
421  {
422  include_once "./Services/Table/classes/class.ilTableGUI.php";
423 
424  return new ilTableGUI(0,false);
425  }
426 
427 
431  function __showObjectDetails(&$info,$item_id = 0)
432  {
433  global $ilObjDataCache;
434 
435  $details_id = $item_id ? $item_id : $this->details_id;
436 
437  include_once './Services/MetaData/classes/class.ilMDEducational.php';
438  if(ilLPObjSettings::_lookupMode($details_id) == LP_MODE_VISITS ||
440  {
441 
442  // Section object details
443  $info->addSection($this->lng->txt('details'));
444 
445  /*
446  $info->addProperty($this->lng->txt('title'),$ilObjDataCache->lookupTitle($details_id));
447 
448  // :TODO: event title
449 
450  if(strlen($desc = $ilObjDataCache->lookupDescription($details_id)))
451  {
452  $info->addProperty($this->lng->txt('description'),$desc);
453  }
454  $info->addProperty($this->lng->txt('trac_mode'),ilLPObjSettings::_mode2Text(ilLPObjSettings::_lookupMode($details_id)));
455  */
456 
457  if(ilLPObjSettings::_lookupMode($details_id) == LP_MODE_VISITS)
458  {
459  $info->addProperty($this->lng->txt('trac_required_visits'),ilLPObjSettings::_lookupVisits($details_id));
460  }
461 
462  if($seconds = ilMDEducational::_getTypicalLearningTimeSeconds($details_id))
463  {
464  $info->addProperty($this->lng->txt('meta_typical_learning_time'),ilFormat::_secondsToString($seconds));
465  }
466 
467  return true;
468  }
469  return false;
470  }
471 
472  function __appendUserInfo(&$info, $a_user)
473  {
474  global $ilUser;
475 
476  if(!is_object($a_user))
477  {
478  $a_user = ilObjectFactory::getInstanceByObjId($a_user);
479  }
480 
481  if($a_user->getId() != $ilUser->getId())
482  {
483  $info->addSection($this->lng->txt("trac_user_data"));
484  // $info->addProperty($this->lng->txt('username'),$a_user->getLogin());
485  // $info->addProperty($this->lng->txt('name'),$a_user->getFullname());
486  $info->addProperty($this->lng->txt('last_login'),
487  ilDatePresentation::formatDate(new ilDateTime($a_user->getLastLogin(),IL_CAL_DATETIME)));
488  $info->addProperty($this->lng->txt('trac_total_online'),
490  return true;
491  }
492  }
493 
494  function __appendLPDetails(&$info,$item_id,$user_id)
495  {
496  global $ilObjDataCache;
497 
498  $type = $ilObjDataCache->lookupType($item_id);
499 
500  // Section learning_progress
501  $info->addSection($this->lng->txt('trac_learning_progress'));
502 
503  switch($type)
504  {
505  case 'lm':
506  case 'htlm':
507  include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
508  $progress = ilLearningProgress::_getProgress($user_id,$item_id);
509 
510  if($progress['access_time'])
511  {
512  $info->addProperty($this->lng->txt('last_access'),
513  ilDatePresentation::formatDate(new ilDateTime($progress['access_time'],IL_CAL_DATETIME)));
514  }
515  else
516  {
517  $info->addProperty($this->lng->txt('last_access'),$this->lng->txt('trac_not_accessed'));
518  }
519  $info->addProperty($this->lng->txt('trac_visits'),(int) $progress['visits']);
520  if($type == 'lm')
521  {
522  $info->addProperty($this->lng->txt('trac_spent_time'),ilFormat::_secondsToString($progress['spent_seconds']));
523  }
524 
525  // display status as image
526  include_once("./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
527  $status = $this->__readStatus($item_id,$user_id);
529  $status_text = ilLearningProgressBaseGUI::_getStatusText($status);
530  $info->addProperty($this->lng->txt('trac_status'),
531  ilUtil::img($status_path, $status_text)." ".$status_text);
532  break;
533 
534  case 'exc':
535  case 'tst':
536  case 'crs':
537  case 'sahs':
538  case 'grp':
539  // display status as image
540  include_once("./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
541  $status = $this->__readStatus($item_id,$user_id);
543  $status_text = ilLearningProgressBaseGUI::_getStatusText($status);
544  $info->addProperty($this->lng->txt('trac_status'),
545  ilUtil::img($status_path, $status_text)." ".$status_text);
546  break;
547 
548  }
549 
550  include_once 'Services/Tracking/classes/class.ilLPMarks.php';
551  if(strlen($mark = ilLPMarks::_lookupMark($user_id,$item_id)))
552  {
553  $info->addProperty($this->lng->txt('trac_mark'),$mark);
554  }
555  if(strlen($comment = ilLPMarks::_lookupComment($user_id,$item_id)))
556  {
557  $info->addProperty($this->lng->txt('trac_comment'),$comment);
558  }
559  }
560 
561  function __readStatus($a_obj_id,$user_id)
562  {
563  include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
564  $status = ilLPStatusWrapper::_determineStatus($a_obj_id, $user_id);
565 
566  include_once("./Services/Tracking/classes/class.ilLPStatus.php");
567  switch($status)
568  {
570  return LP_STATUS_IN_PROGRESS;
571 
573  return LP_STATUS_COMPLETED;
574 
576  return LP_STATUS_FAILED;
577 
580 
581  default:
582  return $status;
583  }
584  }
585 
586 
587  function __showButton($a_link,$a_text,$a_target = '')
588  {
589  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
590 
591  // display button
592  $this->tpl->setCurrentBlock("btn_cell");
593  $this->tpl->setVariable("BTN_LINK",$a_link);
594  $this->tpl->setVariable("BTN_TXT",$a_text);
595  if($a_target)
596  {
597  $this->tpl->setVariable("BTN_TARGET",$a_target);
598  }
599 
600  $this->tpl->parseCurrentBlock();
601  }
602 
603 
616  function __sort($a_ids,$a_table,$a_field,$a_id_name)
617  {
618  global $ilDB;
619 
620  if(!$a_ids)
621  {
622  return array();
623  }
624 
625  // comment by mjansen: Requesting database in gui classes?
626 
627  // use database to sort user array
628  $where = "WHERE ".$ilDB->in($a_id_name, $a_ids, false, 'integer')." ";
629 
630  $query = "SELECT ".$a_id_name." FROM ".$a_table." ".
631  $where.
632  "ORDER BY ".$a_field;
633 
634  $res = $ilDB->query($query);
635  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
636  {
637  $ids[] = $row->$a_id_name;
638  }
639  return $ids ? $ids : array();
640  }
641 
642  function __getPercent($max,$reached)
643  {
644  if(!$max)
645  {
646  return "0%";
647  }
648 
649  return sprintf("%d%%",$reached / $max * 100);
650  }
651 
652  function __readItemStatusInfo($a_items)
653  {
654  global $ilObjDataCache;
655 
656  foreach($a_items as $item_id)
657  {
658  $this->obj_data[$item_id]['mode'] = ilLPObjSettings::_lookupMode($item_id);
659  $this->obj_data[$item_id]['type'] = $ilObjDataCache->lookupType($item_id);
660  if($this->obj_data[$item_id]['mode'] == LP_MODE_TLT)
661  {
662  include_once './Services/MetaData/classes/class.ilMDEducational.php';
663  $this->obj_data[$item_id]['tlt'] = ilMDEducational::_getTypicalLearningTimeSeconds($item_id);
664  }
665  if($this->obj_data[$item_id]['mode'] == LP_MODE_VISITS)
666  {
667  include_once './Services/Tracking/classes/class.ilLPObjSettings.php';
668  $this->obj_data[$item_id]['visits'] = ilLPObjSettings::_lookupVisits($item_id);
669  }
670  if($this->obj_data[$item_id]['mode'] == LP_MODE_SCORM)
671  {
672  include_once './Services/Tracking/classes/class.ilLPCollectionCache.php';
673  $this->obj_data[$item_id]['scos'] = count(ilLPCollectionCache::_getItems($item_id));
674  }
675  }
676  }
677 
678  function __getLegendHTML()
679  {
680  global $lng;
681 
682  $tpl = new ilTemplate("tpl.lp_legend.html", true, true, "Services/Tracking");
683  $tpl->setVariable("IMG_NOT_ATTEMPTED",
684  ilUtil::getImagePath("scorm/not_attempted.gif"));
685  $tpl->setVariable("IMG_IN_PROGRESS",
686  ilUtil::getImagePath("scorm/incomplete.gif"));
687  $tpl->setVariable("IMG_COMPLETED",
688  ilUtil::getImagePath("scorm/completed.gif"));
689  $tpl->setVariable("IMG_FAILED",
690  ilUtil::getImagePath("scorm/failed.gif"));
691  $tpl->setVariable("TXT_NOT_ATTEMPTED",
692  $lng->txt("trac_not_attempted"));
693  $tpl->setVariable("TXT_IN_PROGRESS",
694  $lng->txt("trac_in_progress"));
695  $tpl->setVariable("TXT_COMPLETED",
696  $lng->txt("trac_completed"));
697  $tpl->setVariable("TXT_FAILED",
698  $lng->txt("trac_failed"));
699  return $tpl->get();
700  }
701 
702  function __showEditUser($a_user_id, $a_ref_id, $a_cancel, $a_sub_id = false)
703  {
704  global $ilObjDataCache, $lng, $ilCtrl;
705 
706  include_once 'Services/Tracking/classes/class.ilLPMarks.php';
707 
708  if(!$a_sub_id)
709  {
710  $obj_id = $ilObjDataCache->lookupObjId($a_ref_id);
711  }
712  else
713  {
714  $ilCtrl->setParameter($this,'userdetails_id',$a_sub_id);
715  $obj_id = $ilObjDataCache->lookupObjId($a_sub_id);
716  }
717 
718  $marks = new ilLPMarks($obj_id, $a_user_id);
719 
720  $tpl = new ilTemplate('tpl.lp_edit_user.html', true, true, 'Services/Tracking');
721 
722  $tpl->setVariable("OBJ_TITLE", $lng->txt("edit").": ".$ilObjDataCache->lookupTitle($obj_id));
723  $tpl->setVariable("OBJ_SUBTITLE", $this->lng->txt('trac_mode').": ".ilLPObjSettings::_mode2Text(ilLPObjSettings::_lookupMode($obj_id)));
724 
725  $ilCtrl->setParameter($this,'user_id',$a_user_id);
726  $ilCtrl->setParameter($this,'details_id',$a_ref_id);
727  $tpl->setVariable("FORMACTION",$ilCtrl->getFormAction($this));
728 
729  $tpl->setVariable("TYPE_IMG",ilObjUser::_getPersonalPicturePath($a_user_id,'xxsmall'));
730  $tpl->setVariable("ALT_IMG",$ilObjDataCache->lookupTitle($a_user_id));
731  $tpl->setVariable("TXT_LP",$lng->txt('trac_learning_progress_tbl_header'));
732 
733  $tpl->setVariable("COMMENT",ilUtil::prepareFormOutput($marks->getComment(),false));
734 
735  $type = $ilObjDataCache->lookupType($obj_id);
736  if($type != 'lm')
737  {
738  $tpl->setVariable("TXT_MARK",$lng->txt('trac_mark'));
739  $tpl->setVariable("MARK",ilUtil::prepareFormOutput($marks->getMark(),false));
740  }
741 
742  $tpl->setVariable("TXT_COMMENT",$lng->txt('trac_comment'));
743 
746  {
747  $completed = ilLPStatusWrapper::_getCompleted($obj_id);
748 
749  $tpl->setVariable("mode_manual");
750  $tpl->setVariable("TXT_COMPLETED",$lng->txt('trac_completed'));
751  $tpl->setVariable("CHECK_COMPLETED",ilUtil::formCheckbox(in_array($a_user_id,$completed),
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  include_once 'Services/Tracking/classes/class.ilLPMarks.php';
766 
767  $marks = new ilLPMarks($obj_id, $user_id);
768  $marks->setMark(ilUtil::stripSlashes($_POST['mark']));
769  $marks->setComment(ilUtil::stripSlashes($_POST['comment']));
770  $marks->setCompleted((bool) $_POST['completed']);
771  $marks->update();
772 
773  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
774  ilLPStatusWrapper::_updateStatus($obj_id, $user_id);
775  }
776 
777  static function isObjectOffline($a_obj_id, $a_type = null)
778  {
779  global $objDefinition, $ilObjDataCache;
780 
781  if(!$a_type)
782  {
783  $a_type = $ilObjDataCache->lookupType($a_obj_id);
784  }
785 
786  $class = "ilObj".$objDefinition->getClassName($a_type)."Access";
787  include_once $objDefinition->getLocation($a_type)."/class.".$class.".php";
788 
789  return call_user_func(array($class,'_isOffline'), $a_obj_id);
790 
791  // PHP 5.3 only ?
792  //return $class::_isOffline($obj_id);
793  }
794 }
795 
796 ?>