ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilECSMappingSettingsGUI Class Reference

Class for ECS node and directory mapping settings. More...

+ Collaboration diagram for ilECSMappingSettingsGUI:

Public Member Functions

 __construct (ilECSSettingsGUI $settingsContainer, int $server_id, int $mid)
 Constructor. More...
 
 getContainer ()
 Get container object. More...
 
 getServer ()
 
 getMid ()
 Get mid. More...
 
 executeCommand ()
 ilCtrl executeCommand More...
 
 cancel ()
 return to parent container More...
 

Data Fields

const TAB_DIRECTORY = 1
 
const TAB_COURSE = 2
 

Protected Member Functions

 cStart ()
 Goto default page. More...
 
 dStart ()
 Goto default page. More...
 
 cInitOverview ($form=null, $current_attribute=null)
 Show overview page. More...
 
 cAddAttribute ()
 Add one attribute in form. More...
 
 cDeleteAttribute ()
 Delete last attribute in form. More...
 
 cShowLocalExplorer ()
 Show local explorer. More...
 
 cInitMappingForm (int $current_node, $current_attribute)
 Init the mapping form. More...
 
 cSaveOverview ()
 Save overview. More...
 
 cDeleteRulesOfNode ()
 
 cSettings (?ilPropertyFormGUI $form=null)
 Show course allocation. More...
 
 initFormCSettings ()
 Init settings form. More...
 
 dSettings (?ilPropertyFormGUI $form=null)
 Show directory allocation. More...
 
 cUpdateSettings ()
 Update course settings. More...
 
 dUpdateSettings ()
 Update node mapping settings. More...
 
 initFormDSettings ()
 
 dTrees ()
 Show directory trees. More...
 
 dConfirmDeleteTree ()
 Delete tree settings. More...
 
 dDeleteTree ()
 Delete tree. More...
 
 dEditTree (?ilPropertyFormGUI $form=null)
 Edit directory tree assignments. More...
 
 dInitFormTreeSettings (?ilPropertyFormGUI $form=null)
 Init form settings. More...
 
 dUpdateTreeSettings ()
 
 dSynchronizeTree ()
 Synchronize Tree. More...
 
 dSynchronizeTrees ()
 
 dShowLocalExplorer ()
 Show local explorer. More...
 
 dShowCmsExplorer (ilExplorer $localExplorer)
 Show cms explorer. More...
 
 dInitEditTree ()
 Init tree. More...
 
 dMap ()
 Do mapping. More...
 
 dMappingOverview ()
 Show directory trees. More...
 
 setTabs ()
 Set tabs. More...
 
 setSubTabs (int $a_tab)
 Set Sub tabs. More...
 

Protected Attributes

ilLogger $log
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 

Private Attributes

ilTabsGUI $tabs
 
ilToolbarGUI $toolbar
 
ilECSSettingsGUI $container
 
ilECSSetting $server
 
int $mid
 

Detailed Description

Class for ECS node and directory mapping settings.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e @ilCtrl_isCalledBy ilECSMappingSettingsGUI: ilECSSettingsGUI

Definition at line 27 of file class.ilECSMappingSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilECSMappingSettingsGUI::__construct ( ilECSSettingsGUI  $settingsContainer,
int  $server_id,
int  $mid 
)

Constructor.

Definition at line 47 of file class.ilECSMappingSettingsGUI.php.

48 {
49 global $DIC;
50
51 $this->lng = $DIC->language();
52 $this->ctrl = $DIC->ctrl();
53 $this->tpl = $DIC->ui()->mainTemplate();
54 $this->log = $DIC->logger()->wsrv();
55 $this->tabs = $DIC->tabs();
56 $this->toolbar = $DIC->toolbar();
57
58 $this->container = $settingsContainer;
60 $this->mid = $mid;
61 $this->lng->loadLanguageModule('ecs');
62 }
static getInstanceByServerId(int $a_server_id)
Get singleton instance per server.
global $DIC
Definition: shib_login.php:26

