ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilUserStartingPointGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilUserStartingPointGUI:

Public Member Functions

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

Protected Member Functions

 getUserStartingPointForm ()
 
 getRoleStartingPointForm ()
 
 saveUserStartingPoint ()
 
 saveStartingPoint ()
 store starting point from the form More...
 
 showRoleSelection (string $role, string $role_search, string $start_point, string $start_object)
 
 deleteStartingPoint ()
 Set to 0 the starting point values. More...
 

Protected Attributes

ilCtrl $ctrl
 
ilToolbarGUI $toolbar
 
ILIAS User StandardGUIRequest $user_request
 
ilLogger $log
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
int $parent_ref_id
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilUserStartingPointGUI

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

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

Constructor & Destructor Documentation

◆ __construct()

ilUserStartingPointGUI::__construct ( int  $a_parent_ref_id)

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

References $DIC, $lng, $tpl, ILIAS\Repository\ctrl(), ilLoggerFactory\getLogger(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

36  {
37  global $DIC;
38 
39  $lng = $DIC['lng'];
40  $tpl = $DIC['tpl'];
41  $ilToolbar = $DIC['ilToolbar'];
42  $ilCtrl = $DIC['ilCtrl'];
43 
44  $this->log = ilLoggerFactory::getLogger("user");
45  $this->lng = $lng;
46  $this->tpl = $tpl;
47  $this->toolbar = $ilToolbar;
48  $this->ctrl = $ilCtrl;
49  $this->parent_ref_id = $a_parent_ref_id;
50  $this->lng->loadLanguageModule("administration");
51  $this->lng->loadLanguageModule("dateplaner");
52  $this->user_request = new \ILIAS\User\StandardGUIRequest(
53  $DIC->http(),
54  $DIC->refinery()
55  );
56  }
static getLogger(string $a_component_id)
Get component logger.
ilGlobalTemplateInterface $tpl
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ addRoleAutoCompleteObject()

ilUserStartingPointGUI::addRoleAutoCompleteObject ( )

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

References ilRoleAutoCompleteInputGUI\echoAutoCompleteList().

299  : void
300  {
302  }
static echoAutoCompleteList()
Static asynchronous default auto complete function.
+ Here is the call graph for this function:

◆ confirmDeleteStartingPoint()

ilUserStartingPointGUI::confirmDeleteStartingPoint ( )

Confirm delete starting point.

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

References $DIC, ilGlobalTemplateInterface\setContent(), and ilLanguage\txt().

501  : void
502  {
503  global $DIC;
504 
505  $ilCtrl = $DIC['ilCtrl'];
506  $lng = $DIC['lng'];
507  $tpl = $DIC['tpl'];
508  $ilTabs = $DIC['ilTabs'];
509 
510  $ilTabs->clearTargets();
511  $ilTabs->setBackTarget($lng->txt('back_to_starting_points_list'), $ilCtrl->getLinkTarget($this, 'startingPoints'));
512 
513  $conf = new ilConfirmationGUI();
514  $conf->setFormAction($ilCtrl->getFormAction($this));
515  $conf->setHeaderText($lng->txt('confirm_delete_starting_point'));
516 
517  $req_role_id = $this->user_request->getRoleId();
518  $req_sp_id = $this->user_request->getStartingPointId();
519 
520  //if type role based
521  if ($req_role_id && $req_sp_id) {
522  $rolid = $req_role_id;
523  $spid = $req_sp_id;
524 
525  $role = new ilObjRole($rolid);
526 
527  $conf->addItem('rolid', $rolid, $role->getTitle());
528  $conf->addItem('spid', $spid, "");
529  }
530 
531  $conf->setConfirm($lng->txt('delete'), 'deleteStartingPoint');
532  $conf->setCancel($lng->txt('cancel'), 'startingPoints');
533 
534  $tpl->setContent($conf->getHTML());
535  }
Class ilObjRole.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ilGlobalTemplateInterface $tpl
global $DIC
Definition: feed.php:28
setContent(string $a_html)
Sets content for standard template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ deleteStartingPoint()

ilUserStartingPointGUI::deleteStartingPoint ( )
protected

Set to 0 the starting point values.

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

References $DIC, and ILIAS\Repository\lng().

540  : void
541  {
542  global $DIC;
543 
544  $ilCtrl = $DIC['ilCtrl'];
545  $rbacsystem = $DIC['rbacsystem'];
546  $spid = 0;
547 
548  if (!$rbacsystem->checkAccess("write", $this->parent_ref_id)) {
549  throw new ilPermissionException($this->lng->txt("msg_no_perm_read"));
550  }
551 
552  $spoint_id = $this->user_request->getStartingPointId();
553  $req_role_id = $this->user_request->getRoleId();
554 
555  if ($req_role_id && $spid = $spoint_id) {
556  $sp = new ilStartingPoint($spid);
557  $sp->delete();
558  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
559  } else {
560  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("msg_spoint_not_modified"), true);
561  }
562  $ilCtrl->redirect($this, "startingPoints");
563  }
Class ilStartingPoint.
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ executeCommand()

ilUserStartingPointGUI::executeCommand ( )

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

References $DIC.

58  : void
59  {
60  global $DIC;
61 
62  $ilCtrl = $DIC['ilCtrl'];
63 
64  $cmd = $ilCtrl->getCmd();
65  if ($cmd == "roleStartingPointform" || !$cmd) {
66  $cmd = "initRoleStartingPointForm";
67  }
68 
69  $this->$cmd();
70  }
global $DIC
Definition: feed.php:28

◆ getRoleStartingPointForm()

ilUserStartingPointGUI::getRoleStartingPointForm ( )
protected
Returns
ilPropertyFormGUI

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

References $DIC, $ilErr, $valid, ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilCalendarSettings\DEFAULT_CAL_DAY, ilCalendarSettings\DEFAULT_CAL_LIST, ilCalendarSettings\DEFAULT_CAL_MONTH, ilCalendarSettings\DEFAULT_CAL_WEEK, ilUserUtil\getCalendarPeriod(), ilUserUtil\getCalendarView(), ilStartingPoint\getGlobalRolesWithoutStartingPoint(), ilUserUtil\getPossibleStartingPoints(), ilUserUtil\getStartingObject(), ilUserUtil\getStartingPoint(), ILIAS\Repository\lng(), ilCalendarAgendaListGUI\PERIOD_DAY, ilCalendarAgendaListGUI\PERIOD_HALF_YEAR, ilCalendarAgendaListGUI\PERIOD_MONTH, ilCalendarAgendaListGUI\PERIOD_WEEK, ilStartingPoint\ROLE_BASED, ilRadioOption\setInfo(), ilFormPropertyGUI\setRequired(), ilRadioGroupInputGUI\setValue(), ilRadioOption\setValue(), ilNonEditableValueGUI\setValue(), ilUserUtil\START_PD_CALENDAR, and ilUserUtil\START_REPOSITORY_OBJ.

Referenced by initRoleStartingPointForm(), and saveStartingPoint().

135  {
136  global $DIC;
137 
138  $ilCtrl = $DIC['ilCtrl'];
139  $rbacsystem = $DIC['rbacsystem'];
140  $ilErr = $DIC['ilErr'];
141  $options = [];
142  $starting_point = 0;
143  $st_point = null;
144 
145  if (!$rbacsystem->checkAccess("write", $this->parent_ref_id)) {
146  $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->FATAL);
147  }
148  $form = new ilPropertyFormGUI();
149  $ilCtrl->saveParameter($this, array("spid"));
150 
151  $spoint_id = $this->user_request->getStartingPointId();
152  $req_role_id = $this->user_request->getRoleId();
153 
154  if ($spoint_id === 'default') {
155  $starting_point = ilUserUtil::getStartingPoint();
156  } elseif (is_numeric($spoint_id) && intval($spoint_id) > 0) {
157  $st_point = new ilStartingPoint((int) $spoint_id);
158 
159  //starting point role based
160  if ($st_point->getRuleType() === ilStartingPoint::ROLE_BASED
161  && is_numeric($req_role_id) && intval($req_role_id) > 0
162  && ($role = new ilObjRole((int) $req_role_id))) {
163  $options[$req_role_id] = $role->getTitle();
164  $starting_point = $st_point->getStartingPoint();
165 
166  // role title, non editable
167  $ne = new ilNonEditableValueGUI($this->lng->txt("editing_this_role"), 'role_disabled');
168  $ne->setValue($role->getTitle());
169  $form->addItem($ne);
170 
171  $hi = new ilHiddenInputGUI("role");
172  $hi->setValue($req_role_id);
173  $form->addItem($hi);
174 
175  $hidde_sp_id = new ilHiddenInputGUI("start_point_id");
176  $hidde_sp_id->setValue($spoint_id);
177  $form->addItem($hidde_sp_id);
178  }
179  } else {
180  //starting point role based
183 
184  // role type
185  $radg = new ilRadioGroupInputGUI($this->lng->txt("role"), "role_type");
186  $radg->setValue(0);
187  $op1 = new ilRadioOption($this->lng->txt("user_global_role"), 0);
188  $radg->addOption($op1);
189  $op2 = new ilRadioOption($this->lng->txt("user_local_role"), 1);
190  $radg->addOption($op2);
191  $form->addItem($radg);
192 
193  foreach ($roles as $role) {
194  $options[$role['id']] = $role['title'];
195  }
196  $si_roles = new ilSelectInputGUI($this->lng->txt("roles_without_starting_point"), 'role');
197  $si_roles->setOptions($options);
198  $op1->addSubItem($si_roles);
199 
200  // local role
201  $role_search = new ilRoleAutoCompleteInputGUI('', 'role_search', $this, 'addRoleAutoCompleteObject');
202  $role_search->setSize(40);
203  $op2->addSubItem($role_search);
204  }
205  }
206 
207  // starting point
208 
209  $si = new ilRadioGroupInputGUI($this->lng->txt("adm_user_starting_point"), "start_point");
210  $si->setRequired(true);
211  $si->setInfo($this->lng->txt("adm_user_starting_point_info"));
213  foreach (ilUserUtil::getPossibleStartingPoints(true) as $value => $caption) {
214  if ($value === ilUserUtil::START_REPOSITORY_OBJ) {
215  continue;
216  }
217  $opt = new ilRadioOption($caption, $value);
218 
219  if ($value === ilUserUtil::START_PD_CALENDAR) {
220  $default_cal_view = new ilRadioGroupInputGUI($this->lng->txt('cal_def_view'), 'user_calendar_view');
221  $default_cal_view->setRequired(true);
222 
223  $option = new ilRadioOption($this->lng->txt("day"), ilCalendarSettings::DEFAULT_CAL_DAY);
224  $default_cal_view->addOption($option);
225  $option = new ilRadioOption($this->lng->txt("week"), ilCalendarSettings::DEFAULT_CAL_WEEK);
226  $default_cal_view->addOption($option);
227  $option = new ilRadioOption($this->lng->txt("month"), ilCalendarSettings::DEFAULT_CAL_MONTH);
228  $default_cal_view->addOption($option);
229 
230  $option = new ilRadioOption($this->lng->txt("cal_list"), ilCalendarSettings::DEFAULT_CAL_LIST);
231 
232  $cal_periods = new ilSelectInputGUI($this->lng->txt("cal_list"), "user_cal_period");
233  $cal_periods->setOptions([
234  ilCalendarAgendaListGUI::PERIOD_DAY => "1 " . $this->lng->txt("day"),
235  ilCalendarAgendaListGUI::PERIOD_WEEK => "1 " . $this->lng->txt("week"),
236  ilCalendarAgendaListGUI::PERIOD_MONTH => "1 " . $this->lng->txt("month"),
237  ilCalendarAgendaListGUI::PERIOD_HALF_YEAR => "6 " . $this->lng->txt("months")
238  ]);
239  $cal_periods->setRequired(true);
240 
241 
242  if (isset($st_point)) {
243  $default_cal_view->setValue($st_point->getCalendarView());
244  $cal_periods->setValue($st_point->getCalendarPeriod());
245  } else {
246  $default_cal_view->setValue(ilUserUtil::getCalendarView());
247  $cal_periods->setValue(ilUserUtil::getCalendarPeriod());
248  }
249  $option->addSubItem($cal_periods);
250  $default_cal_view->addOption($option);
251 
252  $opt->addSubItem($default_cal_view);
253  }
254 
255  $si->addOption($opt);
256 
257  if (!in_array($value, $valid)) {
258  $opt->setInfo($this->lng->txt("adm_user_starting_point_invalid_info"));
259  }
260  }
261  $si->setValue($starting_point);
262  $form->addItem($si);
263 
264  // starting point: repository object
265  $repobj = new ilRadioOption($this->lng->txt("adm_user_starting_point_object"), ilUserUtil::START_REPOSITORY_OBJ);
266  $repobj_id = new ilTextInputGUI($this->lng->txt("adm_user_starting_point_ref_id"), "start_object");
267  $repobj_id->setRequired(true);
268  $repobj_id->setSize(5);
269  //$i has the starting_point value, so we are here only when edit one role or setting the default role.
270  if ($si->getValue() == ilUserUtil::START_REPOSITORY_OBJ) {
271  if ($st_point) {
272  $start_ref_id = $st_point->getStartingObject();
273  } else {
274  $start_ref_id = ilUserUtil::getStartingObject();
275  }
276 
277  $repobj_id->setValue($start_ref_id);
278  if ($start_ref_id) {
279  $start_obj_id = ilObject::_lookupObjId($start_ref_id);
280  if ($start_obj_id) {
281  $repobj_id->setInfo($this->lng->txt("obj_" . ilObject::_lookupType($start_obj_id)) .
282  ": " . ilObject::_lookupTitle($start_obj_id));
283  }
284  }
285  }
286  $repobj->addSubItem($repobj_id);
287  $si->addOption($repobj);
288 
289  // save and cancel commands
290  $form->addCommandButton("saveStartingPoint", $this->lng->txt("save"));
291  $form->addCommandButton("startingPoints", $this->lng->txt("cancel"));
292 
293  $form->setTitle($this->lng->txt("starting_point_settings"));
294  $form->setFormAction($ilCtrl->getFormAction($this));
295 
296  return $form;
297  }
Class ilObjRole.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilStartingPoint.
setInfo(string $a_info)
$valid
static getGlobalRolesWithoutStartingPoint()
Get id and title of the roles without starting points.
static getStartingPoint()
Get current starting point setting.
$ilErr
Definition: raiseError.php:17
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getPossibleStartingPoints(bool $a_force_all=false)
Get all valid starting points.
This class represents a property in a property form.
static _lookupTitle(int $obj_id)
setValue(string $a_value)
static getStartingObject()
Get ref id of starting object.
setRequired(bool $a_required)
const START_PD_CALENDAR
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getCalendarPeriod()
Get time frame of calendar view.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getCalendarView()
Get specific view of calendar starting point.
const START_REPOSITORY_OBJ
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUserStartingPointForm()

