ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilMailSearchObjectGUI Class Reference
+ Inheritance diagram for ilMailSearchObjectGUI:
+ Collaboration diagram for ilMailSearchObjectGUI:

Public Member Functions

 __construct (protected readonly ilPortfolioAccessHandler|ilWorkspaceAccessHandler|null $wsp_access_handler=null, protected readonly ?int $wsp_node_id=null,)
 
 getObjectType ()
 
 getObjectTypeLabel ()
 
 getSearchTableTitle ()
 
 doesExposeMembers (ilObject $object)
 
 getUnsafeGetCommands ()
 This method must return a list of unsafe GET commands. More...
 
 getSafePostCommands ()
 This method must return a list of safe POST commands. More...
 
 executeCommand ()
 
 getContext ()
 
 isDefaultRequestContext ()
 
 getUnsafeGetCommands ()
 This method must return a list of unsafe GET commands. More...
 
 getSafePostCommands ()
 This method must return a list of safe POST commands. More...
 

Data Fields

const string CONTEXT_CONTACT = 'contact'
 
const string CONTEXT_MAIL = 'mail'
 
const string CONTEXT_WORKSPACE = 'wsp'
 
const string CMD_SHOW_MY_OBJECTS = 'showMyObjects'
 
const string CMD_HANDLE_MAIL_SEARCH_OBJECT_ACTIONS = 'handleMailSearchObjectActions'
 
const string CMD_CANCEL = 'cancel'
 
const string ACTION_MAIL_OBJECTS = 'mailObjects'
 
const string ACTION_MAIL_MEMBERS = 'mailMembers'
 
const string ACTION_SHARE_OBJECTS = 'shareObjects'
 
const string ACTION_SHARE_MEMBERS = 'shareMembers'
 
const string ACTION_SHOW_MEMBERS = 'showMembers'
 
const string ACTION_BUDDY_REQUEST = 'buddyRequest'
 

Protected Member Functions

 getLocalDefaultRolePrefixes ()
 
 addPermission (array $a_obj_ids)
 

Protected Attributes

readonly GlobalHttpState $http
 
readonly Refinery $refinery
 
readonly ilGlobalTemplateInterface $tpl
 
readonly ilCtrlInterface $ctrl
 
readonly ilLanguage $lng
 
readonly ilObjUser $user
 
readonly ilErrorHandling $error
 
readonly ilRbacSystem $rbacsystem
 
readonly ilRbacReview $rbacreview
 
readonly ilTree $tree
 
readonly ilObjectDataCache $cache
 
readonly ilFormatMail $umail
 
readonly bool $mailing_allowed
 
readonly Factory $ui_factory
 
readonly Renderer $ui_renderer
 

Private Member Functions

 mailMembers ()
 
 cancel ()
 
 showMyObjects ()
 
 isLocalRoleTitle (string $title)
 
 shareObjects ()
 
 shareMembers ()
 
 mailObjects ()
 
 handleMailSearchObjectActions ()
 
 isMailActionAllowed ()
 
 isShareActionAllowed ()
 
 resolveBuddyUserIdFromQuery ()
 
 retrieveObjectIdsFromQuery ()
 
 resolveObjectIds (array|string $obj_ids)
 
 getOwnObjectIds ()
 
 resolveUserIds ()
 
 collectMemberRowIds (array $obj_ids)
 
 retrieveMemberRowIdsFromQuery ()
 
 retrieveIdsFromQuery (string $key)
 

Private Attributes

readonly ilTabsGUI $tabs
 
string $context = null
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilMailSearchObjectGUI::__construct ( protected readonly ilPortfolioAccessHandler|ilWorkspaceAccessHandler|null  $wsp_access_handler = null,
protected readonly ?int  $wsp_node_id = null 
)
Exceptions
ilCtrlException

Definition at line 63 of file class.ilMailSearchObjectGUI.php.

66 {
67 global $DIC;
68
69 $this->tpl = $DIC['tpl'];
70 $this->ctrl = $DIC['ilCtrl'];
71 $this->lng = $DIC['lng'];
72 $this->user = $DIC['ilUser'];
73 $this->error = $DIC['ilErr'];
74 $this->rbacsystem = $DIC['rbacsystem'];
75 $this->rbacreview = $DIC['rbacreview'];
76 $this->tree = $DIC['tree'];
77 $this->cache = $DIC['ilObjDataCache'];
78 $this->http = $DIC->http();
79 $this->refinery = $DIC->refinery();
80 $this->ui_factory = $DIC->ui()->factory();
81 $this->ui_renderer = $DIC->ui()->renderer();
82 $this->tabs = $DIC->tabs();
83
84 $this->ctrl->saveParameter($this, 'mobj_id');
85 $this->ctrl->saveParameter($this, 'ref');
86
87 $this->mailing_allowed = $this->rbacsystem->checkAccess(
88 'internal_mail',
89 new ilMail($this->user->getId())->getMailObjectReferenceId(),
90 );
91
92 $this->umail = new ilFormatMail($this->user->getId());
93
94 $this->lng->loadLanguageModule('mail');
95 }
getMailObjectReferenceId()
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addPermission()

ilMailSearchObjectGUI::addPermission ( array  $a_obj_ids)
protected
Parameters
int[]$a_obj_ids

Definition at line 190 of file class.ilMailSearchObjectGUI.php.

190 : void
191 {
192 if ($this->wsp_access_handler === null || $this->wsp_node_id === null) {
193 $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->MESSAGE);
194 }
195
196 $added = $this->wsp_access_handler->addMissingPermissionForObjects($this->wsp_node_id, $a_obj_ids);
197
198 if ($added) {
199 $this->tpl->setOnScreenMessage('success', $this->lng->txt('wsp_share_success'), true);
200 }
201 $this->ctrl->redirectByClass(ilWorkspaceAccessGUI::class, 'share');
202 }

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

Referenced by shareMembers(), and shareObjects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilMailSearchObjectGUI::cancel ( )
private

Definition at line 244 of file class.ilMailSearchObjectGUI.php.

244 : void
245 {
246 $view = '';
247 if ($this->http->wrapper()->query()->has('view')) {
248 $view = $this->http->wrapper()->query()->retrieve('view', $this->refinery->kindlyTo()->string());
249 }
250
251 if ($view === 'myobjects' && $this->isDefaultRequestContext()) {
252 $this->ctrl->returnToParent($this);
253 } else {
254 $this->showMyObjects();
255 }
256 }

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

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ collectMemberRowIds()

ilMailSearchObjectGUI::collectMemberRowIds ( array  $obj_ids)
private
Parameters
list<int>$obj_ids
Returns
list<string>

Definition at line 649 of file class.ilMailSearchObjectGUI.php.

649 : array
650 {
651 $member_row_ids = [];
652 foreach ($obj_ids as $obj_id) {
653 $ref_ids = new ObjectId($obj_id)->toReferenceIds();
654 if ($ref_ids === []) {
655 continue;
656 }
657
658 foreach (ilParticipants::getInstance($ref_ids[0]->toInt())->getParticipants() as $participant) {
659 if (ilObjUser::_lookupActive($participant)) {
660 $member_row_ids[] = "{$obj_id}_$participant";
661 }
662 }
663 }
664
665 return $member_row_ids;
666 }
static _lookupActive(int $a_usr_id)
static getInstance(int $a_ref_id)

References ilObjUser\_lookupActive(), ilParticipants\getInstance(), and ILIAS\Data\ObjectId\toReferenceIds().

Referenced by resolveUserIds().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doesExposeMembers()

ilMailSearchObjectGUI::doesExposeMembers ( ilObject  $object)
abstract

◆ executeCommand()

ilMailSearchObjectGUI::executeCommand ( )
Exceptions
ilCtrlException

Definition at line 125 of file class.ilMailSearchObjectGUI.php.

125 : bool
126 {
127 $forward_class = $this->ctrl->getNextClass($this) ?? '';
128 switch (strtolower($forward_class)) {
129 case strtolower(ilBuddySystemGUI::class):
130 if (!ilBuddySystem::getInstance()->isEnabled()) {
131 $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->MESSAGE);
132 }
133
134 $buddy_user_id = $this->resolveBuddyUserIdFromQuery();
135 if ($buddy_user_id !== null) {
136 $this->ctrl->setParameterByClass(ilBuddySystemGUI::class, 'user_id', $buddy_user_id);
137 }
138
139 $obj_ids = $this->retrieveObjectIdsFromQuery();
140 $this->ctrl->setParameter($this, 'contact_mailinglist_search_action', self::ACTION_SHOW_MEMBERS);
141 if ($obj_ids !== []) {
142 $this->ctrl->setParameter(
143 $this,
144 'contact_mailinglist_search_obj_ids',
145 implode(',', $obj_ids)
146 );
147 }
148 $this->ctrl->setReturn($this, self::CMD_HANDLE_MAIL_SEARCH_OBJECT_ACTIONS);
149 $this->ctrl->forwardCommand(new ilBuddySystemGUI());
150 break;
151
152 default:
153 match ($this->ctrl->getCmd()) {
154 self::CMD_HANDLE_MAIL_SEARCH_OBJECT_ACTIONS => $this->handleMailSearchObjectActions(),
155 self::CMD_CANCEL => $this->cancel(),
156 default => $this->showMyObjects(),
157 };
158 break;
159 }
160
161 return true;
162 }
Class ilBuddySystemGUI.
Class ilBuddySystem.
if(!file_exists('../ilias.ini.php'))