References $DIC, $mid, ILIAS\Repository\ctrl(), ilECSSetting\getInstanceByServerId(), ILIAS\Repository\lng(), ILIAS\UI\examples\Progress\Bar\server(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

Member Function Documentation

◆ cAddAttribute()

ilECSMappingSettingsGUI::cAddAttribute ( )
protected

Add one attribute in form.

Definition at line 201 of file class.ilECSMappingSettingsGUI.php.

201 : void
202 {
203 $next_attribute = ilECSCourseAttributes::getInstance($this->getServer()->getServerId(), $this->getMid())->getNextAttributeName((string) $_REQUEST['ecs_ca']);
204 $this->cInitOverview(null, $next_attribute);
205 }
static getInstance(int $a_server_id, int $a_mid)
Get instance.
cInitOverview($form=null, $current_attribute=null)
Show overview page.

References cInitOverview(), ilECSCourseAttributes\getInstance(), getMid(), and getServer().

+ Here is the call graph for this function:

◆ cancel()

ilECSMappingSettingsGUI::cancel ( )

return to parent container

Definition at line 113 of file class.ilECSMappingSettingsGUI.php.

113 : void
114 {
115 $this->ctrl->returnToParent($this);
116 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ cDeleteAttribute()

ilECSMappingSettingsGUI::cDeleteAttribute ( )
protected

Delete last attribute in form.

Definition at line 210 of file class.ilECSMappingSettingsGUI.php.

210 : void
211 {
212 $prev_attribute = ilECSCourseAttributes::getInstance($this->getServer()->getServerId(), $this->getMid())->getPreviousAttributeName((string) $_REQUEST['ecs_ca']);
213 $this->cInitOverview(null, $prev_attribute);
214 }

References cInitOverview(), ilECSCourseAttributes\getInstance(), getMid(), and getServer().

+ Here is the call graph for this function:

◆ cDeleteRulesOfNode()

ilECSMappingSettingsGUI::cDeleteRulesOfNode ( )
protected

Definition at line 415 of file class.ilECSMappingSettingsGUI.php.

415 : void
416 {
417 $current_node = (int) $_REQUEST['lnodes'];
418
420 $this->getServer()->getServerId(),
421 $this->getMid(),
422 $current_node
423 );
424
425 foreach ($rules as $rid) {
426 $rule = new ilECSCourseMappingRule($rid);
427 $rule->delete();
428 }
429 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
430 $this->ctrl->redirect($this, 'cInitOverview');
431 }
static getRulesOfRefId(int $a_sid, int $a_mid, int $a_ref_id)
Get all rule of ref_id.

References ILIAS\Repository\ctrl(), getMid(), ilECSCourseMappingRule\getRulesOfRefId(), getServer(), ILIAS\Repository\int(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ cInitMappingForm()

ilECSMappingSettingsGUI::cInitMappingForm ( int  $current_node,
  $current_attribute 
)
protected

Init the mapping form.

Definition at line 250 of file class.ilECSMappingSettingsGUI.php.

251 {
252 $attributes_obj = ilECSCourseAttributes::getInstance($this->getServer()->getServerId(), $this->getMid());
253
254 $form = new ilPropertyFormGUI();
255 $form->setTableWidth("100%");
256 $this->ctrl->setParameter($this, 'ecs_ca', $current_attribute);
257 $form->setFormAction($this->ctrl->getFormAction($this));
258 $this->ctrl->setParameter($this, 'ecs_ca', '');
259
260 $form->setTitle($this->lng->txt('ecs_cmap_mapping_form_title') . ' ' . ilObject::_lookupTitle(ilObject::_lookupObjId($current_node)));
261
262 // Iterate through all current attributes
263 $attributes = $attributes_obj->getAttributeSequence($current_attribute);
264 foreach ($attributes as $att_name) {
265 $rule = ilECSCourseMappingRule::getInstanceByAttribute($this->getServer()->getServerId(), $this->getMid(), $current_node, $att_name);
266
267 $section = new ilFormSectionHeaderGUI();
268 $section->setTitle($this->lng->txt('ecs_cmap_att_' . $att_name));
269
270 // Filter
271 $form->addItem($section);
272
273 $isfilter = new ilRadioGroupInputGUI($this->lng->txt('ecs_cmap_form_filter'), $att_name . '_is_filter');
274 $isfilter->setValue($rule->isFilterEnabled() ? "1" : "0");
275
276 $all_values = new ilRadioOption($this->lng->txt('ecs_cmap_form_all_values'), "0");
277 $isfilter->addOption($all_values);
278
279 $use_filter = new ilRadioOption($this->lng->txt('ecs_cmap_form_filter_by_values'), "1");
280 $filter = new ilTextInputGUI('', $att_name . '_filter');
281 $filter->setInfo($this->lng->txt('ecs_cmap_form_filter_info'));
282 $filter->setSize(50);
283 $filter->setMaxLength(512);
284 $filter->setRequired(true);
285 $filter->setValue($rule->getFilter());
286 $use_filter->addSubItem($filter);
287
288 $isfilter->addOption($use_filter);
289
290 $form->addItem($isfilter);
291
292 // Create subdirs
293 $subdirs = new ilCheckboxInputGUI($this->lng->txt('ecs_cmap_form_create_subdirs'), $att_name . '_subdirs');
294 $subdirs->setChecked($rule->isSubdirCreationEnabled());
295 $subdirs->setValue("1");
296
297 // Subdir types (disabled in spec)
298 /*
299 $subdir_type = new ilRadioGroupInputGUI($this->lng->txt('ecs_cmap_form_subdir_type'), $att_name.'_subdir_type');
300 $subdir_type->setValue($rule->getSubDirectoryType());
301
302 $value = new ilRadioOption($this->lng->txt('ecs_cmap_form_subdir_value'), ilECSCourseMappingRule::SUBDIR_VALUE);
303 $subdir_type->addOption($value);
304
305 $name = new ilRadioOption($this->lng->txt('ecs_cmap_form_subdir_name'), ilECSCourseMappingRule::SUBDIR_ATTRIBUTE_NAME);
306 $subdir_type->addOption($name);
307
308 $subdirs->addSubItem($subdir_type);
309 */
310 $form->addItem($subdirs);
311
312 // Directory relations
313 /*
314 $upper_attributes = ilECSCourseAttributes::getInstance(
315 $this->getServer()->getServerId(),
316 $this->getMid())->getUpperAttributes($att_name);
317
318 if($upper_attributes)
319 {
320 $dir_relation = new ilRadioGroupInputGUI($this->lng->txt('ecs_cmap_form_dir_relation'),$att_name.'_dir_relation');
321
322 $current_dir = new ilRadioOption($this->lng->txt('ecs_cmap_form_current_dir'),'');
323 $dir_relation->addOption($current_dir);
324 }
325 foreach($upper_attributes as $subdir_name)
326 {
327 $subdir = new ilRadioOption($this->lng->txt('ecs_cmap_att_'.$subdir_name),$subdir_name);
328 $dir_relation->addOption($subdir);
329 }
330 if($upper_attributes)
331 {
332 $dir_relation->setValue((string) $rule->getDirectory());
333 $form->addItem($dir_relation);
334 }
335 */
336 }
337
338 // add list of attributes
339 $hidden_atts = new ilHiddenInputGUI('attributes');
340 $hidden_atts->setValue(implode(',', $attributes));
341 $form->addItem($hidden_atts);
342
343
344 if ($current_attribute) {
345 $form->addCommandButton('cSaveOverview', $this->lng->txt('save'));
346 }
347
348 if ($attributes_obj->getNextAttributeName($current_attribute)) {
349 $form->addCommandButton('cAddAttribute', $this->lng->txt('ecs_cmap_add_attribute_btn'));
350 }
351 if ($attributes_obj->getPreviousAttributeName($current_attribute)) {
352 $form->addCommandButton('cDeleteAttribute', $this->lng->txt('ecs_cmap_delete_attribute_btn'));
353 }
355 $this->getServer()->getServerId(),
356 $this->getMid(),
357 $current_node
358 )) {
359 $form->addCommandButton('cDeleteRulesOfNode', $this->lng->txt('ecs_cmap_delete_rule'));
360 }
361
362 #$form->addCommandButton('cInitOverview', $this->lng->txt('cancel'));
363
364 $form->setShowTopButtons(false);
365
366 return $form;
367 }
This class represents a checkbox property in a property form.
static hasRules(int $a_sid, int $a_mid, int $a_ref_id)
static getInstanceByAttribute($a_sid, $a_mid, $a_ref_id, $a_att)
Get rule instance by attribute.
This class represents a section header in a property form.
This class represents a hidden form property in a property form.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a text property in a property form.

References ilObject\_lookupObjId(), ilObject\_lookupTitle(), ILIAS\Repository\ctrl(), ilECSCourseAttributes\getInstance(), ilECSCourseMappingRule\getInstanceByAttribute(), getMid(), getServer(), ilECSCourseMappingRule\hasRules(), and ILIAS\Repository\lng().

Referenced by cInitOverview(), and cSaveOverview().

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

◆ cInitOverview()

ilECSMappingSettingsGUI::cInitOverview (   $form = null,
  $current_attribute = null 
)
protected

Show overview page.

Definition at line 153 of file class.ilECSMappingSettingsGUI.php.

153 : void
154 {
155 $current_node = (array) (($_REQUEST['lnodes']) ?: ROOT_FOLDER_ID);
156 //TODO fix proper handling of input
157 $current_node = (int) end($current_node);
158
159 $this->ctrl->setParameter($this, 'lnodes', $current_node);
160
161 $this->setSubTabs(self::TAB_COURSE);
162 $this->tabs->activateTab('ecs_crs_allocation');
163 $this->tabs->activateSubTab('cInitTree');
164
165 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.ecs_cmap_overview.html', 'components/ILIAS/WebServices/ECS');
166
167 $explorer = $this->cShowLocalExplorer();
168 if (!$form instanceof ilPropertyFormGUI) {
169 if ($current_attribute === null) {
170 // check request
171 $current_attribute = (string) $_REQUEST['ecs_ca'];
172 if (!$current_attribute) {
174 $this->getServer()->getServerId(),
175 $this->getMid(),
176 $current_node
177 );
178
179 $current_attribute =
180 $existing ?:
181 '';
182 /*
183 ilECSCourseAttributes::getInstance(
184 $this->getServer()->getServerId(),
185 $this->getMid())->getFirstAttributeName()
186 );
187 */
188 }
189 }
190 $form = $this->cInitMappingForm($current_node, $current_attribute);
191 }
192
193 $this->tpl->setVariable('TFORM_ACTION', $this->ctrl->getFormAction($this));
194 $this->tpl->setVariable('LOCAL_EXPLORER', $explorer->getOutput());
195 $this->tpl->setVariable('MAPPING_FORM', $form->getHTML());
196 }
static lookupLastExistingAttribute(int $a_sid, int $a_mid, int $a_ref_id)
Lookup existing attributes.
cInitMappingForm(int $current_node, $current_attribute)
Init the mapping form.
const ROOT_FOLDER_ID
Definition: constants.php:32

