ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilUserStartingPointGUI Class Reference

Class ilUserStartingPointGUI. More...

+ Collaboration diagram for ilUserStartingPointGUI:

Public Member Functions

 executeCommand ()
 
 startingPoints ()
 table form to set up starting points depends of user roles More...
 
 initUserStartingPointForm (?ilPropertyFormGUI $form=null)
 
 initRoleStartingPointForm (?ilPropertyFormGUI $form=null)
 
 addRoleAutoCompleteObject ()
 
 saveOrder ()
 

Protected Member Functions

 getUserStartingPointForm ()
 
 getRoleStartingPointForm ()
 
 saveUserStartingPoint ()
 
 saveStartingPoint ()
 store starting point from the form More...
 
 deleteStartingPoint ()
 

Private Member Functions

 getCurrentStartingPointOrNullForStartingPointForm (?int $starting_point_id)
 
 getCurrentTypeForStartingPointForm (?ilUserStartingPoint $starting_point)
 
 getFormTypeSpecificStartingPointFormParts (?int $spoint_id, ?int $req_role_id)
 
 getCreateFormSpecificInputs ()
 
 getEditFormSpecificInputs (int $spoint_id, int $req_role_id)
 
 getStartingPointSelectionInput (?ilUserStartingPoint $st_point)
 
 getStartingPointSelectionOption (int $value, string $caption, ?ilUserStartingPoint $st_point, array $valid)
 
 getCalenderSubInputs (?ilUserStartingPoint $st_point)
 
 getRepositoryObjectInput (?ilUserStartingPoint $st_point)
 
 showRoleSelection (string $role, string $role_search, string $start_point, string $start_object)
 

Private Attributes

ilLogger $log
 
Language $lng
 
ilSetting $settings
 
ilGlobalTemplateInterface $tpl
 
ilToolbarGUI $toolbar
 
ilTabsGUI $tabs
 
ilCtrl $ctrl
 
ilTree $tree
 
ilObjUser $user
 
ilDBInterface $db
 
ilRbacReview $rbac_review
 
ilRbacSystem $rbac_system
 
UIFactory $ui_factory
 
Renderer $ui_renderer
 
UserGUIRequest $user_request
 
ilUserStartingPointRepository $starting_point_repository
 
int $parent_ref_id
 

Detailed Description

Member Function Documentation

◆ addRoleAutoCompleteObject()

ilUserStartingPointGUI::addRoleAutoCompleteObject ( )

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

References ilRoleAutoCompleteInputGUI\echoAutoCompleteList().

378  : void
379  {
381  }
static echoAutoCompleteList()
Static asynchronous default auto complete function.
+ Here is the call graph for this function:

◆ deleteStartingPoint()

ilUserStartingPointGUI::deleteStartingPoint ( )
protected

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

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

553  : void
554  {
555  if (!$this->rbac_system->checkAccess('write', $this->parent_ref_id)) {
556  throw new ilPermissionException($this->lng->txt('msg_no_perm_read'));
557  }
558 
559  $spoint_id = $this->user_request->getStartingPointId();
560  $req_role_id = $this->user_request->getRoleId();
561 
562  if ($req_role_id && is_numeric($spoint_id)) {
563  $sp = $this->starting_point_repository->getStartingPointById(
564  $spoint_id
565  );
566  $this->starting_point_repository->delete($sp->getId());
567  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
568  } else {
569  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_spoint_not_modified'), true);
570  }
571  $this->ctrl->redirect($this, 'startingPoints');
572  }
+ Here is the call graph for this function:

◆ executeCommand()

ilUserStartingPointGUI::executeCommand ( )

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

References ILIAS\Repository\ctrl().

95  : void
96  {
97  $cmd = $this->ctrl->getCmd();
98  if ($cmd == 'roleStartingPointform' || !$cmd) {
99  $cmd = 'initRoleStartingPointForm';
100  }
101 
102  $this->$cmd();
103  }
+ Here is the call graph for this function:

