ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilUserStartingPointGUI Class Reference

Class ilUserStartingPointGUI. More...

+ Collaboration diagram for ilUserStartingPointGUI:

Public Member Functions

 __construct ($a_parent_ref_id)
 Constructor @access public. More...
 
executeCommand ()
 
 startingPoints ()
 table form to set up starting points depends of user roles More...
 
 initUserStartingPointForm (ilPropertyFormGUI $form=null)
 
 initRoleStartingPointForm (ilPropertyFormGUI $form=null)
 
 saveOrder ()
 
 confirmDeleteStartingPoint ()
 Confirm delete starting point. More...
 

Protected Member Functions

 getUserStartingPointForm ()
 
 getRoleStartingPointForm ()
 
 saveUserStartingPoint ()
 
 saveStartingPoint ()
 store starting point from the form More...
 
 deleteStartingPoint ()
 Set to 0 the starting point values. More...
 

Protected Attributes

 $log
 
 $lng
 
 $tpl
 
 $parent_ref_id
 

Detailed Description

Class ilUserStartingPointGUI.

Author
Jesús López lopez.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$ @ilCtrl_Calls ilUserStartingPointGUI:

Definition at line 13 of file class.ilUserStartingPointGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilUserStartingPointGUI::__construct (   $a_parent_ref_id)

Constructor @access public.

Definition at line 24 of file class.ilUserStartingPointGUI.php.

25 {
26 global $lng,$tpl,$ilToolbar, $ilCtrl;
27
28 $this->log = ilLoggerFactory::getLogger("user");
29 $this->lng = $lng;
30 $this->tpl = $tpl;
31 $this->toolbar = $ilToolbar;
32 $this->ctrl = $ilCtrl;
33 $this->parent_ref_id = $a_parent_ref_id;
34 $this->lng->loadLanguageModule("administration");
35 }
static getLogger($a_component_id)
Get component logger.
global $ilCtrl
Definition: ilias.php:18

References $ilCtrl, $lng, $tpl, and ilLoggerFactory\getLogger().

+ Here is the call graph for this function:

Member Function Documentation

◆ confirmDeleteStartingPoint()

ilUserStartingPointGUI::confirmDeleteStartingPoint ( )

Confirm delete starting point.

Definition at line 332 of file class.ilUserStartingPointGUI.php.

333 {
334 global $ilCtrl, $lng, $tpl, $ilTabs;
335
336 $ilTabs->clearTargets();
337 $ilTabs->setBackTarget($lng->txt('back_to_starting_points_list'), $ilCtrl->getLinkTarget($this, 'startingPoints'));
338
339 include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
340 $conf = new ilConfirmationGUI();
341 $conf->setFormAction($ilCtrl->getFormAction($this));
342 $conf->setHeaderText($lng->txt('confirm_delete_starting_point'));
343
344 //if type role based
345 if ($_REQUEST['rolid'] && $_REQUEST['spid']) {
346 include_once "./Services/AccessControl/classes/class.ilObjRole.php";
347
348 $rolid = (int) $_REQUEST['rolid'];
349 $spid = (int) $_REQUEST['spid'];
350
351 $role = new ilObjRole($rolid);
352
353 $conf->addItem('rolid', $rolid, $role->getTitle());
354 $conf->addItem('spid', $spid, "");
355 }
356
357 $conf->setConfirm($lng->txt('delete'), 'deleteStartingPoint');
358 $conf->setCancel($lng->txt('cancel'), 'startingPoints');
359
360 $tpl->setContent($conf->getHTML());
361 }
Confirmation screen class.
Class ilObjRole.

References $ilCtrl, $lng, and $tpl.

◆ deleteStartingPoint()

ilUserStartingPointGUI::deleteStartingPoint ( )
protected

Set to 0 the starting point values.

Definition at line 366 of file class.ilUserStartingPointGUI.php.

367 {
368 global $ilCtrl, $rbacsystem, $ilErr;
369
370 if (!$rbacsystem->checkAccess("write", $this->parent_ref_id)) {
371 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
372 }
373
374 require_once "./Services/AccessControl/classes/class.ilObjRole.php";
375
376 if ($rolid = $_REQUEST['rolid'] && $spid = $_REQUEST['spid']) {
377 include_once("./Services/AccessControl/classes/class.ilStartingPoint.php");
378 $sp = new ilStartingPoint($spid);
379 $sp->delete();
380 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
381 } else {
382 ilUtil::sendFailure($this->lng->txt("msg_spoint_not_modified"), true);
383 }
384 $ilCtrl->redirect($this, "startingPoints");
385 }
Class ilStartingPoint.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilErr
Definition: raiseError.php:16

References $ilCtrl, $ilErr, $lng, ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ executeCommand()

& ilUserStartingPointGUI::executeCommand ( )

Definition at line 36 of file class.ilUserStartingPointGUI.php.

37 {
38 global $ilCtrl;
39
40 $cmd = $ilCtrl->getCmd();
41 if ($cmd == "roleStartingPointform" || !$cmd) {
42 $cmd = "initRoleStartingPointForm";
43 }
44
45 $this->$cmd();
46
47 return true;
48 }

References $ilCtrl.

◆ getRoleStartingPointForm()

ilUserStartingPointGUI::getRoleStartingPointForm ( )
protected
Returns
ilPropertyFormGUI

Definition at line 116 of file class.ilUserStartingPointGUI.php.

117 {
118 global $ilCtrl, $rbacsystem, $ilErr;
119
120 if (!$rbacsystem->checkAccess("write", $this->parent_ref_id)) {
121 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
122 }
123
124 require_once "Services/Form/classes/class.ilPropertyFormGUI.php";
125 require_once "./Services/AccessControl/classes/class.ilObjRole.php";
126 require_once "./Services/AccessControl/classes/class.ilStartingPoint.php";
127 include_once "Services/User/classes/class.ilUserUtil.php";
128
129 $form = new ilPropertyFormGUI();
130 $ilCtrl->saveParameter($this, array("spid"));
131
132 $spoint_id = $_REQUEST['spid'];
133
134 //edit no default
135 if ($spoint_id > 0 && $spoint_id != 'default') {
136 $st_point = new ilStartingPoint($spoint_id);
137
138 //starting point role based
139 if ($st_point->getRuleType() == ilStartingPoint::ROLE_BASED && $_REQUEST['rolid']) {
140 $rolid = (int) $_REQUEST['rolid'];
141 if ($role = new ilObjRole($rolid)) {
142 $options[$rolid] = $role->getTitle();
143 $starting_point = $st_point->getStartingPoint();
144 $si_roles = new ilSelectInputGUI($this->lng->txt("editing_this_role"), 'role_disabled');
145 $si_roles->setOptions($options);
146 $si_roles->setDisabled(true);
147 $form->addItem($si_roles);
148
149 $hi = new ilHiddenInputGUI("role");
150 $hi->setValue($rolid);
151 $form->addItem($hi);
152
153 $hidde_sp_id = new ilHiddenInputGUI("start_point_id");
154 $hidde_sp_id->setValue($spoint_id);
155 $form->addItem($hidde_sp_id);
156 }
157 }
158 }
159 //create
160 elseif (!$spoint_id || $spoint_id !='default') {
161 //starting point role based
164
165 foreach ($roles as $role) {
166 $options[$role['id']] = $role['title'];
167 }
168 $si_roles = new ilSelectInputGUI($this->lng->txt("roles_without_starting_point"), 'role');
169 $si_roles->setOptions($options);
170 $form->addItem($si_roles);
171 }
172 } else {
173 $starting_point = ilUserUtil::getStartingPoint();
174 }
175
176 // starting point
177
178 $si = new ilRadioGroupInputGUI($this->lng->txt("adm_user_starting_point"), "start_point");
179 $si->setRequired(true);
180 $si->setInfo($this->lng->txt("adm_user_starting_point_info"));
182 foreach (ilUserUtil::getPossibleStartingPoints(true) as $value => $caption) {
183 $opt = new ilRadioOption($caption, $value);
184 $si->addOption($opt);
185
186 if (!in_array($value, $valid)) {
187 $opt->setInfo($this->lng->txt("adm_user_starting_point_invalid_info"));
188 }
189 }
190 $si->setValue($starting_point);
191 $form->addItem($si);
192
193 // starting point: repository object
194 $repobj = new ilRadioOption($this->lng->txt("adm_user_starting_point_object"), ilUserUtil::START_REPOSITORY_OBJ);
195 $repobj_id = new ilTextInputGUI($this->lng->txt("adm_user_starting_point_ref_id"), "start_object");
196 $repobj_id->setRequired(true);
197 $repobj_id->setSize(5);
198 //$i has the starting_point value, so we are here only when edit one role or setting the default role.
199 if ($si->getValue() == ilUserUtil::START_REPOSITORY_OBJ) {
200 if ($st_point) {
201 $start_ref_id = $st_point->getStartingObject();
202 } else {
203 $start_ref_id = ilUserUtil::getStartingObject();
204 }
205
206 $repobj_id->setValue($start_ref_id);
207 if ($start_ref_id) {
208 $start_obj_id = ilObject::_lookupObjId($start_ref_id);
209 if ($start_obj_id) {
210 $repobj_id->setInfo($this->lng->txt("obj_" . ilObject::_lookupType($start_obj_id)) .
211 ": " . ilObject::_lookupTitle($start_obj_id));
212 }
213 }
214 }
215 $repobj->addSubItem($repobj_id);
216 $si->addOption($repobj);
217
218 // save and cancel commands
219 $form->addCommandButton("saveStartingPoint", $this->lng->txt("save"));
220 $form->addCommandButton("startingPoints", $this->lng->txt("cancel"));
221
222 $form->setTitle($this->lng->txt("starting_point_settings"));
223 $form->setFormAction($ilCtrl->getFormAction($this));
224
225 return $form;
226 }
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
This class represents a hidden form property in a property form.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
static getGlobalRolesWithoutStartingPoint()
Get id and title of the roles without starting points.
This class represents a text property in a property form.
static getPossibleStartingPoints($a_force_all=false)
Get all valid starting points.
static getStartingPoint()
Get current starting point setting.
static getStartingObject()
Get ref id of starting object.
const START_REPOSITORY_OBJ
$valid
if(isset($_POST['submit'])) $form

References $form, $ilCtrl, $ilErr, $lng, $options, $si, $valid, ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilStartingPoint\getGlobalRolesWithoutStartingPoint(), ilUserUtil\getPossibleStartingPoints(), ilUserUtil\getStartingObject(), ilUserUtil\getStartingPoint(), ilStartingPoint\ROLE_BASED, and ilUserUtil\START_REPOSITORY_OBJ.

Referenced by initRoleStartingPointForm(), and saveStartingPoint().

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

◆ getUserStartingPointForm()

ilUserStartingPointGUI::getUserStartingPointForm ( )
protected

Definition at line 91 of file class.ilUserStartingPointGUI.php.

92 {
93 global $ilCtrl;
94
95 require_once("Services/Form/classes/class.ilPropertyFormGUI.php");
96 require_once "Services/User/classes/class.ilUserUtil.php";
97
99
100 // starting point: personal
101 $startp = new ilCheckboxInputGUI($this->lng->txt("user_chooses_starting_page"), "usr_start_pers");
102 $startp->setInfo($this->lng->txt("adm_user_starting_point_personal_info"));
103 $startp->setChecked(ilUserUtil::hasPersonalStartingPoint());
104
105 $form->addItem($startp);
106
107 $form->addCommandButton("saveUserStartingPoint", $this->lng->txt("save"));
108 $form->setFormAction($ilCtrl->getFormAction($this));
109
110 return $form;
111 }
This class represents a checkbox property in a property form.
static hasPersonalStartingPoint()
Can starting point be personalized?

References $form, $ilCtrl, and ilUserUtil\hasPersonalStartingPoint().

Referenced by initUserStartingPointForm(), and saveUserStartingPoint().

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

◆ initRoleStartingPointForm()

ilUserStartingPointGUI::initRoleStartingPointForm ( ilPropertyFormGUI  $form = null)

Definition at line 83 of file class.ilUserStartingPointGUI.php.

84 {
85 if (!($form instanceof ilPropertyFormGUI)) {
87 }
88 $this->tpl->setContent($form->getHTML());
89 }

References $form, and getRoleStartingPointForm().

+ Here is the call graph for this function:

◆ initUserStartingPointForm()

ilUserStartingPointGUI::initUserStartingPointForm ( ilPropertyFormGUI  $form = null)

Definition at line 75 of file class.ilUserStartingPointGUI.php.

76 {
77 if (!($form instanceof ilPropertyFormGUI)) {
79 }
80 $this->tpl->setContent($form->getHTML());
81 }

References $form, and getUserStartingPointForm().

+ Here is the call graph for this function:

◆ saveOrder()

ilUserStartingPointGUI::saveOrder ( )

Definition at line 310 of file class.ilUserStartingPointGUI.php.

311 {
312 global $ilCtrl, $rbacsystem, $ilErr;
313
314 if (!$rbacsystem->checkAccess("write", $this->parent_ref_id)) {
315 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
316 }
317
318 if ($_POST['position']) {
319 require_once "./Services/AccessControl/classes/class.ilStartingPoint.php";
320
321 $sp = new ilStartingPoint();
322 $sp->saveOrder($_POST['position']);
323 }
324
325 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
326 $ilCtrl->redirect($this, "startingPoints");
327 }
$_POST["username"]

References $_POST, $ilCtrl, $ilErr, $lng, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ saveStartingPoint()

ilUserStartingPointGUI::saveStartingPoint ( )
protected

store starting point from the form

Definition at line 252 of file class.ilUserStartingPointGUI.php.

253 {
254 global $ilCtrl, $tree, $rbacsystem, $ilErr, $tpl;
255
256 if (!$rbacsystem->checkAccess("write", $this->parent_ref_id)) {
257 $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->FATAL);
258 }
259
260 if ((int) $_POST['start_point_id'] > 0) {
261 $start_point_id = (int) $_POST['start_point_id'];
262 }
263
264 //add from form
266 if ($form->checkInput()) {
267 //if role
268 if ($form->getInput('role')) {
269
270 //create starting point
271 if ($start_point_id) {
272 $starting_point = new ilStartingPoint($start_point_id);
273 } else { //edit
274 $starting_point = new ilStartingPoint();
275 }
276 $starting_point->setRuleType(ilStartingPoint::ROLE_BASED);
277 $starting_point->setStartingPoint($form->getInput("start_point"));
278 $rules = array("role_id" => $form->getInput('role'));
279 $starting_point->setRuleOptions(serialize($rules));
280
281 $obj_id = $form->getInput('start_object');
282 if ($obj_id && ($starting_point->getStartingPoint() == ilUserUtil::START_REPOSITORY_OBJ)) {
283 if (ilObject::_lookupObjId($obj_id) && !$tree->isDeleted($obj_id)) {
284 $starting_point->setStartingObject($obj_id);
285 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
286 } else {
287 ilUtil::sendFailure($this->lng->txt("obj_ref_id_not_exist"), true);
288 }
289 } else {
290 $starting_point->setStartingObject(0);
291 }
292
293 if ($start_point_id) {
294 $starting_point->update();
295 } else {
296 $starting_point->save();
297 }
298 } else { //default
299 ilUserUtil::setStartingPoint($form->getInput('start_point'), $form->getInput('start_object'));
300 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
301 }
302
303 $ilCtrl->redirect($this, "startingPoints");
304 }
305 $tpl->setContent($form->getHTML());
306
307 //$ilCtrl->redirect($this, "startingPoints");
308 }
static setStartingPoint($a_value, $a_ref_id=null)
Set starting point setting.

References $_POST, $form, $ilCtrl, $ilErr, $tpl, ilObject\_lookupObjId(), getRoleStartingPointForm(), ilStartingPoint\ROLE_BASED, ilUtil\sendFailure(), ilUtil\sendSuccess(), ilUserUtil\setStartingPoint(), and ilUserUtil\START_REPOSITORY_OBJ.

+ Here is the call graph for this function:

◆ saveUserStartingPoint()

ilUserStartingPointGUI::saveUserStartingPoint ( )
protected

Definition at line 228 of file class.ilUserStartingPointGUI.php.

229 {
230 global $ilCtrl, $rbacsystem, $ilErr;
231
232 if (!$rbacsystem->checkAccess("write", $this->parent_ref_id)) {
233 $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->FATAL);
234 }
235
236 include_once "Services/User/classes/class.ilUserUtil.php";
237
239
240 if ($form->checkInput()) {
241 ilUserUtil::togglePersonalStartingPoint($form->getInput('usr_start_pers'));
242 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
243 $ilCtrl->redirect($this, "startingPoints");
244 }
245 ilUtil::sendFailure($this->lng->txt("msg_error"), true);
246 $ilCtrl->redirect($this, "startingPoints");
247 }
static togglePersonalStartingPoint($a_value)
Toggle personal starting point setting.

References $form, $ilCtrl, $ilErr, getUserStartingPointForm(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilUserUtil\togglePersonalStartingPoint().

+ Here is the call graph for this function:

◆ startingPoints()

ilUserStartingPointGUI::startingPoints ( )

table form to set up starting points depends of user roles

Definition at line 53 of file class.ilUserStartingPointGUI.php.

54 {
55 include_once "Services/User/classes/class.ilUserRoleStartingPointTableGUI.php";
56
57 require_once "./Services/AccessControl/classes/class.ilStartingPoint.php";
59
60 if (!empty($roles_without_point)) {
61 $this->toolbar->addButton(
62 $this->lng->txt('create_starting_point'),
63 $this->ctrl->getLinkTarget($this, "roleStartingPointform")
64 );
65 } else {
66 ilUtil::sendInfo($this->lng->txt("all_roles_has_starting_point"));
67 }
68
69
71
72 $this->tpl->setContent($tbl->getHTML());
73 }
TableGUI class for LTI consumer listing.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$tbl
Definition: example_048.php:81

References $tbl, ilStartingPoint\getGlobalRolesWithoutStartingPoint(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilUserStartingPointGUI::$lng
protected

◆ $log

ilUserStartingPointGUI::$log
protected

Definition at line 15 of file class.ilUserStartingPointGUI.php.

◆ $parent_ref_id

ilUserStartingPointGUI::$parent_ref_id
protected

Definition at line 18 of file class.ilUserStartingPointGUI.php.

◆ $tpl

ilUserStartingPointGUI::$tpl
protected

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