References cInitMappingForm(), cShowLocalExplorer(), ILIAS\Repository\ctrl(), getMid(), getServer(), ILIAS\Repository\int(), ilECSCourseMappingRule\lookupLastExistingAttribute(), ROOT_FOLDER_ID, setSubTabs(), and ILIAS\Repository\tabs().

Referenced by cAddAttribute(), cDeleteAttribute(), cSaveOverview(), and cStart().

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

◆ cSaveOverview()

ilECSMappingSettingsGUI::cSaveOverview ( )
protected

Save overview.

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

372 : void
373 {
374 $current_node = (int) $_REQUEST['lnodes'];
375 $current_att = (string) $_REQUEST['ecs_ca'];
376 $form = $this->cInitMappingForm($current_node, $current_att);
377
378 if ($form->checkInput()) {
379 // save ...
380 $all_attributes = explode(',', $form->getInput('attributes'));
381 foreach ((array) $all_attributes as $att_name) {
383 $this->getServer()->getServerId(),
384 $this->getMid(),
385 $current_node,
386 $att_name
387 );
388 $rule->setServerId($this->getServer()->getServerId());
389 $rule->setMid($this->getMid());
390 $rule->setRefId($current_node);
391 $rule->setAttribute($att_name);
392 $rule->enableFilter((bool) $form->getInput($att_name . '_is_filter'));
393 $rule->setFilter($form->getInput($att_name . '_filter'));
394 $rule->enableSubdirCreation((bool) $form->getInput($att_name . '_subdirs'));
395 //$rule->setSubDirectoryType($form->getInput($att_name.'_subdir_type'));
396 //$rule->setDirectory($form->getInput($att_name.'_dir_relation'));
397
398 if ($rule->getRuleId()) {
399 $rule->update();
400 } else {
401 $rule->save();
402 }
403 }
404
405 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
406 $this->ctrl->setParameter($this, 'lnodes', $current_node);
407 $this->ctrl->redirect($this, 'cInitOverview');
408 }
409
410 $form->setValuesByPost();
411 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
412 $this->cInitOverview($form, $current_att);
413 }

References cInitMappingForm(), cInitOverview(), ILIAS\Repository\ctrl(), ilECSCourseMappingRule\getInstanceByAttribute(), getMid(), getServer(), ILIAS\Repository\int(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ cSettings()

ilECSMappingSettingsGUI::cSettings ( ?ilPropertyFormGUI  $form = null)
protected

Show course allocation.

Definition at line 439 of file class.ilECSMappingSettingsGUI.php.

439 : bool
440 {
441 $this->setSubTabs(self::TAB_COURSE);
442 $this->tabs->activateTab('ecs_crs_allocation');
443 $this->tabs->activateSubTab('cSettings');
444
445 if (!$form instanceof ilPropertyFormGUI) {
446 $form = $this->initFormCSettings();
447 }
448
449 $this->tpl->setContent($form->getHTML());
450
451 return true;
452 }

References initFormCSettings(), setSubTabs(), and ILIAS\Repository\tabs().

Referenced by cStart(), and cUpdateSettings().

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

◆ cShowLocalExplorer()

ilECSMappingSettingsGUI::cShowLocalExplorer ( )
protected

Show local explorer.

Definition at line 219 of file class.ilECSMappingSettingsGUI.php.

220 {
221 $explorer = new ilECSNodeMappingLocalExplorer(
222 $this->ctrl->getLinkTarget($this, 'cInitOverview'),
223 $this->getServer()->getServerId(),
224 $this->getMid()
225 );
226 $explorer->setPostVar('lnodes[]');
227
228 $lnodes = (array) $_REQUEST['lnodes'];
229 $checked_node = (int) array_pop($lnodes);
230 if ((int) $_REQUEST['lid']) {
231 $checked_node = (int) $_REQUEST['lid'];
232 }
233
234 if ($checked_node) {
235 $explorer->setCheckedItems(array($checked_node));
236 } else {
237 $explorer->setCheckedItems(array(ROOT_FOLDER_ID));
238 }
239 $explorer->setTargetGet('lref_id');
240 $explorer->setSessionExpandVariable('lexpand');
241 $explorer->setExpand((int) $_GET['lexpand']);
242 $explorer->setExpandTarget($this->ctrl->getLinkTarget($this, 'cInitOverview'));
243 $explorer->setOutput(0);
244 return $explorer;
245 }
$_GET['cmd']
Definition: lti.php:26

References $_GET, ILIAS\Repository\ctrl(), ILIAS\Repository\int(), and ROOT_FOLDER_ID.

Referenced by cInitOverview().

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

◆ cStart()

ilECSMappingSettingsGUI::cStart ( )
protected

Goto default page.

Definition at line 126 of file class.ilECSMappingSettingsGUI.php.

126 : void
127 {
129 $this->getServer()->getServerId(),
130 $this->getMid()
131 )->isCourseAllocationEnabled()) {
132 $this->cInitOverview();
133 } else {
134 $this->cSettings();
135 }
136 }
cSettings(?ilPropertyFormGUI $form=null)
Show course allocation.
static getInstanceByServerMid(int $a_server_id, int $a_mid)
Get instance.

References cInitOverview(), cSettings(), ilECSNodeMappingSettings\getInstanceByServerMid(), getMid(), and getServer().

+ Here is the call graph for this function:

◆ cUpdateSettings()

ilECSMappingSettingsGUI::cUpdateSettings ( )
protected

Update course settings.

Definition at line 589 of file class.ilECSMappingSettingsGUI.php.

589 : void
590 {
591 $form = $this->initFormCSettings();
592 if ($form->checkInput()) {
593 $settings = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid());
594 $settings->enableCourseAllocation((bool) $form->getInput('enabled'));
595 $settings->setDefaultCourseCategory((int) $form->getInput('default_cat'));
596 $settings->enableAllInOne((bool) $form->getInput('allinone'));
597 $settings->setAllInOneCategory((int) $form->getInput('allinone_cat'));
598 $settings->enableAttributeMapping((bool) $form->getInput('multiple'));
599 $settings->setAuthMode($form->getInput('auth_mode'));
600
601 $role_mappings = [];
602 foreach (ilECSMappingUtils::getRoleMappingInfo() as $role => $name) {
603 $role_mappings[$role] = $form->getInput((string) $role);
604 }
605 $settings->setRoleMappings($role_mappings);
606 $settings->update();
607
608 // store attribute settings
609 $attributes = new ilECSCourseAttributes($this->getServer()->getServerId(), $this->getMid());
610 $attributes->delete();
611
612 $form_atts = $form->getInput('atts');
613
614 foreach ($form_atts as $name) {
615 if (!$name) {
616 continue;
617 }
618
619 $att = new ilECSCourseAttribute();
620 $att->setServerId($this->getServer()->getServerId());
621 $att->setMid($this->getMid());
622 $att->setName($name);
623 $att->save();
624 }
625
626 //$att = new ilECSCourseAttribute();
627 //$att->setName($a_name)
628
629 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
630 $this->ctrl->redirect($this, 'cSettings');
631 }
632 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
633 $form->setValuesByPost();
634 $this->cSettings($form);
635 }
Storage of course attributes for assignment rules.
Storage of course attributes for assignment rules.
static getRoleMappingInfo($a_role_type_info=0)
Get role mapping info.

