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/Contact/classes/class.ilAddressbook.php";
55 include_once
"Services/Mail/classes/class.ilMail.php";
57 $this->mailing_allowed = $rbacsystem->checkAccess(
'mail_visible',$mail->getMailObjectReferenceId());
59 $this->ctrl->saveParameter($this,
"mobj_id");
67 $forward_class = $this->ctrl->getNextClass($this);
68 switch($forward_class)
71 if (!(
$cmd = $this->ctrl->getCmd()))
73 $cmd =
"showMyCourses";
85 if (
$_GET[
"view"] ==
"mycourses")
87 $ids = ((int)
$_GET[
'search_crs']) ? array((
int)
$_GET[
'search_crs']) :
$_POST[
'search_crs'];
99 else if (
$_GET[
"view"] ==
"crs_members")
101 $ids = ((int)
$_GET[
'search_members']) ? array((
int)
$_GET[
'search_members']) :
$_POST[
'search_members'];
120 global $ilUser,
$lng, $rbacreview;
124 if (!is_array($old_mail_data = $this->umail->getSavedData()))
126 $this->umail->savePostData(
140 require_once
'classes/class.ilObject.php';
142 $ids = ((int)
$_GET[
'search_crs']) ? array((
int)
$_GET[
'search_crs']) :
$_POST[
'search_crs'];
144 foreach ($ids as $crs_id)
150 $roles = $rbacreview->getAssignableChildRoles($ref_id);
151 foreach ($roles as $role)
153 if (substr($role[
'title'], 0, 14) ==
'il_crs_member_' ||
154 substr($role[
'title'], 0, 13) ==
'il_crs_tutor_' ||
155 substr($role[
'title'], 0, 13) ==
'il_crs_admin_')
157 if(isset($old_mail_data[
'rcp_to']) &&
158 trim($old_mail_data[
'rcp_to']) !=
'')
160 $rcpt = $rbacreview->getRoleMailboxAddress($role[
'obj_id']);
162 if(!$this->umail->doesRecipientStillExists($rcpt, $old_mail_data[
'rcp_to']))
163 array_push($members, $rcpt);
169 array_push($members, $rbacreview->getRoleMailboxAddress($role[
'obj_id']));
177 $mail_data = $this->umail->appendSearchResult($members,
'to');
179 $mail_data = $this->umail->getSavedData();
181 $this->umail->savePostData(
182 $mail_data[
"user_id"],
183 $mail_data[
"attachments"],
184 $mail_data[
"rcp_to"],
185 $mail_data[
"rcp_cc"],
186 $mail_data[
"rcp_bcc"],
187 $mail_data[
"m_type"],
188 $mail_data[
"m_email"],
189 $mail_data[
"m_subject"],
190 $mail_data[
"m_message"],
191 $mail_data[
"use_placeholders"]
194 #$this->ctrl->returnToParent($this);
202 if (!is_array($this->umail->getSavedData()))
204 $this->umail->savePostData(
218 $ids = ((int)
$_GET[
'search_members']) ? array((
int)
$_GET[
'search_members']) :
$_POST[
'search_members'];
220 foreach ($ids as $member)
223 array_push($members,
$login);
225 $mail_data = $this->umail->appendSearchResult($members,
"to");
227 $this->umail->savePostData(
228 $mail_data[
"user_id"],
229 $mail_data[
"attachments"],
230 $mail_data[
"rcp_to"],
231 $mail_data[
"rcp_cc"],
232 $mail_data[
"rcp_bcc"],
233 $mail_data[
"m_type"],
234 $mail_data[
"m_email"],
235 $mail_data[
"m_subject"],
236 $mail_data[
"m_message"],
237 $mail_data[
"use_placeholders"]
240 #$this->ctrl->returnToParent($this);
250 $ids = ((int)
$_GET[
'search_members']) ? array((
int)
$_GET[
'search_members']) :
$_POST[
'search_members'];
252 if ((
int)$ids && !is_array($ids))
253 $ids = array((
int)$ids);
259 foreach ($ids as $member)
263 if (!$this->abook->checkEntry(
$login))
271 $this->abook->addEntry(
294 if (
$_GET[
"view"] ==
"mycourses" &&
295 $_GET[
"ref"] ==
"mail")
297 $this->ctrl->returnToParent($this);
310 global
$lng, $ilUser, $ilObjDataCache, $tree,
$tpl;
312 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
314 $this->tpl->setVariable(
'HEADER', $this->lng->txt(
'mail') );
316 $searchTpl =
new ilTemplate(
'tpl.mail_search_template.html',
true,
true,
'Services/Contact');
318 $_GET[
'view'] =
'mycourses';
320 $lng->loadLanguageModule(
'crs');
322 include_once
'Services/Contact/classes/class.ilMailSearchCoursesTableGUI.php';
324 $table->setId(
'search_crs_tbl');
325 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
328 $tableData = array();
329 if (is_array($crs_ids) && count($crs_ids) > 0)
331 $num_courses_hidden_members = 0;
332 include_once(
"./Services/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
333 foreach($crs_ids as $crs_id)
338 $crs_members = $oCrsParticipants->getParticipants();
340 foreach($crs_members as
$key => $member)
343 if($tmp_usr->checkTimeLimit()==
false || $tmp_usr->getActive() == false )
345 unset($crs_members[
$key]);
351 $hiddenMembers =
false;
352 if((
int)$oTmpCrs->getShowMembers() == $oTmpCrs->SHOW_MEMBERS_DISABLED)
354 ++$num_courses_hidden_members;
355 $hiddenMembers =
true;
361 $path_arr = $tree->getPathFull(
$ref_id, $tree->getRootId());
364 foreach($path_arr as
$data)
370 $path .= $data[
'title'];
372 $path = $this->lng->txt(
'path').
': '.$path;
375 $current_selection_list->setListTitle($this->lng->txt(
"actions"));
376 $current_selection_list->setId(
"act_".$counter);
378 $this->ctrl->setParameter($this,
'search_crs', $crs_id);
379 $this->ctrl->setParameter($this,
'view',
'mycourses');
381 if ($this->mailing_allowed)
382 $current_selection_list->addItem($this->lng->txt(
"mail_members"),
'', $this->ctrl->getLinkTarget($this,
"mail"));
383 $current_selection_list->addItem($this->lng->txt(
"mail_list_members"),
'', $this->ctrl->getLinkTarget($this,
"showMembers"));
385 $this->ctrl->clearParameters($this);
390 "CRS_NAME" => $ilObjDataCache->lookupTitle($crs_id),
391 "CRS_NO_MEMBERS" => count($crs_members),
393 'COMMAND_SELECTION_LIST' => $current_selection_list->getHTML(),
394 "hidden_members" => $hiddenMembers,
397 $tableData[] = $rowData;
407 if($num_courses_hidden_members > 0)
409 $searchTpl->setCurrentBlock(
'caption_block');
410 $searchTpl->setVariable(
'TXT_LIST_MEMBERS_NOT_AVAILABLE', $this->lng->txt(
'mail_crs_list_members_not_available'));
411 $searchTpl->parseCurrentBlock();
415 $searchTpl->setVariable(
'TXT_MARKED_ENTRIES', $lng->txt(
'marked_entries'));
417 $table->setData($tableData);
418 if(
$_GET[
'ref'] ==
'mail') $this->tpl->setVariable(
'BUTTON_CANCEL', $lng->txt(
'cancel'));
420 $searchTpl->setVariable(
'TABLE', $table->getHtml());
421 $tpl->setContent($searchTpl->get());
430 global
$lng, $ilUser, $ilObjDataCache;
432 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
434 if (
$_GET[
"search_crs"] !=
"")
436 $_POST[
"search_crs"] = explode(
",",
$_GET[
"search_crs"]);
437 $_GET[
"search_crs"] =
"";
445 if (!is_array(
$_POST[
"search_crs"]) ||
446 count(
$_POST[
"search_crs"]) == 0)
453 foreach(
$_POST[
'search_crs'] as $crs_id)
456 if($oTmpCrs->getShowMembers() == $oTmpCrs->SHOW_MEMBERS_DISABLED)
458 unset(
$_POST[
'search_crs']);
459 ilUtil::sendInfo($lng->txt(
'mail_crs_list_members_not_available_for_at_least_one_crs'));
465 $this->tpl->setVariable(
"HEADER", $this->lng->txt(
"mail"));
467 $this->ctrl->setParameter($this,
"view",
"crs_members");
468 if (
$_GET[
"ref"] !=
"") $this->ctrl->setParameter($this,
"ref",
$_GET[
"ref"]);
469 if (is_array(
$_POST[
"search_crs"])) $this->ctrl->setParameter($this,
"search_crs", implode(
",",
$_POST[
"search_crs"]));
470 $this->tpl->setVariable(
"ACTION", $this->ctrl->getFormAction($this));
471 $this->ctrl->clearParameters($this);
473 $lng->loadLanguageModule(
'crs');
474 include_once
'Services/Contact/classes/class.ilMailSearchCoursesMembersTableGUI.php';
476 $table->setId(
'show_crs_mmbrs_tbl');
477 $tableData = array();
478 $searchTpl =
new ilTemplate(
'tpl.mail_search_template.html',
true,
true,
'Services/Contact');
479 foreach(
$_POST[
"search_crs"] as $crs_id)
481 $members_obj = ilCourseParticipants::_getinstanceByObjId($crs_id);
482 $tmp_members = $members_obj->getParticipants();
483 $course_members =
ilUtil::_sortIds($tmp_members,
'usr_data',
'lastname',
'usr_id');
485 foreach ($course_members as $member)
488 if($tmp_usr->checkTimeLimit()==
false || $tmp_usr->getActive() == false )
500 $fullname =
$name[
'lastname'].
', '.
$name[
'firstname'];
503 'MEMBERS_ID' => $member,
504 'MEMBERS_LOGIN' =>
$login,
505 'MEMBERS_NAME' => $fullname,
506 'MEMBERS_CRS_GRP' => $ilObjDataCache->lookupTitle($crs_id),
507 'MEMBERS_IN_ADDRESSBOOK' => $this->abook->checkEntryByLogin(
$login) ? $lng->txt(
"yes") : $lng->txt(
"no"),
508 'search_crs' => $crs_id
510 $tableData[] = $rowData;
513 $table->setData($tableData);
514 if (count($tableData))
519 $searchTpl->setVariable(
"TXT_MARKED_ENTRIES",$lng->txt(
"marked_entries"));
522 $searchTpl->setVariable(
'TABLE', $table->getHtml());
523 $this->tpl->setContent($searchTpl->get());