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

  • CForm
  • CFormButtonElement
  • CFormElement
  • CFormElementCollection
  • CFormInputElement
  • CFormStringElement
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * CFormStringElement 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:  * CFormStringElement represents a string in a form.
13:  *
14:  * @property string $on Scenario names separated by commas. Defaults to null.
15:  *
16:  * @author Qiang Xue <qiang.xue@gmail.com>
17:  * @package system.web.form
18:  * @since 1.1
19:  */
20: class CFormStringElement extends CFormElement
21: {
22:     /**
23:      * @var string the string content
24:      */
25:     public $content;
26: 
27:     private $_on;
28: 
29:     /**
30:      * Returns a value indicating under which scenarios this string is visible.
31:      * If the value is empty, it means the string is visible under all scenarios.
32:      * Otherwise, only when the model is in the scenario whose name can be found in
33:      * this value, will the string be visible. See {@link CModel::scenario} for more
34:      * information about model scenarios.
35:      * @return string scenario names separated by commas. Defaults to null.
36:      */
37:     public function getOn()
38:     {
39:         return $this->_on;
40:     }
41: 
42:     /**
43:      * @param string $value scenario names separated by commas.
44:      */
45:     public function setOn($value)
46:     {
47:         $this->_on=preg_split('/[\s,]+/',$value,-1,PREG_SPLIT_NO_EMPTY);
48:     }
49: 
50:     /**
51:      * Renders this element.
52:      * The default implementation simply returns {@link content}.
53:      * @return string the string content
54:      */
55:     public function render()
56:     {
57:         return $this->content;
58:     }
59: 
60:     /**
61:      * Evaluates the visibility of this element.
62:      * This method will check the {@link on} property to see if
63:      * the model is in a scenario that should have this string displayed.
64:      * @return boolean whether this element is visible.
65:      */
66:     protected function evaluateVisible()
67:     {
68:         return empty($this->_on) || in_array($this->getParent()->getModel()->getScenario(),$this->_on);
69:     }
70: }
71: 
API documentation generated by ApiGen 2.8.0