References cSettings(), ILIAS\Repository\ctrl(), ilECSNodeMappingSettings\getInstanceByServerMid(), getMid(), ilECSMappingUtils\getRoleMappingInfo(), getServer(), initFormCSettings(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ dConfirmDeleteTree()

ilECSMappingSettingsGUI::dConfirmDeleteTree ( )
protected

Delete tree settings.

Definition at line 710 of file class.ilECSMappingSettingsGUI.php.

710 : void
711 {
712 $this->setSubTabs(self::TAB_DIRECTORY);
713 $this->tabs->activateSubTab('dTrees');
714 $this->tabs->activateTab('ecs_dir_allocation');
715
716 $confirm = new ilConfirmationGUI();
717 $confirm->setFormAction($this->ctrl->getFormAction($this));
718 $confirm->setHeaderText($this->lng->txt('ecs_confirm_delete_tree'));
719
720 $confirm->addItem(
721 'tid',
722 $_REQUEST['tid'],
724 $this->getServer()->getServerId(),
725 $this->getMid(),
726 (int) $_REQUEST['tid']
727 )
728 );
729 $confirm->setConfirm($this->lng->txt('delete'), 'dDeleteTree');
730 $confirm->setCancel($this->lng->txt('cancel'), 'dTrees');
731
732 $this->tpl->setContent($confirm->getHTML());
733 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupTitle(int $a_server_id, int $a_mid, int $a_tree_id)
Lookup title by obj id.

References ILIAS\Repository\ctrl(), getMid(), getServer(), ILIAS\Repository\lng(), ilECSCmsData\lookupTitle(), setSubTabs(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

◆ dDeleteTree()

ilECSMappingSettingsGUI::dDeleteTree ( )
protected

Delete tree.

Definition at line 738 of file class.ilECSMappingSettingsGUI.php.

738 : void
739 {
740 $this->log->info('Deleting tree');
741
742 $tree = new ilECSCmsTree((int) $_REQUEST['tid']);
743 $tree->deleteTree($tree->getNodeData(ilECSCmsTree::lookupRootId((int) $_REQUEST['tid'])));
744
745
746
747 // also delete import information
748 ilECSImportManager::getInstance()->deleteRessources(
749 $this->getServer()->getServerId(),
750 $this->getMid(),
752 $this->getServer()->getServerId(),
753 $this->getMid(),
754 (int) $_REQUEST['tid']
755 )
756 );
757
758 $data = new ilECSCmsData();
759 $data->setServerId($this->getServer()->getServerId());
760 $data->setMid($this->getMid());
761 $data->setTreeId((int) $_REQUEST['tid']);
762 $data->deleteTree();
763
765 $this->getServer()->getServerId(),
766 $this->getMid(),
767 (int) $_REQUEST['tid']
768 );
769
770 $this->tpl->setOnScreenMessage('success', $this->lng->txt('ecs_cms_tree_deleted'), true);
771 $this->ctrl->redirect($this, 'dTrees');
772 }
static lookupCmsIdsOfTree($a_server_id, $a_mid, $a_tree_id)
static lookupRootId($a_tree_id)
lookup root id
static getInstance()
Get the singleton instance of this ilECSImportManager.
static deleteMappings(int $a_server_id, int $a_mid, int $a_tree_id)
Delete mappings.

References $data, ILIAS\Repository\ctrl(), ilECSNodeMappingAssignments\deleteMappings(), ilECSImportManager\getInstance(), getMid(), getServer(), ILIAS\Repository\lng(), ilECSCmsData\lookupCmsIdsOfTree(), and ilECSCmsTree\lookupRootId().

+ Here is the call graph for this function:

◆ dEditTree()

ilECSMappingSettingsGUI::dEditTree ( ?ilPropertyFormGUI  $form = null)
protected

Edit directory tree assignments.

Definition at line 777 of file class.ilECSMappingSettingsGUI.php.

777 : void
778 {
779 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.ecs_edit_tree.html', 'components/ILIAS/WebServices/ECS');
780
781 $this->ctrl->saveParameter($this, 'cid');
782
783 $this->tabs->clearTargets();
784 $this->tabs->setBack2Target(
785 $this->lng->txt('ecs_back_settings'),
786 $this->ctrl->getLinkTarget($this, 'cancel')
787 );
788 $this->tabs->setBackTarget(
789 $this->lng->txt('ecs_cms_dir_tree'),
790 $this->ctrl->getLinkTarget($this, 'dTrees')
791 );
792
793 $this->tpl->setVariable('LEGEND', $this->lng->txt('ecs_status_legend'));
794 $this->tpl->setVariable('PENDING_UNMAPPED', $this->lng->txt('ecs_status_pending_unmapped'));
795 $this->tpl->setVariable('PENDING_UNMAPPED_DISCON', $this->lng->txt('ecs_status_pending_unmapped_discon'));
796 $this->tpl->setVariable('PENDING_UNMAPPED_NONDISCON', $this->lng->txt('ecs_status_pending_unmapped_nondiscon'));
797 $this->tpl->setVariable('MAPPED', $this->lng->txt('ecs_status_mapped'));
798 $this->tpl->setVariable('DELETED', $this->lng->txt('ecs_status_deleted'));
799
800 $form = $this->dInitFormTreeSettings($form);
801 $this->tpl->setVariable('GENERAL_FORM', $form->getHTML());
802 $this->tpl->setVariable('TFORM_ACTION', $this->ctrl->getFormAction($this, 'dEditTree'));
803
804 $explorer = $this->dShowLocalExplorer();
805 $this->dShowCmsExplorer($explorer);
806 }
dShowCmsExplorer(ilExplorer $localExplorer)
Show cms explorer.
dInitFormTreeSettings(?ilPropertyFormGUI $form=null)
Init form settings.

References ILIAS\Repository\ctrl(), dInitFormTreeSettings(), dShowCmsExplorer(), dShowLocalExplorer(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

Referenced by dInitEditTree(), and dUpdateTreeSettings().

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

◆ dInitEditTree()

ilECSMappingSettingsGUI::dInitEditTree ( )
protected

Init tree.

Definition at line 1044 of file class.ilECSMappingSettingsGUI.php.

1044 : void
1045 {
1047 $this->getServer()->getServerId(),
1048 $this->getMid(),
1049 (int) $_REQUEST['tid']
1050 );
1051 $this->dEditTree();
1052 }
static updateStatus(int $a_server_id, int $a_mid, int $a_tree_id)
dEditTree(?ilPropertyFormGUI $form=null)
Edit directory tree assignments.

References dEditTree(), getMid(), getServer(), and ilECSCmsData\updateStatus().

+ Here is the call graph for this function:

◆ dInitFormTreeSettings()

ilECSMappingSettingsGUI::dInitFormTreeSettings ( ?ilPropertyFormGUI  $form = null)
protected

Init form settings.

Definition at line 811 of file class.ilECSMappingSettingsGUI.php.

