ILIAS  release_4-4 Revision
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 ()
 
 lookupAddressbookAsync ()
 
 showSubTabs ()
 
 activateTab ($a_id)
 

Private Attributes

 $tpl = null
 
 $ctrl = 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 876 of file class.ilMailAddressbookGUI.php.

Referenced by executeCommand().

877  {
878  if($this->has_sub_tabs)
879  {
880  $this->tabs_gui->activateSubTab($a_id);
881  }
882  else
883  {
884  $this->tabs_gui->activateTab($a_id);
885  }
886  }
+ 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 832 of file class.ilMailAddressbookGUI.php.

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

833  {
834  include_once 'Services/JSON/classes/class.ilJsonUtil.php';
835  include_once 'Services/Contact/classes/class.ilMailAddressbook.php';
836 
837  $search = "%" . $_REQUEST["term"] . "%";
838  $result = array();
839 
840  if( !$search )
841  {
843  exit;
844  }
845 
846  $mailAdrBookObj = new ilMailAddressbook;
847  $result = $mailAdrBookObj->getAddressbookAsync($search);
848 
850  exit;
851  }
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 331 of file class.ilMailAddressbookGUI.php.

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

332  {
333  global $ilUser;
334 
335  if ($_GET['addr_id'] && is_array($_GET['addr_id']))
336  $addr_ids = $_GET['addr_id'];
337  else if ((int)$_GET['addr_id'])
338  $addr_ids = array((int)$_GET['addr_id']);
339  else if ($_POST['addr_id'] && is_array($_POST['addr_id']))
340  $addr_ids = $_POST['addr_id'];
341  else if ((int)$_POST['addr_id'])
342  $addr_ids = array((int)$_POST['addr_id']);
343 
344 // $addr_ids = ((int)$_GET['addr_id']) ? array((int)$_GET['addr_id']) : $_POST['addr_id'];
345 
346  if (!$addr_ids)
347  {
348  ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
349  $this->showAddressbook();
350  return true;
351  }
352 
353  $mail_data = $this->umail->getSavedData();
354  if(!is_array($mail_data))
355  {
356  $this->umail->savePostData($ilUser->getId(), array(), '', '', '', '', '', '', '', '');
357  }
358 
359  $members = array();
360  foreach ($addr_ids as $addr_id)
361  {
362  $entry = $this->abook->getEntry($addr_id);
363 
364  if(strlen($entry['login']) && !$this->umail->doesRecipientStillExists($entry['login'], $mail_data['rcp_to'])) {
365  $members[] = $entry['login'];
366  } else if(strlen($entry['email']) && !$this->umail->doesRecipientStillExists($entry['email'], $mail_data['rcp_to'])) {
367  $members[] = $entry['email'];
368  }
369  }
370 
371  if(count($members))
372  {
373  $mail_data = $this->umail->appendSearchResult($members, 'to');
374  $this->umail->savePostData(
375  $mail_data['user_id'],
376  $mail_data['attachments'],
377  $mail_data['rcp_to'],
378  $mail_data['rcp_cc'],
379  $mail_data['rcp_bcc'],
380  $mail_data['m_type'],
381  $mail_data['m_email'],
382  $mail_data['m_subject'],
383  $mail_data['m_message'],
384  $mail_data['use_placeholders']
385  );
386  }
387 
388  ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res");
389  }
$_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:

◆ search()

ilMailAddressbookGUI::search ( )

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

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

392  {
393  $_SESSION['addr_search'] = $_POST['search_qry'];
394 
395  $this->showAddressbook();
396 
397  return true;
398  }
< 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:

◆ showSubTabs()

ilMailAddressbookGUI::showSubTabs ( )

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

Referenced by executeCommand().

854  {
855  global $ilHelp;
856 
857  if($this->tabs_gui->hasTabs())
858  {
859  $this->tabs_gui->addSubTab('mail_my_entries', $this->lng->txt('mail_my_entries'), $this->ctrl->getLinkTarget($this));
860  $this->tabs_gui->addSubTab('mail_my_mailing_lists', $this->lng->txt('mail_my_mailing_lists'), $this->ctrl->getLinkTargetByClass('ilmailinglistsgui'));
861  $this->tabs_gui->addSubTab('mail_my_courses', $this->lng->txt('mail_my_courses'), $this->ctrl->getLinkTargetByClass('ilmailsearchcoursesgui'));
862  $this->tabs_gui->addSubTab('mail_my_groups', $this->lng->txt('mail_my_groups'), $this->ctrl->getLinkTargetByClass('ilmailsearchgroupsgui'));
863  $this->has_sub_tabs = true;
864  }
865  else
866  {
867  $ilHelp->setScreenIdComponent("contacts");
868 
869  $this->tabs_gui->addTab('mail_my_entries', $this->lng->txt('mail_my_entries'), $this->ctrl->getLinkTarget($this));
870  $this->tabs_gui->addTab('mail_my_mailing_lists', $this->lng->txt('mail_my_mailing_lists'), $this->ctrl->getLinkTargetByClass('ilmailinglistsgui'));
871  $this->tabs_gui->addTab('mail_my_courses', $this->lng->txt('mail_my_courses'), $this->ctrl->getLinkTargetByClass('ilmailsearchcoursesgui'));
872  $this->tabs_gui->addTab('mail_my_groups', $this->lng->txt('mail_my_groups'), $this->ctrl->getLinkTargetByClass('ilmailsearchgroupsgui'));
873  }
874  }
+ 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
private

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: