ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilMailingListsGUI Class Reference
+ Collaboration diagram for ilMailingListsGUI:

Public Member Functions

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

Private Member Functions

 getQueryMailingListId ()
 
 handleMailingListMemberActions ()
 
 handleMailingListActions ()
 
 getMailingListIdsFromRequest ()
 
 initForm ()
 
 setValuesByObject ()
 
 setDefaultValues ()
 

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
 
ilPropertyFormGUI $form_gui
 
readonly ILIAS UI Factory $ui_factory
 
readonly ILIAS UI Renderer $ui_renderer
 
readonly ilTabsGUI $tabs
 

Detailed Description

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de

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

Constructor & Destructor Documentation

◆ __construct()

ilMailingListsGUI::__construct ( )

Definition at line 47 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().

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

Member Function Documentation

◆ cancel()

ilMailingListsGUI::cancel ( )

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

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

344  : void
345  {
346  if (
347  $this->http->wrapper()->query()->has('ref') &&
348  $this->http->wrapper()->query()->retrieve('ref', $this->refinery->kindlyTo()->string()) === 'mail') {
349  $this->ctrl->returnToParent($this);
350  }
351 
352  $this->showMailingLists();
353  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ confirmDelete()

ilMailingListsGUI::confirmDelete ( )

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

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

Referenced by handleMailingListActions().

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

◆ confirmDeleteMembers()

ilMailingListsGUI::confirmDeleteMembers ( )

Definition at line 520 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().

520  : bool
521  {
522  $requested_record_ids = $this->http->wrapper()->query()->retrieve(
523  'contact_mailinglist_members_entry_ids',
524  $this->refinery->byTrying([
525  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string()),
526  $this->refinery->always([])
527  ])
528  );
529 
530  if ($requested_record_ids === []) {
531  $this->tpl->setOnScreenMessage('info', $this->lng->txt('mail_select_one_entry'));
532  $this->showMembersList();
533 
534  return true;
535  }
536 
537  if ((string) current($requested_record_ids) === 'ALL_OBJECTS') {
538  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
539  $requested_record_ids = [];
540  foreach ($assigned_entries as $entry) {
541  $requested_record_ids[] = $entry['a_id'];
542  }
543  } else {
544  $requested_record_ids = array_map(intval(...), $requested_record_ids);
545  }
546 
547  $c_gui = new ilConfirmationGUI();
548  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
549  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDeleteMembers'));
550  $c_gui->setHeaderText($this->lng->txt('mail_sure_remove_user'));
551  $c_gui->setCancel($this->lng->txt('cancel'), 'showMembersList');
552  $c_gui->setConfirm($this->lng->txt('confirm'), 'performDeleteMembers');
553 
554  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
555  $usr_ids = array_map(static fn(array $entry): int => $entry['usr_id'], $assigned_entries);
556  $names = ilUserUtil::getNamePresentation($usr_ids, false, false, '', false, false, false);
557 
558  foreach ($assigned_entries as $entry) {
559  if (in_array($entry['a_id'], $requested_record_ids, true)) {
560  $c_gui->addItem('a_id[]', (string) $entry['a_id'], $names[$entry['usr_id']]);
561  }
562  }
563 
564  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
565  $this->tpl->addBlockFile(
566  'ADM_CONTENT',
567  'adm_content',
568  'tpl.mail_mailing_lists_members.html',
569  'components/ILIAS/Contact'
570  );
571  $this->tpl->setVariable('DELETE_CONFIRMATION', $c_gui->getHTML());
572 
573  $this->tpl->printToStdout();
574 
575  return true;
576  }
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 95 of file class.ilMailingListsGUI.php.

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

95  : bool
96  {
97  if (
98  !ilBuddySystem::getInstance()->isEnabled() ||
99  (
100  0 === count(ilBuddyList::getInstanceByGlobalUser()->getLinkedRelations()) &&
101  !$this->mlists->hasAny()
102  )
103  ) {
104  $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->MESSAGE);
105  }
106 
107  if (!($cmd = $this->ctrl->getCmd())) {
108  $cmd = 'showMailingLists';
109  }
110 
111  $this->$cmd();
112 
113  return true;
114  }
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 152 of file class.ilMailingListsGUI.php.

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