812 {
813 if ($form instanceof ilPropertyFormGUI) {
814 return $form;
815 }
816
817 $assignment = new ilECSNodeMappingAssignment(
818 $this->getServer()->getServerId(),
819 $this->getMid(),
820 (int) $_REQUEST['tid'],
821 0
822 );
823
824 $form = new ilPropertyFormGUI();
825 $form->setFormAction($this->ctrl->getFormAction($this, 'dEditTree'));
826 $form->setTitle($this->lng->txt('general_settings'));
827 $form->addCommandButton('dUpdateTreeSettings', $this->lng->txt('save'));
828 $form->addCommandButton('dTrees', $this->lng->txt('cancel'));
829 $form->setTableWidth('30%');
830
831 // CMS id (readonly)
832 $cmsid = new ilNumberInputGUI($this->lng->txt('ecs_cms_id'), 'cmsid');
833 $cmsid->setValue(
835 );
836 $cmsid->setDisabled(true);
837 $cmsid->setSize(7);
838 $cmsid->setMaxLength(12);
839 $form->addItem($cmsid);
840
841
843 $this->getServer()->getServerId(),
844 $this->getMid(),
845 (int) $_REQUEST['tid']
846 );
847 $mapping_advanced = ($mapping_status !== ilECSMappingUtils::MAPPED_MANUAL);
848
849 // Status (readonly)
850 $status = new ilNonEditableValueGUI($this->lng->txt('status'), '');
851 $status->setValue(ilECSMappingUtils::mappingStatusToString($mapping_status));
852 $form->addItem($status);
853
854 // title update
855 $title = new ilCheckboxInputGUI($this->lng->txt('ecs_title_updates'), 'title');
856 $title->setValue("1");
857 $title->setChecked($assignment->isTitleUpdateEnabled());
858 #$title->setInfo($this->lng->txt('ecs_title_update_info'));
859 $form->addItem($title);
860
861
862 $position = new ilCheckboxInputGUI($this->lng->txt('ecs_position_updates'), 'position');
863 $position->setDisabled(!$mapping_advanced);
864 $position->setChecked($mapping_advanced && $assignment->isPositionUpdateEnabled());
865 $position->setValue("1");
866 #$position->setInfo($this->lng->txt('ecs_position_update_info'));
867 $form->addItem($position);
868
869 $tree = new ilCheckboxInputGUI($this->lng->txt('ecs_tree_updates'), 'tree');
870 $tree->setDisabled(!$mapping_advanced);
871 $tree->setChecked($mapping_advanced && $assignment->isTreeUpdateEnabled());
872 $tree->setValue("1");
873 #$tree->setInfo($this->lng->txt('ecs_tree_update_info'));
874 $form->addItem($tree);
875
876 return $form;
877 }
static lookupCmsId($a_obj_id)
Lookup cms id.
static mappingStatusToString(int $a_status)
Get mapping status as string.
static lookupMappingStatus(int $a_server_id, int $a_mid, int $a_tree_id)
Lookup mapping status.
This class represents a non editable value in a property form.
This class represents a number property in a property form.

References ILIAS\Repository\ctrl(), getMid(), getServer(), ILIAS\Repository\lng(), ilECSCmsData\lookupCmsId(), ilECSMappingUtils\lookupMappingStatus(), ilECSCmsTree\lookupRootId(), ilECSMappingUtils\MAPPED_MANUAL, and ilECSMappingUtils\mappingStatusToString().

Referenced by dEditTree(), and dUpdateTreeSettings().

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

◆ dMap()

ilECSMappingSettingsGUI::dMap ( )
protected

Do mapping.

Definition at line 1058 of file class.ilECSMappingSettingsGUI.php.

1058 : void
1059 {
1060 if (!$_POST['lnodes']) {
1061 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
1062 $this->ctrl->redirect($this, 'dEditTree');
1063 }
1064
1065 $ref_id = end($_POST['lnodes']);
1066
1068 $this->getServer()->getServerId(),
1069 $this->getMid(),
1070 (int) $_REQUEST['tid'],
1071 $ref_id
1072 );
1073
1074
1075 $nodes = (array) $_POST['rnodes'];
1076 $nodes = array_reverse($nodes);
1077
1078 foreach ($nodes as $cms_id) {
1079 $assignment = new ilECSNodeMappingAssignment(
1080 $this->getServer()->getServerId(),
1081 $this->getMid(),
1082 (int) $_REQUEST['tid'],
1083 (int) $cms_id
1084 );
1085 $assignment->setRefId($ref_id);
1086 $assignment->setObjId(ilObject::_lookupObjId($ref_id));
1087 $assignment->enablePositionUpdate(false);
1088 $assignment->enableTreeUpdate(false);
1089 $assignment->enableTitleUpdate(ilECSNodeMappingAssignments::lookupDefaultTitleUpdate(
1090 $this->getServer()->getServerId(),
1091 $this->getMid(),
1092 (int) $_REQUEST['tid']
1093 ));
1094 $assignment->update();
1095
1096 // Delete subitems mappings for cms subtree
1097 $cmsTree = new ilECSCmsTree((int) $_REQUEST['tid']);
1098 $childs = $cmsTree->getSubTreeIds($cms_id);
1099
1101 $this->getServer()->getServerId(),
1102 $this->getMid(),
1103 (int) $_REQUEST['tid'],
1104 $childs
1105 );
1106 }
1107
1109 $this->getServer()->getServerId(),
1110 $this->getMid(),
1111 (int) $_REQUEST['tid']
1112 );
1113
1114 // Save parameter cid
1115 $this->ctrl->setParameter($this, 'lid', (int) $ref_id);
1116
1117 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
1118 $this->ctrl->redirect($this, 'dEditTree');
1119 }
static deleteDisconnectableMappings(int $a_server_id, int $a_mid, int $a_tree_id, int $a_ref_id)
delete disconnectable mappings
static lookupDefaultTitleUpdate($a_server_id, $a_mid, $a_tree_id)
Lookup default title update setting.
static deleteMappingsByCsId(int $a_server_id, int $a_mid, int $a_tree_id, array $cs_ids)
Delete mappings.
$_POST['cmd']
Definition: lti.php:27
$ref_id
Definition: ltiauth.php:66

References $_POST, $ref_id, ilObject\_lookupObjId(), ILIAS\Repository\ctrl(), ilECSNodeMappingAssignments\deleteDisconnectableMappings(), ilECSNodeMappingAssignments\deleteMappingsByCsId(), getMid(), getServer(), ILIAS\Repository\lng(), ilECSNodeMappingAssignments\lookupDefaultTitleUpdate(), and ilECSCmsData\updateStatus().

+ Here is the call graph for this function:

◆ dMappingOverview()

ilECSMappingSettingsGUI::dMappingOverview ( )
protected

Show directory trees.

Definition at line 1124 of file class.ilECSMappingSettingsGUI.php.

1124 : void
1125 {
1126 $this->setSubTabs(self::TAB_DIRECTORY);
1127 $this->tabs->activateSubTab('dMappingOverview');
1128 $this->tabs->activateTab('ecs_dir_allocation');
1129 }

