From 0fd30598b34c56ef139f8354fc96a0e89bdc99d9 Mon Sep 17 00:00:00 2001 From: Alexander Kochetov Date: Sun, 26 May 2013 01:44:34 +0400 Subject: [PATCH] jQuery UI sortable widget --- framework/yii/jui/Sortable.php | 63 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 framework/yii/jui/Sortable.php diff --git a/framework/yii/jui/Sortable.php b/framework/yii/jui/Sortable.php new file mode 100644 index 0000000..1b5b26b --- /dev/null +++ b/framework/yii/jui/Sortable.php @@ -0,0 +1,63 @@ + array( + * 'cursor' => 'move', + * ), + * 'options' => array( + * 'tag' => 'ul', + * ), + * )); + * + * echo '
  • Item 1
  • '; + * echo '
  • Item 2
  • '; + * echo '
  • Item 3
  • '; + * + * Sortable::end(); + * ``` + * + * @see http://api.jqueryui.com/sortable/ + * @author Alexander Kochetov + * @since 2.0 + */ +class Sortable extends Widget +{ + /** + * Initializes the widget. + */ + public function init() + { + parent::init(); + $options = $this->options; + $tag = isset($options['tag']) ? $options['tag'] : 'div'; + unset($options['tag']); + echo Html::beginTag($tag, $options) . "\n"; + } + + /** + * Renders the widget. + */ + public function run() + { + $options = $this->options; + $tag = isset($options['tag']) ? $options['tag'] : 'div'; + unset($options['tag']); + echo Html::endTag($tag) . "\n"; + $this->registerWidget('sortable', false); + } +}