ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilIndividualAssessmentMembers Class Reference

Member administration related logic, add and remove members, get the list of all members, etc. More...

+ Inheritance diagram for ilIndividualAssessmentMembers:
+ Collaboration diagram for ilIndividualAssessmentMembers:

Public Member Functions

 __construct (ilObjIndividualAssessment $iass)
 
 count ()
 Countable Methods. More...
 
 current ()
 Iterator Methods. More...
 
 key ()
 
 next ()
 
 rewind ()
 
 valid ()
 
 referencedObject ()
 Get the Individual assessment object that is corresponding to this. More...
 
 recordOK (array $record)
 Check the validity of a record before adding it to this. More...
 
 userAllreadyMemberByUsrId ($usr_id)
 Check if a user with user_id is member of this. More...
 
 userAllreadyMember (ilObjUser $usr)
 Check if a user is member of this. More...
 
 withAdditionalRecord (array $record)
 Clone this and add an additional record. More...
 
 withAdditionalUser (ilObjUser $usr)
 Clone this and add an additional record created for user. More...
 
 withoutPresentUser (ilObjUser $usr)
 Clone this andremove record corresponding to user. More...
 
 membersIds ()
 Get the ids of all the users being member in this iass. More...
 
 updateStorageAndRBAC (ilIndividualAssessmentMembersStorage $storage, IndividualAssessmentAccessHandler $access_handler)
 Store the data to a persistent medium. More...
 

Data Fields

const FIELD_FIRSTNAME = 'firstname'
 
const FIELD_LASTNAME = 'lastname'
 
const FIELD_LOGIN = 'login'
 
const FIELD_USR_ID = 'usr_id'
 
const FIELD_LEARNING_PROGRESS = 'learning_progress'
 
const FIELD_EXAMINER_ID = 'examiner_id'
 
const FIELD_EXAMINER_FIRSTNAME = 'examiner_firstname'
 
const FIELD_EXAMINER_LASTNAME = 'examiner_lastname'
 
const FIELD_RECORD = 'record'
 
const FIELD_INTERNAL_NOTE = 'internal_note'
 
const FIELD_NOTIFY = 'notify'
 
const FIELD_FINALIZED = 'finalized'
 
const FIELD_NOTIFICATION_TS = 'notification_ts'
 
const LP_NOT_ATTEMPTED = ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM
 
const LP_IN_PROGRESS = ilLPStatus::LP_STATUS_IN_PROGRESS_NUM
 
const LP_COMPLETED = ilLPStatus::LP_STATUS_COMPLETED_NUM
 
const LP_FAILED = ilLPStatus::LP_STATUS_FAILED_NUM
 

Protected Member Functions

 userExists ($usr_id)
 
 buildNewRecordOfUser (ilObjUser $usr)
 

Protected Attributes

 $member_records = array()
 
 $position = 0
 
 $iass
 

Detailed Description

Member administration related logic, add and remove members, get the list of all members, etc.

Author
Denis Klöpfer denis.nosp@m..klo.nosp@m.epfer.nosp@m.@con.nosp@m.cepts.nosp@m.-and.nosp@m.-trai.nosp@m.ning.nosp@m..de

Definition at line 12 of file class.ilIndividualAssessmentMembers.php.

Constructor & Destructor Documentation

◆ __construct()

ilIndividualAssessmentMembers::__construct ( ilObjIndividualAssessment  $iass)

Definition at line 36 of file class.ilIndividualAssessmentMembers.php.

References $iass.

Member Function Documentation

◆ buildNewRecordOfUser()

ilIndividualAssessmentMembers::buildNewRecordOfUser ( ilObjUser  $usr)
protected

Definition at line 157 of file class.ilIndividualAssessmentMembers.php.

