From 4ac888d2f342bfc76d3c8f977834c2c65bd28d8d Mon Sep 17 00:00:00 2001 From: Alexander Kochetov Date: Fri, 24 May 2013 16:10:28 +0400 Subject: [PATCH 1/3] jQuery UI progressbar widget --- framework/yii/jui/ProgressBar.php | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 framework/yii/jui/ProgressBar.php diff --git a/framework/yii/jui/ProgressBar.php b/framework/yii/jui/ProgressBar.php new file mode 100644 index 0000000..ab07620 --- /dev/null +++ b/framework/yii/jui/ProgressBar.php @@ -0,0 +1,41 @@ + array( + * 'value' => 75, + * ), + * )); + * ``` + * + * @see http://api.jqueryui.com/progressbar/ + * @author Alexander Kochetov + * @since 2.0 + */ +class ProgressBar extends Widget +{ + /** + * Renders the widget. + */ + public function run() + { + echo Html::beginTag('div', $this->options) . "\n"; + echo Html::endTag('div') . "\n"; + $this->registerWidget('progressbar'); + } +} From f3554048a90886c4716d7b5e54042ddd751838ae Mon Sep 17 00:00:00 2001 From: Alexander Kochetov Date: Fri, 24 May 2013 22:04:29 +0400 Subject: [PATCH 2/3] ProgressBar enhancement --- framework/yii/jui/ProgressBar.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/framework/yii/jui/ProgressBar.php b/framework/yii/jui/ProgressBar.php index ab07620..6861a22 100644 --- a/framework/yii/jui/ProgressBar.php +++ b/framework/yii/jui/ProgressBar.php @@ -16,13 +16,27 @@ use yii\helpers\Html; * For example: * * ```php - * echo Progressbar::widget(array( + * echo ProgressBar::widget(array( * 'clientOptions' => array( * 'value' => 75, * ), * )); * ``` * + * The following example will show the content enclosed between the [[begin()]] + * and [[end()]] calls within the widget container: + * + * ~~~php + * ProgressBar::widget(array( + * 'clientOptions' => array( + * 'value' => 75, + * ), + * )); + * + * echo '
Loading...
'; + * + * ProgressBar::end(); + * ~~~ * @see http://api.jqueryui.com/progressbar/ * @author Alexander Kochetov * @since 2.0 @@ -30,11 +44,19 @@ use yii\helpers\Html; class ProgressBar extends Widget { /** + * Initializes the widget. + */ + public function init() + { + parent::init(); + echo Html::beginTag('div', $this->options) . "\n"; + } + + /** * Renders the widget. */ public function run() { - echo Html::beginTag('div', $this->options) . "\n"; echo Html::endTag('div') . "\n"; $this->registerWidget('progressbar'); } From ae1576c335a9c96c02e76dc22cfaef3701471e0a Mon Sep 17 00:00:00 2001 From: Alexander Kochetov Date: Sat, 25 May 2013 00:39:14 +0400 Subject: [PATCH 3/3] Remove unnecessary use --- framework/yii/jui/ProgressBar.php | 1 - 1 file changed, 1 deletion(-) diff --git a/framework/yii/jui/ProgressBar.php b/framework/yii/jui/ProgressBar.php index 6861a22..a7697e5 100644 --- a/framework/yii/jui/ProgressBar.php +++ b/framework/yii/jui/ProgressBar.php @@ -7,7 +7,6 @@ namespace yii\jui; -use yii\helpers\base\ArrayHelper; use yii\helpers\Html; /**