ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilIndividualAssessmentLPInterface.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 {
24 
25  public static function updateLPStatusOfMember(ilIndividualAssessmentMember $member): void
26  {
27  ilLPStatusWrapper::_updateStatus($member->assessmentId(), $member->id());
28  }
29 
30  public static function updateLPStatusByIds(int $iass_id, array $usr_ids): void
31  {
32  foreach ($usr_ids as $usr_id) {
33  ilLPStatusWrapper::_updateStatus($iass_id, $usr_id);
34  }
35  }
36 
37  public static function determineStatusOfMember(int $iass_id, int $usr_id): int
38  {
39  if (self::$members_storage === null) {
40  self::$members_storage = self::getMembersStorage($iass_id);
41  }
42 
43  $iass = new ilObjIndividualAssessment($iass_id, false);
44  $members = $iass->loadMembers();
45  $usr = new ilObjUser($usr_id);
46 
47  if ($members->userAllreadyMember($usr)) {
48  $member = self::$members_storage->loadMember($iass, $usr);
49 
50  if ($member->finalized()) {
51  return $member->LPStatus();
52  } elseif (
53  in_array($member->LPStatus(), [
56  ])
57  ) {
59  }
60  }
61 
63  }
64 
65  protected static function getMembersStorage(int $iass_id): ilIndividualAssessmentMembersStorageDB
66  {
67  global $DIC;
68  $iass = new ilObjIndividualAssessment($iass_id, false);
69  $dic = $iass->getObjectDIC($iass, $DIC);
70  return $dic['iass.member.storage'];
71  }
72 
73  public static function getMembersHavingStatusIn(int $iass_id, int $status): array
74  {
75  if (self::$members_storage === null) {
76  self::$members_storage = self::getMembersStorage($iass_id);
77  }
78  $members = self::$members_storage->loadMembers(new ilObjIndividualAssessment($iass_id, false));
79  $return = array();
80  foreach ($members as $usr_id => $record) {
81  if (self::determineStatusOfMember($iass_id, $usr_id) === $status) {
82  $return[] = $usr_id;
83  }
84  }
85  return $return;
86  }
87 
88  public static function isActiveLP(int $object_id): bool
89  {
90  return ilIndividualAssessmentLP::getInstance($object_id)->isActive();
91  }
92 }
For the purpose of streamlining the grading and learning-process status definition outside of tests...
const LP_STATUS_IN_PROGRESS_NUM
static updateLPStatusOfMember(ilIndividualAssessmentMember $member)
static determineStatusOfMember(int $iass_id, int $usr_id)
static updateLPStatusByIds(int $iass_id, array $usr_ids)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getMembersHavingStatusIn(int $iass_id, int $status)
global $DIC
Definition: shib_login.php:22
Edit the record of a user, set LP.
const LP_STATUS_NOT_ATTEMPTED_NUM
$dic
Definition: result.php:31
static ilIndividualAssessmentMembersStorageDB $members_storage
static getInstance(int $obj_id)
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)