ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

References $button_factory, $ilCtrl, $lng, $message_box_factory, $request, $tpl, $tree, $ui_factory, $ui_renderer, and ilGlobalTemplateInterface\addJavaScript().

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  }
global $ilCtrl
Definition: ilias.php:18
addJavaScript($a_js_file, $a_add_version_parameter=true, $a_batch=2)
Add a javascript file that should be included in the header.
+ Here is the call graph for this function:

Member Function Documentation

◆ __storeEntries()

ilObjStudyProgrammeAutoMembershipsGUI::__storeEntries ( $new_res)

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

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

◆ delete()

ilObjStudyProgrammeAutoMembershipsGUI::delete ( )
protected

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

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

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

◆ deleteConfirmation()

ilObjStudyProgrammeAutoMembershipsGUI::deleteConfirmation ( )
protected

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

References ilUtil\sendInfo().

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

◆ disable()

ilObjStudyProgrammeAutoMembershipsGUI::disable ( )
protected

Disable single entry.

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

References $type, and getObject().

355  {
356  $get = $this->request->getQueryParams();
357  $field = self::CHECKBOX_SOURCE_IDS;
358  if (array_key_exists($field, $get)) {
359  [$type, $id] = explode('-', $get[$field]);
360  $this->getObject()->disableAutomaticMembershipSource((string) $type, (int) $id);
361  }
362  $this->ctrl->redirect($this, self::CMD_VIEW);
363  }
$type
+ Here is the call graph for this function:

◆ enable()

ilObjStudyProgrammeAutoMembershipsGUI::enable ( )
protected

Enable single entry.

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

References $type, and getObject().

341  {
342  $get = $this->request->getQueryParams();
343  $field = self::CHECKBOX_SOURCE_IDS;
344  if (array_key_exists($field, $get)) {
345  [$type, $id] = explode('-', $get[$field]);
346  $this->getObject()->enableAutomaticMembershipSource((string) $type, (int) $id);
347  }
348  $this->ctrl->redirect($this, self::CMD_VIEW);
349  }
$type
+ Here is the call graph for this function:

◆ executeCommand()

ilObjStudyProgrammeAutoMembershipsGUI::executeCommand ( )

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

References view().

121  {
122  $cmd = $this->ctrl->getCmd();
123  switch ($cmd) {
124  case self::CMD_VIEW:
125  case self::CMD_DELETE:
126  case self::CMD_DELETE_CONFIRMATION:
127  case self::CMD_DISABLE:
128  case self::CMD_GET_ASYNC_MODAL_OUTPUT:
129  case self::CMD_NEXT_STEP:
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;
137  case self::CMD_PROFILE_NOT_PUBLIC:
138  $this->view(true);
139  break;
140  default:
141  throw new ilException(
142  "ilObjStudyProgrammeAutoMembershipsGUI: " .
143  "Command not supported: $cmd"
144  );
145  }
146  }
+ Here is the call graph for this function:

◆ getAsynchModalOutput()

ilObjStudyProgrammeAutoMembershipsGUI::getAsynchModalOutput ( )
protected

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

References $_GET, exit, getForm(), and txt().

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

◆ getForm()

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

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

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

Referenced by getAsynchModalOutput(), and save().

