24 require_once
'./Services/User/classes/class.ilObjUser.php';
25 require_once
"Services/Mail/classes/class.ilMailbox.php";
26 require_once
"Services/Mail/classes/class.ilFormatMail.php";
27 require_once
"Services/Mail/classes/class.ilAddressbook.php";
52 $this->ctrl->saveParameter($this,
"mobj_id");
60 $forward_class = $this->ctrl->getNextClass($this);
61 switch($forward_class)
64 if (!(
$cmd = $this->ctrl->getCmd()))
66 $cmd =
"showMyGroups";
79 if (
$_GET[
"view"] ==
"mygroups")
81 if (is_array($_POST[
"search_grp"]))
91 else if (
$_GET[
"view"] ==
"grp_members")
93 if (is_array($_POST[
"search_members"]))
111 global $ilUser,
$lng, $rbacreview;
115 if (!is_array($old_mail_data = $this->umail->getSavedData()))
117 $this->umail->savePostData(
131 require_once
'classes/class.ilObject.php';
132 foreach ($_POST[
"search_grp"] as $grp_id)
137 $roles = $rbacreview->getAssignableChildRoles($ref_id);
138 foreach ($roles as $role)
140 if (substr($role[
'title'], 0, 14) ==
'il_grp_member_' ||
141 substr($role[
'title'], 0, 13) ==
'il_grp_admin_')
143 if(isset($old_mail_data[
'rcp_to']) &&
144 trim($old_mail_data[
'rcp_to']) !=
'')
146 $rcpt = $rbacreview->getRoleMailboxAddress($role[
'obj_id']);
148 if(!$this->umail->doesRecipientStillExists($rcpt, $old_mail_data[
'rcp_to']))
149 array_push($members, $rcpt);
155 array_push($members, $rbacreview->getRoleMailboxAddress($role[
'obj_id']));
163 $mail_data = $this->umail->appendSearchResult($members,
'to');
165 $mail_data = $this->umail->getSavedData();
167 $this->umail->savePostData(
168 $mail_data[
"user_id"],
169 $mail_data[
"attachments"],
170 $mail_data[
"rcp_to"],
171 $mail_data[
"rcp_cc"],
172 $mail_data[
"rcp_bcc"],
173 $mail_data[
"m_type"],
174 $mail_data[
"m_email"],
175 $mail_data[
"m_subject"],
176 $mail_data[
"m_message"],
177 $mail_data[
"use_placeholders"]
187 if (!is_array($this->umail->getSavedData()))
189 $this->umail->savePostData(
203 foreach ($_POST[
"search_members"] as $member)
206 array_push($members, $login);
208 $mail_data = $this->umail->appendSearchResult($members,
"to");
210 $this->umail->savePostData(
211 $mail_data[
"user_id"],
212 $mail_data[
"attachments"],
213 $mail_data[
"rcp_to"],
214 $mail_data[
"rcp_cc"],
215 $mail_data[
"rcp_bcc"],
216 $mail_data[
"m_type"],
217 $mail_data[
"m_email"],
218 $mail_data[
"m_subject"],
219 $mail_data[
"m_message"],
220 $mail_data[
"use_placeholders"]
233 if (is_array($_POST[
"search_members"]))
237 foreach ($_POST[
"search_members"] as $member)
241 if (!$this->abook->checkEntry($login))
249 $this->abook->addEntry(
272 if (
$_GET[
"view"] ==
"mygroups" &&
273 $_GET[
"ref"] ==
"mail")
275 $this->ctrl->returnToParent($this);
288 global
$lng, $ilUser, $ilObjDataCache, $tree;
290 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_addressbook_search.html',
'Services/Mail');
291 $this->tpl->setVariable(
'HEADER', $this->lng->txt(
'mail'));
293 $_GET[
'view'] =
'mygroups';
295 $this->ctrl->setParameter($this,
'view',
'mygroups');
296 if (
$_GET[
'ref'] !=
'') $this->ctrl->setParameter($this,
'ref',
$_GET[
'ref']);
297 if (is_array($_POST[
'search_grp'])) $this->ctrl->setParameter($this,
'search_grp', implode(
',', $_POST[
'search_grp']));
298 $this->tpl->setVariable(
'ACTION', $this->ctrl->getFormAction($this));
299 $this->ctrl->clearParameters($this);
301 $lng->loadLanguageModule(
'crs');
303 include_once
'Modules/Group/classes/class.ilGroupParticipants.php';
307 if (is_array($grp_ids) &&
310 $this->tpl->setVariable(
'GRP_TXT_GROUPS',$lng->txt(
'mail_my_groups'));
311 $this->tpl->setVariable(
'GRP_TXT_GROUPS_PATHS',$lng->txt(
'path'));
312 $this->tpl->setVariable(
'GRP_TXT_NO_MEMBERS',$lng->txt(
'grp_count_members'));
314 foreach($grp_ids as $grp_id)
319 $grp_members = $oGroupParticipants->getParticipants();
321 foreach ($grp_members as $key => $member)
325 if($tmp_usr->checkTimeLimit()==
false || $tmp_usr->getActive() == false )
327 unset($grp_members[$key]);
334 $path_arr = $tree->getPathFull(
$ref_id, $tree->getRootId());
337 foreach($path_arr as
$data)
343 $path .= $data[
'title'];
345 $path = $this->lng->txt(
'path').
': '.$path;
347 $this->tpl->setCurrentBlock(
'loop_grp');
348 $this->tpl->setVariable(
'LOOP_GRP_CSSROW', ++$counter % 2 ?
'tblrow1' :
'tblrow2');
349 $this->tpl->setVariable(
'LOOP_GRP_ID', $grp_id);
350 $this->tpl->setVariable(
'LOOP_GRP_NAME', $ilObjDataCache->lookupTitle($grp_id));
351 $this->tpl->setVariable(
'LOOP_GRP_NO_MEMBERS', count($grp_members));
352 $this->tpl->setVariable(
'LOOP_GRP_PATH', $path);
353 $this->tpl->parseCurrentBlock();
359 $this->tpl->setVariable(
'BUTTON_MAIL', $lng->txt(
'mail_members'));
360 $this->tpl->setVariable(
'BUTTON_LIST', $lng->txt(
'mail_list_members'));
366 $this->tpl->setCurrentBlock(
'grp_not_found');
367 $this->tpl->setVariable(
'TXT_GRP_NOT_FOUND', $lng->txt(
'mail_search_groups_not_found'));
368 $this->tpl->parseCurrentBlock();
370 $this->tpl->touchBlock(
'entries_not_found');
374 $this->tpl->setVariable(
'TXT_MARKED_ENTRIES',$lng->txt(
'marked_entries'));
377 if(
$_GET[
'ref'] ==
'mail') $this->tpl->setVariable(
'BUTTON_CANCEL', $lng->txt(
'cancel'));
387 global
$lng, $ilUser;
389 if (
$_GET[
"search_grp"] !=
"")
391 $_POST[
"search_grp"] = explode(
",",
$_GET[
"search_grp"]);
394 if (!is_array($_POST[
"search_grp"]) ||
395 count($_POST[
"search_grp"]) == 0)
402 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.mail_addressbook_search.html",
"Services/Mail");
403 $this->tpl->setVariable(
"HEADER", $this->lng->txt(
"mail"));
405 $this->ctrl->setParameter($this,
"view",
"grp_members");
406 if (
$_GET[
"ref"] !=
"") $this->ctrl->setParameter($this,
"ref",
$_GET[
"ref"]);
407 if (is_array($_POST[
"search_grp"])) $this->ctrl->setParameter($this,
"search_grp", implode(
",", $_POST[
"search_grp"]));
408 $this->tpl->setVariable(
"ACTION", $this->ctrl->getFormAction($this));
409 $this->ctrl->clearParameters($this);
411 $lng->loadLanguageModule(
'crs');
413 $this->tpl->setCurrentBlock(
"members_group");
414 $this->tpl->setVariable(
"MEMBERS_TXT_GROUP",$lng->txt(
"obj_grp"));
415 $this->tpl->parseCurrentBlock();
416 $this->tpl->setVariable(
"MEMBERS_TXT_LOGIN",$lng->txt(
"login"));
417 $this->tpl->setVariable(
"MEMBERS_TXT_NAME",$lng->txt(
"name"));
418 $this->tpl->setVariable(
"MEMBERS_TXT_IN_ADDRESSBOOK",$lng->txt(
"mail_in_addressbook"));
421 foreach($_POST[
"search_grp"] as $grp_id)
428 $grp_members = $group_obj->getGroupMemberData($group_obj->getGroupMemberIds());
430 foreach($grp_members as $member)
433 if($tmp_usr->checkTimeLimit()==
false || $tmp_usr->getActive() == false )
440 $this->tpl->setCurrentBlock(
"loop_members");
441 $this->tpl->setVariable(
"LOOP_MEMBERS_CSSROW",++$counter%2 ?
'tblrow1' :
'tblrow2');
442 $this->tpl->setVariable(
"LOOP_MEMBERS_ID",$member[
"id"]);
443 $this->tpl->setVariable(
"LOOP_MEMBERS_LOGIN",$member[
"login"]);
446 $this->tpl->setVariable(
'LOOP_MEMBERS_NAME', $member[
'lastname'].
', '.$member[
'firstname']);
448 $this->tpl->setVariable(
"LOOP_MEMBERS_CRS_GRP",$group_obj->getTitle());
449 $this->tpl->setVariable(
"LOOP_MEMBERS_IN_ADDRESSBOOK", $this->abook->checkEntryByLogin($member[
"login"]) ? $lng->txt(
"yes") : $lng->txt(
"no"));
450 $this->tpl->parseCurrentBlock();
457 $this->tpl->setCurrentBlock(
"members_not_found");
458 $this->tpl->setVariable(
"TXT_MEMBERS_NOT_FOUND",$lng->txt(
"mail_search_members_not_found"));
459 $this->tpl->parseCurrentBlock();
461 $this->tpl->touchBlock(
"entries_not_found");
465 $this->tpl->setVariable(
"BUTTON_MAIL",$lng->txt(
"grp_mem_send_mail"));
466 $this->tpl->setVariable(
"BUTTON_ADOPT",$lng->txt(
"mail_into_addressbook"));
468 $this->tpl->setVariable(
"TXT_MARKED_ENTRIES",$lng->txt(
"marked_entries"));
471 $this->tpl->setVariable(
"BUTTON_CANCEL",$lng->txt(
"cancel"));