ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjStudyProgrammeAutoMembershipsGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
30
39{
40 private const ROLEFOLDER_REF_ID = 8;
41 public const CHECKBOX_SOURCE_IDS = 'c_amsids';
42
43 private const F_SOURCE_TYPE = 'f_st';
44 private const F_SOURCE_ID = 'f_sid';
45 private const F_ORIGINAL_SOURCE_TYPE = 'f_st_org';
46 private const F_ORIGINAL_SOURCE_ID = 'f_sid_org';
47 private const F_SEARCH_RECURSIVE = "f_search_recursive";
48 private const CMD_VIEW = 'view';
49 private const CMD_SAVE = 'save';
50 private const CMD_DELETE = 'delete';
51 private const CMD_DELETE_CONFIRMATION = 'deleteConfirmation';
52 public const CMD_GET_ASYNC_MODAL_OUTPUT = 'getAsynchModalOutput';
53 public const CMD_NEXT_STEP = 'nextStep';
54 private const CMD_ENABLE = 'enable';
55 private const CMD_DISABLE = 'disable';
56 private const CMD_PROFILE_NOT_PUBLIC = 'profile_not_public';
57
58 private static array $switch_to_ref_id = [
61 ];
62
64 public ?int $prg_ref_id;
66
67 public function __construct(
68 public ilGlobalTemplateInterface $tpl,
69 public ilCtrl $ctrl,
70 public ilToolbarGUI $toolbar,
71 public ilLanguage $lng,
72 public Factory $ui_factory,
73 protected MessageBox\Factory $message_box_factory,
74 protected Button\Factory $button_factory,
75 protected Renderer $ui_renderer,
76 protected Psr\Http\Message\ServerRequestInterface $request,
77 protected ilTree $tree,
78 protected ILIAS\HTTP\Wrapper\RequestWrapper $request_wrapper,
80 protected ilRbacReview $rbac_review
81 ) {
82 // Add this js manually here because the modal contains a form that is
83 // loaded asynchronously later on, and this JS won't be pulled then for
84 // some reason.
85 $tpl->addJavaScript("assets/js/Form.js");
86 }
87 public function executeCommand(): void
88 {
89 $cmd = $this->ctrl->getCmd();
90 switch ($cmd) {
91 case self::CMD_VIEW:
97 case self::CMD_SAVE:
98 $this->$cmd();
99 break;
100 case self::CMD_ENABLE:
101 $this->$cmd();
102 $this->ctrl->redirect($this, self::CMD_VIEW);
103 break;
105 $this->view(true);
106 break;
107 case 'handleExplorerCommand':
108 break;
109 default:
110 throw new ilException("ilObjStudyProgrammeAutoMembershipsGUI: Command not supported: $cmd");
111 }
112 }
113
114 protected function nextStep(): void
115 {
116 $current_src_type = null;
117 if ($this->request_wrapper->has(self::F_ORIGINAL_SOURCE_TYPE)) {
118 $current_src_type = $this->request_wrapper->retrieve(
119 self::F_ORIGINAL_SOURCE_TYPE,
120 $this->refinery->to()->string()
121 );
122 }
123
124 $current_src_id = null;
125 if ($this->request_wrapper->has(self::F_ORIGINAL_SOURCE_ID)) {
126 $current_src_id = $this->request_wrapper->retrieve(
127 self::F_ORIGINAL_SOURCE_ID,
128 $this->refinery->to()->string()
129 );
130 }
131
132 $selected_src_type = $this->request_wrapper->retrieve(self::F_SOURCE_TYPE, $this->refinery->kindlyTo()->string());
133 $selected_src = $this->request_wrapper->retrieve(self::F_SOURCE_ID, $this->refinery->kindlyTo()->string());
134
135 $form = $this->getSelectionForm(
136 $selected_src_type,
137 $selected_src,
138 $current_src_type,
139 $current_src_id
140 );
141 $form_id = "form_" . $form->getId();
142
143 $modal = $this->ui_factory->modal()->roundtrip(
144 $this->txt('modal_member_auto_select_title'),
145 $this->ui_factory->legacy()->content($form->getHtml())
146 );
147
148 $submit = $this->ui_factory->button()->primary($this->txt('add'), "#")->withOnLoadCode(
149 function ($id) use ($form_id) {
150 return "$('#$id').click(function() { $('#$form_id').submit(); return false; });";
151 }
152 );
153
154 $modal = $modal->withActionButtons([$submit]);
155
156 echo $this->ui_renderer->renderAsync($modal);
157 exit;
158 }
159
163 protected function view(bool $profile_not_public = false): void
164 {
165 if ($profile_not_public) {
166 $this->tpl->setOnScreenMessage("info", $this->lng->txt('prg_profile_not_public'));
167 }
168 $collected_modals = [];
169 $modal = $this->getModal();
170 $this->getToolbar($modal->getShowSignal());
171 $collected_modals[] = $modal;
172 $data = [];
173 foreach ($this->getObject()->getAutomaticMembershipSources() as $ams) {
174 $title = $this->getTitleRepresentation($ams);
175 $usr = $this->getUserRepresentation($ams->getLastEditorId()) ?? $this->ui_factory->legacy()->content('-');
176 $modal = $this->getModal($ams->getSourceType(), $ams->getSourceId(), $ams->isSearchRecursive());
177 $collected_modals[] = $modal;
178 $src_id = $ams->getSourceType() . '-' . $ams->getSourceId() . '-' . $ams->isSearchRecursive();
179 $actions = $this->getItemAction(
180 $src_id,
181 $modal->getShowSignal(),
182 $ams->isEnabled()
183 );
184
185 $data[] = [
186 $ams,
187 $this->ui_renderer->render($title),
188 $this->ui_renderer->render($usr),
189 $this->ui_renderer->render($actions)
190 ];
191 }
192 $table = new ilStudyProgrammeAutoMembershipsTableGUI($this, "view", "");
193 $table->setData($data);
194 $this->tpl->setContent(
195 $this->ui_renderer->render($collected_modals)
196 . $table->getHTML()
197 );
198 }
199
200 protected function save(): void
201 {
202 $form = $this->getForm();
203 $form->checkInput();
204
205 $post = $this->request->getParsedBody();
206 $form->setValuesByArray($post);
207 $src_type = $post[self::F_SOURCE_TYPE];
208 $src_id = $post[self::F_SOURCE_ID . $src_type] ?? null;
209 $search_recursive = (bool) ($post[self::F_SEARCH_RECURSIVE] ?? false);
210
211 if (
212 (is_null($src_type) || $src_type === "") ||
213 (is_null($src_id) || $src_id === 0)
214 ) {
215 $this->tpl->setOnScreenMessage("failure", $this->txt('no_srctype_or_id'), true);
216 $this->ctrl->redirect($this, self::CMD_VIEW);
217 return;
218 }
219
220 if (in_array($src_type, self::$switch_to_ref_id)) {
221 $refs = ilObject::_getAllReferences((int) $src_id);
222 $src_id = (int) array_shift($refs);
223 }
224
225 if (
226 array_key_exists(self::F_ORIGINAL_SOURCE_TYPE, $post) &&
227 array_key_exists(self::F_ORIGINAL_SOURCE_ID, $post)
228 ) {
229 $this->getObject()->deleteAutomaticMembershipSource(
230 (string) $post[self::F_ORIGINAL_SOURCE_TYPE],
231 (int) $post[self::F_ORIGINAL_SOURCE_ID]
232 );
233 }
234
235 $this->getObject()->storeAutomaticMembershipSource($src_type, (int) $src_id, $search_recursive);
236 $this->tpl->setOnScreenMessage("success", $this->txt("auto_add_success"), true);
237 $this->ctrl->redirect($this, self::CMD_VIEW);
238 }
239
240 protected function deleteConfirmation(): void
241 {
242 $get = $this->request->getQueryParams();
243 $post = $this->request->getParsedBody();
245
246 $field_ids_in_get = array_key_exists($field, $get);
247 $field_ids_in_post = array_key_exists($field, $post);
248
249 $type_ids = '';
250 $msg = '';
251 if ($field_ids_in_get) {
252 $type_ids = $get[$field];
253 $msg = $this->lng->txt('prg_delete_single_confirmation');
254 } elseif ($field_ids_in_post) {
255 $type_ids = implode(' ', $post[$field]);
256 $msg = $this->lng->txt('prg_delete_confirmation');
257 } else {
258 $this->tpl->setOnScreenMessage("info", $this->lng->txt('prg_delete_nothing_selected'), true);
259 $this->ctrl->redirect($this, self::CMD_VIEW);
260 }
261
262 $type_ids = base64_encode($type_ids);
263
264 $this->ctrl->setParameterByClass(self::class, $field, $type_ids);
265 $delete = $this->ctrl->getFormActionByClass(self::class, self::CMD_DELETE);
266 $cancel = $this->ctrl->getFormActionByClass(self::class, self::CMD_VIEW);
267 $this->ctrl->clearParameterByClass(self::class, $field);
268
269 $buttons = [
270 $this->button_factory->standard($this->lng->txt('prg_confirm_delete'), $delete),
271 $this->button_factory->standard($this->lng->txt('prg_cancel'), $cancel)
272 ];
273
274 $message_box = $this->message_box_factory->confirmation($msg)->withButtons($buttons);
275
276 $this->tpl->setContent($this->ui_renderer->render($message_box));
277 }
278
279 protected function delete(): void
280 {
282 $get = $this->request->getQueryParams();
283
284 if (!array_key_exists($field, $get)) {
285 $this->tpl->setOnScreenMessage("failure", $this->lng->txt('prg_delete_failure'), true);
286 $this->ctrl->redirect($this, self::CMD_VIEW);
287 }
288
289 $type_ids = base64_decode($get[$field]);
290 $type_ids = explode(' ', trim($type_ids));
291
292 foreach ($type_ids as $src_id) {
293 [$type, $id] = explode('-', $src_id);
294 $this->getObject()->deleteAutomaticMembershipSource((string) $type, (int) $id);
295 }
296
297 $msg = $this->lng->txt('prg_delete_single_success');
298 if (count($type_ids) > 1) {
299 $msg = $this->lng->txt('prg_delete_success');
300 }
301
302 $this->tpl->setOnScreenMessage("success", $msg, true);
303 $this->ctrl->redirect($this, self::CMD_VIEW);
304 }
305
309 protected function enable(): void
310 {
311 $get = $this->request->getQueryParams();
313 if (array_key_exists($field, $get)) {
314 [$type, $id, $search_recursive] = explode('-', $get[$field]);
315 $this->getObject()->enableAutomaticMembershipSource((string) $type, (int) $id, (bool) $search_recursive);
316 }
317 $this->ctrl->redirect($this, self::CMD_VIEW);
318 }
319
323 protected function disable(): void
324 {
325 $get = $this->request->getQueryParams();
327 if (array_key_exists($field, $get)) {
328 [$type, $id, $search_recursive] = explode('-', $get[$field]);
329 $this->getObject()->disableAutomaticMembershipSource((string) $type, (int) $id, (bool) $search_recursive);
330 }
331 $this->ctrl->redirect($this, self::CMD_VIEW);
332 }
333
337 public function setRefId(int $prg_ref_id): void
338 {
339 $this->prg_ref_id = $prg_ref_id;
340 }
341
345 public function setParentGUI(ilContainerGUI $a_parent_gui): void
346 {
347 $this->parent_gui = $a_parent_gui;
348 }
349
353 protected function getObject(): ilObjStudyProgramme
354 {
355 if ($this->object === null ||
356 $this->object->getRefId() !== $this->prg_ref_id
357 ) {
358 $this->object = ilObjStudyProgramme::getInstanceByRefId($this->prg_ref_id);
359 }
360 return $this->object;
361 }
362
363 protected function getModal(
364 ?string $source_type = null,
365 ?int $source_id = null,
366 bool $search_recursive = false
367 ): RoundTrip {
368 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_TYPE, $source_type);
369 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_ID, $source_id);
370 $this->ctrl->setParameter($this, self::F_SEARCH_RECURSIVE, $search_recursive);
371 $link = $this->ctrl->getLinkTarget($this, "getAsynchModalOutput", "", true);
372 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_TYPE, null);
373 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_ID, null);
374 $this->ctrl->setParameter($this, self::F_SEARCH_RECURSIVE, null);
375
376 return $this->ui_factory->modal()->roundtrip(
377 '',
378 []
379 )
380 ->withAsyncRenderUrl($link);
381 }
382
383 protected function getAsynchModalOutput(): void
384 {
385 $current_src_type = null;
386 if ($this->request_wrapper->has(self::F_ORIGINAL_SOURCE_TYPE)) {
387 $current_src_type = $this->request_wrapper->retrieve(
388 self::F_ORIGINAL_SOURCE_TYPE,
389 $this->refinery->to()->string()
390 );
391 }
392
393 $current_src_id = null;
394 if ($this->request_wrapper->has(self::F_ORIGINAL_SOURCE_ID)) {
395 $current_src_id = $this->request_wrapper->retrieve(self::F_ORIGINAL_SOURCE_ID, $this->refinery->kindlyTo()->int());
396 }
397
398 $search_recursive = false;
399 if ($this->request_wrapper->has(self::F_SEARCH_RECURSIVE)) {
400 $search_recursive = $this->request_wrapper->retrieve(self::F_SEARCH_RECURSIVE, $this->refinery->kindlyTo()->bool());
401 }
402 $form = $this->getForm($current_src_type, $current_src_id, $search_recursive);
403 $form_id = "form_" . $form->getId();
404
405 $modal = $this->ui_factory->modal()->roundtrip(
406 $this->txt('modal_member_auto_select_title'),
407 $this->ui_factory->legacy()->content($form->getHtml())
408 );
409
410 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_TYPE, $current_src_type);
411 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_ID, $current_src_id);
412 $link = $this->ctrl->getLinkTarget($this, "nextStep", "", true);
413 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_TYPE, null);
414 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_ID, null);
415
416 $replaceSignal = $modal->getReplaceSignal();
417 $signal_id = $replaceSignal->getId();
418 $f_selected_type = self::F_SOURCE_TYPE;
419 $f_selected_id = self::F_SOURCE_ID;
420 $submit = $this->ui_factory->button()->primary($this->txt('search'), "#")
421 ->withOnLoadCode(
422 function ($id) use ($form_id, $link, $signal_id, $f_selected_type, $f_selected_id) {
423 return
424 "$('#$id').click(function() {
425
426 var checked = $(\"input[name='$f_selected_type']:checked\"). val();
427 if(checked == 'orgu' || typeof(checked) == \"undefined\") {
428 console.log('$(\'#$form_id\').submit()');
429 document.getElementById('$form_id').submit();
430 return false;
431 }
432
433 var i_value = $(\"input[name='$f_selected_id\" + checked + \"']\"). val();
434 if(i_value == '' || typeof(i_value) == \"undefined\") {
435 document.getElementById('$form_id').submit();
436 return false;
437 }
438
439 n_url = '$link' + '&$f_selected_type=' + checked + '&$f_selected_id=' + i_value;
440 $('#$id').attr(\"onclick\", function(event) {
441 $(this).trigger('$signal_id',
442 {
443 'id' : '$signal_id', 'event' : 'click',
444 'triggerer' : $(this),
445 'options' : JSON.parse('{\"url\":\"' + n_url + '\"}')
446 }
447 );
448 });
449 return false;
450 }
451 );";
452 }
453 );
454
455 $modal = $modal->withActionButtons([$submit])
456 ->withAdditionalOnLoadCode(
457 function ($id) use ($form) {
458 $selector_post_var = self::F_SOURCE_ID . ilStudyProgrammeAutoMembershipSource::TYPE_ORGU;
459 $js = $form->getItemByPostVar($selector_post_var)->getOnloadCode();
460 return implode(';', $js);
461 }
462 );
463
464 echo $this->ui_renderer->renderAsync($modal);
465 exit;
466 }
467
468 protected function getForm(
469 ?string $source_type = null,
470 ?int $source_id = null,
471 bool $search_recursive = false
473 $form = new ilPropertyFormGUI();
474
475 if (is_null($source_type)) {
476 $source_type = "";
477 }
478
479 $form->setId(uniqid($source_type . $source_id, true));
480 $form->setFormAction($this->ctrl->getFormAction($this, 'save'));
481
482 $rgroup = new ilRadioGroupInputGUI($this->txt('membership_source_type'), self::F_SOURCE_TYPE);
483 $rgroup->setValue($source_type);
484 $form->addItem($rgroup);
485
486 $radio_role = new ilRadioOption(
489 );
490
491 $ni_role = new ilTextInputGUI(
494 );
495 $radio_role->addSubItem($ni_role);
496 $rgroup->addOption($radio_role);
497
498 $radio_grp = new ilRadioOption(
501 );
502 $ni_grp = new ilTextInputGUI(
505 );
506 $radio_grp->addSubItem($ni_grp);
507 $rgroup->addOption($radio_grp);
508
509 $radio_crs = new ilRadioOption(
512 );
513 $ni_crs = new ilTextInputGUI(
516 );
517 $radio_crs->addSubItem($ni_crs);
518 $rgroup->addOption($radio_crs);
519
520 $radio_orgu = new ilRadioOption(
523 );
525 "",
527 false,
528 $this
529 );
530 $orgu->getExplorerGUI()->setSelectableTypes(["orgu"]);
531 $orgu->getExplorerGUI()->setTypeWhiteList(["root", "orgu"]);
532 $orgu->getExplorerGUI()->setRootId(ilObjOrgUnit::getRootOrgRefId());
533 $orgu->getExplorerGUI()->setAjax(false);
534 $radio_orgu->addSubItem($orgu);
535
536 $recurse = new ilCheckboxInputGUI($this->txt('search_for_orgu_members_recursive'), self::F_SEARCH_RECURSIVE);
537 $recurse->setValue('1');
538 $recurse->setChecked($search_recursive);
539 $radio_orgu->addSubItem($recurse);
540 $rgroup->addOption($radio_orgu);
541 if (
542 !is_null($source_type) &&
543 !is_null($source_id) &&
544 $source_type !== "" &&
545 $source_id !== ""
546 ) {
547 switch ($source_type) {
549 $ni_role->setValue($source_id);
550 break;
552 $ni_grp->setValue($source_id);
553 break;
555 $ni_crs->setValue($source_id);
556 break;
558 $orgu->setValue($source_id);
559 break;
560 default:
561 }
562 }
563
564 $hi = new ilHiddenInputGUI(self::F_ORIGINAL_SOURCE_TYPE);
565 $hi->setValue($source_type);
566 $form->addItem($hi);
567
568 $hi = new ilHiddenInputGUI(self::F_ORIGINAL_SOURCE_ID);
569 $hi->setValue((string) $source_id ?? '');
570 $form->addItem($hi);
571
572 return $form;
573 }
574
575 protected function getSelectionForm(
576 string $selected_source_type,
577 string $selected_source,
578 ?string $source_type = null,
579 ?string $source_id = null
581 $form = new ilPropertyFormGUI();
582 $form->setFormAction($this->ctrl->getFormAction($this, "save"));
583
584 $query_parser = $this->parseQueryString($selected_source);
585 $object_search = new ilLikeObjectSearch($query_parser);
586 $object_search->setFilter(array($selected_source_type));
587 $entries = $object_search->performSearch()->getEntries();
588
589 $rgoup = new ilRadioGroupInputGUI(
590 $this->txt("prg_auto_member_select_" . $selected_source_type),
591 self::F_SOURCE_ID . $selected_source_type
592 );
593 $form->addItem($rgoup);
594 foreach ($entries as $entry) {
595 $obj_id = (int) $entry['obj_id'];
596 $title = ilObject::_lookupTitle($obj_id);
597 $description = ilObject::_lookupDescription($obj_id);
598
599 $option = new ilRadioOption($title, (string) $obj_id, $description);
600 $rgoup->addOption($option);
601 }
602
603 $hi = new ilHiddenInputGUI(self::F_ORIGINAL_SOURCE_TYPE);
604 $hi->setValue($source_type ?? '');
605 $form->addItem($hi);
606
607 $hi = new ilHiddenInputGUI(self::F_ORIGINAL_SOURCE_ID);
608 $hi->setValue((string) $source_id);
609 $form->addItem($hi);
610
611 $hi = new ilHiddenInputGUI(self::F_SOURCE_TYPE);
612 $hi->setValue($selected_source_type);
613 $form->addItem($hi);
614
615 return $form;
616 }
617
621 protected function parseQueryString(string $string)
622 {
623 $query_parser = new ilQueryParser(ilUtil::stripSlashes($string));
624 $query_parser->setCombination(ilQueryParser::QP_COMBINATION_AND);
625 $query_parser->setMinWordLength(1);
626 $query_parser->setGlobalMinLength(3); // #14768
627 $query_parser->parse();
628
629 if (!$query_parser->validate()) {
630 return $query_parser->getMessage();
631 }
632 return $query_parser;
633 }
634
638 protected function getToolbar(Signal $add_cat_signal): void
639 {
640 $btn = $this->ui_factory->button()->primary($this->txt('add_automembership_source'), '')
641 ->withOnClick($add_cat_signal);
642 $this->toolbar->addComponent($btn);
643 }
644
645
646
647 protected function getItemAction(
648 string $src_id,
649 Signal $signal,
650 bool $is_enabled
651 ): Dropdown\Standard {
652 $items = [];
653
654 $items[] = $this->ui_factory->button()->shy($this->txt('edit'), '')
655 ->withOnClick($signal);
656
657 $this->ctrl->setParameter($this, self::CHECKBOX_SOURCE_IDS, $src_id);
658
659 if ($is_enabled) {
660 $items[] = $this->ui_factory->button()->shy(
661 $this->txt('deactivate'),
662 $this->ctrl->getLinkTarget($this, self::CMD_DISABLE)
663 );
664 } else {
665 $items[] = $this->ui_factory->button()->shy(
666 $this->txt('activate'),
667 $this->ctrl->getLinkTarget($this, self::CMD_ENABLE)
668 );
669 }
670
671 $items[] = $this->ui_factory->button()->shy(
672 $this->txt('delete'),
673 $this->ctrl->getLinkTarget($this, self::CMD_DELETE_CONFIRMATION)
674 );
675
676 $this->ctrl->clearParameters($this);
677
678 return $this->ui_factory->dropdown()->standard($items);
679 }
680
681 protected function getUserRepresentation(int $usr_id): Link\Standard
682 {
683 $username = ilObjUser::_lookupName($usr_id);
684 $editor = implode(' ', [
685 $username['firstname'],
686 $username['lastname'],
687 '(' . $username['login'] . ')'
688 ]);
689
690 $back_url = $this->ctrl->getLinkTarget($this, self::CMD_VIEW);
691 $this->ctrl->setParameterByClass(PublicProfileGUI::class, 'back_url', urlencode($back_url));
692 $this->ctrl->setParameterByClass(PublicProfileGUI::class, 'user_id', $usr_id);
693 $url = $this->ctrl->getLinkTargetByClass(PublicProfileGUI::class, 'view');
694
696 if (!$usr->hasPublicProfile()) {
697 $url = $this->ctrl->getLinkTarget($this, self::CMD_PROFILE_NOT_PUBLIC);
698 }
699 return $this->ui_factory->link()->standard($editor, $url);
700 }
701
702
703 protected function getTitleRepresentation(
705 ): Link\Standard {
706 $src_id = $ams->getSourceId();
707
708 switch ($ams->getSourceType()) {
710 $title = ilObjRole::_lookupTitle($src_id) ?? "-";
711
712 if ($this->rbac_review->isGlobalRole($src_id)) {
713 $parent_ref = self::ROLEFOLDER_REF_ID;
714 $path = ['ilAdministrationGUI'];
715 $this->ctrl->setParameterByClass('ilObjRoleGUI', 'admin_mode', 'settings');
716 } else {
717 $parent_ref = $this->rbac_review->getObjectReferenceOfRole($src_id);
718 $parent_type = ilObject::_lookupType($parent_ref, true);
719 $path = ['ilRepositoryGUI','ilObjCategoryGUI'];
720 if ($parent_type == 'orgu') {
721 $path = ['ilAdministrationGUI','ilObjOrgUnitGUI'];
722 }
723 $path[] = 'ilPermissionGUI';
724 }
725 $path[] = 'ilObjRoleGUI';
726 $this->ctrl->setParameterByClass('ilObjRoleGUI', 'ref_id', $parent_ref);
727 $this->ctrl->setParameterByClass('ilObjRoleGUI', 'obj_id', $src_id);
728 $url = $this->ctrl->getLinkTargetByClass($path, 'userassignment');
729 $this->ctrl->clearParametersByClass('ilObjRoleGUI');
730 break;
731
733 $url = ilLink::_getStaticLink($src_id, 'crs');
734 // no break
736 $url = ilLink::_getStaticLink($src_id, 'grp');
737 $hops = array_map(
738 static function (array $c): string {
739 return ilObject::_lookupTitle((int) $c["obj_id"]);
740 },
741 $this->tree->getPathFull($src_id)
742 );
743 $hops = array_slice($hops, 1);
744 $title = implode(' > ', $hops) ?? "-";
745 break;
746
748 $hops = array_map(
749 static function (array $c): string {
750 return ilObject::_lookupTitle((int) $c["obj_id"]);
751 },
752 $this->tree->getPathFull($src_id)
753 );
754 $hops = array_slice($hops, 3);
755 $title = implode(' > ', $hops) ?? "-";
756 $url = ilLink::_getStaticLink($src_id, $ams->getSourceType());
757 break;
758 default:
759 throw new LogicException("This should not happen. Forgot a case in the switch?");
760 }
761
762 return $this->ui_factory->link()->standard($title, $url);
763 }
764
765 protected function txt(string $code): string
766 {
767 return $this->lng->txt($code);
768 }
769}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
GUI class for public user profile presentation.
This class represents a checkbox property in a property form.
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder,...
Class ilCtrl provides processing control methods.
Base class for ILIAS Exception handling.
setFormAction(string $a_formaction)
setId(string $a_id)
This class represents a hidden form property in a property form.
language handling
static getRootOrgRefId()
getModal(?string $source_type=null, ?int $source_id=null, bool $search_recursive=false)
getForm(?string $source_type=null, ?int $source_id=null, bool $search_recursive=false)
__construct(public ilGlobalTemplateInterface $tpl, public ilCtrl $ctrl, public ilToolbarGUI $toolbar, public ilLanguage $lng, public Factory $ui_factory, protected MessageBox\Factory $message_box_factory, protected Button\Factory $button_factory, protected Renderer $ui_renderer, protected Psr\Http\Message\ServerRequestInterface $request, protected ilTree $tree, protected ILIAS\HTTP\Wrapper\RequestWrapper $request_wrapper, protected ILIAS\Refinery\Factory $refinery, protected ilRbacReview $rbac_review)
getTitleRepresentation(ilStudyProgrammeAutoMembershipSource $ams)
getItemAction(string $src_id, Signal $signal, bool $is_enabled)
setRefId(int $prg_ref_id)
Set ref-id of StudyProgramme before using this GUI.
setParentGUI(ilContainerGUI $a_parent_gui)
Set this GUI's parent gui.
getSelectionForm(string $selected_source_type, string $selected_source, ?string $source_type=null, ?string $source_id=null)
static _lookupName(int $a_user_id)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
static _lookupType(int $id, bool $reference=false)
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupTitle(int $obj_id)
static _lookupDescription(int $obj_id)
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.
class ilRbacReview Contains Review functions of core Rbac.
This class represents a text property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
$c
Definition: deliver.php:25
exit
addJavaScript(string $a_js_file, bool $a_add_version_parameter=true, int $a_batch=2)
Add a javascript file that should be included in the header.
This describes commonalities between all types of Dropdowns.
Definition: Dropdown.php:35
An entity that renders components to a string output.
Definition: Renderer.php:31
$path
Definition: ltiservices.php:30
$post
Definition: ltitoken.php:46
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $lng
Definition: privfeed.php:31
$url
Definition: shib_logout.php:68