ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilStudyProgrammeMailMemberSearchGUI Class Reference
+ Collaboration diagram for ilStudyProgrammeMailMemberSearchGUI:

Public Member Functions

 __construct (ilCtrl $ctrl, ilGlobalTemplateInterface $tpl, ilLanguage $lng, ilAccessHandler $access, ILIAS\HTTP\Wrapper\WrapperFactory $http_wrapper, ILIAS\Refinery\Factory $refinery, ilPRGPermissionsHelper $permission_helper)
 
 getAssignments ()
 
 setAssignments (array $assignments)
 
 getBackTarget ()
 
 setBackTarget (string $target)
 
 executeCommand ()
 

Protected Member Functions

 showSelectableUsers ()
 
 getProcessData ()
 
 getPRGMembersGUI ()
 
 retrieveUserIds ()
 
 sendMailToSelectedUsers ()
 
 generateContextArray ()
 
 redirectToParent ()
 
 createMailSignature ()
 
 getRootPrgRefId ()
 
 getRootPrgObjId ()
 

Protected Attributes

ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilAccessHandler $access
 
ILIAS HTTP Wrapper WrapperFactory $http_wrapper
 
ILIAS Refinery Factory $refinery
 
array $assignments = []
 
array $user_ids = []
 
ilPRGPermissionsHelper $permission_helper
 

Private Attributes

string $back_target = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammeMailMemberSearchGUI::__construct ( ilCtrl  $ctrl,
ilGlobalTemplateInterface  $tpl,
ilLanguage  $lng,
ilAccessHandler  $access,
ILIAS\HTTP\Wrapper\WrapperFactory  $http_wrapper,
ILIAS\Refinery\Factory  $refinery,
ilPRGPermissionsHelper  $permission_helper 
)

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

References $access, $ctrl, $http_wrapper, $lng, $permission_helper, $refinery, $tpl, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

43  {
44  $this->ctrl = $ctrl;
45  $this->tpl = $tpl;
46  $this->lng = $lng;
47  $this->access = $access;
48  $this->http_wrapper = $http_wrapper;
49  $this->refinery = $refinery;
50  $this->permission_helper = $permission_helper;
51 
52  $this->lng->loadLanguageModule('mail');
53  $this->lng->loadLanguageModule('search');
54  }
+ Here is the call graph for this function:

Member Function Documentation

◆ createMailSignature()

ilStudyProgrammeMailMemberSearchGUI::createMailSignature ( )
protected

Definition at line 225 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References ilLink\_getLink(), getRootPrgRefId(), and ILIAS\Repository\lng().

Referenced by sendMailToSelectedUsers().

