ILIAS  release_8 Revision v8.24
ilObjStudyProgrammeAutoMembershipsGUI Class Reference

Class ilObjStudyProgrammeAutoMembershipsGUI. More...

+ Collaboration diagram for ilObjStudyProgrammeAutoMembershipsGUI:

Public Member Functions

 __construct (ilGlobalTemplateInterface $tpl, ilCtrl $ilCtrl, ilToolbarGUI $ilToolbar, ilLanguage $lng, Factory $ui_factory, MessageBox\Factory $message_box_factory, Button\Factory $button_factory, Renderer $ui_renderer, Psr\Http\Message\ServerRequestInterface $request, ilTree $tree, ILIAS\HTTP\Wrapper\RequestWrapper $request_wrapper, ILIAS\Refinery\Factory $refinery)
 
 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'
 
ilGlobalTemplateInterface $tpl
 
ilCtrl $ctrl
 
ilToolbarGUI $toolbar
 
ilLanguage $lng
 
int $prg_ref_id
 
ilObjStudyProgramme $object = null
 
ILIAS UI Factory $ui_factory
 
ILIAS UI Renderer $ui_renderer
 

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)
 
 getAsynchModalOutput ()
 
 getForm (string $source_type=null, ?string $source_id='')
 
 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

MessageBox Factory $message_box_factory
 
Button Factory $button_factory
 
Psr Http Message ServerRequestInterface $request
 
ilTree $tree
 
ILIAS HTTP Wrapper RequestWrapper $request_wrapper
 
ILIAS Refinery Factory $refinery
 
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 CMD_VIEW = 'view'
 
const CMD_SAVE = 'save'
 
const CMD_DELETE = 'delete'
 
const CMD_DELETE_CONFIRMATION = 'deleteConfirmation'
 
const CMD_GET_ASYNC_MODAL_OUTPUT = 'getAsynchModalOutput'
 
const CMD_NEXT_STEP = 'nextStep'
 
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 ( ilGlobalTemplateInterface  $tpl,
ilCtrl  $ilCtrl,
ilToolbarGUI  $ilToolbar,
ilLanguage  $lng,
Factory  $ui_factory,
MessageBox\Factory  $message_box_factory,
Button\Factory  $button_factory,
Renderer  $ui_renderer,
Psr\Http\Message\ServerRequestInterface  $request,
ilTree  $tree,
ILIAS\HTTP\Wrapper\RequestWrapper  $request_wrapper,
ILIAS\Refinery\Factory  $refinery 
)

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

91 {
92 $this->tpl = $tpl;
93 $this->ctrl = $ilCtrl;
94 $this->toolbar = $ilToolbar;
95 $this->lng = $lng;
96 $this->ui_factory = $ui_factory;
97 $this->message_box_factory = $message_box_factory;
98 $this->button_factory = $button_factory;
99 $this->ui_renderer = $ui_renderer;
100 $this->request = $request;
101 $this->tree = $tree;
102 $this->request_wrapper = $request_wrapper;
103 $this->refinery = $refinery;
104
105 // Add this js manually here because the modal contains a form that is
106 // loaded asynchronously later on, and this JS won't be pulled then for
107 // some reason.
108 $tpl->addJavaScript("Services/Form/js/Form.js");
109 }
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.

