ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Survey\Participants\InvitationsManager Class Reference

Survey invitations. More...

+ Collaboration diagram for ILIAS\Survey\Participants\InvitationsManager:

Public Member Functions

 __construct (InternalRepoService $repo_service)
 
 remove (int $survey_id, int $user_id)
 Remove invitation. More...
 
 removeAll (int $survey_id)
 
 add (int $survey_id, int $user_id)
 Add invitation. More...
 
 getAllForSurvey (int $survey_id)
 Get invitations for survey. More...
 
 getOpenInvitationsOfUser (int $user_id)
 Get all open invitations of a user. More...
 

Protected Attributes

InvitationsDBRepository $repo
 
Execution RunDBRepository $run_repo
 
Settings SettingsDBRepository $set_repo
 

Detailed Description

Survey invitations.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 31 of file class.InvitationsManager.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Survey\Participants\InvitationsManager::__construct ( InternalRepoService  $repo_service)

Definition at line 37 of file class.InvitationsManager.php.

39 {
40 $this->repo = $repo_service->participants()->invitations();
41 $this->run_repo = $repo_service->execution()->run();
42 $this->set_repo = $repo_service->settings();
43 }

References ILIAS\Survey\InternalRepoService\execution(), ILIAS\Survey\InternalRepoService\participants(), and ILIAS\Survey\InternalRepoService\settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ add()

ILIAS\Survey\Participants\InvitationsManager::add ( int  $survey_id,
int  $user_id 
)

Add invitation.

Parameters
int$survey_idSurvey ID not object ID!
int$user_id

Definition at line 71 of file class.InvitationsManager.php.

74 : void {
75 $this->repo->add($survey_id, $user_id);
76 }

◆ getAllForSurvey()

ILIAS\Survey\Participants\InvitationsManager::getAllForSurvey ( int  $survey_id)

Get invitations for survey.

Parameters
int$survey_idSurvey ID not object ID!
Returns
int[]

Definition at line 83 of file class.InvitationsManager.php.

85 : array {
86 return $this->repo->getAllForSurvey($survey_id);
87 }

◆ getOpenInvitationsOfUser()

ILIAS\Survey\Participants\InvitationsManager::getOpenInvitationsOfUser ( int  $user_id)

Get all open invitations of a user.

Returns
int[] survey ids

Definition at line 93 of file class.InvitationsManager.php.

95 : array {
96 // get all invitations
97 $survey_ids = $this->repo->getAllForUser($user_id);
98
99 // check if user started already
100 $finished_surveys = $this->run_repo->getFinishedSurveysOfUser($user_id);
101
102 $open_surveys = array_filter($survey_ids, static function (int $i) use ($finished_surveys) {
103 return !in_array($i, $finished_surveys, true);
104 });
105
106 // filter all surveys that have ended
107 $has_ended = $this->set_repo->hasEnded($open_surveys);
108 $open_surveys = array_filter($open_surveys, static function (int $i) use ($has_ended): bool {
109 return !($has_ended[$i] ?? false);
110 });
111
112 return $open_surveys;
113 }

◆ remove()

ILIAS\Survey\Participants\InvitationsManager::remove ( int  $survey_id,
int  $user_id 
)

Remove invitation.

Parameters
int$survey_idSurvey ID not object ID!
int$user_id

Definition at line 51 of file class.InvitationsManager.php.

54 : void {
55 $this->repo->remove($survey_id, $user_id);
56 }

References $user_id.

◆ removeAll()

ILIAS\Survey\Participants\InvitationsManager::removeAll ( int  $survey_id)

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

60 : void {
61 $this->repo->removeAll($survey_id);
62 }

Field Documentation

◆ $repo

InvitationsDBRepository ILIAS\Survey\Participants\InvitationsManager::$repo
protected

Definition at line 33 of file class.InvitationsManager.php.

◆ $run_repo

Execution RunDBRepository ILIAS\Survey\Participants\InvitationsManager::$run_repo
protected

Definition at line 34 of file class.InvitationsManager.php.

◆ $set_repo

Settings SettingsDBRepository ILIAS\Survey\Participants\InvitationsManager::$set_repo
protected

Definition at line 35 of file class.InvitationsManager.php.


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