225  : string
226  {
227  $link = chr(13) . chr(10) . chr(13) . chr(10);
228  $link .= $this->lng->txt('prg_mail_permanent_link');
229  $link .= chr(13) . chr(10) . chr(13) . chr(10);
230  $link .= ilLink::_getLink($this->getRootPrgRefId());
231  return rawurlencode(base64_encode($link));
232  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilStudyProgrammeMailMemberSearchGUI::executeCommand ( )

Definition at line 76 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References ILIAS\Repository\ctrl(), getProcessData(), redirectToParent(), retrieveUserIds(), sendMailToSelectedUsers(), and showSelectableUsers().

76  : void
77  {
78  $cmd = $this->ctrl->getCmd();
79 
80  $this->ctrl->setReturn($this, '');
81 
82  switch ($cmd) {
83  case 'showSelectableUsers':
84  case 'members':
85  $this->showSelectableUsers();
86  break;
87  case 'sendMailToSelectedUsers':
88  $this->user_ids = $this->retrieveUserIds();
89  $this->sendMailToSelectedUsers();
90  break;
91  case 'mailUserMulti':
92  $this->user_ids = array_keys($this->getProcessData());
93  $this->sendMailToSelectedUsers();
94  break;
95  case 'cancel':
96  $this->redirectToParent();
97  break;
98  default:
99  throw new Exception('Unknown command ' . $cmd);
100  }
101  }
+ Here is the call graph for this function:

◆ generateContextArray()

ilStudyProgrammeMailMemberSearchGUI::generateContextArray ( )
protected

Definition at line 196 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References $ref_id, $type, ilObject\_lookupType(), ILIAS\Repository\access(), ilMailFormCall\CONTEXT_KEY, getRootPrgRefId(), and ilStudyProgrammeMailTemplateContext\ID.

Referenced by sendMailToSelectedUsers().

196  : array
197  {
198  $context_array = [];
199  $ref_id = $this->getRootPrgRefId();
201  switch ($type) {
202  case 'prg':
203  if ($this->access->checkAccess('write', "", $ref_id)) {
204  $context_array = array(
206  'ref_id' => $ref_id,
207  'ts' => time()
208  );
209  }
210  break;
211  }
212  return $context_array;
213  }
$type
$ref_id
Definition: ltiauth.php:67
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAssignments()

ilStudyProgrammeMailMemberSearchGUI::getAssignments ( )

Definition at line 56 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References $assignments.

Referenced by getProcessData(), getRootPrgObjId(), and getRootPrgRefId().

+ Here is the caller graph for this function:

◆ getBackTarget()

ilStudyProgrammeMailMemberSearchGUI::getBackTarget ( )

Definition at line 66 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References $back_target.

Referenced by redirectToParent().

+ Here is the caller graph for this function:

◆ getPRGMembersGUI()

ilStudyProgrammeMailMemberSearchGUI::getPRGMembersGUI ( )
protected

Definition at line 143 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References ilStudyProgrammeDIC\dic().

Referenced by sendMailToSelectedUsers().

144  {
145  return ilStudyProgrammeDIC::dic()['ilObjStudyProgrammeMembersGUI'];
146  }
ilObjStudyProgrammeMembersGUI: ilStudyProgrammeRepositorySearchGUI ilObjStudyProgrammeMembersGUI: il...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProcessData()

ilStudyProgrammeMailMemberSearchGUI::getProcessData ( )
protected

Definition at line 112 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References $data, $name, ilObjUser\_lookupLogin(), ilObjUser\_lookupName(), getAssignments(), and ilOrgUnitOperation\OP_MANAGE_MEMBERS.

Referenced by executeCommand(), and showSelectableUsers().

112  : array
113  {
114  $data = [];
115 
116  foreach ($this->getAssignments() as $assignment) {
117  $user_id = $assignment->getUserId();
118  $name = ilObjUser::_lookupName($user_id);
119  $login = ilObjUser::_lookupLogin($user_id);
120 
121  $publicName = $name['lastname'] . ', ' . $name['firstname'];
122 
123  $data[$user_id]['user_id'] = $user_id;
124  $data[$user_id]['login'] = $login;
125  $data[$user_id]['name'] = $publicName;
126  }
127 
128  $allowed_user_ids = $this->permission_helper->filterUserIds(
129  array_keys($data),
131  );
132 
133  $ret = [];
134  foreach ($data as $usr_id => $entry) {
135  if (in_array($usr_id, $allowed_user_ids)) {
136  $ret[$usr_id] = $entry;
137  }
138  }
139 
140  return $ret;
141  }
static _lookupName(int $a_user_id)
lookup user name
if($format !==null) $name
Definition: metadata.php:247
static _lookupLogin(int $a_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRootPrgObjId()

ilStudyProgrammeMailMemberSearchGUI::getRootPrgObjId ( )
protected

Definition at line 241 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References getAssignments().

Referenced by showSelectableUsers().

241  : int
242  {
243  $assignments = $this->getAssignments();
244  $assignment = array_shift($assignments);
245  return (int) $assignment->getRootId();
246  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRootPrgRefId()

ilStudyProgrammeMailMemberSearchGUI::getRootPrgRefId ( )
protected

Definition at line 234 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References getAssignments(), and ilObjStudyProgramme\getRefIdFor().

Referenced by createMailSignature(), and generateContextArray().

234  : int
235  {
236  $assignments = $this->getAssignments();
237  $assignment = array_shift($assignments);
238  return ilObjStudyProgramme::getRefIdFor($assignment->getRootId());
239  }
static getRefIdFor(int $obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirectToParent()

ilStudyProgrammeMailMemberSearchGUI::redirectToParent ( )
protected

Definition at line 215 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References ILIAS\Repository\ctrl(), and getBackTarget().

Referenced by executeCommand().

215  : void
216  {
217  $back_target = $this->getBackTarget();
218  if (is_null($back_target)) {
219  throw new LogicException("Can't redirect. No back target given.");
220  }
221 
222  $this->ctrl->redirectToURL($back_target);
223  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ retrieveUserIds()

ilStudyProgrammeMailMemberSearchGUI::retrieveUserIds ( )
protected

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

References $user_ids, and ILIAS\Repository\refinery().

Referenced by executeCommand().

148  : array
149  {
150  $user_ids = [];
151  if ($this->http_wrapper->post()->has("user_ids")) {
152  $user_ids = $this->http_wrapper->post()->retrieve(
153  "user_ids",
154  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
155  );
156  }
157  return $user_ids;
158  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendMailToSelectedUsers()

ilStudyProgrammeMailMemberSearchGUI::sendMailToSelectedUsers ( )
protected

Definition at line 160 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References $user_ids, ilObjUser\_lookupLogin(), createMailSignature(), ILIAS\Repository\ctrl(), generateContextArray(), getPRGMembersGUI(), ilMailFormCall\getRedirectTarget(), ILIAS\Repository\lng(), ilMailFormCall\setRecipients(), and showSelectableUsers().

Referenced by executeCommand().

160  : bool
161  {
163  if (!count($user_ids)) {
164  $this->tpl->setOnScreenMessage("failure", $this->lng->txt("no_checkbox"));
165  $this->showSelectableUsers();
166  return false;
167  }
168 
169  $rcps = array();
170  foreach ($user_ids as $usr_id) {
171  $rcps[] = ilObjUser::_lookupLogin($usr_id);
172  }
173 
174  if (!count(array_filter($rcps))) {
175  $this->tpl->setOnScreenMessage("failure", $this->lng->txt("no_checkbox"));
176  $this->showSelectableUsers();
177  return false;
178  }
180 
181  $members_gui = $this->getPRGMembersGUI();
182  $this->ctrl->redirectToURL(ilMailFormCall::getRedirectTarget(
183  $members_gui,
184  'view',
185  array(),
186  array(
187  'type' => 'new',
188  'sig' => $this->createMailSignature()
189  ),
190  $this->generateContextArray()
191  ));
192 
193  return true;
194  }
static setRecipients(array $recipients, string $type='to')
static getRedirectTarget( $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])
static _lookupLogin(int $a_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAssignments()

ilStudyProgrammeMailMemberSearchGUI::setAssignments ( array  $assignments)

Definition at line 61 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References $assignments.

61  : void
62  {
63  $this->assignments = $assignments;
64  }

◆ setBackTarget()

ilStudyProgrammeMailMemberSearchGUI::setBackTarget ( string  $target)

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

71  : void
72  {
73  $this->back_target = $target;
74  }

◆ showSelectableUsers()

ilStudyProgrammeMailMemberSearchGUI::showSelectableUsers ( )
protected

Definition at line 103 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References getProcessData(), and getRootPrgObjId().

Referenced by executeCommand(), and sendMailToSelectedUsers().

103  : void
104  {
105  $this->tpl->loadStandardTemplate();
106  $tbl = new ilStudyProgrammeMailMemberSearchTableGUI($this, $this->getRootPrgObjId(), 'showSelectableUsers');
107  $tbl->setData($this->getProcessData());
108 
109  $this->tpl->setContent($tbl->getHTML());
110  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilStudyProgrammeMailMemberSearchGUI::$access
protected

Definition at line 26 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

Referenced by __construct().

◆ $assignments

array ilStudyProgrammeMailMemberSearchGUI::$assignments = []
protected

Definition at line 30 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

Referenced by getAssignments(), and setAssignments().

◆ $back_target

string ilStudyProgrammeMailMemberSearchGUI::$back_target = null
private

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

Referenced by getBackTarget().

◆ $ctrl

ilCtrl ilStudyProgrammeMailMemberSearchGUI::$ctrl
protected

Definition at line 23 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

Referenced by __construct().

◆ $http_wrapper

ILIAS HTTP Wrapper WrapperFactory ilStudyProgrammeMailMemberSearchGUI::$http_wrapper
protected

Definition at line 27 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

Referenced by __construct().

◆ $lng

ilLanguage ilStudyProgrammeMailMemberSearchGUI::$lng
protected

Definition at line 25 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

Referenced by __construct().

◆ $permission_helper

ilPRGPermissionsHelper ilStudyProgrammeMailMemberSearchGUI::$permission_helper
protected

Definition at line 32 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

Referenced by __construct().

◆ $refinery

ILIAS Refinery Factory ilStudyProgrammeMailMemberSearchGUI::$refinery
protected

Definition at line 28 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

Referenced by __construct().

◆ $tpl

ilGlobalTemplateInterface ilStudyProgrammeMailMemberSearchGUI::$tpl
protected

Definition at line 24 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

Referenced by __construct().

◆ $user_ids

array ilStudyProgrammeMailMemberSearchGUI::$user_ids = []
protected

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