ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilLTIConsumeProviderSettingsGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
30 {
31  public const CMD_SHOW_SETTINGS = 'showSettings';
32  public const CMD_SAVE_SETTINGS = 'saveSettings';
33 
38 
43 
47  public function __construct(ilObjLTIConsumer $object, ilLTIConsumerAccess $access)
48  {
49  $this->object = $object;
50  $this->access = $access;
51  }
52 
56  public function executeCommand(): void
57  {
58  global $DIC; /* @var \ILIAS\DI\Container $DIC */
59 
60  switch ($DIC->ctrl()->getNextClass()) {
61  default:
62 
63  $command = $DIC->ctrl()->getCmd(self::CMD_SHOW_SETTINGS) . 'Cmd';
64  $this->{$command}();
65  }
66  }
67 
68  protected function showSettingsCmd(?ilLTIConsumeProviderFormGUI $form = null): void
69  {
70  global $DIC; /* @var \ILIAS\DI\Container $DIC */
71 
72  if ($form === null) {
73  $form = $this->buildForm($this->object->getProvider());
74  }
75 
76  $DIC->ui()->mainTemplate()->setContent($form->getHTML());
77  }
78 
79  protected function saveSettingsCmd(): void
80  {
81  global $DIC; /* @var \ILIAS\DI\Container $DIC */
82 
83  $provider = $this->object->getProvider();
84  $form = $this->buildForm($provider);
85 
86  if ($form->checkInput()) {
87  $form->initProvider($provider);
88  $this->object->getProvider()->save();
89  $DIC->ctrl()->redirect($this, self::CMD_SHOW_SETTINGS);
90  }
91 
92  $this->showSettingsCmd($form);
93  }
94 
99  {
100  global $DIC; /* @var \ILIAS\DI\Container $DIC */
101 
102  $form = new ilLTIConsumeProviderFormGUI($provider);
103 
104  $form->initForm(
105  $DIC->ctrl()->getFormAction($this),
106  self::CMD_SAVE_SETTINGS,
107  self::CMD_SHOW_SETTINGS
108  );
109 
110  return $form;
111  }
112 }
__construct(ilObjLTIConsumer $object, ilLTIConsumerAccess $access)
ilLTIConsumerAccess constructor.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$provider
Definition: ltitoken.php:80
global $DIC
Definition: shib_login.php:22
showSettingsCmd(?ilLTIConsumeProviderFormGUI $form=null)