19 declare(strict_types=1);
48 bool $a_call_by_reference =
true,
49 bool $a_prepare_output =
true 53 $this->error = $DIC[
"ilErr"];
54 $this->
access = $DIC->access();
55 $this->rbacsystem = $DIC->rbac()->system();
57 $this->folder_settings =
new ilSetting(
'fold');
58 $this->
ctrl = $DIC->ctrl();
59 $this->
lng = $DIC->language();
60 $this->
toolbar = $DIC->toolbar();
61 $this->
factory = $DIC->ui()->factory();
62 $this->
renderer = $DIC->ui()->renderer();
67 $this->
lng->loadLanguageModule(
'rep');
68 $this->
lng->loadLanguageModule(
'cmps');
70 $this->admin_gui_request = $DIC
83 $next_class = $this->
ctrl->getNextClass($this);
84 $cmd = $this->
ctrl->getCmd();
88 if (!$ilAccess->checkAccess(
'read',
'', $this->object->getRefId())) {
92 switch ($next_class) {
93 case 'ilpermissiongui':
94 $this->tabs_gui->setTabActive(
'perm_settings');
96 $this->
ctrl->forwardCommand($perm_gui);
109 $this->tabs_gui->addTab(
111 $this->
lng->txt(
"settings"),
112 $this->
ctrl->getLinkTarget($this,
"view")
115 $this->tabs_gui->addTab(
117 $this->
lng->txt(
"rep_custom_icons"),
118 $this->
ctrl->getLinkTarget($this,
"customIcons")
121 $this->tabs_gui->addTab(
123 $this->
lng->txt(
"cmps_repository_object_types"),
124 $this->
ctrl->getLinkTarget($this,
"listModules")
127 if ($rbacsystem->
checkAccess(
'edit_permission', $this->object->getRefId())) {
128 $this->tabs_gui->addTab(
130 $this->
lng->txt(
"perm_settings"),
131 $this->
ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm")
138 $this->tabs_gui->activateTab(
"settings");
144 $this->tpl->setContent($this->
renderer->render($a_form));
159 $this->
lng->txt(
"adm_rep_tree_only_cntr")
160 )->withByline($this->
lng->txt(
"adm_rep_tree_only_cntr_info"));
164 $this->
lng->txt(
"adm_rep_tree_limit_grp_crs"),
165 $this->
lng->txt(
"adm_rep_tree_limit_grp_crs_info")
170 'rep_tree_limit_grp_crs' => $cb
172 $this->
lng->txt(
"adm_rep_tree_all_types")
173 )->withByline($this->
lng->txt(
"adm_rep_tree_all_types_info"));
175 $tree_pres =
$f->switchableGroup(
180 $this->
lng->txt(
"adm_rep_tree_presentation")
184 $tree_limit_number =
$f->numeric(
185 $this->
lng->txt(
"rep_tree_limit_number"),
186 $this->
lng->txt(
"rep_tree_limit_number_info")
192 $tree_limit =
$f->optionalGroup(
194 'rep_tree_limit_number' => $tree_limit_number
196 $this->
lng->txt(
"rep_tree_limit"),
197 $this->
lng->txt(
"rep_tree_limit_info")
199 if (
$ilSetting->get(
"rep_tree_limit_number") <= 0) {
200 $tree_limit = $tree_limit->withValue(
null);
204 $change_mode =
$f->radio(
205 $this->
lng->txt(
"rep_breadcr_crs_config")
208 $this->
lng->txt(
"rep_breadcr_crs_overwrite")
210 'rep_breadcr_crs_default',
211 $this->
lng->txt(
"rep_breadcr_crs_overwrite_with_default")
214 $this->
lng->txt(
"rep_breadcr_crs_overwrite_not")
216 if (
$ilSetting->get(
"rep_breadcr_crs_default")) {
217 $change_mode = $change_mode->withValue(
'rep_breadcr_crs_default');
220 $breadcrumbs =
$f->optionalGroup(
222 'rep_breadcr_crs_overwrite' => $change_mode
224 $this->
lng->txt(
"rep_breadcr_crs")
227 $breadcrumbs = $breadcrumbs->withValue(
null);
231 $enable_trash =
$f->checkbox(
232 $this->
lng->txt(
"enable_trash"),
233 $this->
lng->txt(
"enable_trash_info")
237 $this->
lng->loadLanguageModule(
"trac");
238 $event =
$f->checkbox(
239 $this->
lng->txt(
'trac_show_repository_views'),
240 $this->
lng->txt(
"trac_show_repository_views_info")
244 $exp_disabled =
$f->group(
246 $this->
lng->txt(
"rep_export_limitation_disabled")
250 $exp_unlimited =
$f->group(
252 $this->
lng->txt(
"rep_export_limitation_unlimited")
256 $exp_limit_num =
$f->numeric(
257 $this->
lng->txt(
"rep_export_limit_number")
261 ->withRequired(
true);
263 $exp_limited =
$f->group(
265 'rep_export_limit_number' => $exp_limit_num
267 $this->
lng->txt(
"rep_export_limitation_limited")
271 $exp_limit =
$f->switchableGroup(
275 'rep_export_unlimited' => $exp_unlimited
277 $this->
lng->txt(
"rep_export_limitation"),
278 $this->
lng->txt(
"rep_export_limitation_info")
279 )->
withValue((
string) $limiter->getLimitationMode());
283 $ilSetting->get(
"rep_export_limit_number") ===
'' 285 $exp_limit = $exp_limit->withValue(
'rep_export_unlimited');
289 $dl_prob =
$f->checkbox(
290 $this->
lng->txt(
"enable_download_folder"),
291 $this->
lng->txt(
'enable_download_folder_info')
293 (
int) $this->folder_settings->get(
294 "enable_download_folder",
300 $dl_prop =
$f->checkbox(
301 $this->
lng->txt(
"enable_multi_download"),
302 $this->
lng->txt(
'enable_multi_download_info')
304 (
int) $this->folder_settings->get(
305 "enable_multi_download",
312 $this->
lng->txt(
"rep_favourites"),
313 $this->
lng->txt(
"rep_favourites_info")
319 'tree_pres' => $tree_pres,
320 'rep_tree_limit' => $tree_limit,
321 'rep_breadcr_crs' => $breadcrumbs,
322 'enable_trash' => $enable_trash,
323 'change_event_tracking' => $event,
324 'rep_export_limitation' => $exp_limit,
325 'enable_download_folder' => $dl_prob,
326 'enable_multi_download' => $dl_prop,
327 'rep_favourites' => $fav
329 $this->
lng->txt(
"settings")
330 )->withDisabled($read_only);
334 $sdesclen =
$f->numeric(
335 $this->
lng->txt(
"adm_rep_shorten_description_length")
340 $sdesc =
$f->optionalGroup(
342 'rep_shorten_description_length' => $sdesclen
344 $this->
lng->txt(
"adm_rep_shorten_description"),
345 $this->
lng->txt(
"adm_rep_shorten_description_info")
347 if (!
$ilSetting->get(
"rep_shorten_description")) {
348 $sdesc = $sdesc->withValue(
null);
352 $pltags =
$f->checkbox(
353 $this->
lng->txt(
'adm_show_comments_tagging_in_lists_tags')
356 $pl =
$f->optionalGroup(
358 'comments_tagging_in_lists_tags' => $pltags
360 $this->
lng->txt(
'adm_show_comments_tagging_in_lists')
362 if (!
$ilSetting->get(
'comments_tagging_in_lists')) {
363 $pl = $pl->withValue(
null);
366 $obj_lists =
$f->section(
368 'rep_shorten_description' => $sdesc,
369 'comments_tagging_in_lists' => $pl
371 $this->
lng->txt(
"rep_object_lists")
372 )->withDisabled($read_only);
374 $form = $this->
factory->input()->container()->form()->standard(
375 $this->
ctrl->getFormAction($this,
'saveSettings'),
378 'obj_lists' => $obj_lists
390 if (!$ilAccess->checkAccess(
'write',
'', $this->object->getRefId())) {
391 $this->tpl->setOnScreenMessage(
393 $this->
lng->txt(
'permission_denied'),
396 $this->
ctrl->redirect($this,
"view");
400 ->withRequest($this->
http->request());
401 if ($form->getData()) {
402 $data = $form->getData()[
'settings'];
404 "repository_tree_pres",
405 $data[
"tree_pres"][0]
407 if (
$data[
'tree_pres'][0] ===
'all_types') {
409 "rep_tree_limit_grp_crs",
410 (
string)
$data[
'tree_pres'][1][
"rep_tree_limit_grp_crs"] ??
'' 416 $data[
"rep_favourites"] ?
"1" :
"0" 419 if (
$data[
"rep_export_limitation"][0] ===
'rep_export_unlimited') {
421 "rep_export_limitation",
425 "rep_export_limit_number",
430 "rep_export_limitation",
431 (
string)
$data[
"rep_export_limitation"][0]
436 "rep_export_limit_number",
437 (
string) (
$data[
"rep_export_limitation"][1][
"rep_export_limit_number"] ??
'')
443 (
string)
$data[
"enable_trash"]
448 (
string) ((
int) $data[
"rep_breadcr_crs"])
450 if (isset($data[
"rep_breadcr_crs"])) {
451 $overwrite = $data[
"rep_breadcr_crs"][
"rep_breadcr_crs_overwrite"];
453 "rep_breadcr_crs_default",
454 (
string) ((
int) ($overwrite ===
'rep_breadcr_crs_default'))
456 if ($overwrite ===
'rep_breadcr_crs_default') {
460 "rep_breadcr_crs_overwrite",
461 (
string) ((
int) $overwrite)
466 $limit_number = ($data[
'rep_tree_limit'] &&
467 $data[
'rep_tree_limit'][
'rep_tree_limit_number'] > 0)
468 ? (
int) $data[
'rep_tree_limit'][
'rep_tree_limit_number']
470 $ilSetting->set(
'rep_tree_limit_number', (
string) $limit_number);
472 $this->folder_settings->set(
473 "enable_download_folder",
474 (
string) ((
int) $data[
"enable_download_folder"] === 1)
476 $this->folder_settings->set(
477 "enable_multi_download",
478 (
string) ((
int) $data[
"enable_multi_download"] === 1)
480 if ($data[
'change_event_tracking']) {
487 $data = $form->getData()[
'obj_lists'];
489 "rep_shorten_description",
490 (
string) ((
int) $data[
'rep_shorten_description'])
492 if (isset($data[
'rep_shorten_description'])) {
494 "rep_shorten_description_length",
495 (
string) ((
int) $data[
'rep_shorten_description'][
'rep_shorten_description_length'])
499 'comments_tagging_in_lists',
500 (
string) ((
int) $data[
'comments_tagging_in_lists'])
502 if (isset($data[
'comments_tagging_in_lists'])) {
504 'comments_tagging_in_lists_tags',
505 (
string) $data[
'comments_tagging_in_lists'][
'comments_tagging_in_lists_tags']
509 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
510 $this->
ctrl->redirect($this,
"view");
518 $this->tabs_gui->activateTab(
"icons");
524 $this->tpl->setContent($this->
renderer->render($a_form));
532 $cb = $this->
factory->input()->field()->checkbox(
533 $this->
lng->txt(
"enable_custom_icons"),
534 $this->
lng->txt(
"enable_custom_icons_info")
537 $section = $this->
factory->input()->field()->section(
538 [
'custom_icons' => $cb],
539 $this->
lng->txt(
"rep_custom_icons")
541 !$ilAccess->checkAccess(
'write',
'', $this->object->getRefId())
544 $form = $this->
factory->input()->container()->form()->standard(
545 $this->
ctrl->getFormAction($this,
'saveCustomIcons'),
546 [
'section' => $section]
557 if (!$ilAccess->checkAccess(
'write',
'', $this->object->getRefId())) {
558 $this->tpl->setOnScreenMessage(
560 $this->
lng->txt(
'permission_denied'),
563 $this->
ctrl->redirect($this,
"customIcons");
567 ->withRequest($this->
http->request());
568 if ($form->getData()) {
571 (
string) ((
int) $form->getData()[
'section'][
'custom_icons'])
573 $this->tpl->setOnScreenMessage(
575 $this->
lng->txt(
"msg_obj_modified"),
578 $this->
ctrl->redirect($this,
"customIcons");
586 $this->tabs_gui->activateTab(
'modules');
588 $this->tabs_gui->addSubTab(
590 $this->
lng->txt(
"rep_new_item_menu"),
591 $this->
ctrl->getLinkTarget($this,
"listModules")
594 $this->tabs_gui->addSubTab(
596 $this->
lng->txt(
"rep_new_item_groups"),
597 $this->
ctrl->getLinkTarget($this,
"listNewItemGroups")
600 $this->tabs_gui->activateSubTab($a_active);
609 $has_write = $ilAccess->checkAccess(
'write',
'', $this->
object->getRefId());
613 $this->tpl->setContent($comp_table->getHTML());
623 $item_groups = $this->admin_gui_request->getNewItemGroups();
624 $item_positions = $this->admin_gui_request->getNewItemPositions();
626 if (count($item_groups) === 0 || count($item_positions) === 0 ||
627 !$ilAccess->checkAccess(
'write',
'', $this->object->getRefId())) {
628 $ilCtrl->redirect($this,
"listModules");
631 $grp_pos_map = [0 => 9999];
633 $grp_pos_map[$item[
"id"]] = $item[
"pos"];
637 $item_enablings = $this->admin_gui_request->getNewItemEnablings();
638 foreach ($item_positions as $obj_type => $pos) {
639 $grp_id = ($item_groups[$obj_type] ?? 0);
640 $type_pos_map[$grp_id][$obj_type] = $pos;
644 "obj_dis_creation_" . $obj_type,
645 (
string) ((
int) (!($item_enablings[$obj_type] ??
false)))
649 foreach ($type_pos_map as $grp_id => $obj_types) {
650 $grp_pos = str_pad((
string) $grp_pos_map[$grp_id], 4,
"0", STR_PAD_LEFT);
654 foreach (array_keys($obj_types) as $obj_type) {
656 $type_pos = $grp_pos . str_pad((
string) $pos, 4,
"0", STR_PAD_LEFT);
657 $ilSetting->set(
"obj_add_new_pos_" . $obj_type, (
string) $type_pos);
658 $ilSetting->set(
"obj_add_new_pos_grp_" . $obj_type, (
string) $grp_id);
662 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
663 $ilCtrl->redirect($this,
"listModules");
673 $has_write = $ilAccess->checkAccess(
'write',
'', $this->
object->getRefId());
676 $ilToolbar->addButton(
677 $this->
lng->txt(
"rep_new_item_group_add"),
678 $this->
ctrl->getLinkTarget($this,
"addNewItemGroup")
684 $this->tpl->setContent($grp_table->getHTML());
693 $this->
lng->loadLanguageModule(
"meta");
694 $def_lng = $this->
lng->getDefaultLanguage();
697 $title->setInfo($this->
lng->txt(
"meta_l_" . $def_lng) .
698 " (" . $this->
lng->txt(
"default_language") .
")");
699 $title->setRequired(
true);
700 $form->addItem($title);
702 foreach ($this->
lng->getInstalledLanguages() as $lang_id) {
703 if ($lang_id !== $def_lng) {
704 $title =
new ilTextInputGUI($this->
lng->txt(
"translation"),
"title_" . $lang_id);
705 $title->setInfo($this->
lng->txt(
"meta_l_" . $lang_id));
706 $form->addItem($title);
711 $form->setTitle($this->
lng->txt(
"rep_new_item_group_add"));
712 $form->setFormAction($this->
ctrl->getFormAction($this,
"saveNewItemGroup"));
714 $form->addCommandButton(
"saveNewItemGroup", $this->
lng->txt(
"save"));
716 $form->setTitle($this->
lng->txt(
"rep_new_item_group_edit"));
717 $form->setFormAction($this->
ctrl->getFormAction($this,
"updateNewItemGroup"));
720 $grp = $grp[$a_grp_id];
722 foreach ($grp[
"titles"] as
$id => $value) {
723 $field = $form->getItemByPostVar(
"title_" .
$id);
725 $field->setValue($value);
729 $form->addCommandButton(
"updateNewItemGroup", $this->
lng->txt(
"save"));
731 $form->addCommandButton(
"listNewItemGroups", $this->
lng->txt(
"cancel"));
742 $this->tpl->setContent($a_form->getHTML());
748 if ($form->checkInput()) {
750 foreach ($this->
lng->getInstalledLanguages() as $lang_id) {
751 $titles[$lang_id] = $form->getInput(
"title_" . $lang_id);
755 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"),
true);
756 $this->
ctrl->redirect($this,
"listNewItemGroups");
760 $form->setValuesByPost();
766 $grp_id = $this->admin_gui_request->getNewItemGroupId();
768 $this->
ctrl->redirect($this,
"listNewItemGroups");
772 $this->
ctrl->setParameter($this,
"grp_id", $grp_id);
776 $this->tpl->setContent($a_form->getHTML());
781 $grp_id = $this->admin_gui_request->getNewItemGroupId();
783 $this->
ctrl->redirect($this,
"listNewItemGroups");
786 $this->
ctrl->setParameter($this,
"grp_id", $grp_id);
789 if ($form->checkInput()) {
791 foreach ($this->
lng->getInstalledLanguages() as $lang_id) {
792 $titles[$lang_id] = $form->getInput(
"title_" . $lang_id);
796 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"),
true);
797 $this->
ctrl->redirect($this,
"listNewItemGroups");
801 $form->setValuesByPost();
809 $group_order = $this->admin_gui_request->getNewItemGroupOrder();
810 if (count($group_order) > 0) {
815 $grp_pos_map[$item[
"id"]] = str_pad((
string) $item[
"pos"], 4,
"0", STR_PAD_LEFT);
822 foreach ($subitems as $obj_type) {
823 $old_pos =
$ilSetting->get(
"obj_add_new_pos_" . $obj_type);
824 if (strlen($old_pos) === 8) {
825 $new_pos = $grp_pos_map[$grp_id] . substr($old_pos, 4);
826 $ilSetting->set(
"obj_add_new_pos_" . $obj_type, $new_pos);
832 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"),
true);
834 $this->
ctrl->redirect($this,
"listNewItemGroups");
839 $group_ids = $this->admin_gui_request->getNewItemGroupIds();
840 if (count($group_ids) === 0) {
841 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"select_one"));
849 $cgui->setHeaderText($this->
lng->txt(
"rep_new_item_group_delete_sure"));
851 $cgui->setFormAction($this->
ctrl->getFormAction($this));
852 $cgui->setCancel($this->
lng->txt(
"cancel"),
"listNewItemGroups");
853 $cgui->setConfirm($this->
lng->txt(
"confirm"),
"deleteNewItemGroup");
857 foreach ($group_ids as $grp_id) {
858 $cgui->addItem(
"grp_ids[]", (
string) $grp_id, $groups[$grp_id][
"title"]);
861 $this->tpl->setContent($cgui->getHTML());
866 $group_ids = $this->admin_gui_request->getNewItemGroupIds();
867 if (count($group_ids) === 0) {
872 foreach ($group_ids as $grp_id) {
876 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"),
true);
877 $this->
ctrl->redirect($this,
"listNewItemGroups");
884 switch ($a_form_id) {
889 return [[
"view", $fields]];
895 'adm_show_comments_tagging_in_lists' => [
901 return [[
"view", $fields]];
910 $bound = (
int) (10 ** $max_length - 1);
912 return $this->
refinery->int()->isLessThanOrEqual($bound);
917 return $this->
refinery->int()->isGreaterThan(0);
922 return $this->
refinery->int()->isGreaterThanOrEqual(0);
static _activate()
Activates change event tracking.
TableGUI class for new item groups.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
addToExternalSettingsForm(int $a_form_id)
confirmDeleteNewItemGroup()
prepareOutput(bool $show_sub_objects=true)
checkAccess(string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
static getNewItemGroups()
AdministrationGUIRequest $admin_gui_request
A constraint encodes some resrtictions on values.
setModuleSubTabs(string $a_active)
static getNewItemGroupSubItems()
initNewItemGroupForm(int $a_grp_id=0)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
static http()
Fetches the global http state from ILIAS.
getMaxLengthConstraint(int $max_length)
static deleteNewItemGroup(int $a_id)
Class ilObjectGUI Basic methods of all Output classes.
editNewItemGroup(?ilPropertyFormGUI $a_form=null)
__construct( $a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
addNewItemGroup(?ilPropertyFormGUI $a_form=null)
static updateNewItemGroup(int $a_id, array $a_titles)
ilSetting $folder_settings
static updateNewItemGroupOrder(array $a_order)
static addNewItemGroup(array $a_titles)
const SET_EXPORT_DISABLED
static _isActive()
Returns true, if change event tracking is active.
Export limitation checker.
__construct(Container $dic, ilPlugin $plugin)
static _deactivate()
Deactivates change event tracking.
view(?StandardForm $a_form=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
customIcons(?StandardForm $a_form=null)
getNonNegativeConstraint()