ILIAS  release_7 Revision v7.30-3-g800a261c036
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...
 
 withOnlyUsersByIds ($keep_users_ids)
 Remove all users that do no exist in list of given ids. More...
 
 withAccessHandling (ilOrgUnitPositionAndRBACAccessHandler $access_handler)
 Get a collection like this, but only including users that are visible according to the supplied access handler. 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_CHANGER_ID = "changer_id"
 
const FIELD_CHANGER_FIRSTNAME = "changer_firstname"
 
const FIELD_CHANGER_LASTNAME = "changer_lastname"
 
const FIELD_CHANGE_TIME = "change_time"
 
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 FIELD_PLACE = "place"
 
const FIELD_EVENTTIME = "event_time"
 
const FIELD_FILE_NAME = "file_name"
 
const FIELD_USER_VIEW_FILE = "user_view_file"
 
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
 
const LP_ASSESSMENT_NOT_COMPLETED = "not_completed"
 

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 46 of file class.ilIndividualAssessmentMembers.php.

References $iass.

Member Function Documentation

◆ buildNewRecordOfUser()

ilIndividualAssessmentMembers::buildNewRecordOfUser ( ilObjUser  $usr)
protected

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

184 {
185 return array(
186 self::FIELD_USR_ID => $usr->getId()
187 , self::FIELD_RECORD => $this->iass->getSettings()->getRecordTemplate()
188 , self::FIELD_NOTIFY => 0
189 , self::FIELD_FIRSTNAME => $usr->getFirstname()
190 , self::FIELD_LASTNAME => $usr->getLastname()
191 , self::FIELD_LOGIN => $usr->getLogin()
192 , self::FIELD_LEARNING_PROGRESS => self::LP_NOT_ATTEMPTED
193 , self::FIELD_EXAMINER_ID => null
194 , self::FIELD_EXAMINER_FIRSTNAME => null
195 , self::FIELD_EXAMINER_LASTNAME => null
196 , self::FIELD_INTERNAL_NOTE => null
197 , self::FIELD_FILE_NAME => null
198 , self::FIELD_USER_VIEW_FILE => false
199 , self::FIELD_FINALIZED => 0
200 , self::FIELD_CHANGER_ID => null
201 , self::FIELD_CHANGER_FIRSTNAME => null
202 , self::FIELD_CHANGER_LASTNAME => null
203 );
204 }
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 54 of file class.ilIndividualAssessmentMembers.php.

55 {
56 return count($this->member_records);
57 }

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 62 of file class.ilIndividualAssessmentMembers.php.

63 {
64 return current($this->member_records);
65 }

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 67 of file class.ilIndividualAssessmentMembers.php.

68 {
69 return key($this->member_records);
70 }

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 267 of file class.ilIndividualAssessmentMembers.php.

268 {
269 return array_keys($this->member_records);
270 }

Referenced by withOnlyUsersByIds().

+ Here is the caller graph for this function:

◆ next()

ilIndividualAssessmentMembers::next ( )

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

73 {
74 $this->position++;
75 next($this->member_records);
76 }

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 105 of file class.ilIndividualAssessmentMembers.php.

106 {
107 if (isset($record[self::FIELD_USR_ID])) {
108 if (!$this->userExists($record[self::FIELD_USR_ID])
109 || $this->userAllreadyMemberByUsrId($record[self::FIELD_USR_ID])) {
110 return false;
111 }
112 }
113 if (!in_array(
114 $record[self::FIELD_LEARNING_PROGRESS],
115 array(self::LP_NOT_ATTEMPTED, self::LP_FAILED, self::LP_COMPLETED, self::LP_IN_PROGRESS)
116 )) {
117 return false;
118 }
119 return true;
120 }
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 94 of file class.ilIndividualAssessmentMembers.php.

95 {
96 return $this->iass;
97 }

References $iass.

Referenced by updateStorageAndRBAC().

+ Here is the caller graph for this function:

◆ rewind()

ilIndividualAssessmentMembers::rewind ( )

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

79 {
80 $this->position = 0;
81 reset($this->member_records);
82 }

◆ updateStorageAndRBAC()

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

Store the data to a persistent medium.

Parameters
ilIndividualAssessmentMembersStorage$storage
IndividualAssessmentAccessHandler$access_handler

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

279 {
280 $current = $storage->loadMembers($this->referencedObject());
281 $iass = $this->referencedObject();
282 foreach ($this as $usr_id => $record) {
283 if (!$current->userAllreadyMemberByUsrId($usr_id)) {
284 $storage->insertMembersRecord($this->referencedObject(), $record);
285 $access_handler->assignUserToMemberRole(new ilObjUser($usr_id), $iass);
286 }
287 }
288 foreach ($current as $usr_id => $record) {
289 if (!$this->userAllreadyMemberByUsrId($usr_id)) {
290 $storage->removeMembersRecord($this->referencedObject(), $record);
291 $access_handler->deassignUserFromMemberRole(new ilObjUser($usr_id), $iass);
292 }
293 }
294 }
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 139 of file class.ilIndividualAssessmentMembers.php.

140 {
141 return $this->userAllreadyMemberByUsrId($usr->getId());
142 }

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 128 of file class.ilIndividualAssessmentMembers.php.

