* Copyright (C) 2024 Frédéric France * * 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 . */ // Load Dolibarr environment require '../../../../main.inc.php'; /** * @var DoliDB $db * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ // Protection if external user if ($user->socid > 0) { accessforbidden(); } // Includes require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php'; // Load documentation translations $langs->load('uxdocumentation'); // $documentation = new Documentation($db); $morejs = [ '/includes/ace/src/ace.js', '/includes/ace/src/ext-statusbar.js', '/includes/ace/src/ext-language_tools.js', ]; // Output html head + body - Param is Title $documentation->docHeader('Buttons', $morejs); // Set view for menu and breadcrumb // Menu must be set in constructor of documentation class $documentation->view = array('Components','Buttons'); // Output sidebar $documentation->showSidebar(); ?>
showBreadCrumb(); ?>

trans('DocButtonsTitle'); ?>

trans('DocButtonsMainDescription'); ?>

showSummary(); ?>

trans('DocBasicUsage'); ?>

trans('DocButtonBasicUsageDescription'); ?>

My default action'; $action_type = 'default'; $id = 'button-id-1'; $url = '#'.$id; print dolGetButtonAction($label, $html, $action_type, $url, $id, $user_right); $html = ' My delete action'; $action_type = 'delete'; $id = 'button-id-2'; $url = '#'.$id; print dolGetButtonAction($label, $html, $action_type, $url, $id, $user_right); $html = ' My danger action'; $action_type = 'danger'; $id = 'button-id-3'; $url = '#'.$id; print dolGetButtonAction($label, $html, $action_type, $url, $id, $user_right); ?>

My default action'; $action_type = 'default'; $id = 'button-id-4'; $url = '#'.$id; print dolGetButtonAction($label, $html, $action_type, $url, $id, $user_right); $html = ' My delete action'; $action_type = 'delete'; $id = 'button-id-5'; $url = '#'.$id; print dolGetButtonAction($label, $html, $action_type, $url, $id, $user_right); $html = ' My danger action'; $action_type = 'danger'; $id = 'button-id-6'; $url = '#'.$id; print dolGetButtonAction($label, $html, $action_type, $url, $id, $user_right); ?>
formconfirm() method.', ' * $userRight User action right / 0 = No, 1 = Yes', ' * $params Various params', ' * ', ' * See more in core/lib/functions.lib.php', ' */', 'print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params);', ); echo $documentation->showCode($lines, 'php'); ?>

trans('DocButtonModal'); ?>

trans('DocButtonModalDescription'); ?>

My default action'; $actionType = 'default'; $id = 'button-id-7'; $url = '#'.$id; $params = array( 'confirm' => [], ); print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params); $html = ' My delete action'; $actionType = 'delete'; $id = 'button-id-8'; $url = $_SERVER['PHP_SELF'] . '?token='.newToken().'#'.$id; $params = array( 'confirm' => array( 'url' => 'your confirm action url', 'title' => 'Your title to display', 'action-btn-label' => 'Your confirm label', 'cancel-btn-label' => 'Your cancel label', 'content' => 'Content to display with HTML compatible
  • test 01
  • test 02
  • test 03
' ) ); print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params); $userRight = 0; $html = ' My default action'; $actionType = 'delete'; $id = 'button-id-9'; $url = '#'.$id; $params = array( 'confirm' => [], ); print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params); ?>
[],', ');', '', '// Custom parameters', '$params = array(', ' \'confirm\' => array(', ' \'url\' => \'your confirm action url\',', ' \'title\' => \'Your title to display\',', ' \'action-btn-label\' => \'Your confirm label\',', ' \'cancel-btn-label\' => \'Your cancel label\',', ' \'content\' => \'Content to display with HTML compatible
  • test 01
  • test 02
  • test 03
\',', ' )', ');', '', 'print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params);', ); echo $documentation->showCode($lines, 'php'); ?>

trans('DocButtonSubmenu'); ?>

trans('DocButtonSubmenuDescription'); ?>

