ILIAS  release_8 Revision v8.24
class.ilLPStatusQuestions.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=0);
4/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
5
12{
13 public static function _getInProgress(int $a_obj_id): array
14 {
15 $users = ilChangeEvent::lookupUsersInProgress($a_obj_id);
16
17 // Exclude all users with status completed.
18 $users = array_diff(
19 $users,
21 );
22
23 return $users;
24 }
25
26 public static function _getCompleted(int $a_obj_id): array
27 {
28 $usr_ids = array();
29
30 $users = ilChangeEvent::lookupUsersInProgress($a_obj_id);
31
32 foreach ($users as $user_id) {
33 // :TODO: this ought to be optimized
34 $tracker = ilLMTracker::getInstanceByObjId($a_obj_id, $user_id);
35 if ($tracker->getAllQuestionsCorrect()) {
36 $usr_ids[] = $user_id;
37 }
38 }
39
40 return $usr_ids;
41 }
42
43 public function determineStatus(
44 int $a_obj_id,
45 int $a_usr_id,
46 object $a_obj = null
47 ): int {
48 $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
49
50 if (ilChangeEvent::hasAccessed($a_obj_id, $a_usr_id)) {
52
53 $tracker = ilLMTracker::getInstanceByObjId($a_obj_id, $a_usr_id);
54 if ($tracker->getAllQuestionsCorrect()) {
56 }
57 }
58
59 return $status;
60 }
61}
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