ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLPStatusQuestions.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=0);
26{
27 public static function _getInProgress(int $a_obj_id): array
28 {
29 $users = ilChangeEvent::lookupUsersInProgress($a_obj_id);
30
31 // Exclude all users with status completed.
32 $users = array_diff(
33 $users,
35 );
36
37 return $users;
38 }
39
40 public static function _getCompleted(int $a_obj_id): array
41 {
42 $usr_ids = array();
43
44 $users = ilChangeEvent::lookupUsersInProgress($a_obj_id);
45
46 foreach ($users as $user_id) {
47 // :TODO: this ought to be optimized
48 $tracker = ilLMTracker::getInstanceByObjId($a_obj_id, $user_id);
49 if ($tracker->getAllQuestionsCorrect()) {
50 $usr_ids[] = $user_id;
51 }
52 }
53
54 return $usr_ids;
55 }
56
57 public function determineStatus(
58 int $a_obj_id,
59 int $a_usr_id,
60 ?object $a_obj = null
61 ): int {
62 $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
63
64 if (ilChangeEvent::hasAccessed($a_obj_id, $a_usr_id)) {
66
67 $tracker = ilLMTracker::getInstanceByObjId($a_obj_id, $a_usr_id);
68 if ($tracker->getAllQuestionsCorrect()) {
70 }
71 }
72
73 return $status;
74 }
75}
static hasAccessed(int $a_obj_id, int $a_usr_id)
Has accessed.
static lookupUsersInProgress(int $a_obj_id)
static getInstanceByObjId(int $a_obj_id, int $a_user_id=0)
determineStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null)
static _getCompleted(int $a_obj_id)
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