493  $form = new ilPropertyFormGUI();
494 
495  if (is_null($source_type)) {
496  $source_type = "";
497  }
498  if (is_null($source_id)) {
499  $source_id = "";
500  }
501  $form->setId(uniqid((string) $source_type . (string) $source_id));
502  $form->setFormAction($this->ctrl->getFormAction($this, 'save'));
503 
504  $rgroup = new ilRadioGroupInputGUI($this->txt('membership_source_type'), self::F_SOURCE_TYPE);
505  $rgroup->setValue($source_type);
506  $form->addItem($rgroup);
507 
508  $radio_role = new ilRadioOption(
511  );
512 
513  $ni_role = new ilTextInputGUI(
516  );
517  $radio_role->addSubItem($ni_role);
518  $rgroup->addOption($radio_role);
519 
520  $radio_grp = new ilRadioOption(
523  );
524  $ni_grp = new ilTextInputGUI(
527  );
528  $radio_grp->addSubItem($ni_grp);
529  $rgroup->addOption($radio_grp);
530 
531  $radio_crs = new ilRadioOption(
534  );
535  $ni_crs = new ilTextInputGUI(
538  );
539  $radio_crs->addSubItem($ni_crs);
540  $rgroup->addOption($radio_crs);
541 
542  $radio_orgu = new ilRadioOption(
545  );
546  $orgu = new ilRepositorySelector2InputGUI(
547  "",
549  false
550  );
551  $orgu->getExplorerGUI()->setSelectableTypes(["orgu"]);
552  $orgu->getExplorerGUI()->setTypeWhiteList(["root", "orgu"]);
553 
554  $orgu->getExplorerGUI()->setRootId(ilObjOrgUnit::getRootOrgRefId());
555  $orgu->getExplorerGUI()->setAjax(false);
556  $radio_orgu->addSubItem($orgu);
557  $rgroup->addOption($radio_orgu);
558 
559  if (
560  !is_null($source_type) &&
561  !is_null($source_id) &&
562  $source_type !== "" &&
563  $source_id !== ""
564  ) {
565  switch ($source_type) {
567  $ni_role->setValue($source_id);
568  break;
570  $ni_grp->setValue($source_id);
571  break;
573  $ni_crs->setValue($source_id);
574  break;
576  $orgu->setValue($source_id);
577  break;
578  default:
579  }
580  }
581 
582  $hi = new ilHiddenInputGUI(self::F_ORIGINAL_SOURCE_TYPE);
583  $hi->setValue($source_type);
584  $form->addItem($hi);
585 
586  $hi = new ilHiddenInputGUI(self::F_ORIGINAL_SOURCE_ID);
587  $hi->setValue($source_id);
588  $form->addItem($hi);
589 
590  return $form;
591  }
This class represents an option in a radio group.
This class represents a property form user interface.
This class represents a hidden form property in a property form.
This class represents a property in a property form.
static getRootOrgRefId()
+ Here is the call graph for this function:
+ 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 680 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

References txt(), and ILIAS\UI\Component\Button\Button\withOnClick().

Referenced by view().

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

Referenced by view().

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

◆ getObject()

ilObjStudyProgrammeAutoMembershipsGUI::getObject ( )
protected

Get current StudyProgramme-object.

Returns
ilObjStudyProgramme

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

References $object, $prg_ref_id, and ilObjStudyProgramme\getInstanceByRefId().

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

387  {
388  if ($this->object === null ||
389  (int) $this->object->getRefId() !== $this->prg_ref_id
390  ) {
391  $this->object = ilObjStudyProgramme::getInstanceByRefId($this->prg_ref_id);
392  }
393  return $this->object;
394  }
static getInstanceByRefId($a_ref_id)
+ 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 593 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

References ilObject\_lookupDescription(), ilObject\_lookupTitle(), parseQueryString(), and txt().

Referenced by nextStep().

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

◆ getTitleRepresentation()

ilObjStudyProgrammeAutoMembershipsGUI::getTitleRepresentation ( ilStudyProgrammeAutoMembershipSource  $ams)
protected

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

References Vendor\Package\$c, $url, ilLink\_getStaticLink(), ilObject\_lookupTitle(), ilStudyProgrammeAutoMembershipSource\getSourceId(), ilStudyProgrammeAutoMembershipSource\getSourceType(), ilStudyProgrammeAutoMembershipSource\TYPE_COURSE, ilStudyProgrammeAutoMembershipSource\TYPE_GROUP, ilStudyProgrammeAutoMembershipSource\TYPE_ORGU, and ilStudyProgrammeAutoMembershipSource\TYPE_ROLE.

Referenced by view().

736  $src_id = $ams->getSourceId();
737 
738  $title = "";
739  $url = "";
740  switch ($ams->getSourceType()) {
742  $title = ilObjRole::_lookupTitle($src_id) ?? "-";
743  $this->ctrl->setParameterByClass('ilObjRoleGUI', 'obj_id', $src_id);
744  $this->ctrl->setParameterByClass('ilObjRoleGUI', 'ref_id', self::ROLEFOLDER_REF_ID);
745  $this->ctrl->setParameterByClass('ilObjRoleGUI', 'admin_mode', 'settings');
746  $url = $this->ctrl->getLinkTargetByClass(['ilAdministrationGUI', 'ilObjRoleGUI'], 'userassignment');
747  $this->ctrl->clearParametersByClass('ilObjRoleGUI');
748  break;
749 
752  $hops = array_map(
753  function ($c) {
754  return ilObject::_lookupTitle($c["obj_id"]);
755  },
756  $this->tree->getPathFull($src_id)
757  );
758  $hops = array_slice($hops, 1);
759  $title = implode(' > ', $hops) ?? "-";
760  break;
761 
763  $hops = array_map(
764  function ($c) {
765  return ilObject::_lookupTitle($c["obj_id"]);
766  },
767  $this->tree->getPathFull($src_id)
768  );
769  $hops = array_slice($hops, 3);
770  $title = implode(' > ', $hops) ?? "-";
771  $url = ilLink::_getStaticLink($src_id, $ams->getSourceType());
772  break;
773  default:
774  throw new \LogicException("This should not happen. Forgot a case in the switch?");
775  }
776 
777  return $this->ui_factory->link()->standard($title, $url);
778  }
static _lookupTitle($a_id)
lookup object title
$url
+ 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 671 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

