ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilStudyProgrammeMailMemberSearchGUI Class Reference
+ Collaboration diagram for ilStudyProgrammeMailMemberSearchGUI:

Public Member Functions

 __construct (ilCtrl $ctrl, ilGlobalTemplateInterface $tpl, ilLanguage $lng, ilAccessHandler $access)
 
 getAssignments ()
 
 setAssignments (array $assignments)
 
 getBackTarget ()
 
 setBackTarget (string $target)
 
 executeCommand ()
 

Protected Member Functions

 showSelectableUsers ()
 
 getProcessData ()
 
 sendMailToSelectedUsers ()
 
 generateContextArray ()
 
 redirectToParent ()
 
 createMailSignature ()
 
 getObjectRefId ()
 

Protected Attributes

 $gui
 
 $ctrl
 
 $tpl
 
 $lng
 
 $access
 
 $assignments
 

Detailed Description

Definition at line 7 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammeMailMemberSearchGUI::__construct ( ilCtrl  $ctrl,
ilGlobalTemplateInterface  $tpl,
ilLanguage  $lng,
ilAccessHandler  $access 
)

Definition at line 39 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References $access, $ctrl, $lng, and $tpl.

44  {
45  $this->ctrl = $ctrl;
46  $this->tpl = $tpl;
47  $this->lng = $lng;
48  $this->access = $access;
49 
50  $this->lng->loadLanguageModule('mail');
51  $this->lng->loadLanguageModule('search');
52  }

Member Function Documentation

◆ createMailSignature()

ilStudyProgrammeMailMemberSearchGUI::createMailSignature ( )
protected

Definition at line 191 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References ilLink\_getLink(), and getObjectRefId().

Referenced by sendMailToSelectedUsers().

191  : string
192  {
193  $link = chr(13) . chr(10) . chr(13) . chr(10);
194  $link .= $this->lng->txt('prg_mail_permanent_link');
195  $link .= chr(13) . chr(10) . chr(13) . chr(10);
196  include_once 'Services/Link/classes/class.ilLink.php';
197  $link .= ilLink::_getLink($this->getObjectRefId());
198  return rawurlencode(base64_encode($link));
199  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilStudyProgrammeMailMemberSearchGUI::executeCommand ( )

Definition at line 74 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References redirectToParent(), sendMailToSelectedUsers(), and showSelectableUsers().

74  : void
75  {
76  $next_class = $this->ctrl->getNextClass($this);
77  $cmd = $this->ctrl->getCmd();
78 
79  $this->ctrl->setReturn($this, '');
80 
81  switch ($next_class) {
82  default:
83  switch ($cmd) {
84  case 'sendMailToSelectedUsers':
85  $this->sendMailToSelectedUsers();
86  break;
87  case 'showSelectableUsers':
88  case 'members':
89  $this->showSelectableUsers();
90  break;
91  case 'cancel':
92  $this->redirectToParent();
93  break;
94  default:
95  throw new Exception('Unknown command ' . $cmd);
96  break;
97  }
98  break;
99  }
100  }
+ Here is the call graph for this function:

◆ generateContextArray()

ilStudyProgrammeMailMemberSearchGUI::generateContextArray ( )
protected

Definition at line 167 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References $type, ilObject\_lookupType(), ilMailFormCall\CONTEXT_KEY, getObjectRefId(), and ilStudyProgrammeMailTemplateContext\ID.

Referenced by sendMailToSelectedUsers().

167  : array
168  {
169  $context_array = [];
170  $ref_id = $this->getObjectRefId();
171  $type = ilObject::_lookupType($ref_id, true);
172  switch ($type) {
173  case 'prg':
174  if ($this->access->checkAccess('write', "", $ref_id)) {
175  $context_array = array(
177  'ref_id' => $ref_id,
178  'ts' => time()
179  );
180  }
181  break;
182  }
183  return $context_array;
184  }
$type
static _lookupType($a_id, $a_reference=false)
lookup object type
const CONTEXT_KEY
Session parameter for the context.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAssignments()

ilStudyProgrammeMailMemberSearchGUI::getAssignments ( )

Definition at line 54 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References $assignments.

Referenced by getObjectRefId(), and getProcessData().

+ Here is the caller graph for this function:

◆ getBackTarget()

ilStudyProgrammeMailMemberSearchGUI::getBackTarget ( )

Definition at line 64 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

Referenced by redirectToParent().

64  : string
65  {
66  return $this->back_target;
67  }
+ Here is the caller graph for this function:

◆ getObjectRefId()

ilStudyProgrammeMailMemberSearchGUI::getObjectRefId ( )
protected

Definition at line 201 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References getAssignments().

Referenced by createMailSignature(), and generateContextArray().

201  : int
202  {
203  $assignment = array_shift($this->getAssignments());
204  $obj = $assignment->getStudyProgramme();
205  return $obj->getRefId();
206  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProcessData()

ilStudyProgrammeMailMemberSearchGUI::getProcessData ( )
protected

Definition at line 111 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References $data, $login, $name, ilObjUser\_lookupLogin(), ilObjUser\_lookupName(), ilObjUser\_lookupPref(), and getAssignments().

Referenced by showSelectableUsers().

111  : array
112  {
113  $data = [];
114 
115  foreach ($this->getAssignments() as $assignment) {
116  $user_id = $assignment->getUserId();
117  $name = ilObjUser::_lookupName($user_id);
118  $login = ilObjUser::_lookupLogin($user_id);
119 
120  $publicName = '';
121  if (in_array(ilObjUser::_lookupPref($user_id, 'public_profile'), array('g', 'y'))) {
122  $publicName = $name['lastname'] . ', ' . $name['firstname'];
123  }
124 
125  $data[$user_id]['user_id'] = $user_id;
126  $data[$user_id]['login'] = $login;
127  $data[$user_id]['name'] = $publicName;
128  }
129 
130  return $data;
131  }
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
$login
Definition: cron.php:13
$data
Definition: storeScorm.php:23
if($format !==null) $name
Definition: metadata.php:230
static _lookupPref($a_usr_id, $a_keyword)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirectToParent()

ilStudyProgrammeMailMemberSearchGUI::redirectToParent ( )
protected

Definition at line 186 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References getBackTarget(), and ilUtil\redirect().

Referenced by executeCommand().

186  : void
187  {
189  }
static redirect($a_script)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendMailToSelectedUsers()

ilStudyProgrammeMailMemberSearchGUI::sendMailToSelectedUsers ( )
protected

Definition at line 133 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References $_POST, ilObjUser\_lookupLogin(), createMailSignature(), generateContextArray(), ilMailFormCall\getRedirectTarget(), ilUtil\redirect(), ilUtil\sendFailure(), ilMailFormCall\setRecipients(), and showSelectableUsers().

Referenced by executeCommand().

133  : bool
134  {
135  if (!isset($_POST['user_ids']) || !count($_POST['user_ids'])) {
136  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
137  $this->showSelectableUsers();
138  return false;
139  }
140 
141  $rcps = array();
142  foreach ($_POST['user_ids'] as $usr_id) {
143  $rcps[] = ilObjUser::_lookupLogin($usr_id);
144  }
145 
146  if (!count(array_filter($rcps))) {
147  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
148  $this->showSelectableUsers();
149  return false;
150  }
152 
154  $this,
155  'members',
156  array(),
157  array(
158  'type' => 'new',
159  'sig' => $this->createMailSignature()
160  ),
161  $this->generateContextArray()
162  ));
163 
164  return true;
165  }
static _lookupLogin($a_user_id)
lookup login
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static getRedirectTarget($gui, $cmd, array $gui_params=array(), array $mail_params=array(), array $context_params=array())
static setRecipients(array $recipients)
static redirect($a_script)
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAssignments()

