/** * Constructor. * * $name : raw button text * $message : dialog message to ask user * $formParams : associate array of form parameters * $icon : name of the icon: ~/images/icons/button_[$icon].png. Uses $name if not present * $hideText : true to have a text-less round button * $formMethod : the method of the form, POST by default * $formAction : the action of the form, current page by default */ public function __construct($name, $message, $formParams, $icon = null, $hideText = false, $formMethod = 'POST', $formAction = null) { parent::__construct($name, '#', "doConfirm('" . js_reencode($message) . "', document." . ($id = 'confirm' . self::nextConfirmID()) . ");", $icon, $hideText); if ($formAction == null) { $formAction = Server::currentPageName(); } $this->form = "<form class=inline name=\"{$id}\" method=\"{$formMethod}\" action=\"{$formAction}\">"; foreach ($formParams as $name => $value) { $valueEsc = inputize($value); $this->form .= "<input type=\"hidden\" name=\"{$name}\" value=\"{$valueEsc}\" />"; } $this->form .= "</form>"; require_js('confirm'); require_css('form'); }