ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ilMailingListsGUI Class Reference
+ Collaboration diagram for ilMailingListsGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 confirmDelete ()
 
 performDelete ()
 
 mailToList ()
 
 showMailingLists ()
 
 cancel ()
 
 saveForm ()
 
 showForm ()
 
 showMembersList ()
 
 confirmDeleteMembers ()
 
 performDeleteMembers ()
 
 saveAssignmentForm ()
 
 showAssignmentForm (?StandardForm $form=null)
 

Private Member Functions

 getQueryMailingListId ()
 
 handleMailingListMemberActions ()
 
 handleMailingListActions ()
 
 getMailingListIdsFromRequest ()
 
 initForm ()
 

Private Attributes

readonly ILIAS HTTP GlobalHttpState $http
 
readonly Refinery $refinery
 
readonly ilGlobalTemplateInterface $tpl
 
readonly ilCtrlInterface $ctrl
 
readonly ilLanguage $lng
 
readonly ilObjUser $user
 
readonly ilErrorHandling $error
 
readonly ilToolbarGUI $toolbar
 
readonly ilRbacSystem $rbacsystem
 
readonly ilFormatMail $umail
 
readonly ilMailingLists $mlists
 
StandardForm $form
 
readonly ILIAS UI Factory $ui_factory
 
readonly ILIAS UI Renderer $ui_renderer
 
readonly ilTabsGUI $tabs
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilMailingListsGUI::__construct ( )

Definition at line 44 of file class.ilMailingListsGUI.php.

