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';
37$langs->load(
'uxdocumentation');
39$action =
GETPOST(
'action',
'alpha');
41if ($action ==
'displayeventmessage') {
43} elseif ($action ==
'displayeventmessages') {
44 $messageArray = [$langs->trans(
'DocSetEventMessage',
'1'),
45 $langs->trans(
'DocSetEventMessage',
'2'),
46 $langs->trans(
'DocSetEventMessage',
'3')];
48} elseif ($action ==
'displayeventmessageok') {
50} elseif ($action ==
'displayeventmessagewarning') {
51 setEventMessages($langs->trans(
'DocSetEventMessageWarning'),
null,
'warnings');
52} elseif ($action ==
'displayeventmessageerror') {
60$documentation->docHeader(
'SetEventMessages');
64$documentation->view = array(
'Components',
'Event Message');
67$documentation->showSidebar(); ?>
69<div
class=
"doc-wrapper">
71 <?php $documentation->showBreadCrumb(); ?>
73 <div
class=
"doc-content-wrapper">
75 <h1
class=
"documentation-title"><?php echo $langs->trans(
'DocSetEventMessageTitle'); ?></h1>
76 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocSetEventMessageMainDescription'); ?></p>
79 <?php $documentation->showSummary(); ?>
82 <div
class=
"documentation-section" id=
"seteventmessagesection-basicusage">
83 <h2
class=
"documentation-title"><?php echo $langs->trans(
'DocBasicUsage'); ?></h2>
84 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocSetEventMessageDescription'); ?></p>
85 <div
class=
"documentation-example">
87 $label =
'My action label used for accessibility visually for impaired people';
90 $html =
'<span class="fa fa-comment paddingright"></span>'.$langs->trans(
'DocSetEventMessageDisplayMessage');
91 $action_type =
'displayeventmessage';
92 $url = $_SERVER[
"PHP_SELF"].
'?action=displayeventmessage';
95 $label =
'My action label used for accessibility visually for impaired people';
98 $html =
'<span class="fa fa-comments paddingright"></span>'.$langs->trans(
'DocSetEventMessageDisplayMessages');;
99 $action_type =
'displayeventmessages';
100 $url = $_SERVER[
"PHP_SELF"].
'?action=displayeventmessages';
121 'setEventMessages("message", null);',
122 'setEventMessages(null, messages[]);',
124 echo $documentation->showCode($lines); ?>
127 <!-- Contextual variations -->
128 <div
class=
"documentation-section" id=
"seteventmessagesection-contextvariations">
129 <h2
class=
"documentation-title"><?php echo $langs->trans(
'DocSetEventMessageContextualVariations'); ?></h2>
130 <p
class=
"documentation-text"><?php echo $langs->trans(
'DocSetEventMessageContextualVariationsDescription'); ?></p>
131 <div
class=
"documentation-example">
133 $label =
'My action label used for accessibility visually for impaired people';
135 $html =
'<span class="fa fa-comment paddingright"></span>'.$langs->trans(
'DocSetEventMessageDisplayOKMessage');;
136 $action_type =
'displayeventmessageok';
137 $url = $_SERVER[
"PHP_SELF"].
'?action=displayeventmessageok#seteventmessagesection-contextvariations';
138 $params[
'attr'][
'style'] =
'background: #446548';
141 $label =
'My action label used for accessibility visually for impaired people';
143 $html =
'<span class="fa fa-comment paddingright"></span>'.$langs->trans(
'DocSetEventMessageDisplayWarningMessage');;
144 $action_type =
'displayeventmessagewarning';
145 $url = $_SERVER[
"PHP_SELF"].
'?action=displayeventmessagewarning#seteventmessagesection-contextvariations';
146 $params[
'attr'][
'style'] =
'background: #a28918';
147 print
dolGetButtonAction($label, $html, $action_type, $url,
'', $user_right, $params);
149 $label =
'My action label used for accessibility visually for impaired people';
151 $html =
'<span class="fa fa-comment paddingright"></span>'.$langs->trans(
'DocSetEventMessageDisplayErrorMessage');;
152 $action_type =
'displayeventmessageerror';
153 $url = $_SERVER[
"PHP_SELF"].
'?action=displayeventmessageerror#seteventmessagesection-contextvariations';
154 $params[
'attr'][
'style'] =
'background: #a72947';
155 print
dolGetButtonAction($label, $html, $action_type, $url,
'', $user_right, $params); ?>
159 'setEventMessages("message", null)',
160 'setEventMessages("message", null, "warnings")',
161 'setEventMessages("message", null, "errors")'
163 echo $documentation->showCode($lines); ?>
172$documentation->docFooter();
Class to manage UI documentation.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.