ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
19  public function __construct(ilObjectGUI $object)
20  {
21  global $ilCtrl, $lng;
22 
23  $this->object = $object;
24  $this->ctrl = $ilCtrl;
25  $this->lng = $lng;
26  }
27 
28  public function getCurrentObject()
29  {
30  return $this->object;
31  }
32 
39  public function executeCommand()
40  {
41  $next_class = $this->ctrl->getNextClass($this);
42  $cmd = $this->ctrl->getCmd();
43 
44  switch ($next_class) {
45 
46  default:
47  $this->$cmd();
48  break;
49  }
50 
51  return true;
52  }
53 
61  public function sendMailToSelectedUsers()
62  {
63  if (isset($_GET['member_id'])) {
64  $_POST['participants'] = array($_GET['member_id']);
65  } else {
66  $_POST['participants'] = array_unique(array_merge(
67  (array) $_POST['admins'],
68  (array) $_POST['tutors'],
69  (array) $_POST['members'],
70  (array) $_POST['roles'],
71  (array) $_POST['waiting'],
72  (array) $_POST['subscribers']
73  ));
74  }
75 
76  if (!count($_POST['participants'])) {
77  ilUtil::sendFailure($GLOBALS['lng']->txt("no_checkbox"), true);
78  $this->ctrl->returnToParent($this);
79  return false;
80  }
81  foreach ($_POST['participants'] as $usr_id) {
82  $rcps[] = ilObjUser::_lookupLogin($usr_id);
83  }
84 
85  require_once 'Services/Mail/classes/class.ilMailFormCall.php';
87  $this->getCurrentObject(),
88  'members',
89  array(),
90  array('type' => 'new', 'rcp_to' => implode(',', $rcps),'sig' => $this->createMailSignature())
91  ));
92  return true;
93  }
94 
99  protected function createMailSignature()
100  {
101  $GLOBALS['lng']->loadLanguageModule($this->getCurrentObject()->object->getType());
102 
103  $link = chr(13) . chr(10) . chr(13) . chr(10);
104  $link .= $this->lng->txt($this->getCurrentObject()->object->getType() . '_mail_permanent_link');
105  $link .= chr(13) . chr(10) . chr(13) . chr(10);
106  include_once 'Services/Link/classes/class.ilLink.php';
107  $link .= ilLink::_getLink($this->getCurrentObject()->object->getRefId());
108  return rawurlencode(base64_encode($link));
109  }
110 }
createMailSignature()
Create a course mail signature.
static _lookupLogin($a_user_id)
lookup login
executeCommand()
execute command
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
__construct(ilObjectGUI $object)
global $ilCtrl
Definition: ilias.php:18
Class ilObjectGUI Basic methods of all Output classes.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
sendMailToSelectedUsers()
show send mail
Create new PHPExcel object
obj_idprivate
static getRedirectTarget($gui, $cmd, array $gui_params=array(), array $mail_params=array(), array $context_params=array())
static redirect($a_script)
$_POST["username"]