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

  • ActionFormModelBase
  • CActiveDataProvider
  • CalendarEventFormModel
  • CallFormModel
  • CArrayDataProvider
  • CAssetManager
  • CBaseController
  • CBaseUrlRule
  • CCacheHttpSession
  • CClientScript
  • CController
  • CCookieCollection
  • CDataProvider
  • CDataProviderIterator
  • CDbHttpSession
  • CExtController
  • CFormModel
  • CHttpCookie
  • CHttpRequest
  • CHttpSession
  • CHttpSessionIterator
  • COutputEvent
  • CPagination
  • CreatePageFormModel
  • CSort
  • CSqlDataProvider
  • CTheme
  • CThemeManager
  • CUploadedFile
  • CUrlManager
  • CUrlRule
  • CWebApplication
  • CWebModule
  • CWidgetFactory
  • EditMobileFormsFormModel
  • EventCommentPublisherFormModel
  • EventFormModel
  • EventPublisherFormModel
  • FileSystemObjectDataProvider
  • MassActionFormModel
  • MobilePagination
  • NoteFormModel
  • NotificationsController
  • TimeFormModel
  • UploadLogoFormModel
  • X2FormModel
  • X2HttpRequest

Interfaces

  • IDataProvider
  • IWidgetFactory
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * CFormModel 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:  * CFormModel represents a data model that collects HTML form inputs.
13:  *
14:  * Unlike {@link CActiveRecord}, the data collected by CFormModel are stored
15:  * in memory only, instead of database.
16:  *
17:  * To collect user inputs, you may extend CFormModel and define the attributes
18:  * whose values are to be collected from user inputs. You may override
19:  * {@link rules()} to declare validation rules that should be applied to
20:  * the attributes.
21:  *
22:  * @author Qiang Xue <qiang.xue@gmail.com>
23:  * @package system.web
24:  * @since 1.0
25:  */
26: class CFormModel extends CModel
27: {
28:     private static $_names=array();
29: 
30:     /**
31:      * Constructor.
32:      * @param string $scenario name of the scenario that this model is used in.
33:      * See {@link CModel::scenario} on how scenario is used by models.
34:      * @see getScenario
35:      */
36:     public function __construct($scenario='')
37:     {
38:         $this->setScenario($scenario);
39:         $this->init();
40:         $this->attachBehaviors($this->behaviors());
41:         $this->afterConstruct();
42:     }
43: 
44:     /**
45:      * Initializes this model.
46:      * This method is invoked in the constructor right after {@link scenario} is set.
47:      * You may override this method to provide code that is needed to initialize the model (e.g. setting
48:      * initial property values.)
49:      */
50:     public function init()
51:     {
52:     }
53: 
54:     /**
55:      * Returns the list of attribute names.
56:      * By default, this method returns all public properties of the class.
57:      * You may override this method to change the default.
58:      * @return array list of attribute names. Defaults to all public properties of the class.
59:      */
60:     public function attributeNames()
61:     {
62:         $className=get_class($this);
63:         if(!isset(self::$_names[$className]))
64:         {
65:             $class=new ReflectionClass(get_class($this));
66:             $names=array();
67:             foreach($class->getProperties() as $property)
68:             {
69:                 $name=$property->getName();
70:                 if($property->isPublic() && !$property->isStatic())
71:                     $names[]=$name;
72:             }
73:             return self::$_names[$className]=$names;
74:         }
75:         else
76:             return self::$_names[$className];
77:     }
78: }
API documentation generated by ApiGen 2.8.0