References $button_factory, $lng, $message_box_factory, $refinery, $request, $request_wrapper, $tpl, $tree, $ui_factory, $ui_renderer, ilGlobalTemplateInterface\addJavaScript(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

Member Function Documentation

◆ delete()

ilObjStudyProgrammeAutoMembershipsGUI::delete ( )
protected

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

300 : void
301 {
303 $get = $this->request->getQueryParams();
304
305 if (!array_key_exists($field, $get)) {
306 $this->tpl->setOnScreenMessage("failure", $this->lng->txt('prg_delete_failure'), true);
307 $this->ctrl->redirect($this, self::CMD_VIEW);
308 }
309
310 $type_ids = base64_decode($get[$field]);
311 $type_ids = explode(' ', trim($type_ids));
312
313 foreach ($type_ids as $src_id) {
314 [$type, $id] = explode('-', $src_id);
315 $this->getObject()->deleteAutomaticMembershipSource((string) $type, (int) $id);
316 }
317
318 $msg = $this->lng->txt('prg_delete_single_success');
319 if (count($type_ids) > 1) {
320 $msg = $this->lng->txt('prg_delete_success');
321 }
322
323 $this->tpl->setOnScreenMessage("success", $msg, true);
324 $this->ctrl->redirect($this, self::CMD_VIEW);
325 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$type

References $id, $type, 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 261 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

261 : void
262 {
263 $get = $this->request->getQueryParams();
264 $post = $this->request->getParsedBody();
266
267 $field_ids_in_get = array_key_exists($field, $get);
268 $field_ids_in_post = array_key_exists($field, $post);
269
270 $type_ids = '';
271 $msg = '';
272 if ($field_ids_in_get) {
273 $type_ids = $get[$field];
274 $msg = $this->lng->txt('prg_delete_single_confirmation');
275 } elseif ($field_ids_in_post) {
276 $type_ids = implode(' ', $post[$field]);
277 $msg = $this->lng->txt('prg_delete_confirmation');
278 } else {
279 $this->tpl->setOnScreenMessage("info", $this->lng->txt('prg_delete_nothing_selected'), true);
280 $this->ctrl->redirect($this, self::CMD_VIEW);
281 }
282
283 $type_ids = base64_encode($type_ids);
284
285 $this->ctrl->setParameterByClass(self::class, $field, $type_ids);
286 $delete = $this->ctrl->getFormActionByClass(self::class, self::CMD_DELETE);
287 $cancel = $this->ctrl->getFormActionByClass(self::class, self::CMD_VIEW);
288 $this->ctrl->clearParameterByClass(self::class, $field);
289
290 $buttons = [
291 $this->button_factory->standard($this->lng->txt('prg_confirm_delete'), $delete),
292 $this->button_factory->standard($this->lng->txt('prg_cancel'), $cancel)
293 ];
294
295 $message_box = $this->message_box_factory->confirmation($msg)->withButtons($buttons);
296
297 $this->tpl->setContent($this->ui_renderer->render($message_box));
298 }
$post
Definition: ltitoken.php:49

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 344 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

344 : void
345 {
346 $get = $this->request->getQueryParams();
348 if (array_key_exists($field, $get)) {
349 [$type, $id] = explode('-', $get[$field]);
350 $this->getObject()->disableAutomaticMembershipSource((string) $type, (int) $id);
351 }
352 $this->ctrl->redirect($this, self::CMD_VIEW);
353 }

References $id, $type, 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 330 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

330 : void
331 {
332 $get = $this->request->getQueryParams();
334 if (array_key_exists($field, $get)) {
335 [$type, $id] = explode('-', $get[$field]);
336 $this->getObject()->enableAutomaticMembershipSource((string) $type, (int) $id);
337 }
338 $this->ctrl->redirect($this, self::CMD_VIEW);
339 }

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

+ Here is the call graph for this function:

◆ executeCommand()

ilObjStudyProgrammeAutoMembershipsGUI::executeCommand ( )

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

110 : void
111 {
112 $cmd = $this->ctrl->getCmd();
113 switch ($cmd) {
114 case self::CMD_VIEW:
115 case self::CMD_DELETE:
120 case self::CMD_SAVE:
121 $this->$cmd();
122 break;
123 case self::CMD_ENABLE:
124 $this->$cmd();
125 $this->ctrl->redirect($this, self::CMD_VIEW);
126 break;
128 $this->view(true);
129 break;
130 default:
131 throw new ilException("ilObjStudyProgrammeAutoMembershipsGUI: Command not supported: $cmd");
132 }
133 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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 399 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

399 : void
400 {
401 $current_src_type = null;
402 if ($this->request_wrapper->has(self::F_ORIGINAL_SOURCE_TYPE)) {
403 $current_src_type = $this->request_wrapper->retrieve(
404 self::F_ORIGINAL_SOURCE_TYPE,
405 $this->refinery->to()->string()
406 );
407 }
408
409 $current_src_id = null;
410 if ($this->request_wrapper->has(self::F_ORIGINAL_SOURCE_ID)) {
411 $current_src_id = $this->request_wrapper->retrieve(self::F_ORIGINAL_SOURCE_ID, $this->refinery->to()->string());
412 }
413
414 $form = $this->getForm($current_src_type, $current_src_id);
415 $form_id = "form_" . $form->getId();
416
417 $modal = $this->ui_factory->modal()->roundtrip(
418 $this->txt('modal_member_auto_select_title'),
419 $this->ui_factory->legacy($form->getHtml())
420 );
421
422 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_TYPE, $current_src_type);
423 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_ID, $current_src_id);
424 $link = $this->ctrl->getLinkTarget($this, "nextStep", "", true);
425 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_TYPE, null);
426 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_ID, null);
427
428 $replaceSignal = $modal->getReplaceSignal();
429 $signal_id = $replaceSignal->getId();
430 $f_selected_type = self::F_SOURCE_TYPE;
431 $f_selected_id = self::F_SOURCE_ID;
432 $submit = $this->ui_factory->button()->primary($this->txt('search'), "#")
433 ->withOnLoadCode(
434 function ($id) use ($form_id, $link, $signal_id, $f_selected_type, $f_selected_id) {
435 return
436 "$('#$id').click(function() {
437
438 var checked = $(\"input[name='$f_selected_type']:checked\"). val();
439 if(checked == 'orgu' || typeof(checked) == \"undefined\") {
440 console.log('$(\'#$form_id\').submit()');
441 document.getElementById('$form_id').submit();
442 return false;
443 }
444
445 var i_value = $(\"input[name='$f_selected_id\" + checked + \"']\"). val();
446 if(i_value == '' || typeof(i_value) == \"undefined\") {
447 document.getElementById('$form_id').submit();
448 return false;
449 }
450
451 n_url = '$link' + '&$f_selected_type=' + checked + '&$f_selected_id=' + i_value;
452 $('#$id').attr(\"onclick\", function(event) {
453 $(this).trigger('$signal_id',
454 {
455 'id' : '$signal_id', 'event' : 'click',
456 'triggerer' : $(this),
457 'options' : JSON.parse('{\"url\":\"' + n_url + '\"}')
458 }
459 );
460 });
461 return false;
462 }
463 );";
464 }
465 );
466
467 $modal = $modal->withActionButtons([$submit])
468 ->withAdditionalOnLoadCode(
469 function ($id) use ($form) {
470 $selector_post_var = self::F_SOURCE_ID . ilStudyProgrammeAutoMembershipSource::TYPE_ORGU;
471 $js = $form->getItemByPostVar($selector_post_var)->getOnloadCode();
472 return implode(';', $js);
473 }
474 );
475
476 echo $this->ui_renderer->renderAsync($modal);
477 exit;
478 }
getForm(string $source_type=null, ?string $source_id='')
exit
Definition: login.php:28

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