◆ getCalenderSubInputs()

ilUserStartingPointGUI::getCalenderSubInputs ( ?ilUserStartingPoint  $st_point)
private

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

References ilCalendarSettings\DEFAULT_CAL_DAY, ilCalendarSettings\DEFAULT_CAL_LIST, ilCalendarSettings\DEFAULT_CAL_MONTH, ilCalendarSettings\DEFAULT_CAL_WEEK, ilUserStartingPoint\getCalendarPeriod(), ilUserStartingPoint\getCalendarView(), ILIAS\Repository\lng(), null, ilCalendarAgendaListGUI\PERIOD_DAY, ilCalendarAgendaListGUI\PERIOD_HALF_YEAR, ilCalendarAgendaListGUI\PERIOD_MONTH, ilCalendarAgendaListGUI\PERIOD_WEEK, ilSelectInputGUI\setOptions(), and ilFormPropertyGUI\setRequired().

Referenced by getStartingPointSelectionOption().

323  {
324  $default_cal_view = new ilRadioGroupInputGUI($this->lng->txt('cal_def_view'), 'user_calendar_view');
325  $default_cal_view->setRequired(true);
326 
327  $day = new ilRadioOption($this->lng->txt('day'), (string) ilCalendarSettings::DEFAULT_CAL_DAY);
328  $default_cal_view->addOption($day);
329  $week = new ilRadioOption($this->lng->txt('week'), (string) ilCalendarSettings::DEFAULT_CAL_WEEK);
330  $default_cal_view->addOption($week);
331  $month = new ilRadioOption($this->lng->txt('month'), (string) ilCalendarSettings::DEFAULT_CAL_MONTH);
332  $default_cal_view->addOption($month);
333 
334  $list = new ilRadioOption($this->lng->txt('cal_list'), (string) ilCalendarSettings::DEFAULT_CAL_LIST);
335 
336  $cal_periods = new ilSelectInputGUI($this->lng->txt('cal_list'), 'user_cal_period');
337  $cal_periods->setOptions([
338  ilCalendarAgendaListGUI::PERIOD_DAY => '1 ' . $this->lng->txt('day'),
339  ilCalendarAgendaListGUI::PERIOD_WEEK => '1 ' . $this->lng->txt('week'),
340  ilCalendarAgendaListGUI::PERIOD_MONTH => '1 ' . $this->lng->txt('month'),
341  ilCalendarAgendaListGUI::PERIOD_HALF_YEAR => '6 ' . $this->lng->txt('months')
342  ]);
343  $cal_periods->setRequired(true);
344 
345  if ($st_point !== null) {
346  $default_cal_view->setValue((string) $st_point->getCalendarView());
347  $cal_periods->setValue((string) $st_point->getCalendarPeriod());
348  }
349 
350  $list->addSubItem($cal_periods);
351  $default_cal_view->addOption($list);
352 
353  return $default_cal_view;
354  }
This class represents an option in a radio group.
This class represents a selection list property in a property form.
setOptions(array $a_options)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This class represents a property in a property form.
setRequired(bool $a_required)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCreateFormSpecificInputs()

ilUserStartingPointGUI::getCreateFormSpecificInputs ( )
private

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

References ILIAS\Repository\lng(), ilSelectInputGUI\setOptions(), and ilRadioGroupInputGUI\setValue().

Referenced by getFormTypeSpecificStartingPointFormParts().

230  {
231  $roles = $this->starting_point_repository->getGlobalRolesWithoutStartingPoint();
232 
233 
234  // role type
235  $radg = new ilRadioGroupInputGUI($this->lng->txt('role'), 'role_type');
236  $radg->setValue('1');
237  if ($roles !== []) {
238  $radg->setValue('0');
239  $op1 = new ilRadioOption($this->lng->txt('user_global_role'), '0');
240  $radg->addOption($op1);
241 
242  $role_options = [];
243  foreach ($roles as $role) {
244  $role_options[$role['id']] = $role['title'];
245  }
246  $si_roles = new ilSelectInputGUI($this->lng->txt('roles_without_starting_point'), 'role');
247  $si_roles->setOptions($role_options);
248  $op1->addSubItem($si_roles);
249  }
250 
251  $op2 = new ilRadioOption($this->lng->txt('user_local_role'), '1');
252  $radg->addOption($op2);
253  $role_search = new ilRoleAutoCompleteInputGUI('', 'role_search', $this, 'addRoleAutoCompleteObject');
254  $role_search->setSize(40);
255  $op2->addSubItem($role_search);
256  return $radg;
257  }
This class represents an option in a radio group.
This class represents a selection list property in a property form.
setOptions(array $a_options)
This class represents a property in a property form.
This class represents a role + autocomplete feature form input.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCurrentStartingPointOrNullForStartingPointForm()

ilUserStartingPointGUI::getCurrentStartingPointOrNullForStartingPointForm ( ?int  $starting_point_id)
private

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

References null.

Referenced by getRoleStartingPointForm().

201  {
202  if ($starting_point_id === null) {
203  return null;
204  }
205 
206  return $this->starting_point_repository->getStartingPointById(
207  $starting_point_id
208  );
209  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ getCurrentTypeForStartingPointForm()

ilUserStartingPointGUI::getCurrentTypeForStartingPointForm ( ?ilUserStartingPoint  $starting_point)
private

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

References ilUserStartingPoint\getStartingPointType(), and null.

Referenced by getRoleStartingPointForm().

211  : ?int
212  {
213  if ($starting_point === null) {
214  return null;
215  }
216 
217  return $starting_point->getStartingPointType();
218  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEditFormSpecificInputs()

ilUserStartingPointGUI::getEditFormSpecificInputs ( int  $spoint_id,
int  $req_role_id 
)
private

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

References ILIAS\UI\Implementation\Component\Input\$inputs, and ILIAS\Repository\lng().

Referenced by getFormTypeSpecificStartingPointFormParts().

259  : array
260  {
261  $title = $this->lng->txt('default');
262  if ($spoint_id !== $this->starting_point_repository->getDefaultStartingPointID()) {
263  $role = new ilObjRole($req_role_id);
264  $title = $role->getTitle();
265  }
266 
267  $inputs = [];
268  $inputs[0] = new ilNonEditableValueGUI($this->lng->txt('editing_this_role'), 'role_disabled');
269  $inputs[0]->setValue($title);
270 
271  $inputs[1] = new ilHiddenInputGUI('role');
272  $inputs[1]->setValue((string) $req_role_id);
273 
274  $inputs[2] = new ilHiddenInputGUI('start_point_id');
275  $inputs[2]->setValue((string) $spoint_id);
276 
277  return $inputs;
278  }
Class ilObjRole.
This class represents a hidden form property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFormTypeSpecificStartingPointFormParts()

ilUserStartingPointGUI::getFormTypeSpecificStartingPointFormParts ( ?int  $spoint_id,
?int  $req_role_id 
)
private

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

References ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from(), getCreateFormSpecificInputs(), getEditFormSpecificInputs(), and null.

Referenced by getRoleStartingPointForm().

220  : Generator
221  { //edit no default
222  if ($spoint_id === null) {
223  yield $this->getCreateFormSpecificInputs();
224  } else {
225  yield from $this->getEditFormSpecificInputs($spoint_id, $req_role_id);
226  }
227  }
getEditFormSpecificInputs(int $spoint_id, int $req_role_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRepositoryObjectInput()

ilUserStartingPointGUI::getRepositoryObjectInput ( ?ilUserStartingPoint  $st_point)
private

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

References ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilUserStartingPoint\getStartingObject(), ILIAS\Repository\lng(), and null.

Referenced by getStartingPointSelectionOption().

357  {
358  $repobj_id = new ilTextInputGUI($this->lng->txt('adm_user_starting_point_ref_id'), 'start_object');
359  $repobj_id->setRequired(true);
360  $repobj_id->setSize(5);
361 
362  if ($st_point !== null) {
363  $start_ref_id = $st_point->getStartingObject();
364  $repobj_id->setValue($start_ref_id);
365  }
366 
367  if (isset($start_ref_id)) {
368  $start_obj_id = ilObject::_lookupObjId($start_ref_id);
369  if ($start_obj_id) {
370  $repobj_id->setInfo($this->lng->txt('obj_' . ilObject::_lookupType($start_obj_id)) .
371  ': ' . ilObject::_lookupTitle($start_obj_id));
372  }
373  }
374 
375  return $repobj_id;
376  }
static _lookupObjId(int $ref_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _lookupTitle(int $obj_id)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRoleStartingPointForm()

ilUserStartingPointGUI::getRoleStartingPointForm ( )
protected
Returns
ilPropertyFormGUI

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

References ILIAS\Repository\ctrl(), getCurrentStartingPointOrNullForStartingPointForm(), getCurrentTypeForStartingPointForm(), getFormTypeSpecificStartingPointFormParts(), getStartingPointSelectionInput(), and ILIAS\Repository\lng().

Referenced by initRoleStartingPointForm(), and saveStartingPoint().

165  {
166  if (!$this->rbac_system->checkAccess('write', $this->parent_ref_id)) {
167  $this->error->raiseError(
168  $this->lng->txt('msg_no_perm_read'),
169  $this->error->FATAL
170  );
171  }
172  $form = new ilPropertyFormGUI();
173  $this->ctrl->saveParameter($this, ['spid']);
174 
175  $starting_point_id = $this->user_request->getStartingPointId();
176  $starting_point = $this->getCurrentStartingPointOrNullForStartingPointForm($starting_point_id);
177  $starting_point_type = $this->getCurrentTypeForStartingPointForm($starting_point);
178  $req_role_id = $this->user_request->getRoleId();
179 
180  foreach ($this->getFormTypeSpecificStartingPointFormParts($starting_point_id, $req_role_id) as $input) {
181  $form->addItem(
182  $input
183  );
184  }
185 
186  $si = $this->getStartingPointSelectionInput($starting_point);
187  $si->setValue((string) $starting_point_type);
188  $form->addItem($si);
189 
190  // save and cancel commands
191  $form->addCommandButton('saveStartingPoint', $this->lng->txt('save'));
192  $form->addCommandButton('startingPoints', $this->lng->txt('cancel'));
193 
194  $form->setTitle($this->lng->txt('starting_point_settings'));
195  $form->setFormAction($this->ctrl->getFormAction($this));
196 
197  return $form;
198  }
getCurrentStartingPointOrNullForStartingPointForm(?int $starting_point_id)
getStartingPointSelectionInput(?ilUserStartingPoint $st_point)
getCurrentTypeForStartingPointForm(?ilUserStartingPoint $starting_point)
getFormTypeSpecificStartingPointFormParts(?int $spoint_id, ?int $req_role_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStartingPointSelectionInput()

ilUserStartingPointGUI::getStartingPointSelectionInput ( ?ilUserStartingPoint  $st_point)
private

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

References $valid, getStartingPointSelectionOption(), ILIAS\Repository\lng(), and ilFormPropertyGUI\setRequired().

Referenced by getRoleStartingPointForm().

281  {
282  $si = new ilRadioGroupInputGUI($this->lng->txt('adm_user_starting_point'), 'start_point');
283  $si->setRequired(true);
284  $si->setInfo($this->lng->txt('adm_user_starting_point_info'));
285  $valid = array_keys($this->starting_point_repository->getPossibleStartingPoints());
286  foreach ($this->starting_point_repository->getPossibleStartingPoints(true) as $value => $caption) {
287  $si->addOption(
288  $this->getStartingPointSelectionOption($value, $caption, $st_point, $valid)
289  );
290  }
291 
292  return $si;
293  }
$valid
This class represents a property in a property form.
setRequired(bool $a_required)
getStartingPointSelectionOption(int $value, string $caption, ?ilUserStartingPoint $st_point, array $valid)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStartingPointSelectionOption()

ilUserStartingPointGUI::getStartingPointSelectionOption ( int  $value,
string  $caption,
?ilUserStartingPoint  $st_point,
array  $valid 
)
private

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

References getCalenderSubInputs(), getRepositoryObjectInput(), ILIAS\Repository\lng(), ilUserStartingPointRepository\START_PD_CALENDAR, and ilUserStartingPointRepository\START_REPOSITORY_OBJ.

Referenced by getStartingPointSelectionInput().

300  : ilRadioOption {
301  $opt = new ilRadioOption($this->lng->txt($caption), (string) $value);
302 
304  $opt->addSubItem(
305  $this->getCalenderSubInputs($st_point)
306  );
307  }
308 
310  $opt->addSubItem(
311  $this->getRepositoryObjectInput($st_point)
312  );
313  }
314 
315  if (!in_array($value, $valid)) {
316  $opt->setInfo($this->lng->txt('adm_user_starting_point_invalid_info'));
317  }
318 
319  return $opt;
320  }
This class represents an option in a radio group.
getCalenderSubInputs(?ilUserStartingPoint $st_point)
getRepositoryObjectInput(?ilUserStartingPoint $st_point)
$valid
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUserStartingPointForm()

ilUserStartingPointGUI::getUserStartingPointForm ( )
protected

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

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by initUserStartingPointForm(), and saveUserStartingPoint().

145  {
146  $form = new ilPropertyFormGUI();
147 
148  // starting point: personal
149  $startp = new ilCheckboxInputGUI($this->lng->txt('user_chooses_starting_page'), 'usr_start_pers');
150  $startp->setInfo($this->lng->txt('adm_user_starting_point_personal_info'));
151  $startp->setChecked($this->starting_point_repository->isPersonalStartingPointEnabled());
152 
153  $form->addItem($startp);
154 
155  $form->addCommandButton('saveUserStartingPoint', $this->lng->txt('save'));
156  $form->setFormAction($this->ctrl->getFormAction($this));
157 
158  return $form;
159  }
+ 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 136 of file class.ilUserStartingPointGUI.php.

References getRoleStartingPointForm().

136  : void
137  {
138  if (!($form instanceof ilPropertyFormGUI)) {
139  $form = $this->getRoleStartingPointForm();
140  }
141  $this->tpl->setContent($form->getHTML());
142  }
+ Here is the call graph for this function:

◆ initUserStartingPointForm()

ilUserStartingPointGUI::initUserStartingPointForm ( ?ilPropertyFormGUI  $form = null)

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

References getUserStartingPointForm().

128  : void
129  {
130  if (!($form instanceof ilPropertyFormGUI)) {
131  $form = $this->getUserStartingPointForm();
132  }
133  $this->tpl->setContent($form->getHTML());
134  }
+ Here is the call graph for this function:

◆ saveOrder()

ilUserStartingPointGUI::saveOrder ( )

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

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

538  : void
539  {
540  if (!$this->rbac_system->checkAccess('write', $this->parent_ref_id)) {
541  throw new ilPermissionException($this->lng->txt('msg_no_perm_read'));
542  }
543 
544  $positions = $this->user_request->getPositions();
545  if (count($positions) > 0) {
546  $this->starting_point_repository->saveOrder($positions);
547  }
548 
549  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
550  $this->ctrl->redirect($this, 'startingPoints');
551  }
+ Here is the call graph for this function:

◆ saveStartingPoint()

ilUserStartingPointGUI::saveStartingPoint ( )
protected

store starting point from the form

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

References $res, ilObject\_lookupObjId(), ILIAS\Repository\ctrl(), getRoleStartingPointForm(), ILIAS\Repository\int(), ILIAS\Repository\lng(), null, ilQueryParser\QP_COMBINATION_AND, ilQueryParser\setMinWordLength(), showRoleSelection(), ilUserStartingPointRepository\START_PD_CALENDAR, and ilUserStartingPointRepository\START_REPOSITORY_OBJ.

403  : void
404  {
405  if (!$this->rbac_system->checkAccess('write', $this->parent_ref_id)) {
406  $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->FATAL);
407  }
408 
409  $start_point_id = $this->user_request->getStartingPointId();
410 
411  //add from form
412  $form = $this->getRoleStartingPointForm();
413 
414  if (!$form->checkInput()) {
415  $form->setValuesByPost();
416  $this->tpl->setContent($form->getHTML());
417  return;
418  }
419 
420  $starting_point = $this->starting_point_repository->getStartingPointById(
421  $start_point_id
422  );
423 
424 
425  $role_id = $this->user_request->getRoleId();
426 
427  if ($form->getInput('role_type') === '1'
428  && ($role_id === null || $role_id < 1)) {
429  $parser = new ilQueryParser($form->getInput('role_search'));
430 
431  // TODO: Handle minWordLength
432  $parser->setMinWordLength(1);
433  $parser->setCombination(ilQueryParser::QP_COMBINATION_AND);
434  $parser->parse();
435 
436  $object_search = new ilLikeObjectSearch($parser);
437  $object_search->setFilter(['role']);
438  $res = $object_search->performSearch();
439 
440  $entries = $res->getEntries();
441 
442  if ($entries === []) {
443  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('no_corresponding_roles'), true);
444  $form->setValuesByPost();
445  $this->tpl->setContent($form->getHTML());
446  return;
447  }
448 
449  if (count($entries) > 1) {
450  $this->showRoleSelection(
451  $form->getInput('role'),
452  $form->getInput('role_search'),
453  $form->getInput('start_point'),
454  $form->getInput('start_object')
455  );
456  return;
457  }
458 
459  if (count($entries) === 1) {
460  $role = current($entries);
461  $role_id = $role['obj_id'];
462  }
463  }
464 
465  if ($role_id === 0) {
466  $role_id = $form->getInput('role');
467  }
468 
469  if ($role_id !== 0) {
470  $starting_point->setRuleTypeRoleBased();
471  $rules = ['role_id' => $role_id];
472  $starting_point->setRuleOptions(serialize($rules));
473  }
474 
475  $starting_point->setStartingPointType((int) $form->getInput('start_point'));
476 
477  $obj_id = (int) $form->getInput('start_object');
478  $cal_view = (int) $form->getInput('user_calendar_view');
479  $cal_period = (int) $form->getInput('user_cal_period');
480 
481 
482  if ($starting_point->getStartingPointType() === ilUserStartingPointRepository::START_REPOSITORY_OBJ
483  && (ilObject::_lookupObjId($obj_id) === 0 || $this->tree->isDeleted($obj_id))) {
484  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('obj_ref_id_not_exist'), true);
485  $form->setValuesByPost();
486  $this->tpl->setContent($form->getHTML());
487  return;
488  }
489  $starting_point->setStartingObject($obj_id);
490 
491  if ($starting_point->getStartingPointType() === ilUserStartingPointRepository::START_PD_CALENDAR) {
492  $starting_point->setCalendarView($cal_view);
493  $starting_point->setCalendarPeriod($cal_period);
494  }
495 
496  if ($start_point_id !== null) {
497  $this->starting_point_repository->update($starting_point);
498  } else {
499  $this->starting_point_repository->save($starting_point);
500  }
501 
502  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
503  $this->ctrl->redirect($this, 'startingPoints');
504  }
$res
Definition: ltiservices.php:66
showRoleSelection(string $role, string $role_search, string $start_point, string $start_object)
static _lookupObjId(int $ref_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setMinWordLength(int $a_length)
+ Here is the call graph for this function:

◆ saveUserStartingPoint()

ilUserStartingPointGUI::saveUserStartingPoint ( )
protected

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

References ILIAS\Repository\ctrl(), getUserStartingPointForm(), and ILIAS\Repository\lng().

383  : void
384  {
385  if (!$this->rbac_system->checkAccess('write', $this->parent_ref_id)) {
386  $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->FATAL);
387  }
388 
389  $form = $this->getUserStartingPointForm();
390 
391  if ($form->checkInput()) {
392  $this->starting_point_repository->togglePersonalStartingPointActivation((bool) $form->getInput('usr_start_pers'));
393  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
394  $this->ctrl->redirect($this, 'startingPoints');
395  }
396  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_error'), true);
397  $this->ctrl->redirect($this, 'startingPoints');
398  }
+ Here is the call graph for this function:

◆ showRoleSelection()

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

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

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

Referenced by saveStartingPoint().

511  : void {
512  $parser = new ilQueryParser($role_search);
513  $parser->setMinWordLength(1);
514  $parser->setCombination(ilQueryParser::QP_COMBINATION_AND);
515  $parser->parse();
516 
517  $object_search = new ilLikeObjectSearch($parser);
518  $object_search->setFilter(['role']);
519  $res = $object_search->performSearch();
520 
521  $entries = $res->getEntries();
522 
523  $table = new ilRoleSelectionTableGUI($this, 'saveStartingPoint');
524  $table->setLimit(9999);
525  $table->disable('sort');
526  $table->addHiddenInput('role_search', $role_search);
527  $table->addHiddenInput('start_point', $start_point);
528  $table->addHiddenInput('start_object', $start_object);
529  $table->addHiddenInput('role', $role);
530  $table->addHiddenInput('role_type', '1');
531  $table->setTitle($this->lng->txt('user_role_selection'));
532  $table->addMultiCommand('saveStartingPoint', $this->lng->txt('select'));
533  $table->parse($entries);
534 
535  $this->tpl->setContent($table->getHTML());
536  }
$res
Definition: ltiservices.php:66
+ 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 108 of file class.ilUserStartingPointGUI.php.

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

108  : void
109  {
110  $this->toolbar->addComponent(
111  $this->ui_factory->link()->standard(
112  $this->lng->txt('create_starting_point'),
113  $this->ctrl->getLinkTarget($this, "roleStartingPointform")
114  )
115  );
116 
118  $this,
119  $this->starting_point_repository,
120  $this->rbac_review,
121  $this->ui_factory,
122  $this->ui_renderer,
123  );
124 
125  $this->tpl->setContent($tbl->getHTML());
126  }
TableGUI class for LTI consumer listing.
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilUserStartingPointGUI::$ctrl
private

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

◆ $db

ilDBInterface ilUserStartingPointGUI::$db
private

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

◆ $lng

Language ilUserStartingPointGUI::$lng
private

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

◆ $log

ilLogger ilUserStartingPointGUI::$log
private

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

◆ $parent_ref_id

int ilUserStartingPointGUI::$parent_ref_id
private

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

◆ $rbac_review

ilRbacReview ilUserStartingPointGUI::$rbac_review
private

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

◆ $rbac_system

ilRbacSystem ilUserStartingPointGUI::$rbac_system
private

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

◆ $settings

ilSetting ilUserStartingPointGUI::$settings
private

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

◆ $starting_point_repository

ilUserStartingPointRepository ilUserStartingPointGUI::$starting_point_repository
private

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

◆ $tabs

ilTabsGUI ilUserStartingPointGUI::$tabs
private

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

◆ $toolbar

ilToolbarGUI ilUserStartingPointGUI::$toolbar
private

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

◆ $tpl

ilGlobalTemplateInterface ilUserStartingPointGUI::$tpl
private

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

◆ $tree

ilTree ilUserStartingPointGUI::$tree
private

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

◆ $ui_factory

UIFactory ilUserStartingPointGUI::$ui_factory
private

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

◆ $ui_renderer

Renderer ilUserStartingPointGUI::$ui_renderer
private

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

◆ $user

ilObjUser ilUserStartingPointGUI::$user
private

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

◆ $user_request

UserGUIRequest ilUserStartingPointGUI::$user_request
private

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


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