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/classes/class.ilAddressbook.php';
27 public function __construct($wsp_access_handler = null, $wsp_node_id = null)
36 $this->wsp_access_handler = $wsp_access_handler;
37 $this->wsp_node_id = $wsp_node_id;
39 $this->ctrl->saveParameter($this,
"mobj_id");
40 $this->ctrl->saveParameter($this,
"ref");
43 include_once
"Services/Mail/classes/class.ilMail.php";
45 $this->mailing_allowed = $rbacsystem->checkAccess(
'mail_visible',$mail->getMailObjectReferenceId());
53 $forward_class = $this->ctrl->getNextClass($this);
54 switch($forward_class)
57 if (!(
$cmd = $this->ctrl->getCmd()))
59 $cmd =
"showMyGroups";
72 if (
$_GET[
"view"] ==
"mygroups")
74 $ids = ((int)
$_GET[
'search_grp']) ? array((
int)
$_GET[
'search_grp']) :
$_POST[
'search_grp'];
85 else if (
$_GET[
"view"] ==
"grp_members")
87 $ids = ((int)
$_GET[
'search_members']) ? array((
int)
$_GET[
'search_members']) :
$_POST[
'search_members'];
106 global $ilUser,
$lng, $rbacreview;
110 if (!is_array($old_mail_data = $this->umail->getSavedData()))
112 $this->umail->savePostData(
126 require_once
'classes/class.ilObject.php';
127 $ids = ((int)
$_GET[
'search_grp']) ? array((
int)
$_GET[
'search_grp']) :
$_POST[
'search_grp'];
128 foreach ($ids as $grp_id)
133 $roles = $rbacreview->getAssignableChildRoles($ref_id);
134 foreach ($roles as $role)
136 if (substr($role[
'title'], 0, 14) ==
'il_grp_member_' ||
137 substr($role[
'title'], 0, 13) ==
'il_grp_admin_')
139 if(isset($old_mail_data[
'rcp_to']) &&
140 trim($old_mail_data[
'rcp_to']) !=
'')
142 $rcpt = $rbacreview->getRoleMailboxAddress($role[
'obj_id']);
144 if(!$this->umail->doesRecipientStillExists($rcpt, $old_mail_data[
'rcp_to']))
148 array_push($members,
'#'.$role[
'title']);
157 array_push($members,
'#'.$role[
'title']);
165 $mail_data = $this->umail->appendSearchResult($members,
'to');
167 $mail_data = $this->umail->getSavedData();
169 $this->umail->savePostData(
170 $mail_data[
"user_id"],
171 $mail_data[
"attachments"],
172 $mail_data[
"rcp_to"],
173 $mail_data[
"rcp_cc"],
174 $mail_data[
"rcp_bcc"],
175 $mail_data[
"m_type"],
176 $mail_data[
"m_email"],
177 $mail_data[
"m_subject"],
178 $mail_data[
"m_message"],
179 $mail_data[
"use_placeholders"]
191 if (!is_array($this->umail->getSavedData()))
193 $this->umail->savePostData(
207 $ids = ((int)
$_GET[
'search_members']) ? array((
int)
$_GET[
'search_members']) :
$_POST[
'search_members'];
209 foreach ($ids as $member)
212 array_push($members, $login);
214 $mail_data = $this->umail->appendSearchResult($members,
"to");
216 $this->umail->savePostData(
217 $mail_data[
"user_id"],
218 $mail_data[
"attachments"],
219 $mail_data[
"rcp_to"],
220 $mail_data[
"rcp_cc"],
221 $mail_data[
"rcp_bcc"],
222 $mail_data[
"m_type"],
223 $mail_data[
"m_email"],
224 $mail_data[
"m_subject"],
225 $mail_data[
"m_message"],
226 $mail_data[
"use_placeholders"]
239 $ids = ((int)
$_GET[
'search_members']) ? array((
int)
$_GET[
'search_members']) :
$_POST[
'search_members'];
245 foreach ($ids as $member)
249 if (!$this->abook->checkEntry($login))
257 $this->abook->addEntry(
280 if (
$_GET[
"view"] ==
"mygroups" &&
281 $_GET[
"ref"] ==
"mail")
283 $this->ctrl->returnToParent($this);
296 global
$lng, $ilUser, $ilObjDataCache, $tree;
298 include_once
'Modules/Group/classes/class.ilGroupParticipants.php';
300 $this->tpl->setTitle($this->lng->txt(
'mail'));
302 $searchTpl =
new ilTemplate(
'tpl.mail_search_template.html',
true,
true,
'Services/Contact');
304 $_GET[
'view'] =
'mygroups';
306 $lng->loadLanguageModule(
'crs');
308 $this->ctrl->setParameter($this,
'view',
'mygroups');
310 include_once
'Services/Contact/classes/class.ilMailSearchCoursesTableGUI.php';
312 $table->setId(
'search_grps_tbl');
316 $tableData = array();
317 if (is_array($grp_ids) &&
321 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
322 foreach($grp_ids as $grp_id)
327 $grp_members = $oGroupParticipants->getParticipants();
329 foreach ($grp_members as $key => $member)
333 if($tmp_usr->checkTimeLimit()==
false || $tmp_usr->getActive() == false )
335 unset($grp_members[$key]);
342 $path_arr = $tree->getPathFull(
$ref_id, $tree->getRootId());
345 foreach($path_arr as
$data)
351 $path .= $data[
'title'];
356 $current_selection_list->setListTitle($this->lng->txt(
"actions"));
357 $current_selection_list->setId(
"act_".$counter);
359 $this->ctrl->setParameter($this,
'search_grp', $grp_id);
360 $this->ctrl->setParameter($this,
'view',
'mygroups');
362 if(
$_GET[
"ref"] ==
"mail")
364 if ($this->mailing_allowed)
365 $current_selection_list->addItem($this->lng->txt(
"mail_members"),
'', $this->ctrl->getLinkTarget($this,
"mail"));
367 else if(
$_GET[
"ref"] ==
"wsp")
369 $current_selection_list->addItem($this->lng->txt(
"wsp_share_with_members"),
'', $this->ctrl->getLinkTarget($this,
"share"));
371 $current_selection_list->addItem($this->lng->txt(
"mail_list_members"),
'', $this->ctrl->getLinkTarget($this,
"showMembers"));
373 $this->ctrl->clearParameters($this);
378 'CRS_NAME' => $ilObjDataCache->lookupTitle($grp_id),
379 'CRS_NO_MEMBERS' => count($grp_members),
381 'COMMAND_SELECTION_LIST' => $current_selection_list->getHTML()
384 $tableData[] = $rowData;
388 $table->setData($tableData);
391 $this->tpl->setVariable(
'TXT_MARKED_ENTRIES',$lng->txt(
'marked_entries'));
394 $searchTpl->setVariable(
'TABLE', $table->getHtml());
395 $this->tpl->setContent($searchTpl->get());
397 if(
$_GET[
"ref"] !=
"wsp")
408 global
$lng, $ilUser;
410 if (
$_GET[
"search_grp"] !=
"")
412 $_POST[
"search_grp"] = explode(
",",
$_GET[
"search_grp"]);
415 if (!is_array(
$_POST[
"search_grp"]) ||
416 count(
$_POST[
"search_grp"]) == 0)
423 $this->tpl->setTitle($this->lng->txt(
"mail"));
424 include_once
'Services/Contact/classes/class.ilMailSearchCoursesMembersTableGUI.php';
425 $context =
$_GET[
"ref"] ?
$_GET[
"ref"] :
"mail";
427 $table->setId(
'show_grps_mmbrs_tbl');
428 $lng->loadLanguageModule(
'crs');
431 $tableData = array();
432 $searchTpl =
new ilTemplate(
'tpl.mail_search_template.html',
true,
true,
'Services/Contact');
434 foreach(
$_POST[
"search_grp"] as $grp_id)
441 $grp_members = $group_obj->getGroupMemberData($group_obj->getGroupMemberIds());
443 foreach($grp_members as $member)
446 if($tmp_usr->checkTimeLimit()==
false || $tmp_usr->getActive() == false )
455 $fullname = $member[
'lastname'].
', '.$member[
'firstname'];
458 'MEMBERS_ID' => $member[
"id"],
459 'MEMBERS_LOGIN' => $member[
"login"],
460 'MEMBERS_NAME' => $fullname,
461 'MEMBERS_CRS_GRP' => $group_obj->getTitle(),
462 'MEMBERS_IN_ADDRESSBOOK' => $this->abook->checkEntryByLogin($member[
"login"]) ? $lng->txt(
"yes") : $lng->txt(
"no"),
463 'search_grp' => $grp_id
465 $tableData[] = $rowData;
469 $table->setData($tableData);
470 if (count($tableData))
474 $searchTpl->setVariable(
"TXT_MARKED_ENTRIES",$lng->txt(
"marked_entries"));
476 $searchTpl->setVariable(
'TABLE', $table->getHtml());
477 $this->tpl->setContent($searchTpl->get());
479 if(
$_GET[
"ref"] !=
"wsp")
490 if (
$_GET[
"view"] ==
"mygroups")
503 else if (
$_GET[
"view"] ==
"grp_members")
524 if(!is_array($a_obj_ids))
526 $a_obj_ids = array($a_obj_ids);
529 $existing = $this->wsp_access_handler->getPermissions($this->wsp_node_id);
531 foreach($a_obj_ids as $object_id)
533 if(!in_array($object_id, $existing))
535 $added = $this->wsp_access_handler->addPermission($this->wsp_node_id, $object_id);
543 $this->ctrl->redirectByClass(
"ilworkspaceaccessgui",
"share");