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

Public Member Functions

 __construct ($wsp_access_handler=null, $wsp_node_id=null)
 executeCommand ()
 mail ()
 mailGroups ()
 mailMembers ()
 adoptMembers ()
 Take over course members to addressbook.
 cancel ()
 Cancel action.
 showMyGroups ()
 Show user's courses.
 showMembers ()
 Show course members.
 share ()

Protected Member Functions

 addPermission ($a_obj_ids)

Protected Attributes

 $mailing_allowed

Private Attributes

 $tpl = null
 $ctrl = null
 $lng = null
 $umail = null
 $abook = null

Detailed Description

Author
Jens Conze
Version
Id:
class.ilMailSearchGroupsGUI.php 61492 2016-01-05 08:57:10Z gitmgr

Definition at line 16 of file class.ilMailSearchGroupsGUI.php.

Constructor & Destructor Documentation

ilMailSearchGroupsGUI::__construct (   $wsp_access_handler = null,
  $wsp_node_id = null 
)

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

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

{
global $tpl, $ilCtrl, $lng, $ilUser, $rbacsystem;
$this->tpl = $tpl;
$this->ctrl = $ilCtrl;
$this->lng = $lng;
// personal workspace
$this->wsp_access_handler = $wsp_access_handler;
$this->wsp_node_id = $wsp_node_id;
$this->ctrl->saveParameter($this, "mobj_id");
$this->ctrl->saveParameter($this, "ref");
// check if current user may send mails
include_once "Services/Mail/classes/class.ilMail.php";
$mail = new ilMail($_SESSION["AccountId"]);
$this->mailing_allowed = $rbacsystem->checkAccess('internal_mail',$mail->getMailObjectReferenceId());
$this->umail = new ilFormatMail($ilUser->getId());
$this->abook = new ilAddressbook($ilUser->getId());
}

Member Function Documentation

ilMailSearchGroupsGUI::addPermission (   $a_obj_ids)
protected

Definition at line 510 of file class.ilMailSearchGroupsGUI.php.

References ilUtil\sendSuccess().

Referenced by share().