ilStudyProgrammeMailMemberSearchGUI::setAssignments ( array  $assignments)

Definition at line 59 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References $assignments.

59  : void
60  {
61  $this->assignments = $assignments;
62  }

◆ setBackTarget()

ilStudyProgrammeMailMemberSearchGUI::setBackTarget ( string  $target)

Definition at line 69 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

70  {
71  $this->back_target = $target;
72  }

◆ showSelectableUsers()

ilStudyProgrammeMailMemberSearchGUI::showSelectableUsers ( )
protected

Definition at line 102 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

References getProcessData().

Referenced by executeCommand(), and sendMailToSelectedUsers().

102  : void
103  {
104  $this->tpl->loadStandardTemplate();
105  $tbl = new ilStudyProgrammeMailMemberSearchTableGUI($this, 'showSelectableUsers');
106  $tbl->setData($this->getProcessData());
107 
108  $this->tpl->setContent($tbl->getHTML());
109  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilStudyProgrammeMailMemberSearchGUI::$access
protected

Definition at line 32 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

Referenced by __construct().

◆ $assignments

ilStudyProgrammeMailMemberSearchGUI::$assignments
protected

Definition at line 37 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

Referenced by getAssignments(), and setAssignments().

◆ $ctrl

ilStudyProgrammeMailMemberSearchGUI::$ctrl
protected

Definition at line 17 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

Referenced by __construct().

◆ $gui

ilStudyProgrammeMailMemberSearchGUI::$gui
protected

◆ $lng

ilStudyProgrammeMailMemberSearchGUI::$lng
protected

Definition at line 27 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

Referenced by __construct().

◆ $tpl

ilStudyProgrammeMailMemberSearchGUI::$tpl
protected

Definition at line 22 of file class.ilStudyProgrammeMailMemberSearchGUI.php.

Referenced by __construct().


The documentation for this class was generated from the following file: