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 =
"showMyCourses";
79 if (
$_GET[
"view"] ==
"mycourses")
81 if (is_array($_POST[
"search_crs"]))
91 else if (
$_GET[
"view"] ==
"crs_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_crs"] as $crs_id)
137 $roles = $rbacreview->getAssignableChildRoles($ref_id);
138 foreach ($roles as $role)
140 if (substr($role[
'title'], 0, 14) ==
'il_crs_member_' ||
141 substr($role[
'title'], 0, 13) ==
'il_crs_tutor_' ||
142 substr($role[
'title'], 0, 13) ==
'il_crs_admin_')
144 if(isset($old_mail_data[
'rcp_to']) &&
145 trim($old_mail_data[
'rcp_to']) !=
'')
147 $rcpt = $rbacreview->getRoleMailboxAddress($role[
'obj_id']);
149 if(!$this->umail->doesRecipientStillExists($rcpt, $old_mail_data[
'rcp_to']))
150 array_push($members, $rcpt);
156 array_push($members, $rbacreview->getRoleMailboxAddress($role[
'obj_id']));
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);
189 if (!is_array($this->umail->getSavedData()))
191 $this->umail->savePostData(
205 foreach ($_POST[
"search_members"] as $member)
208 array_push($members, $login);
210 $mail_data = $this->umail->appendSearchResult($members,
"to");
212 $this->umail->savePostData(
213 $mail_data[
"user_id"],
214 $mail_data[
"attachments"],
215 $mail_data[
"rcp_to"],
216 $mail_data[
"rcp_cc"],
217 $mail_data[
"rcp_bcc"],
218 $mail_data[
"m_type"],
219 $mail_data[
"m_email"],
220 $mail_data[
"m_subject"],
221 $mail_data[
"m_message"],
222 $mail_data[
"use_placeholders"]
225 #$this->ctrl->returnToParent($this);
236 if (is_array($_POST[
"search_members"]))
240 foreach ($_POST[
"search_members"] 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;
293 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
295 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_addressbook_search.html',
'Services/Mail');
296 $this->tpl->setVariable(
'HEADER', $this->lng->txt(
'mail'));
298 $_GET[
'view'] =
'mycourses';
300 $this->ctrl->setParameter($this,
'view',
'mycourses');
301 if (
$_GET[
'ref'] !=
'') $this->ctrl->setParameter($this,
'ref',
$_GET[
'ref']);
302 if (is_array($_POST[
'search_crs'])) $this->ctrl->setParameter($this,
'search_crs', implode(
',', $_POST[
'search_crs']));
303 $this->tpl->setVariable(
'ACTION', $this->ctrl->getFormAction($this));
304 $this->ctrl->clearParameters($this);
306 $lng->loadLanguageModule(
'crs');
311 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
315 if (is_array($crs_ids) &&
319 $this->tpl->setVariable(
'CRS_TXT_COURSES', $lng->txt(
'mail_my_courses'));
320 $this->tpl->setVariable(
'CRS_TXT_COURSES_PATHS', $lng->txt(
'path'));
321 $this->tpl->setVariable(
'CRS_TXT_NO_MEMBERS', $lng->txt(
'crs_count_members'));
323 $num_courses_hidden_members = 0;
325 foreach($crs_ids as $crs_id)
330 $crs_members = $oCrsParticipants->getParticipants();
332 foreach($crs_members as $key => $member)
335 if($tmp_usr->checkTimeLimit()==
false || $tmp_usr->getActive() == false )
337 unset($crs_members[$key]);
343 if((
int)$oTmpCrs->getShowMembers() == $oTmpCrs->SHOW_MEMBERS_DISABLED)
345 ++$num_courses_hidden_members;
347 $this->tpl->setCurrentBlock(
'caption_asterisk');
348 $this->tpl->touchBlock(
'caption_asterisk');
349 $this->tpl->parseCurrentBlock();
355 $path_arr = $tree->getPathFull(
$ref_id, $tree->getRootId());
358 foreach($path_arr as
$data)
364 $path .= $data[
'title'];
366 $path = $this->lng->txt(
'path').
': '.$path;
368 $this->tpl->setCurrentBlock(
'loop_crs');
369 $this->tpl->setVariable(
'LOOP_CRS_CSSROW', ++$counter % 2 ?
'tblrow1' :
'tblrow2');
370 $this->tpl->setVariable(
'LOOP_CRS_ID', $crs_id);
371 $this->tpl->setVariable(
'LOOP_CRS_NAME', $ilObjDataCache->lookupTitle($crs_id));
372 $this->tpl->setVariable(
'LOOP_CRS_NO_MEMBERS', count($crs_members));
373 $this->tpl->setVariable(
'LOOP_CRS_PATH', $path);
374 $this->tpl->parseCurrentBlock();
380 $this->tpl->setVariable(
'BUTTON_MAIL',$lng->txt(
'mail_members'));
381 $this->tpl->setVariable(
'BUTTON_LIST',$lng->txt(
'mail_list_members'));
384 if($num_courses_hidden_members > 0)
386 $this->tpl->setCurrentBlock(
'caption_block');
387 $this->tpl->setVariable(
'TXT_LIST_MEMBERS_NOT_AVAILABLE', $this->lng->txt(
'mail_crs_list_members_not_available'));
388 $this->tpl->parseCurrentBlock();
394 $this->tpl->setCurrentBlock(
'crs_not_found');
395 $this->tpl->setVariable(
'TXT_CRS_NOT_FOUND', $lng->txt(
'mail_search_courses_not_found'));
396 $this->tpl->parseCurrentBlock();
398 $this->tpl->touchBlock(
'entries_not_found');
402 $this->tpl->setVariable(
'TXT_MARKED_ENTRIES', $lng->txt(
'marked_entries'));
405 if(
$_GET[
'ref'] ==
'mail') $this->tpl->setVariable(
'BUTTON_CANCEL', $lng->txt(
'cancel'));
415 global
$lng, $ilUser, $ilObjDataCache;
417 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
419 if (
$_GET[
"search_crs"] !=
"")
421 $_POST[
"search_crs"] = explode(
",",
$_GET[
"search_crs"]);
422 $_GET[
"search_crs"] =
"";
426 $_POST[
"search_crs"] = explode(
",",
$_SESSION[
"search_crs"]);
430 if (!is_array($_POST[
"search_crs"]) ||
431 count($_POST[
"search_crs"]) == 0)
438 foreach($_POST[
'search_crs'] as $crs_id)
441 if($oTmpCrs->getShowMembers() == $oTmpCrs->SHOW_MEMBERS_DISABLED)
443 unset($_POST[
'search_crs']);
444 ilUtil::sendInfo($lng->txt(
'mail_crs_list_members_not_available_for_at_least_one_crs'));
450 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.mail_addressbook_search.html",
"Services/Mail");
451 $this->tpl->setVariable(
"HEADER", $this->lng->txt(
"mail"));
453 $this->ctrl->setParameter($this,
"view",
"crs_members");
454 if (
$_GET[
"ref"] !=
"") $this->ctrl->setParameter($this,
"ref",
$_GET[
"ref"]);
455 if (is_array($_POST[
"search_crs"])) $this->ctrl->setParameter($this,
"search_crs", implode(
",", $_POST[
"search_crs"]));
456 $this->tpl->setVariable(
"ACTION", $this->ctrl->getFormAction($this));
457 $this->ctrl->clearParameters($this);
459 $lng->loadLanguageModule(
'crs');
461 $this->tpl->setCurrentBlock(
"members_course");
462 $this->tpl->setVariable(
"MEMBERS_TXT_COURSE",$lng->txt(
"course"));
463 $this->tpl->parseCurrentBlock();
464 $this->tpl->setVariable(
"MEMBERS_TXT_LOGIN",$lng->txt(
"login"));
465 $this->tpl->setVariable(
"MEMBERS_TXT_NAME",$lng->txt(
"name"));
466 $this->tpl->setVariable(
"MEMBERS_TXT_IN_ADDRESSBOOK",$lng->txt(
"mail_in_addressbook"));
469 foreach($_POST[
"search_crs"] as $crs_id)
471 $members_obj = ilCourseParticipants::_getinstanceByObjId($crs_id);
472 $tmp_members = $members_obj->getParticipants();
473 $course_members =
ilUtil::_sortIds($tmp_members,
'usr_data',
'lastname',
'usr_id');
475 foreach ($course_members as $member)
478 if($tmp_usr->checkTimeLimit()==
false || $tmp_usr->getActive() == false )
488 $this->tpl->setCurrentBlock(
"loop_members");
489 $this->tpl->setVariable(
"LOOP_MEMBERS_CSSROW",++$counter%2 ?
'tblrow1' :
'tblrow2');
490 $this->tpl->setVariable(
"LOOP_MEMBERS_ID",$member);
491 $this->tpl->setVariable(
"LOOP_MEMBERS_LOGIN",$login);
494 $this->tpl->setVariable(
'LOOP_MEMBERS_NAME', $name[
'lastname'].
', '.$name[
'firstname']);
496 $this->tpl->setVariable(
"LOOP_MEMBERS_CRS_GRP", $ilObjDataCache->lookupTitle($crs_id));
497 $this->tpl->setVariable(
"LOOP_MEMBERS_IN_ADDRESSBOOK", $this->abook->checkEntryByLogin($login) ? $lng->txt(
"yes") : $lng->txt(
"no"));
498 $this->tpl->parseCurrentBlock();
504 $this->tpl->setCurrentBlock(
"members_not_found");
505 $this->tpl->setVariable(
"TXT_MEMBERS_NOT_FOUND",$lng->txt(
"mail_search_members_not_found"));
506 $this->tpl->parseCurrentBlock();
508 $this->tpl->touchBlock(
"entries_not_found");
512 $this->tpl->setVariable(
"BUTTON_MAIL",$lng->txt(
"grp_mem_send_mail"));
513 $this->tpl->setVariable(
"BUTTON_ADOPT",$lng->txt(
"mail_into_addressbook"));
515 $this->tpl->setVariable(
"TXT_MARKED_ENTRIES",$lng->txt(
"marked_entries"));
518 $this->tpl->setVariable(
"BUTTON_CANCEL",$lng->txt(
"cancel"));