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) {
105 case 'ilbuddysystemgui':
107 $this->error->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->error->MESSAGE);
110 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddySystemGUI.php';
111 $this->ctrl->saveParameter($this,
'search_grp');
112 $this->ctrl->setReturn($this,
'showMembers');
117 if (!($cmd = $this->ctrl->getCmd())) {
118 $cmd =
"showMyGroups";
129 if (
$_GET[
"view"] ==
"mygroups") {
130 $ids = ((int)
$_GET[
'search_grp']) ? array((
int)
$_GET[
'search_grp']) :
$_POST[
'search_grp'];
135 $this->showMyGroups();
137 } elseif (
$_GET[
"view"] ==
"grp_members") {
138 $ids = ((int)
$_GET[
'search_members']) ? array((
int)
$_GET[
'search_members']) :
$_POST[
'search_members'];
146 $this->showMyGroups();
154 if (!is_array($old_mail_data = $this->umail->getSavedData())) {
155 $this->umail->savePostData(
156 $this->
user->getId(),
169 require_once
'./Services/Object/classes/class.ilObject.php';
170 require_once
'Services/Mail/classes/Address/Type/class.ilMailRoleAddressType.php';
172 $ids = ((int)
$_GET[
'search_grp']) ? array((
int)
$_GET[
'search_grp']) :
$_POST[
'search_grp'];
173 foreach ($ids as $grp_id) {
175 foreach ($ref_ids as $ref_id) {
176 $roles = $this->rbacreview->getAssignableChildRoles($ref_id);
177 foreach ($roles as $role) {
178 if (substr($role[
'title'], 0, 14) ==
'il_grp_member_' ||
179 substr($role[
'title'], 0, 13) ==
'il_grp_admin_') {
180 if (isset($old_mail_data[
'rcp_to']) &&
181 trim($old_mail_data[
'rcp_to']) !=
'') {
182 $rcpt = (new \ilRoleMailboxAddress($role[
'obj_id']))->value();
183 if (!$this->umail->existsRecipient($rcpt, (
string) $old_mail_data[
'rcp_to'])) {
184 array_push($members, $rcpt);
194 if (count($members)) {
195 $mail_data = $this->umail->appendSearchResult($members,
'to');
197 $mail_data = $this->umail->getSavedData();
200 $this->umail->savePostData(
201 $mail_data[
"user_id"],
202 $mail_data[
"attachments"],
203 $mail_data[
"rcp_to"],
204 $mail_data[
"rcp_cc"],
205 $mail_data[
"rcp_bcc"],
206 $mail_data[
"m_email"],
207 $mail_data[
"m_subject"],
208 $mail_data[
"m_message"],
209 $mail_data[
"use_placeholders"],
210 $mail_data[
'tpl_ctx_id'],
211 $mail_data[
'tpl_ctx_params']
221 if (!is_array($this->umail->getSavedData())) {
222 $this->umail->savePostData(
223 $this->
user->getId(),
236 $ids = ((int)
$_GET[
'search_members']) ? array((
int)
$_GET[
'search_members']) :
$_POST[
'search_members'];
238 foreach ($ids as $member) {
240 array_push($members,
$login);
242 $mail_data = $this->umail->appendSearchResult($members,
"to");
244 $this->umail->savePostData(
245 $mail_data[
"user_id"],
246 $mail_data[
"attachments"],
247 $mail_data[
"rcp_to"],
248 $mail_data[
"rcp_cc"],
249 $mail_data[
"rcp_bcc"],
250 $mail_data[
"m_email"],
251 $mail_data[
"m_subject"],
252 $mail_data[
"m_message"],
253 $mail_data[
"use_placeholders"],
254 $mail_data[
'tpl_ctx_id'],
255 $mail_data[
'tpl_ctx_params']
266 if (
$_GET[
"view"] ==
"mygroups" &&
267 $_GET[
"ref"] ==
"mail") {
268 $this->ctrl->returnToParent($this);
270 $this->showMyGroups();
277 public function showMyGroups()
279 include_once
'Modules/Group/classes/class.ilGroupParticipants.php';
281 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
283 $searchTpl =
new ilTemplate(
'tpl.mail_search_template.html',
true,
true,
'Services/Contact');
285 $_GET[
'view'] =
'mygroups';
287 $this->lng->loadLanguageModule(
'crs');
289 $this->ctrl->setParameter($this,
'view',
'mygroups');
291 include_once
'Services/Contact/classes/class.ilMailSearchCoursesTableGUI.php';
293 $table->setId(
'search_grps_tbl');
297 $tableData = array();
298 if (is_array($grp_ids) &&
299 count($grp_ids) > 0) {
300 $num_groups_hidden_members = 0;
301 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
302 foreach ($grp_ids as $grp_id) {
309 $showMemberListEnabled = (boolean) $oTmpGrp->getShowMembers();
311 $isPrivilegedUser = $this->rbacsystem->checkAccess(
'write', $ref_ids[0]);
313 if ($hasUntrashedReferences && ($showMemberListEnabled || $isPrivilegedUser)) {
315 $grp_members = $oGroupParticipants->getParticipants();
317 foreach ($grp_members as $key => $member) {
320 if (!$tmp_usr->getActive()) {
321 unset($grp_members[$key]);
325 $hiddenMembers =
false;
326 if ((
int) $oTmpGrp->getShowMembers() == $oTmpGrp->SHOW_MEMBERS_DISABLED) {
327 ++$num_groups_hidden_members;
328 $hiddenMembers =
true;
333 $ref_id = current($ref_ids);
334 $path_arr = $this->tree->getPathFull($ref_id, $this->tree->getRootId());
337 foreach ($path_arr as
$data) {
338 if ($path_counter++) {
341 $path .= $data[
'title'];
343 $path = $this->lng->txt(
'path') .
': ' . $path;
346 $current_selection_list->setListTitle($this->lng->txt(
"actions"));
347 $current_selection_list->setId(
"act_" . $counter);
349 $this->ctrl->setParameter($this,
'search_grp', $grp_id);
350 $this->ctrl->setParameter($this,
'view',
'mygroups');
352 if (
$_GET[
"ref"] ==
"mail") {
353 if ($this->mailing_allowed) {
354 $current_selection_list->addItem($this->lng->txt(
"mail_members"),
'', $this->ctrl->getLinkTarget($this,
"mail"));
356 } elseif (
$_GET[
"ref"] ==
"wsp") {
357 $current_selection_list->addItem($this->lng->txt(
"wsp_share_with_members"),
'', $this->ctrl->getLinkTarget($this,
"share"));
359 $current_selection_list->addItem($this->lng->txt(
"mail_list_members"),
'', $this->ctrl->getLinkTarget($this,
"showMembers"));
361 $this->ctrl->clearParameters($this);
365 'CRS_NAME' => $this->cache->lookupTitle($grp_id),
366 'CRS_NO_MEMBERS' => count($grp_members),
368 'COMMAND_SELECTION_LIST' => $current_selection_list->getHTML(),
369 "hidden_members" => $hiddenMembers
372 $tableData[] = $rowData;
375 if ($num_groups_hidden_members > 0) {
376 $searchTpl->setCurrentBlock(
'caption_block');
377 $searchTpl->setVariable(
'TXT_LIST_MEMBERS_NOT_AVAILABLE', $this->lng->txt(
'mail_crs_list_members_not_available'));
378 $searchTpl->parseCurrentBlock();
381 $table->setData($tableData);
383 $this->tpl->setVariable(
'TXT_MARKED_ENTRIES', $this->lng->txt(
'marked_entries'));
386 $searchTpl->setVariable(
'TABLE', $table->getHTML());
387 $this->tpl->setContent($searchTpl->get());
389 if (
$_GET[
"ref"] !=
"wsp") {
390 $this->tpl->printToStdout();
399 if (
$_GET[
"search_grp"] !=
"") {
400 $_POST[
"search_grp"] = explode(
",",
$_GET[
"search_grp"]);
403 if (!is_array(
$_POST[
"search_grp"]) ||
404 count(
$_POST[
"search_grp"]) == 0) {
406 $this->showMyGroups();
408 $this->tpl->setTitle($this->lng->txt(
"mail_addressbook"));
409 include_once
'Services/Contact/classes/class.ilMailSearchCoursesMembersTableGUI.php';
412 $this->lng->loadLanguageModule(
'crs');
414 $tableData = array();
415 $searchTpl =
new ilTemplate(
'tpl.mail_search_template.html',
true,
true,
'Services/Contact');
417 foreach (
$_POST[
"search_grp"] as $grp_id) {
419 $ref_id = current($ref_ids);
422 $grp_members = $group_obj->getGroupMemberData($group_obj->getGroupMemberIds());
424 foreach ($grp_members as $member) {
426 if (!$tmp_usr->getActive()) {
432 $fullname = $member[
'lastname'] .
', ' . $member[
'firstname'];
436 'members_id' => $member[
"id"],
437 'members_login' => $member[
"login"],
438 'members_name' => $fullname,
439 'members_crs_grp' => $group_obj->getTitle(),
440 'search_grp' => $grp_id,
446 $rowData[
'status'] =
'';
447 if ($member[
'id'] != $this->
user->getId()) {
448 if ($relation->isOwnedByActor()) {
449 $rowData[
'status'] = $this->lng->txt(
'buddy_bs_state_' . $state_name .
'_a');
451 $rowData[
'status'] = $this->lng->txt(
'buddy_bs_state_' . $state_name .
'_p');
456 $tableData[] = $rowData;
460 $table->setData($tableData);
461 if (count($tableData)) {
462 $searchTpl->setVariable(
"TXT_MARKED_ENTRIES", $this->lng->txt(
"marked_entries"));
464 $searchTpl->setVariable(
'TABLE', $table->getHTML());
465 $this->tpl->setContent($searchTpl->get());
467 if (
$_GET[
"ref"] !=
"wsp") {
468 $this->tpl->printToStdout();
475 if (
$_GET[
"view"] ==
"mygroups") {
476 $ids = $_REQUEST[
"search_grp"];
477 if (is_array($ids) && count($ids)) {
481 $this->showMyGroups();
483 } elseif (
$_GET[
"view"] ==
"grp_members") {
484 $ids = $_REQUEST[
"search_members"];
485 if (is_array($ids) && count($ids)) {
492 $this->showMyGroups();
498 if (!is_array($a_obj_ids)) {
499 $a_obj_ids = array($a_obj_ids);
502 $existing = $this->wsp_access_handler->getPermissions($this->wsp_node_id);
504 foreach ($a_obj_ids as $object_id) {
505 if (!in_array($object_id, $existing)) {
506 $added = $this->wsp_access_handler->addPermission($this->wsp_node_id, $object_id);
511 ilUtil::sendSuccess($this->lng->txt(
"wsp_share_success"),
true);
513 $this->ctrl->redirectByClass(
"ilworkspaceaccessgui",
"share");
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
Class ilRoleMailboxAddress.
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.
__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.
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)