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(
'internal_mail',$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'];
110 if (!is_array($old_mail_data = $this->umail->getSavedData()))
112 $this->umail->savePostData(
126 require_once
'./Services/Object/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'];
243 foreach ($ids as $member)
247 if (!$this->abook->checkEntry($login))
255 $this->abook->addEntry(
278 if (
$_GET[
"view"] ==
"mygroups" &&
279 $_GET[
"ref"] ==
"mail")
281 $this->ctrl->returnToParent($this);
296 include_once
'Modules/Group/classes/class.ilGroupParticipants.php';
298 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
300 $searchTpl =
new ilTemplate(
'tpl.mail_search_template.html',
true,
true,
'Services/Contact');
302 $_GET[
'view'] =
'mygroups';
304 $lng->loadLanguageModule(
'crs');
306 $this->ctrl->setParameter($this,
'view',
'mygroups');
308 include_once
'Services/Contact/classes/class.ilMailSearchCoursesTableGUI.php';
310 $table->setId(
'search_grps_tbl');
314 $tableData = array();
315 if (is_array($grp_ids) &&
319 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
320 foreach($grp_ids as $grp_id)
325 $grp_members = $oGroupParticipants->getParticipants();
327 foreach ($grp_members as $key => $member)
331 if($tmp_usr->checkTimeLimit()==
false || $tmp_usr->getActive() == false )
333 unset($grp_members[$key]);
340 $path_arr = $tree->getPathFull(
$ref_id, $tree->getRootId());
343 foreach($path_arr as $data)
349 $path .= $data[
'title'];
354 $current_selection_list->setListTitle($this->lng->txt(
"actions"));
355 $current_selection_list->setId(
"act_".$counter);
357 $this->ctrl->setParameter($this,
'search_grp', $grp_id);
358 $this->ctrl->setParameter($this,
'view',
'mygroups');
360 if(
$_GET[
"ref"] ==
"mail")
362 if ($this->mailing_allowed)
363 $current_selection_list->addItem($this->lng->txt(
"mail_members"),
'', $this->ctrl->getLinkTarget($this,
"mail"));
365 else if(
$_GET[
"ref"] ==
"wsp")
367 $current_selection_list->addItem($this->lng->txt(
"wsp_share_with_members"),
'', $this->ctrl->getLinkTarget($this,
"share"));
369 $current_selection_list->addItem($this->lng->txt(
"mail_list_members"),
'', $this->ctrl->getLinkTarget($this,
"showMembers"));
371 $this->ctrl->clearParameters($this);
376 'CRS_NAME' => $ilObjDataCache->lookupTitle($grp_id),
377 'CRS_NO_MEMBERS' => count($grp_members),
379 'COMMAND_SELECTION_LIST' => $current_selection_list->getHTML()
382 $tableData[] = $rowData;
386 $table->setData($tableData);
389 $this->tpl->setVariable(
'TXT_MARKED_ENTRIES',$lng->txt(
'marked_entries'));
392 $searchTpl->setVariable(
'TABLE', $table->getHtml());
393 $this->tpl->setContent($searchTpl->get());
395 if(
$_GET[
"ref"] !=
"wsp")
408 if (
$_GET[
"search_grp"] !=
"")
410 $_POST[
"search_grp"] = explode(
",",
$_GET[
"search_grp"]);
413 if (!is_array(
$_POST[
"search_grp"]) ||
414 count(
$_POST[
"search_grp"]) == 0)
421 $this->tpl->setTitle($this->lng->txt(
"mail_addressbook"));
422 include_once
'Services/Contact/classes/class.ilMailSearchCoursesMembersTableGUI.php';
423 $context =
$_GET[
"ref"] ?
$_GET[
"ref"] :
"mail";
425 $table->setId(
'show_grps_mmbrs_tbl');
426 $lng->loadLanguageModule(
'crs');
428 $tableData = array();
429 $searchTpl =
new ilTemplate(
'tpl.mail_search_template.html',
true,
true,
'Services/Contact');
431 foreach(
$_POST[
"search_grp"] as $grp_id)
438 $grp_members = $group_obj->getGroupMemberData($group_obj->getGroupMemberIds());
440 foreach($grp_members as $member)
443 if($tmp_usr->checkTimeLimit()==
false || $tmp_usr->getActive() == false )
452 $fullname = $member[
'lastname'].
', '.$member[
'firstname'];
455 'members_id' => $member[
"id"],
456 'members_login' => $member[
"login"],
457 'members_name' => $fullname,
458 'members_crs_grp' => $group_obj->getTitle(),
459 'members_in_addressbook' => $this->abook->checkEntryByLogin($member[
"login"]) ? $lng->txt(
"yes") : $lng->txt(
"no"),
460 'search_grp' => $grp_id
462 $tableData[] = $rowData;
466 $table->setData($tableData);
467 if (count($tableData))
469 $searchTpl->setVariable(
"TXT_MARKED_ENTRIES",$lng->txt(
"marked_entries"));
471 $searchTpl->setVariable(
'TABLE', $table->getHtml());
472 $this->tpl->setContent($searchTpl->get());
474 if(
$_GET[
"ref"] !=
"wsp")
485 if (
$_GET[
"view"] ==
"mygroups")
498 else if (
$_GET[
"view"] ==
"grp_members")
519 if(!is_array($a_obj_ids))
521 $a_obj_ids = array($a_obj_ids);
524 $existing = $this->wsp_access_handler->getPermissions($this->wsp_node_id);
526 foreach($a_obj_ids as $object_id)
528 if(!in_array($object_id, $existing))
530 $added = $this->wsp_access_handler->addPermission($this->wsp_node_id, $object_id);
538 $this->ctrl->redirectByClass(
"ilworkspaceaccessgui",
"share");