My default action'; $actionType = 'default'; $id = 'button-id-7'; $submenu_url = str_replace(DOL_URL_ROOT, '', $_SERVER['PHP_SELF']); $url = array( array( 'lang'=>'documentation@documentation', 'url'=> $submenu_url.'#'.$id, 'label' => 'My SubAction 1', 'perm' => true, 'enabled' => true, ), array( 'lang'=>'documentation@documentation', 'url'=> $submenu_url.'#'.$id, 'label' => 'My SubAction 2', 'perm' => false, 'enabled' => true, ), ); $params = array(); print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params); ?>
\'langfile\',', ' \'url\' => \'url_script_1\', // Url without DOL_URL_ROOT', ' \'label\' => \'My SubAction 1\',', ' \'perm\' => 1, // The user have the rights', ' ),', ' array(', ' \'lang\' => \'langfile\',', ' \'url\' => \'url_script_2\', // Url without DOL_URL_ROOT', ' \'label\' => \'My SubAction 2\',', ' \'perm\' => 0, // The user does not have the rights', ' ),', ');', 'print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params);' ); echo $documentation->showCode($lines, 'php'); ?>

trans('DocButtonIconsLowEmphasis'); ?>

trans('DocButtonIconsDescriptionLowEmphasis'); ?>

trans('Label'); print ' '; $btnLabel = $langs->trans('Reset'); print ' '; ?>
trans(\'Label\');', 'print \' \';', '', '$btnLabel = $langs->trans(\'Reset\');', 'print \' \';', ); echo $documentation->showCode($lines, 'php'); ?>

trans('DocButtonIconsForTitle'); ?>

trans('Label'); print dolGetButtonTitle($btnLabel, '', 'fa fa-file', '#', '', 0); // Not Enough Permissions print dolGetButtonTitle($btnLabel, '', 'fa fa-file', '#', '', 1); // Active print dolGetButtonTitle($btnLabel, '', 'fa fa-file', '#', '', 2); // Active and selected print dolGetButtonTitle($btnLabel, '', 'fa fa-file', '#', '', -1); // Functionality is disabled print dolGetButtonTitle($btnLabel, '', 'fa fa-file', '#', '', -2); // Disabled without info ?>
trans(\'Label\');', '$status = 0; // Not Enough Permissions', 'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-file\', \'#\', \'\', $status);', '$status = 1; // Active', 'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-file\', \'#\', \'\', $status);', '$status = 2; // Active and selected', 'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-file\', \'#\', \'\', $status);', '$status = -1; // Functionality is disabled', 'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-file\', \'#\', \'\', $status);', '$status = -2; // Disabled without info', 'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-file\', \'#\', \'\', $status);', ); echo $documentation->showCode($lines, 'php'); ?>
trans('Label', 'php'); print dolGetButtonTitle($btnLabel, '', 'fa fa-download', '#', '', 0, ['forcenohideoftext'=>1]); // Not Enough Permissions print dolGetButtonTitle($btnLabel, '', 'fa fa-download', '#', '', 1, ['forcenohideoftext'=>1]); // Active print dolGetButtonTitle($btnLabel, '', 'fa fa-download', '#', '', 2, ['forcenohideoftext'=>1]); // Active and selected print dolGetButtonTitle($btnLabel, '', 'fa fa-download', '#', '', -1, ['forcenohideoftext'=>1]); // Functionality is disabled print dolGetButtonTitle($btnLabel, '', 'fa fa-download', '#', '', -2, ['forcenohideoftext'=>1]); // Disabled without info ?>
trans(\'Label\');', '$status = 0; // Not Enough Permissions', 'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-download\', \'#\', \'\', $status, [\'forcenohideoftext\'=>1]);', '$status = 1; // Active', 'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-download\', \'#\', \'\', $status, [\'forcenohideoftext\'=>1]);', '$status = 2; // Active and selected', 'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-download\', \'#\', \'\', $status, [\'forcenohideoftext\'=>1]);', '$status = -1; // Functionality is disabled', 'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-download\', \'#\', \'\', $status, [\'forcenohideoftext\'=>1]);', '$status = -2; // Disabled without info', 'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-download\', \'#\', \'\', $status, [\'forcenohideoftext\'=>1]);', ); echo $documentation->showCode($lines, 'php'); ?>
docFooter(); ?>