ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMailAddressbookGUI Class Reference
+ Collaboration diagram for ilMailAddressbookGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 checkInput ($addr_id=0)
 Check user's input. More...
 
 confirmDelete ()
 Confirm delete entry. More...
 
 performDelete ()
 Delete entry. More...
 
 cancel ()
 Cancel action. More...
 
 mailToUsers ()
 
 search ()
 
 lookupUsersAsync ()
 
 lookupAddressbookAsync ()
 
 lookupEmailsAsync ()
 
 showSubTabs ()
 
 activateTab ($a_id)
 
 setAddressbookFilter ()
 
 resetAddressbookFilter ()
 

Data Fields

 $ctrl = null
 

Private Attributes

 $tpl = null
 
 $lng = null
 
 $tabs_gui = null
 
 $umail = null
 
 $abook = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMailAddressbookGUI::__construct ( )

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

References $ilCtrl, $ilUser, $lng, and $tpl.

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  }
Mail Box class Base class for creating and handling mail boxes.
global $ilCtrl
Definition: ilias.php:18
Class UserMail this class handles user mails.
global $ilUser
Definition: imgupload.php:15

Member Function Documentation

◆ activateTab()

ilMailAddressbookGUI::activateTab (   $a_id)

Definition at line 771 of file class.ilMailAddressbookGUI.php.

Referenced by executeCommand().

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  }
+ Here is the caller graph for this function:

◆ cancel()

ilMailAddressbookGUI::cancel ( )

Cancel action.

Definition at line 268 of file class.ilMailAddressbookGUI.php.

References $_GET, $_POST, $ilSetting, $lng, ilUtil\prepareFormOutput(), and ilTextInputGUI\setValue().

269  {
270  $this->showAddressbook();
271  }
+ Here is the call graph for this function:

◆ checkInput()

ilMailAddressbookGUI::checkInput (   $addr_id = 0)

Check user's input.

Definition at line 106 of file class.ilMailAddressbookGUI.php.

References $_GET, $_POST, $_SESSION, $ilSetting, $lng, ilObjUser\_lookupId(), ilUtil\is_email(), ilUtil\sendInfo(), and ilUtil\stripSlashes().

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  }
$_POST['username']
Definition: cron.php:12
static is_email($a_email)
This preg-based function checks whether an e-mail address is formally valid.
static _lookupId($a_user_str)
lookup id by login
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:

◆ confirmDelete()

ilMailAddressbookGUI::confirmDelete ( )

Confirm delete entry.

Definition at line 199 of file class.ilMailAddressbookGUI.php.

References $_GET, $_POST, $lng, and ilUtil\sendInfo().

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  }
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Confirmation screen class.
+ Here is the call graph for this function:

◆ executeCommand()

ilMailAddressbookGUI::executeCommand ( )

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

References $cmd, $ilUser, activateTab(), and showSubTabs().

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  }
$cmd
Definition: sahs_server.php:35
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ lookupAddressbookAsync()

ilMailAddressbookGUI::lookupAddressbookAsync ( )

Definition at line 722 of file class.ilMailAddressbookGUI.php.

References $_REQUEST, $result, ilJsonUtil\encode(), and exit.

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  }
exit
Definition: login.php:54
$result
static encode($mixed, $suppress_native=false)
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ lookupEmailsAsync()

ilMailAddressbookGUI::lookupEmailsAsync ( )

Definition at line 735 of file class.ilMailAddressbookGUI.php.

References $_REQUEST, $result, ilJsonUtil\encode(), and exit.

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  }
exit
Definition: login.php:54
$result
static encode($mixed, $suppress_native=false)
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ lookupUsersAsync()

ilMailAddressbookGUI::lookupUsersAsync ( )

Definition at line 709 of file class.ilMailAddressbookGUI.php.

References $_REQUEST, $result, ilJsonUtil\encode(), and exit.

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  }
exit
Definition: login.php:54
$result
static encode($mixed, $suppress_native=false)
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ mailToUsers()

ilMailAddressbookGUI::mailToUsers ( )

Definition at line 333 of file class.ilMailAddressbookGUI.php.

References $_GET, $_POST, $ilUser, ilUtil\redirect(), and ilUtil\sendInfo().

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  }
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $ilUser
Definition: imgupload.php:15
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:

◆ performDelete()

ilMailAddressbookGUI::performDelete ( )

Delete entry.

Definition at line 240 of file class.ilMailAddressbookGUI.php.

References $_POST, $lng, and ilUtil\sendInfo().

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  }
$_POST['username']
Definition: cron.php:12
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ resetAddressbookFilter()

ilMailAddressbookGUI::resetAddressbookFilter ( )

Definition at line 791 of file class.ilMailAddressbookGUI.php.

792  {
793  $table = new ilAddressbookTableGUI($this, 'showAddressbook');
794  $table->resetOffset();
795  $table->resetFilter();
796  $this->showAddressbook();
797  }

◆ search()

ilMailAddressbookGUI::search ( )

Definition at line 393 of file class.ilMailAddressbookGUI.php.

References $_GET, $_POST, $_SESSION, $ilCtrl, $ilSetting, $ilUser, $lng, $options, $ref_id, $tpl, ilLink\_getStaticLink(), ilChatroom\byRoomId(), ilChatroom\checkPermissionsOfUser(), ilChatroom\lookupPrivateRoomTitle(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilSelectInputGUI\setOptions().

394  {
395  $_SESSION['addr_search'] = $_POST['search_qry'];
396 
397  $this->showAddressbook();
398 
399  return true;
400  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_POST['username']
Definition: cron.php:12
+ Here is the call graph for this function:

◆ setAddressbookFilter()

ilMailAddressbookGUI::setAddressbookFilter ( )

Definition at line 783 of file class.ilMailAddressbookGUI.php.

784  {
785  $table = new ilAddressbookTableGUI($this, 'showAddressbook');
786  $table->resetOffset();
787  $table->writeFilterToSession();
788  $this->showAddressbook();
789  }

◆ showSubTabs()

ilMailAddressbookGUI::showSubTabs ( )

Definition at line 748 of file class.ilMailAddressbookGUI.php.

Referenced by executeCommand().

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  }
+ Here is the caller graph for this function:

Field Documentation

◆ $abook

ilMailAddressbookGUI::$abook = null
private

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

◆ $ctrl

ilMailAddressbookGUI::$ctrl = null

Definition at line 23 of file class.ilMailAddressbookGUI.php.

◆ $lng

ilMailAddressbookGUI::$lng = null
private

◆ $tabs_gui

ilMailAddressbookGUI::$tabs_gui = null
private

Definition at line 25 of file class.ilMailAddressbookGUI.php.

◆ $tpl

ilMailAddressbookGUI::$tpl = null
private

Definition at line 22 of file class.ilMailAddressbookGUI.php.

Referenced by __construct(), and search().

◆ $umail

ilMailAddressbookGUI::$umail = null
private

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


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