ILIAS  release_7 Revision v7.30-3-g800a261c036
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, ServerRequest $request, ilTree $tree)
 
 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...
 
 __storeEntries (&$new_res)
 

Data Fields

const ROLEFOLDER_REF_ID = 8
 
const CHECKBOX_SOURCE_IDS = 'c_amsids'
 
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'
 
 $tpl
 
 $ctrl
 
 $toolbar
 
 $lng
 
 $prg_ref_id
 
 $object
 
 $ui_factory
 
 $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, int $source_id=null)
 
 getSelectionForm (string $selected_source_type, string $selected_source, string $source_type=null, int $source_id=null)
 
 parseQueryString ($a_string, $a_combination_or=true, $a_ignore_length=false)
 
 getToolbar (\ILIAS\UI\Component\Signal $add_cat_signal)
 Setup toolbar. More...
 
 getItemAction (string $src_id, \ILIAS\UI\Component\Signal $signal, bool $is_enabled)
 
 getUserRepresentation (int $usr_id)
 
 getTitleRepresentation (ilStudyProgrammeAutoMembershipSource $ams)
 
 txt (string $code)
 

Protected Attributes

 $message_box_factory
 
 $button_factory
 
 $request
 
 $tree
 

Static Private Attributes

static $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,
ServerRequest  $request,
ilTree  $tree 
)

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

103 {
104 $this->tpl = $tpl;
105 $this->ctrl = $ilCtrl;
106 $this->toolbar = $ilToolbar;
107 $this->lng = $lng;
108 $this->ui_factory = $ui_factory;
109 $this->message_box_factory = $message_box_factory;
110 $this->button_factory = $button_factory;
111 $this->ui_renderer = $ui_renderer;
112 $this->request = $request;
113 $this->tree = $tree;
114
115 // Add this js manually here because the modal contains a form that is
116 // loaded asynchronously later on, and this JS won't be pulled then for
117 // some reason.
118 $tpl->addJavaScript("Services/Form/js/Form.js");
119 }

References $button_factory, $lng, $message_box_factory, $request, $tpl, $tree, $ui_factory, and $ui_renderer.

Member Function Documentation

◆ __storeEntries()

ilObjStudyProgrammeAutoMembershipsGUI::__storeEntries ( $new_res)

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

658 {
659 if ($this->stored == false) {
660 $this->result_obj->mergeEntries($new_res);
661 $this->stored = true;
662 return true;
663 } else {
664 $this->result_obj->intersectEntries($new_res);
665 return true;
666 }
667 }

◆ delete()

ilObjStudyProgrammeAutoMembershipsGUI::delete ( )
protected

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

312 {
314 $get = $this->request->getQueryParams();
315
316 if (!array_key_exists($field, $get)) {
317 ilUtil::sendFailure($this->lng->txt('prg_delete_failure'), true);
318 $this->ctrl->redirect($this, self::CMD_VIEW);
319 }
320
321 $type_ids = base64_decode($get[$field]);
322 $type_ids = explode(' ', trim($type_ids));
323
324 foreach ($type_ids as $src_id) {
325 [$type, $id] = explode('-', $src_id);
326 $this->getObject()->deleteAutomaticMembershipSource((string) $type, (int) $id);
327 }
328
329 $msg = $this->lng->txt('prg_delete_single_success');
330 if (count($type_ids) > 1) {
331 $msg = $this->lng->txt('prg_delete_success');
332 }
333
334 ilUtil::sendSuccess($msg, true);
335 $this->ctrl->redirect($this, self::CMD_VIEW);
336 }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$type

References $type, CHECKBOX_SOURCE_IDS, getObject(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ deleteConfirmation()

ilObjStudyProgrammeAutoMembershipsGUI::deleteConfirmation ( )
protected

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

275 {
276 $get = $this->request->getQueryParams();
277 $post = $this->request->getParsedBody();
279
280 $field_ids_in_get = array_key_exists($field, $get);
281 $field_ids_in_post = array_key_exists($field, $post);
282
283 if ($field_ids_in_get) {
284 $type_ids = $get[$field];
285 $msg = $this->lng->txt('prg_delete_single_confirmation');
286 } elseif ($field_ids_in_post) {
287 $type_ids = implode(' ', $post[$field]);
288 $msg = $this->lng->txt('prg_delete_confirmation');
289 } else {
290 ilUtil::sendInfo($this->lng->txt('prg_delete_nothing_selected'), true);
291 $this->ctrl->redirect($this, self::CMD_VIEW);
292 }
293
294 $type_ids = base64_encode($type_ids);
295
296 $this->ctrl->setParameterByClass(self::class, $field, $type_ids);
297 $delete = $this->ctrl->getFormActionByClass(self::class, self::CMD_DELETE);
298 $cancel = $this->ctrl->getFormActionByClass(self::class, self::CMD_VIEW);
299 $this->ctrl->clearParameterByClass(self::class, $field);
300
301 $buttons = [
302 $this->button_factory->standard($this->lng->txt('prg_confirm_delete'), $delete),
303 $this->button_factory->standard($this->lng->txt('prg_cancel'), $cancel)
304 ];
305
306 $message_box = $this->message_box_factory->confirmation($msg)->withButtons($buttons);
307
308 $this->tpl->setContent($this->ui_renderer->render($message_box));
309 }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References CHECKBOX_SOURCE_IDS, and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ disable()

ilObjStudyProgrammeAutoMembershipsGUI::disable ( )
protected

Disable single entry.

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

356 {
357 $get = $this->request->getQueryParams();
359 if (array_key_exists($field, $get)) {
360 [$type, $id] = explode('-', $get[$field]);
361 $this->getObject()->disableAutomaticMembershipSource((string) $type, (int) $id);
362 }
363 $this->ctrl->redirect($this, self::CMD_VIEW);
364 }

References $type, CHECKBOX_SOURCE_IDS, and getObject().

+ Here is the call graph for this function:

◆ enable()

ilObjStudyProgrammeAutoMembershipsGUI::enable ( )
protected

Enable single entry.

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

342 {
343 $get = $this->request->getQueryParams();
345 if (array_key_exists($field, $get)) {
346 [$type, $id] = explode('-', $get[$field]);
347 $this->getObject()->enableAutomaticMembershipSource((string) $type, (int) $id);
348 }
349 $this->ctrl->redirect($this, self::CMD_VIEW);
350 }

References $type, CHECKBOX_SOURCE_IDS, and getObject().

+ Here is the call graph for this function:

◆ executeCommand()

ilObjStudyProgrammeAutoMembershipsGUI::executeCommand ( )

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

121 {
122 $cmd = $this->ctrl->getCmd();
123 switch ($cmd) {
124 case self::CMD_VIEW:
125 case self::CMD_DELETE:
130 case self::CMD_SAVE:
131 $this->$cmd();
132 break;
133 case self::CMD_ENABLE:
134 $this->$cmd();
135 $this->ctrl->redirect($this, self::CMD_VIEW);
136 break;
138 $this->view(true);
139 break;
140 default:
141 throw new ilException(
142 "ilObjStudyProgrammeAutoMembershipsGUI: " .
143 "Command not supported: $cmd"
144 );
145 }
146 }
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, and view().

+ Here is the call graph for this function:

◆ getAsynchModalOutput()

ilObjStudyProgrammeAutoMembershipsGUI::getAsynchModalOutput ( )
protected

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

418 {
419 $current_src_type = null;
420 if (
421 array_key_exists(self::F_ORIGINAL_SOURCE_TYPE, $_GET) &&
422 !is_null($_GET[self::F_ORIGINAL_SOURCE_TYPE])
423 ) {
424 $current_src_type = $_GET[self::F_ORIGINAL_SOURCE_TYPE];
425 }
426 $current_src_id = null;
427 if (
428 array_key_exists(self::F_ORIGINAL_SOURCE_ID, $_GET) &&
429 !is_null($_GET[self::F_ORIGINAL_SOURCE_ID])
430 ) {
431 $current_src_id = (int) $_GET[self::F_ORIGINAL_SOURCE_ID];
432 }
433 $form = $this->getForm($current_src_type, $current_src_id);
434 $form_id = "form_" . $form->getId();
435
436 $modal = $this->ui_factory->modal()->roundtrip(
437 $this->txt('modal_member_auto_select_title'),
438 $this->ui_factory->legacy($form->getHtml())
439 );
440
441 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_TYPE, $current_src_type);
442 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_ID, $current_src_id);
443 $link = $this->ctrl->getLinkTarget($this, "nextStep", "", true);
444 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_TYPE, null);
445 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_ID, null);
446
447 $replaceSignal = $modal->getReplaceSignal();
448 $signal_id = $replaceSignal->getId();
449 $f_selected_type = self::F_SOURCE_TYPE;
450 $f_selected_id = self::F_SOURCE_ID;
451 $submit = $this->ui_factory->button()->primary($this->txt('search'), "#")->withOnLoadCode(
452 function ($id) use ($form_id, $link, $signal_id, $f_selected_type, $f_selected_id) {
453 return
454 "$('#{$id}').click(function() {
455 var checked = $(\"input[name='{$f_selected_type}']:checked\"). val();
456 if(checked == 'orgu' || typeof(checked) == \"undefined\") {
457 $('#{$form_id}').submit();
458 return false;
459 }
460
461 var i_value = $(\"input[name='{$f_selected_id}\" + checked + \"']\"). val();
462 if(i_value == '' || typeof(i_value) == \"undefined\") {
463 $('#{$form_id}').submit();
464 return false;
465 }
466
467 n_url = '{$link}' + '&{$f_selected_type}=' + checked + '&{$f_selected_id}=' + i_value;
468 $('#{$id}').attr(\"onclick\", function(event) {
469 $(this).trigger('{$signal_id}',
470 {
471 'id' : '{$signal_id}', 'event' : 'click',
472 'triggerer' : $(this),
473 'options' : JSON.parse('{\"url\":\"' + n_url + '\"}')
474 }
475 );
476 });
477 return false;
478 }
479 );"
480 ;
481 }
482 );
483
484 $modal = $modal->withActionButtons([$submit]);
485
486 echo $this->ui_renderer->renderAsync($modal);
487 exit;
488 }
$_GET["client_id"]
getForm(string $source_type=null, int $source_id=null)
exit
Definition: login.php:29

References $_GET, exit, F_ORIGINAL_SOURCE_TYPE, F_SOURCE_ID, F_SOURCE_TYPE, getForm(), and txt().

+ Here is the call graph for this function:

◆ getForm()

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

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

494 $form = new ilPropertyFormGUI();
495
496 if (is_null($source_type)) {
497 $source_type = "";
498 }
499 if (is_null($source_id)) {
500 $source_id = "";
501 }
502 $form->setId(uniqid((string) $source_type . (string) $source_id));
503 $form->setFormAction($this->ctrl->getFormAction($this, 'save'));
504
505 $rgroup = new ilRadioGroupInputGUI($this->txt('membership_source_type'), self::F_SOURCE_TYPE);
506 $rgroup->setValue($source_type);
507 $form->addItem($rgroup);
508
509 $radio_role = new ilRadioOption(
512 );
513
514 $ni_role = new ilTextInputGUI(
517 );
518 $radio_role->addSubItem($ni_role);
519 $rgroup->addOption($radio_role);
520
521 $radio_grp = new ilRadioOption(
524 );
525 $ni_grp = new ilTextInputGUI(
528 );
529 $radio_grp->addSubItem($ni_grp);
530 $rgroup->addOption($radio_grp);
531
532 $radio_crs = new ilRadioOption(
535 );
536 $ni_crs = new ilTextInputGUI(
539 );
540 $radio_crs->addSubItem($ni_crs);
541 $rgroup->addOption($radio_crs);
542
543 $radio_orgu = new ilRadioOption(
546 );
548 "",
550 false
551 );
552 $orgu->getExplorerGUI()->setSelectableTypes(["orgu"]);
553 $orgu->getExplorerGUI()->setTypeWhiteList(["root", "orgu"]);
554
555 $orgu->getExplorerGUI()->setRootId(ilObjOrgUnit::getRootOrgRefId());
556 $orgu->getExplorerGUI()->setAjax(false);
557 $radio_orgu->addSubItem($orgu);
558 $rgroup->addOption($radio_orgu);
559
560 if (
561 !is_null($source_type) &&
562 !is_null($source_id) &&
563 $source_type !== "" &&
564 $source_id !== ""
565 ) {
566 switch ($source_type) {
568 $ni_role->setValue($source_id);
569 break;
571 $ni_grp->setValue($source_id);
572 break;
574 $ni_crs->setValue($source_id);
575 break;
577 $orgu->setValue($source_id);
578 break;
579 default:
580 }
581 }
582
583 $hi = new ilHiddenInputGUI(self::F_ORIGINAL_SOURCE_TYPE);
584 $hi->setValue($source_type);
585 $form->addItem($hi);
586
587 $hi = new ilHiddenInputGUI(self::F_ORIGINAL_SOURCE_ID);
588 $hi->setValue($source_id);
589 $form->addItem($hi);
590
591 return $form;
592 }
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 getAsynchModalOutput(), and save().

+ Here is the caller graph for this function:

◆ getItemAction()

ilObjStudyProgrammeAutoMembershipsGUI::getItemAction ( string  $src_id,
\ILIAS\UI\Component\Signal  $signal,
bool  $is_enabled 
)
protected

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

686 $items = [];
687
688 $items[] = $this->ui_factory->button()->shy($this->txt('edit'), '')
689 ->withOnClick($signal);
690
691 $this->ctrl->setParameter($this, self::CHECKBOX_SOURCE_IDS, $src_id);
692
693 if ($is_enabled) {
694 $items[] = $this->ui_factory->button()->shy(
695 $this->txt('deactivate'),
696 $this->ctrl->getLinkTarget($this, self::CMD_DISABLE)
697 );
698 } else {
699 $items[] = $this->ui_factory->button()->shy(
700 $this->txt('activate'),
701 $this->ctrl->getLinkTarget($this, self::CMD_ENABLE)
702 );
703 }
704
705 $items[] = $this->ui_factory->button()->shy(
706 $this->txt('delete'),
707 $this->ctrl->getLinkTarget($this, self::CMD_DELETE_CONFIRMATION)
708 );
709
710 $this->ctrl->clearParameters($this);
711
712 $dd = $this->ui_factory->dropdown()->standard($items);
713 return $dd;
714 }
withOnClick(Signal $signal)
Get a component like this, triggering a signal of another component on click.
This describes a Standard Dropdown.
Definition: Standard.php:11

Referenced by view().

+ Here is the caller graph for this function:

◆ getModal()

ilObjStudyProgrammeAutoMembershipsGUI::getModal ( string  $source_type = null,
int  $source_id = null 
)
protected

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

400 {
401 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_TYPE, $source_type);
402 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_ID, $source_id);
403 $link = $this->ctrl->getLinkTarget($this, "getAsynchModalOutput", "", true);
404 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_TYPE, null);
405 $this->ctrl->setParameter($this, self::F_ORIGINAL_SOURCE_ID, null);
406
407 $modal = $this->ui_factory->modal()->roundtrip(
408 '',
409 []
410 )->withAsyncRenderUrl(
411 $link
412 );
413
414 return $modal;
415 }

Referenced by view().

+ Here is the caller graph for this function:

◆ getObject()

ilObjStudyProgrammeAutoMembershipsGUI::getObject ( )
protected

Get current StudyProgramme-object.

Returns
ilObjStudyProgramme

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

388 {
389 if ($this->object === null ||
390 (int) $this->object->getRefId() !== $this->prg_ref_id
391 ) {
392 $this->object = ilObjStudyProgramme::getInstanceByRefId($this->prg_ref_id);
393 }
394 return $this->object;
395 }
static getInstanceByRefId($a_ref_id)

References $object, and ilObjStudyProgramme\getInstanceByRefId().

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,
int  $source_id = null 
)
protected

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

600 $form = new ilPropertyFormGUI();
601 $form->setFormAction($this->ctrl->getFormAction($this, "save"));
602
603 $query_parser = $this->parseQueryString($selected_source);
604 include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
605 $object_search = new ilLikeObjectSearch($query_parser);
606 $object_search->setFilter(array($selected_source_type));
607 $entries = $object_search->performSearch()->getEntries();
608
609 $rgoup = new ilRadioGroupInputGUI(
610 $this->txt("prg_auto_member_select_" . $selected_source_type),
611 self::F_SOURCE_ID . $selected_source_type
612 );
613 $form->addItem($rgoup);
614 foreach ($entries as $entry) {
615 $obj_id = $entry['obj_id'];
616 $title = ilObject::_lookupTitle($obj_id);
617 $description = ilObject::_lookupDescription($obj_id);
618
619 $option = new ilRadioOption($title, $obj_id, $description);
620 $rgoup->addOption($option);
621 }
622
623 $hi = new ilHiddenInputGUI(self::F_ORIGINAL_SOURCE_TYPE);
624 $hi->setValue($source_type);
625 $form->addItem($hi);
626
627 $hi = new ilHiddenInputGUI(self::F_ORIGINAL_SOURCE_ID);
628 $hi->setValue($source_id);
629 $form->addItem($hi);
630
631 $hi = new ilHiddenInputGUI(self::F_SOURCE_TYPE);
632 $hi->setValue($selected_source_type);
633 $form->addItem($hi);
634
635 return $form;
636 }
parseQueryString($a_string, $a_combination_or=true, $a_ignore_length=false)
static _lookupTitle($a_id)
lookup object title
static _lookupDescription($a_id)
lookup object description

Referenced by nextStep().

+ Here is the caller graph for this function:

◆ getTitleRepresentation()

ilObjStudyProgrammeAutoMembershipsGUI::getTitleRepresentation ( ilStudyProgrammeAutoMembershipSource  $ams)
protected

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

737 $src_id = $ams->getSourceId();
738
739 $title = "";
740 $url = "";
741 switch ($ams->getSourceType()) {
743 $title = ilObjRole::_lookupTitle($src_id) ?? "-";
744 $this->ctrl->setParameterByClass('ilObjRoleGUI', 'obj_id', $src_id);
745 $this->ctrl->setParameterByClass('ilObjRoleGUI', 'ref_id', self::ROLEFOLDER_REF_ID);
746 $this->ctrl->setParameterByClass('ilObjRoleGUI', 'admin_mode', 'settings');
747 $url = $this->ctrl->getLinkTargetByClass(['ilAdministrationGUI', 'ilObjRoleGUI'], 'userassignment');
748 $this->ctrl->clearParametersByClass('ilObjRoleGUI');
749 break;
750
752 $url = ilLink::_getStaticLink($src_id, 'crs');
753 // no break
755 $url = ilLink::_getStaticLink($src_id, 'grp');
756 $hops = array_map(
757 function ($c) {
758 return ilObject::_lookupTitle($c["obj_id"]);
759 },
760 $this->tree->getPathFull($src_id)
761 );
762 $hops = array_slice($hops, 1);
763 $title = implode(' > ', $hops) ?? "-";
764 break;
765
767 $hops = array_map(
768 function ($c) {
769 return ilObject::_lookupTitle($c["obj_id"]);
770 },
771 $this->tree->getPathFull($src_id)
772 );
773 $hops = array_slice($hops, 3);
774 $title = implode(' > ', $hops) ?? "-";
775 $url = ilLink::_getStaticLink($src_id, $ams->getSourceType());
776 break;
777 default:
778 throw new \LogicException("This should not happen. Forgot a case in the switch?");
779 }
780
781 return $this->ui_factory->link()->standard($title, $url);
782 }
$c
Definition: cli.php:37
$url

References $c, $url, ilLink\_getStaticLink(), ilObject\_lookupTitle(), 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 ( \ILIAS\UI\Component\Signal  $add_cat_signal)
protected

Setup toolbar.

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

673 {
674 $btn = $this->ui_factory->button()->primary($this->txt('add_automembership_source'), '')
675 ->withOnClick($add_cat_signal);
676 $this->toolbar->addComponent($btn);
677 }

Referenced by view().

+ Here is the caller graph for this function:

◆ getUserRepresentation()

ilObjStudyProgrammeAutoMembershipsGUI::getUserRepresentation ( int  $usr_id)
protected

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

717 {
718 $username = ilObjUser::_lookupName($usr_id);
719 $editor = implode(' ', [
720 $username['firstname'],
721 $username['lastname'],
722 '(' . $username['login'] . ')'
723 ]);
725 $url = ilLink::_getStaticLink($usr_id, 'usr');
726
727 if (!$usr->hasPublicProfile()) {
728 $url = $this->ctrl->getLinkTarget($this, self::CMD_PROFILE_NOT_PUBLIC);
729 }
730 return $this->ui_factory->link()->standard($editor, $url);
731 }
static _lookupName($a_user_id)
lookup user name
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id

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

149 {
150 $current_src_type = null;
151 if (
152 array_key_exists(self::F_ORIGINAL_SOURCE_TYPE, $_GET) &&
153 !is_null($_GET[self::F_ORIGINAL_SOURCE_TYPE])
154 ) {
155 $current_src_type = $_GET[self::F_ORIGINAL_SOURCE_TYPE];
156 }
157 $current_src_id = null;
158 if (
159 array_key_exists(self::F_ORIGINAL_SOURCE_ID, $_GET) &&
160 !is_null($_GET[self::F_ORIGINAL_SOURCE_ID])
161 ) {
162 $current_src_id = (int) $_GET[self::F_ORIGINAL_SOURCE_ID];
163 }
164
165 $selected_src_type = $_GET[self::F_SOURCE_TYPE];
166 $selected_src = $_GET[self::F_SOURCE_ID];
167
168 $form = $this->getSelectionForm(
169 $selected_src_type,
170 $selected_src,
171 $current_src_type,
172 $current_src_id
173 );
174 $form_id = "form_" . $form->getId();
175
176 $modal = $this->ui_factory->modal()->roundtrip(
177 $this->txt('modal_member_auto_select_title'),
178 $this->ui_factory->legacy($form->getHtml())
179 );
180
181 $submit = $this->ui_factory->button()->primary($this->txt('add'), "#")->withOnLoadCode(
182 function ($id) use ($form_id) {
183 return "$('#{$id}').click(function() { $('#{$form_id}').submit(); return false; });";
184 }
185 );
186
187 $modal = $modal->withActionButtons([$submit]);
188
189 echo $this->ui_renderer->renderAsync($modal);
190 exit;
191 }
getSelectionForm(string $selected_source_type, string $selected_source, string $source_type=null, int $source_id=null)

References $_GET, exit, F_ORIGINAL_SOURCE_TYPE, F_SOURCE_ID, F_SOURCE_TYPE, getSelectionForm(), and txt().

+ Here is the call graph for this function:

◆ parseQueryString()

ilObjStudyProgrammeAutoMembershipsGUI::parseQueryString (   $a_string,
  $a_combination_or = true,
  $a_ignore_length = false 
)
protected

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

639 {
640 $query_parser = new ilQueryParser(ilUtil::stripSlashes($a_string));
641 $query_parser->setCombination(QP_COMBINATION_AND);
642 $query_parser->setMinWordLength(1);
643
644 // #17502
645 if (!(bool) $a_ignore_length) {
646 $query_parser->setGlobalMinLength(3); // #14768
647 }
648
649 $query_parser->parse();
650
651 if (!$query_parser->validate()) {
652 return $query_parser->getMessage();
653 }
654 return $query_parser;
655 }
const QP_COMBINATION_AND
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References QP_COMBINATION_AND, and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ save()

ilObjStudyProgrammeAutoMembershipsGUI::save ( )
protected

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

235 {
236 $form = $this->getForm();
237 $form->checkInput();
238 $form->setValuesByPost();
239
240 $post = $this->request->getParsedBody();
241 $src_type = $post[self::F_SOURCE_TYPE];
242 $src_id = $post[self::F_SOURCE_ID . $src_type];
243
244 if (
245 (is_null($src_type) || $src_type == "") ||
246 (is_null($src_id) || $src_id == 0)
247 ) {
248 ilUtil::sendFailure($this->txt('no_srctype_or_id'), true);
249 $this->ctrl->redirect($this, self::CMD_VIEW);
250 return;
251 }
252
253 if (in_array($src_type, self::$switch_to_ref_id)) {
254 $src_id = (int) array_shift(
256 );
257 }
258
259 if (
260 array_key_exists(self::F_ORIGINAL_SOURCE_TYPE, $post) &&
261 array_key_exists(self::F_ORIGINAL_SOURCE_ID, $post)
262 ) {
263 $this->getObject()->deleteAutomaticMembershipSource(
264 (string) $post[self::F_ORIGINAL_SOURCE_TYPE],
265 (int) $post[self::F_ORIGINAL_SOURCE_ID]
266 );
267 }
268
269 $this->getObject()->storeAutomaticMembershipSource($src_type, (int) $src_id);
270 ilUtil::sendSuccess($this->txt("auto_add_success"), true);
271 $this->ctrl->redirect($this, self::CMD_VIEW);
272 }
static _getAllReferences($a_id)
get all reference ids of object

References ilObject\_getAllReferences(), F_SOURCE_TYPE, getForm(), getObject(), ilUtil\sendFailure(), and txt().

+ Here is the call graph for this function:

◆ setParentGUI()

ilObjStudyProgrammeAutoMembershipsGUI::setParentGUI ( ilContainerGUI  $a_parent_gui)

Set this GUI's parent gui.

Parameters
ilContainerGUI$a_parent_gui

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

379 {
380 $this->parent_gui = $a_parent_gui;
381 }

◆ setRefId()

ilObjStudyProgrammeAutoMembershipsGUI::setRefId ( int  $prg_ref_id)

Set ref-id of StudyProgramme before using this GUI.

Parameters
int$prg_ref_id

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

References $prg_ref_id.

◆ txt()

ilObjStudyProgrammeAutoMembershipsGUI::txt ( string  $code)
protected

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

784 : string
785 {
786 return $this->lng->txt($code);
787 }

Referenced by getAsynchModalOutput(), nextStep(), and save().

+ Here is the caller graph for this function:

◆ view()

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

Render.

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

197 {
198 if ($profile_not_public) {
199 ilUtil::sendInfo($this->lng->txt('prg_profile_not_public'));
200 }
201 $collected_modals = [];
202 $modal = $this->getModal();
203 $this->getToolbar($modal->getShowSignal());
204 $collected_modals[] = $modal;
205 $data = [];
206 foreach ($this->getObject()->getAutomaticMembershipSources() as $ams) {
207 $title = $this->getTitleRepresentation($ams);
208 $usr = $this->getUserRepresentation($ams->getLastEditorId());
209 $modal = $this->getModal($ams->getSourceType(), $ams->getSourceId());
210 $collected_modals[] = $modal;
211
212 $src_id = $ams->getSourceType() . '-' . $ams->getSourceId();
213 $actions = $this->getItemAction(
214 $src_id,
215 $modal->getShowSignal(),
216 $ams->isEnabled()
217 );
218
219 $data[] = [
220 $ams,
221 $this->ui_renderer->render($title),
222 $this->ui_renderer->render($usr),
223 $this->ui_renderer->render($actions)
224 ];
225 }
226 $table = new ilStudyProgrammeAutoMembershipsTableGUI($this, "view", "");
227 $table->setData($data);
228 $this->tpl->setContent(
229 $this->ui_renderer->render($collected_modals)
230 . $table->getHTML()
231 );
232 }
getToolbar(\ILIAS\UI\Component\Signal $add_cat_signal)
Setup toolbar.
getModal(string $source_type=null, int $source_id=null)
getItemAction(string $src_id, \ILIAS\UI\Component\Signal $signal, bool $is_enabled)
getTitleRepresentation(ilStudyProgrammeAutoMembershipSource $ams)
$data
Definition: storeScorm.php:23