Referenced by confirmDelete(), and mailToList().

152  : array
153  {
154  if ($this->http->wrapper()->query()->has('ml_id')) {
155  $ml_ids = [
156  $this->http->wrapper()->query()->retrieve('ml_id', $this->refinery->kindlyTo()->int())
157  ];
158  } elseif ($this->http->wrapper()->post()->has('ml_id')) {
159  $ml_ids = $this->http->wrapper()->post()->retrieve(
160  'ml_id',
161  $this->refinery->kindlyTo()->listOf(
162  $this->refinery->kindlyTo()->int()
163  )
164  );
165  } else {
166  $ml_ids = $this->http->wrapper()->query()->retrieve(
167  'contact_mailinglist_list_ml_ids',
168  $this->refinery->byTrying([
169  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string()),
170  $this->refinery->always([])
171  ])
172  );
173  }
174 
175  return array_filter($ml_ids);
176  }
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 74 of file class.ilMailingListsGUI.php.

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

Referenced by __construct().

74  : int
75  {
76  return $this->http->wrapper()->query()->retrieve(
77  'ml_id',
78  $this->refinery->byTrying([
79  $this->refinery->kindlyTo()->int(),
80  $this->refinery->always(
81  current(
82  $this->http->wrapper()->query()->retrieve(
83  'contact_mailinglist_list_ml_ids',
84  $this->refinery->byTrying([
85  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int()),
86  $this->refinery->always([0])
87  ])
88  )
89  ) ?: 0
90  )
91  ])
92  );
93  }
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 131 of file class.ilMailingListsGUI.php.

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

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

◆ handleMailingListMemberActions()

ilMailingListsGUI::handleMailingListMemberActions ( )
private

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

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

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

◆ initForm()

ilMailingListsGUI::initForm ( )
private

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

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilTextAreaInputGUI\setCols().

Referenced by saveForm(), and showForm().

404  : void
405  {
406  $this->form_gui = new ilPropertyFormGUI();
407  $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'saveForm'));
408  $this->form_gui->setTitle($this->lng->txt('mail_mailing_list'));
409  $titleGui = new ilTextInputGUI($this->lng->txt('title'), 'title');
410  $titleGui->setRequired(true);
411  $this->form_gui->addItem($titleGui);
412  $descriptionGui = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
413  $descriptionGui->setCols(40);
414  $descriptionGui->setRows(8);
415  $this->form_gui->addItem($descriptionGui);
416  $this->form_gui->addCommandButton('saveForm', $this->lng->txt('save'));
417  $this->form_gui->addCommandButton('showMailingLists', $this->lng->txt('cancel'));
418  }
This class represents a text area property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mailToList()

ilMailingListsGUI::mailToList ( )

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

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

Referenced by handleMailingListActions().

252  : bool
253  {
254  // check if current user may send mails
255  $mail = new ilMail($this->user->getId());
256  $mailing_allowed = $this->rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId());
257 
258  if (!$mailing_allowed) {
259  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('no_permission'));
260  return true;
261  }
262 
263  $ml_ids = $this->getMailingListIdsFromRequest();
264  if ($ml_ids === []) {
265  $this->tpl->setOnScreenMessage('info', $this->lng->txt('mail_select_one_entry'));
266  $this->showMailingLists();
267  return true;
268  }
269 
270  if ((string) current($ml_ids) === 'ALL_OBJECTS') {
271  $entries = $this->mlists->getAll();
272  $ml_ids = [];
273  foreach ($entries as $entry) {
274  $ml_ids[] = $entry->getId();
275  }
276  } else {
277  $ml_ids = array_map(intval(...), $ml_ids);
278  }
279 
280  $mail_data = $this->umail->retrieveFromStage();
281  $lists = [];
282  foreach ($ml_ids as $id) {
283  if ($this->mlists->isOwner($id, $this->user->getId()) &&
284  !$this->umail->existsRecipient('#il_ml_' . $id, (string) $mail_data['rcp_to'])) {
285  $lists['#il_ml_' . $id] = '#il_ml_' . $id;
286  }
287  }
288 
289  if ($lists !== []) {
290  $mail_data = $this->umail->appendSearchResult(array_values($lists), 'to');
291  $this->umail->persistToStage(
292  (int) $mail_data['user_id'],
293  $mail_data['attachments'],
294  $mail_data['rcp_to'],
295  $mail_data['rcp_cc'],
296  $mail_data['rcp_bcc'],
297  $mail_data['m_subject'],
298  $mail_data['m_message'],
299  $mail_data['use_placeholders'],
300  $mail_data['tpl_ctx_id'],
301  $mail_data['tpl_ctx_params']
302  );
303  }
304 
305  ilUtil::redirect('ilias.php?baseClass=ilMailGUI&type=search_res');
306 
307  return true;
308  }
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 220 of file class.ilMailingListsGUI.php.

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

220  : bool
221  {
222  if ($this->http->wrapper()->post()->has('ml_id')) {
223  $ml_ids = array_filter(
224  $this->http->wrapper()->post()->retrieve(
225  'ml_id',
226  $this->refinery->kindlyTo()->listOf(
227  $this->refinery->kindlyTo()->int()
228  )
229  )
230  );
231 
232  $counter = 0;
233  foreach ($ml_ids as $id) {
234  if ($this->mlists->isOwner($id, $this->user->getId())) {
235  $this->mlists->get($id)->delete();
236  ++$counter;
237  }
238  }
239 
240  if ($counter !== 0) {
241  $this->tpl->setOnScreenMessage('success', $this->lng->txt('mail_deleted_entry'));
242  }
243  } else {
244  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('mail_delete_error'));
245  }
246 
247  $this->showMailingLists();
248 
249  return true;
250  }
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 578 of file class.ilMailingListsGUI.php.

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

578  : bool
579  {
580  if (!$this->mlists->isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
581  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
582  }
583 
584  if (
585  $this->http->wrapper()->post()->has('a_id') &&
586  ($requested_entry_ids = $this->http->wrapper()->post()->retrieve(
587  'a_id',
588  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
589  )) !== []
590  ) {
591  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
592  foreach ($requested_entry_ids as $id) {
593  if (isset($assigned_entries[$id])) {
594  $this->mlists->getCurrentMailingList()->deleteEntry($id);
595  }
596  }
597  $this->tpl->setOnScreenMessage('success', $this->lng->txt('mail_success_removed_user'));
598  } else {
599  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('mail_delete_error'));
600  }
601 
602  $this->showMembersList();
603 
604  return true;
605  }
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 667 of file class.ilMailingListsGUI.php.

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

667  : bool
668  {
669  if (!$this->mlists->isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
670  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
671  }
672 
673  $form = $this->getAssignmentForm();
674  if (!$form->checkInput()) {
675  $form->setValuesByPost();
676  $this->showAssignmentForm($form);
677 
678  return true;
679  }
680 
681  if (
682  ilBuddyList::getInstanceByGlobalUser()->getRelationByUserId(
683  $this->http->wrapper()->post()->retrieve('usr_id', $this->refinery->kindlyTo()->int())
684  )->isLinked()
685  ) {
686  $this->mlists->getCurrentMailingList()->assignUser(
687  $this->http->wrapper()->post()->retrieve('usr_id', $this->refinery->kindlyTo()->int())
688  );
689  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
690  $this->showMembersList();
691 
692  return true;
693  }
694 
695  $this->showAssignmentForm($form);
696 
697  return true;
698  }
static http()
Fetches the global http state from ILIAS.
showAssignmentForm(?ilPropertyFormGUI $form=null)
static getInstanceByGlobalUser(?ilObjUser $user=null)
+ Here is the call graph for this function:

◆ saveForm()

ilMailingListsGUI::saveForm ( )

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

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

355  : void
356  {
357  if ($this->mlists->getCurrentMailingList() && $this->mlists->getCurrentMailingList()->getId()) {
358  if (!$this->mlists->isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
359  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
360  }
361 
362  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
363  $this->initForm();
364  } else {
365  $this->initForm();
366  }
367 
368  if ($this->form_gui->checkInput()) {
369  $this->mlists->getCurrentMailingList()->setTitle(
370  $this->form_gui->getInput('title')
371  );
372  $this->mlists->getCurrentMailingList()->setDescription(
373  $this->form_gui->getInput('description')
374  );
375 
376  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
377  if ($this->mlists->getCurrentMailingList()->getId() > 0) {
378  $this->mlists->getCurrentMailingList()->setChangedate(date('Y-m-d H:i:s'));
379  $this->mlists->getCurrentMailingList()->update();
380  $this->ctrl->redirect($this, 'showMailingLists');
381  } else {
382  $this->mlists->getCurrentMailingList()->setCreatedate(date('Y-m-d H:i:s'));
383  $this->mlists->getCurrentMailingList()->insert();
384 
385  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
386  $this->ctrl->redirect($this, 'showMembersList');
387  }
388  }
389 
390  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
391  $this->tpl->addBlockFile(
392  'ADM_CONTENT',
393  'adm_content',
394  'tpl.mail_mailing_lists_form.html',
395  'components/ILIAS/Contact'
396  );
397 
398  $this->form_gui->setValuesByPost();
399 
400  $this->tpl->setVariable('FORM', $this->form_gui->getHTML());
401  $this->tpl->printToStdout();
402  }
+ Here is the call graph for this function:

◆ setDefaultValues()

ilMailingListsGUI::setDefaultValues ( )
private

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

Referenced by showForm().

428  : void
429  {
430  $this->form_gui->setValuesByArray([
431  'title' => '',
432  'description' => ''
433  ]);
434  }
+ Here is the caller graph for this function:

◆ setValuesByObject()

ilMailingListsGUI::setValuesByObject ( )
private

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

Referenced by showForm().

420  : void
421  {
422  $this->form_gui->setValuesByArray([
423  'title' => $this->mlists->getCurrentMailingList()->getTitle(),
424  'description' => $this->mlists->getCurrentMailingList()->getDescription() ?? ''
425  ]);
426  }
+ Here is the caller graph for this function:

◆ showAssignmentForm()

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

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

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

Referenced by saveAssignmentForm().

700  : bool
701  {
702  if ($this->mlists->getCurrentMailingList()->getId() === 0) {
703  $this->showMembersList();
704 
705  return true;
706  }
707 
708  if (!$this->mlists->isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
709  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
710  }
711 
712  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
713  $this->tpl->addBlockFile(
714  'ADM_CONTENT',
715  'adm_content',
716  'tpl.mail_mailing_lists_members_form.html',
717  'components/ILIAS/Contact'
718  );
719 
720  if (!($form instanceof ilPropertyFormGUI)) {
721  $form = $this->getAssignmentForm();
722  }
723 
724  $this->tpl->setVariable('FORM', $form->getHTML());
725  $this->tpl->printToStdout();
726 
727  return true;
728  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showForm()

ilMailingListsGUI::showForm ( )

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

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

Referenced by handleMailingListActions().

436  : void
437  {
438  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
439  $this->tpl->addBlockFile(
440  'ADM_CONTENT',
441  'adm_content',
442  'tpl.mail_mailing_lists_form.html',
443  'components/ILIAS/Contact'
444  );
445 
446  if ($this->mlists->getCurrentMailingList() && $this->mlists->getCurrentMailingList()->getId()) {
447  if (!$this->mlists->isOwner($this->mlists->getCurrentMailingList()->getId(), $this->user->getId())) {
448  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
449  }
450 
451  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
452  $this->initForm();
453  $this->setValuesByObject();
454  } else {
455  $this->initForm();
456  $this->setDefaultValues();
457  }
458 
459  $this->tpl->setVariable('FORM', $this->form_gui->getHTML());
460  $this->tpl->printToStdout();
461  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showMailingLists()

ilMailingListsGUI::showMailingLists ( )

Definition at line 310 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().

310  : bool
311  {
312  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
313  $this->tpl->addBlockFile(
314  'ADM_CONTENT',
315  'adm_content',
316  'tpl.mail_mailing_lists_list.html',
317  'components/ILIAS/Contact'
318  );
319 
320  // check if current user may send mails
321  $mail = new ilMail($this->user->getId());
322 
323  $this->toolbar->addComponent(
324  $this->ui_factory->button()->standard(
325  $this->lng->txt('create'),
326  $this->ctrl->getLinkTarget($this, 'showForm')
327  )
328  );
329 
330  $tbl = new MailingListsTable(
331  $this->mlists,
332  $this->ctrl,
333  $this->lng,
334  $this->ui_factory,
335  $this->http
336  );
337  $tbl->setMailingAllowed($this->rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId()));
338  $this->tpl->setVariable('MAILING_LISTS', $this->ui_renderer->render($tbl->getComponent()));
339  $this->tpl->printToStdout();
340 
341  return true;
342  }
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 463 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().

463  : bool
464  {
465  if ($this->mlists->getCurrentMailingList()->getId() === 0) {
466  $this->showMailingLists();
467 
468  return true;
469  }
470 
471  $this->tabs->clearTargets();
472  $this->tabs->setBackTarget(
473  $this->lng->txt('back'),
474  $this->ctrl->getLinkTarget($this, 'showMailingLists')
475  );
476 
477  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
478 
479  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
480  $this->tpl->addBlockFile(
481  'ADM_CONTENT',
482  'adm_content',
483  'tpl.mail_mailing_lists_members.html',
484  'components/ILIAS/Contact'
485  );
486 
487  $availale_usr_ids = array_diff(
488  array_map(
489  static fn(ilBuddySystemRelation $relation): int => $relation->getBuddyUsrId(),
490  ilBuddyList::getInstanceByGlobalUser()->getLinkedRelations()->toArray()
491  ),
492  array_map(
493  static fn(array $entry): int => $entry['usr_id'],
494  $this->mlists->getCurrentMailingList()->getAssignedEntries()
495  ),
496  );
497 
498  if ($availale_usr_ids !== []) {
499  $this->toolbar->addComponent(
500  $this->ui_factory->button()->standard(
501  $this->lng->txt('add'),
502  $this->ctrl->getLinkTarget($this, 'showAssignmentForm')
503  )
504  );
505  }
506 
507  $tbl = new MailingListsMembersTable(
508  $this->mlists->getCurrentMailingList(),
509  $this->ctrl,
510  $this->lng,
513  );
514  $this->tpl->setVariable('MEMBERS_LIST', $this->ui_renderer->render($tbl->getComponent()));
515  $this->tpl->printToStdout();
516 
517  return true;
518  }
$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 34 of file class.ilMailingListsGUI.php.

Referenced by showMembersList().

◆ $error

readonly ilErrorHandling ilMailingListsGUI::$error
private

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

◆ $form_gui

ilPropertyFormGUI ilMailingListsGUI::$form_gui
private

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

◆ $http

readonly ILIAS HTTP GlobalHttpState ilMailingListsGUI::$http
private

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

Referenced by showMembersList().

◆ $lng

readonly ilLanguage ilMailingListsGUI::$lng
private

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

Referenced by showMembersList().

◆ $mlists

readonly ilMailingLists ilMailingListsGUI::$mlists
private

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

◆ $rbacsystem

readonly ilRbacSystem ilMailingListsGUI::$rbacsystem
private

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

◆ $refinery

readonly Refinery ilMailingListsGUI::$refinery
private

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

◆ $tabs

readonly ilTabsGUI ilMailingListsGUI::$tabs
private

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

◆ $toolbar

readonly ilToolbarGUI ilMailingListsGUI::$toolbar
private

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

◆ $tpl

readonly ilGlobalTemplateInterface ilMailingListsGUI::$tpl
private

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

◆ $ui_factory

readonly ILIAS UI Factory ilMailingListsGUI::$ui_factory
private

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

Referenced by showMembersList().

◆ $ui_renderer

readonly ILIAS UI Renderer ilMailingListsGUI::$ui_renderer
private

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

◆ $umail

readonly ilFormatMail ilMailingListsGUI::$umail
private

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

◆ $user

readonly ilObjUser ilMailingListsGUI::$user
private

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


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