ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilObjStudyProgrammeAutoMembershipsGUI Class Reference

Class ilObjStudyProgrammeAutoMembershipsGUI. More...

+ Collaboration diagram for ilObjStudyProgrammeAutoMembershipsGUI:

Public Member Functions

 __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)
 
 executeCommand ()
 
 setRefId (int $prg_ref_id)
 Set ref-id of StudyProgramme before using this GUI. More...
 
 setParentGUI (ilContainerGUI $a_parent_gui)
 Set this GUI's parent gui. More...
 

Data Fields

const CHECKBOX_SOURCE_IDS = 'c_amsids'
 
const CMD_GET_ASYNC_MODAL_OUTPUT = 'getAsynchModalOutput'
 
const CMD_NEXT_STEP = 'nextStep'
 
ilObjStudyProgramme $object = null
 
int $prg_ref_id
 

Protected Member Functions

 nextStep ()
 
 view (bool $profile_not_public=false)
 Render. More...
 
 save ()
 
 deleteConfirmation ()
 
 delete ()
 
 enable ()
 Enable single entry. More...
 
 disable ()
 Disable single entry. More...
 
 getObject ()
 Get current StudyProgramme-object. More...
 
 getModal (?string $source_type=null, ?int $source_id=null, bool $search_recursive=false)
 
 getAsynchModalOutput ()
 
 getForm (?string $source_type=null, ?int $source_id=null, bool $search_recursive=false)
 
 getSelectionForm (string $selected_source_type, string $selected_source, ?string $source_type=null, ?string $source_id=null)
 
 parseQueryString (string $string)
 
 getToolbar (Signal $add_cat_signal)
 Setup toolbar. More...
 
 getItemAction (string $src_id, Signal $signal, bool $is_enabled)
 
 getUserRepresentation (int $usr_id)
 
 getTitleRepresentation (ilStudyProgrammeAutoMembershipSource $ams)
 
 txt (string $code)
 

Protected Attributes

ilContainerGUI $parent_gui
 

Private Attributes

const ROLEFOLDER_REF_ID = 8
 
const F_SOURCE_TYPE = 'f_st'
 
const F_SOURCE_ID = 'f_sid'
 
const F_ORIGINAL_SOURCE_TYPE = 'f_st_org'
 
const F_ORIGINAL_SOURCE_ID = 'f_sid_org'
 
const F_SEARCH_RECURSIVE = "f_search_recursive"
 
const CMD_VIEW = 'view'
 
const CMD_SAVE = 'save'
 
const CMD_DELETE = 'delete'
 
const CMD_DELETE_CONFIRMATION = 'deleteConfirmation'
 
const CMD_ENABLE = 'enable'
 
const CMD_DISABLE = 'disable'
 
const CMD_PROFILE_NOT_PUBLIC = 'profile_not_public'
 

Static Private Attributes

static array $switch_to_ref_id
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjStudyProgrammeAutoMembershipsGUI::__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 
)

Definition at line 67 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

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 }

References ILIAS\UICore\GlobalTemplate\addJavaScript().

+ Here is the call graph for this function:

Member Function Documentation

◆ delete()

ilObjStudyProgrammeAutoMembershipsGUI::delete ( )
protected

Definition at line 279 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

279 : 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 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id, CHECKBOX_SOURCE_IDS, ILIAS\Repository\ctrl(), getObject(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ deleteConfirmation()

ilObjStudyProgrammeAutoMembershipsGUI::deleteConfirmation ( )
protected

Definition at line 240 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

240 : 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 }
$post
Definition: ltitoken.php:46

References $post, CHECKBOX_SOURCE_IDS, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ disable()

ilObjStudyProgrammeAutoMembershipsGUI::disable ( )
protected

Disable single entry.

Definition at line 323 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

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

References $id, CHECKBOX_SOURCE_IDS, ILIAS\Repository\ctrl(), and getObject().

+ Here is the call graph for this function:

◆ enable()

ilObjStudyProgrammeAutoMembershipsGUI::enable ( )
protected

Enable single entry.

Definition at line 309 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

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

References $id, CHECKBOX_SOURCE_IDS, ILIAS\Repository\ctrl(), and getObject().

+ Here is the call graph for this function:

◆ executeCommand()

ilObjStudyProgrammeAutoMembershipsGUI::executeCommand ( )

Definition at line 87 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

87 : 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 }
Base class for ILIAS Exception handling.

References CMD_DELETE, CMD_DELETE_CONFIRMATION, CMD_DISABLE, CMD_ENABLE, CMD_GET_ASYNC_MODAL_OUTPUT, CMD_NEXT_STEP, CMD_PROFILE_NOT_PUBLIC, CMD_SAVE, CMD_VIEW, ILIAS\Repository\ctrl(), and view().

+ Here is the call graph for this function:

◆ getAsynchModalOutput()

ilObjStudyProgrammeAutoMembershipsGUI::getAsynchModalOutput ( )
protected

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

383 : 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 }
getForm(?string $source_type=null, ?int $source_id=null, bool $search_recursive=false)
exit

References $id, ILIAS\Repository\ctrl(), exit, ILIAS\Repository\refinery(), and ilStudyProgrammeAutoMembershipSource\TYPE_ORGU.

+ Here is the call graph for this function:

◆ getForm()

ilObjStudyProgrammeAutoMembershipsGUI::getForm ( ?string  $source_type = null,
?int  $source_id = null,
bool  $search_recursive = false 
)
protected

Definition at line 468 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

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 }
This class represents a checkbox property in a property form.
This class represents a hidden form property in a property form.
static getRootOrgRefId()
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 text property in a property form.

Referenced by save().

+ Here is the caller graph for this function:

◆ getItemAction()

ilObjStudyProgrammeAutoMembershipsGUI::getItemAction ( string  $src_id,
Signal  $signal,
bool  $is_enabled 
)
protected

Definition at line 647 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

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 }

References ILIAS\Repository\ctrl().

Referenced by view().

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

◆ getModal()

ilObjStudyProgrammeAutoMembershipsGUI::getModal ( ?string  $source_type = null,
?int  $source_id = null,
bool  $search_recursive = false 
)
protected

Definition at line 363 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

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 }

Referenced by view().

+ Here is the caller graph for this function:

◆ getObject()

ilObjStudyProgrammeAutoMembershipsGUI::getObject ( )
protected

Get current StudyProgramme-object.

Definition at line 353 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

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 }

References $object, ilObjStudyProgramme\getInstanceByRefId(), and ILIAS\Repository\object().

Referenced by delete(), disable(), enable(), save(), and view().

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

◆ getSelectionForm()

ilObjStudyProgrammeAutoMembershipsGUI::getSelectionForm ( string  $selected_source_type,
string  $selected_source,
?string  $source_type = null,
?string  $source_id = null 
)
protected

Definition at line 575 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

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 }
static _lookupTitle(int $obj_id)
static _lookupDescription(int $obj_id)

Referenced by nextStep().

+ Here is the caller graph for this function:

◆ getTitleRepresentation()

ilObjStudyProgrammeAutoMembershipsGUI::getTitleRepresentation ( ilStudyProgrammeAutoMembershipSource  $ams)
protected

Definition at line 703 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

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 }
static _lookupType(int $id, bool $reference=false)
$c
Definition: deliver.php:25
$path
Definition: ltiservices.php:30
$url
Definition: shib_logout.php:68

References $c, $path, $url, ilLink\_getStaticLink(), ilObject\_lookupTitle(), ilObject\_lookupType(), ILIAS\Repository\ctrl(), ilStudyProgrammeAutoMembershipSource\getSourceType(), ilStudyProgrammeAutoMembershipSource\TYPE_COURSE, ilStudyProgrammeAutoMembershipSource\TYPE_GROUP, ilStudyProgrammeAutoMembershipSource\TYPE_ORGU, and ilStudyProgrammeAutoMembershipSource\TYPE_ROLE.

Referenced by view().

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

◆ getToolbar()

ilObjStudyProgrammeAutoMembershipsGUI::getToolbar ( Signal  $add_cat_signal)
protected

Setup toolbar.

Definition at line 638 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

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

References ILIAS\Repository\toolbar().

Referenced by view().

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

◆ getUserRepresentation()

ilObjStudyProgrammeAutoMembershipsGUI::getUserRepresentation ( int  $usr_id)
protected

Definition at line 681 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

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

References $url, ilObjUser\_lookupName(), ILIAS\Repository\ctrl(), and ilObjectFactory\getInstanceByObjId().

Referenced by view().

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

◆ nextStep()

ilObjStudyProgrammeAutoMembershipsGUI::nextStep ( )
protected

Definition at line 114 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

114 : 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 }
getSelectionForm(string $selected_source_type, string $selected_source, ?string $source_type=null, ?string $source_id=null)

References $id, exit, getSelectionForm(), ILIAS\Repository\refinery(), and txt().

+ Here is the call graph for this function:

◆ parseQueryString()

ilObjStudyProgrammeAutoMembershipsGUI::parseQueryString ( string  $string)
protected
Returns
ilQueryParser|string

Definition at line 621 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

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 }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")

References ilQueryParser\QP_COMBINATION_AND, and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ save()

ilObjStudyProgrammeAutoMembershipsGUI::save ( )
protected

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

200 : 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 }
static _getAllReferences(int $id)
get all reference ids for object ID

References $post, ilObject\_getAllReferences(), ILIAS\Repository\ctrl(), F_SOURCE_TYPE, getForm(), getObject(), ILIAS\Repository\int(), and txt().