References setSubTabs(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

◆ dSettings()

ilECSMappingSettingsGUI::dSettings ( ?ilPropertyFormGUI  $form = null)
protected

Show directory allocation.

Definition at line 571 of file class.ilECSMappingSettingsGUI.php.

571 : bool
572 {
573 $this->setSubTabs(self::TAB_DIRECTORY);
574 $this->tabs->activateTab('ecs_dir_allocation');
575 $this->tabs->activateSubTab('dSettings');
576
577 if (!$form instanceof ilPropertyFormGUI) {
578 $form = $this->initFormDSettings();
579 }
580
581 $this->tpl->setContent($form->getHTML());
582
583 return true;
584 }

References initFormDSettings(), setSubTabs(), and ILIAS\Repository\tabs().

Referenced by dStart().

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

◆ dShowCmsExplorer()

ilECSMappingSettingsGUI::dShowCmsExplorer ( ilExplorer  $localExplorer)
protected

Show cms explorer.

Definition at line 987 of file class.ilECSMappingSettingsGUI.php.

987 : void
988 {
989 $explorer = new ilECSNodeMappingCmsExplorer(
990 $this->ctrl->getLinkTarget($this, 'dEditTree'),
991 $this->getServer()->getServerId(),
992 $this->getMid(),
993 (int) $_REQUEST['tid']
994 );
995 $explorer->setRoot(ilECSCmsTree::lookupRootId((int) $_REQUEST['tid']));
996 $explorer->setTree(
997 new ilECSCmsTree(
998 (int) $_REQUEST['tid']
999 )
1000 );
1001 $explorer->setPostVar('rnodes[]');
1002
1003 // Read checked items from mapping of checked items in local explorer
1004 // $active_node = $this->tree->getRootId();
1005 foreach ($localExplorer->getCheckedItems() as $ref_id) {
1006 $explorer->setCheckedItems(
1008 $this->getServer()->getServerId(),
1009 $this->getMid(),
1010 (int) $_REQUEST['tid'],
1011 $ref_id
1012 )
1013 );
1014 // $active_node = $ref_id;
1015 }
1016
1017 // $cmsTree = new ilECSCmsTree((int) $_REQUEST['tid']);
1018 // foreach (ilECSNodeMappingAssignments::lookupAssignmentsByRefId(
1019 // $this->getServer()->getServerId(),
1020 // $this->getMid(),
1021 // (int) $_REQUEST['tid'],
1022 // $active_node
1023 // ) as $cs_id) {
1024 // foreach ($cmsTree->getPathId($cs_id) as $path_id) {
1025 // #$explorer->setExpand($path_id);
1026 // }
1027 // }
1028
1029 $explorer->setTargetGet('rref_id');
1030 $explorer->setSessionExpandVariable('rexpand');
1031
1032 #if((int) $_REQUEST['rexpand'])
1033 {
1034 $explorer->setExpand((int) $_GET['rexpand']);
1035 }
1036 $explorer->setExpandTarget($this->ctrl->getLinkTarget($this, 'dEditTree'));
1037 $explorer->setOutput(0);
1038 $this->tpl->setVariable('REMOTE_EXPLORER', $explorer->getOutput());
1039 }
static lookupMappedItemsForRefId(int $a_server_id, int $a_mid, int $a_tree_id, int $a_ref_id)
Get cs ids for ref_id.

References $_GET, $ref_id, ILIAS\Repository\ctrl(), getMid(), getServer(), ilECSNodeMappingAssignments\lookupMappedItemsForRefId(), and ilECSCmsTree\lookupRootId().

Referenced by dEditTree().

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

◆ dShowLocalExplorer()

ilECSMappingSettingsGUI::dShowLocalExplorer ( )
protected

Show local explorer.

Definition at line 954 of file class.ilECSMappingSettingsGUI.php.

955 {
956 $explorer = new ilECSNodeMappingLocalExplorer(
957 $this->ctrl->getLinkTarget($this, 'dEditTree'),
958 $this->getServer()->getServerId(),
959 $this->getMid()
960 );
961 $explorer->setPostVar('lnodes[]');
962
963 $lnodes = (array) $_REQUEST['lnodes'];
964 $checked_node = array_pop($lnodes);
965 if ((int) $_REQUEST['lid']) {
966 $checked_node = (int) $_REQUEST['lid'];
967 }
968
969 if ($checked_node) {
970 $explorer->setCheckedItems(array($checked_node));
971 } else {
972 $explorer->setCheckedItems(array(ROOT_FOLDER_ID));
973 }
974 $explorer->setTargetGet('lref_id');
975 $explorer->setSessionExpandVariable('lexpand');
976 $explorer->setExpand((int) $_GET['lexpand']);
977 $explorer->setExpandTarget($this->ctrl->getLinkTarget($this, 'dEditTree'));
978 $explorer->setOutput(0);
979 $this->tpl->setVariable('LOCAL_EXPLORER', $explorer->getOutput());
980
981 return $explorer;
982 }

References $_GET, ILIAS\Repository\ctrl(), ILIAS\Repository\int(), and ROOT_FOLDER_ID.

Referenced by dEditTree().

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

◆ dStart()

ilECSMappingSettingsGUI::dStart ( )
protected

Goto default page.

Definition at line 141 of file class.ilECSMappingSettingsGUI.php.

141 : void
142 {
143 if (ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isDirectoryMappingEnabled()) {
144 $this->dTrees();
145 } else {
146 $this->dSettings();
147 }
148 }
dSettings(?ilPropertyFormGUI $form=null)
Show directory allocation.

References dSettings(), dTrees(), ilECSNodeMappingSettings\getInstanceByServerMid(), getMid(), and getServer().

+ Here is the call graph for this function:

◆ dSynchronizeTree()

ilECSMappingSettingsGUI::dSynchronizeTree ( )
protected

Synchronize Tree.

Definition at line 914 of file class.ilECSMappingSettingsGUI.php.

914 : void
915 {
916 $sync = new ilECSCmsTreeSynchronizer(
917 $this->getServer(),
918 $this->mid,
919 (int) $_REQUEST['tid']
920 );
921 $sync->sync();
922 $this->tpl->setOnScreenMessage('success', $this->lng->txt('ecs_cms_tree_synchronized'), true);
923 $this->ctrl->redirect($this, 'dTrees');
924 }

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

+ Here is the call graph for this function:

◆ dSynchronizeTrees()

ilECSMappingSettingsGUI::dSynchronizeTrees ( )
protected

Definition at line 926 of file class.ilECSMappingSettingsGUI.php.

926 : void
927 {
928 $this->log->dump('Start synchronizing cms directory trees');
929
930 try {
931 $connector = new ilECSDirectoryTreeConnector($this->getServer());
932 $res = $connector->getDirectoryTrees();
933
934 $this->log->dump($res, ilLogLevel::DEBUG);
935
936 foreach ($res->getLinkIds() as $cms_id) {
937 $event = new ilECSEventQueueReader($this->getServer());
938 $event->add(
940 $cms_id,
942 );
943 }
944 $this->ctrl->redirect($this, 'dTrees');
945 } catch (Exception $e) {
946 $this->tpl->setOnScreenMessage('failure', $e->getMessage(), true);
947 $this->ctrl->redirect($this, 'dTrees');
948 }
949 }
Reads ECS events and stores them in the database.
$res
Definition: ltiservices.php:69

References Vendor\Package\$e, $res, ILIAS\Repository\ctrl(), ilLogLevel\DEBUG, getServer(), ilECSEventQueueReader\TYPE_DIRECTORY_TREES, and ilECSEvent\UPDATED.

+ Here is the call graph for this function:

◆ dTrees()

ilECSMappingSettingsGUI::dTrees ( )
protected

Show directory trees.

Definition at line 683 of file class.ilECSMappingSettingsGUI.php.

683 : bool
684 {
685 $this->setSubTabs(self::TAB_DIRECTORY);
686 $this->tabs->activateSubTab('dTrees');
687 $this->tabs->activateTab('ecs_dir_allocation');
688
689 $this->toolbar->addButton(
690 $this->lng->txt('ecs_sync_trees'),
691 $this->ctrl->getLinkTarget($this, 'dSynchronizeTrees')
692 );
693
694 $dtreeTable = new ilECSNodeMappingTreeTableGUI(
695 $this->getServer()->getServerId(),
696 $this->getMid(),
697 $this,
698 'dtree'
699 );
700
701
702 $dtreeTable->parse();
703 $this->tpl->setContent($dtreeTable->getHTML());
704 return true;
705 }