References cancel(), ILIAS\Repository\ctrl(), ilBuddySystem\getInstance(), handleMailSearchObjectActions(), ILIAS\Repository\lng(), resolveBuddyUserIdFromQuery(), retrieveObjectIdsFromQuery(), and showMyObjects().

+ Here is the call graph for this function:

◆ getContext()

ilMailSearchObjectGUI::getContext ( )

Definition at line 164 of file class.ilMailSearchObjectGUI.php.

164 : string
165 {
166 if ($this->context === null) {
167 $context = $this->http->wrapper()->query()->retrieve(
168 'ref',
169 $this->refinery->byTrying([
170 $this->refinery->kindlyTo()->string(),
171 $this->refinery->always(self::CONTEXT_CONTACT)
172 ]),
173 );
174 $this->context = in_array($context, [self::CONTEXT_CONTACT, self::CONTEXT_MAIL, self::CONTEXT_WORKSPACE], true)
175 ? $context
177 }
178
179 return $this->context;
180 }

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

Referenced by isDefaultRequestContext(), isShareActionAllowed(), and showMyObjects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLocalDefaultRolePrefixes()

ilMailSearchObjectGUI::getLocalDefaultRolePrefixes ( )
abstractprotected
Returns
string[] Returns an array like ['il_crs_member_', 'il_crs_tutor', ...]

Reimplemented in ilMailSearchCoursesGUI, and ilMailSearchGroupsGUI.

Referenced by isLocalRoleTitle().

+ Here is the caller graph for this function:

◆ getObjectType()

ilMailSearchObjectGUI::getObjectType ( )
abstract

Reimplemented in ilMailSearchCoursesGUI, and ilMailSearchGroupsGUI.

Referenced by retrieveObjectIdsFromQuery().

+ Here is the caller graph for this function:

◆ getObjectTypeLabel()

ilMailSearchObjectGUI::getObjectTypeLabel ( )
abstract

◆ getOwnObjectIds()

ilMailSearchObjectGUI::getOwnObjectIds ( )
private
Returns
list<int>

Definition at line 607 of file class.ilMailSearchObjectGUI.php.

607 : array
608 {
609 return array_values(array_filter(
610 ilParticipants::_getMembershipByType($this->user->getId(), [$this->getObjectType()]),
612 ));
613 }
static _hasUntrashedReference(int $obj_id)
checks whether an object has at least one reference that is not in trash
static _getMembershipByType(int $a_usr_id, array $a_type, bool $a_only_member_role=false)
get membership by type Get course or group membership

References ilParticipants\_getMembershipByType(), ilObject\_hasUntrashedReference(), and ILIAS\Repository\user().

Referenced by resolveObjectIds().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSafePostCommands()

ilMailSearchObjectGUI::getSafePostCommands ( )

This method must return a list of safe POST commands.

Safe post commands returned by this method will no longer be CSRF protected and will NOT be appended by an ilCtrlToken.

Returns
string[]

Implements ilCtrlSecurityInterface.

Definition at line 117 of file class.ilMailSearchObjectGUI.php.

117 : array
118 {
119 return [];
120 }

◆ getSearchTableTitle()

ilMailSearchObjectGUI::getSearchTableTitle ( )
abstract

◆ getUnsafeGetCommands()

ilMailSearchObjectGUI::getUnsafeGetCommands ( )

This method must return a list of unsafe GET commands.

Unsafe get commands returned by this method will now be CSRF protected, which means an ilCtrlToken is appended each time a link-target is generated to the class implementing this interface with a command from that list.

Tokens will be validated in

See also
ilCtrlInterface::getCmd(), whereas the fallback command will be used if the CSRF validation fails.
Returns
string[]

Implements ilCtrlSecurityInterface.

Definition at line 110 of file class.ilMailSearchObjectGUI.php.

110 : array
111 {
112 return [
114 ];
115 }
const string CMD_HANDLE_MAIL_SEARCH_OBJECT_ACTIONS

