ILIAS  release_7 Revision v7.30-3-g800a261c036
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 ()
 
 getPRGMembersGUI ()
 
 sendMailToSelectedUsers ()
 
 generateContextArray ()
 
 redirectToParent ()
 
 createMailSignature ()
 
 getRootPrgRefId ()
 

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.

Member Function Documentation

◆ createMailSignature()

ilStudyProgrammeMailMemberSearchGUI::createMailSignature ( )
protected

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

197 : string
198 {
199 $link = chr(13) . chr(10) . chr(13) . chr(10);
200 $link .= $this->lng->txt('prg_mail_permanent_link');
201 $link .= chr(13) . chr(10) . chr(13) . chr(10);
202 include_once 'Services/Link/classes/class.ilLink.php';
203 $link .= ilLink::_getLink($this->getRootPrgRefId());
204 return rawurlencode(base64_encode($link));
205 }

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

Referenced by sendMailToSelectedUsers().

+ 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.

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':
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 }

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

+ Here is the call graph for this function:

◆ generateContextArray()

ilStudyProgrammeMailMemberSearchGUI::generateContextArray ( )
protected

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

173 : array
174 {
175 $context_array = [];
176 $ref_id = $this->getRootPrgRefId();
177 $type = ilObject::_lookupType($ref_id, true);
178 switch ($type) {
179 case 'prg':
180 if ($this->access->checkAccess('write', "", $ref_id)) {
181 $context_array = array(
183 'ref_id' => $ref_id,
184 'ts' => time()
185 );
186 }
187 break;
188 }
189 return $context_array;
190 }
const CONTEXT_KEY
Session parameter for the context.
static _lookupType($a_id, $a_reference=false)
lookup object type
$type

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

Referenced by sendMailToSelectedUsers().

+ 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 getProcessData(), and getRootPrgRefId().

+ Here is the caller graph for this function:

◆ getBackTarget()

ilStudyProgrammeMailMemberSearchGUI::getBackTarget ( )

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

64 : string
65 {
66 return $this->back_target;
67 }

Referenced by redirectToParent().

+ Here is the caller graph for this function:

◆ getPRGMembersGUI()

ilStudyProgrammeMailMemberSearchGUI::getPRGMembersGUI ( )
protected

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

134 {
135 return ilStudyProgrammeDIC::dic()['ilObjStudyProgrammeMembersGUI'];
136 }
@ilCtrl_Calls ilObjStudyProgrammeMembersGUI: ilStudyProgrammeRepositorySearchGUI @ilCtrl_Calls ilObjS...

References ilStudyProgrammeDIC\dic().

Referenced by sendMailToSelectedUsers().

+ 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.

111 : array
112 {
113 $data = [];
114
115 foreach ($this->getAssignments() as $assignment) {
116 $user_id = $assignment->getUserId();
117 $name = ilObjUser::_lookupName($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 _lookupPref($a_usr_id, $a_keyword)
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
$login
Definition: cron.php:13
if($format !==null) $name
Definition: metadata.php:230
$data
Definition: storeScorm.php:23

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

Referenced by showSelectableUsers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRootPrgRefId()

ilStudyProgrammeMailMemberSearchGUI::getRootPrgRefId ( )
protected

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

207 : int
208 {
209 $assignment = array_shift($this->getAssignments());
210 return ilObjStudyProgramme::getRefIdFor($assignment->getRootId());
211 }
static getRefIdFor(int $obj_id)

References getAssignments(), and ilObjStudyProgramme\getRefIdFor().

Referenced by createMailSignature(), and generateContextArray().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirectToParent()

ilStudyProgrammeMailMemberSearchGUI::redirectToParent ( )
protected

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

192 : void
193 {
195 }
static redirect($a_script)

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

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendMailToSelectedUsers()

ilStudyProgrammeMailMemberSearchGUI::sendMailToSelectedUsers ( )
protected

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

138 : bool
139 {
140 if (!isset($_POST['user_ids']) || !count($_POST['user_ids'])) {
141 ilUtil::sendFailure($this->lng->txt("no_checkbox"));
142 $this->showSelectableUsers();
143 return false;
144 }
145
146 $rcps = array();
147 foreach ($_POST['user_ids'] as $usr_id) {
148 $rcps[] = ilObjUser::_lookupLogin($usr_id);
149 }
150
151 if (!count(array_filter($rcps))) {
152 ilUtil::sendFailure($this->lng->txt("no_checkbox"));
153 $this->showSelectableUsers();
154 return false;
155 }
157
158 $members_gui = $this->getPRGMembersGUI();
160 $members_gui,
161 'view',
162 array(),
163 array(
164 'type' => 'new',
165 'sig' => $this->createMailSignature()
166 ),
167 $this->generateContextArray()
168 ));
169
170 return true;
171 }
$_POST["username"]
static getRedirectTarget( $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])
static setRecipients(array $recipients, string $type='to')
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

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

Referenced by executeCommand().

+ 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.

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

References $assignments.

◆ 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.

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 }

References getProcessData().

Referenced by executeCommand(), and sendMailToSelectedUsers().

+ 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: