ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLPStatusManual.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=0);
25{
26 public static function _getInProgress(int $a_obj_id): array
27 {
28 $users = ilChangeEvent::lookupUsersInProgress($a_obj_id);
29
30 // Exclude all users with status completed.
31 return array_diff($users, ilLPStatusWrapper::_getCompleted($a_obj_id));
32 }
33
34 public static function _getCompleted(int $a_obj_id): array
35 {
36 global $DIC;
37
38 $ilDB = $DIC['ilDB'];
39
40 $usr_ids = array();
41
42 $query = "SELECT DISTINCT(usr_id) user_id FROM ut_lp_marks " .
43 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
44 "AND completed = '1' ";
45
46 $res = $ilDB->query($query);
47 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
48 $usr_ids[] = (int) $row->user_id;
49 }
50 return $usr_ids;
51 }
52
56 public function determineStatus(
57 int $a_obj_id,
58 int $a_usr_id,
59 ?object $a_obj = null
60 ): int {
61 global $DIC;
62
63 $ilObjDataCache = $DIC['ilObjDataCache'];
64 $ilDB = $DIC['ilDB'];
65
67 switch ($this->ilObjDataCache->lookupType($a_obj_id)) {
68 case 'lm':
69 case 'copa':
70 case 'file':
71 case 'htlm':
72 if (ilChangeEvent::hasAccessed($a_obj_id, $a_usr_id)) {
74
75 // completed?
76 $set = $this->db->query(
77 $q = "SELECT usr_id FROM ut_lp_marks " .
78 "WHERE obj_id = " . $this->db->quote(
79 $a_obj_id,
80 'integer'
81 ) . " " .
82 "AND usr_id = " . $this->db->quote(
83 $a_usr_id,
84 'integer'
85 ) . " " .
86 "AND completed = '1' "
87 );
88 if ($rec = $this->db->fetchAssoc($set)) {
90 }
91 }
92 break;
93 }
94 return $status;
95 }
96
103 public static function _lookupFailedForObject(
104 int $a_obj_id,
105 ?array $a_user_ids = null
106 ): array {
107 return array();
108 }
109}
static hasAccessed(int $a_obj_id, int $a_usr_id)
Has accessed.
static lookupUsersInProgress(int $a_obj_id)
static _lookupFailedForObject(int $a_obj_id, ?array $a_user_ids=null)
Get failed users for object.
static _getCompleted(int $a_obj_id)
determineStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null)
Determine status.
static _getInProgress(int $a_obj_id)
static _getCompleted(int $a_obj_id)
Static function to read the users who have the status 'completed'.
Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ...
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
ilObjectDataCache $ilObjDataCache
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$res
Definition: ltiservices.php:69
global $DIC
Definition: shib_login.php:26
$q
Definition: shib_logout.php:23