ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilMembershipMailGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
14{
15 protected $ctrl;
16 protected $lng;
17 private $object = null;
18
20 {
21 global $DIC;
22
23 $ilCtrl = $DIC['ilCtrl'];
24 $lng = $DIC['lng'];
25
26 $this->object = $object;
27 $this->ctrl = $ilCtrl;
28 $this->lng = $lng;
29 }
30
31 public function getCurrentObject()
32 {
33 return $this->object;
34 }
35
42 public function executeCommand()
43 {
44 $next_class = $this->ctrl->getNextClass($this);
45 $cmd = $this->ctrl->getCmd();
46
47 switch ($next_class) {
48
49 default:
50 $this->$cmd();
51 break;
52 }
53
54 return true;
55 }
56
64 public function sendMailToSelectedUsers()
65 {
66 if (isset($_GET['member_id'])) {
67 $_POST['participants'] = array($_GET['member_id']);
68 } else {
69 $_POST['participants'] = array_unique(array_merge(
70 (array) $_POST['admins'],
71 (array) $_POST['tutors'],
72 (array) $_POST['members'],
73 (array) $_POST['roles'],
74 (array) $_POST['waiting'],
75 (array) $_POST['subscribers']
76 ));
77 }
78
79 if (!count($_POST['participants'])) {
80 ilUtil::sendFailure($GLOBALS['DIC']['lng']->txt("no_checkbox"), true);
81 $this->ctrl->returnToParent($this);
82 return false;
83 }
84 foreach ($_POST['participants'] as $usr_id) {
85 $rcps[] = ilObjUser::_lookupLogin($usr_id);
86 }
87
88 require_once 'Services/Mail/classes/class.ilMailFormCall.php';
90 $this->getCurrentObject(),
91 'members',
92 array(),
93 array('type' => 'new', 'rcp_to' => implode(',', $rcps),'sig' => $this->createMailSignature())
94 ));
95 return true;
96 }
97
102 protected function createMailSignature()
103 {
104 $GLOBALS['DIC']['lng']->loadLanguageModule($this->getCurrentObject()->object->getType());
105
106 $link = chr(13) . chr(10) . chr(13) . chr(10);
107 $link .= $this->lng->txt($this->getCurrentObject()->object->getType() . '_mail_permanent_link');
108 $link .= chr(13) . chr(10) . chr(13) . chr(10);
109 include_once 'Services/Link/classes/class.ilLink.php';
110 $link .= ilLink::_getLink($this->getCurrentObject()->object->getRefId());
111 return rawurlencode(base64_encode($link));
112 }
113}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
static getRedirectTarget($gui, $cmd, array $gui_params=array(), array $mail_params=array(), array $context_params=array())
sendMailToSelectedUsers()
show send mail
__construct(ilObjectGUI $object)
createMailSignature()
Create a course mail signature.
static _lookupLogin($a_user_id)
lookup login
Class ilObjectGUI Basic methods of all Output classes.
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilCtrl
Definition: ilias.php:18
$DIC
Definition: xapitoken.php:46