References $data, getItemAction(), getModal(), getObject(), getTitleRepresentation(), getToolbar(), getUserRepresentation(), and ilUtil\sendInfo().

Referenced by executeCommand().

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

Field Documentation

◆ $button_factory

ilObjStudyProgrammeAutoMembershipsGUI::$button_factory
protected

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

Referenced by __construct().

◆ $ctrl

ilObjStudyProgrammeAutoMembershipsGUI::$ctrl

◆ $lng

ilObjStudyProgrammeAutoMembershipsGUI::$lng

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

Referenced by __construct().

◆ $message_box_factory

ilObjStudyProgrammeAutoMembershipsGUI::$message_box_factory
protected

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

Referenced by __construct().

◆ $object

ilObjStudyProgrammeAutoMembershipsGUI::$object

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

Referenced by getObject().

◆ $prg_ref_id

ilObjStudyProgrammeAutoMembershipsGUI::$prg_ref_id

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

Referenced by setRefId().

◆ $request

ilObjStudyProgrammeAutoMembershipsGUI::$request
protected

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

Referenced by __construct().

◆ $switch_to_ref_id

ilObjStudyProgrammeAutoMembershipsGUI::$switch_to_ref_id
staticprivate

◆ $toolbar

ilObjStudyProgrammeAutoMembershipsGUI::$toolbar

◆ $tpl

ilObjStudyProgrammeAutoMembershipsGUI::$tpl

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

Referenced by __construct().

◆ $tree

ilObjStudyProgrammeAutoMembershipsGUI::$tree
protected

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

Referenced by __construct().

◆ $ui_factory

ilObjStudyProgrammeAutoMembershipsGUI::$ui_factory

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

Referenced by __construct().

◆ $ui_renderer

ilObjStudyProgrammeAutoMembershipsGUI::$ui_renderer

Definition at line 82 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'

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

Referenced by executeCommand().

◆ CMD_DELETE_CONFIRMATION

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_DELETE_CONFIRMATION = 'deleteConfirmation'

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

Referenced by executeCommand().

◆ CMD_DISABLE

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_DISABLE = 'disable'

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

Referenced by executeCommand().

◆ CMD_ENABLE

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_ENABLE = 'enable'

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

Referenced by executeCommand().

◆ CMD_GET_ASYNC_MODAL_OUTPUT

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_GET_ASYNC_MODAL_OUTPUT = 'getAsynchModalOutput'

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

Referenced by executeCommand().

◆ CMD_NEXT_STEP

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_NEXT_STEP = 'nextStep'

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

Referenced by executeCommand().

◆ CMD_PROFILE_NOT_PUBLIC

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_PROFILE_NOT_PUBLIC = 'profile_not_public'

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

Referenced by executeCommand().

◆ CMD_SAVE

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_SAVE = 'save'

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

Referenced by executeCommand().

◆ CMD_VIEW

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_VIEW = 'view'

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

Referenced by executeCommand().

◆ F_ORIGINAL_SOURCE_ID

const ilObjStudyProgrammeAutoMembershipsGUI::F_ORIGINAL_SOURCE_ID = 'f_sid_org'

◆ F_ORIGINAL_SOURCE_TYPE

const ilObjStudyProgrammeAutoMembershipsGUI::F_ORIGINAL_SOURCE_TYPE = 'f_st_org'

◆ F_SOURCE_ID

const ilObjStudyProgrammeAutoMembershipsGUI::F_SOURCE_ID = 'f_sid'

◆ F_SOURCE_TYPE

const ilObjStudyProgrammeAutoMembershipsGUI::F_SOURCE_TYPE = 'f_st'

◆ ROLEFOLDER_REF_ID

const ilObjStudyProgrammeAutoMembershipsGUI::ROLEFOLDER_REF_ID = 8

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