* Copyright (C) 2024 Frédéric France * Copyright (C) 2026 John BOTELLA * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file quickmemo/admin/setup.php * \ingroup quickmemo * \brief QuickMemo setup page. */ // Load Dolibarr environment require '../../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; require_once __DIR__ . '/../lib/quickmemo.lib.php'; require_once __DIR__ . '/../class/memo.class.php'; //require_once "../class/myclass.class.php"; // Translations $langs->loadLangs(array("admin", "quickmemo")); // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context /** @var HookManager $hookmanager */ $hookmanager->initHooks(array('quickmemosetup', 'globalsetup')); // Parameters $action = GETPOST('action', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php $value = GETPOST('value', 'alpha'); $label = GETPOST('label', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha'); $type = 'myobject'; $error = 0; $setupnotempty = 0; // Access control if (!$user->admin) { accessforbidden(); } // Set this to 1 to use the factory to manage constants. Warning, the generated module will be compatible with version v15+ only $useFormSetup = 1; if (!class_exists('FormSetup')) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; } $formSetup = new FormSetup($db); $item = $formSetup->newItem('QUICKMEMO_COLORS_PRESET'); /** * Callback used to generate the custom HTML input field. * * @param FormSetupItem $item Current form/configuration item. * @return string Generated HTML content. */ $item->fieldInputCallBack = function ($item) { global $langs; $item->fieldInputOverride = '
'; return $item->fieldInputOverride; }; $formSetup->newItem('QUICKMEMO_AUTO_RESIZE_FONT_SIZE_SECTION')->setAsTitle(); $formSetup->newItem('QUICKMEMO_DISABLE_AUTO_RESIZE_FONT_SIZE')->setAsYesNo(); $item = $formSetup->newItem('QUICKMEMO_AUTO_RESIZE_MIN_FONT_SIZE'); $item->defaultFieldValue = '1'; /** * Callback used to generate the custom HTML input field. * * @param FormSetupItem $item Current form/configuration item. * @return string Generated HTML content. */ $item->fieldInputCallBack = function ($item) { $item->fieldInputOverride = '
Lorem ipsum dolor sit amet
'; return $item->fieldInputOverride; }; $item = $formSetup->newItem('QUICKMEMO_AUTO_RESIZE_MAX_FONT_SIZE'); $item->defaultFieldValue = '1.4'; /** * Callback used to generate the custom HTML input field. * * @param FormSetupItem $item Current form/configuration item. * @return string Generated HTML content. */ $item->fieldInputCallBack = function ($item) { $item->fieldInputOverride = '
Lorem ipsum dolor sit amet
'; return $item->fieldInputOverride; }; $setupnotempty += count($formSetup->items); /* * Actions */ // For retrocompatibility Dolibarr < 15.0 if (versioncompare(explode('.', DOL_VERSION), array(15)) < 0 && $action == 'update' && !empty($user->admin)) { $formSetup->saveConfFromPost(); } include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if (empty($action)) { $action = 'edit'; } /* * View */ $form = new Form($db); $help_url = ''; $title = "QuickMemoSetup"; llxHeader('', $langs->trans($title), $help_url, '', 0, 0, '', ['quickmemo/css/setup.css'], '', 'mod-quickmemo page-admin'); ?> '.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans($title), $linkback, 'title_setup'); // Configuration header $head = quickmemoAdminPrepareHead(); print dol_get_fiche_head($head, 'settings', $langs->trans($title), -1, "fa-sticky-note_fa"); // Setup page goes here echo ''.$langs->trans("QuickMemoSetupPage").'

'; if (!empty($formSetup->items)) { print $formSetup->generateOutput(true); print '
'; } if (empty($setupnotempty)) { print '
'.$langs->trans("NothingToSetup"); } // Page end print dol_get_fiche_end(); llxFooter(); $db->close();