Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • CJuiAccordion
  • CJuiAutoComplete
  • CJuiButton
  • CJuiDatePicker
  • CJuiDialog
  • CJuiDraggable
  • CJuiDroppable
  • CJuiInputWidget
  • CJuiProgressBar
  • CJuiResizable
  • CJuiSelectable
  • CJuiSlider
  • CJuiSliderInput
  • CJuiSortable
  • CJuiTabs
  • CJuiWidget
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * CJuiDraggable class file.
 4:  *
 5:  * @author Sebastian Thierer <sebathi@gmail.com>
 6:  * @link http://www.yiiframework.com/
 7:  * @copyright 2008-2013 Yii Software LLC
 8:  * @license http://www.yiiframework.com/license/
 9:  */
10: 
11: Yii::import('zii.widgets.jui.CJuiWidget');
12: 
13: /**
14:  * CJuiDraggable displays a draggable widget.
15:  *
16:  * CJuiDraggable encapsulates the {@link http://jqueryui.com/draggable/ JUI Draggable}
17:  * plugin.
18:  *
19:  * To use this widget, you may insert the following code in a view:
20:  * <pre>
21:  * $this->beginWidget('zii.widgets.jui.CJuiDraggable',array(
22:  *     // additional javascript options for the draggable plugin
23:  *     'options'=>array(
24:  *         'scope'=>'myScope',
25:  *     ),
26:  * ));
27:  *     echo 'Your draggable content here';
28:  *
29:  * $this->endWidget();
30:  *
31:  * </pre>
32:  *
33:  * By configuring the {@link options} property, you may specify the options
34:  * that need to be passed to the JUI Draggable plugin. Please refer to
35:  * the {@link http://api.jqueryui.com/draggable/ JUI Draggable API} documentation
36:  * for possible options (name-value pairs) and
37:  * {@link http://jqueryui.com/draggable/ JUI Draggable page} for general
38:  * description and demo.
39:  *
40:  * @author Sebastian Thierer <sebathi@gmail.com>
41:  * @package zii.widgets.jui
42:  * @since 1.1
43:  */
44: class CJuiDraggable extends CJuiWidget
45: {
46:     /**
47:      * @var string the name of the Draggable element. Defaults to 'div'.
48:      */
49:     public $tagName='div';
50: 
51:     /**
52:      * Renders the open tag of the draggable element.
53:      * This method also registers the necessary javascript code.
54:      */
55:     public function init()
56:     {
57:         parent::init();
58: 
59:         $id=$this->getId();
60:         if(isset($this->htmlOptions['id']))
61:             $id=$this->htmlOptions['id'];
62:         else
63:             $this->htmlOptions['id']=$id;
64: 
65:         $options=CJavaScript::encode($this->options);
66:         Yii::app()->getClientScript()->registerScript(__CLASS__.'#'.$id,"jQuery('#{$id}').draggable($options);");
67: 
68:         echo CHtml::openTag($this->tagName,$this->htmlOptions)."\n";
69:     }
70: 
71:     /**
72:      * Renders the close tag of the draggable element.
73:      */
74:     public function run()
75:     {
76:         echo CHtml::closeTag($this->tagName);
77:     }
78: }
API documentation generated by ApiGen 2.8.0