157 {
158 return array(
159 self::FIELD_USR_ID => $usr->getId()
160 , self::FIELD_RECORD => $this->iass->getSettings()->recordTemplate()
161 , self::FIELD_NOTIFY => 0
162 , self::FIELD_FIRSTNAME => $usr->getFirstname()
163 , self::FIELD_LASTNAME => $usr->getLastname()
164 , self::FIELD_LOGIN => $usr->getLogin()
165 , self::FIELD_LEARNING_PROGRESS => self::LP_NOT_ATTEMPTED
166 , self::FIELD_EXAMINER_ID => null
167 , self::FIELD_EXAMINER_FIRSTNAME => null
168 , self::FIELD_EXAMINER_LASTNAME => null
169 , self::FIELD_INTERNAL_NOTE => null
170 , self::FIELD_FINALIZED => 0
171 );
172 }
getLastname()
get lastname @access public
getFirstname()
get firstname @access public
getLogin()
get login / username @access public
getId()
get object id @access public

References ilObjUser\getFirstname(), ilObject\getId(), ilObjUser\getLastname(), and ilObjUser\getLogin().

Referenced by withAdditionalUser().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ count()

ilIndividualAssessmentMembers::count ( )

Countable Methods.

Definition at line 43 of file class.ilIndividualAssessmentMembers.php.

43 {
44 return count($this->member_records);
45 }

References count().

Referenced by count(), and valid().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ current()

ilIndividualAssessmentMembers::current ( )

Iterator Methods.

Definition at line 50 of file class.ilIndividualAssessmentMembers.php.

50 {
51 return current($this->member_records);
52 }

References current().

Referenced by current().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ key()

ilIndividualAssessmentMembers::key ( )

Definition at line 54 of file class.ilIndividualAssessmentMembers.php.

54 {
55 return key($this->member_records);
56 }

References key().

Referenced by key().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ membersIds()

ilIndividualAssessmentMembers::membersIds ( )

Get the ids of all the users being member in this iass.

Returns
int|string[]

Definition at line 197 of file class.ilIndividualAssessmentMembers.php.

197 {
198 return array_keys($this->member_records);
199 }

◆ next()

ilIndividualAssessmentMembers::next ( )

Definition at line 58 of file class.ilIndividualAssessmentMembers.php.

58 {
59 $this->position++;
60 next($this->member_records);
61 }

References next().

Referenced by next().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ recordOK()

ilIndividualAssessmentMembers::recordOK ( array  $record)

Check the validity of a record before adding it to this.

Parameters
int | string | null[]$record
Returns
bool

Definition at line 87 of file class.ilIndividualAssessmentMembers.php.

87 {
88 if(isset($record[self::FIELD_USR_ID])) {
89 if(!$this->userExists($record[self::FIELD_USR_ID])
90 || $this->userAllreadyMemberByUsrId($record[self::FIELD_USR_ID])) {
91 return false;
92 }
93 }
94 if(!in_array($record[self::FIELD_LEARNING_PROGRESS],
95 array(self::LP_NOT_ATTEMPTED, self::LP_FAILED, self::LP_COMPLETED, self::LP_IN_PROGRESS))) {
96 return false;
97 }
98 return true;
99 }
userAllreadyMemberByUsrId($usr_id)
Check if a user with user_id is member of this.

References userAllreadyMemberByUsrId(), and userExists().

Referenced by withAdditionalRecord().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ referencedObject()

ilIndividualAssessmentMembers::referencedObject ( )

Get the Individual assessment object that is corresponding to this.

Returns
ilObjIndividualAssessment

Definition at line 77 of file class.ilIndividualAssessmentMembers.php.

77 {
78 return $this->iass;
79 }

References $iass.

Referenced by updateStorageAndRBAC().

+ Here is the caller graph for this function:

◆ rewind()

ilIndividualAssessmentMembers::rewind ( )

Definition at line 63 of file class.ilIndividualAssessmentMembers.php.

63 {
64 $this->position = 0;
65 reset($this->member_records);
66 }

◆ updateStorageAndRBAC()

ilIndividualAssessmentMembers::updateStorageAndRBAC ( ilIndividualAssessmentMembersStorage  $storage,
IndividualAssessmentAccessHandler  $access_handler 
)

Store the data to a persistent medium.

Parameters
ilIndividualAssessmentMembersStorage$storage
IndividualAssessmentAccessHandler$access_handler

