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']);
143 if(!$this->umail->doesRecipientStillExists($rcpt, $old_mail_data[
'rcp_to']))
145 array_push($members, $rcpt);
150 array_push($members, $rbacreview->getRoleMailboxAddress($role[
'obj_id']));
158 $mail_data = $this->umail->appendSearchResult($members,
'to');
160 $mail_data = $this->umail->getSavedData();
162 $this->umail->savePostData(
163 $mail_data[
"user_id"],
164 $mail_data[
"attachments"],
165 $mail_data[
"rcp_to"],
166 $mail_data[
"rcp_cc"],
167 $mail_data[
"rcp_bcc"],
168 $mail_data[
"m_type"],
169 $mail_data[
"m_email"],
170 $mail_data[
"m_subject"],
171 $mail_data[
"m_message"],
172 $mail_data[
"use_placeholders"]
184 if (!is_array($this->umail->getSavedData()))
186 $this->umail->savePostData(
200 $ids = ((int)
$_GET[
'search_members']) ? array((
int)
$_GET[
'search_members']) :
$_POST[
'search_members'];
202 foreach ($ids as $member)
205 array_push($members, $login);
207 $mail_data = $this->umail->appendSearchResult($members,
"to");
209 $this->umail->savePostData(
210 $mail_data[
"user_id"],
211 $mail_data[
"attachments"],
212 $mail_data[
"rcp_to"],
213 $mail_data[
"rcp_cc"],
214 $mail_data[
"rcp_bcc"],
215 $mail_data[
"m_type"],
216 $mail_data[
"m_email"],
217 $mail_data[
"m_subject"],
218 $mail_data[
"m_message"],
219 $mail_data[
"use_placeholders"]
232 $ids = ((int)
$_GET[
'search_members']) ? array((
int)
$_GET[
'search_members']) :
$_POST[
'search_members'];
236 foreach ($ids as $member)
240 if (!$this->abook->checkEntry($login))
248 $this->abook->addEntry(
271 if (
$_GET[
"view"] ==
"mygroups" &&
272 $_GET[
"ref"] ==
"mail")
274 $this->ctrl->returnToParent($this);
289 include_once
'Modules/Group/classes/class.ilGroupParticipants.php';
291 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
293 $searchTpl =
new ilTemplate(
'tpl.mail_search_template.html',
true,
true,
'Services/Contact');
295 $_GET[
'view'] =
'mygroups';
297 $lng->loadLanguageModule(
'crs');
299 $this->ctrl->setParameter($this,
'view',
'mygroups');
301 include_once
'Services/Contact/classes/class.ilMailSearchCoursesTableGUI.php';
303 $table->setId(
'search_grps_tbl');
307 $tableData = array();
308 if (is_array($grp_ids) &&
312 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
313 foreach($grp_ids as $grp_id)
318 $grp_members = $oGroupParticipants->getParticipants();
320 foreach ($grp_members as $key => $member)
324 if($tmp_usr->checkTimeLimit()==
false || $tmp_usr->getActive() == false )
326 unset($grp_members[$key]);
333 $path_arr = $tree->getPathFull(
$ref_id, $tree->getRootId());
336 foreach($path_arr as $data)
342 $path .= $data[
'title'];
347 $current_selection_list->setListTitle($this->lng->txt(
"actions"));
348 $current_selection_list->setId(
"act_".$counter);
350 $this->ctrl->setParameter($this,
'search_grp', $grp_id);
351 $this->ctrl->setParameter($this,
'view',
'mygroups');
353 if(
$_GET[
"ref"] ==
"mail")
355 if ($this->mailing_allowed)
356 $current_selection_list->addItem($this->lng->txt(
"mail_members"),
'', $this->ctrl->getLinkTarget($this,
"mail"));
358 else if(
$_GET[
"ref"] ==
"wsp")
360 $current_selection_list->addItem($this->lng->txt(
"wsp_share_with_members"),
'', $this->ctrl->getLinkTarget($this,
"share"));
362 $current_selection_list->addItem($this->lng->txt(
"mail_list_members"),
'', $this->ctrl->getLinkTarget($this,
"showMembers"));
364 $this->ctrl->clearParameters($this);
369 'CRS_NAME' => $ilObjDataCache->lookupTitle($grp_id),
370 'CRS_NO_MEMBERS' => count($grp_members),
372 'COMMAND_SELECTION_LIST' => $current_selection_list->getHTML()
375 $tableData[] = $rowData;
379 $table->setData($tableData);
382 $this->tpl->setVariable(
'TXT_MARKED_ENTRIES',$lng->txt(
'marked_entries'));
385 $searchTpl->setVariable(
'TABLE', $table->getHtml());
386 $this->tpl->setContent($searchTpl->get());
388 if(
$_GET[
"ref"] !=
"wsp")
401 if (
$_GET[
"search_grp"] !=
"")
403 $_POST[
"search_grp"] = explode(
",",
$_GET[
"search_grp"]);
406 if (!is_array(
$_POST[
"search_grp"]) ||
407 count(
$_POST[
"search_grp"]) == 0)
414 $this->tpl->setTitle($this->lng->txt(
"mail_addressbook"));
415 include_once
'Services/Contact/classes/class.ilMailSearchCoursesMembersTableGUI.php';
416 $context =
$_GET[
"ref"] ?
$_GET[
"ref"] :
"mail";
418 $table->setId(
'show_grps_mmbrs_tbl');
419 $lng->loadLanguageModule(
'crs');
421 $tableData = array();
422 $searchTpl =
new ilTemplate(
'tpl.mail_search_template.html',
true,
true,
'Services/Contact');
424 foreach(
$_POST[
"search_grp"] as $grp_id)
431 $grp_members = $group_obj->getGroupMemberData($group_obj->getGroupMemberIds());
433 foreach($grp_members as $member)
436 if($tmp_usr->checkTimeLimit()==
false || $tmp_usr->getActive() == false )
445 $fullname = $member[
'lastname'].
', '.$member[
'firstname'];
448 'members_id' => $member[
"id"],
449 'members_login' => $member[
"login"],
450 'members_name' => $fullname,
451 'members_crs_grp' => $group_obj->getTitle(),
452 'members_in_addressbook' => $this->abook->checkEntryByLogin($member[
"login"]) ? $lng->txt(
"yes") : $lng->txt(
"no"),
453 'search_grp' => $grp_id
455 $tableData[] = $rowData;
459 $table->setData($tableData);
460 if (count($tableData))
462 $searchTpl->setVariable(
"TXT_MARKED_ENTRIES",$lng->txt(
"marked_entries"));
464 $searchTpl->setVariable(
'TABLE', $table->getHtml());
465 $this->tpl->setContent($searchTpl->get());
467 if(
$_GET[
"ref"] !=
"wsp")
478 if (
$_GET[
"view"] ==
"mygroups")
491 else if (
$_GET[
"view"] ==
"grp_members")
512 if(!is_array($a_obj_ids))
514 $a_obj_ids = array($a_obj_ids);
517 $existing = $this->wsp_access_handler->getPermissions($this->wsp_node_id);
519 foreach($a_obj_ids as $object_id)
521 if(!in_array($object_id, $existing))
523 $added = $this->wsp_access_handler->addPermission($this->wsp_node_id, $object_id);
531 $this->ctrl->redirectByClass(
"ilworkspaceaccessgui",
"share");