4 require_once
'Services/Mail/classes/class.ilFormatMail.php';
5 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddySystem.php';
82 $this->tpl = $DIC[
'tpl'];
83 $this->ctrl = $DIC[
'ilCtrl'];
84 $this->lng = $DIC[
'lng'];
85 $this->tabs_gui = $DIC[
'ilTabs'];
86 $this->
help = $DIC[
'ilHelp'];
87 $this->toolbar = $DIC[
'ilToolbar'];
88 $this->
user = $DIC[
'ilUser'];
89 $this->error = $DIC[
'ilErr'];
90 $this->rbacsystem = $DIC[
'rbacsystem'];
92 $this->ctrl->saveParameter($this,
"mobj_id");
95 $this->lng->loadLanguageModule(
'buddysystem');
102 $forward_class = $this->ctrl->getNextClass($this);
105 $this->umail->savePostData($this->
user->getId(), array(),
'',
'',
'',
'',
'',
'',
'',
'');
107 switch ($forward_class) {
108 case 'ilmailformgui':
109 include_once
'Services/Mail/classes/class.ilMailFormGUI.php';
113 case 'ilmailsearchcoursesgui':
114 include_once
'Services/Contact/classes/class.ilMailSearchCoursesGUI.php';
118 $this->ctrl->setReturn($this,
"showContacts");
122 case 'ilmailsearchgroupsgui':
123 include_once
'Services/Contact/classes/class.ilMailSearchGroupsGUI.php';
127 $this->ctrl->setReturn($this,
"showContacts");
131 case 'ilmailinglistsgui':
132 include_once
'Services/Contact/classes/class.ilMailingListsGUI.php';
136 $this->ctrl->setReturn($this,
"showContacts");
140 case 'ilusersgallerygui':
142 $this->error->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->error->MESSAGE);
145 $this->tabs_gui->activateSubTab(
'buddy_view_gallery');
147 require_once
'Services/User/Gallery/classes/class.ilUsersGalleryContacts.php';
148 require_once
'Services/User/Gallery/classes/class.ilUsersGalleryGUI.php';
150 $this->tpl->printToStdout();
153 case 'ilpublicuserprofilegui':
154 require_once
'Services/User/classes/class.ilPublicUserProfileGUI.php';
156 $profile_gui->setBackUrl($this->ctrl->getLinkTarget($this,
'showContacts'));
157 $this->ctrl->forwardCommand($profile_gui);
158 $this->tpl->printToStdout();
164 if (!($cmd = $this->ctrl->getCmd())) {
166 $cmd =
'showContacts';
168 $this->ctrl->redirectByClass(
'ilmailsearchcoursesgui');
183 if ($this->tabs_gui->hasTabs()) {
185 $this->tabs_gui->addSubTab(
'my_contacts', $this->lng->txt(
'my_contacts'), $this->ctrl->getLinkTarget($this));
187 if (in_array(strtolower($this->ctrl->getCmdClass()), array_map(
'strtolower', array(
'ilUsersGalleryGUI', get_class($this))))) {
188 require_once
'Services/Form/classes/class.ilSelectInputGUI.php';
190 $view_selection->setOptions(array(
191 self::CONTACTS_VIEW_TABLE => $this->lng->txt(
'buddy_view_table'),
192 self::CONTACTS_VIEW_GALLERY => $this->lng->txt(
'buddy_view_gallery')
194 $view_selection->setValue(
195 strtolower($this->ctrl->getCmdClass()) ==
'ilusersgallerygui' ? self::CONTACTS_VIEW_GALLERY : self::CONTACTS_VIEW_TABLE
197 $this->toolbar->addInputItem($view_selection);
199 require_once
'Services/UIComponent/Button/classes/class.ilSubmitButton.php';
201 $contact_view_btn->setCaption(
'show');
202 $contact_view_btn->setCommand(
'changeContactsView');
203 $this->toolbar->addButtonInstance($contact_view_btn);
204 $this->toolbar->setFormAction($this->ctrl->getFormAction($this,
'changeContactsView'));
211 $this->tabs_gui->addSubTab(
212 'mail_my_mailing_lists',
213 $this->lng->txt(
'mail_my_mailing_lists'),
214 $this->ctrl->getLinkTargetByClass(
'ilmailinglistsgui')
219 $this->tabs_gui->addSubTab(
'mail_my_courses', $this->lng->txt(
'mail_my_courses'), $this->ctrl->getLinkTargetByClass(
'ilmailsearchcoursesgui'));
220 $this->tabs_gui->addSubTab(
'mail_my_groups', $this->lng->txt(
'mail_my_groups'), $this->ctrl->getLinkTargetByClass(
'ilmailsearchgroupsgui'));
221 $this->has_sub_tabs =
true;
225 $this->
help->setScreenIdComponent(
'contacts');
228 $this->tabs_gui->addTab(
'my_contacts', $this->lng->txt(
'my_contacts'), $this->ctrl->getLinkTarget($this));
230 if (in_array(strtolower($this->ctrl->getCmdClass()), array_map(
'strtolower', array(
'ilUsersGalleryGUI', get_class($this))))) {
231 $this->tabs_gui->addSubTab(
'buddy_view_table', $this->lng->txt(
'buddy_view_table'), $this->ctrl->getLinkTarget($this));
232 $this->tabs_gui->addSubTab(
'buddy_view_gallery', $this->lng->txt(
'buddy_view_gallery'), $this->ctrl->getLinkTargetByClass(
'ilUsersGalleryGUI'));
239 $this->tabs_gui->addTab(
240 'mail_my_mailing_lists',
241 $this->lng->txt(
'mail_my_mailing_lists'),
242 $this->ctrl->getLinkTargetByClass(
'ilmailinglistsgui')
247 $this->tabs_gui->addTab(
'mail_my_courses', $this->lng->txt(
'mail_my_courses'), $this->ctrl->getLinkTargetByClass(
'ilmailsearchcoursesgui'));
248 $this->tabs_gui->addTab(
'mail_my_groups', $this->lng->txt(
'mail_my_groups'), $this->ctrl->getLinkTargetByClass(
'ilmailsearchgroupsgui'));
257 if ($this->has_sub_tabs) {
258 $this->tabs_gui->activateSubTab($a_id);
260 $this->tabs_gui->activateTab($a_id);
270 $this->error->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->error->MESSAGE);
273 if (isset(
$_POST[
'contacts_view'])) {
274 switch (
$_POST[
'contacts_view']) {
275 case self::CONTACTS_VIEW_GALLERY:
276 $this->ctrl->redirectByClass(
'ilUsersGalleryGUI');
279 case self::CONTACTS_VIEW_TABLE:
280 $this->ctrl->redirect($this);
285 $this->ctrl->redirect($this);
294 $this->error->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->error->MESSAGE);
297 require_once
'Services/Contact/BuddySystem/classes/tables/class.ilBuddySystemRelationsTableGUI.php';
300 $table->resetOffset();
301 $table->writeFilterToSession();
312 $this->error->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->error->MESSAGE);
315 require_once
'Services/Contact/BuddySystem/classes/tables/class.ilBuddySystemRelationsTableGUI.php';
318 $table->resetOffset();
319 $table->resetFilter();
330 $this->error->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->error->MESSAGE);
333 $this->tabs_gui->activateSubTab(
'buddy_view_table');
336 require_once
'Services/Contact/BuddySystem/classes/tables/class.ilBuddySystemRelationsTableGUI.php';
339 $this->tpl->setContent($table->getHTML());
340 $this->tpl->printToStdout();
346 $this->error->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->error->MESSAGE);
351 $table->resetOffset();
352 $table->resetFilter();
354 $table->applyFilterValue(
356 ilBuddySystemRequestedRelationState::class .
'_p' 369 $this->error->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->error->MESSAGE);
372 if (!isset(
$_POST[
'usr_id']) || !is_array(
$_POST[
'usr_id']) || 0 == count(
$_POST[
'usr_id'])) {
378 $usr_ids = (array)
$_POST[
'usr_id'];
380 $mail_data = $this->umail->getSavedData();
381 if (!is_array($mail_data)) {
382 $this->umail->savePostData($this->
user->getId(), array(),
'',
'',
'',
'',
'',
'',
'',
'');
386 foreach ($usr_ids as $usr_id) {
389 $logins = array_filter($logins);
391 if (count($logins) > 0) {
392 $mail_data = $this->umail->appendSearchResult($logins,
'to');
393 $this->umail->savePostData(
394 $mail_data[
'user_id'],
395 $mail_data[
'attachments'],
396 $mail_data[
'rcp_to'],
397 $mail_data[
'rcp_cc'],
398 $mail_data[
'rcp_bcc'],
399 $mail_data[
'm_email'],
400 $mail_data[
'm_subject'],
401 $mail_data[
'm_message'],
402 $mail_data[
'use_placeholders'],
403 $mail_data[
'tpl_ctx_id'],
404 $mail_data[
'tpl_ctx_params']
417 if (!isset(
$_POST[
'usr_id']) || !strlen(
$_POST[
'usr_id'])) {
419 $this->ctrl->redirect($this);
424 $_POST[
'usr_id'] = explode(
',', $_POST[
'usr_id']);
430 $usr_ids = explode(
',',
$_POST[
'usr_id']);
433 $room_ids = explode(
',',
$_POST[
'room_id']);
434 $room_id = (int) $room_ids[0];
437 if (count($room_ids) > 0) {
438 $scope = (int) $room_ids[1];
441 include_once
'Modules/Chatroom/classes/class.ilChatroom.php';
444 $no_access = array();
446 $valid_users = array();
447 $valid_user_to_login_map = array();
449 foreach ($usr_ids as $usr_id) {
452 $no_login[$usr_id] = $usr_id;
456 $ref_id = $room->getRefIdByRoomId($room_id);
460 $room->isUserBanned($usr_id)
462 $no_access[$usr_id] =
$login;
464 $valid_users[$usr_id] = $usr_id;
465 $valid_user_to_login_map[$usr_id] =
$login;
469 if (count($no_access) || count($no_login)) {
472 if (count($no_access) > 0) {
473 $message .= $this->lng->txt(
'chat_users_without_permission') .
':<br>';
476 foreach ($no_access as $usr_id =>
$login) {
477 $list .=
'<li>' .
$login .
'</li>';
485 if (count($no_login)) {
486 $message .= $this->lng->txt(
'chat_users_without_login') .
':<br>';
489 foreach ($no_login as $usr_id) {
490 $list .=
'<li>' . $usr_id .
'</li>';
499 $_POST[
'usr_id'] = $usr_ids;
504 $ref_id = $room->getRefIdByRoomId($room_id);
506 require_once
'Services/Link/classes/class.ilLink.php';
512 $link =
'<p><a target="chatframe" href="' .
$url .
'" title="' . $this->lng->txt(
'goto_invitation_chat') .
'">' . $this->lng->txt(
'goto_invitation_chat') .
'</a></p>';
515 foreach ($valid_users as $id) {
516 $room->inviteUserToPrivateRoom($id, $scope);
517 $room->sendInvitationNotification(
519 $this->
user->getId(),
524 $userlist[] =
'<li>' . $valid_user_to_login_map[$id] .
'</li>';
528 ilUtil::sendSuccess($this->lng->txt(
'chat_users_have_been_invited') .
'<ul>' . implode(
'', $userlist) .
'</ul>' . $link,
true);
531 $this->ctrl->redirect($this);
539 $this->tabs_gui->activateSubTab(
'buddy_view_table');
542 $this->lng->loadLanguageModule(
'chatroom');
544 if (!isset(
$_POST[
'usr_id']) || !is_array(
$_POST[
'usr_id']) || 0 == count(
$_POST[
'usr_id'])) {
546 $this->ctrl->redirect($this);
548 $usr_ids =
$_POST[
'usr_id'];
550 require_once
'Modules/Chatroom/classes/class.ilChatroom.php';
553 $chat_rooms = $ilChatroom->getAccessibleRoomIdByTitleMap($this->
user->getId());
556 foreach ($chat_rooms as $room_id => $title) {
557 $subrooms[] = $ilChatroom->getPrivateSubRooms($room_id, $this->
user->getId());
560 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
563 $form->setTitle($this->lng->txt(
'mail_invite_users_to_chat'));
565 $psel =
new ilSelectInputGUI($this->lng->txt(
'chat_select_room'),
'room_id');
569 foreach ($chat_rooms as $room_id => $room) {
572 if ($ilChatroom->isUserBanned($this->user->getId())) {
576 $options[$ref_id] = $room;
578 foreach ($subrooms as $subroom) {
579 foreach ($subroom as $sub_id => $parent_id) {
580 if ($parent_id == $ref_id) {
582 $options[$ref_id .
',' . $sub_id] =
'+ ' . $title;
589 $form->addItem($psel);
591 $phidden->setValue(implode(
',', $usr_ids));
592 $form->addItem($phidden);
593 $form->addCommandButton(
'submitInvitation', $this->lng->txt(
'submit'));
594 $form->addCommandButton(
'showContacts', $this->lng->txt(
'cancel'));
595 $form->setFormAction($this->ctrl->getFormAction($this,
'showContacts'));
597 $this->tpl->setTitle($this->lng->txt(
'mail_invite_users_to_chat'));
598 $this->tpl->setContent($form->getHTML());
599 $this->tpl->printToStdout();
static _lookupLogin($a_user_id)
lookup login
static getInstanceByGlobalUser()
static _getStaticLink( $a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
static byRoomId($room_id, $initObject=false)
Returns ilChatroom by given $room_id.
ilUsersGalleryGUI: ilPublicUserProfileGUI ilUsersGalleryGUI: ilCourseMembershipGUI, ilGroupMembershipGUI
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
GUI class for public user profile presentation.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static lookupPrivateRoomTitle($proom_id)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static getMailObjectRefId()
Determines the reference id of the mail object and stores this information in a local cache variable...
const STATE_FILTER_ELM_ID
static redirect($a_script)
static checkPermissionsOfUser($usr_id, $permissions, $ref_id)
Checks user permissions in question for a given user id in relation to a given ref_id.