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

  • ActionActiveForm
  • ActionActiveFormBase
  • CActiveForm
  • CalendarEventActiveForm
  • CallActiveForm
  • CClipWidget
  • CContentDecorator
  • CFilterWidget
  • CFlexWidget
  • CHtmlPurifier
  • CInputWidget
  • CMarkdown
  • CMaskedTextField
  • CMultiFileUpload
  • COutputCache
  • COutputProcessor
  • CStarRating
  • CTabView
  • CTextHighlighter
  • CTreeView
  • CWidget
  • EventActiveForm
  • MobileActiveForm
  • NoteActiveForm
  • TimeActiveForm
  • X2ActiveForm
  • X2StarRating
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * CFilterWidget class file.
 4:  *
 5:  * @author Qiang Xue <qiang.xue@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: /**
12:  * CFilterWidget is the base class for widgets that can also be used as filters.
13:  *
14:  * Derived classes may need to override the following methods:
15:  * <ul>
16:  * <li>{@link CWidget::init()} : called when this is object is used as a widget and needs initialization.</li>
17:  * <li>{@link CWidget::run()} : called when this is object is used as a widget.</li>
18:  * <li>{@link filter()} : the filtering method called when this object is used as an action filter.</li>
19:  * </ul>
20:  *
21:  * CFilterWidget provides all properties and methods of {@link CWidget} and {@link CFilter}.
22:  *
23:  * @property boolean $isFilter Whether this widget is used as a filter.
24:  *
25:  * @author Qiang Xue <qiang.xue@gmail.com>
26:  * @package system.web.widgets
27:  * @since 1.0
28:  */
29: class CFilterWidget extends CWidget implements IFilter
30: {
31:     /**
32:      * @var boolean whether to stop the action execution when this widget is used as a filter.
33:      * This property should be changed only in {@link CWidget::init} method.
34:      * Defaults to false, meaning the action should be executed.
35:      */
36:     public $stopAction=false;
37: 
38:     private $_isFilter;
39: 
40:     /**
41:      * Constructor.
42:      * @param CBaseController $owner owner/creator of this widget. It could be either a widget or a controller.
43:      */
44:     public function __construct($owner=null)
45:     {
46:         parent::__construct($owner);
47:         $this->_isFilter=($owner===null);
48:     }
49: 
50:     /**
51:      * @return boolean whether this widget is used as a filter.
52:      */
53:     public function getIsFilter()
54:     {
55:         return $this->_isFilter;
56:     }
57: 
58:     /**
59:      * Performs the filtering.
60:      * The default implementation simply calls {@link init()},
61:      * {@link CFilterChain::run()} and {@link run()} in order
62:      * Derived classes may want to override this method to change this behavior.
63:      * @param CFilterChain $filterChain the filter chain that the filter is on.
64:      */
65:     public function filter($filterChain)
66:     {
67:         $this->init();
68:         if(!$this->stopAction)
69:         {
70:             $filterChain->run();
71:             $this->run();
72:         }
73:     }
74: }
API documentation generated by ApiGen 2.8.0