{
if(!is_array($a_obj_ids))
{
$a_obj_ids = array($a_obj_ids);
}
$existing = $this->wsp_access_handler->getPermissions($this->wsp_node_id);
$added = false;
foreach($a_obj_ids as $object_id)
{
if(!in_array($object_id, $existing))
{
$added = $this->wsp_access_handler->addPermission($this->wsp_node_id, $object_id);
}
}
if($added)
{
ilUtil::sendSuccess($this->lng->txt("wsp_share_success"), true);
}
$this->ctrl->redirectByClass("ilworkspaceaccessgui", "share");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMailSearchGroupsGUI::adoptMembers ( )

Take over course members to addressbook.

Definition at line 228 of file class.ilMailSearchGroupsGUI.php.

References $_GET, $_POST, $lng, ilObjUser\_lookupEmail(), ilObjUser\_lookupLogin(), ilObjUser\_lookupName(), ilObjUser\_lookupPref(), ilUtil\sendInfo(), and showMembers().

{
global $lng;
$ids = ((int)$_GET['search_members']) ? array((int)$_GET['search_members']) : $_POST['search_members'];
if ($ids )
{
foreach ($ids as $member)
{
$login = ilObjUser::_lookupLogin($member);
if (!$this->abook->checkEntry($login))
{
$name = ilObjUser::_lookupName($member);
$email = '';
if(ilObjUser::_lookupPref((int)$member, 'public_email') == 'y')
{
$email = ilObjUser::_lookupEmail($member);
}
$this->abook->addEntry(
$login,
$name["firstname"],
$name["lastname"],
$email
);
}
}
ilUtil::sendInfo($lng->txt("mail_members_added_addressbook"));
}
else
{
ilUtil::sendInfo($lng->txt("mail_select_one_entry"));
}
$this->showMembers();
}

+ Here is the call graph for this function:

ilMailSearchGroupsGUI::cancel ( )

Cancel action.

Definition at line 269 of file class.ilMailSearchGroupsGUI.php.

References $_GET, and showMyGroups().

{
if ($_GET["view"] == "mygroups" &&
$_GET["ref"] == "mail")
{
$this->ctrl->returnToParent($this);
}
else
{
$this->showMyGroups();
}
}

+ Here is the call graph for this function:

ilMailSearchGroupsGUI::executeCommand ( )

Definition at line 51 of file class.ilMailSearchGroupsGUI.php.

References $cmd.

{
$forward_class = $this->ctrl->getNextClass($this);
switch($forward_class)
{
default:
if (!($cmd = $this->ctrl->getCmd()))
{
$cmd = "showMyGroups";
}
$this->$cmd();
break;
}
return true;
}
ilMailSearchGroupsGUI::mail ( )

Definition at line 68 of file class.ilMailSearchGroupsGUI.php.

References $_GET, $_POST, $lng, mailGroups(), mailMembers(), ilUtil\sendInfo(), showMembers(), and showMyGroups().

{
global $lng;
if ($_GET["view"] == "mygroups")
{
$ids = ((int) $_GET['search_grp']) ? array((int)$_GET['search_grp']) : $_POST['search_grp'];
if ($ids)
{
$this->mailGroups();
}
else
{
ilUtil::sendInfo($lng->txt("mail_select_group"));
$this->showMyGroups();
}
}
else if ($_GET["view"] == "grp_members")
{
$ids = ((int) $_GET['search_members']) ? array((int)$_GET['search_members']) : $_POST['search_members'];
if ($ids)
{
$this->mailMembers();
}
else
{
ilUtil::sendInfo($lng->txt("mail_select_one_entry"));
$this->showMembers();
}
}
else
{
$this->showMyGroups();
}
}

+ Here is the call graph for this function:

ilMailSearchGroupsGUI::mailGroups ( )

Definition at line 104 of file class.ilMailSearchGroupsGUI.php.

References $_GET, $_POST, $ilUser, $ref_id, ilObject\_getAllReferences(), and ilUtil\redirect().

Referenced by mail().

{
global $ilUser, $rbacreview;
$members = array();
if (!is_array($old_mail_data = $this->umail->getSavedData()))
{
$this->umail->savePostData(
$ilUser->getId(),
array(),
"",
"",
"",
"",
"",
"",
"",
""
);
}
require_once './Services/Object/classes/class.ilObject.php';
$ids = ((int) $_GET['search_grp']) ? array((int)$_GET['search_grp']) : $_POST['search_grp'];
foreach ($ids as $grp_id)
{
$ref_ids = ilObject::_getAllReferences($grp_id);
foreach ($ref_ids as $ref_id)
{
$roles = $rbacreview->getAssignableChildRoles($ref_id);
foreach ($roles as $role)
{
if (substr($role['title'], 0, 14) == 'il_grp_member_' ||
substr($role['title'], 0, 13) == 'il_grp_admin_')
{
if(isset($old_mail_data['rcp_to']) &&
trim($old_mail_data['rcp_to']) != '')
{
$rcpt = $rbacreview->getRoleMailboxAddress($role['obj_id']);
if(!$this->umail->doesRecipientStillExists($rcpt, $old_mail_data['rcp_to']))
{
array_push($members, $rcpt);
}
}
else
{
array_push($members, $rbacreview->getRoleMailboxAddress($role['obj_id']));
}
}
}
}
}
if(count($members))
$mail_data = $this->umail->appendSearchResult($members, 'to');
else
$mail_data = $this->umail->getSavedData();
$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:

+ Here is the caller graph for this function:

ilMailSearchGroupsGUI::mailMembers ( )

Definition at line 178 of file class.ilMailSearchGroupsGUI.php.

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

Referenced by mail().

{
global $ilUser;
$members = array();
if (!is_array($this->umail->getSavedData()))
{
$this->umail->savePostData(
$ilUser->getId(),
array(),
"",
"",
"",
"",
"",
"",
"",
""
);
}
$ids = ((int) $_GET['search_members']) ? array((int)$_GET['search_members']) : $_POST['search_members'];
foreach ($ids as $member)
{
$login = ilObjUser::_lookupLogin($member);
array_push($members, $login);
}
$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:

+ Here is the caller graph for this function:

ilMailSearchGroupsGUI::share ( )

Definition at line 474 of file class.ilMailSearchGroupsGUI.php.

References $_GET, $_REQUEST, $lng, addPermission(), ilUtil\sendInfo(), showMembers(), and showMyGroups().

{
global $lng;
if ($_GET["view"] == "mygroups")
{
$ids = $_REQUEST["search_grp"];
if (sizeof($ids))
{
$this->addPermission($ids);
}
else
{
ilUtil::sendInfo($lng->txt("mail_select_course"));
$this->showMyGroups();
}
}
else if ($_GET["view"] == "grp_members")
{
$ids = $_REQUEST["search_members"];
if (sizeof($ids))
{
$this->addPermission($ids);
}
else
{
ilUtil::sendInfo($lng->txt("mail_select_one_entry"));
$this->showMembers();
}
}
else
{
$this->showMyGroups();
}
}

+ Here is the call graph for this function:

ilMailSearchGroupsGUI::showMembers ( )

Show course members.

Definition at line 397 of file class.ilMailSearchGroupsGUI.php.

References $_GET, $_POST, $lng, $ref_id, ilObject\_getAllReferences(), ilObjUser\_lookupPref(), ilObjectFactory\getInstanceByRefId(), ilUtil\sendInfo(), and showMyGroups().

Referenced by adoptMembers(), mail(), and share().

{
global $lng;
if ($_GET["search_grp"] != "")
{
$_POST["search_grp"] = explode(",", $_GET["search_grp"]);
}
if (!is_array($_POST["search_grp"]) ||
count($_POST["search_grp"]) == 0)
{
ilUtil::sendInfo($lng->txt("mail_select_group"));
$this->showMyGroups();
}
else
{
$this->tpl->setTitle($this->lng->txt("mail_addressbook"));
include_once 'Services/Contact/classes/class.ilMailSearchCoursesMembersTableGUI.php';
$context = $_GET["ref"] ? $_GET["ref"] : "mail";
$table = new ilMailSearchCoursesMembersTableGUI($this, 'grp', $context);
$table->setId('show_grps_mmbrs_tbl');
$lng->loadLanguageModule('crs');
$tableData = array();
$searchTpl = new ilTemplate('tpl.mail_search_template.html', true, true, 'Services/Contact');
foreach($_POST["search_grp"] as $grp_id)
{
$ref_ids = ilObject::_getAllReferences($grp_id);
$ref_id = current($ref_ids);
if (is_object($group_obj = ilObjectFactory::getInstanceByRefId($ref_id,false)))
{
$grp_members = $group_obj->getGroupMemberData($group_obj->getGroupMemberIds());
foreach($grp_members as $member)
{
$tmp_usr = new ilObjUser($member['id']);
if($tmp_usr->checkTimeLimit()== false || $tmp_usr->getActive() == false )
{
unset($tmp_usr);
continue;
}
unset($tmp_usr);
$fullname = "";
if(in_array(ilObjUser::_lookupPref($member['id'], 'public_profile'), array("g", 'y')))
$fullname = $member['lastname'].', '.$member['firstname'];
$rowData = array(
'members_id' => $member["id"],
'members_login' => $member["login"],
'members_name' => $fullname,
'members_crs_grp' => $group_obj->getTitle(),
'members_in_addressbook' => $this->abook->checkEntryByLogin($member["login"]) ? $lng->txt("yes") : $lng->txt("no"),
'search_grp' => $grp_id
);
$tableData[] = $rowData;
}
}
}
$table->setData($tableData);
if (count($tableData))
{
$searchTpl->setVariable("TXT_MARKED_ENTRIES",$lng->txt("marked_entries"));
}
$searchTpl->setVariable('TABLE', $table->getHtml());
$this->tpl->setContent($searchTpl->get());
if($_GET["ref"] != "wsp")
{
$this->tpl->show();
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMailSearchGroupsGUI::showMyGroups ( )

Show user's courses.

Definition at line 285 of file class.ilMailSearchGroupsGUI.php.

References $_GET, $ilUser, $lng, $path, $ref_id, ilObject\_getAllReferences(), ilGroupParticipants\_getInstanceByObjId(), ilParticipants\_getMembershipByType(), and ilObject\_hasUntrashedReference().

Referenced by cancel(), mail(), share(), and showMembers().

{
global $lng, $ilUser, $ilObjDataCache, $tree;
include_once 'Modules/Group/classes/class.ilGroupParticipants.php';
$this->tpl->setTitle($this->lng->txt('mail_addressbook'));
$searchTpl = new ilTemplate('tpl.mail_search_template.html', true, true, 'Services/Contact');
$_GET['view'] = 'mygroups';
$lng->loadLanguageModule('crs');
$this->ctrl->setParameter($this, 'view', 'mygroups');
include_once 'Services/Contact/classes/class.ilMailSearchCoursesTableGUI.php';
$table = new ilMailSearchCoursesTableGUI($this, 'grp', $_GET["ref"]);
$table->setId('search_grps_tbl');
$grp_ids = ilGroupParticipants::_getMembershipByType($ilUser->getId(), 'grp');
$counter = 0;
$tableData = array();
if (is_array($grp_ids) &&
count($grp_ids) > 0)
{
include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
foreach($grp_ids as $grp_id)
{
{
$oGroupParticipants = ilGroupParticipants::_getInstanceByObjId($grp_id);
$grp_members = $oGroupParticipants->getParticipants();
foreach ($grp_members as $key => $member)
{
$tmp_usr = new ilObjUser($member);
if($tmp_usr->checkTimeLimit()== false || $tmp_usr->getActive() == false )
{
unset($grp_members[$key]);
}
}
unset($tmp_usr);
$ref_ids = ilObject::_getAllReferences($grp_id);
$ref_id = current($ref_ids);
$path_arr = $tree->getPathFull($ref_id, $tree->getRootId());
$path_counter = 0;
$path = '';
foreach($path_arr as $data)
{
if($path_counter++)
{
$path .= " -> ";
}
$path .= $data['title'];
}
$path = $this->lng->txt('path').': '.$path;
$current_selection_list = new ilAdvancedSelectionListGUI();
$current_selection_list->setListTitle($this->lng->txt("actions"));
$current_selection_list->setId("act_".$counter);
$this->ctrl->setParameter($this, 'search_grp', $grp_id);
$this->ctrl->setParameter($this, 'view', 'mygroups');
if($_GET["ref"] == "mail")
{
if ($this->mailing_allowed)
$current_selection_list->addItem($this->lng->txt("mail_members"), '', $this->ctrl->getLinkTarget($this, "mail"));
}
else if($_GET["ref"] == "wsp")
{
$current_selection_list->addItem($this->lng->txt("wsp_share_with_members"), '', $this->ctrl->getLinkTarget($this, "share"));
}
$current_selection_list->addItem($this->lng->txt("mail_list_members"), '', $this->ctrl->getLinkTarget($this, "showMembers"));
$this->ctrl->clearParameters($this);
$rowData = array
(
'CRS_ID' => $grp_id,
'CRS_NAME' => $ilObjDataCache->lookupTitle($grp_id),
'CRS_NO_MEMBERS' => count($grp_members),
'CRS_PATH' => $path,
'COMMAND_SELECTION_LIST' => $current_selection_list->getHTML()
);
$counter++;
$tableData[] = $rowData;
}
}
}
$table->setData($tableData);
if($counter > 0)
{
$this->tpl->setVariable('TXT_MARKED_ENTRIES',$lng->txt('marked_entries'));
}
$searchTpl->setVariable('TABLE', $table->getHtml());
$this->tpl->setContent($searchTpl->get());
if($_GET["ref"] != "wsp")
{
$this->tpl->show();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilMailSearchGroupsGUI::$abook = null
private

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

ilMailSearchGroupsGUI::$ctrl = null
private

Definition at line 19 of file class.ilMailSearchGroupsGUI.php.

ilMailSearchGroupsGUI::$lng = null
private
ilMailSearchGroupsGUI::$mailing_allowed
protected

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

ilMailSearchGroupsGUI::$tpl = null
private

Definition at line 18 of file class.ilMailSearchGroupsGUI.php.

Referenced by __construct().

ilMailSearchGroupsGUI::$umail = null
private

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


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