ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilObjLTIAdministrationGUI Class Reference

Class ilObjLTIAdministrationGUI. More...

+ Inheritance diagram for ilObjLTIAdministrationGUI:
+ Collaboration diagram for ilObjLTIAdministrationGUI:

Public Member Functions

 __construct (?array $a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
 
 executeCommand ()
 
 getType ()
 
 getAdminTabs ()
 
- Public Member Functions inherited from ilObjectGUI
 getRefId ()
 
 setAdminMode (string $mode)
 
 getAdminMode ()
 
 getObject ()
 
 executeCommand ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode (bool $mode=true)
 If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode is determined in ilRepositoryGUI. More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 editAvailabilityPeriodObject ()
 
 saveAvailabilityPeriodObject ()
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Protected Member Functions

 addProvidingSubtabs ()
 
 initSettingsForm (ilPropertyFormGUI $form=null)
 
 getSettingsForm ()
 
 createLtiUserRole ()
 
 initConsumerForm (ilPropertyFormGUI $form=null)
 
 getConsumerForm (string $a_mode='')
 
 editConsumer (ilPropertyFormGUI $a_form=null)
 Edit consumer. More...
 
 createLTIConsumer ()
 Create new lti consumer. More...
 
 updateLTIConsumer ()
 Update lti consumer settings. More...
 
 deleteLTIConsumer ()
 Delete consumers. More...
 
 listConsumers ()
 List consumers. More...
 
 changeStatusLTIConsumer ()
 Change activation status. More...
 
 releasedObjects ()
 Show relases objects. More...
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 createActionDispatcherGUI ()
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction (?ilObjectListGUI $list_gui=null)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 setTabs ()
 set admin tabs More...
 
 setAdminTabs ()
 set admin tabs More...
 
 setLocator ()
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator (bool $omit=true)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 getCreationFormsHTML (StandardForm|ilPropertyFormGUI|array $form)
 
 getTitleForCreationFormPage ()
 
 getCreationFormTitle ()
 
 initCreateForm (string $new_type)
 
 didacticTemplatesToForm ()
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 retrieveAdditionalDidacticTemplateOptions ()
 
 addAdoptContentLinkToToolbar ()
 
 addImportButtonToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 parseDidacticTemplateVar (string $var, string $type)
 
 afterSave (ilObject $new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 routeImportCmdObject ()
 
 importFile (string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
 
 deleteUploadedImportFile (string $path_to_uploaded_file_in_temp_dir)
 
 afterImport (ilObject $new_object)
 Post (successful) object import hook. More...
 
 setFormAction (string $cmd, string $form_action)
 
 getReturnLocation (string $cmd, string $default_location="")
 Get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 getTargetFrame (string $cmd, string $default_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 getTabs ()
 overwrite in derived GUI class of your object type More...
 
 redirectToRefId (int $ref_id, string $cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current ["ref_id"] value of the request More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 getCreatableObjectTypes ()
 
 buildAddNewItemElements (array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
 
 buildGroup (string $create_target_class, array $obj_types_in_group, string $title, array $subtypes)
 

Private Attributes

ilLTIDataConnector $dataConnector = null
 
int $consumer_id = null
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot (bool $raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode (int $ref_id, string $cmd="")
 
static _gotoSharedWorkspaceNode (int $wsp_id)
 
- Data Fields inherited from ilObjectGUI
const ADMIN_MODE_NONE = ""
 
const ADMIN_MODE_SETTINGS = "settings"
 
const ADMIN_MODE_REPOSITORY = "repository"
 
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 
const SUPPORTED_IMPORT_MIME_TYPES = [MimeType::APPLICATION__ZIP, MimeType::APPLICATION__X_ZIP_COMPRESSED]
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
ServerRequestInterface $request
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilSetting $settings
 
ilToolbarGUI $toolbar
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
ilObjectService $object_service
 
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilCtrl $ctrl
 
ilErrorHandling $error
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ILIAS $ilias
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
Refinery $refinery
 
ilFavouritesManager $favourites
 
ilObjectCustomIconFactory $custom_icon_factory
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
Filesystem $temp_file_system
 
ilObject $object = null
 
bool $creation_mode = false
 
 $data
 
int $id
 
bool $call_by_reference = false
 
bool $prepare_output
 
int $ref_id
 
int $obj_id
 
int $maxcount
 
array $form_action = []
 
array $return_location = []
 
array $target_frame = []
 
string $tmp_import_dir
 
string $sub_objects = ""
 
bool $omit_locator = false
 
string $type = ""
 
string $admin_mode = self::ADMIN_MODE_NONE
 
int $requested_ref_id = 0
 
int $requested_crtptrefid = 0
 
int $requested_crtcb = 0
 
string $requested_new_type = ""
 
string $link_params
 
string $html = ""
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjLTIAdministrationGUI::__construct ( ?array  $a_data,
int  $a_id,
bool  $a_call_by_reference = true,
bool  $a_prepare_output = true 
)

Definition at line 37 of file class.ilObjLTIAdministrationGUI.php.

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\int().

38  {
39  global $DIC;
40  $DIC->language()->loadLanguageModule('lti'); //&ltis
41  $this->type = "ltis";
42  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
43  $this->dataConnector = new ilLTIDataConnector();
44 
45  if ($DIC->http()->wrapper()->query()->has("cid")) {
46  $this->consumer_id = (int) $DIC->http()->wrapper()->query()->retrieve("cid", $DIC->refinery()->kindlyTo()->int());
47  }
48  }
global $DIC
Definition: shib_login.php:25
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ addProvidingSubtabs()

ilObjLTIAdministrationGUI::addProvidingSubtabs ( )
protected

Definition at line 116 of file class.ilObjLTIAdministrationGUI.php.

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by getAdminTabs().

116  : void
117  {
118  if ($this->rbac_system->checkAccess("visible,read", $this->object->getRefId())) {
119  // currently no general settings.
120  // $this->tabs_gui->addTab("settings",
121  // $this->lng->txt("settings"),
122  // $this->ctrl->getLinkTarget($this, "initSettingsForm"));
123 
124  $this->tabs_gui->addSubTab(
125  "consumers",
126  $this->lng->txt("consumers"),
127  $this->ctrl->getLinkTarget($this, "listConsumers")
128  );
129  }
130  if ($this->rbac_system->checkAccess("visible,read", $this->object->getRefId())) {
131  $this->tabs_gui->addSubTab(
132  "releasedObjects",
133  $this->lng->txt("lti_released_objects"),
134  $this->ctrl->getLinkTarget($this, "releasedObjects")
135  );
136  }
137  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ changeStatusLTIConsumer()

ilObjLTIAdministrationGUI::changeStatusLTIConsumer ( )
protected

Change activation status.

Definition at line 450 of file class.ilObjLTIAdministrationGUI.php.

References ILIAS\Repository\ctrl(), ilLTIPlatform\fromExternalConsumerId(), and ILIAS\Repository\lng().

450  : void
451  {
452  if (!$this->consumer_id) {
453  $this->ctrl->redirect($this, "listConsumers");
454  }
455 
456  $consumer = ilLTIPlatform::fromExternalConsumerId($this->consumer_id, $this->dataConnector);
457  if ($consumer->getActive()) {
458  $consumer->setActive(false);
459  $msg = "lti_consumer_set_inactive";
460  } else {
461  $consumer->setActive(true);
462  $msg = "lti_consumer_set_active";
463  }
464  $consumer->saveGlobalToolConsumerSettings($this->dataConnector);
465  $this->tpl->setOnScreenMessage('success', $this->lng->txt($msg), true);
466 
467  $this->ctrl->redirect($this, 'listConsumers');
468  }
static fromExternalConsumerId(int $id, ilLTIDataConnector $dataConnector)
+ Here is the call graph for this function:

◆ createLTIConsumer()

ilObjLTIAdministrationGUI::createLTIConsumer ( )
protected

Create new lti consumer.

Definition at line 338 of file class.ilObjLTIAdministrationGUI.php.

References ilObjectGUI\checkPermission(), ILIAS\Repository\ctrl(), getConsumerForm(), listConsumers(), and ILIAS\Repository\lng().

338  : void
339  {
340  $this->checkPermission("write");
341 
342  $form = $this->getConsumerForm();
343 
344  if ($form->checkInput()) {
345  // $consumer = new ilLTIExternalConsumer();
346  // $dataConnector = new ilLTIDataConnector();
347  $consumer = new ilLTIPlatform(null, $this->dataConnector);
348  $consumer->setTitle($form->getInput('title'));
349  $consumer->setDescription($form->getInput('description'));
350  $consumer->setPrefix($form->getInput('prefix'));
351  $consumer->setLanguage($form->getInput('language'));
352  $consumer->setActive((bool) $form->getInput('active'));
353  $consumer->setRole((int) $form->getInput('role'));
354  $consumer->saveGlobalToolConsumerSettings($this->dataConnector);
355 
356  $this->object->saveConsumerObjectTypes(
357  $consumer->getExtConsumerId(),
358  $form->getInput('types')
359  );
360  $this->tpl->setOnScreenMessage('success', $this->lng->txt("lti_consumer_created"), true);
361  $this->ctrl->redirect($this, 'listConsumers');
362  }
363 
364  $form->setValuesByPost();
365  $this->listConsumers();
366  return;
367  }
LTI provider for LTI launch.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

◆ createLtiUserRole()

ilObjLTIAdministrationGUI::createLtiUserRole ( )
protected

Definition at line 209 of file class.ilObjLTIAdministrationGUI.php.

References listConsumers(), ILIAS\Repository\lng(), ilObjRole\MODE_UNPROTECTED_KEEP_LOCAL_POLICIES, and ROOT_FOLDER_ID.

209  : void
210  {
211  $role = new ilObjRole();
212  $role->setTitle("il_lti_global_role");
213  $role->setDescription("This global role should only contain the permission 'read' for repository and categories. Do not rename this role.");
214  $role->create();
215  $this->rbac_admin->assignRoleToFolder($role->getId(), 8, 'y');
216  $this->rbac_admin->setProtected(8, $role->getId(), 'y');
217  $this->rbac_admin->setRolePermission($role->getId(), 'root', [3], 8);
218  $this->rbac_admin->setRolePermission($role->getId(), 'cat', [3], 8);
219  $this->rbac_admin->grantPermission($role->getId(), [3], ROOT_FOLDER_ID);
220  $role->changeExistingObjects(
223  array('cat'),
224  array()
225  );
226 
227  $this->tpl->setOnScreenMessage('success', $this->lng->txt("lti_user_role_created"), true);
228  $this->listConsumers();
229  }
Class ilObjRole.
const ROOT_FOLDER_ID
Definition: constants.php:32
const MODE_UNPROTECTED_KEEP_LOCAL_POLICIES
+ Here is the call graph for this function:

◆ deleteLTIConsumer()

ilObjLTIAdministrationGUI::deleteLTIConsumer ( )
protected

Delete consumers.

Definition at line 402 of file class.ilObjLTIAdministrationGUI.php.

References ILIAS\Repository\ctrl(), ilLTIPlatform\fromExternalConsumerId(), ILIAS\Repository\int(), and ILIAS\Repository\lng().

402  : void
403  {
404  $consumer_id = 0;
405  if ($this->request_wrapper->has('cid')) {
406  $consumer_id = (int) $this->request_wrapper->retrieve('cid', $this->refinery->kindlyTo()->int());
407  }
408 
409  if ($consumer_id == 0) {
410  $this->ctrl->redirect($this, "listConsumers");
411  }
412  $consumer = ilLTIPlatform::fromExternalConsumerId($consumer_id, $this->dataConnector);
413  $consumer->deleteGlobalToolConsumerSettings($this->dataConnector);
414  $this->tpl->setOnScreenMessage('success', $this->lng->txt("lti_consumer_deleted"), true);
415  $this->ctrl->redirect($this, 'listConsumers');
416  }
static fromExternalConsumerId(int $id, ilLTIDataConnector $dataConnector)
+ Here is the call graph for this function:

◆ editConsumer()

ilObjLTIAdministrationGUI::editConsumer ( ilPropertyFormGUI  $a_form = null)
protected

Edit consumer.

Parameters
ilPropertyFormGUI$a_form

Definition at line 313 of file class.ilObjLTIAdministrationGUI.php.

References ILIAS\Repository\ctrl(), ilLTIPlatform\fromExternalConsumerId(), getConsumerForm(), and ILIAS\Repository\object().

313  : void
314  {
315  $this->ctrl->setParameter($this, "cid", $this->consumer_id);
316 
317  if (!$this->consumer_id) {
318  $this->ctrl->redirect($this, "listConsumers");
319  }
320 
321  $consumer = ilLTIPlatform::fromExternalConsumerId($this->consumer_id, $this->dataConnector);
322  if (!$a_form instanceof ilPropertyFormGUI) {
323  $a_form = $this->getConsumerForm('edit');
324  $a_form->getItemByPostVar("title")->setValue($consumer->getTitle());
325  $a_form->getItemByPostVar("description")->setValue($consumer->getDescription());
326  $a_form->getItemByPostVar("prefix")->setValue($consumer->getPrefix());
327  $a_form->getItemByPostVar("language")->setValue($consumer->getLanguage());
328  $a_form->getItemByPostVar("active")->setChecked($consumer->getActive());
329  $a_form->getItemByPostVar("role")->setValue($consumer->getRole());
330  $a_form->getItemByPostVar("types")->setValue($this->object->getActiveObjectTypes($this->consumer_id));
331  }
332  $this->tpl->setContent($a_form->getHTML());
333  }
getItemByPostVar(string $a_post_var)
static fromExternalConsumerId(int $id, ilLTIDataConnector $dataConnector)
+ Here is the call graph for this function:

◆ executeCommand()

ilObjLTIAdministrationGUI::executeCommand ( )

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

References $GLOBALS, ilObjectGUI\checkPermissionBool(), ILIAS\Repository\ctrl(), and ilObjectGUI\prepareOutput().

50  : void
51  {
52  $next_class = $this->ctrl->getNextClass($this);
53  $cmd = $this->ctrl->getCmd();
54 
55  $this->prepareOutput();
56 
57  switch ($next_class) {
58  case 'ilpermissiongui':
59  $GLOBALS['ilTabs']->activateTab('perm_settings');
60  $perm_gui = new ilPermissionGUI($this);
61  $this->ctrl->forwardCommand($perm_gui);
62  break;
63 
64  case 'illticonsumeradministrationgui':
65  $this->tabs_gui->activateTab('lti_consuming');
66  $gui = new ilLTIConsumerAdministrationGUI($this->checkPermissionBool('write'));
67  $this->ctrl->forwardCommand($gui);
68  break;
69 
70  default:
71  $this->tabs_gui->activateTab('lti_providing');
72  if (!$cmd || $cmd == 'view') {
73  $cmd = 'listConsumers';
74  } elseif ($cmd == 'createconsumer') {
75  $cmd = "initConsumerForm";
76  }
77  $this->$cmd();
78  break;
79  }
80  }
prepareOutput(bool $show_sub_objects=true)
$GLOBALS["DIC"]
Definition: wac.php:30
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjLTIAdministrationGUI::getAdminTabs ( )

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

References addProvidingSubtabs(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

87  : void
88  {
89  if ($this->rbac_system->checkAccess("visible,read", $this->object->getRefId())) {
90  $this->tabs_gui->addTab(
91  'lti_providing',
92  $this->lng->txt("lti_providing_tab"),
93  $this->ctrl->getLinkTarget($this, "listConsumers")
94  );
95 
96  $this->tabs_gui->addTab(
97  'lti_consuming',
98  $this->lng->txt("lti_consuming_tab"),
99  $this->ctrl->getLinkTargetByClass('ilLTIConsumerAdministrationGUI')
100  );
101 
102  if ($this->ctrl->getCmdClass() == 'ilobjltiadministrationgui') {
103  $this->addProvidingSubtabs();
104  }
105  }
106 
107  if ($this->rbac_system->checkAccess('edit_permission', $this->object->getRefId())) {
108  $this->tabs_gui->addTab(
109  "perm_settings",
110  $this->lng->txt("perm_settings"),
111  $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm")
112  );
113  }
114  }
+ Here is the call graph for this function:

◆ getConsumerForm()

ilObjLTIAdministrationGUI::getConsumerForm ( string  $a_mode = '')
protected

Definition at line 242 of file class.ilObjLTIAdministrationGUI.php.

References ilLanguage\_lookupEntry(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilSelectInputGUI\setOptions().

Referenced by createLTIConsumer(), editConsumer(), initConsumerForm(), and updateLTIConsumer().

243  {
244  $this->tabs_gui->activateSubTab("consumers");
245 
246  $form = new ilPropertyFormGUI();
247 
248  $ti_title = new ilTextInputGUI($this->lng->txt("title"), 'title');
249  $ti_title->setRequired(true);
250  $form->addItem($ti_title);
251  $ti_description = new ilTextInputGUI($this->lng->txt("description"), 'description');
252  $form->addItem($ti_description);
253  $ti_prefix = new ilTextInputGUI($this->lng->txt("prefix"), 'prefix');
254  $ti_prefix->setInfo($this->lng->txt("prefix_info"));
255  $ti_prefix->setRequired(true);
256  $form->addItem($ti_prefix);
257  #$ti_key = new ilTextInputGUI($this->lng->txt("lti_consumer_key"), 'key');
258  #$ti_key->setRequired(true);
259  #$ti_secret = new ilTextInputGUI($this->lng->txt("lti_consumer_secret"), 'secret');
260  #$ti_secret->setRequired(true);
261 
262  $languages = $this->lng->getInstalledLanguages();
263  $array_lang = [];
264  $options = [];
265  foreach ($languages as $lang_key) {
266  $array_lang[$lang_key] = ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_" . $lang_key);
267  }
268 
269  $si_language = new ilSelectInputGUI($this->lng->txt("language"), "language");
270  $si_language->setOptions($array_lang);
271  $form->addItem($si_language);
272 
273  // object types
274  $cb_obj_types = new ilCheckboxGroupInputGUI($this->lng->txt("act_lti_for_obj_type"), 'types');
275 
276  $valid_obj_types = $this->object->getLTIObjectTypes();
277  foreach ($valid_obj_types as $obj_type) {
278  $object_name = $this->lng->txt('objs_' . $obj_type);
279  $cb_obj_types->addOption(new ilCheckboxOption($object_name, $obj_type));
280  }
281  $form->addItem($cb_obj_types);
282 
283  // test roles
284  $roles = $this->object->getLTIRoles();
285  foreach ($roles as $role_id => $role_name) {
286  $options[$role_id] = $role_name;
287  }
288  $si_roles = new ilSelectInputGUI($this->lng->txt("gbl_roles_to_users"), 'role');
289  $si_roles->setOptions($options);
290  $form->addItem($si_roles);
291 
292  $cb_active = new ilCheckboxInputGUI($this->lng->txt('active'), 'active');
293  $form->addItem($cb_active);
294 
295  if ($a_mode == 'edit') {
296  $form->setFormAction($this->ctrl->getFormAction($this, 'editLTIConsumer'));
297  $form->setTitle($this->lng->txt("lti_edit_consumer"));
298  $form->addCommandButton("updateLTIConsumer", $this->lng->txt("save"));
299  } else {
300  $form->setFormAction($this->ctrl->getFormAction($this, 'createLTIConsumer'));
301  $form->setTitle($this->lng->txt("lti_create_consumer"));
302  $form->addCommandButton("createLTIConsumer", $this->lng->txt("save"));
303  $form->addCommandButton('listConsumers', $this->lng->txt('cancel'));
304  }
305 
306  return $form;
307  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a selection list property in a property form.
This class represents a property form user interface.
setOptions(array $a_options)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupEntry(string $a_lang_key, string $a_mod, string $a_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSettingsForm()

ilObjLTIAdministrationGUI::getSettingsForm ( )
protected

Definition at line 149 of file class.ilObjLTIAdministrationGUI.php.

Referenced by initSettingsForm().

150  {
151  $form = new ilPropertyFormGUI();
152  /*
153  $form->setFormAction($this->ctrl->getFormAction($this,'saveSettingsForm'));
154  $form->setTitle($this->lng->txt("lti_settings"));
155 
156  // object types
157  $cb_obj_types = new ilCheckboxGroupInputGUI($this->lng->txt("act_lti_for_obj_type"), 'types');
158 
159  $valid_obj_types = $this->object->getLTIObjectTypes();
160  foreach($valid_obj_types as $obj_type_id => $obj_name)
161  {
162  $cb_obj_types->addOption(new ilCheckboxOption($obj_name, $obj_type_id));
163  }
164  $objs_active = $this->object->getActiveObjectTypes();
165  $cb_obj_types->setValue($objs_active);
166  $form->addItem($cb_obj_types);
167 
168  // test roles
169  $roles = $this->object->getLTIRoles();
170  foreach($roles as $role_id => $role_name)
171  {
172  $options[$role_id] = $role_name;
173  }
174  $si_roles = new ilSelectInputGUI($this->lng->txt("gbl_roles_to_users"), 'roles');
175  $si_roles->setOptions($options);
176  $si_roles->setValue($this->object->getCurrentRole());
177  $form->addItem($si_roles);
178 
179  $form->addCommandButton("saveSettingsForm", $this->lng->txt("save"));
180  */
181  return $form;
182  }
This class represents a property form user interface.
+ Here is the caller graph for this function:

◆ getType()

ilObjLTIAdministrationGUI::getType ( )

Definition at line 82 of file class.ilObjLTIAdministrationGUI.php.

82  : string
83  {
84  return "ltis";
85  }

◆ initConsumerForm()

ilObjLTIAdministrationGUI::initConsumerForm ( ilPropertyFormGUI  $form = null)
protected

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

References getConsumerForm().

234  : void
235  {
236  if (!($form instanceof ilPropertyFormGUI)) {
237  $form = $this->getConsumerForm();
238  }
239  $this->tpl->setContent($form->getHTML());
240  }
+ Here is the call graph for this function:

◆ initSettingsForm()

ilObjLTIAdministrationGUI::initSettingsForm ( ilPropertyFormGUI  $form = null)
protected

Definition at line 139 of file class.ilObjLTIAdministrationGUI.php.

References getSettingsForm().

139  : void
140  {
141  if (!($form instanceof ilPropertyFormGUI)) {
142  $form = $this->getSettingsForm();
143  }
144  $this->tabs_gui->activateSubTab("settings");
145  $this->tpl->setContent($form->getHTML());
146  }
+ Here is the call graph for this function:

◆ listConsumers()

ilObjLTIAdministrationGUI::listConsumers ( )
protected

List consumers.

Definition at line 422 of file class.ilObjLTIAdministrationGUI.php.

References ilObject\_getIdsForTitle(), ilObjectGUI\checkPermissionBool(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

Referenced by createLTIConsumer(), createLtiUserRole(), and updateLTIConsumer().

422  : void
423  {
424  if ($this->checkPermissionBool('write')) {
425  $this->toolbar->addButton(
426  $this->lng->txt('lti_create_consumer'),
427  $this->ctrl->getLinkTarget($this, 'createconsumer')
428  );
429  if (ilObject::_getIdsForTitle("il_lti_global_role", "role", false) == []) {
430  $this->toolbar->addButton(
431  $this->lng->txt('lti_create_lti_user_role'),
432  $this->ctrl->getLinkTarget($this, 'createLtiUserRole')
433  );
434  $this->toolbar->addText($this->lng->txt('lti_user_role_info'));
435  }
436  }
437 
438  $this->tabs_gui->activateSubTab("consumers");
439  $tbl = new ilObjectConsumerTableGUI(
440  $this,
441  "listConsumers"
442  );
443  $tbl->setEditable($this->checkPermissionBool('write'));
444  $this->tpl->setContent($tbl->getHTML());
445  }
TableGUI class for LTI consumer listing.
static _getIdsForTitle(string $title, string $type='', bool $partial_match=false)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ releasedObjects()

ilObjLTIAdministrationGUI::releasedObjects ( )
protected

Show relases objects.

Definition at line 473 of file class.ilObjLTIAdministrationGUI.php.

473  : void
474  {
475  $this->tabs_gui->activateSubTab('releasedObjects');
476 
477  $table = new ilLTIProviderReleasedObjectsTableGUI($this, 'releasedObjects', 'ltireleases');
478  $table->init();
479  $table->parse();
480 
481  $this->tpl->setContent($table->getHTML());
482  }

◆ updateLTIConsumer()

ilObjLTIAdministrationGUI::updateLTIConsumer ( )
protected

Update lti consumer settings.

Definition at line 372 of file class.ilObjLTIAdministrationGUI.php.

References ilObjectGUI\checkPermission(), ILIAS\Repository\ctrl(), ilLTIPlatform\fromExternalConsumerId(), getConsumerForm(), listConsumers(), and ILIAS\Repository\lng().

372  : void
373  {
374  $this->checkPermission("write");
375 
376  if (!$this->consumer_id) {
377  $this->ctrl->redirect($this, "listConsumers");
378  }
379 
380  $this->ctrl->setParameter($this, "cid", $this->consumer_id);
381 
382  $consumer = ilLTIPlatform::fromExternalConsumerId($this->consumer_id, $this->dataConnector);
383  $form = $this->getConsumerForm('edit');
384  if ($form->checkInput()) {
385  $consumer->setTitle($form->getInput('title'));
386  $consumer->setDescription($form->getInput('description'));
387  $consumer->setPrefix($form->getInput('prefix'));
388  $consumer->setLanguage($form->getInput('language'));
389  $consumer->setActive((bool) $form->getInput('active'));
390  $consumer->setRole((int) $form->getInput('role'));
391  $consumer->saveGlobalToolConsumerSettings($this->dataConnector);
392  $this->object->saveConsumerObjectTypes($this->consumer_id, $form->getInput('types'));
393 
394  $this->tpl->setOnScreenMessage('success', $this->lng->txt("lti_consumer_updated"), true);
395  }
396  $this->listConsumers();
397  }
static fromExternalConsumerId(int $id, ilLTIDataConnector $dataConnector)
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

Field Documentation

◆ $consumer_id

int ilObjLTIAdministrationGUI::$consumer_id = null
private

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

◆ $dataConnector

ilLTIDataConnector ilObjLTIAdministrationGUI::$dataConnector = null
private

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


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