ILIAS  trunk Revision v11.0_alpha-1861-g09f3d197f78
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 36 of file class.ilObjLTIAdministrationGUI.php.

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

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

Member Function Documentation

◆ addProvidingSubtabs()

ilObjLTIAdministrationGUI::addProvidingSubtabs ( )
protected

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

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

Referenced by getAdminTabs().

115  : void
116  {
117  if ($this->rbac_system->checkAccess("visible,read", $this->object->getRefId())) {
118  // currently no general settings.
119  // $this->tabs_gui->addTab("settings",
120  // $this->lng->txt("settings"),
121  // $this->ctrl->getLinkTarget($this, "initSettingsForm"));
122 
123  $this->tabs_gui->addSubTab(
124  "consumers",
125  $this->lng->txt("consumers"),
126  $this->ctrl->getLinkTarget($this, "listConsumers")
127  );
128  }
129  if ($this->rbac_system->checkAccess("visible,read", $this->object->getRefId())) {
130  $this->tabs_gui->addSubTab(
131  "releasedObjects",
132  $this->lng->txt("lti_released_objects"),
133  $this->ctrl->getLinkTarget($this, "releasedObjects")
134  );
135  }
136  }
+ 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 449 of file class.ilObjLTIAdministrationGUI.php.

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

449  : void
450  {
451  if (!$this->consumer_id) {
452  $this->ctrl->redirect($this, "listConsumers");
453  }
454 
455  $consumer = ilLTIPlatform::fromExternalConsumerId($this->consumer_id, $this->dataConnector);
456  if ($consumer->getActive()) {
457  $consumer->setActive(false);
458  $msg = "lti_consumer_set_inactive";
459  } else {
460  $consumer->setActive(true);
461  $msg = "lti_consumer_set_active";
462  }
463  $consumer->saveGlobalToolConsumerSettings($this->dataConnector);
464  $this->tpl->setOnScreenMessage('success', $this->lng->txt($msg), true);
465 
466  $this->ctrl->redirect($this, 'listConsumers');
467  }
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 337 of file class.ilObjLTIAdministrationGUI.php.

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