References CMD_HANDLE_MAIL_SEARCH_OBJECT_ACTIONS.

◆ handleMailSearchObjectActions()

ilMailSearchObjectGUI::handleMailSearchObjectActions ( )
private

Definition at line 507 of file class.ilMailSearchObjectGUI.php.

507 : void
508 {
509 $query = $this->http->wrapper()->query();
510
511 if (!$query->has('contact_mailinglist_search_action')) {
512 $this->ctrl->redirect($this, self::CMD_SHOW_MY_OBJECTS);
513 return;
514 }
515
516 $action = $query->retrieve('contact_mailinglist_search_action', $this->refinery->to()->string());
517
518 if (
519 in_array($action, [self::ACTION_MAIL_OBJECTS, self::ACTION_MAIL_MEMBERS], true)
520 && !$this->isMailActionAllowed()
521 ) {
522 $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->MESSAGE);
523 }
524
525 if (
526 in_array($action, [self::ACTION_SHARE_OBJECTS, self::ACTION_SHARE_MEMBERS], true)
527 && !$this->isShareActionAllowed()
528 ) {
529 $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->MESSAGE);
530 }
531
532 match ($action) {
533 self::ACTION_MAIL_OBJECTS => $this->mailObjects(),
534 self::ACTION_MAIL_MEMBERS => $this->mailMembers(),
535 self::ACTION_SHARE_OBJECTS => $this->shareObjects(),
536 self::ACTION_SHARE_MEMBERS => $this->shareMembers(),
537 self::ACTION_SHOW_MEMBERS => $this->showMembers(),
538 default => $this->ctrl->redirect($this, self::CMD_SHOW_MY_OBJECTS),
539 };
540 }

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), isMailActionAllowed(), isShareActionAllowed(), ILIAS\Repository\lng(), mailMembers(), mailObjects(), ILIAS\Repository\refinery(), shareMembers(), and shareObjects().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isDefaultRequestContext()

ilMailSearchObjectGUI::isDefaultRequestContext ( )

Definition at line 182 of file class.ilMailSearchObjectGUI.php.

182 : bool
183 {
184 return in_array($this->getContext(), [self::CONTEXT_CONTACT, self::CONTEXT_MAIL], true);
185 }

References getContext().

Referenced by cancel(), isMailActionAllowed(), and showMyObjects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isLocalRoleTitle()

ilMailSearchObjectGUI::isLocalRoleTitle ( string  $title)
private

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

404 : bool
405 {
406 return array_any(
408 static fn(string $local_role_prefix): bool => str_starts_with($title, $local_role_prefix),
409 );
410 }

References getLocalDefaultRolePrefixes().

Referenced by mailObjects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isMailActionAllowed()

ilMailSearchObjectGUI::isMailActionAllowed ( )
private

Definition at line 542 of file class.ilMailSearchObjectGUI.php.

542 : bool
543 {
545 }

References $mailing_allowed, and isDefaultRequestContext().

Referenced by handleMailSearchObjectActions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isShareActionAllowed()

ilMailSearchObjectGUI::isShareActionAllowed ( )
private

Definition at line 547 of file class.ilMailSearchObjectGUI.php.

547 : bool
548 {
549 return $this->getContext() === self::CONTEXT_WORKSPACE
550 && $this->wsp_access_handler !== null
551 && $this->wsp_node_id !== null;
552 }

References getContext().

Referenced by handleMailSearchObjectActions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mailMembers()

ilMailSearchObjectGUI::mailMembers ( )
private

Definition at line 204 of file class.ilMailSearchObjectGUI.php.

204 : void
205 {
206 $members = [];
207
208 $usr_ids = $this->resolveUserIds();
209
210 if ($usr_ids === []) {
211 $this->tpl->setOnScreenMessage('info', $this->lng->txt('mail_select_one_entry'));
212 $this->showMembers();
213
214 return;
215 }
216
217 $mail_data = $this->umail->retrieveFromStage();
218 foreach ($usr_ids as $usr_id) {
219 $login = ilObjUser::_lookupLogin($usr_id);
220 if (!$this->umail->existsRecipient($login, (string) $mail_data['rcp_to'])) {
221 $members[] = $login;
222 }
223 }
224
225 $mail_data = $this->umail->appendSearchResult(array_unique($members), 'to');
226
227 $this->umail->persistToStage(
228 (int) $mail_data['user_id'],
229 $mail_data['rcp_to'],
230 $mail_data['rcp_cc'],
231 $mail_data['rcp_bcc'],
232 $mail_data['m_subject'],
233 $mail_data['m_message'],
234 $mail_data['attachments'],
235 $mail_data['use_placeholders'],
236 $mail_data['tpl_ctx_id'],
237 $mail_data['tpl_ctx_params']
238 );
239
240 $this->ctrl->setParameterByClass(ilMailGUI::class, 'type', ilMailFormGUI::MAIL_FORM_TYPE_SEARCH_RESULT);
241 $this->ctrl->redirectByClass(ilMailGUI::class);
242 }
final const string MAIL_FORM_TYPE_SEARCH_RESULT
static _lookupLogin(int $a_user_id)

