ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilLTIConsumerLPStatus.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 
14 require_once 'Services/Tracking/classes/status/class.ilLPStatusPlugin.php';
15 
16 
18 {
27  public static function getLPStatusDataFromDb($a_obj_id, $a_status)
28  {
29  return self::getLPStatusData($a_obj_id, $a_status);
30  }
31 
40  public static function getLPDataForUserFromDb($a_obj_id, $a_user_id)
41  {
42  return self::getLPDataForUser($a_obj_id, $a_user_id);
43  }
44 
45 
56  public static function trackAccess($a_user_id, $a_obj_id, $a_ref_id)
57  {
58  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
59  ilChangeEvent::_recordReadEvent('xxco', $a_ref_id, $a_obj_id, $a_user_id);
60 
61  $status = self::getLPDataForUser($a_obj_id, $a_user_id);
62  if ($status == self::LP_STATUS_NOT_ATTEMPTED_NUM) {
63  self::writeStatus($a_obj_id, $a_user_id, self::LP_STATUS_IN_PROGRESS_NUM);
64  self::raiseEventStatic(
65  $a_obj_id,
66  $a_user_id,
67  self::LP_STATUS_IN_PROGRESS_NUM,
68  self::getPercentageForUser($a_obj_id, $a_user_id)
69  );
70  }
71  }
72 
83  public static function trackResult($a_user_id, $a_obj_id, $a_status = self::LP_STATUS_IN_PROGRESS_NUM, $a_percentage)
84  {
85  self::writeStatus($a_obj_id, $a_user_id, $a_status, $a_percentage, true);
86  self::raiseEventStatic($a_obj_id, $a_user_id, $a_status, $a_percentage);
87  }
88 
98  protected static function raiseEventStatic($a_obj_id, $a_usr_id, $a_status, $a_percentage)
99  {
100  global $DIC; /* @var \ILIAS\DI\Container $DIC */
101 
102  $DIC->event()->raise("Services/Tracking", "updateStatus", array(
103  "obj_id" => $a_obj_id,
104  "usr_id" => $a_usr_id,
105  "status" => $a_status,
106  "percentage" => $a_percentage
107  ));
108  }
109 }
static _recordReadEvent( $a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
static raiseEventStatic($a_obj_id, $a_usr_id, $a_status, $a_percentage)
Static version if ilLPStatus::raiseEvent This function is just a workaround for PHP7 until ilLPStatus...
static trackAccess($a_user_id, $a_obj_id, $a_ref_id)
Track read access to the object Prevents a call of determineStatus() that would return "not attempted...
static getLPDataForUserFromDb($a_obj_id, $a_user_id)
Get the LP data directly from the database table This can be called from ilLTIConsumer::getLP* method...
global $DIC
Definition: goto.php:24
static trackResult($a_user_id, $a_obj_id, $a_status=self::LP_STATUS_IN_PROGRESS_NUM, $a_percentage)
Track result from the LTI Consumer.
static getLPStatusDataFromDb($a_obj_id, $a_status)
Get the LP status data directly from the database table This can be called from ilLTIConsumer::getLP*...