bookmark.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.org>
  4. * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. /** \file htdocs/bookmarks/admin/bookmark.php
  20. * \ingroup bookmark
  21. * \brief Page to setup bookmark module
  22. */
  23. // Load Dolibarr environment
  24. require '../../main.inc.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  26. // Load translation files required by the page
  27. $langs->load("admin");
  28. if (!$user->admin) {
  29. accessforbidden();
  30. }
  31. $action = GETPOST('action', 'aZ09');
  32. if ($action == 'setvalue') {
  33. $showmenu = GETPOST('BOOKMARKS_SHOW_IN_MENU', 'alpha');
  34. $res = dolibarr_set_const($db, "BOOKMARKS_SHOW_IN_MENU", $showmenu, 'chaine', 0, '', $conf->entity);
  35. if (!($res > 0)) {
  36. $error++;
  37. }
  38. if (!$error) {
  39. $db->commit();
  40. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  41. } else {
  42. $db->rollback();
  43. setEventMessages($langs->trans("Error"), null, 'errors');
  44. }
  45. }
  46. /*
  47. * View
  48. */
  49. llxHeader();
  50. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  51. print load_fiche_titre($langs->trans("BookmarkSetup"), $linkback, 'title_setup');
  52. print $langs->trans("BookmarkDesc")."<br>\n";
  53. print '<br>';
  54. print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
  55. print '<input type="hidden" name="token" value="'.newToken().'">';
  56. print '<input type="hidden" name="action" value="setvalue">';
  57. print '<table summary="bookmarklist" class="noborder centpercent">';
  58. print '<tr class="liste_titre">';
  59. print '<td>'.$langs->trans("Name").'</td>';
  60. print '<td>'.$langs->trans("Value").'</td>';
  61. print "</tr>\n";
  62. print '<tr class="oddeven"><td>';
  63. print $langs->trans("NbOfBoomarkToShow").'</td><td>';
  64. print '<input size="3" type="text" name="BOOKMARKS_SHOW_IN_MENU" value="'.$conf->global->BOOKMARKS_SHOW_IN_MENU.'">';
  65. print '</td></tr>';
  66. print '</table><br><div class="center"><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></div></form>';
  67. // End of page
  68. llxFooter();
  69. $db->close();