+ Here is the call graph for this function:

◆ setParentGUI()

ilObjStudyProgrammeAutoMembershipsGUI::setParentGUI ( ilContainerGUI  $a_parent_gui)

Set this GUI's parent gui.

Definition at line 345 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

345 : void
346 {
347 $this->parent_gui = $a_parent_gui;
348 }

◆ setRefId()

ilObjStudyProgrammeAutoMembershipsGUI::setRefId ( int  $prg_ref_id)

Set ref-id of StudyProgramme before using this GUI.

Definition at line 337 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

337 : void
338 {
339 $this->prg_ref_id = $prg_ref_id;
340 }

References $prg_ref_id.

◆ txt()

ilObjStudyProgrammeAutoMembershipsGUI::txt ( string  $code)
protected

Definition at line 765 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

765 : string
766 {
767 return $this->lng->txt($code);
768 }

References ILIAS\Repository\lng().

Referenced by nextStep(), and save().

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

◆ view()

ilObjStudyProgrammeAutoMembershipsGUI::view ( bool  $profile_not_public = false)
protected

Render.

Definition at line 163 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

163 : 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 }
getModal(?string $source_type=null, ?int $source_id=null, bool $search_recursive=false)
getTitleRepresentation(ilStudyProgrammeAutoMembershipSource $ams)
getItemAction(string $src_id, Signal $signal, bool $is_enabled)

References $data, getItemAction(), getModal(), getObject(), getTitleRepresentation(), getToolbar(), getUserRepresentation(), and ILIAS\Repository\lng().

Referenced by executeCommand().

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

Field Documentation

◆ $object

ilObjStudyProgramme ilObjStudyProgrammeAutoMembershipsGUI::$object = null

Definition at line 63 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

Referenced by getObject().

◆ $parent_gui

ilContainerGUI ilObjStudyProgrammeAutoMembershipsGUI::$parent_gui
protected

◆ $prg_ref_id

int ilObjStudyProgrammeAutoMembershipsGUI::$prg_ref_id

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

Referenced by setRefId().

◆ $switch_to_ref_id

array ilObjStudyProgrammeAutoMembershipsGUI::$switch_to_ref_id
staticprivate

◆ CHECKBOX_SOURCE_IDS

const ilObjStudyProgrammeAutoMembershipsGUI::CHECKBOX_SOURCE_IDS = 'c_amsids'

◆ CMD_DELETE

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_DELETE = 'delete'
private

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

Referenced by executeCommand().

◆ CMD_DELETE_CONFIRMATION

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_DELETE_CONFIRMATION = 'deleteConfirmation'
private

Definition at line 51 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

Referenced by executeCommand().

◆ CMD_DISABLE

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_DISABLE = 'disable'
private

Definition at line 55 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

Referenced by executeCommand().

◆ CMD_ENABLE

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_ENABLE = 'enable'
private

Definition at line 54 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

Referenced by executeCommand().

◆ CMD_GET_ASYNC_MODAL_OUTPUT

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_GET_ASYNC_MODAL_OUTPUT = 'getAsynchModalOutput'

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

Referenced by executeCommand().

◆ CMD_NEXT_STEP

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_NEXT_STEP = 'nextStep'

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

Referenced by executeCommand().

◆ CMD_PROFILE_NOT_PUBLIC

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_PROFILE_NOT_PUBLIC = 'profile_not_public'
private

Definition at line 56 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

Referenced by executeCommand().

◆ CMD_SAVE

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_SAVE = 'save'
private

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

Referenced by executeCommand().

◆ CMD_VIEW

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_VIEW = 'view'
private

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

Referenced by executeCommand().

◆ F_ORIGINAL_SOURCE_ID

const ilObjStudyProgrammeAutoMembershipsGUI::F_ORIGINAL_SOURCE_ID = 'f_sid_org'
private

◆ F_ORIGINAL_SOURCE_TYPE

const ilObjStudyProgrammeAutoMembershipsGUI::F_ORIGINAL_SOURCE_TYPE = 'f_st_org'
private

◆ F_SEARCH_RECURSIVE

const ilObjStudyProgrammeAutoMembershipsGUI::F_SEARCH_RECURSIVE = "f_search_recursive"
private

◆ F_SOURCE_ID

const ilObjStudyProgrammeAutoMembershipsGUI::F_SOURCE_ID = 'f_sid'
private

◆ F_SOURCE_TYPE

const ilObjStudyProgrammeAutoMembershipsGUI::F_SOURCE_TYPE = 'f_st'
private

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

Referenced by save().

◆ ROLEFOLDER_REF_ID

const ilObjStudyProgrammeAutoMembershipsGUI::ROLEFOLDER_REF_ID = 8
private

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