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']))
147 array_push($members,
'#'.$role[
'title']);
156 array_push($members,
'#'.$role[
'title']);
164 $mail_data = $this->umail->appendSearchResult($members,
'to');
166 $mail_data = $this->umail->getSavedData();
168 $this->umail->savePostData(
169 $mail_data[
"user_id"],
170 $mail_data[
"attachments"],
171 $mail_data[
"rcp_to"],
172 $mail_data[
"rcp_cc"],
173 $mail_data[
"rcp_bcc"],
174 $mail_data[
"m_type"],
175 $mail_data[
"m_email"],
176 $mail_data[
"m_subject"],
177 $mail_data[
"m_message"],
178 $mail_data[
"use_placeholders"]
181 #$this->ctrl->returnToParent($this);
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"]
229 #$this->ctrl->returnToParent($this);
239 $ids = ((int)
$_GET[
'search_members']) ? array((
int)
$_GET[
'search_members']) :
$_POST[
'search_members'];
241 if ((
int)$ids && !is_array($ids))
242 $ids = array((
int)$ids);
248 foreach ($ids as $member)
252 if (!$this->abook->checkEntry($login))
260 $this->abook->addEntry(
283 if (
$_GET[
"view"] ==
"mycourses" &&
284 $_GET[
"ref"] ==
"mail")
286 $this->ctrl->returnToParent($this);
299 global
$lng, $ilUser, $ilObjDataCache, $tree,
$tpl, $rbacsystem;
301 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
303 $this->tpl->setVariable(
'HEADER', $this->lng->txt(
'mail') );
305 $searchTpl =
new ilTemplate(
'tpl.mail_search_template.html',
true,
true,
'Services/Contact');
307 $_GET[
'view'] =
'mycourses';
309 $lng->loadLanguageModule(
'crs');
311 include_once
'Services/Contact/classes/class.ilMailSearchCoursesTableGUI.php';
313 $table->setId(
'search_crs_tbl');
314 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
317 $tableData = array();
318 if (is_array($crs_ids) && count($crs_ids) > 0)
320 $num_courses_hidden_members = 0;
321 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
322 foreach($crs_ids as $crs_id)
326 $isOffline = $oTmpCrs->getOfflineStatus();
328 $showMemberListEnabled = (boolean)$oTmpCrs->getShowMembers();
330 $isPrivilegedUser = $rbacsystem->checkAccess(
'edit', $ref_ids[0]);
332 if($hasUntrashedReferences && ((!$isOffline && $showMemberListEnabled) || $isPrivilegedUser))
335 $crs_members = $oCrsParticipants->getParticipants();
337 foreach($crs_members as $key => $member)
340 if($tmp_usr->checkTimeLimit()==
false || $tmp_usr->getActive() == false )
342 unset($crs_members[$key]);
347 $hiddenMembers =
false;
348 if((
int)$oTmpCrs->getShowMembers() == $oTmpCrs->SHOW_MEMBERS_DISABLED)
350 ++$num_courses_hidden_members;
351 $hiddenMembers =
true;
357 $path_arr = $tree->getPathFull(
$ref_id, $tree->getRootId());
360 foreach($path_arr as
$data)
366 $path .= $data[
'title'];
371 $current_selection_list->setListTitle($this->lng->txt(
"actions"));
372 $current_selection_list->setId(
"act_".$counter);
374 $this->ctrl->setParameter($this,
'search_crs', $crs_id);
375 $this->ctrl->setParameter($this,
'view',
'mycourses');
377 if ($this->mailing_allowed)
378 $current_selection_list->addItem($this->lng->txt(
"mail_members"),
'', $this->ctrl->getLinkTarget($this,
"mail"));
379 $current_selection_list->addItem($this->lng->txt(
"mail_list_members"),
'', $this->ctrl->getLinkTarget($this,
"showMembers"));
381 $this->ctrl->clearParameters($this);
386 "CRS_NAME" => $ilObjDataCache->lookupTitle($crs_id),
387 "CRS_NO_MEMBERS" => count($crs_members),
389 'COMMAND_SELECTION_LIST' => $current_selection_list->getHTML(),
390 "hidden_members" => $hiddenMembers,
393 $tableData[] = $rowData;
403 if($num_courses_hidden_members > 0)
405 $searchTpl->setCurrentBlock(
'caption_block');
406 $searchTpl->setVariable(
'TXT_LIST_MEMBERS_NOT_AVAILABLE', $this->lng->txt(
'mail_crs_list_members_not_available'));
407 $searchTpl->parseCurrentBlock();
411 $searchTpl->setVariable(
'TXT_MARKED_ENTRIES', $lng->txt(
'marked_entries'));
413 $table->setData($tableData);
414 if(
$_GET[
'ref'] ==
'mail') $this->tpl->setVariable(
'BUTTON_CANCEL', $lng->txt(
'cancel'));
416 $searchTpl->setVariable(
'TABLE', $table->getHtml());
417 $tpl->setContent($searchTpl->get());
426 global
$lng, $ilUser, $ilObjDataCache;
428 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
430 if (
$_GET[
"search_crs"] !=
"")
432 $_POST[
"search_crs"] = explode(
",",
$_GET[
"search_crs"]);
433 $_GET[
"search_crs"] =
"";
441 if (!is_array(
$_POST[
"search_crs"]) ||
442 count(
$_POST[
"search_crs"]) == 0)
449 foreach(
$_POST[
'search_crs'] as $crs_id)
452 if($oTmpCrs->getShowMembers() == $oTmpCrs->SHOW_MEMBERS_DISABLED)
454 unset(
$_POST[
'search_crs']);
455 ilUtil::sendInfo($lng->txt(
'mail_crs_list_members_not_available_for_at_least_one_crs'));
461 $this->tpl->setVariable(
"HEADER", $this->lng->txt(
"mail"));
463 $this->ctrl->setParameter($this,
"view",
"crs_members");
464 if (
$_GET[
"ref"] !=
"") $this->ctrl->setParameter($this,
"ref",
$_GET[
"ref"]);
465 if (is_array(
$_POST[
"search_crs"])) $this->ctrl->setParameter($this,
"search_crs", implode(
",",
$_POST[
"search_crs"]));
466 $this->tpl->setVariable(
"ACTION", $this->ctrl->getFormAction($this));
467 $this->ctrl->clearParameters($this);
469 $lng->loadLanguageModule(
'crs');
470 include_once
'Services/Contact/classes/class.ilMailSearchCoursesMembersTableGUI.php';
472 $table->setId(
'show_crs_mmbrs_tbl');
473 $tableData = array();
474 $searchTpl =
new ilTemplate(
'tpl.mail_search_template.html',
true,
true,
'Services/Contact');
475 foreach(
$_POST[
"search_crs"] as $crs_id)
477 $members_obj = ilCourseParticipants::_getinstanceByObjId($crs_id);
478 $tmp_members = $members_obj->getParticipants();
479 $course_members =
ilUtil::_sortIds($tmp_members,
'usr_data',
'lastname',
'usr_id');
481 foreach ($course_members as $member)
484 if($tmp_usr->checkTimeLimit()==
false || $tmp_usr->getActive() == false )
496 $fullname = $name[
'lastname'].
', '.$name[
'firstname'];
499 'MEMBERS_ID' => $member,
500 'MEMBERS_LOGIN' => $login,
501 'MEMBERS_NAME' => $fullname,
502 'MEMBERS_CRS_GRP' => $ilObjDataCache->lookupTitle($crs_id),
503 'MEMBERS_IN_ADDRESSBOOK' => $this->abook->checkEntryByLogin($login) ? $lng->txt(
"yes") : $lng->txt(
"no"),
504 'search_crs' => $crs_id
506 $tableData[] = $rowData;
509 $table->setData($tableData);
510 if (count($tableData))
515 $searchTpl->setVariable(
"TXT_MARKED_ENTRIES",$lng->txt(
"marked_entries"));
518 $searchTpl->setVariable(
'TABLE', $table->getHtml());
519 $this->tpl->setContent($searchTpl->get());