19 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 if($assignments === []) {
50 foreach ($assignments as $ass) {
51 $pgs = $ass->getProgressForNode($prg_obj_id);
52 $pgss[$ass->getId()] = $pgs;
53 $sorting[] = $ass->getId();
58 $sorting = array_reverse($sorting);
59 $pgs = $pgss[reset($sorting)];
61 if (!$pgs || !$pgs->isRelevant()) {
65 if ($pgs->hasValidQualification($now)) {
69 if ($pgs->isSuccessful() || $pgs->isFailed()) {
89 foreach ($assignments as $ass) {
90 $usr_id = $ass->getUserId();
91 if (!array_key_exists($usr_id, $user_centric)) {
92 $user_centric[$usr_id] = [];
94 $user_centric[$usr_id][] = $ass;
96 foreach ($user_centric as $usr_id => $assignments) {
97 $status = self::getStatusForAssignments($assignments, $prg_obj_id);
98 $matrix[$status][] = $usr_id;
106 throw new \Exception(
'called');
107 return count(self::_getInProgress($a_obj_id));
112 $assignments = self::getAssignments((
int) $a_obj_id);
113 $matrix = self::getAssignmentsLPMatrix($assignments, (
int) $a_obj_id);
119 return count(self::_getCompleted($a_obj_id));
124 $assignments = self::getAssignments((
int) $a_obj_id);
125 $matrix = self::getAssignmentsLPMatrix($assignments, (
int) $a_obj_id);
131 $assignments = self::getAssignments((
int) $a_obj_id);
132 $matrix = self::getAssignmentsLPMatrix($assignments, (
int) $a_obj_id);
138 $assignments = self::getAssignments((
int) $a_obj_id, (
int) $a_user_id);
139 return self::getStatusForAssignments($assignments, (
int) $a_obj_id);
const LP_STATUS_COMPLETED_NUM
static getAssignments(int $obj_id, ?int $usr_id=null)
static _getFailed($a_obj_id)
const LP_STATUS_IN_PROGRESS_NUM
static getStatusForAssignments(array $assignments, int $prg_obj_id)
determine a status based on a single users collection of assignments.
static _getInProgress($a_obj_id)
sort()
description: > Example for rendering a Sort Glyph.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
determineStatus($a_obj_id, $a_user_id, $a_obj=null)
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