References getMid(), getServer(), ILIAS\Repository\lng(), setSubTabs(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

Referenced by dStart().

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

◆ dUpdateSettings()

ilECSMappingSettingsGUI::dUpdateSettings ( )
protected

Update node mapping settings.

Definition at line 640 of file class.ilECSMappingSettingsGUI.php.

640 : void
641 {
642 $form = $this->initFormDSettings();
643 if ($form->checkInput()) {
644 $settings = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid());
645 $settings->enableDirectoryMapping((bool) $form->getInput('active'));
646 $settings->enableEmptyContainerCreation(!$form->getInput('empty'));
647 $settings->update();
648 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
649 } else {
650 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'), true);
651 $form->setValuesByPost();
652 }
653 $this->ctrl->redirect($this, 'dSettings');
654 }

References ILIAS\Repository\ctrl(), ilECSNodeMappingSettings\getInstanceByServerMid(), getMid(), getServer(), initFormDSettings(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ dUpdateTreeSettings()

ilECSMappingSettingsGUI::dUpdateTreeSettings ( )
protected
Returns
boolean Update global settings

Definition at line 883 of file class.ilECSMappingSettingsGUI.php.

883 : bool
884 {
885 $assignment = new ilECSNodeMappingAssignment(
886 $this->getServer()->getServerId(),
887 $this->getMid(),
888 (int) $_REQUEST['tid'],
889 0
890 );
891 $assignment->setRefId(0);
892 $assignment->setObjId(0);
893
894 $form = $this->dInitFormTreeSettings();
895 if ($form->checkInput()) {
896 $assignment->enableTitleUpdate($form->getInput('title'));
897 $assignment->enableTreeUpdate($form->getInput('tree'));
898 $assignment->enablePositionUpdate($form->getInput('position'));
899 $assignment->update();
900
901 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved', "1"));
902 $this->ctrl->redirect($this, 'dEditTree');
903 }
904
905 $form->setValuesByPost();
906 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
907 $this->dEditTree($form);
908 return true;
909 }

References ILIAS\Repository\ctrl(), dEditTree(), dInitFormTreeSettings(), getMid(), getServer(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ executeCommand()

ilECSMappingSettingsGUI::executeCommand ( )

ilCtrl executeCommand

Definition at line 89 of file class.ilECSMappingSettingsGUI.php.

89 : void
90 {
91 $this->tpl->setTitle($this->lng->txt('ecs_campus_connect_title'));
92
93 $this->ctrl->saveParameter($this, 'server_id');
94 $this->ctrl->saveParameter($this, 'mid');
95 $this->ctrl->saveParameter($this, 'tid');
96
97 $next_class = $this->ctrl->getNextClass($this);
98 $cmd = $this->ctrl->getCmd();
99
100 $this->setTabs();
101 if (!$cmd) {
102 $cmd = "cStart";
103 }
104 $this->$cmd();
105
106 $this->tpl->setTitle($this->getServer()->getTitle());
107 $this->tpl->setDescription('');
108 }

References ILIAS\Repository\ctrl(), getServer(), ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle(), ILIAS\Repository\lng(), and setTabs().

+ Here is the call graph for this function:

◆ getContainer()

ilECSMappingSettingsGUI::getContainer ( )

Get container object.

Definition at line 67 of file class.ilECSMappingSettingsGUI.php.

References $container.

◆ getMid()

◆ getServer()

◆ initFormCSettings()

ilECSMappingSettingsGUI::initFormCSettings ( )
protected

Init settings form.

Definition at line 457 of file class.ilECSMappingSettingsGUI.php.

458 {
459 $form = new ilPropertyFormGUI();
460 $form->setFormAction($this->ctrl->getFormAction($this));
461 $form->setTitle($this->lng->txt('settings'));
462
463 // individual course allocation
464 $check = new ilCheckboxInputGUI($this->lng->txt('ecs_cmap_enable'), 'enabled');
465 $check->setChecked(ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isCourseAllocationEnabled());
466 $form->addItem($check);
467
468
469 // add default container
470 $imp = new ilCustomInputGUI($this->lng->txt('ecs_cmap_def_cat'), 'default_cat');
471 $imp->setRequired(true);
472
473 $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'components/ILIAS/WebServices/ECS');
474 $tpl->setVariable('SIZE', 5);
475 $tpl->setVariable('MAXLENGTH', 11);
476 $tpl->setVariable('POST_VAR', 'default_cat');
477
478 $default = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->getDefaultCourseCategory();
479 $tpl->setVariable('PROPERTY_VALUE', $default);
480
481 if ($default) {
482 $path = new ilPathGUI();
483 $path->enableTextOnly(false);
484 $path->enableHideLeaf(false);
485 $tpl->setVariable('COMPLETE_PATH', $path->getPath(ROOT_FOLDER_ID, $default));
486 }
487
488 $imp->setHtml($tpl->get());
489 $imp->setInfo($this->lng->txt('ecs_cmap_def_cat_info'));
490 $form->addItem($imp);
491
492 // all in one category
493 $allinone = new ilCheckboxInputGUI($this->lng->txt('ecs_cmap_all_in_one'), 'allinone');
494 $allinone->setChecked(ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isAllInOneCategoryEnabled());
495 $allinone->setInfo($this->lng->txt('ecs_cmap_all_in_one_info'));
496
497 $allinone_cat = new ilCustomInputGUI($this->lng->txt('ecs_cmap_all_in_one_cat'), 'allinone_cat');
498 $allinone_cat->setRequired(true);
499
500 $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'components/ILIAS/WebServices/ECS');
501 $tpl->setVariable('SIZE', 5);
502 $tpl->setVariable('MAXLENGTH', 11);
503 $tpl->setVariable('POST_VAR', 'allinone_cat');
504
505 $cat = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->getAllInOneCategory();
506 $tpl->setVariable('PROPERTY_VALUE', $cat);
507 if ($cat) {
508 $path = new ilPathGUI();
509 $path->enableTextOnly(false);
510 $path->enableHideLeaf(false);
511 $tpl->setVariable('COMPLETE_PATH', $path->getPath(ROOT_FOLDER_ID, $default));
512 }
513
514 $allinone_cat->setHtml($tpl->get());
515 $allinone->addSubItem($allinone_cat);
516 $form->addItem($allinone);
517
518 // multiple attributes
519 $multiple = new ilCheckboxInputGUI($this->lng->txt('ecs_cmap_multiple_atts'), 'multiple');
520 $multiple->setChecked(ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isAttributeMappingEnabled());
521
522 // attribute selection
523 $attributes = new ilSelectInputGUI($this->lng->txt('ecs_cmap_attributes'), 'atts');
524 $attributes->setMulti(true);
525 $attributes->setValue(
527 $this->getServer()->getServerId(),
528 $this->getMid()
529 )->getAttributeValues()
530 );
531 $attributes->setRequired(true);
533 $multiple->addSubItem($attributes);
534
535 $form->addItem($multiple);
536
537 // role mapping
538 $rm = new ilFormSectionHeaderGUI();
539 $rm->setTitle($this->lng->txt('ecs_role_mappings'));
540 $form->addItem($rm);
541
542 // auth type
543 $auth_type = new ilSelectInputGUI($this->lng->txt('ecs_member_auth_type'), 'auth_mode');
544 $auth_type->setOptions(ilECSMappingUtils::getAuthModeSelection());
545 $auth_type->setRequired(true);
546 $auth_type->setValue(ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->getAuthMode());
547 $form->addItem($auth_type);
548
549 $mapping_defs = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->getRoleMappings();
550
551 foreach (ilECSMappingUtils::getRoleMappingInfo() as $name => $info) {
552 $role_map = new ilTextInputGUI($this->lng->txt($info['lang']), (string) $name);
553 if (isset($mapping_defs[$name])) {
554 $role_map->setValue($mapping_defs[$name]);
555 }
556 $role_map->setSize(32);
557 $role_map->setMaxLength(64);
558 $role_map->setRequired($info['required']);
559 $form->addItem($role_map);
560 }
561
562 $form->addCommandButton('cUpdateSettings', $this->lng->txt('save'));
563 $form->addCommandButton('cSettings', $this->lng->txt('cancel'));
564
565 return $form;
566 }
$check
Definition: buildRTE.php:81
This class represents a custom property in a property form.
static getAuthModeSelection()
Get auth mode selection with active authentication modes.
static getCourseMappingFieldSelectOptions()
This class represents a selection list property in a property form.
special template class to simplify handling of ITX/PEAR
$info
Definition: entry_point.php:21
setVariable(string $variable, $value='')
Sets the given variable to the given value.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
$path
Definition: ltiservices.php:30

