ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilIndividualAssessmentLPInterface.php
Go to the documentation of this file.
1 <?php
2 
3 require_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
4 require_once 'Modules/IndividualAssessment/classes/Members/class.ilIndividualAssessmentMembersStorageDB.php';
6 {
7  protected static $members_storage = null;
8 
9  public static function updateLPStatusOfMember(ilIndividualAssessmentMember $member)
10  {
11  ilLPStatusWrapper::_refreshStatus($member->assessmentId(), array($member->id()));
12  }
13 
14 
15  public static function updateLPStatusByIds($iass_id, array $usr_ids)
16  {
17  ilLPStatusWrapper::_refreshStatus($iass_id, $usr_ids);
18  }
19 
20  public static function determineStatusOfMember($iass_id, $usr_id)
21  {
22  if (self::$members_storage === null) {
23  self::$members_storage = self::getMembersStorage();
24  }
25  $iass = new ilObjIndividualAssessment($iass_id, false);
26  $members = $iass->loadMembers($iass);
27  $usr = new ilObjUser($usr_id);
28  if ($members->userAllreadyMember($usr)) {
29  $member = self::$members_storage->loadMember($iass, $usr);
30  if ($member->finalized()) {
31  return $member->LPStatus();
32  } elseif (in_array($member->LPStatus(), array(ilIndividualAssessmentMembers::LP_FAILED, ilIndividualAssessmentMembers::LP_COMPLETED))) {
34  }
35  }
37  }
38 
39  protected static function getMembersStorage()
40  {
41  global $DIC;
42  return new ilIndividualAssessmentMembersStorageDB($DIC['ilDB']);
43  }
44 
45  public static function getMembersHavingStatusIn($iass_id, $status)
46  {
47  if (self::$members_storage === null) {
48  self::$members_storage = self::getMembersStorage();
49  }
50  $members = self::$members_storage->loadMembers(new ilObjIndividualAssessment($iass_id, false));
51  $return = array();
52  foreach ($members as $usr_id => $record) {
53  if ((string) self::determineStatusOfMember($iass_id, $usr_id) === (string) $status) {
54  $return[] = $usr_id;
55  }
56  }
57  return $return;
58  }
59 
60  public static function isActiveLP($a_object_id)
61  {
62  require_once 'Modules/IndividualAssessment/classes/class.ilIndividualAssessmentLP.php';
63  return ilIndividualAssessmentLP::getInstance($a_object_id)->isActive();
64  }
65 }
For the purpose of streamlining the grading and learning-process status definition outside of tests...
global $DIC
Definition: saml.php:7
const LP_STATUS_IN_PROGRESS_NUM
static updateLPStatusOfMember(ilIndividualAssessmentMember $member)
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
Edit the record of a user, set LP.
const LP_STATUS_NOT_ATTEMPTED_NUM
assessmentId()
Get the ilObjIndividualAssessment id corresponding to this membership.
id()
Get the user id corresponding to this membership.
static getInstance($a_obj_id)