Definition at line 207 of file class.ilIndividualAssessmentMembers.php.

207 {
208 $current = $storage->loadMembers($this->referencedObject());
209 $iass = $this->referencedObject();
210 foreach($this as $usr_id => $record) {
211 if(!$current->userAllreadyMemberByUsrId($usr_id)) {
212 $storage->insertMembersRecord($this->referencedObject(),$record);
213 $access_handler->assignUserToMemberRole(new ilObjUser($usr_id),$iass);
214 }
215 }
216 foreach($current as $usr_id => $record) {
217 if(!$this->userAllreadyMemberByUsrId($usr_id)) {
218 $storage->removeMembersRecord($this->referencedObject(),$record);
219 $access_handler->deassignUserFromMemberRole(new ilObjUser($usr_id),$iass);
220 }
221 }
222 }
referencedObject()
Get the Individual assessment object that is corresponding to this.
assignUserToMemberRole(ilObjUser $usr, ilObjIndividualAssessment $iass)
Assign a user to the member role at an Individual assessment.
deassignUserFromMemberRole(ilObjUser $usr, ilObjIndividualAssessment $iass)
Deasign a user from the member role at an Individual assessment.
insertMembersRecord(ilObjIndividualAssessment $iass, array $record)
Create a membership inside storage.
removeMembersRecord(ilObjIndividualAssessment $iass, array $record)
Remove a membership associated with a IndividualAssessment object inside storage.
loadMembers(ilObjIndividualAssessment $obj)
Get ilIndividualAssessmentMembers-object containing meberinfo associated with $obj.

References $iass, IndividualAssessmentAccessHandler\assignUserToMemberRole(), IndividualAssessmentAccessHandler\deassignUserFromMemberRole(), ilIndividualAssessmentMembersStorage\insertMembersRecord(), ilIndividualAssessmentMembersStorage\loadMembers(), referencedObject(), ilIndividualAssessmentMembersStorage\removeMembersRecord(), and userAllreadyMemberByUsrId().

Referenced by ilObjIndividualAssessment\updateMembers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ userAllreadyMember()

ilIndividualAssessmentMembers::userAllreadyMember ( ilObjUser  $usr)

Check if a user is member of this.

Parameters
ilObjUser$usr
Returns
bool

Definition at line 117 of file class.ilIndividualAssessmentMembers.php.

117 {
118 return $this->userAllreadyMemberByUsrId($usr->getId());
119 }

References ilObject\getId(), and userAllreadyMemberByUsrId().

Referenced by withAdditionalUser().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ userAllreadyMemberByUsrId()

ilIndividualAssessmentMembers::userAllreadyMemberByUsrId (   $usr_id)

Check if a user with user_id is member of this.

Parameters
int | string$usr_id
Returns
bool

Definition at line 107 of file class.ilIndividualAssessmentMembers.php.

107 {
108 return isset($this->member_records[$usr_id]);
109 }

Referenced by recordOK(), updateStorageAndRBAC(), and userAllreadyMember().

+ Here is the caller graph for this function:

◆ userExists()

ilIndividualAssessmentMembers::userExists (   $usr_id)
protected

Definition at line 121 of file class.ilIndividualAssessmentMembers.php.

121 {
122 return ilObjUser::_exists($usr_id,false,'usr');
123 }
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public

References ilObject\_exists().

Referenced by recordOK().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ valid()

ilIndividualAssessmentMembers::valid ( )

Definition at line 68 of file class.ilIndividualAssessmentMembers.php.

68 {
69 return $this->position < count($this->member_records);
70 }

References count().

+ Here is the call graph for this function:

◆ withAdditionalRecord()

ilIndividualAssessmentMembers::withAdditionalRecord ( array  $record)

Clone this and add an additional record.

Parameters
int | string | null[]$record
Returns
ilIndividualAssessmentMembers
Exceptions
ilIndividualAssessmentException

Definition at line 132 of file class.ilIndividualAssessmentMembers.php.

132 {
133 if($this->recordOK($record)) {
134 $clone = clone $this;
135 $clone->member_records[$record[self::FIELD_USR_ID]] = $record;
136 return $clone;
137 }
138 throw new ilIndividualAssessmentException('illdefined record');
139 }
recordOK(array $record)
Check the validity of a record before adding it to this.

References FIELD_USR_ID, and recordOK().

+ Here is the call graph for this function:

◆ withAdditionalUser()

ilIndividualAssessmentMembers::withAdditionalUser ( ilObjUser  $usr)

Clone this and add an additional record created for user.

Parameters
ilObjUser$usr
Returns
ilIndividualAssessmentMembers
Exceptions
ilIndividualAssessmentException

Definition at line 148 of file class.ilIndividualAssessmentMembers.php.

148 {
149 if(!$this->userAllreadyMember($usr)) {
150 $clone = clone $this;
151 $clone->member_records[$usr->getId()] = $this->buildNewRecordOfUser($usr);
152 return $clone;
153 }
154 throw new ilIndividualAssessmentException('User allready member');
155 }
userAllreadyMember(ilObjUser $usr)
Check if a user is member of this.

References buildNewRecordOfUser(), ilObject\getId(), and userAllreadyMember().

+ Here is the call graph for this function:

◆ withoutPresentUser()

ilIndividualAssessmentMembers::withoutPresentUser ( ilObjUser  $usr)

Clone this andremove record corresponding to user.

Parameters
ilObjUser$usr
Returns
ilIndividualAssessmentMembers
Exceptions
ilIndividualAssessmentException

Definition at line 181 of file class.ilIndividualAssessmentMembers.php.

181 {
182 $usr_id = $usr->getId();
183 if(isset($this->member_records[$usr_id]) && (string)$this->member_records[$usr_id][self::FIELD_FINALIZED] !== "1") {
184 $clone = clone $this;
185 unset($clone->member_records[$usr->getId()]);
186 return $clone;
187 }
188 throw new ilIndividualAssessmentException('User not member or allready finished');
189 }

References ilObject\getId().

+ Here is the call graph for this function:

Field Documentation

◆ $iass

ilIndividualAssessmentMembers::$iass
protected

◆ $member_records

ilIndividualAssessmentMembers::$member_records = array()
protected

Definition at line 13 of file class.ilIndividualAssessmentMembers.php.

◆ $position

ilIndividualAssessmentMembers::$position = 0
protected

Definition at line 14 of file class.ilIndividualAssessmentMembers.php.

◆ FIELD_EXAMINER_FIRSTNAME

const ilIndividualAssessmentMembers::FIELD_EXAMINER_FIRSTNAME = 'examiner_firstname'

◆ FIELD_EXAMINER_ID

◆ FIELD_EXAMINER_LASTNAME

const ilIndividualAssessmentMembers::FIELD_EXAMINER_LASTNAME = 'examiner_lastname'

◆ FIELD_FINALIZED

const ilIndividualAssessmentMembers::FIELD_FINALIZED = 'finalized'

◆ FIELD_FIRSTNAME

const ilIndividualAssessmentMembers::FIELD_FIRSTNAME = 'firstname'

◆ FIELD_INTERNAL_NOTE

const ilIndividualAssessmentMembers::FIELD_INTERNAL_NOTE = 'internal_note'

◆ FIELD_LASTNAME

const ilIndividualAssessmentMembers::FIELD_LASTNAME = 'lastname'

◆ FIELD_LEARNING_PROGRESS

◆ FIELD_LOGIN

const ilIndividualAssessmentMembers::FIELD_LOGIN = 'login'

◆ FIELD_NOTIFICATION_TS

const ilIndividualAssessmentMembers::FIELD_NOTIFICATION_TS = 'notification_ts'

◆ FIELD_NOTIFY

const ilIndividualAssessmentMembers::FIELD_NOTIFY = 'notify'

◆ FIELD_RECORD

◆ FIELD_USR_ID

◆ LP_COMPLETED

◆ LP_FAILED

◆ LP_IN_PROGRESS

◆ LP_NOT_ATTEMPTED


The documentation for this class was generated from the following file: