ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ILIAS\Survey\Participants\InvitationsManager Class Reference

Survey invitations. More...

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

Public Member Functions

 __construct (InvitationsDBRepository $repo=null, Execution\RunDBRepository $run_repo=null, Settings\SettingsDBRepository $set_repo=null)
 Constructor. More...
 
 remove (int $survey_id, int $user_id)
 Remove invitation. More...
 
 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

 $repo
 
 $run_repo
 
 $set_repo
 

Detailed Description

Survey invitations.

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

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

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Survey\Participants\InvitationsManager::__construct ( InvitationsDBRepository  $repo = null,
Execution\RunDBRepository  $run_repo = null,
Settings\SettingsDBRepository  $set_repo = null 
)

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 72 of file class.InvitationsManager.php.

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

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

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

◆ getOpenInvitationsOfUser()

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

Get all open invitations of a user.

Parameters

return

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

95 {
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, function ($i) use ($finished_surveys) {
103 return !in_array($i, $finished_surveys);
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, function ($i) use ($has_ended) {
109 return !$has_ended[$i];
110 });
111
112 return $open_surveys;
113 }
$i
Definition: metadata.php:24

References $i.

◆ 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 60 of file class.InvitationsManager.php.

61 {
62 $this->repo->remove($survey_id, $user_id);
63 }

Field Documentation

◆ $repo

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

◆ $run_repo

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

◆ $set_repo

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

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