ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilMailAddressbookGUI Class Reference
+ Collaboration diagram for ilMailAddressbookGUI:

Public Member Functions

 __construct ()
 executeCommand ()
 checkInput ($addr_id=0)
 Check user's input.
 confirmDelete ()
 Confirm delete entry.
 performDelete ()
 Delete entry.
 cancel ()
 Cancel action.
 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

ilMailAddressbookGUI::__construct ( )

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

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

{
global $tpl, $ilCtrl, $lng, $ilUser, $ilTabs;
$this->tpl = $tpl;
$this->ctrl = $ilCtrl;
$this->lng = $lng;
$this->tabs_gui =& $ilTabs;
$this->ctrl->saveParameter($this, "mobj_id");
$this->umail = new ilFormatMail($ilUser->getId());
$this->abook = new ilAddressbook($ilUser->getId());
}

Member Function Documentation

ilMailAddressbookGUI::activateTab (   $a_id)

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

Referenced by executeCommand().

{
if($this->has_sub_tabs)
{
$this->tabs_gui->activateSubTab($a_id);
}
else
{
$this->tabs_gui->activateTab($a_id);
}
}

+ Here is the caller graph for this function:

ilMailAddressbookGUI::cancel ( )

Cancel action.

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

{
$this->showAddressbook();
}
ilMailAddressbookGUI::checkInput (   $addr_id = 0)

Check user's input.

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

References $_POST, ilObjUser\_lookupId(), ilUtil\is_email(), ilUtil\sendInfo(), and ilUtil\stripSlashes().