ilUserStartingPointGUI::getUserStartingPointForm ( )
protected

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

References $DIC, ilUserUtil\hasPersonalStartingPoint(), ILIAS\Repository\lng(), and ilFormPropertyGUI\setInfo().

Referenced by initUserStartingPointForm(), and saveUserStartingPoint().

111  {
112  global $DIC;
113 
114  $ilCtrl = $DIC['ilCtrl'];
115 
116  $form = new ilPropertyFormGUI();
117 
118  // starting point: personal
119  $startp = new ilCheckboxInputGUI($this->lng->txt("user_chooses_starting_page"), "usr_start_pers");
120  $startp->setInfo($this->lng->txt("adm_user_starting_point_personal_info"));
121  $startp->setChecked(ilUserUtil::hasPersonalStartingPoint());
122 
123  $form->addItem($startp);
124 
125  $form->addCommandButton("saveUserStartingPoint", $this->lng->txt("save"));
126  $form->setFormAction($ilCtrl->getFormAction($this));
127 
128  return $form;
129  }
This class represents a checkbox property in a property form.
static hasPersonalStartingPoint()
Can starting point be personalized?
global $DIC
Definition: feed.php:28
+ 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 102 of file class.ilUserStartingPointGUI.php.

References getRoleStartingPointForm().

102  : void
103  {
104  if (!($form instanceof ilPropertyFormGUI)) {
105  $form = $this->getRoleStartingPointForm();
106  }
107  $this->tpl->setContent($form->getHTML());
108  }
+ Here is the call graph for this function:

◆ initUserStartingPointForm()

ilUserStartingPointGUI::initUserStartingPointForm ( ilPropertyFormGUI  $form = null)

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

References getUserStartingPointForm().

94  : void
95  {
96  if (!($form instanceof ilPropertyFormGUI)) {
97  $form = $this->getUserStartingPointForm();
98  }
99  $this->tpl->setContent($form->getHTML());
100  }
+ Here is the call graph for this function:

◆ saveOrder()

ilUserStartingPointGUI::saveOrder ( )

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

References $DIC, and ILIAS\Repository\lng().

477  : void
478  {
479  global $DIC;
480 
481  $ilCtrl = $DIC['ilCtrl'];
482  $rbacsystem = $DIC['rbacsystem'];
483 
484  if (!$rbacsystem->checkAccess("write", $this->parent_ref_id)) {
485  throw new ilPermissionException($this->lng->txt("msg_no_perm_read"));
486  }
487 
488  $positions = $this->user_request->getPositions();
489  if (count($positions) > 0) {
490  $sp = new ilStartingPoint();
491  $sp->saveOrder($positions);
492  }
493 
494  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
495  $ilCtrl->redirect($this, "startingPoints");
496  }
Class ilStartingPoint.
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ saveStartingPoint()

ilUserStartingPointGUI::saveStartingPoint ( )
protected

store starting point from the form

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

References $DIC, $ilErr, $res, ilObject\_lookupObjId(), getRoleStartingPointForm(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ilQueryParser\QP_COMBINATION_AND, ilStartingPoint\ROLE_BASED, ilGlobalTemplateInterface\setContent(), ilQueryParser\setMinWordLength(), ilUserUtil\setStartingPoint(), showRoleSelection(), ilUserUtil\START_PD_CALENDAR, and ilUserUtil\START_REPOSITORY_OBJ.

330  : void
331  {
332  global $DIC;
333 
334  $ilCtrl = $DIC['ilCtrl'];
335  $tree = $DIC['tree'];
336  $rbacsystem = $DIC['rbacsystem'];
337  $ilErr = $DIC['ilErr'];
338  $tpl = $DIC['tpl'];
339  $start_point_id = 0;
340 
341  if (!$rbacsystem->checkAccess("write", $this->parent_ref_id)) {
342  $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->FATAL);
343  }
344 
345  if ($this->user_request->getStartingPointId() > 0) {
346  $start_point_id = $this->user_request->getStartingPointId();
347  }
348 
349  //add from form
350  $form = $this->getRoleStartingPointForm();
351  if ($form->checkInput()) {
352  //if role
353  if ($form->getInput('role')) {
354 
355  // check if we have a locale role
356  if ($form->getInput('role_type') == 1) {
357  if ($this->user_request->getRoleId() > 0) {
358  $role_id = $this->user_request->getRoleId(); // id from role selection
359  } else {
360  $parser = new ilQueryParser($form->getInput('role_search'));
361 
362  // TODO: Handle minWordLength
363  $parser->setMinWordLength(1);
364  $parser->setCombination(ilQueryParser::QP_COMBINATION_AND);
365  $parser->parse();
366 
367  $object_search = new ilLikeObjectSearch($parser);
368  $object_search->setFilter(array('role'));
369  $res = $object_search->performSearch();
370 
371  $entries = $res->getEntries();
372  if (count($entries) == 1) { // role name only finds one match -> use it
373  $role = current($entries);
374  $role_id = $role['obj_id'];
375  } elseif (count($entries) > 1) { // multiple matches -> show selection
376  $this->showRoleSelection(
377  $form->getInput('role'),
378  $form->getInput('role_search'),
379  $form->getInput('start_point'),
380  $form->getInput('start_object')
381  );
382  return;
383  }
384  }
385  } else {
386  $role_id = $form->getInput('role');
387  }
388 
389  //create starting point
390  if ($start_point_id) {
391  $starting_point = new ilStartingPoint($start_point_id);
392  } else { //edit
393  $starting_point = new ilStartingPoint();
394  }
395  $starting_point->setRuleType(ilStartingPoint::ROLE_BASED);
396  $starting_point->setStartingPoint((int) $form->getInput("start_point"));
397  $rules = array("role_id" => $role_id);
398  $starting_point->setRuleOptions(serialize($rules));
399 
400  $obj_id = $form->getInput('start_object');
401  $cal_view = $form->getInput("user_calendar_view");
402  $cal_period = $form->getInput("user_cal_period");
403  if ($obj_id && ($starting_point->getStartingPoint() == ilUserUtil::START_REPOSITORY_OBJ)) {
404  if (ilObject::_lookupObjId($obj_id) && !$tree->isDeleted($obj_id)) {
405  $starting_point->setStartingObject($obj_id);
406  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
407  } else {
408  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("obj_ref_id_not_exist"), true);
409  }
410  } else {
411  $starting_point->setStartingObject(0);
412  }
413 
414  if (!empty($cal_view) && !empty($cal_period) && ($starting_point->getStartingPoint() == ilUserUtil::START_PD_CALENDAR)) {
415  $starting_point->setCalendarView($cal_view);
416  $starting_point->setCalendarPeriod($cal_period);
417  } else {
418  $starting_point->setCalendarView(0);
419  $starting_point->setCalendarPeriod(0);
420  }
421 
422  if ($start_point_id) {
423  $starting_point->update();
424  } else {
425  $starting_point->save();
426  }
427  } elseif (!empty($form->getInput("user_calendar_view")) && !empty($form->getInput("user_cal_period"))) {
428  $calendar_info = [
429  "user_calendar_view" => $form->getInput("user_calendar_view"),
430  "user_cal_period" => $form->getInput("user_cal_period")
431  ];
432  ilUserUtil::setStartingPoint($form->getInput('start_point'), (int) $form->getInput('start_object'), $calendar_info);
433  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
434  } else { //default
435  ilUserUtil::setStartingPoint($form->getInput('start_point'), (int) $form->getInput('start_object'));
436  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
437  }
438 
439  $ilCtrl->redirect($this, "startingPoints");
440  }
441  $form->setValuesByPost();
442  $tpl->setContent($form->getHTML());
443  }
$res
Definition: ltiservices.php:69
Class ilStartingPoint.
ilGlobalTemplateInterface $tpl
showRoleSelection(string $role, string $role_search, string $start_point, string $start_object)
$ilErr
Definition: raiseError.php:17
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
setMinWordLength(int $a_length)
setContent(string $a_html)
Sets content for standard template.
const START_PD_CALENDAR
static setStartingPoint(int $a_value, int $a_ref_id=null, array $a_cal_view=[])
Set starting point setting.
const START_REPOSITORY_OBJ
+ Here is the call graph for this function:

◆ saveUserStartingPoint()

ilUserStartingPointGUI::saveUserStartingPoint ( )
protected

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

References $DIC, $ilErr, getUserStartingPointForm(), ILIAS\Repository\lng(), and ilUserUtil\togglePersonalStartingPoint().

304  : void
305  {
306  global $DIC;
307 
308  $ilCtrl = $DIC['ilCtrl'];
309  $rbacsystem = $DIC['rbacsystem'];
310  $ilErr = $DIC['ilErr'];
311 
312  if (!$rbacsystem->checkAccess("write", $this->parent_ref_id)) {
313  $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->FATAL);
314  }
315 
316  $form = $this->getUserStartingPointForm();
317 
318  if ($form->checkInput()) {
319  ilUserUtil::togglePersonalStartingPoint($form->getInput('usr_start_pers'));
320  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
321  $ilCtrl->redirect($this, "startingPoints");
322  }
323  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("msg_error"), true);
324  $ilCtrl->redirect($this, "startingPoints");
325  }
$ilErr
Definition: raiseError.php:17
global $DIC
Definition: feed.php:28
static togglePersonalStartingPoint(bool $a_value)
Toggle personal starting point setting.
+ Here is the call graph for this function:

◆ showRoleSelection()

ilUserStartingPointGUI::showRoleSelection ( string  $role,
string  $role_search,
string  $start_point,
string  $start_object 
)
protected

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

References $res, ILIAS\Repository\lng(), and ilQueryParser\QP_COMBINATION_AND.

Referenced by saveStartingPoint().

450  : void {
451  $parser = new ilQueryParser($role_search);
452  $parser->setMinWordLength(1);
453  $parser->setCombination(ilQueryParser::QP_COMBINATION_AND);
454  $parser->parse();
455 
456  $object_search = new ilLikeObjectSearch($parser);
457  $object_search->setFilter(array('role'));
458  $res = $object_search->performSearch();
459 
460  $entries = $res->getEntries();
461 
462  $table = new ilRoleSelectionTableGUI($this, 'saveStartingPoint');
463  $table->setLimit(9999);
464  $table->disable("sort");
465  $table->addHiddenInput("role_search", $role_search);
466  $table->addHiddenInput("start_point", $start_point);
467  $table->addHiddenInput("start_object", $start_object);
468  $table->addHiddenInput("role", $role);
469  $table->addHiddenInput("role_type", 1);
470  $table->setTitle($this->lng->txt('user_role_selection'));
471  $table->addMultiCommand('saveStartingPoint', $this->lng->txt('select'));
472  $table->parse($entries);
473 
474  $this->tpl->setContent($table->getHTML());
475  }
$res
Definition: ltiservices.php:69
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ startingPoints()

ilUserStartingPointGUI::startingPoints ( )

table form to set up starting points depends of user roles

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

References ILIAS\Repository\ctrl(), ilStartingPoint\getGlobalRolesWithoutStartingPoint(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

75  : void
76  {
78 
79  if (!empty($roles_without_point)) {
80  $this->toolbar->addButton(
81  $this->lng->txt('create_starting_point'),
82  $this->ctrl->getLinkTarget($this, "roleStartingPointform")
83  );
84  } else {
85  $this->tpl->setOnScreenMessage('info', $this->lng->txt("all_roles_has_starting_point"));
86  }
87 
88 
89  $tbl = new ilUserRoleStartingPointTableGUI($this);
90 
91  $this->tpl->setContent($tbl->getHTML());
92  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getGlobalRolesWithoutStartingPoint()
Get id and title of the roles without starting points.
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilUserStartingPointGUI::$ctrl
protected

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

◆ $lng

ilLanguage ilUserStartingPointGUI::$lng
protected

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

Referenced by __construct().

◆ $log

ilLogger ilUserStartingPointGUI::$log
protected

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

◆ $parent_ref_id

int ilUserStartingPointGUI::$parent_ref_id
protected

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

◆ $toolbar

ilToolbarGUI ilUserStartingPointGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilUserStartingPointGUI::$tpl
protected

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

Referenced by __construct().

◆ $user_request

ILIAS User StandardGUIRequest ilUserStartingPointGUI::$user_request
protected

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


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