+ Here is the call graph for this function:

◆ getForm()

ilObjStudyProgrammeAutoMembershipsGUI::getForm ( string  $source_type = null,
?string  $source_id = '' 
)
protected

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

481 {
482 $form = new ilPropertyFormGUI();
483
484 if (is_null($source_type)) {
485 $source_type = "";
486 }
487
488 $form->setId(uniqid($source_type . $source_id, true));
489 $form->setFormAction($this->ctrl->getFormAction($this, 'save'));
490
491 $rgroup = new ilRadioGroupInputGUI($this->txt('membership_source_type'), self::F_SOURCE_TYPE);
492 $rgroup->setValue($source_type);
493 $form->addItem($rgroup);
494
495 $radio_role = new ilRadioOption(
498 );
499
500 $ni_role = new ilTextInputGUI(
503 );
504 $radio_role->addSubItem($ni_role);
505 $rgroup->addOption($radio_role);
506
507 $radio_grp = new ilRadioOption(
510 );
511 $ni_grp = new ilTextInputGUI(
514 );
515 $radio_grp->addSubItem($ni_grp);
516 $rgroup->addOption($radio_grp);
517
518 $radio_crs = new ilRadioOption(
521 );
522 $ni_crs = new ilTextInputGUI(
525 );
526 $radio_crs->addSubItem($ni_crs);
527 $rgroup->addOption($radio_crs);
528
529 $radio_orgu = new ilRadioOption(
532 );
534 "",
536 false,
537 $this
538 );
539 $orgu->getExplorerGUI()->setSelectableTypes(["orgu"]);
540 $orgu->getExplorerGUI()->setTypeWhiteList(["root", "orgu"]);
541 $orgu->getExplorerGUI()->setRootId(ilObjOrgUnit::getRootOrgRefId());
542 $orgu->getExplorerGUI()->setAjax(false);
543 $radio_orgu->addSubItem($orgu);
544 $rgroup->addOption($radio_orgu);
545 if (
546 !is_null($source_type) &&
547 !is_null($source_id) &&
548 $source_type !== "" &&
549 $source_id !== ""
550 ) {
551 switch ($source_type) {
553 $ni_role->setValue($source_id);
554 break;
556 $ni_grp->setValue($source_id);
557 break;
559 $ni_crs->setValue($source_id);
560 break;
562 $orgu->setValue($source_id);
563 break;
564 default:
565 }
566 }
567
568 $hi = new ilHiddenInputGUI(self::F_ORIGINAL_SOURCE_TYPE);
569 $hi->setValue($source_type);
570 $form->addItem($hi);
571
572 $hi = new ilHiddenInputGUI(self::F_ORIGINAL_SOURCE_ID);
573 $hi->setValue($source_id ?? '');
574 $form->addItem($hi);
575
576 return $form;
577 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getRootOrgRefId()
This class represents a property form user interface.
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text property in a property form.

References ILIAS\Repository\ctrl(), ilObjOrgUnit\getRootOrgRefId(), txt(), ilStudyProgrammeAutoMembershipSource\TYPE_COURSE, ilStudyProgrammeAutoMembershipSource\TYPE_GROUP, ilStudyProgrammeAutoMembershipSource\TYPE_ORGU, and ilStudyProgrammeAutoMembershipSource\TYPE_ROLE.

Referenced by getAsynchModalOutput(), and save().

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

◆ getItemAction()

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

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

655 : Dropdown\Standard {
656 $items = [];
657
658 $items[] = $this->ui_factory->button()->shy($this->txt('edit'), '')
659 ->withOnClick($signal);
660
661 $this->ctrl->setParameter($this, self::CHECKBOX_SOURCE_IDS, $src_id);
662
663 if ($is_enabled) {
664 $items[] = $this->ui_factory->button()->shy(
665 $this->txt('deactivate'),
666 $this->ctrl->getLinkTarget($this, self::CMD_DISABLE)
667 );
668 } else {
669 $items[] = $this->ui_factory->button()->shy(
670 $this->txt('activate'),
671 $this->ctrl->getLinkTarget($this, self::CMD_ENABLE)
672 );
673 }
674
675 $items[] = $this->ui_factory->button()->shy(
676 $this->txt('delete'),
677 $this->ctrl->getLinkTarget($this, self::CMD_DELETE_CONFIRMATION)
678 );
679
680 $this->ctrl->clearParameters($this);
681
682 return $this->ui_factory->dropdown()->standard($items);
683 }

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 
)
protected

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

384 : RoundTrip
385 {
386 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_TYPE, $source_type);
387 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_ID, $source_id);
388 $link = $this->ctrl->getLinkTarget($this, "getAsynchModalOutput", "", true);
389 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_TYPE, null);
390 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_ID, null);
391
392 return $this->ui_factory->modal()->roundtrip(
393 '',
394 []
395 )
396 ->withAsyncRenderUrl($link);
397 }

References ILIAS\Repository\ctrl().

Referenced by view().

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

◆ getObject()

ilObjStudyProgrammeAutoMembershipsGUI::getObject ( )
protected

Get current StudyProgramme-object.

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

375 {
376 if ($this->object === null ||
377 $this->object->getRefId() !== $this->prg_ref_id
378 ) {
379 $this->object = ilObjStudyProgramme::getInstanceByRefId($this->prg_ref_id);
380 }
381 return $this->object;
382 }

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 579 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