References ilObjUser\_lookupLogin(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilMailFormGUI\MAIL_FORM_TYPE_SEARCH_RESULT, and resolveUserIds().

Referenced by handleMailSearchObjectActions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mailObjects()

ilMailSearchObjectGUI::mailObjects ( )
private

Definition at line 441 of file class.ilMailSearchObjectGUI.php.

441 : void
442 {
443 $members = [];
444 $mail_data = $this->umail->retrieveFromStage();
445
446 $obj_ids = $this->resolveObjectIds(
447 $this->retrieveIdsFromQuery('contact_mailinglist_search_obj_ids')
448 );
449
450 if ($obj_ids === []) {
451 $this->tpl->setOnScreenMessage(
452 'info',
453 $this->lng->txt($this->getObjectType() === 'crs' ? 'mail_select_crs' : 'mail_select_grp'),
454 );
455 $this->showMyObjects();
456
457 return;
458 }
459
460 foreach ($obj_ids as $obj_id) {
461 $ref_ids = ilObject::_getAllReferences($obj_id);
462 foreach ($ref_ids as $ref_id) {
463 $can_send_mails = ilParticipants::canSendMailToMembers(
464 $ref_id,
465 $this->user->getId(),
467 );
468
469 if (!$can_send_mails) {
470 continue;
471 }
472
473 $roles = $this->rbacreview->getAssignableChildRoles($ref_id);
474 foreach ($roles as $role) {
475 if ($this->isLocalRoleTitle($role['title'])) {
476 $recipient = new ilRoleMailboxAddress($role['obj_id'])->value();
477 if (!$this->umail->existsRecipient($recipient, (string) $mail_data['rcp_to'])) {
478 $members[] = $recipient;
479 }
480 }
481 }
482 }
483 }
484
485 $mail_data = $members !== [] ? $this->umail->appendSearchResult(
486 array_unique($members),
487 'to'
488 ) : $this->umail->retrieveFromStage();
489
490 $this->umail->persistToStage(
491 (int) $mail_data['user_id'],
492 $mail_data['rcp_to'],
493 $mail_data['rcp_cc'],
494 $mail_data['rcp_bcc'],
495 $mail_data['m_subject'],
496 $mail_data['m_message'],
497 $mail_data['attachments'],
498 $mail_data['use_placeholders'],
499 $mail_data['tpl_ctx_id'],
500 $mail_data['tpl_ctx_params']
501 );
502
503 $this->ctrl->setParameterByClass(ilMailGUI::class, 'type', ilMailFormGUI::MAIL_FORM_TYPE_SEARCH_RESULT);
504 $this->ctrl->redirectByClass(ilMailGUI::class);
505 }
resolveObjectIds(array|string $obj_ids)
static _getAllReferences(int $id)
get all reference ids for object ID
static canSendMailToMembers(int|ilObject $ref_id_or_instance, ?int $usr_id=null, ?int $mail_obj_ref_id=null)
This method was introduced as a band-aid fix for #22764.
value()
Returns the mailbox address of a role.

References ilObject\_getAllReferences(), ilParticipants\canSendMailToMembers(), ILIAS\Repository\ctrl(), ilMailGlobalServices\getMailObjectRefId(), isLocalRoleTitle(), ILIAS\Repository\lng(), ilMailFormGUI\MAIL_FORM_TYPE_SEARCH_RESULT, resolveObjectIds(), retrieveIdsFromQuery(), showMyObjects(), ILIAS\Repository\user(), and ilRoleMailboxAddress\value().

Referenced by handleMailSearchObjectActions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resolveBuddyUserIdFromQuery()

ilMailSearchObjectGUI::resolveBuddyUserIdFromQuery ( )
private

Definition at line 554 of file class.ilMailSearchObjectGUI.php.

554 : ?int
555 {
556 $member_row_ids = $this->retrieveMemberRowIdsFromQuery();
557
558 if ($member_row_ids === 'ALL_OBJECTS' || $member_row_ids === []) {
559 return null;
560 }
561
562 $member_row_id = is_array($member_row_ids)
563 ? (string) ($member_row_ids[0] ?? '')
564 : $member_row_ids;
565
566 if (!str_contains($member_row_id, '_')) {
567 return null;
568 }
569
570 return (int) explode('_', $member_row_id, 2)[1];
571 }

References retrieveMemberRowIdsFromQuery().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resolveObjectIds()

ilMailSearchObjectGUI::resolveObjectIds ( array|string  $obj_ids)
private
Parameters
list<int>|string$obj_ids
Returns
list<int>

Definition at line 594 of file class.ilMailSearchObjectGUI.php.

594 : array
595 {
596 $own_obj_ids = $this->getOwnObjectIds();
597 if ($obj_ids === 'ALL_OBJECTS') {
598 return $own_obj_ids;
599 }
600
601 return array_values(array_intersect($obj_ids, $own_obj_ids));
602 }

References getOwnObjectIds().

Referenced by mailObjects(), retrieveObjectIdsFromQuery(), and shareObjects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resolveUserIds()

ilMailSearchObjectGUI::resolveUserIds ( )
private
Returns
list<int>

Definition at line 618 of file class.ilMailSearchObjectGUI.php.

618 : array
619 {
620 $member_row_ids = $this->retrieveMemberRowIdsFromQuery();
621
622 $obj_ids = $this->retrieveObjectIdsFromQuery();
623 $allowed_member_row_ids = $this->collectMemberRowIds($obj_ids);
624 if ($member_row_ids === 'ALL_OBJECTS') {
625 return array_values(array_unique(array_map(
626 static fn(string $member_row_id): int => (int) explode('_', $member_row_id, 2)[1],
627 $allowed_member_row_ids,
628 )));
629 }
630
631 $allowed_row_ids = array_flip($allowed_member_row_ids);
632 $usr_ids = [];
633 foreach ($member_row_ids as $member_row_id) {
634 $member_row_id = (string) $member_row_id;
635 if (!isset($allowed_row_ids[$member_row_id])) {
636 continue;
637 }
638
639 $usr_ids[] = (int) explode('_', $member_row_id, 2)[1];
640 }
641
642 return array_values(array_unique($usr_ids));
643 }

References collectMemberRowIds(), ILIAS\Repository\int(), retrieveMemberRowIdsFromQuery(), and retrieveObjectIdsFromQuery().

Referenced by mailMembers(), and shareMembers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ retrieveIdsFromQuery()

ilMailSearchObjectGUI::retrieveIdsFromQuery ( string  $key)
private
Returns
list<int>|string

Definition at line 703 of file class.ilMailSearchObjectGUI.php.

703 : array|string
704 {
705 return $this->http->wrapper()->query()->retrieve(
706 $key,
707 $this->refinery->byTrying([
708 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int()),
709 $this->refinery->custom()->transformation(
710 static function (mixed $value): array|string {
711 if ($value === ['ALL_OBJECTS']) {
712 return 'ALL_OBJECTS';
713 }
714 if (!is_string($value) || $value === '') {
715 throw new Exception('invalid ids');
716 }
717
718 return array_map(intval(...), explode(',', $value));
719 }
720 ),
721 $this->refinery->always([])
722 ])
723 );
724 }

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

