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/BuddySystem/classes/class.ilBuddySystem.php';
73 public function __construct($wsp_access_handler = null, $wsp_node_id = null)
77 $this->tpl = $DIC[
'tpl'];
78 $this->ctrl = $DIC[
'ilCtrl'];
79 $this->lng = $DIC[
'lng'];
80 $this->
user = $DIC[
'ilUser'];
81 $this->error = $DIC[
'ilErr'];
82 $this->rbacsystem = $DIC[
'rbacsystem'];
83 $this->rbacreview = $DIC[
'rbacreview'];
84 $this->tree = $DIC[
'tree'];
85 $this->cache = $DIC[
'ilObjDataCache'];
88 $this->wsp_access_handler = $wsp_access_handler;
89 $this->wsp_node_id = $wsp_node_id;
91 $this->ctrl->saveParameter($this,
"mobj_id");
92 $this->ctrl->saveParameter($this,
"ref");
94 include_once
"Services/Mail/classes/class.ilMail.php";
96 $this->mailing_allowed = $this->rbacsystem->checkAccess(
'internal_mail', $mail->getMailObjectReferenceId());
103 $forward_class = $this->ctrl->getNextClass($this);
104 switch($forward_class)
106 case 'ilbuddysystemgui':
109 $this->error->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->error->MESSAGE);
112 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddySystemGUI.php';
113 $this->ctrl->saveParameter($this,
'search_grp');
114 $this->ctrl->setReturn($this,
'showMembers');
119 if (!(
$cmd = $this->ctrl->getCmd()))
121 $cmd =
"showMyGroups";
132 if (
$_GET[
"view"] ==
"mygroups")
142 $this->showMyGroups();
145 else if (
$_GET[
"view"] ==
"grp_members")
147 $ids = ((int)
$_GET[
'search_members']) ?
array((
int)
$_GET[
'search_members']) :
$_POST[
'search_members'];
160 $this->showMyGroups();
168 if (!is_array($old_mail_data = $this->umail->getSavedData()))
170 $this->umail->savePostData(
171 $this->
user->getId(),
184 require_once
'./Services/Object/classes/class.ilObject.php';
185 require_once
'Services/Mail/classes/Address/Type/class.ilMailRoleAddressType.php';
188 foreach ($ids as $grp_id)
193 $roles = $this->rbacreview->getAssignableChildRoles($ref_id);
194 foreach ($roles as $role)
196 if (substr($role[
'title'], 0, 14) ==
'il_grp_member_' ||
197 substr($role[
'title'], 0, 13) ==
'il_grp_admin_')
199 if(isset($old_mail_data[
'rcp_to']) &&
200 trim($old_mail_data[
'rcp_to']) !=
'')
202 $rcpt = ilMailRoleAddressType::getRoleMailboxAddress($role[
'obj_id']);
203 if(!$this->umail->existsRecipient($rcpt, $old_mail_data[
'rcp_to']))
205 array_push($members, $rcpt);
210 array_push($members, ilMailRoleAddressType::getRoleMailboxAddress($role[
'obj_id']));
218 $mail_data = $this->umail->appendSearchResult($members,
'to');
220 $mail_data = $this->umail->getSavedData();
222 $this->umail->savePostData(
223 $mail_data[
"user_id"],
224 $mail_data[
"attachments"],
225 $mail_data[
"rcp_to"],
226 $mail_data[
"rcp_cc"],
227 $mail_data[
"rcp_bcc"],
228 $mail_data[
"m_type"],
229 $mail_data[
"m_email"],
230 $mail_data[
"m_subject"],
231 $mail_data[
"m_message"],
232 $mail_data[
"use_placeholders"],
233 $mail_data[
'tpl_ctx_id'],
234 $mail_data[
'tpl_ctx_params']
244 if (!is_array($this->umail->getSavedData()))
246 $this->umail->savePostData(
247 $this->
user->getId(),
260 $ids = ((int)
$_GET[
'search_members']) ?
array((
int)
$_GET[
'search_members']) :
$_POST[
'search_members'];
262 foreach ($ids as $member)
265 array_push($members, $login);
267 $mail_data = $this->umail->appendSearchResult($members,
"to");
269 $this->umail->savePostData(
270 $mail_data[
"user_id"],
271 $mail_data[
"attachments"],
272 $mail_data[
"rcp_to"],
273 $mail_data[
"rcp_cc"],
274 $mail_data[
"rcp_bcc"],
275 $mail_data[
"m_type"],
276 $mail_data[
"m_email"],
277 $mail_data[
"m_subject"],
278 $mail_data[
"m_message"],
279 $mail_data[
"use_placeholders"],
280 $mail_data[
'tpl_ctx_id'],
281 $mail_data[
'tpl_ctx_params']
292 if (
$_GET[
"view"] ==
"mygroups" &&
293 $_GET[
"ref"] ==
"mail")
295 $this->ctrl->returnToParent($this);
299 $this->showMyGroups();
306 public function showMyGroups()
308 include_once
'Modules/Group/classes/class.ilGroupParticipants.php';
310 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
312 $searchTpl =
new ilTemplate(
'tpl.mail_search_template.html',
true,
true,
'Services/Contact');
314 $_GET[
'view'] =
'mygroups';
316 $this->lng->loadLanguageModule(
'crs');
318 $this->ctrl->setParameter($this,
'view',
'mygroups');
320 include_once
'Services/Contact/classes/class.ilMailSearchCoursesTableGUI.php';
322 $table->setId(
'search_grps_tbl');
326 $tableData =
array();
327 if (is_array($grp_ids) &&
330 $num_groups_hidden_members = 0;
331 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
332 foreach($grp_ids as $grp_id)
340 $showMemberListEnabled = (boolean)$oTmpGrp->getShowMembers();
342 $isPrivilegedUser = $this->rbacsystem->checkAccess(
'write', $ref_ids[0]);
344 if($hasUntrashedReferences && ($showMemberListEnabled || $isPrivilegedUser))
347 $grp_members = $oGroupParticipants->getParticipants();
349 foreach ($grp_members as $key => $member)
353 if($tmp_usr->checkTimeLimit()==
false || $tmp_usr->getActive() == false )
355 unset($grp_members[$key]);
360 $hiddenMembers =
false;
361 if((
int)$oTmpGrp->getShowMembers() == $oTmpGrp->SHOW_MEMBERS_DISABLED)
363 ++$num_groups_hidden_members;
364 $hiddenMembers =
true;
370 $path_arr = $this->tree->getPathFull(
$ref_id, $this->tree->getRootId());
373 foreach($path_arr as
$data)
379 $path .= $data[
'title'];
384 $current_selection_list->setListTitle($this->lng->txt(
"actions"));
385 $current_selection_list->setId(
"act_".$counter);
387 $this->ctrl->setParameter($this,
'search_grp', $grp_id);
388 $this->ctrl->setParameter($this,
'view',
'mygroups');
390 if(
$_GET[
"ref"] ==
"mail")
392 if ($this->mailing_allowed)
393 $current_selection_list->addItem($this->lng->txt(
"mail_members"),
'', $this->ctrl->getLinkTarget($this,
"mail"));
395 else if(
$_GET[
"ref"] ==
"wsp")
397 $current_selection_list->addItem($this->lng->txt(
"wsp_share_with_members"),
'', $this->ctrl->getLinkTarget($this,
"share"));
399 $current_selection_list->addItem($this->lng->txt(
"mail_list_members"),
'', $this->ctrl->getLinkTarget($this,
"showMembers"));
401 $this->ctrl->clearParameters($this);
406 'CRS_NAME' => $this->cache->lookupTitle($grp_id),
407 'CRS_NO_MEMBERS' => count($grp_members),
409 'COMMAND_SELECTION_LIST' => $current_selection_list->getHTML(),
410 "hidden_members" => $hiddenMembers
413 $tableData[] = $rowData;
416 if($num_groups_hidden_members > 0)
418 $searchTpl->setCurrentBlock(
'caption_block');
419 $searchTpl->setVariable(
'TXT_LIST_MEMBERS_NOT_AVAILABLE', $this->lng->txt(
'mail_crs_list_members_not_available'));
420 $searchTpl->parseCurrentBlock();
423 $table->setData($tableData);
426 $this->tpl->setVariable(
'TXT_MARKED_ENTRIES', $this->lng->txt(
'marked_entries'));
429 $searchTpl->setVariable(
'TABLE', $table->getHTML());
430 $this->tpl->setContent($searchTpl->get());
432 if(
$_GET[
"ref"] !=
"wsp")
443 if (
$_GET[
"search_grp"] !=
"")
445 $_POST[
"search_grp"] = explode(
",",
$_GET[
"search_grp"]);
448 if (!is_array(
$_POST[
"search_grp"]) ||
449 count(
$_POST[
"search_grp"]) == 0)
452 $this->showMyGroups();
456 $this->tpl->setTitle($this->lng->txt(
"mail_addressbook"));
457 include_once
'Services/Contact/classes/class.ilMailSearchCoursesMembersTableGUI.php';
458 $context =
$_GET[
"ref"] ?
$_GET[
"ref"] :
"mail";
460 $this->lng->loadLanguageModule(
'crs');
462 $tableData =
array();
463 $searchTpl =
new ilTemplate(
'tpl.mail_search_template.html',
true,
true,
'Services/Contact');
465 foreach(
$_POST[
"search_grp"] as $grp_id)
472 $grp_members = $group_obj->getGroupMemberData($group_obj->getGroupMemberIds());
474 foreach($grp_members as $member)
477 if($tmp_usr->checkTimeLimit()==
false || $tmp_usr->getActive() == false )
486 $fullname = $member[
'lastname'].
', '.$member[
'firstname'];
489 'members_id' => $member[
"id"],
490 'members_login' => $member[
"login"],
491 'members_name' => $fullname,
492 'members_crs_grp' => $group_obj->getTitle(),
493 'search_grp' => $grp_id,
500 $rowData[
'status'] =
'';
501 if($member[
'id'] != $this->
user->getId())
503 if($relation->isOwnedByRequest())
505 $rowData[
'status'] = $this->lng->txt(
'buddy_bs_state_' . $state_name .
'_a');
509 $rowData[
'status'] = $this->lng->txt(
'buddy_bs_state_' . $state_name .
'_p');
514 $tableData[] = $rowData;
518 $table->setData($tableData);
519 if (count($tableData))
521 $searchTpl->setVariable(
"TXT_MARKED_ENTRIES", $this->lng->txt(
"marked_entries"));
523 $searchTpl->setVariable(
'TABLE', $table->getHTML());
524 $this->tpl->setContent($searchTpl->get());
526 if(
$_GET[
"ref"] !=
"wsp")
535 if (
$_GET[
"view"] ==
"mygroups")
537 $ids = $_REQUEST[
"search_grp"];
545 $this->showMyGroups();
548 else if (
$_GET[
"view"] ==
"grp_members")
550 $ids = $_REQUEST[
"search_members"];
563 $this->showMyGroups();
569 if(!is_array($a_obj_ids))
571 $a_obj_ids =
array($a_obj_ids);
574 $existing = $this->wsp_access_handler->getPermissions($this->wsp_node_id);
576 foreach($a_obj_ids as $object_id)
578 if(!in_array($object_id, $existing))
580 $added = $this->wsp_access_handler->addPermission($this->wsp_node_id, $object_id);
588 $this->ctrl->redirectByClass(
"ilworkspaceaccessgui",
"share");
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _lookupLogin($a_user_id)
lookup login
static _hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
static convertUpperCamelCaseToUnderscoreCase($value)
Convert a value given in camel case conversion to underscore case conversion (e.g.
static getInstanceByGlobalUser()
addPermission($a_obj_ids)
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
static _getAllReferences($a_id)
get all reference ids of object
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
showMembers()
Show course members.
This class handles base functions for mail handling.
special template class to simplify handling of ITX/PEAR
__construct($wsp_access_handler=null, $wsp_node_id=null)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
Create styles array
The data for the language used.
User interface class for advanced drop-down selection lists.
static _lookupPref($a_usr_id, $a_keyword)
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static redirect($a_script)
http redirect to other script