3 declare(strict_types=0);
    18         if (isset($status_info[
'completed'])) {
    19             foreach ($status_info[
'completed'] as $in_progress) {
    20                 $users = array_merge($users, $in_progress);
    22             $users = array_unique($users);
    34         foreach ($status_info[
'items'] as $item_id) {
    35             $tmp_users = $status_info[
'completed'][$item_id];
    40                 $users = array_intersect($users, $tmp_users);
    43         return array_unique($users);
    48         $status_info = array();
    51         $collection = $olp->getCollectionInstance();
    54             $status_info[
"items"] = $collection->getItems($a_obj_id);
    56             foreach ($status_info[
"items"] as $item_id) {
    57                 $status_info[
"completed"][$item_id] = array();
    62             $possible_items = $collection->getPossibleItems(
$ref_id);
    63             $chapter_ids = array_intersect(
    64                 array_keys($possible_items),
    69             $status_info[
"items"] = $chapter_ids;
    72                 $status = self::_getObjectStatus($a_obj_id);
    74                 foreach ($chapter_ids as $item_id) {
    75                     $status_info[
"item_titles"][$item_id] = $possible_items[$item_id][
"title"];
    77                     if (isset($status[$item_id])) {
    78                         foreach ($status[$item_id] as 
$user_id => $user_status) {
    80                                 $status_info[
"completed"][$item_id][] = 
$user_id;
    95         $info = self::_getStatusInfo($a_obj_id);
    97         if (isset($info[
"completed"])) {
   100             foreach ($info[
"completed"] as $user_ids) {
   102                 if (in_array($a_usr_id, $user_ids)) {
   110                 return self::LP_STATUS_COMPLETED_NUM;
   113                 return self::LP_STATUS_IN_PROGRESS_NUM;
   117         return self::LP_STATUS_NOT_ATTEMPTED_NUM;
   126         $ilDB = $DIC[
'ilDB'];
   130         $sql = 
"SELECT subitem_id, completed, usr_id, last_change" .
   131             " FROM ut_lp_coll_manual" .
   132             " WHERE obj_id = " . 
$ilDB->quote($a_obj_id, 
"integer");
   134             $sql .= 
" AND usr_id = " . 
$ilDB->quote($a_user_id, 
"integer");
   136         $set = 
$ilDB->query($sql);
   137         while ($row = 
$ilDB->fetchAssoc($set)) {
   139                 $res[(
int) $row[
"subitem_id"]][(
int) $row[
"usr_id"]] = (
int) $row[
"completed"];
   141                 $res[(
int) $row[
"subitem_id"]] = array((
int) $row[
"completed"],
   152         array $a_completed = null
   156         $ilDB = $DIC[
'ilDB'];
   161             $a_completed = array();
   165         $collection = $olp->getCollectionInstance();
   167             $existing = self::_getObjectStatus($a_obj_id, $a_user_id);
   169             foreach ($collection->getItems() as $item_id) {
   170                 if (isset($existing[$item_id])) {
   172                     if ((!$existing[$item_id][0] && in_array(
   176                         ($existing[$item_id][0] && !in_array(
   181                             "UPDATE ut_lp_coll_manual SET " .
   182                             " completed = " . 
$ilDB->quote(
   183                                 in_array($item_id, $a_completed),
   186                             " , last_change = " . 
$ilDB->quote(
   190                             " WHERE obj_id = " . 
$ilDB->quote(
   194                             " AND usr_id = " . 
$ilDB->quote(
   198                             " AND subitem_id = " . 
$ilDB->quote(
   204                 } elseif (in_array($item_id, $a_completed)) {
   206                         "INSERT INTO ut_lp_coll_manual" .
   207                         "(obj_id,usr_id,subitem_id,completed,last_change)" .
   208                         " VALUES (" . 
$ilDB->quote($a_obj_id, 
"integer") .
   209                         " , " . 
$ilDB->quote($a_user_id, 
"integer") .
   210                         " , " . 
$ilDB->quote($item_id, 
"integer") .
   211                         " , " . 
$ilDB->quote(1, 
"integer") .
   212                         " , " . 
$ilDB->quote($now, 
"integer") . 
")" 
determineStatus(int $a_obj_id, int $a_usr_id, object $a_obj=null)
 
static _getObjectStatus( $a_obj_id, $a_user_id=null)
 
static _getCompleted(int $a_obj_id)
Static function to read the users who have the status 'completed'. 
 
static _getStatusInfo(int $a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits. 
 
static _getAllReferences(int $id)
get all reference ids for object ID 
 
static _getInProgress(int $a_obj_id)
 
static _setObjectStatus(int $a_obj_id, int $a_user_id, array $a_completed=null)
 
static _getCompleted(int $a_obj_id)
 
static _getStatusInfo(int $a_obj_id)
 
static getInstance(int $obj_id)
 
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)