585 $form = new ilPropertyFormGUI();
586 $form->setFormAction($this->ctrl->getFormAction($this, "save"));
587
588 $query_parser = $this->parseQueryString($selected_source);
589 $object_search = new ilLikeObjectSearch($query_parser);
590 $object_search->setFilter(array($selected_source_type));
591 $entries = $object_search->performSearch()->getEntries();
592
593 $rgoup = new ilRadioGroupInputGUI(
594 $this->txt("prg_auto_member_select_" . $selected_source_type),
595 self::F_SOURCE_ID . $selected_source_type
596 );
597 $form->addItem($rgoup);
598 foreach ($entries as $entry) {
599 $obj_id = (int) $entry['obj_id'];
600 $title = ilObject::_lookupTitle($obj_id);
601 $description = ilObject::_lookupDescription($obj_id);
602
603 $option = new ilRadioOption($title, (string) $obj_id, $description);
604 $rgoup->addOption($option);
605 }
606
607 $hi = new ilHiddenInputGUI(self::F_ORIGINAL_SOURCE_TYPE);
608 $hi->setValue($source_type ?? '');
609 $form->addItem($hi);
610
611 $hi = new ilHiddenInputGUI(self::F_ORIGINAL_SOURCE_ID);
612 $hi->setValue((string) $source_id);
613 $form->addItem($hi);
614
615 $hi = new ilHiddenInputGUI(self::F_SOURCE_TYPE);
616 $hi->setValue($selected_source_type);
617 $form->addItem($hi);
618
619 return $form;
620 }
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 $this->ctrl->setParameterByClass('ilObjRoleGUI', 'obj_id', $src_id);
712 $this->ctrl->setParameterByClass('ilObjRoleGUI', 'ref_id', self::ROLEFOLDER_REF_ID);
713 $this->ctrl->setParameterByClass('ilObjRoleGUI', 'admin_mode', 'settings');
714 $url = $this->ctrl->getLinkTargetByClass(['ilAdministrationGUI', 'ilObjRoleGUI'], 'userassignment');
715 $this->ctrl->clearParametersByClass('ilObjRoleGUI');
716 break;
717
719 $url = ilLink::_getStaticLink($src_id, 'crs');
720 // no break
722 $url = ilLink::_getStaticLink($src_id, 'grp');
723 $hops = array_map(
724 static function (array $c): string {
725 return ilObject::_lookupTitle((int) $c["obj_id"]);
726 },
727 $this->tree->getPathFull($src_id)
728 );
729 $hops = array_slice($hops, 1);
730 $title = implode(' > ', $hops) ?? "-";
731 break;
732
734 $hops = array_map(
735 static function (array $c): string {
736 return ilObject::_lookupTitle((int)$c["obj_id"]);
737 },
738 $this->tree->getPathFull($src_id)
739 );
740 $hops = array_slice($hops, 3);
741 $title = implode(' > ', $hops) ?? "-";
742 $url = ilLink::_getStaticLink($src_id, $ams->getSourceType());
743 break;
744 default:
745 throw new LogicException("This should not happen. Forgot a case in the switch?");
746 }
747
748 return $this->ui_factory->link()->standard($title, $url);
749 }
$c
Definition: cli.php:38
$url

References $c, $url, ilLink\_getStaticLink(), ilObject\_lookupTitle(), 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 642 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

642 : void
643 {
644 $btn = $this->ui_factory->button()->primary($this->txt('add_automembership_source'), '')
645 ->withOnClick($add_cat_signal);
646 $this->toolbar->addComponent($btn);
647 }

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 685 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

685 : Link\Standard
686 {
687 $username = ilObjUser::_lookupName($usr_id);
688 $editor = implode(' ', [
689 $username['firstname'],
690 $username['lastname'],
691 '(' . $username['login'] . ')'
692 ]);
694 $url = ilLink::_getStaticLink($usr_id, 'usr');
695
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)
lookup user name
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id

References $url, ilLink\_getStaticLink(), 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 135 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

135 : void
136 {
137 $current_src_type = null;
138 if ($this->request_wrapper->has(self::F_ORIGINAL_SOURCE_TYPE)) {
139 $current_src_type = $this->request_wrapper->retrieve(
140 self::F_ORIGINAL_SOURCE_TYPE,
141 $this->refinery->to()->string()
142 );
143 }
144
145 $current_src_id = null;
146 if ($this->request_wrapper->has(self::F_ORIGINAL_SOURCE_ID)) {
147 $current_src_id = $this->request_wrapper->retrieve(
148 self::F_ORIGINAL_SOURCE_ID,
149 $this->refinery->to()->string()
150 );
151 }
152
153 $selected_src_type = $this->request_wrapper->retrieve(self::F_SOURCE_TYPE, $this->refinery->kindlyTo()->string());
154 $selected_src = $this->request_wrapper->retrieve(self::F_SOURCE_ID, $this->refinery->kindlyTo()->string());
155
156 $form = $this->getSelectionForm(
157 $selected_src_type,
158 $selected_src,
159 $current_src_type,
160 $current_src_id
161 );
162 $form_id = "form_" . $form->getId();
163
164 $modal = $this->ui_factory->modal()->roundtrip(
165 $this->txt('modal_member_auto_select_title'),
166 $this->ui_factory->legacy($form->getHtml())
167 );
168
169 $submit = $this->ui_factory->button()->primary($this->txt('add'), "#")->withOnLoadCode(
170 function ($id) use ($form_id) {
171 return "$('#$id').click(function() { $('#$form_id').submit(); return false; });";
172 }
173 );
174
175 $modal = $modal->withActionButtons([$submit]);
176
177 echo $this->ui_renderer->renderAsync($modal);
178 exit;
179 }
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 625 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

626 {
627 $query_parser = new ilQueryParser(ilUtil::stripSlashes($string));
628 $query_parser->setCombination(ilQueryParser::QP_COMBINATION_AND);
629 $query_parser->setMinWordLength(1);
630 $query_parser->setGlobalMinLength(3); // #14768
631 $query_parser->parse();
632
633 if (!$query_parser->validate()) {
634 return $query_parser->getMessage();
635 }
636 return $query_parser;
637 }
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 222 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

222 : void
223 {
224 $form = $this->getForm();
225 $form->checkInput();
226
227 $post = $this->request->getParsedBody();
228 $form->setValuesByArray($post);
229 $src_type = $post[self::F_SOURCE_TYPE];
230 $src_id = $post[self::F_SOURCE_ID . $src_type];
231
232 if (
233 (is_null($src_type) || $src_type === "") ||
234 (is_null($src_id) || $src_id === 0)
235 ) {
236 $this->tpl->setOnScreenMessage("failure", $this->txt('no_srctype_or_id'), true);
237 $this->ctrl->redirect($this, self::CMD_VIEW);
238 return;
239 }
240
241 if (in_array($src_type, self::$switch_to_ref_id)) {
242 $refs = ilObject::_getAllReferences((int) $src_id);
243 $src_id = (int) array_shift($refs);
244 }
245
246 if (
247 array_key_exists(self::F_ORIGINAL_SOURCE_TYPE, $post) &&
248 array_key_exists(self::F_ORIGINAL_SOURCE_ID, $post)
249 ) {
250 $this->getObject()->deleteAutomaticMembershipSource(
251 (string) $post[self::F_ORIGINAL_SOURCE_TYPE],
252 (int) $post[self::F_ORIGINAL_SOURCE_ID]
253 );
254 }
255
256 $this->getObject()->storeAutomaticMembershipSource($src_type, (int) $src_id);
257 $this->tpl->setOnScreenMessage("success", $this->txt("auto_add_success"), true);
258 $this->ctrl->redirect($this, self::CMD_VIEW);
259 }
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 366 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

366 : void
367 {
368 $this->parent_gui = $a_parent_gui;
369 }

◆ setRefId()

ilObjStudyProgrammeAutoMembershipsGUI::setRefId ( int  $prg_ref_id)

Set ref-id of StudyProgramme before using this GUI.

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

358 : void
359 {
360 $this->prg_ref_id = $prg_ref_id;
361 }

References $prg_ref_id.

◆ txt()

ilObjStudyProgrammeAutoMembershipsGUI::txt ( string  $code)
protected

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

751 : string
752 {
753 return $this->lng->txt($code);
754 }

References ILIAS\Repository\lng().

Referenced by getAsynchModalOutput(), getForm(), 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 184 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

184 : void
185 {
186 if ($profile_not_public) {
187 $this->tpl->setOnScreenMessage("info", $this->lng->txt('prg_profile_not_public'));
188 }
189 $collected_modals = [];
190 $modal = $this->getModal();
191 $this->getToolbar($modal->getShowSignal());
192 $collected_modals[] = $modal;
193 $data = [];
194 foreach ($this->getObject()->getAutomaticMembershipSources() as $ams) {
195 $title = $this->getTitleRepresentation($ams);
196 $usr = $this->getUserRepresentation($ams->getLastEditorId());
197 $modal = $this->getModal($ams->getSourceType(), $ams->getSourceId());
198 $collected_modals[] = $modal;
199
200 $src_id = $ams->getSourceType() . '-' . $ams->getSourceId();
201 $actions = $this->getItemAction(
202 $src_id,
203 $modal->getShowSignal(),
204 $ams->isEnabled()
205 );
206
207 $data[] = [
208 $ams,
209 $this->ui_renderer->render($title),
210 $this->ui_renderer->render($usr),
211 $this->ui_renderer->render($actions)
212 ];
213 }
214 $table = new ilStudyProgrammeAutoMembershipsTableGUI($this, "view", "");
215 $table->setData($data);
216 $this->tpl->setContent(
217 $this->ui_renderer->render($collected_modals)
218 . $table->getHTML()
219 );
220 }
getModal(string $source_type=null, int $source_id=null)
getTitleRepresentation(ilStudyProgrammeAutoMembershipSource $ams)
getItemAction(string $src_id, Signal $signal, bool $is_enabled)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