References $DIC, ILIAS\Repository\ctrl(), getQueryMailingListId(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

45  {
46  global $DIC;
47 
48  $this->tpl = $DIC->ui()->mainTemplate();
49  $this->ctrl = $DIC['ilCtrl'];
50  $this->lng = $DIC['lng'];
51  $this->rbacsystem = $DIC['rbacsystem'];
52  $this->user = $DIC['ilUser'];
53  $this->error = $DIC['ilErr'];
54  $this->toolbar = $DIC['ilToolbar'];
55  $this->http = $DIC->http();
56  $this->refinery = $DIC->refinery();
57  $this->ui_factory = $DIC->ui()->factory();
58  $this->ui_renderer = $DIC->ui()->renderer();
59  $this->tabs = $DIC->tabs();
60 
61  $this->umail = new ilFormatMail($this->user->getId());
62  $this->mlists = new ilMailingLists($this->user);
63  $this->mlists->setCurrentMailingList($this->getQueryMailingListId());
64 
65  $this->ctrl->saveParameter($this, 'mobj_id');
66  $this->ctrl->saveParameter($this, 'ref');
67 
68  $this->lng->loadLanguageModule('mail');
69  }
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:

Member Function Documentation

◆ cancel()

ilMailingListsGUI::cancel ( )

Definition at line 327 of file class.ilMailingListsGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\refinery(), and showMailingLists().

327  : void
328  {
329  if (
330  $this->http->wrapper()->query()->has('ref') &&
331  $this->http->wrapper()->query()->retrieve('ref', $this->refinery->kindlyTo()->string()) === 'mail') {
332  $this->ctrl->returnToParent($this);
333  }
334 
335  $this->showMailingLists();
336  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ confirmDelete()

ilMailingListsGUI::confirmDelete ( )

Definition at line 175 of file class.ilMailingListsGUI.php.

References ILIAS\Repository\ctrl(), getMailingListIdsFromRequest(), ILIAS\Repository\lng(), and showMailingLists().

Referenced by handleMailingListActions().

175  : bool
176  {
177  $ml_ids = $this->getMailingListIdsFromRequest();
178  if ($ml_ids === []) {
179  $this->tpl->setOnScreenMessage('info', $this->lng->txt('mail_select_one_entry'));
180  $this->showMailingLists();
181  return true;
182  }
183 
184  if ((string) current($ml_ids) === 'ALL_OBJECTS') {
185  $entries = $this->mlists->getAll();
186  } else {
187  $entries = $this->mlists->getSelected(
188  array_map(intval(...), $ml_ids)
189  );
190  }
191 
192  $c_gui = new ilConfirmationGUI();
193 
194  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDelete'));
195  $c_gui->setHeaderText($this->lng->txt('mail_sure_delete_entry'));
196  $c_gui->setCancel($this->lng->txt('cancel'), 'showMailingLists');
197  $c_gui->setConfirm($this->lng->txt('confirm'), 'performDelete');
198 
199  foreach ($entries as $entry) {
200  $c_gui->addItem('ml_id[]', (string) $entry->getId(), $entry->getTitle());
201  }
202 
203  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
204  $this->tpl->setContent($c_gui->getHTML());
205  $this->tpl->printToStdout();
206 
207  return true;
208  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeleteMembers()

ilMailingListsGUI::confirmDeleteMembers ( )

Definition at line 478 of file class.ilMailingListsGUI.php.

References ILIAS\Repository\ctrl(), ilUserUtil\getNamePresentation(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and showMembersList().

Referenced by handleMailingListMemberActions().

478  : bool
479  {
480  $requested_record_ids = $this->http->wrapper()->query()->retrieve(
481  'contact_mailinglist_members_entry_ids',
482  $this->refinery->byTrying([
483  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string()),
484  $this->refinery->always([])
485  ])
486  );
487 
488  if ($requested_record_ids === []) {
489  $this->tpl->setOnScreenMessage('info', $this->lng->txt('mail_select_one_entry'));
490  $this->showMembersList();
491 
492  return true;
493  }
494 
495  if ((string) current($requested_record_ids) === 'ALL_OBJECTS') {
496  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
497  $requested_record_ids = [];
498  foreach ($assigned_entries as $entry) {
499  $requested_record_ids[] = $entry['a_id'];
500  }
501  } else {
502  $requested_record_ids = array_map(intval(...), $requested_record_ids);
503  }
504 
505  $c_gui = new ilConfirmationGUI();
506  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
507  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDeleteMembers'));
508  $c_gui->setHeaderText($this->lng->txt('mail_sure_remove_user'));
509  $c_gui->setCancel($this->lng->txt('cancel'), 'showMembersList');
510  $c_gui->setConfirm($this->lng->txt('confirm'), 'performDeleteMembers');
511 
512  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
513  $usr_ids = array_map(static fn(array $entry): int => $entry['usr_id'], $assigned_entries);
514  $names = ilUserUtil::getNamePresentation($usr_ids, false, false, '', false, false, false);
515 
516  foreach ($assigned_entries as $entry) {
517  if (in_array($entry['a_id'], $requested_record_ids, true)) {
518  $c_gui->addItem('a_id[]', (string) $entry['a_id'], $names[$entry['usr_id']]);
519  }
520  }
521 
522  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
523  $this->tpl->setContent($c_gui->getHTML());
524  $this->tpl->printToStdout();
525 
526  return true;
527  }
static http()
Fetches the global http state from ILIAS.
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path='ilpublicuserprofilegui')
Default behaviour is:
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilMailingListsGUI::executeCommand ( )

Definition at line 92 of file class.ilMailingListsGUI.php.

References ILIAS\Repository\ctrl(), ilBuddySystem\getInstance(), ilBuddyList\getInstanceByGlobalUser(), and ILIAS\Repository\lng().

92  : bool
93  {
94  if (
95  !ilBuddySystem::getInstance()->isEnabled() ||
96  (
97  count(ilBuddyList::getInstanceByGlobalUser()->getLinkedRelations()) === 0 &&
98  !$this->mlists->hasAny()
99  )
100  ) {
101  $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->MESSAGE);
102  }
103 
104  if (!($cmd = $this->ctrl->getCmd())) {
105  $cmd = 'showMailingLists';
106  }
107 
108  $this->$cmd();
109 
110  return true;
111  }
static getInstanceByGlobalUser(?ilObjUser $user=null)
+ Here is the call graph for this function:

◆ getMailingListIdsFromRequest()

ilMailingListsGUI::getMailingListIdsFromRequest ( )
private
Returns
list<int>|list<string>

Definition at line 149 of file class.ilMailingListsGUI.php.

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by confirmDelete(), and mailToList().

149  : array
150  {
151  if ($this->http->wrapper()->query()->has('ml_id')) {
152  $ml_ids = [
153  $this->http->wrapper()->query()->retrieve('ml_id', $this->refinery->kindlyTo()->int())
154  ];
155  } elseif ($this->http->wrapper()->post()->has('ml_id')) {
156  $ml_ids = $this->http->wrapper()->post()->retrieve(
157  'ml_id',
158  $this->refinery->kindlyTo()->listOf(
159  $this->refinery->kindlyTo()->int()
160  )
161  );
162  } else {
163  $ml_ids = $this->http->wrapper()->query()->retrieve(
164  'contact_mailinglist_list_ml_ids',
165  $this->refinery->byTrying([
166  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string()),
167  $this->refinery->always([])
168  ])
169  );
170  }
171 
172  return array_filter($ml_ids);
173  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQueryMailingListId()

ilMailingListsGUI::getQueryMailingListId ( )
private

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

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by __construct().

71  : int
72  {
73  return $this->http->wrapper()->query()->retrieve(
74  'ml_id',
75  $this->refinery->byTrying([
76  $this->refinery->kindlyTo()->int(),
77  $this->refinery->always(
78  current(
79  $this->http->wrapper()->query()->retrieve(
80  'contact_mailinglist_list_ml_ids',
81  $this->refinery->byTrying([
82  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int()),
83  $this->refinery->always([0])
84  ])
85  )
86  ) ?: 0
87  )
88  ])
89  );
90  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleMailingListActions()

ilMailingListsGUI::handleMailingListActions ( )
private

Definition at line 128 of file class.ilMailingListsGUI.php.

References confirmDelete(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), mailToList(), ILIAS\Repository\refinery(), showForm(), and showMembersList().

128  : void
129  {
130  $action = $this->http->wrapper()->query()->retrieve(
131  'contact_mailinglist_list_action',
132  $this->refinery->byTrying([
133  $this->refinery->kindlyTo()->string(),
134  $this->refinery->always('')
135  ])
136  );
137  match ($action) {
138  'mailToList' => $this->mailToList(),
139  'confirmDelete' => $this->confirmDelete(),
140  'showMembersList' => $this->showMembersList(),
141  'showForm' => $this->showForm(),
142  default => $this->ctrl->redirect($this, 'showMailingLists'),
143  };
144  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ handleMailingListMemberActions()

ilMailingListsGUI::handleMailingListMemberActions ( )
private

Definition at line 113 of file class.ilMailingListsGUI.php.

References confirmDeleteMembers(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

113  : void
114  {
115  $action = $this->http->wrapper()->query()->retrieve(
116  'contact_mailinglist_members_action',
117  $this->refinery->byTrying([
118  $this->refinery->kindlyTo()->string(),
119  $this->refinery->always('')
120  ])
121  );
122  match ($action) {
123  'confirmDeleteMembers' => $this->confirmDeleteMembers(),
124  default => $this->ctrl->redirect($this, 'showMailingLists'),
125  };
126  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ initForm()

ilMailingListsGUI::initForm ( )
private

Definition at line 381 of file class.ilMailingListsGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ILIAS\Repository\lng(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by saveForm(), and showForm().

381  : void
382  {
383  $title = $this->ui_factory->input()->field()->text(
384  $this->lng->txt('title')
385  )
386  ->withRequired(true)
387  ->withValue($this->mlists->getCurrentMailingList() ? $this->mlists->getCurrentMailingList()->getTitle() : '');
388 
389  $description = $this->ui_factory->input()->field()->textarea(
390  $this->lng->txt('description')
391  )
392  ->withValue(
393  $this->mlists->getCurrentMailingList() ? $this->mlists->getCurrentMailingList()->getDescription() : ''
394  );
395 
396  $this->form = $this->ui_factory->input()->container()->form()->standard(
397  $this->ctrl->getFormAction($this, 'saveForm'),
398  [
399  'title' => $title,
400  'description' => $description
401  ]
402  );
403  }
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mailToList()

ilMailingListsGUI::mailToList ( )

Definition at line 242 of file class.ilMailingListsGUI.php.

References $id, getMailingListIdsFromRequest(), ILIAS\Repository\lng(), ilUtil\redirect(), showMailingLists(), and ILIAS\Repository\user().

Referenced by handleMailingListActions().

242  : bool
243  {
244  // check if current user may send mails
245  $mail = new ilMail($this->user->getId());
246  $mailing_allowed = $this->rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId());
247 
248  if (!$mailing_allowed) {
249  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('no_permission'));
250  return true;
251  }
252 
253  $ml_ids = $this->getMailingListIdsFromRequest();
254  if ($ml_ids === []) {
255  $this->tpl->setOnScreenMessage('info', $this->lng->txt('mail_select_one_entry'));
256  $this->showMailingLists();
257  return true;
258  }
259 
260  if ((string) current($ml_ids) === 'ALL_OBJECTS') {
261  $entries = $this->mlists->getAll();
262  $ml_ids = [];
263  foreach ($entries as $entry) {
264  $ml_ids[] = $entry->getId();
265  }
266  } else {
267  $ml_ids = array_map(intval(...), $ml_ids);
268  }
269 
270  $mail_data = $this->umail->retrieveFromStage();
271  $lists = [];
272  foreach ($ml_ids as $id) {
273  if ($this->mlists->isOwner($id, $this->user->getId()) &&
274  !$this->umail->existsRecipient('#il_ml_' . $id, (string) $mail_data['rcp_to'])) {
275  $lists['#il_ml_' . $id] = '#il_ml_' . $id;
276  }
277  }
278 
279  if ($lists !== []) {
280  $mail_data = $this->umail->appendSearchResult(array_values($lists), 'to');
281  $this->umail->persistToStage(
282  (int) $mail_data['user_id'],
283  $mail_data['attachments'],
284  $mail_data['rcp_to'],
285  $mail_data['rcp_cc'],
286  $mail_data['rcp_bcc'],
287  $mail_data['m_subject'],
288  $mail_data['m_message'],
289  $mail_data['use_placeholders'],
290  $mail_data['tpl_ctx_id'],
291  $mail_data['tpl_ctx_params']
292  );
293  }
294 
295  ilUtil::redirect('ilias.php?baseClass=ilMailGUI&type=search_res');
296 
297  return true;
298  }
static redirect(string $a_script)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performDelete()

ilMailingListsGUI::performDelete ( )

Definition at line 210 of file class.ilMailingListsGUI.php.

References $id, ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and showMailingLists().

210  : bool
211  {
212  if ($this->http->wrapper()->post()->has('ml_id')) {
213  $ml_ids = array_filter(
214  $this->http->wrapper()->post()->retrieve(
215  'ml_id',
216  $this->refinery->kindlyTo()->listOf(
217  $this->refinery->kindlyTo()->int()
218  )
219  )
220  );
221 
222  $counter = 0;
223  foreach ($ml_ids as $id) {
224  if ($this->mlists->isOwner($id, $this->user->getId())) {
225  $this->mlists->get($id)->delete();
226  ++$counter;
227  }
228  }
229 
230  if ($counter !== 0) {
231  $this->tpl->setOnScreenMessage('success', $this->lng->txt('mail_deleted_entry'));
232  }
233  } else {
234  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('mail_delete_error'));
235  }
236 
237  $this->showMailingLists();
238 
239  return true;
240  }
static http()
Fetches the global http state from ILIAS.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ performDeleteMembers()

ilMailingListsGUI::performDeleteMembers ( )

Definition at line 529 of file class.ilMailingListsGUI.php.

References $form, $id, $relation, ILIAS\Repository\ctrl(), ilBuddyList\getInstanceByGlobalUser(), ilUserUtil\getNamePresentation(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), null, ILIAS\Repository\refinery(), showMembersList(), and ILIAS\Repository\user().

529  : bool
530  {
531  if (!$this->mlists->isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
532  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
533  }
534 
535  if (
536  $this->http->wrapper()->post()->has('a_id') &&
537  ($requested_entry_ids = $this->http->wrapper()->post()->retrieve(
538  'a_id',
539  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
540  )) !== []
541  ) {
542  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
543  foreach ($requested_entry_ids as $id) {
544  if (isset($assigned_entries[$id])) {
545  $this->mlists->getCurrentMailingList()->deleteEntry($id);
546  }
547  }
548  $this->tpl->setOnScreenMessage('success', $this->lng->txt('mail_success_removed_user'));
549  } else {
550  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('mail_delete_error'));
551  }
552 
553  $this->showMembersList();
554 
555  return true;
556  }
static http()
Fetches the global http state from ILIAS.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ saveAssignmentForm()

ilMailingListsGUI::saveAssignmentForm ( )

Definition at line 616 of file class.ilMailingListsGUI.php.

References $data, ilBuddyList\getInstanceByGlobalUser(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), showAssignmentForm(), showMembersList(), and ILIAS\Repository\user().

616  : bool
617  {
618  if (!$this->mlists->isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
619  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
620  }
621 
622  $form = $this->getAssignmentForm();
623  if (!$form) {
624  $this->showAssignmentForm($form);
625 
626  return true;
627  }
628 
629  $form = $form->withRequest($this->http->request());
630  if ($form->getError()) {
631  $this->showAssignmentForm($form);
632 
633  return true;
634  }
635  $data = $form->getData();
636 
637  if (
638  ilBuddyList::getInstanceByGlobalUser()->getRelationByUserId(
639  $this->refinery->kindlyTo()->int()->transform($data['usr_id'])
640  )->isLinked()
641  ) {
642  $this->mlists->getCurrentMailingList()->assignUser(
643  $this->refinery->kindlyTo()->int()->transform($data['usr_id'])
644  );
645  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
646  $this->showMembersList();
647 
648  return true;
649  }
650 
651  $this->showAssignmentForm($form);
652 
653  return true;
654  }
showAssignmentForm(?StandardForm $form=null)
static http()
Fetches the global http state from ILIAS.
static getInstanceByGlobalUser(?ilObjUser $user=null)
+ Here is the call graph for this function:

◆ saveForm()

ilMailingListsGUI::saveForm ( )

Definition at line 338 of file class.ilMailingListsGUI.php.

References $data, ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ILIAS\FileDelivery\http(), initForm(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

338  : void
339  {
340  if ($this->mlists->getCurrentMailingList() && $this->mlists->getCurrentMailingList()->getId()) {
341  if (!$this->mlists->isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
342  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
343  }
344 
345  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
346  }
347  $this->initForm();
348 
349  $form = $this->form->withRequest($this->http->request());
350 
351  if (!$form->getError()) {
352  $data = $form->getData();
353  $this->mlists->getCurrentMailingList()->setTitle(
354  $data['title']
355  );
356  $this->mlists->getCurrentMailingList()->setDescription(
357  $data['description']
358  );
359 
360  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
361  if ($this->mlists->getCurrentMailingList()->getId() > 0) {
362  $this->mlists->getCurrentMailingList()->setChangedate(date('Y-m-d H:i:s'));
363  $this->mlists->getCurrentMailingList()->update();
364  $this->ctrl->redirect($this, 'showMailingLists');
365  } else {
366  $this->mlists->getCurrentMailingList()->setCreatedate(date('Y-m-d H:i:s'));
367  $this->mlists->getCurrentMailingList()->insert();
368 
369  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
370  $this->ctrl->redirect($this, 'showMembersList');
371  }
372  }
373 
374  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
375  $this->tpl->setContent($this->ui_renderer->render([
376  'mailing_lists' => $form
377  ]));
378  $this->tpl->printToStdout();
379  }
static http()
Fetches the global http state from ILIAS.
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:

◆ showAssignmentForm()

ilMailingListsGUI::showAssignmentForm ( ?StandardForm  $form = null)

Definition at line 656 of file class.ilMailingListsGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), showMembersList(), and ILIAS\Repository\user().

Referenced by saveAssignmentForm().

656  : bool
657  {
658  if (!$this->mlists->getCurrentMailingList() || $this->mlists->getCurrentMailingList()->getId() === 0) {
659  $this->showMembersList();
660 
661  return true;
662  }
663 
664  if (!$this->mlists->isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
665  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
666  }
667 
668  if (!$form instanceof StandardForm) {
669  $this->ctrl->redirect($this, 'showMembersList');
670  }
671 
672  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
673  $this->tpl->setContent($this->ui_renderer->render($form));
674  $this->tpl->printToStdout();
675 
676  return true;
677  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showForm()

ilMailingListsGUI::showForm ( )

Definition at line 405 of file class.ilMailingListsGUI.php.

References ILIAS\Repository\ctrl(), initForm(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

Referenced by handleMailingListActions().

405  : void
406  {
407  if ($this->mlists->getCurrentMailingList() && $this->mlists->getCurrentMailingList()->getId()) {
408  if (!$this->mlists->isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
409  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
410  }
411 
412  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
413  }
414  $this->initForm();
415 
416  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
417  $this->tpl->setContent($this->ui_renderer->render([
418  'mailing_lists' => $this->form
419  ]));
420  $this->tpl->printToStdout();
421  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showMailingLists()

ilMailingListsGUI::showMailingLists ( )

Definition at line 300 of file class.ilMailingListsGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

Referenced by cancel(), confirmDelete(), mailToList(), performDelete(), and showMembersList().

300  : bool
301  {
302  $mail = new ilMail($this->user->getId());
303 
304  $this->toolbar->addComponent(
305  $this->ui_factory->button()->standard(
306  $this->lng->txt('create'),
307  $this->ctrl->getLinkTarget($this, 'showForm')
308  )
309  );
310 
311  $tbl = new MailingListsTable(
312  $this->mlists,
313  $this->ctrl,
314  $this->lng,
315  $this->ui_factory,
316  $this->http
317  );
318  $tbl->setMailingAllowed($this->rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId()));
319 
320  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
321  $this->tpl->setContent($this->ui_renderer->render($tbl->getComponent()));
322  $this->tpl->printToStdout();
323 
324  return true;
325  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showMembersList()

ilMailingListsGUI::showMembersList ( )

Definition at line 423 of file class.ilMailingListsGUI.php.

References $ctrl, $http, $lng, $relation, $ui_factory, ILIAS\Repository\ctrl(), ilBuddySystemRelation\getBuddyUsrId(), ilBuddyList\getInstanceByGlobalUser(), ILIAS\Repository\lng(), showMailingLists(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

Referenced by confirmDeleteMembers(), handleMailingListActions(), performDeleteMembers(), saveAssignmentForm(), and showAssignmentForm().

423  : bool
424  {
425  if (!$this->mlists->getCurrentMailingList() || $this->mlists->getCurrentMailingList()->getId() === 0) {
426  $this->showMailingLists();
427 
428  return true;
429  }
430 
431  $this->tabs->clearTargets();
432  $this->tabs->setBackTarget(
433  $this->lng->txt('back'),
434  $this->ctrl->getLinkTarget($this, 'showMailingLists')
435  );
436 
437  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
438 
439  $available_usr_ids = array_diff(
440  array_map(
441  static function (ilBuddySystemRelation $relation): int {
442  return $relation->getBuddyUsrId();
443  },
444  ilBuddyList::getInstanceByGlobalUser()->getLinkedRelations()->toArray()
445  ),
446  array_map(
447  static function (array $entry): int {
448  return $entry['usr_id'];
449  },
450  $this->mlists->getCurrentMailingList()->getAssignedEntries()
451  ),
452  );
453 
454  if ($available_usr_ids !== []) {
455  $this->toolbar->addComponent(
456  $this->ui_factory->button()->standard(
457  $this->lng->txt('add'),
458  $this->ctrl->getLinkTarget($this, 'showAssignmentForm')
459  )
460  );
461  }
462 
463  $tbl = new MailingListsMembersTable(
464  $this->mlists->getCurrentMailingList(),
465  $this->ctrl,
466  $this->lng,
469  );
470 
471  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
472  $this->tpl->setContent($this->ui_renderer->render($tbl->getComponent()));
473  $this->tpl->printToStdout();
474 
475  return true;
476  }
$relation
readonly ilLanguage $lng
readonly ILIAS UI Factory $ui_factory
readonly ILIAS HTTP GlobalHttpState $http
readonly ilCtrlInterface $ctrl
static getInstanceByGlobalUser(?ilObjUser $user=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

readonly ilCtrlInterface ilMailingListsGUI::$ctrl
private

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

Referenced by showMembersList().

◆ $error

readonly ilErrorHandling ilMailingListsGUI::$error
private

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

◆ $form

StandardForm ilMailingListsGUI::$form
private

Definition at line 39 of file class.ilMailingListsGUI.php.

Referenced by performDeleteMembers().

◆ $http

readonly ILIAS HTTP GlobalHttpState ilMailingListsGUI::$http
private

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

Referenced by showMembersList().

◆ $lng

readonly ilLanguage ilMailingListsGUI::$lng
private

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

Referenced by showMembersList().

◆ $mlists

readonly ilMailingLists ilMailingListsGUI::$mlists
private

Definition at line 38 of file class.ilMailingListsGUI.php.

◆ $rbacsystem

readonly ilRbacSystem ilMailingListsGUI::$rbacsystem
private

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

◆ $refinery

readonly Refinery ilMailingListsGUI::$refinery
private

Definition at line 29 of file class.ilMailingListsGUI.php.

◆ $tabs

readonly ilTabsGUI ilMailingListsGUI::$tabs
private

Definition at line 42 of file class.ilMailingListsGUI.php.

◆ $toolbar

readonly ilToolbarGUI ilMailingListsGUI::$toolbar
private

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

◆ $tpl

readonly ilGlobalTemplateInterface ilMailingListsGUI::$tpl
private

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

◆ $ui_factory

readonly ILIAS UI Factory ilMailingListsGUI::$ui_factory
private

Definition at line 40 of file class.ilMailingListsGUI.php.

Referenced by showMembersList().

◆ $ui_renderer

readonly ILIAS UI Renderer ilMailingListsGUI::$ui_renderer
private

Definition at line 41 of file class.ilMailingListsGUI.php.

◆ $umail

readonly ilFormatMail ilMailingListsGUI::$umail
private

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

◆ $user

readonly ilObjUser ilMailingListsGUI::$user
private

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


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