Referenced by mailObjects(), retrieveObjectIdsFromQuery(), and shareObjects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ retrieveMemberRowIdsFromQuery()

ilMailSearchObjectGUI::retrieveMemberRowIdsFromQuery ( )
private
Returns
list<string>|string

Definition at line 671 of file class.ilMailSearchObjectGUI.php.

671 : array|string
672 {
673 return $this->http->wrapper()->query()->retrieve(
674 'contact_mailinglist_search_members_ids',
675 $this->refinery->byTrying([
676 $this->refinery->custom()->transformation(
677 static function (mixed $value): string {
678 if ($value === 'ALL_OBJECTS' || (is_array($value) && ($value[0] ?? null) === 'ALL_OBJECTS')) {
679 return 'ALL_OBJECTS';
680 }
681
682 throw new Exception('not all objects');
683 }
684 ),
685 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string()),
686 $this->refinery->custom()->transformation(
687 static function (mixed $value): array {
688 if (!is_string($value) || $value === '') {
689 throw new Exception('invalid ids');
690 }
691
692 return explode(',', $value);
693 }
694 ),
695 $this->refinery->always([])
696 ])
697 );
698 }

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

Referenced by resolveBuddyUserIdFromQuery(), and resolveUserIds().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ retrieveObjectIdsFromQuery()

