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:  * CJuiSelectable 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:  * CJuiSelectable displays an accordion widget.
15:  *
16:  * CJuiSelectable encapsulates the {@link http://jqueryui.com/selectable/ JUI Selectable}
17:  * plugin.
18:  *
19:  * To use this widget, you may insert the following code in a view:
20:  * <pre>
21:  * $this->widget('zii.widgets.jui.CJuiSelectable',array(
22:  *     'items'=>array(
23:  *         'id1'=>'Item 1',
24:  *         'id2'=>'Item 2',
25:  *         'id3'=>'Item 3',
26:  *     ),
27:  *     // additional javascript options for the selectable plugin
28:  *     'options'=>array(
29:  *         'delay'=>'300',
30:  *     ),
31:  * ));
32:  * </pre>
33:  *
34:  * By configuring the {@link options} property, you may specify the options
35:  * that need to be passed to the JUI Selectable plugin. Please refer to
36:  * the {@link http://api.jqueryui.com/selectable/ JUI Selectable API}
37:  * documentation for possible options (name-value pairs) and
38:  * {@link http://jqueryui.com/selectable/ JUI Selectable page} for general
39:  * description and demo.
40:  *
41:  * @author Sebastian Thierer <sebathi@gmail.com>
42:  * @package zii.widgets.jui
43:  * @since 1.1
44:  */
45: class CJuiSelectable extends CJuiWidget {
46:     /**
47:      * @var array list of selectable items (id=>item content).
48:      * Note that the item contents will not be HTML-encoded.
49:      */
50:     public $items=array();
51:     /**
52:      * @var string the name of the container element that contains all items. Defaults to 'ol'.
53:      */
54:     public $tagName='ol';
55:     /**
56:      * @var string the template that is used to generated every selectable item.
57:      * The token "{content}" in the template will be replaced with the item content,
58:      * while "{id}" will be replaced with the item ID.
59:      */
60:     public $itemTemplate='<li id="{id}">{content}</li>';
61: 
62:     /**
63:      * Run this widget.
64:      * This method registers necessary javascript and renders the needed HTML code.
65:      */
66:     public function run()
67:     {
68:         $id=$this->getId();
69:         if(isset($this->htmlOptions['id']))
70:             $id=$this->htmlOptions['id'];
71:         else
72:             $this->htmlOptions['id']=$id;
73: 
74:         $options=CJavaScript::encode($this->options);
75:         Yii::app()->getClientScript()->registerScript(__CLASS__.'#'.$id,"jQuery('#{$id}').selectable({$options});");
76: 
77:         echo CHtml::openTag($this->tagName,$this->htmlOptions)."\n";
78:         foreach($this->items as $id=>$content)
79:             echo strtr($this->itemTemplate,array('{id}'=>$id,'{content}'=>$content))."\n";
80:         echo CHtml::closeTag($this->tagName);
81:     }
82: }
API documentation generated by ApiGen 2.8.0