References txt().

Referenced by view().

672  {
673  $btn = $this->ui_factory->button()->primary($this->txt('add_automembership_source'), '')
674  ->withOnClick($add_cat_signal);
675  $this->toolbar->addComponent($btn);
676  }
+ 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 715 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

References $url, ilLink\_getStaticLink(), ilObjUser\_lookupName(), and ilObjectFactory\getInstanceByObjId().

Referenced by view().

716  {
717  $username = ilObjUser::_lookupName($usr_id);
718  $editor = implode(' ', [
719  $username['firstname'],
720  $username['lastname'],
721  '(' . $username['login'] . ')'
722  ]);
723  $usr = ilObjectFactory::getInstanceByObjId($usr_id);
724  $url = ilLink::_getStaticLink($usr_id, 'usr');
725 
726  if (!$usr->hasPublicProfile()) {
727  $url = $this->ctrl->getLinkTarget($this, self::CMD_PROFILE_NOT_PUBLIC);
728  }
729  return $this->ui_factory->link()->standard($editor, $url);
730  }
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
$url
+ 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.

References $_GET, exit, getSelectionForm(), and txt().

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('save'), "#")->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  }
exit
Definition: login.php:29
getSelectionForm(string $selected_source_type, string $selected_source, string $source_type=null, int $source_id=null)
$_GET["client_id"]
+ 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 637 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

References QP_COMBINATION_AND, and ilUtil\stripSlashes().

Referenced by getSelectionForm().

638  {
639  $query_parser = new ilQueryParser(ilUtil::stripSlashes($a_string));
640  $query_parser->setCombination(QP_COMBINATION_AND);
641  $query_parser->setMinWordLength(1);
642 
643  // #17502
644  if (!(bool) $a_ignore_length) {
645  $query_parser->setGlobalMinLength(3); // #14768
646  }
647 
648  $query_parser->parse();
649 
650  if (!$query_parser->validate()) {
651  return $query_parser->getMessage();
652  }
653  return $query_parser;
654  }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
const QP_COMBINATION_AND
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilObjStudyProgrammeAutoMembershipsGUI::save ( )
protected

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

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

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  $this->ctrl->redirect($this, self::CMD_VIEW);
271  }
static _getAllReferences($a_id)
get all reference ids of object
getForm(string $source_type=null, int $source_id=null)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ 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 377 of file class.ilObjStudyProgrammeAutoMembershipsGUI.php.

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

◆ setRefId()

ilObjStudyProgrammeAutoMembershipsGUI::setRefId ( int  $prg_ref_id)

Set ref-id of StudyProgramme before using this GUI.

Parameters
int$prg_ref_id

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

References $prg_ref_id.

◆ txt()

ilObjStudyProgrammeAutoMembershipsGUI::txt ( string  $code)
protected

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

Referenced by getAsynchModalOutput(), getForm(), getItemAction(), getSelectionForm(), getToolbar(), nextStep(), and save().

780  : string
781  {
782  return $this->lng->txt($code);
783  }
+ 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.

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

Referenced by executeCommand().

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  }
$data
Definition: storeScorm.php:23
getToolbar(\ILIAS\UI\Component\Signal $add_cat_signal)
Setup toolbar.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getTitleRepresentation(ilStudyProgrammeAutoMembershipSource $ams)
getModal(string $source_type=null, int $source_id=null)
getItemAction(string $src_id, \ILIAS\UI\Component\Signal $signal, bool $is_enabled)
+ 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 getObject(), and 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'

◆ CMD_DELETE_CONFIRMATION

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_DELETE_CONFIRMATION = 'deleteConfirmation'

◆ CMD_DISABLE

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_DISABLE = 'disable'

◆ CMD_ENABLE

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_ENABLE = 'enable'

◆ CMD_GET_ASYNC_MODAL_OUTPUT

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_GET_ASYNC_MODAL_OUTPUT = 'getAsynchModalOutput'

◆ CMD_NEXT_STEP

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_NEXT_STEP = 'nextStep'

◆ CMD_PROFILE_NOT_PUBLIC

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_PROFILE_NOT_PUBLIC = 'profile_not_public'

◆ CMD_SAVE

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_SAVE = 'save'

◆ CMD_VIEW

const ilObjStudyProgrammeAutoMembershipsGUI::CMD_VIEW = 'view'

◆ 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: