+

Button for action

+

Documentation and examples for buttons.

+ +

Example of simple usage

+ +

Buttons for user allowed to click.

+ +
+ My default action'; + $actionType = 'default'; + $n++; + $id = 'mybuttonid'.$n; + $url = '#'.$id; + $userRight = 1; + $params = array(); + + print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight); + + + $html = ' My delete action'; + $actionType = 'delete'; + $n++; + $id = 'mybuttonid'.$n; + $url = $_SERVER['PHP_SELF'] . '?token='.newToken().'#'.$id; + print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight); + + + $html = ' My danger action'; + $actionType = 'danger'; + $n++; + $id = 'mybuttonid'.$n; + $url = $_SERVER['PHP_SELF'] . '?token='.newToken().'#'.$id; + print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight); + + ?> +
+ +

Buttons for user NOT allowed to click.

+ +
+ My default action'; + $actionType = 'default'; + $n++; + $id = 'mybuttonid'.$n; + $url = '#'.$id; + $userRight = 0; + + print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight); + + + $html = ' My delete action'; + $actionType = 'delete'; + $n++; + $id = 'mybuttonid'.$n; + $url = $_SERVER['PHP_SELF'] . '?token='.newToken().'#'.$id; + print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight); + + + $html = ' My danger action'; + $actionType = 'danger'; + $n++; + $id = 'mybuttonid'.$n; + $url = $_SERVER['PHP_SELF'] . '?token='.newToken().'#'.$id; + print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight); + + ?> +
+ + +

Example of confirm dialog

+ +

Buttons for user allowed to click.

+ +
+ My default action'; + $actionType = 'default'; + $n++; + $id = 'mybuttonid'.$n; + $url = '#'.$id; + $userRight = 1; + $params = array( + 'confirm' => true + ); + + print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params); + + + $html = ' My delete action'; + $actionType = 'delete'; + $n++; + $id = 'mybuttonid'.$n; + $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); + + ?> +
+ +

Buttons for user NOT allowed to click.

+ +
+ My default action'; + $actionType = 'default'; + $n++; + $id = 'mybuttonid'.$n; + $url = '#'.$id; + $userRight = 0; + $params = array( + 'confirm' => true + ); + + print dolGetButtonAction($label, $html, $actionType, $url, $id, $userRight, $params); + + + $html = ' My delete action'; + $actionType = 'delete'; + $n++; + $id = 'mybuttonid'.$n; + $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); + + ?> +
+ + +