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";
36 include_once
"Services/Mail/classes/class.ilMail.php";
38 $this->mailing_allowed = $rbacsystem->checkAccess(
'mail_visible',$mail->getMailObjectReferenceId());
40 $this->ctrl->saveParameter($this,
"mobj_id");
48 $forward_class = $this->ctrl->getNextClass($this);
49 switch($forward_class)
52 if (!(
$cmd = $this->ctrl->getCmd()))
54 $cmd =
"showMyCourses";
66 if (
$_GET[
"view"] ==
"mycourses")
68 $ids = ((int)
$_GET[
'search_crs']) ? array((
int)
$_GET[
'search_crs']) :
$_POST[
'search_crs'];
80 else if (
$_GET[
"view"] ==
"crs_members")
82 $ids = ((int)
$_GET[
'search_members']) ? array((
int)
$_GET[
'search_members']) :
$_POST[
'search_members'];
101 global $ilUser,
$lng, $rbacreview;
105 if (!is_array($old_mail_data = $this->umail->getSavedData()))
107 $this->umail->savePostData(
121 require_once
'classes/class.ilObject.php';
123 $ids = ((int)
$_GET[
'search_crs']) ? array((
int)
$_GET[
'search_crs']) :
$_POST[
'search_crs'];
125 foreach ($ids as $crs_id)
131 $roles = $rbacreview->getAssignableChildRoles($ref_id);
132 foreach ($roles as $role)
134 if (substr($role[
'title'], 0, 14) ==
'il_crs_member_' ||
135 substr($role[
'title'], 0, 13) ==
'il_crs_tutor_' ||
136 substr($role[
'title'], 0, 13) ==
'il_crs_admin_')
138 if(isset($old_mail_data[
'rcp_to']) &&
139 trim($old_mail_data[
'rcp_to']) !=
'')
141 $rcpt = $rbacreview->getRoleMailboxAddress($role[
'obj_id']);
143 if(!$this->umail->doesRecipientStillExists($rcpt, $old_mail_data[
'rcp_to']))
144 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"]
175 #$this->ctrl->returnToParent($this);
183 if (!is_array($this->umail->getSavedData()))
185 $this->umail->savePostData(
199 $ids = ((int)
$_GET[
'search_members']) ? array((
int)
$_GET[
'search_members']) :
$_POST[
'search_members'];
201 foreach ($ids as $member)
204 array_push($members, $login);
206 $mail_data = $this->umail->appendSearchResult($members,
"to");
208 $this->umail->savePostData(
209 $mail_data[
"user_id"],
210 $mail_data[
"attachments"],
211 $mail_data[
"rcp_to"],
212 $mail_data[
"rcp_cc"],
213 $mail_data[
"rcp_bcc"],
214 $mail_data[
"m_type"],
215 $mail_data[
"m_email"],
216 $mail_data[
"m_subject"],
217 $mail_data[
"m_message"],
218 $mail_data[
"use_placeholders"]
221 #$this->ctrl->returnToParent($this);
231 $ids = ((int)
$_GET[
'search_members']) ? array((
int)
$_GET[
'search_members']) :
$_POST[
'search_members'];
233 if ((
int)$ids && !is_array($ids))
234 $ids = array((
int)$ids);
240 foreach ($ids as $member)
244 if (!$this->abook->checkEntry($login))
252 $this->abook->addEntry(
275 if (
$_GET[
"view"] ==
"mycourses" &&
276 $_GET[
"ref"] ==
"mail")
278 $this->ctrl->returnToParent($this);
291 global
$lng, $ilUser, $ilObjDataCache, $tree,
$tpl;
293 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
295 $this->tpl->setVariable(
'HEADER', $this->lng->txt(
'mail') );
297 $searchTpl =
new ilTemplate(
'tpl.mail_search_template.html',
true,
true,
'Services/Contact');
299 $_GET[
'view'] =
'mycourses';
301 $lng->loadLanguageModule(
'crs');
303 include_once
'Services/Contact/classes/class.ilMailSearchCoursesTableGUI.php';
305 $table->setId(
'search_crs_tbl');
306 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
309 $tableData = array();
310 if (is_array($crs_ids) && count($crs_ids) > 0)
312 $num_courses_hidden_members = 0;
313 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
314 foreach($crs_ids as $crs_id)
319 $crs_members = $oCrsParticipants->getParticipants();
321 foreach($crs_members as $key => $member)
324 if($tmp_usr->checkTimeLimit()==
false || $tmp_usr->getActive() == false )
326 unset($crs_members[$key]);
332 $hiddenMembers =
false;
333 if((
int)$oTmpCrs->getShowMembers() == $oTmpCrs->SHOW_MEMBERS_DISABLED)
335 ++$num_courses_hidden_members;
336 $hiddenMembers =
true;
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_crs', $crs_id);
360 $this->ctrl->setParameter($this,
'view',
'mycourses');
362 if ($this->mailing_allowed)
363 $current_selection_list->addItem($this->lng->txt(
"mail_members"),
'', $this->ctrl->getLinkTarget($this,
"mail"));
364 $current_selection_list->addItem($this->lng->txt(
"mail_list_members"),
'', $this->ctrl->getLinkTarget($this,
"showMembers"));
366 $this->ctrl->clearParameters($this);
371 "CRS_NAME" => $ilObjDataCache->lookupTitle($crs_id),
372 "CRS_NO_MEMBERS" => count($crs_members),
374 'COMMAND_SELECTION_LIST' => $current_selection_list->getHTML(),
375 "hidden_members" => $hiddenMembers,
378 $tableData[] = $rowData;
388 if($num_courses_hidden_members > 0)
390 $searchTpl->setCurrentBlock(
'caption_block');
391 $searchTpl->setVariable(
'TXT_LIST_MEMBERS_NOT_AVAILABLE', $this->lng->txt(
'mail_crs_list_members_not_available'));
392 $searchTpl->parseCurrentBlock();
396 $searchTpl->setVariable(
'TXT_MARKED_ENTRIES', $lng->txt(
'marked_entries'));
398 $table->setData($tableData);
399 if(
$_GET[
'ref'] ==
'mail') $this->tpl->setVariable(
'BUTTON_CANCEL', $lng->txt(
'cancel'));
401 $searchTpl->setVariable(
'TABLE', $table->getHtml());
402 $tpl->setContent($searchTpl->get());
411 global
$lng, $ilUser, $ilObjDataCache;
413 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
415 if (
$_GET[
"search_crs"] !=
"")
417 $_POST[
"search_crs"] = explode(
",",
$_GET[
"search_crs"]);
418 $_GET[
"search_crs"] =
"";
426 if (!is_array(
$_POST[
"search_crs"]) ||
427 count(
$_POST[
"search_crs"]) == 0)
434 foreach(
$_POST[
'search_crs'] as $crs_id)
437 if($oTmpCrs->getShowMembers() == $oTmpCrs->SHOW_MEMBERS_DISABLED)
439 unset(
$_POST[
'search_crs']);
440 ilUtil::sendInfo($lng->txt(
'mail_crs_list_members_not_available_for_at_least_one_crs'));
446 $this->tpl->setVariable(
"HEADER", $this->lng->txt(
"mail"));
448 $this->ctrl->setParameter($this,
"view",
"crs_members");
449 if (
$_GET[
"ref"] !=
"") $this->ctrl->setParameter($this,
"ref",
$_GET[
"ref"]);
450 if (is_array(
$_POST[
"search_crs"])) $this->ctrl->setParameter($this,
"search_crs", implode(
",",
$_POST[
"search_crs"]));
451 $this->tpl->setVariable(
"ACTION", $this->ctrl->getFormAction($this));
452 $this->ctrl->clearParameters($this);
454 $lng->loadLanguageModule(
'crs');
455 include_once
'Services/Contact/classes/class.ilMailSearchCoursesMembersTableGUI.php';
457 $table->setId(
'show_crs_mmbrs_tbl');
458 $tableData = array();
459 $searchTpl =
new ilTemplate(
'tpl.mail_search_template.html',
true,
true,
'Services/Contact');
460 foreach(
$_POST[
"search_crs"] as $crs_id)
462 $members_obj = ilCourseParticipants::_getinstanceByObjId($crs_id);
463 $tmp_members = $members_obj->getParticipants();
464 $course_members =
ilUtil::_sortIds($tmp_members,
'usr_data',
'lastname',
'usr_id');
466 foreach ($course_members as $member)
469 if($tmp_usr->checkTimeLimit()==
false || $tmp_usr->getActive() == false )
481 $fullname =
$name[
'lastname'].
', '.
$name[
'firstname'];
484 'MEMBERS_ID' => $member,
485 'MEMBERS_LOGIN' => $login,
486 'MEMBERS_NAME' => $fullname,
487 'MEMBERS_CRS_GRP' => $ilObjDataCache->lookupTitle($crs_id),
488 'MEMBERS_IN_ADDRESSBOOK' => $this->abook->checkEntryByLogin($login) ? $lng->txt(
"yes") : $lng->txt(
"no"),
489 'search_crs' => $crs_id
491 $tableData[] = $rowData;
494 $table->setData($tableData);
495 if (count($tableData))
500 $searchTpl->setVariable(
"TXT_MARKED_ENTRIES",$lng->txt(
"marked_entries"));
503 $searchTpl->setVariable(
'TABLE', $table->getHtml());
504 $this->tpl->setContent($searchTpl->get());