21if (! $res && file_exists(
"../../main.inc.php")) : $res=@include
'../../main.inc.php';
23if (! $res && file_exists(
"../../../main.inc.php")) : $res=@include
'../../../main.inc.php';
25if (! $res && file_exists(
"../../../../main.inc.php")) : $res=@include
'../../../../main.inc.php';
36$langs->load(
'uxdocumentation');
42$documentation->docHeader(
'Buttons');
46$documentation->view = array(
'Components',
'Buttons');
49$documentation->showSidebar(); ?>
51<div
class=
"doc-wrapper">
53 <?php $documentation->showBreadCrumb(); ?>
55 <div
class=
"doc-content-wrapper">
57 <h1
class=
"documentation-title"><?php echo $langs->trans(
'DocButtonsTitle'); ?></h1>
58 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocButtonsMainDescription'); ?></p>
61 <?php $documentation->showSummary(); ?>
63 <!-- Example of simple
usage -->
64 <div
class=
"documentation-section" id=
"buttonsection-basicusage">
65 <h2
class=
"documentation-title"><?php echo $langs->trans(
'DocBasicUsage'); ?></h2>
66 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocButtonBasicUsageDescription'); ?></p>
67 <div
class=
"documentation-example">
69 $label =
'My action label used for accessibility visually for impaired people';
72 $html =
'<span class="fa fa-clone paddingright" aria-hidden="true"></span> My default action';
73 $action_type =
'default';
78 $html =
'<span class="fa fa-trash-alt paddingright" aria-hidden="true"></span> My delete action';
79 $action_type =
'delete';
84 $html =
'<span class="fa fa-radiation paddingright" aria-hidden="true"></span> My danger action';
85 $action_type =
'danger';
95 $html =
'<span class="fa fa-clone paddingright" aria-hidden="true"></span> My default action';
96 $action_type =
'default';
101 $html =
'<span class="fa fa-trash-alt paddingright" aria-hidden="true"></span> My delete action';
102 $action_type =
'delete';
107 $html =
'<span class="fa fa-radiation paddingright" aria-hidden="true"></span> My danger action';
108 $action_type =
'danger';
129 'print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params);',
131 echo $documentation->showCode($lines); ?>
134 <!-- Example of modal
usage -->
135 <div
class=
"documentation-section" id=
"buttonsection-modals">
136 <h2
class=
"documentation-title"><?php echo $langs->trans(
'DocButtonModal'); ?></h2>
137 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocButtonModalDescription'); ?></p>
138 <div
class=
"documentation-example">
142 $html =
'<span class="fa fa-clone" paddingright" aria-hidden="true"></span> My default action';
143 $actionType =
'default';
151 $html =
'<span class="fa fa-trash-alt paddingright" aria-hidden="true"></span> My delete action';
152 $actionType =
'delete';
154 $url = $_SERVER[
'PHP_SELF'] .
'?token='.newToken().
'#'.
$id;
157 'url' =>
'your confirm action url',
158 'title' =>
'Your title to display',
159 'action-btn-label' =>
'Your confirm label',
160 'cancel-btn-label' =>
'Your cancel label',
161 'content' =>
'Content to display with <strong>HTML</strong> compatible <ul><li>test 01</li><li>test 02</li><li>test 03</li></ul>'
168 $html =
'<span class="fa fa-clone" ></span> My default action';
169 $actionType =
'delete';
175 print
dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params); ?>
180 '// Default parameters',
182 ' \'confirm\' => true',
185 '// Custom parameters',
187 ' \'confirm\' => array(',
188 ' \'url\' => \'your confirm action url\',',
189 ' \'title\' => \'Your title to display\',',
190 ' \'action-btn-label\' => \'Your confirm label\',',
191 ' \'cancel-btn-label\' => \'Your cancel label\',',
192 ' \'content\' => \'Content to display with <strong>HTML</strong> compatible <ul><li>test 01</li><li>test 02</li><li>test 03</li></ul>\'',
196 'print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params);',
198 echo $documentation->showCode($lines); ?>
201 <!-- Example of subbutton
usage -->
202 <div
class=
"documentation-section" id=
"buttonsection-submenu">
203 <h2
class=
"documentation-title"><?php echo $langs->trans(
'DocButtonSubmenu'); ?></h2>
204 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocButtonSubmenuDescription'); ?></p>
205 <div
class=
"documentation-example">
208 $html =
'<span class="fa fa-clone" paddingright" aria-hidden="true"></span> My default action';
209 $actionType =
'default';
211 $submenu_url = str_replace(DOL_URL_ROOT,
'', $_SERVER[
'PHP_SELF']);
214 'lang'=>
'documentation@documentation',
215 'url'=> $submenu_url.
'#'.$id,
216 'label' =>
'My SubAction 1',
220 'lang'=>
'documentation@documentation',
221 'url'=> $submenu_url.
'#'.$id,
222 'label' =>
'My SubAction 2',
227 print
dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params); ?>
233 '$url = \'url_script\';',
234 'print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params);',
236 '// Dropdown button',
239 ' \'lang\' => \'langfile\',',
240 ' \'url\' => \'url_script_1\', // Url without DOL_URL_ROOT',
241 ' \'label\' => \'My SubAction 1\',',
242 ' \'perm\' => 1, // The user have the rights',
245 ' \'lang\' => \'langfile\',',
246 ' \'url\' => \'url_script_2\', // Url without DOL_URL_ROOT',
247 ' \'label\' => \'My SubAction 2\',',
248 ' \'perm\' => 0, // The user does not have the rights',
251 'print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params);'
253 echo $documentation->showCode($lines); ?>
257 <!-- Example of subbutton
usage -->
258 <div
class=
"documentation-section" id=
"buttonsection-icon-btn">
259 <h2
class=
"documentation-title"><?php echo $langs->trans(
'DocButtonIconsLowEmphasis'); ?></h2>
260 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocButtonIconsDescriptionLowEmphasis'); ?></p>
261 <div
class=
"documentation-example">
263 $btnLabel = $langs->trans(
'Label');
264 print
' <button class="btn-low-emphasis --btn-icon" title="'.dol_escape_htmltag($btnLabel).
'" aria-label="'.
dol_escape_htmltag($btnLabel).
'" >'.
img_picto($btnLabel,
'fa-arrow-right',
'aria-hidden="true"', 0, 0, 1).
'</button>';
266 $btnLabel = $langs->trans(
'Reset');
267 print
' <button class="btn-low-emphasis --btn-icon" title="'.dol_escape_htmltag($btnLabel).
'" aria-label="'.
dol_escape_htmltag($btnLabel).
'" >'.
img_picto($btnLabel,
'eraser',
'aria-hidden="true"', 0, 0, 1).
'</button>';
273 '$btnLabel = $langs->trans(\'Label\');',
274 'print \' <button class="btn-low-emphasis --btn-icon" title="\'.dol_escape_htmltag($btnLabel).\'" aria-label="\'.dol_escape_htmltag($btnLabel).\'" >\'.img_picto($btnLabel, \'fa-arrow-right\', \'aria-hidden="true"\', 0, 0, 1).\'</button>\';',
276 '$btnLabel = $langs->trans(\'Reset\');',
277 'print \' <button class="btn-low-emphasis --btn-icon" title="\'.dol_escape_htmltag($btnLabel).\'" aria-label="\'.dol_escape_htmltag($btnLabel).\'" >\'.img_picto($btnLabel, \'eraser\', \'aria-hidden="true"\', 0, 0, 1).\'</button>\';',
280 echo $documentation->showCode($lines); ?>
283 <!-- Example of subbutton
usage -->
284 <div
class=
"documentation-section" id=
"buttonsection-icon-btn">
285 <h2
class=
"documentation-title"><?php echo $langs->trans(
'DocButtonIconsForTitle'); ?></h2>
286 <div
class=
"documentation-example">
290 $btnLabel = $langs->trans(
'Label');
303 '$btnLabel = $langs->trans(\'Label\');',
304 '$status = 0; // Not Enough Permissions',
305 'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-file\', \'#\', \'\', $status);',
306 '$status = 1; // Active',
307 'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-file\', \'#\', \'\', $status);',
308 '$status = 2; // Active and selected',
309 'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-file\', \'#\', \'\', $status);',
310 '$status = -1; // Functionality is disabled',
311 'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-file\', \'#\', \'\', $status);',
312 '$status = -2; // Disabled without info',
313 'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-file\', \'#\', \'\', $status);',
316 echo $documentation->showCode($lines); ?><div
class=
"documentation-example">
320 $btnLabel = $langs->trans(
'Label');
321 print
dolGetButtonTitle($btnLabel,
'',
'fa fa-download',
'#',
'', 0, [
'forcenohideoftext'=>1]);
322 print
dolGetButtonTitle($btnLabel,
'',
'fa fa-download',
'#',
'', 1, [
'forcenohideoftext'=>1]);
323 print
dolGetButtonTitle($btnLabel,
'',
'fa fa-download',
'#',
'', 2, [
'forcenohideoftext'=>1]);
324 print
dolGetButtonTitle($btnLabel,
'',
'fa fa-download',
'#',
'', -1, [
'forcenohideoftext'=>1]);
325 print
dolGetButtonTitle($btnLabel,
'',
'fa fa-download',
'#',
'', -2, [
'forcenohideoftext'=>1]);
334 '$btnLabel = $langs->trans(\'Label\');',
335 '$status = 0; // Not Enough Permissions',
336 'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-download\', \'#\', \'\', $status, [\'forcenohideoftext\'=>1]);',
337 '$status = 1; // Active',
338 'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-download\', \'#\', \'\', $status, [\'forcenohideoftext\'=>1]);',
339 '$status = 2; // Active and selected',
340 'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-download\', \'#\', \'\', $status, [\'forcenohideoftext\'=>1]);',
341 '$status = -1; // Functionality is disabled',
342 'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-download\', \'#\', \'\', $status, [\'forcenohideoftext\'=>1]);',
343 '$status = -2; // Disabled without info',
344 'print dolGetButtonTitle($btnLabel, \'\', \'fa fa-download\', \'#\', \'\', $status, [\'forcenohideoftext\'=>1]);',
346 echo $documentation->showCode($lines); ?>
360$documentation->docFooter();
Class to manage UI documentation.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
usage($program, $header)
Print the usage when executing scripts from install/.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.