337  : void
338  {
339  $this->checkPermission("write");
340 
341  $form = $this->getConsumerForm();
342 
343  if ($form->checkInput()) {
344  // $consumer = new ilLTIExternalConsumer();
345  // $dataConnector = new ilLTIDataConnector();
346  $consumer = new ilLTIPlatform(null, $this->dataConnector);
347  $consumer->setTitle($form->getInput('title'));
348  $consumer->setDescription($form->getInput('description'));
349  $consumer->setPrefix($form->getInput('prefix'));
350  $consumer->setLanguage($form->getInput('language'));
351  $consumer->setActive((bool) $form->getInput('active'));
352  $consumer->setRole((int) $form->getInput('role'));
353  $consumer->saveGlobalToolConsumerSettings($this->dataConnector);
354 
355  $this->object->saveConsumerObjectTypes(
356  $consumer->getExtConsumerId(),
357  $form->getInput('types')
358  );
359  $this->tpl->setOnScreenMessage('success', $this->lng->txt("lti_consumer_created"), true);
360  $this->ctrl->redirect($this, 'listConsumers');
361  }
362 
363  $form->setValuesByPost();
364  $this->listConsumers();
365  return;
366  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 208 of file class.ilObjLTIAdministrationGUI.php.

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

208  : void
209  {
210  $role = new ilObjRole();
211  $role->setTitle("il_lti_global_role");
212  $role->setDescription("This global role should only contain the permission 'read' for repository and categories. Do not rename this role.");
213  $role->create();
214  $this->rbac_admin->assignRoleToFolder($role->getId(), 8, 'y');
215  $this->rbac_admin->setProtected(8, $role->getId(), 'y');
216  $this->rbac_admin->setRolePermission($role->getId(), 'root', [3], 8);
217  $this->rbac_admin->setRolePermission($role->getId(), 'cat', [3], 8);
218  $this->rbac_admin->grantPermission($role->getId(), [3], ROOT_FOLDER_ID);
219  $role->changeExistingObjects(
222  array('cat'),
223  array()
224  );
225 
226  $this->tpl->setOnScreenMessage('success', $this->lng->txt("lti_user_role_created"), true);
227  $this->listConsumers();
228  }
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 401 of file class.ilObjLTIAdministrationGUI.php.

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

401  : void
402  {
403  $consumer_id = 0;
404  if ($this->request_wrapper->has('cid')) {
405  $consumer_id = (int) $this->request_wrapper->retrieve('cid', $this->refinery->kindlyTo()->int());
406  }
407 
408  if ($consumer_id == 0) {
409  $this->ctrl->redirect($this, "listConsumers");
410  }
411  $consumer = ilLTIPlatform::fromExternalConsumerId($consumer_id, $this->dataConnector);
412  $consumer->deleteGlobalToolConsumerSettings($this->dataConnector);
413  $this->tpl->setOnScreenMessage('success', $this->lng->txt("lti_consumer_deleted"), true);
414  $this->ctrl->redirect($this, 'listConsumers');
415  }
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 312 of file class.ilObjLTIAdministrationGUI.php.

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

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

◆ executeCommand()

ilObjLTIAdministrationGUI::executeCommand ( )

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

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

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

◆ getAdminTabs()

ilObjLTIAdministrationGUI::getAdminTabs ( )

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

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

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

◆ getConsumerForm()

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

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

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

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

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

Referenced by initSettingsForm().

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

◆ getType()

ilObjLTIAdministrationGUI::getType ( )

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

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

◆ initConsumerForm()

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

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

References getConsumerForm().

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

◆ initSettingsForm()

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

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

References getSettingsForm().

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

◆ listConsumers()

ilObjLTIAdministrationGUI::listConsumers ( )
protected

List consumers.

Definition at line 421 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().

421  : void
422  {
423  if ($this->checkPermissionBool('write')) {
424  $this->toolbar->addButton(
425  $this->lng->txt('lti_create_consumer'),
426  $this->ctrl->getLinkTarget($this, 'createconsumer')
427  );
428  if (ilObject::_getIdsForTitle("il_lti_global_role", "role", false) == []) {
429  $this->toolbar->addButton(
430  $this->lng->txt('lti_create_lti_user_role'),
431  $this->ctrl->getLinkTarget($this, 'createLtiUserRole')
432  );
433  $this->toolbar->addText($this->lng->txt('lti_user_role_info'));
434  }
435  }
436 
437  $this->tabs_gui->activateSubTab("consumers");
438  $tbl = new ilObjectConsumerTableGUI(
439  $this,
440  "listConsumers"
441  );
442  $tbl->setEditable($this->checkPermissionBool('write'));
443  $this->tpl->setContent($tbl->getHTML());
444  }
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 472 of file class.ilObjLTIAdministrationGUI.php.

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

◆ updateLTIConsumer()

ilObjLTIAdministrationGUI::updateLTIConsumer ( )
protected

Update lti consumer settings.

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

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

371  : void
372  {
373  $this->checkPermission("write");
374 
375  if (!$this->consumer_id) {
376  $this->ctrl->redirect($this, "listConsumers");
377  }
378 
379  $this->ctrl->setParameter($this, "cid", $this->consumer_id);
380 
381  $consumer = ilLTIPlatform::fromExternalConsumerId($this->consumer_id, $this->dataConnector);
382  $form = $this->getConsumerForm('edit');
383  if ($form->checkInput()) {
384  $consumer->setTitle($form->getInput('title'));
385  $consumer->setDescription($form->getInput('description'));
386  $consumer->setPrefix($form->getInput('prefix'));
387  $consumer->setLanguage($form->getInput('language'));
388  $consumer->setActive((bool) $form->getInput('active'));
389  $consumer->setRole((int) $form->getInput('role'));
390  $consumer->saveGlobalToolConsumerSettings($this->dataConnector);
391  $this->object->saveConsumerObjectTypes($this->consumer_id, $form->getInput('types'));
392 
393  $this->tpl->setOnScreenMessage('success', $this->lng->txt("lti_consumer_updated"), true);
394  }
395  $this->listConsumers();
396  }
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 34 of file class.ilObjLTIAdministrationGUI.php.

◆ $dataConnector

ilLTIDataConnector ilObjLTIAdministrationGUI::$dataConnector = null
private

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


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