/** * Creates a new uiConfirmation object. * * The $text_base argument in fact defines two texts in one (and assumes you are using translations!): * It will be prefixed with 'TXT_' and 'TITLE_' and that two constants will be used. * Sample: 'CONFIRMATION' will become 'TXT_CONFIRMATION' and 'TITLE_CONFIRMATION'. * @param string $text_base base of confirmation text. * @param string $ok_callback JS code to be executed when the positive button is clicked (OK, YES) * @param int $button_mode uiConfirmation::OK_CANCEL or uiConfirmation::YES_NO */ function __initialize($text_base = 'CONFIRMATION', $ok_callback = false, $button_mode = self::OK_CANCEL) { $options = array('autoOpen' => true, 'modal' => true, 'width' => 450, 'height' => 300); $title = "TITLE_{$text_base}"; $text = "TXT_{$text_base}"; parent::__initialize($title, $options); switch ($button_mode) { case self::OK_CANCEL: $this->AddButton(tds('BTN_OK', 'Ok'), $ok_callback); $this->AddCloseButton(tds('BTN_CANCEL', 'Cancel')); break; case self::YES_NO: $this->AddButton(tds('BTN_YES', 'Yes'), $ok_callback); $this->AddCloseButton(tds('BTN_NO', 'No')); break; default: WdfException::Raise("Wrong button_mode: {$button_mode}"); } $this->Mode = $button_mode; $this->content($text); }
/** * @param string $title Dialog title * @param array $options Options as in <uiDialog> */ function __initialize($title = "TITLE_DIALOG", $options = array()) { parent::__initialize($title, $options); $this->_table = $this->content(new Table()); }