dolibarr/htdocs/bookmarks/admin/bookmark.php

101 lines
3.2 KiB
PHP
Raw Permalink Normal View History

2009-01-23 16:44:12 +00:00
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.org>
2012-03-29 16:04:10 +00:00
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
2011-09-14 21:29:04 +00:00
*
2009-01-23 16:44:12 +00:00
* 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
2009-01-23 16:44:12 +00:00
* (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
2019-09-23 19:55:30 +00:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2009-01-23 16:44:12 +00:00
*/
2010-05-12 15:50:59 +00:00
/** \file htdocs/bookmarks/admin/bookmark.php
2009-01-23 16:44:12 +00:00
* \ingroup bookmark
* \brief Page to setup bookmark module
*/
2022-09-07 18:08:59 +00:00
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
2009-01-23 16:44:12 +00:00
add baseline exclude for phpstan (#31632) * add baseline exclude for phpstan * update * update * update * update * update * merge * restore one filter * delete old errors * fix * fix * fix * $moreforfilter can t be empty * fix * enable check * refresh baseline * add phpdoc * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-11-04 22:53:20 +00:00
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
2018-05-27 07:58:23 +00:00
// Load translation files required by the page
2009-01-23 16:44:12 +00:00
$langs->load("admin");
2020-12-16 19:15:48 +00:00
if (!$user->admin) {
accessforbidden();
}
2009-01-23 16:44:12 +00:00
2020-09-16 17:39:50 +00:00
$action = GETPOST('action', 'aZ09');
2009-01-23 16:44:12 +00:00
/*
* Actions
*/
$error = 0;
2020-12-16 19:15:48 +00:00
if ($action == 'setvalue') {
$showmenu = GETPOST('BOOKMARKS_SHOW_IN_MENU', 'alpha');
$res = dolibarr_set_const($db, "BOOKMARKS_SHOW_IN_MENU", $showmenu, 'chaine', 0, '', $conf->entity);
2011-09-14 21:29:04 +00:00
2021-01-23 16:49:08 +00:00
if (!($res > 0)) {
2020-12-16 19:15:48 +00:00
$error++;
}
2011-09-14 21:29:04 +00:00
2020-12-16 19:15:48 +00:00
if (!$error) {
2011-09-14 21:29:04 +00:00
$db->commit();
2015-10-30 20:59:22 +00:00
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
2020-05-21 13:05:19 +00:00
} else {
2011-09-14 21:29:04 +00:00
$db->rollback();
2015-10-30 20:59:22 +00:00
setEventMessages($langs->trans("Error"), null, 'errors');
2011-09-03 14:40:48 +00:00
}
2009-01-23 16:44:12 +00:00
}
/*
2012-03-29 16:04:10 +00:00
* View
2009-01-23 16:44:12 +00:00
*/
llxHeader('', '', '', '', 0, 0, '', '', '', 'mod-bookmarks page-admin_bookmark');
2009-01-23 16:44:12 +00:00
$linkback = '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/admin/modules.php', ['restore_lastsearch_values' => 1]).'">'.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').'<span class="hideonsmartphone">'.$langs->trans("BackToModuleList").'</span></a>';
print load_fiche_titre($langs->trans("BookmarkSetup"), $linkback, 'title_setup');
2009-01-23 16:44:12 +00:00
print $langs->trans("BookmarkDesc")."<br>\n";
print '<br>';
print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
2009-01-23 16:44:12 +00:00
print '<input type="hidden" name="action" value="setvalue">';
2019-11-05 20:24:41 +00:00
print '<table summary="bookmarklist" class="noborder centpercent">';
2009-01-23 16:44:12 +00:00
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
print "</tr>\n";
print '<tr class="oddeven"><td>';
2009-01-23 16:44:12 +00:00
print $langs->trans("NbOfBoomarkToShow").'</td><td>';
2023-10-15 13:32:35 +00:00
print '<input size="3" type="text" name="BOOKMARKS_SHOW_IN_MENU" value="' . getDolGlobalString('BOOKMARKS_SHOW_IN_MENU').'">';
2009-01-23 16:44:12 +00:00
print '</td></tr>';
print '</table><br><div class="center"><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></div></form>';
2009-01-23 16:44:12 +00:00
2018-07-29 11:40:35 +00:00
// End of page
llxFooter();
$db->close();