ilMailSearchObjectGUI::retrieveObjectIdsFromQuery ( )
private
Returns
list<int>

Definition at line 576 of file class.ilMailSearchObjectGUI.php.

576 : array
577 {
578 $obj_ids = $this->resolveObjectIds(
579 $this->retrieveIdsFromQuery('contact_mailinglist_search_obj_ids')
580 );
581 if ($obj_ids !== []) {
582 return $obj_ids;
583 }
584
585 return $this->resolveObjectIds(
586 $this->retrieveIdsFromQuery('search_' . $this->getObjectType())
587 );
588 }

References getObjectType(), resolveObjectIds(), and retrieveIdsFromQuery().

Referenced by executeCommand(), and resolveUserIds().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ shareMembers()

ilMailSearchObjectGUI::shareMembers ( )
private

Definition at line 429 of file class.ilMailSearchObjectGUI.php.

429 : void
430 {
431 $usr_ids = $this->resolveUserIds();
432
433 if ($usr_ids !== []) {
434 $this->addPermission(array_unique($usr_ids));
435 } else {
436 $this->tpl->setOnScreenMessage('info', $this->lng->txt('mail_select_one_entry'));
437 $this->showMembers();
438 }
439 }

References addPermission(), ILIAS\Repository\lng(), and resolveUserIds().

Referenced by handleMailSearchObjectActions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ shareObjects()

ilMailSearchObjectGUI::shareObjects ( )
private

Definition at line 412 of file class.ilMailSearchObjectGUI.php.

412 : void
413 {
414 $obj_ids = $this->resolveObjectIds(
415 $this->retrieveIdsFromQuery('contact_mailinglist_search_obj_ids')
416 );
417
418 if ($obj_ids !== []) {
419 $this->addPermission($obj_ids);
420 } else {
421 $this->tpl->setOnScreenMessage(
422 'info',
423 $this->lng->txt($this->getObjectType() === 'crs' ? 'mail_select_crs' : 'mail_select_grp'),
424 );
425 $this->showMyObjects();
426 }
427 }

References addPermission(), ILIAS\Repository\lng(), resolveObjectIds(), retrieveIdsFromQuery(), and showMyObjects().

Referenced by handleMailSearchObjectActions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showMyObjects()

ilMailSearchObjectGUI::showMyObjects ( )
private

Definition at line 351 of file class.ilMailSearchObjectGUI.php.

351 : void
352 {
353 $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
354
355 if ($this->getContext() === self::CONTEXT_MAIL) {
356 $this->tabs->clearTargets();
357 $this->ctrl->setParameter($this, 'view', 'myobjects');
358 $this->tabs->setBackTarget(
359 $this->lng->txt('back'),
360 $this->ctrl->getLinkTarget($this, self::CMD_CANCEL)
361 );
362 }
363
364 $search_tpl = new ilTemplate(
365 'tpl.mail_search_template.html',
366 true,
367 true,
368 'components/ILIAS/Contact'
369 );
370
371 $this->lng->loadLanguageModule('crs');
372
373 $table = new MailSearchObjectsTable(
374 $this->user,
375 $this,
376 $this->ctrl,
377 $this->lng,
378 $this->ui_factory,
379 $this->http,
380 $this->tree,
381 );
382
383 if ($this->isDefaultRequestContext()) {
384 $table->setMailingAllowed($this->mailing_allowed);
385 }
386
387 if ($table->getNumHiddenMembers() > 0) {
388 $search_tpl->setCurrentBlock('caption_block');
389 $search_tpl->setVariable(
390 'TXT_LIST_MEMBERS_NOT_AVAILABLE',
391 $this->lng->txt('mail_crs_list_members_not_available')
392 );
393 $search_tpl->parseCurrentBlock();
394 }
395
396 $search_tpl->setVariable('TABLE', $this->ui_renderer->render($table->getComponent()));
397 $this->tpl->setContent($search_tpl->get());
398
399 if ($this->isDefaultRequestContext()) {
400 $this->tpl->printToStdout();
401 }
402 }
special template class to simplify handling of ITX/PEAR

References ILIAS\Repository\ctrl(), getContext(), ILIAS\FileDelivery\http(), isDefaultRequestContext(), ILIAS\Repository\lng(), ILIAS\Repository\tabs(), and ILIAS\Repository\user().

Referenced by cancel(), executeCommand(), mailObjects(), and shareObjects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $cache