{
// check if user login and e-mail-address are empty
if (!strcmp(trim($_POST["login"]), "") &&
!strcmp(trim($_POST["email"]), ""))
{
ilUtil::sendInfo($this->lng->txt("mail_enter_login_or_email_addr"));
$error = true;
}
else if ($_POST["login"] != "" &&
{
ilUtil::sendInfo($this->lng->txt("mail_enter_valid_login"));
$error = true;
}
else if ($_POST["email"] &&
!(ilUtil::is_email($_POST["email"])))
{
ilUtil::sendInfo($this->lng->txt("mail_enter_valid_email_addr"));
$error = true;
}
if (($this->existingEntry = $this->abook->checkEntryByLogin(ilUtil::stripSlashes($_POST["login"]))) > 0 &&
(($this->existingEntry != $addr_id && $addr_id > 0) || !$addr_id))
{
ilUtil::sendInfo($this->lng->txt("mail_entry_exists"));
$error = true;
}
return $error ? false : true;
}

+ Here is the call graph for this function:

ilMailAddressbookGUI::confirmDelete ( )

Confirm delete entry.

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

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

{
global $lng;
$addr_ids = ((int)$_GET['addr_id']) ? array((int)$_GET['addr_id']) : $_POST['addr_id'];
if (!$addr_ids)
{
ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
$this->showAddressbook();
return true;
}
include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
$c_gui = new ilConfirmationGUI();
// set confirm/cancel commands
$c_gui->setFormAction($this->ctrl->getFormAction($this, "performDelete"));
$c_gui->setHeaderText($this->lng->txt("mail_sure_delete_entry"));
$c_gui->setCancel($this->lng->txt("cancel"), "showAddressbook");
$c_gui->setConfirm($this->lng->txt("confirm"), "performDelete");
// add items to delete
foreach($addr_ids as $addr_id)
{
$entry = $this->abook->getEntry($addr_id);
$c_gui->addItem("addr_id[]", $addr_id, $entry["login"] ? $entry["login"] : $entry["email"]);
}
$this->tpl->setTitle($this->lng->txt("mail_addressbook"));
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_addressbook.html", "Services/Contact");
$this->tpl->setVariable('DELETE_CONFIRMATION', $c_gui->getHTML());
$this->tpl->show();
return true;
}

+ Here is the call graph for this function:

ilMailAddressbookGUI::executeCommand ( )

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

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

{
global $ilUser;
$this->showSubTabs();
$forward_class = $this->ctrl->getNextClass($this);
// delete all stored maildata
$this->umail->savePostData($ilUser->getId(), array(), '', '', '', '', '', '', '', '');
switch($forward_class)
{
case 'ilmailformgui':
include_once 'Services/Mail/classes/class.ilMailFormGUI.php';
$this->ctrl->forwardCommand(new ilMailFormGUI());
break;
case 'ilmailsearchcoursesgui':
include_once 'Services/Contact/classes/class.ilMailSearchCoursesGUI.php';
$this->activateTab('mail_my_courses');
$this->ctrl->setReturn($this, "showAddressbook");
$this->ctrl->forwardCommand(new ilMailSearchCoursesGUI());
break;
case 'ilmailsearchgroupsgui':
include_once 'Services/Contact/classes/class.ilMailSearchGroupsGUI.php';
$this->activateTab('mail_my_groups');
$this->ctrl->setReturn($this, "showAddressbook");
$this->ctrl->forwardCommand(new ilMailSearchGroupsGUI());
break;
case 'ilmailinglistsgui':
include_once 'Services/Contact/classes/class.ilMailingListsGUI.php';
$this->activateTab('mail_my_mailing_lists');
$this->ctrl->setReturn($this, "showAddressbook");
$this->ctrl->forwardCommand(new ilMailingListsGUI());
break;
default:
$this->activateTab('mail_my_entries');
if (!($cmd = $this->ctrl->getCmd()))
{
$cmd = "showAddressbook";
}
$this->$cmd();
break;
}
return true;
}

+ Here is the call graph for this function:

ilMailAddressbookGUI::lookupAddressbookAsync ( )

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

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

{
include_once 'Services/JSON/classes/class.ilJsonUtil.php';
include_once 'Services/Contact/classes/class.ilMailAddressbook.php';
$search = "%" . $_REQUEST["term"] . "%";
$result = array();
if( !$search )
{
}
$mailAdrBookObj = new ilMailAddressbook;
$result = $mailAdrBookObj->getAddressbookAsync($search);
}

+ Here is the call graph for this function:

ilMailAddressbookGUI::mailToUsers ( )

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

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

{
global $ilUser;
if ($_GET['addr_id'] && is_array($_GET['addr_id']))
$addr_ids = $_GET['addr_id'];
else if ((int)$_GET['addr_id'])
$addr_ids = array((int)$_GET['addr_id']);
else if ($_POST['addr_id'] && is_array($_POST['addr_id']))
$addr_ids = $_POST['addr_id'];
else if ((int)$_POST['addr_id'])
$addr_ids = array((int)$_POST['addr_id']);
// $addr_ids = ((int)$_GET['addr_id']) ? array((int)$_GET['addr_id']) : $_POST['addr_id'];
if (!$addr_ids)
{
ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
$this->showAddressbook();
return true;
}
$mail_data = $this->umail->getSavedData();
if(!is_array($mail_data))
{
$this->umail->savePostData($ilUser->getId(), array(), '', '', '', '', '', '', '', '');
}
$members = array();
foreach ($addr_ids as $addr_id)
{
$entry = $this->abook->getEntry($addr_id);
if(strlen($entry['login']) && !$this->umail->doesRecipientStillExists($entry['login'], $mail_data['rcp_to'])) {
$members[] = $entry['login'];
} else if(strlen($entry['email']) && !$this->umail->doesRecipientStillExists($entry['email'], $mail_data['rcp_to'])) {
$members[] = $entry['email'];
}
}
if(count($members))
{
$mail_data = $this->umail->appendSearchResult($members, 'to');
$this->umail->savePostData(
$mail_data['user_id'],
$mail_data['attachments'],
$mail_data['rcp_to'],
$mail_data['rcp_cc'],
$mail_data['rcp_bcc'],
$mail_data['m_type'],
$mail_data['m_email'],
$mail_data['m_subject'],
$mail_data['m_message'],
$mail_data['use_placeholders']
);
}
ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res");
}

+ Here is the call graph for this function:

ilMailAddressbookGUI::performDelete ( )

Delete entry.

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

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

{
global $lng;
if (is_array($_POST['addr_id']))
{
if ($this->abook->deleteEntries($_POST['addr_id']))
{
ilUtil::sendInfo($lng->txt("mail_deleted_entry"));
}
else
{
ilUtil::sendInfo($lng->txt("mail_delete_error"));
}
}
else
{
ilUtil::sendInfo($lng->txt("mail_delete_error"));
}
$this->showAddressbook();
return true;
}

+ Here is the call graph for this function:

ilMailAddressbookGUI::search ( )

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

References $_POST, and $_SESSION.

{
$_SESSION['addr_search'] = $_POST['search_qry'];
$this->showAddressbook();
return true;
}
ilMailAddressbookGUI::showSubTabs ( )

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

Referenced by executeCommand().

{
global $ilHelp;
if($this->tabs_gui->hasTabs())
{
$this->tabs_gui->addSubTab('mail_my_entries', $this->lng->txt('mail_my_entries'), $this->ctrl->getLinkTarget($this));
$this->tabs_gui->addSubTab('mail_my_mailing_lists', $this->lng->txt('mail_my_mailing_lists'), $this->ctrl->getLinkTargetByClass('ilmailinglistsgui'));
$this->tabs_gui->addSubTab('mail_my_courses', $this->lng->txt('mail_my_courses'), $this->ctrl->getLinkTargetByClass('ilmailsearchcoursesgui'));
$this->tabs_gui->addSubTab('mail_my_groups', $this->lng->txt('mail_my_groups'), $this->ctrl->getLinkTargetByClass('ilmailsearchgroupsgui'));
$this->has_sub_tabs = true;
}
else
{
$ilHelp->setScreenIdComponent("contacts");
$this->tabs_gui->addTab('mail_my_entries', $this->lng->txt('mail_my_entries'), $this->ctrl->getLinkTarget($this));
$this->tabs_gui->addTab('mail_my_mailing_lists', $this->lng->txt('mail_my_mailing_lists'), $this->ctrl->getLinkTargetByClass('ilmailinglistsgui'));
$this->tabs_gui->addTab('mail_my_courses', $this->lng->txt('mail_my_courses'), $this->ctrl->getLinkTargetByClass('ilmailsearchcoursesgui'));
$this->tabs_gui->addTab('mail_my_groups', $this->lng->txt('mail_my_groups'), $this->ctrl->getLinkTargetByClass('ilmailsearchgroupsgui'));
}
}

+ Here is the caller graph for this function:

Field Documentation

ilMailAddressbookGUI::$abook = null
private

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

ilMailAddressbookGUI::$ctrl = null
private

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

ilMailAddressbookGUI::$lng = null
private

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

Referenced by __construct(), confirmDelete(), and performDelete().

ilMailAddressbookGUI::$tabs_gui = null
private

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

ilMailAddressbookGUI::$tpl = null
private

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

Referenced by __construct().

ilMailAddressbookGUI::$umail = null
private

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


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