129 {
130 return isset($this->member_records[$usr_id]);
131 }

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

+ Here is the caller graph for this function:

◆ userExists()

ilIndividualAssessmentMembers::userExists (   $usr_id)
protected

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

145 {
146 return ilObjUser::_exists($usr_id, false, 'usr');
147 }
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 84 of file class.ilIndividualAssessmentMembers.php.

85 {
86 return $this->position < count($this->member_records);
87 }

References count().

+ Here is the call graph for this function:

◆ withAccessHandling()

ilIndividualAssessmentMembers::withAccessHandling ( ilOrgUnitPositionAndRBACAccessHandler  $access_handler)

Get a collection like this, but only including users that are visible according to the supplied access handler.

Parameters
ilOrgUnitPositionAndRBACAccessHandler$access_handler
Returns
self

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

250 {
251 return $this->withOnlyUsersByIds(
253 "read_learning_progress",
254 "read_learning_progress",
255 $this->referencedObject()->getRefId(),
256 $this->membersIds()
257 )
258 );
259 }
withOnlyUsersByIds($keep_users_ids)
Remove all users that do no exist in list of given ids.
filterUserIdsByRbacOrPositionOfCurrentUser($rbac_perm, $pos_perm, $ref_id, array $user_ids)

References ilOrgUnitPositionAndRBACAccessHandler\filterUserIdsByRbacOrPositionOfCurrentUser(), and withOnlyUsersByIds().

+ 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 156 of file class.ilIndividualAssessmentMembers.php.

157 {
158 if ($this->recordOK($record)) {
159 $clone = clone $this;
160 $clone->member_records[$record[self::FIELD_USR_ID]] = $record;
161 return $clone;
162 }
163 throw new ilIndividualAssessmentException('illdefined record');
164 }
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 173 of file class.ilIndividualAssessmentMembers.php.

174 {
175 if (!$this->userAllreadyMember($usr)) {
176 $clone = clone $this;
177 $clone->member_records[$usr->getId()] = $this->buildNewRecordOfUser($usr);
178 return $clone;
179 }
180 throw new ilIndividualAssessmentException('User allready member');
181 }
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:

◆ withOnlyUsersByIds()

ilIndividualAssessmentMembers::withOnlyUsersByIds (   $keep_users_ids)

Remove all users that do no exist in list of given ids.

Parameters
int[]$keep_users_ids
Returns
self

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

231 {
232 $clone = clone $this;
233
234 $remove = array_diff($this->membersIds(), $keep_users_ids);
235 foreach ($remove as $id) {
236 unset($clone->member_records[$id]);
237 }
238
239 return $clone;
240 }
membersIds()
Get the ids of all the users being member in this iass.

References membersIds().

Referenced by withAccessHandling().

+ Here is the call graph for this function:
+ Here is the caller 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 213 of file class.ilIndividualAssessmentMembers.php.

214 {
215 $usr_id = $usr->getId();
216 if (isset($this->member_records[$usr_id]) && (string) $this->member_records[$usr_id][self::FIELD_FINALIZED] !== "1") {
217 $clone = clone $this;
218 unset($clone->member_records[$usr->getId()]);
219 return $clone;
220 }
221 throw new ilIndividualAssessmentException('User not member or allready finished');
222 }

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 14 of file class.ilIndividualAssessmentMembers.php.

◆ $position

ilIndividualAssessmentMembers::$position = 0
protected

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

◆ FIELD_CHANGE_TIME

const ilIndividualAssessmentMembers::FIELD_CHANGE_TIME = "change_time"

◆ FIELD_CHANGER_FIRSTNAME

const ilIndividualAssessmentMembers::FIELD_CHANGER_FIRSTNAME = "changer_firstname"

◆ FIELD_CHANGER_ID

const ilIndividualAssessmentMembers::FIELD_CHANGER_ID = "changer_id"

◆ FIELD_CHANGER_LASTNAME

const ilIndividualAssessmentMembers::FIELD_CHANGER_LASTNAME = "changer_lastname"

◆ FIELD_EVENTTIME

◆ FIELD_EXAMINER_FIRSTNAME

const ilIndividualAssessmentMembers::FIELD_EXAMINER_FIRSTNAME = 'examiner_firstname'

◆ FIELD_EXAMINER_ID

const ilIndividualAssessmentMembers::FIELD_EXAMINER_ID = 'examiner_id'

◆ FIELD_EXAMINER_LASTNAME

const ilIndividualAssessmentMembers::FIELD_EXAMINER_LASTNAME = 'examiner_lastname'

◆ FIELD_FILE_NAME

◆ FIELD_FINALIZED

◆ FIELD_FIRSTNAME

const ilIndividualAssessmentMembers::FIELD_FIRSTNAME = 'firstname'

◆ FIELD_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

◆ FIELD_PLACE

◆ FIELD_RECORD

◆ FIELD_USER_VIEW_FILE

◆ FIELD_USR_ID

◆ LP_ASSESSMENT_NOT_COMPLETED

◆ LP_COMPLETED

◆ LP_FAILED

◆ LP_IN_PROGRESS

◆ LP_NOT_ATTEMPTED


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