ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
47  default:
48  $this->$cmd();
49  break;
50  }
51 
52  return true;
53  }
54 
62  public function sendMailToSelectedUsers()
63  {
64  if(isset($_GET['member_id']))
65  {
66  $_POST['participants'] = array($_GET['member_id']);
67  }
68  else
69  {
70  $_POST['participants'] = array_unique(array_merge(
71  (array) $_POST['admins'],
72  (array) $_POST['tutors'],
73  (array) $_POST['members'],
74  (array) $_POST['roles'],
75  (array) $_POST['waiting'],
76  (array) $_POST['subscribers']));
77  }
78 
79  if (!count($_POST['participants']))
80  {
81  ilUtil::sendFailure($GLOBALS['lng']->txt("no_checkbox"),TRUE);
82  $this->ctrl->returnToParent($this);
83  return false;
84  }
85  foreach($_POST['participants'] as $usr_id)
86  {
87  $rcps[] = ilObjUser::_lookupLogin($usr_id);
88  }
89 
90  require_once 'Services/Mail/classes/class.ilMailFormCall.php';
92  $this->getCurrentObject(),
93  'members',
94  array(),
95  array('type' => 'new', 'rcp_to' => implode(',',$rcps),'sig' => $this->createMailSignature())));
96  return true;
97  }
98 
103  protected function createMailSignature()
104  {
105  $GLOBALS['lng']->loadLanguageModule($this->getCurrentObject()->object->getType());
106 
107  $link = chr(13).chr(10).chr(13).chr(10);
108  $link .= $this->lng->txt($this->getCurrentObject()->object->getType().'_mail_permanent_link');
109  $link .= chr(13).chr(10).chr(13).chr(10);
110  include_once 'Services/Link/classes/class.ilLink.php';
111  $link .= ilLink::_getLink($this->getCurrentObject()->object->getRefId());
112  return rawurlencode(base64_encode($link));
113  }
114 
115 
116 
117 }
118 ?>
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.
$cmd
Definition: sahs_server.php:35
__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)
http redirect to other script
$_POST["username"]