◆ $button_factory

Button Factory ilObjStudyProgrammeAutoMembershipsGUI::$button_factory
protected

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

Referenced by __construct().

◆ $ctrl

ilCtrl ilObjStudyProgrammeAutoMembershipsGUI::$ctrl

◆ $lng

ilLanguage ilObjStudyProgrammeAutoMembershipsGUI::$lng

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

Referenced by __construct().

◆ $message_box_factory

MessageBox Factory ilObjStudyProgrammeAutoMembershipsGUI::$message_box_factory
protected

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

Referenced by __construct().

◆ $object

ilObjStudyProgramme ilObjStudyProgrammeAutoMembershipsGUI::$object = null

Definition at line 67 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 66 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

Referenced by setRefId().

◆ $refinery

ILIAS Refinery Factory ilObjStudyProgrammeAutoMembershipsGUI::$refinery
protected

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

Referenced by __construct().

◆ $request

Psr Http Message ServerRequestInterface ilObjStudyProgrammeAutoMembershipsGUI::$request
protected

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

Referenced by __construct().

◆ $request_wrapper

ILIAS HTTP Wrapper RequestWrapper ilObjStudyProgrammeAutoMembershipsGUI::$request_wrapper
protected

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

Referenced by __construct().

◆ $switch_to_ref_id

array ilObjStudyProgrammeAutoMembershipsGUI::$switch_to_ref_id
staticprivate

◆ $toolbar

ilToolbarGUI ilObjStudyProgrammeAutoMembershipsGUI::$toolbar

◆ $tpl

ilGlobalTemplateInterface ilObjStudyProgrammeAutoMembershipsGUI::$tpl

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

Referenced by __construct().

◆ $tree

ilTree ilObjStudyProgrammeAutoMembershipsGUI::$tree
protected

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

Referenced by __construct().

◆ $ui_factory

ILIAS UI Factory ilObjStudyProgrammeAutoMembershipsGUI::$ui_factory

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

Referenced by __construct().

◆ $ui_renderer

ILIAS UI Renderer ilObjStudyProgrammeAutoMembershipsGUI::$ui_renderer

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

Referenced by __construct().

◆ CHECKBOX_SOURCE_IDS

const ilObjStudyProgrammeAutoMembershipsGUI::CHECKBOX_SOURCE_IDS = 'c_amsids'

◆ CMD_DELETE

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_DELETE = 'delete'
private

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

Referenced by executeCommand().

◆ CMD_DELETE_CONFIRMATION

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_DELETE_CONFIRMATION = 'deleteConfirmation'
private

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

Referenced by executeCommand().

◆ CMD_DISABLE

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_DISABLE = 'disable'
private

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

Referenced by executeCommand().

◆ CMD_ENABLE

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_ENABLE = 'enable'
private

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

Referenced by executeCommand().

◆ CMD_GET_ASYNC_MODAL_OUTPUT

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_GET_ASYNC_MODAL_OUTPUT = 'getAsynchModalOutput'
private

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

Referenced by executeCommand().

◆ CMD_NEXT_STEP

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_NEXT_STEP = 'nextStep'
private

Definition at line 52 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 55 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

Referenced by executeCommand().

◆ CMD_SAVE

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_SAVE = 'save'
private

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

Referenced by executeCommand().

◆ CMD_VIEW

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_VIEW = 'view'
private

Definition at line 47 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_SOURCE_ID

const ilObjStudyProgrammeAutoMembershipsGUI::F_SOURCE_ID = 'f_sid'
private

◆ F_SOURCE_TYPE

const ilObjStudyProgrammeAutoMembershipsGUI::F_SOURCE_TYPE = 'f_st'
private

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

Referenced by getAsynchModalOutput(), and save().

◆ ROLEFOLDER_REF_ID

const ilObjStudyProgrammeAutoMembershipsGUI::ROLEFOLDER_REF_ID = 8
private

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