ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilMailAddressbookGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 require_once './Services/User/classes/class.ilObjUser.php';
6 require_once "Services/Mail/classes/class.ilMailbox.php";
7 require_once "Services/Mail/classes/class.ilFormatMail.php";
8 require_once "Services/Contact/classes/class.ilAddressbook.php";
9 require_once "Services/Contact/classes/class.ilAddressbookTableGUI.php";
10 
11 
21 {
22  private $tpl = null;
23  public $ctrl = null;
24  private $lng = null;
25  private $tabs_gui = null;
26 
27  private $umail = null;
28  private $abook = null;
29 
30  public function __construct()
31  {
32  global $tpl, $ilCtrl, $lng, $ilUser, $ilTabs;
33 
34  $this->tpl = $tpl;
35  $this->ctrl = $ilCtrl;
36  $this->lng = $lng;
37  $this->tabs_gui =& $ilTabs;
38 
39  $this->ctrl->saveParameter($this, "mobj_id");
40 
41  $this->umail = new ilFormatMail($ilUser->getId());
42  $this->abook = new ilAddressbook($ilUser->getId());
43  }
44 
45  public function executeCommand()
46  {
47  global $ilUser;
48  $this->showSubTabs();
49 
50  $forward_class = $this->ctrl->getNextClass($this);
51 
52  // delete all stored maildata
53  $this->umail->savePostData($ilUser->getId(), array(), '', '', '', '', '', '', '', '');
54 
55  switch($forward_class)
56  {
57  case 'ilmailformgui':
58  include_once 'Services/Mail/classes/class.ilMailFormGUI.php';
59  $this->ctrl->forwardCommand(new ilMailFormGUI());
60  break;
61 
62  case 'ilmailsearchcoursesgui':
63  include_once 'Services/Contact/classes/class.ilMailSearchCoursesGUI.php';
64 
65  $this->activateTab('mail_my_courses');
66 
67  $this->ctrl->setReturn($this, "showAddressbook");
68  $this->ctrl->forwardCommand(new ilMailSearchCoursesGUI());
69  break;
70 
71  case 'ilmailsearchgroupsgui':
72  include_once 'Services/Contact/classes/class.ilMailSearchGroupsGUI.php';
73 
74  $this->activateTab('mail_my_groups');
75 
76  $this->ctrl->setReturn($this, "showAddressbook");
77  $this->ctrl->forwardCommand(new ilMailSearchGroupsGUI());
78  break;
79 
80  case 'ilmailinglistsgui':
81  include_once 'Services/Contact/classes/class.ilMailingListsGUI.php';
82 
83  $this->activateTab('mail_my_mailing_lists');
84 
85  $this->ctrl->setReturn($this, "showAddressbook");
86  $this->ctrl->forwardCommand(new ilMailingListsGUI());
87  break;
88 
89  default:
90  $this->activateTab('mail_my_entries');
91 
92  if (!($cmd = $this->ctrl->getCmd()))
93  {
94  $cmd = "showAddressbook";
95  }
96 
97  $this->$cmd();
98  break;
99  }
100  return true;
101  }
102 
106  function checkInput($addr_id = 0)
107  {
108  // check if user login and e-mail-address are empty
109  if (!strcmp(trim($_POST["login"]), "") &&
110  !strcmp(trim($_POST["email"]), ""))
111  {
112  ilUtil::sendInfo($this->lng->txt("mail_enter_login_or_email_addr"));
113  $error = true;
114  }
115  else if ($_POST["login"] != "" &&
117  {
118  ilUtil::sendInfo($this->lng->txt("mail_enter_valid_login"));
119  $error = true;
120  }
121  else if ($_POST["email"] &&
122  !(ilUtil::is_email($_POST["email"])))
123  {
124  ilUtil::sendInfo($this->lng->txt("mail_enter_valid_email_addr"));
125  $error = true;
126  }
127 
128  if (($this->existingEntry = $this->abook->checkEntryByLogin(ilUtil::stripSlashes($_POST["login"]))) > 0 &&
129  (($this->existingEntry != $addr_id && $addr_id > 0) || !$addr_id))
130  {
131  ilUtil::sendInfo($this->lng->txt("mail_entry_exists"));
132  $error = true;
133  }
134 
135  return $error ? false : true;
136  }
137 
141  public function saveEntry()
142  {
147  global $lng, $ilSetting;
148 
149  $autoupdate = (int)$_POST['auto_update'];
150  if(!$ilSetting->get('cron_upd_adrbook', 0))
151  {
152  $autoupdate = 0;
153  }
154 
155  if($this->checkInput($_GET['addr_id']))
156  {
157  if(!isset($_POST['login']) || !strlen($_POST['login']))
158  {
159  $autoupdate = 0;
160  }
161 
162  if($_GET['addr_id'])
163  {
164  $this->abook->updateEntry(ilUtil::stripSlashes($_GET['addr_id']),
165  ilUtil::stripSlashes($_POST['login']),
166  ilUtil::stripSlashes($_POST['firstname']),
167  ilUtil::stripSlashes($_POST['lastname']),
168  ilUtil::stripSlashes($_POST['email']),
169  $autoupdate
170  );
171  ilUtil::sendInfo($lng->txt('mail_entry_changed'));
172  }
173  else
174  {
175  $this->abook->addEntry(ilUtil::stripSlashes($_POST['login']),
176  ilUtil::stripSlashes($_POST['firstname']),
177  ilUtil::stripSlashes($_POST['lastname']),
178  ilUtil::stripSlashes($_POST['email']),
179  $autoupdate
180  );
181  ilUtil::sendInfo($lng->txt('mail_entry_added'));
182  }
183 
184  unset($_SESSION['addr_search']);
185 
186  $this->showAddressbook();
187  }
188  else
189  {
190  $this->showAddressForm();
191  }
192 
193  return true;
194  }
195 
199  function confirmDelete()
200  {
201  global $lng;
202 
203  $addr_ids = ((int)$_GET['addr_id']) ? array((int)$_GET['addr_id']) : $_POST['addr_id'];
204 
205  if (!$addr_ids)
206  {
207  ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
208  $this->showAddressbook();
209  return true;
210  }
211 
212  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
213  $c_gui = new ilConfirmationGUI();
214 
215  // set confirm/cancel commands
216  $c_gui->setFormAction($this->ctrl->getFormAction($this, "performDelete"));
217  $c_gui->setHeaderText($this->lng->txt("mail_sure_delete_entry"));
218  $c_gui->setCancel($this->lng->txt("cancel"), "showAddressbook");
219  $c_gui->setConfirm($this->lng->txt("confirm"), "performDelete");
220 
221  // add items to delete
222  foreach($addr_ids as $addr_id)
223  {
224  $entry = $this->abook->getEntry($addr_id);
225  $c_gui->addItem("addr_id[]", $addr_id, $entry["login"] ? $entry["login"] : $entry["email"]);
226  }
227 
228  $this->tpl->setTitle($this->lng->txt("mail_addressbook"));
229  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_addressbook.html", "Services/Contact");
230  $this->tpl->setVariable('DELETE_CONFIRMATION', $c_gui->getHTML());
231 
232  $this->tpl->show();
233 
234  return true;
235  }
236 
240  function performDelete()
241  {
242  global $lng;
243 
244  if (is_array($_POST['addr_id']))
245  {
246  if ($this->abook->deleteEntries($_POST['addr_id']))
247  {
248  ilUtil::sendInfo($lng->txt("mail_deleted_entry"));
249  }
250  else
251  {
252  ilUtil::sendInfo($lng->txt("mail_delete_error"));
253  }
254  }
255  else
256  {
257  ilUtil::sendInfo($lng->txt("mail_delete_error"));
258  }
259 
260  $this->showAddressbook();
261 
262  return true;
263  }
264 
268  function cancel()
269  {
270  $this->showAddressbook();
271  }
272 
273  public function showAddressForm()
274  {
279  global $lng, $ilSetting;
280 
281  $this->tpl->setTitle($this->lng->txt("mail_addressbook"));
282  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_addressbook_form.html", "Services/Contact");
283 
284  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
285  $form = new ilPropertyFormGUI();
286  $form->setTitle($_GET['addr_id'] ? $lng->txt("mail_edit_entry") : $lng->txt("mail_new_entry"));
287 
288  if ($_GET['addr_id'])
289  {
290  $this->ctrl->setParameter($this, 'addr_id', $_GET['addr_id']);
291  }
292 
293  $entry = $this->abook->getEntry($_GET['addr_id']);
294  $form->setFormAction($this->ctrl->getFormAction($this, "saveEntry"));
295 
296  $login = new ilTextInputGUI($this->lng->txt("username"), "login");
297  $login->setValue(isset($_POST['login']) ? ilUtil::prepareFormOutput($_POST['login'], true) : ilUtil::prepareFormOutput($entry['login']));
298  $login->setDataSource($this->ctrl->getLinkTarget($this, 'lookupUsersAsync', '', true));
299  $form->addItem($login);
300 
301  if($ilSetting->get('cron_upd_adrbook', 0))
302  {
303  $formItem = new ilCheckboxInputGUI('', 'auto_update');
304  $formItem->setChecked(isset($_POST['auto_update']) ? ilUtil::prepareFormOutput($_POST['auto_update'], true) : ilUtil::prepareFormOutput($entry['auto_update']));
305  $formItem->setInfo($this->lng->txt('cron_update_addressbook'));
306 
307  $login->addSubItem($formItem);
308  }
309 
310  $formItem = new ilTextInputGUI($this->lng->txt("firstname"), "firstname");
311  $formItem->setValue(isset($_POST['firstname']) ? ilUtil::prepareFormOutput($_POST['firstname'], true) : ilUtil::prepareFormOutput($entry['firstname']));
312  $form->addItem($formItem);
313 
314  $formItem = new ilTextInputGUI($this->lng->txt("lastname"), "lastname");
315  $formItem->setValue(isset($_POST['lastname']) ? ilUtil::prepareFormOutput($_POST['lastname'], true) : ilUtil::prepareFormOutput($entry['lastname']));
316  $form->addItem($formItem);
317 
318  $formItem = new ilTextInputGUI($this->lng->txt("email"), "email");
319  $formItem->setValue(isset($_POST['email']) ? ilUtil::prepareFormOutput($_POST['email'], true) : ilUtil::prepareFormOutput($entry['email']));
320  $formItem->setDataSource($this->ctrl->getLinkTarget($this, 'lookupEmailsAsync', '', true));
321  $form->addItem($formItem);
322 
323  $form->addCommandButton('saveEntry',$this->lng->txt('save'));
324  $form->addCommandButton('cancel',$this->lng->txt('cancel'));
325 
326  $this->tpl->setVariable('FORM', $form->getHTML());
327 
328  $this->tpl->show();
329 
330  return true;
331  }
332 
333  public function mailToUsers()
334  {
335  global $ilUser;
336 
337  if ($_GET['addr_id'] && is_array($_GET['addr_id']))
338  $addr_ids = $_GET['addr_id'];
339  else if ((int)$_GET['addr_id'])
340  $addr_ids = array((int)$_GET['addr_id']);
341  else if ($_POST['addr_id'] && is_array($_POST['addr_id']))
342  $addr_ids = $_POST['addr_id'];
343  else if ((int)$_POST['addr_id'])
344  $addr_ids = array((int)$_POST['addr_id']);
345 
346 // $addr_ids = ((int)$_GET['addr_id']) ? array((int)$_GET['addr_id']) : $_POST['addr_id'];
347 
348  if (!$addr_ids)
349  {
350  ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
351  $this->showAddressbook();
352  return true;
353  }
354 
355  $mail_data = $this->umail->getSavedData();
356  if(!is_array($mail_data))
357  {
358  $this->umail->savePostData($ilUser->getId(), array(), '', '', '', '', '', '', '', '');
359  }
360 
361  $members = array();
362  foreach ($addr_ids as $addr_id)
363  {
364  $entry = $this->abook->getEntry($addr_id);
365 
366  if(strlen($entry['login']) && !$this->umail->doesRecipientStillExists($entry['login'], $mail_data['rcp_to'])) {
367  $members[] = $entry['login'];
368  } else if(strlen($entry['email']) && !$this->umail->doesRecipientStillExists($entry['email'], $mail_data['rcp_to'])) {
369  $members[] = $entry['email'];
370  }
371  }
372 
373  if(count($members))
374  {
375  $mail_data = $this->umail->appendSearchResult($members, 'to');
376  $this->umail->savePostData(
377  $mail_data['user_id'],
378  $mail_data['attachments'],
379  $mail_data['rcp_to'],
380  $mail_data['rcp_cc'],
381  $mail_data['rcp_bcc'],
382  $mail_data['m_type'],
383  $mail_data['m_email'],
384  $mail_data['m_subject'],
385  $mail_data['m_message'],
386  $mail_data['use_placeholders']
387  );
388  }
389 
390  ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res");
391  }
392 
393  public function search()
394  {
395  $_SESSION['addr_search'] = $_POST['search_qry'];
396 
397  $this->showAddressbook();
398 
399  return true;
400  }
401 
405  public function showAddressbook()
406  {
413  global $rbacsystem, $lng, $ilCtrl, $ilSetting;
414 
415  $this->tpl->setTitle($this->lng->txt("mail_addressbook"));
416  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_addressbook.html", "Services/Contact");
417 
418  // check if current user may send mails
419  include_once "Services/Mail/classes/class.ilMail.php";
420  $mail = new ilMail($_SESSION["AccountId"]);
421  $mailing_allowed = $rbacsystem->checkAccess('internal_mail',$mail->getMailObjectReferenceId());
422 
423  $chatSettings = new ilSetting('chatroom');
424  $chat_active = $chatSettings->get("chat_enabled", false);
425 
426  // check if current user may send smtp mails
427  $smtp_mailing_allowed = $rbacsystem->checkAccess("smtp_mail", $this->umail->getMailObjectReferenceId());
428 
429  $tbl = new ilAddressbookTableGUI($this, '', $mailing_allowed, $chat_active);
430  $tbl->setSmtpMailingAllowed($smtp_mailing_allowed);
431 
432  $this->abook->setSearchQuery($tbl->getFilterQuery());
433  $entries = $this->abook->getEntries();
434 
435  $tbl->setData($entries);
436 
437  $this->tpl->setVariable('TABLE', $tbl->getHTML());
438 
439  $this->tpl->show();
440 
441  unset($_SESSION['addr_search']);
442 
443  return true;
444  }
445 
446 
450  public function inviteToChat()
451  {
458  global $ilUser, $lng, $ilCtrl, $tpl;
459 
460  $lng->loadLanguageModule('chatroom');
461 
462  $addr_ids = ((int)$_GET['addr_id']) ? array((int)$_GET['addr_id']) : $_POST['addr_id'];
463 
464  if(!$addr_ids)
465  {
466  ilUtil::sendFailure($lng->txt('select_one'), true);
467  $ilCtrl->redirect($this, 'showAddressbook');
468  }
469 
470  $no_login = array();
471 
472  foreach($addr_ids as $id)
473  {
474  $entry = $this->abook->getEntry($id);
475  if(!$entry['login'])
476  {
477  $no_login[] = $id;
478  }
479  }
480 
481  if(count($no_login))
482  {
483  $message = $lng->txt('chat_users_without_login') . ':<br>';
484  $list = '';
485 
486  foreach($no_login as $e)
487  {
488  $list .= '<li>' . $this->abook->entryToString($e) . '</li>';
489  }
490 
491  $message .= '<ul>';
492  $message .= $list;
493  $message .= '</ul>';
494 
495  ilUtil::sendFailure($message, true);
496  $ilCtrl->redirect($this, 'showAddressbook');
497  }
498 
499  include_once 'Modules/Chatroom/classes/class.ilChatroom.php';
500 
501  $ilChatroom = new ilChatroom();
502  $chat_rooms = $ilChatroom->getAllRooms($ilUser->getId());
503  $subrooms = array();
504 
505  foreach($chat_rooms as $room_id => $title)
506  {
507  $subrooms[] = $ilChatroom->getPrivateSubRooms($room_id, $ilUser->getId());
508  }
509 
510  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
511 
512  $form = new ilPropertyFormGUI();
513  $form->setTitle($lng->txt('mail_invite_users_to_chat'));
514 
515  $psel = new ilSelectInputGUI($lng->txt('chat_select_room'), 'room_id');
516  $options = array();
517 
518  foreach($chat_rooms as $room_id => $room)
519  {
520  $ref_id = $room_id;
521 
522  if($ilChatroom->isUserBanned($ilUser->getId()))
523  {
524  continue;
525  }
526 
527  $options[$ref_id] = $room;
528 
529  foreach($subrooms as $subroom)
530  {
531  foreach($subroom as $sub_id => $parent_id)
532  {
533  if($parent_id == $ref_id)
534  {
535  $title = ilChatroom::lookupPrivateRoomTitle($sub_id);
536  $options[$ref_id . ',' . $sub_id] = '+&nbsp;' . $title;
537  }
538  }
539  }
540  }
541 
542  $psel->setOptions($options);
543  $form->addItem($psel);
544  $phidden = new ilHiddenInputGUI('addr_ids');
545  $phidden->setValue(implode(',', $addr_ids));
546  $form->addItem($phidden);
547  $form->addCommandButton('submitInvitation', $this->lng->txt('submit'));
548  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
549  $form->setFormAction($ilCtrl->getFormAction($this));
550 
551  $tpl->setTitle($lng->txt('mail_invite_users_to_chat'));
552  $tpl->setContent($form->getHtml());
553  $tpl->show();
554  }
555 
560  public function submitInvitation()
561  {
567  global $ilUser, $ilCtrl, $lng;
568 
569  if(!$_POST['addr_ids'])
570  {
571  ilUtil::sendFailure($lng->txt('select_one'), true);
572  $ilCtrl->redirect($this, 'showAddressbook');
573  }
574 
575  if(!$_POST['room_id'])
576  {
577  ilUtil::sendFailure($lng->txt('select_one'));
578  $_POST['addr_id'] = explode(',', $_POST['addr_ids']);
579  $this->inviteToChat();
580  return;
581  }
582 
583  // get selected users (comma seperated user id list)
584  $ids = explode(',', $_POST['addr_ids']);
585 
586  // get selected chatroom from POST-String, format: "room_id , scope"
587  $room_ids = explode(',', $_POST['room_id']);
588  $room_id = (int)$room_ids[0];
589  $scope = 0;
590 
591  if(count($room_ids) > 0)
592  {
593  $scope = (int)$room_ids[1];
594  }
595 
596  include_once 'Modules/Chatroom/classes/class.ilChatroom.php';
597 
598  $room = ilChatroom::byRoomId((int)$room_id, true);
599  $no_access = array();
600  $no_login = array();
601  $valid_users = array();
602  $valid_user_to_login_map = array();
603 
604  foreach($ids as $id)
605  {
606  $entry = $this->abook->getEntry($id);
607 
608  if($entry['login'])
609  {
610  $user_id = $ilUser->getUserIdByLogin($entry['login']);
611  if(!$user_id)
612  {
613  $no_login[] = $id;
614  continue;
615  }
616  $ref_id = $room->getRefIdByRoomId($room_id);
617 
618  if
619  (
620  !ilChatroom::checkPermissionsOfUser($user_id, 'read', $ref_id) ||
621  $room->isUserBanned($user_id)
622  )
623  {
624  $no_access[] = $id;
625  }
626  else
627  {
628  $valid_users[] = $user_id;
629  $valid_user_to_login_map[$user_id] = $entry['login'];
630  }
631  }
632  else
633  {
634  $no_login[] = $id;
635  }
636  }
637 
638  if(count($no_access) || count($no_login))
639  {
640  $message = '';
641 
642  if(count($no_access))
643  {
644  $message .= $lng->txt('chat_users_without_permission') . ':<br>';
645  $list = '';
646 
647  foreach($no_access as $e)
648  {
649  $list .= '<li>' . $this->abook->entryToString($e) . '</li>';
650  }
651 
652  $message .= '<ul>';
653  $message .= $list;
654  $message .= '</ul>';
655  }
656 
657  if(count($no_login))
658  {
659  $message .= $lng->txt('chat_users_without_login') . ':<br>';
660  $list = '';
661 
662  foreach($no_login as $e)
663  {
664  $list .= '<li>' . $this->abook->entryToString($e) . '</li>';
665  }
666 
667  $message .= '<ul>';
668  $message .= $list;
669  $message .= '</ul>';
670  }
671 
672  ilUtil::sendFailure($message);
673  $_POST['addr_id'] = $ids;
674  $this->inviteToChat();
675  return;
676  }
677 
678  $ref_id = $room->getRefIdByRoomId($room_id);
679 
680  $url = '';
681  include_once 'Services/Link/classes/class.ilLink.php';
682  if($scope)
683  {
684  $url = ilLink::_getStaticLink($ref_id, 'chta', true, '_'.$scope);
685  }
686  else
687  {
688  $url = ilLink::_getStaticLink($ref_id, 'chta');
689  }
690  $link = '<p><a target="chatframe" href="' . $url . '" title="' . $lng->txt('goto_invitation_chat') . '">' .$lng->txt('goto_invitation_chat') . '</a></p>';
691 
692  $userlist = array();
693  foreach($valid_users as $id)
694  {
695  $room->inviteUserToPrivateRoom($id, $scope);
696  $room->sendInvitationNotification(
697  null, $ilUser->getId(), $id, (int)$scope, $url
698  );
699  $userlist[] = '<li>'.$valid_user_to_login_map[$id].'</li>';
700  }
701 
702  if($userlist)
703  {
704  ilUtil::sendSuccess($lng->txt('chat_users_have_been_invited') . '<ul>'.implode('', $userlist).'</ul>' . $link, true);
705  }
706  $ilCtrl->redirect($this, 'showAddressbook');
707  }
708 
709  public function lookupUsersAsync()
710  {
711  include_once 'Services/JSON/classes/class.ilJsonUtil.php';
712  include_once 'Services/Contact/classes/class.ilMailAddressbook.php';
713 
714  $search = "%" . $_REQUEST["term"] . "%";
715  $mailAdrBookObj = new ilMailAddressbook();
716  $result = $mailAdrBookObj->getUsersAsync($search, $_REQUEST["term"]);
717 
719  exit;
720  }
721 
722  public function lookupAddressbookAsync()
723  {
724  include_once 'Services/JSON/classes/class.ilJsonUtil.php';
725  include_once 'Services/Contact/classes/class.ilMailAddressbook.php';
726 
727  $search = "%" . $_REQUEST["term"] . "%";
728  $mailAdrBookObj = new ilMailAddressbook();
729  $result = $mailAdrBookObj->getAddressbookAsync($search, $_REQUEST["term"]);
730 
732  exit;
733  }
734 
735  public function lookupEmailsAsync()
736  {
737  include_once 'Services/JSON/classes/class.ilJsonUtil.php';
738  include_once 'Services/Contact/classes/class.ilMailAddressbook.php';
739 
740  $search = "%" . $_REQUEST["term"] . "%";
741  $mailAdrBookObj = new ilMailAddressbook();
742  $result = $mailAdrBookObj->getEmailsAsync($search, $_REQUEST["term"]);
743 
745  exit;
746  }
747 
748  function showSubTabs()
749  {
750  global $ilHelp;
751 
752  if($this->tabs_gui->hasTabs())
753  {
754  $this->tabs_gui->addSubTab('mail_my_entries', $this->lng->txt('mail_my_entries'), $this->ctrl->getLinkTarget($this));
755  $this->tabs_gui->addSubTab('mail_my_mailing_lists', $this->lng->txt('mail_my_mailing_lists'), $this->ctrl->getLinkTargetByClass('ilmailinglistsgui'));
756  $this->tabs_gui->addSubTab('mail_my_courses', $this->lng->txt('mail_my_courses'), $this->ctrl->getLinkTargetByClass('ilmailsearchcoursesgui'));
757  $this->tabs_gui->addSubTab('mail_my_groups', $this->lng->txt('mail_my_groups'), $this->ctrl->getLinkTargetByClass('ilmailsearchgroupsgui'));
758  $this->has_sub_tabs = true;
759  }
760  else
761  {
762  $ilHelp->setScreenIdComponent("contacts");
763 
764  $this->tabs_gui->addTab('mail_my_entries', $this->lng->txt('mail_my_entries'), $this->ctrl->getLinkTarget($this));
765  $this->tabs_gui->addTab('mail_my_mailing_lists', $this->lng->txt('mail_my_mailing_lists'), $this->ctrl->getLinkTargetByClass('ilmailinglistsgui'));
766  $this->tabs_gui->addTab('mail_my_courses', $this->lng->txt('mail_my_courses'), $this->ctrl->getLinkTargetByClass('ilmailsearchcoursesgui'));
767  $this->tabs_gui->addTab('mail_my_groups', $this->lng->txt('mail_my_groups'), $this->ctrl->getLinkTargetByClass('ilmailsearchgroupsgui'));
768  }
769  }
770 
771  function activateTab($a_id)
772  {
773  if($this->has_sub_tabs)
774  {
775  $this->tabs_gui->activateSubTab($a_id);
776  }
777  else
778  {
779  $this->tabs_gui->activateTab($a_id);
780  }
781  }
782 
783  public function setAddressbookFilter()
784  {
785  $table = new ilAddressbookTableGUI($this, 'showAddressbook');
786  $table->resetOffset();
787  $table->writeFilterToSession();
788  $this->showAddressbook();
789  }
790 
791  public function resetAddressbookFilter()
792  {
793  $table = new ilAddressbookTableGUI($this, 'showAddressbook');
794  $table->resetOffset();
795  $table->resetFilter();
796  $this->showAddressbook();
797  }
798 }
799 ?>