References $check, $info, $path, $tpl, ILIAS\Repository\ctrl(), ILIAS\UICore\GlobalTemplate\get(), ilECSMappingUtils\getAuthModeSelection(), ilECSMappingUtils\getCourseMappingFieldSelectOptions(), ilECSCourseAttributes\getInstance(), ilECSNodeMappingSettings\getInstanceByServerMid(), getMid(), ilECSMappingUtils\getRoleMappingInfo(), getServer(), ILIAS\Repository\lng(), ROOT_FOLDER_ID, and ILIAS\UICore\GlobalTemplate\setVariable().

Referenced by cSettings(), and cUpdateSettings().

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

◆ initFormDSettings()

ilECSMappingSettingsGUI::initFormDSettings ( )
protected

Definition at line 659 of file class.ilECSMappingSettingsGUI.php.

660 {
661 $form = new ilPropertyFormGUI();
662 $form->setFormAction($this->ctrl->getFormAction($this));
663 $form->setTitle($this->lng->txt('general_settings'));
664
665 $active = new ilCheckboxInputGUI($this->lng->txt('ecs_node_mapping_activate'), 'active');
666 $active->setChecked(ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isDirectoryMappingEnabled());
667 $form->addItem($active);
668
669 $create_empty = new ilCheckboxInputGUI($this->lng->txt('ecs_node_mapping_create_empty'), 'empty');
670 $create_empty->setChecked(!ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isEmptyContainerCreationEnabled());
671 $create_empty->setInfo($this->lng->txt('ecs_node_mapping_create_empty_info'));
672 $form->addItem($create_empty);
673
674 $form->addCommandButton('dUpdateSettings', $this->lng->txt('save'));
675 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
676
677 return $form;
678 }

References ILIAS\Repository\ctrl(), ilECSNodeMappingSettings\getInstanceByServerMid(), getMid(), getServer(), and ILIAS\Repository\lng().

Referenced by dSettings(), and dUpdateSettings().

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

◆ setSubTabs()

ilECSMappingSettingsGUI::setSubTabs ( int  $a_tab)
protected

Set Sub tabs.

Definition at line 1162 of file class.ilECSMappingSettingsGUI.php.

1162 : void
1163 {
1164 if ($a_tab === self::TAB_DIRECTORY) {
1165 $this->tabs->addSubTab(
1166 'dMappingOverview',
1167 $this->lng->txt('ecs_cc_mapping_overview'),
1168 $this->ctrl->getLinkTarget($this, 'dMappingOverview')
1169 );
1170 $this->tabs->addSubTab(
1171 'dTrees',
1172 $this->lng->txt('ecs_cms_dir_tree'),
1173 $this->ctrl->getLinkTarget($this, 'dTrees')
1174 );
1175 $this->tabs->addSubTab(
1176 'dSettings',
1177 $this->lng->txt('settings'),
1178 $this->ctrl->getLinkTarget($this, 'dSettings')
1179 );
1180 }
1181 if ($a_tab === self::TAB_COURSE) {
1182 if (ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isCourseAllocationEnabled()) {
1183 $this->tabs->addSubTab(
1184 'cInitTree',
1185 $this->lng->txt('ecs_cmap_overview'),
1186 $this->ctrl->getLinkTarget($this, 'cInitOverview')
1187 );
1188 }
1189
1190 $this->tabs->addSubTab(
1191 'cSettings',
1192 $this->lng->txt('settings'),
1193 $this->ctrl->getLinkTarget($this, 'cSettings')
1194 );
1195 }
1196 }

References ilECSNodeMappingSettings\getInstanceByServerMid(), getMid(), getServer(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

Referenced by cInitOverview(), cSettings(), dConfirmDeleteTree(), dMappingOverview(), dSettings(), and dTrees().

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

◆ setTabs()

ilECSMappingSettingsGUI::setTabs ( )
protected

Set tabs.

Definition at line 1136 of file class.ilECSMappingSettingsGUI.php.

1136 : void
1137 {
1138 $this->tabs->clearTargets();
1139 $this->tabs->setBackTarget(
1140 $this->lng->txt('ecs_back_settings'),
1141 $this->ctrl->getParentReturnByClass(self::class)
1142 );
1143 // Directories are only visible for import type campus managment.
1144 if (ilECSParticipantSettings::getInstanceByServerId($this->getServer()->getServerId())->lookupCmsMid() === $this->getMid()) {
1145 $this->tabs->addTab(
1146 'ecs_dir_allocation',
1147 $this->lng->txt('ecs_dir_alloc'),
1148 $this->ctrl->getLinkTarget($this, 'dSettings')
1149 );
1150 }
1151
1152 $this->tabs->addTab(
1153 'ecs_crs_allocation',
1154 $this->lng->txt('ecs_crs_alloc'),
1155 $this->ctrl->getLinkTarget($this, 'cStart')
1156 );
1157 }
static getInstanceByServerId(int $a_server_id)
Get instance by server id.

References ilECSParticipantSettings\getInstanceByServerId(), getMid(), getServer(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

Referenced by executeCommand().

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

Field Documentation

◆ $container

ilECSSettingsGUI ilECSMappingSettingsGUI::$container
private

Definition at line 39 of file class.ilECSMappingSettingsGUI.php.

Referenced by getContainer().

◆ $ctrl

ilCtrl ilECSMappingSettingsGUI::$ctrl
protected

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

◆ $lng

ilLanguage ilECSMappingSettingsGUI::$lng
protected

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

◆ $log

ilLogger ilECSMappingSettingsGUI::$log
protected

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

◆ $mid

int ilECSMappingSettingsGUI::$mid
private

Definition at line 41 of file class.ilECSMappingSettingsGUI.php.

Referenced by __construct(), and getMid().

◆ $server

ilECSSetting ilECSMappingSettingsGUI::$server
private

Definition at line 40 of file class.ilECSMappingSettingsGUI.php.

Referenced by getServer().

◆ $tabs

ilTabsGUI ilECSMappingSettingsGUI::$tabs
private

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

◆ $toolbar

ilToolbarGUI ilECSMappingSettingsGUI::$toolbar
private

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

◆ $tpl

ilGlobalTemplateInterface ilECSMappingSettingsGUI::$tpl
protected

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

Referenced by initFormCSettings().

◆ TAB_COURSE

const ilECSMappingSettingsGUI::TAB_COURSE = 2

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

◆ TAB_DIRECTORY

const ilECSMappingSettingsGUI::TAB_DIRECTORY = 1

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


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