3 declare(strict_types=1);
26 $repo =
$dic[
'repo.assignment'];
31 $assignments = $repo->getAllForNodeIsContained((
int) $obj_id, $usr_id);
34 $assignments = array_filter($assignments, fn ($ass) => !$ass->isRestarted());
44 foreach ($assignments as $ass) {
45 $pgs = $ass->getProgressForNode($prg_obj_id);
46 $pgss[$ass->getId()] = $pgs;
51 $pgss = array_reverse($pgss);
54 if (!$pgs || !$pgs->isRelevant()) {
58 if ($pgs->hasValidQualification($now)) {
64 if ($pgs->isSuccessful() || $pgs->isFailed()) {
84 foreach ($assignments as $ass) {
85 $usr_id = $ass->getUserId();
86 if (!array_key_exists($usr_id, $user_centric)) {
87 $user_centric[$usr_id] = [];
89 $user_centric[$usr_id][] = $ass;
91 foreach ($user_centric as $usr_id => $assignments) {
92 $status = self::getStatusForAssignments($assignments, $prg_obj_id);
93 $matrix[$status][] = $usr_id;
101 throw new \Exception(
'called');
102 return count(self::_getInProgress($a_obj_id));
107 $assignments = self::getAssignments((
int) $a_obj_id);
108 $matrix = self::getAssignmentsLPMatrix($assignments, (
int) $a_obj_id);
114 return count(self::_getCompleted($a_obj_id));
119 $assignments = self::getAssignments((
int) $a_obj_id);
120 $matrix = self::getAssignmentsLPMatrix($assignments, (
int) $a_obj_id);
126 $assignments = self::getAssignments((
int) $a_obj_id);
127 $matrix = self::getAssignmentsLPMatrix($assignments, (
int) $a_obj_id);
133 $assignments = self::getAssignments((
int) $a_obj_id, (
int) $a_user_id);
134 return self::getStatusForAssignments($assignments, (
int) $a_obj_id);
const LP_STATUS_COMPLETED_NUM
static _getFailed($a_obj_id)
const LP_STATUS_IN_PROGRESS_NUM
static getAssignments(int $obj_id, int $usr_id=null)
static getStatusForAssignments(array $assignments, int $prg_obj_id)
static _getInProgress($a_obj_id)
determineStatus($a_obj_id, $a_user_id, $a_obj=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const LP_STATUS_NOT_ATTEMPTED_NUM
static _getCountInProgress($a_obj_id)
static getAssignmentsLPMatrix(array $assignments, int $prg_obj_id)
static _getCountCompleted($a_obj_id)
static _getCompleted($a_obj_id)
const LP_STATUS_FAILED_NUM