progressText = DUP_PRO_U::__('Processing please wait...'); $this->uniqid = ++self::$uniqueIdCounter; $this->id = 'dpro-dlg-' . $this->uniqid; $this->okText = DUP_PRO_U::__('OK'); $this->cancelText = DUP_PRO_U::__('Cancel'); } /** * * @return int */ public function getUniqueIdCounter() { return $this->uniqid; } /** * Gets the unique id that is assigned to each instance of a dialog * * @return int The unique ID of this dialog */ public function getID() { return $this->id; } /** * Gets the unique id that is assigned to each instance of a dialogs message text * * @return int The unique ID of the message */ public function getMessageID() { return "{$this->id}_message"; } /** * Initialize the alert base html code used to display when needed * * @return string The html content used for the alert dialog */ public function initAlert() { $onClickClose = ''; if (!is_null($this->jsCallback)) { $onClickClose .= $this->jsCallback . ';'; } $onClickClose .= 'tb_remove();'; $html = '
'; echo $html; } /** * Shows the alert base JS code used to display when needed * * @return string The JS content used for the alert dialog */ public function showAlert() { $this->width = is_numeric($this->width) ? $this->width : 500; $this->height = is_numeric($this->height) ? $this->height : 175; $html = "tb_show('" . esc_js($this->title) . "', '#TB_inline?width=" . esc_js($this->width) . "&height=" . esc_js($this->height) . "&inlineId=" . esc_js($this->id) . "');\n" . "var styleData = jQuery('#TB_window').attr('style') + 'height: " . esc_js($this->height) . "px !important';\n" . "jQuery('#TB_window').attr('style', styleData);"; echo $html; } /** * js code to update html message content from js var name * * @param string $jsVarName */ public function updateMessage($jsVarName) { $js = '$("#' . $this->getID() . '_message").html(' . $jsVarName . ');'; echo $js; } /** * Shows the confirm base JS code used to display when needed * * @return string The JS content used for the confirm dialog */ public function initConfirm() { $progress_data = ''; $progress_func2 = ''; $onClickConfirm = ''; if (!is_null($this->jsCallback)) { $onClickConfirm .= $this->jsCallback . ';'; } //Enable the progress spinner if ($this->progressOn) { $progress_func1 = "__dpro_dialog_" . $this->uniqid; $progress_func2 = ";{$progress_func1}(this)"; $progress_data = <<