readonly ilObjectDataCache ilMailSearchObjectGUI::$cache
protected

Definition at line 53 of file class.ilMailSearchObjectGUI.php.

◆ $context

string ilMailSearchObjectGUI::$context = null
private

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

Referenced by getContext().

◆ $ctrl

readonly ilCtrlInterface ilMailSearchObjectGUI::$ctrl
protected

Definition at line 46 of file class.ilMailSearchObjectGUI.php.

◆ $error

readonly ilErrorHandling ilMailSearchObjectGUI::$error
protected

Definition at line 49 of file class.ilMailSearchObjectGUI.php.

◆ $http

readonly GlobalHttpState ilMailSearchObjectGUI::$http
protected

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

◆ $lng

readonly ilLanguage ilMailSearchObjectGUI::$lng
protected

Definition at line 47 of file class.ilMailSearchObjectGUI.php.

◆ $mailing_allowed

readonly bool ilMailSearchObjectGUI::$mailing_allowed
protected

Definition at line 55 of file class.ilMailSearchObjectGUI.php.

Referenced by isMailActionAllowed().

◆ $rbacreview

readonly ilRbacReview ilMailSearchObjectGUI::$rbacreview
protected

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

◆ $rbacsystem

readonly ilRbacSystem ilMailSearchObjectGUI::$rbacsystem
protected

Definition at line 50 of file class.ilMailSearchObjectGUI.php.

◆ $refinery

readonly Refinery ilMailSearchObjectGUI::$refinery
protected

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

◆ $tabs

readonly ilTabsGUI ilMailSearchObjectGUI::$tabs
private

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

◆ $tpl

readonly ilGlobalTemplateInterface ilMailSearchObjectGUI::$tpl
protected

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

◆ $tree

readonly ilTree ilMailSearchObjectGUI::$tree
protected

Definition at line 52 of file class.ilMailSearchObjectGUI.php.

◆ $ui_factory

readonly Factory ilMailSearchObjectGUI::$ui_factory
protected

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

◆ $ui_renderer

readonly Renderer ilMailSearchObjectGUI::$ui_renderer
protected

Definition at line 57 of file class.ilMailSearchObjectGUI.php.

◆ $umail

readonly ilFormatMail ilMailSearchObjectGUI::$umail
protected

Definition at line 54 of file class.ilMailSearchObjectGUI.php.

◆ $user

readonly ilObjUser ilMailSearchObjectGUI::$user
protected

Definition at line 48 of file class.ilMailSearchObjectGUI.php.

◆ ACTION_BUDDY_REQUEST

const string ilMailSearchObjectGUI::ACTION_BUDDY_REQUEST = 'buddyRequest'

◆ ACTION_MAIL_MEMBERS

const string ilMailSearchObjectGUI::ACTION_MAIL_MEMBERS = 'mailMembers'

◆ ACTION_MAIL_OBJECTS

const string ilMailSearchObjectGUI::ACTION_MAIL_OBJECTS = 'mailObjects'

◆ ACTION_SHARE_MEMBERS

const string ilMailSearchObjectGUI::ACTION_SHARE_MEMBERS = 'shareMembers'

◆ ACTION_SHARE_OBJECTS

const string ilMailSearchObjectGUI::ACTION_SHARE_OBJECTS = 'shareObjects'

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

Referenced by MailSearchObjectsTable\getActions().

◆ ACTION_SHOW_MEMBERS

const string ilMailSearchObjectGUI::ACTION_SHOW_MEMBERS = 'showMembers'

◆ CMD_CANCEL

const string ilMailSearchObjectGUI::CMD_CANCEL = 'cancel'

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

◆ CMD_HANDLE_MAIL_SEARCH_OBJECT_ACTIONS

const string ilMailSearchObjectGUI::CMD_HANDLE_MAIL_SEARCH_OBJECT_ACTIONS = 'handleMailSearchObjectActions'

◆ CMD_SHOW_MY_OBJECTS

const string ilMailSearchObjectGUI::CMD_SHOW_MY_OBJECTS = 'showMyObjects'

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

◆ CONTEXT_CONTACT

const string ilMailSearchObjectGUI::CONTEXT_CONTACT = 'contact'

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

Referenced by getContext().

◆ CONTEXT_MAIL

const string ilMailSearchObjectGUI::CONTEXT_MAIL = 'mail'

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

◆ CONTEXT_WORKSPACE

const string ilMailSearchObjectGUI::CONTEXT_WORKSPACE = 'wsp'

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