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

  • CAction
  • CInlineAction
  • CreateWebFormAction
  • CViewAction
  • GetActionsBetweenAction
  • MobileAction
  • MobileActivityAction
  • MobileCreateAction
  • MobileDeleteAction
  • MobileIndexAction
  • MobileProfileViewAction
  • MobilePublisherAction
  • MobileResetPasswordAction
  • MobileTopicsCreateAction
  • MobileTopicsDeleteReplyAction
  • MobileTopicsIndexAction
  • MobileTopicsUpdateAction
  • MobileTopicsUpdateReplyAction
  • MobileTopicsViewAction
  • MobileUpdateAction
  • MobileViewAction
  • MobileViewEventAction
  • RecordAliasesCreateAction
  • RecordAliasesDeleteAction
  • WebFormAction
  • X2GridViewMassActionAction
  • X2ModelConversionAction
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * CAction 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:  * CAction is the base class for all controller action classes.
 13:  *
 14:  * CAction provides a way to divide a complex controller into
 15:  * smaller actions in separate class files.
 16:  *
 17:  * Derived classes must implement {@link run()} which is invoked by
 18:  * controller when the action is requested.
 19:  *
 20:  * An action instance can access its controller via {@link getController controller} property.
 21:  *
 22:  * @property CController $controller The controller who owns this action.
 23:  * @property string $id Id of this action.
 24:  *
 25:  * @method run() executes action
 26:  *
 27:  * @author Qiang Xue <qiang.xue@gmail.com>
 28:  * @package system.web.actions
 29:  * @since 1.0
 30:  */
 31: abstract class CAction extends CComponent implements IAction
 32: {
 33:     private $_id;
 34:     private $_controller;
 35: 
 36:     /**
 37:      * Constructor.
 38:      * @param CController $controller the controller who owns this action.
 39:      * @param string $id id of the action.
 40:      */
 41:     public function __construct($controller,$id)
 42:     {
 43:         $this->_controller=$controller;
 44:         $this->_id=$id;
 45:     }
 46: 
 47:     /**
 48:      * @return CController the controller who owns this action.
 49:      */
 50:     public function getController()
 51:     {
 52:         return $this->_controller;
 53:     }
 54: 
 55:     /**
 56:      * @return string id of this action
 57:      */
 58:     public function getId()
 59:     {
 60:         return $this->_id;
 61:     }
 62: 
 63:     /**
 64:      * Runs the action with the supplied request parameters.
 65:      * This method is internally called by {@link CController::runAction()}.
 66:      * @param array $params the request parameters (name=>value)
 67:      * @return boolean whether the request parameters are valid
 68:      * @since 1.1.7
 69:      */
 70:     public function runWithParams($params)
 71:     {
 72:         $method=new ReflectionMethod($this, 'run');
 73:         if($method->getNumberOfParameters()>0)
 74:             return $this->runWithParamsInternal($this, $method, $params);
 75: 
 76:         $this->run();
 77:         return true;
 78:     }
 79: 
 80:     /**
 81:      * Executes a method of an object with the supplied named parameters.
 82:      * This method is internally used.
 83:      * @param mixed $object the object whose method is to be executed
 84:      * @param ReflectionMethod $method the method reflection
 85:      * @param array $params the named parameters
 86:      * @return boolean whether the named parameters are valid
 87:      * @since 1.1.7
 88:      */
 89:     protected function runWithParamsInternal($object, $method, $params)
 90:     {
 91:         $ps=array();
 92:         foreach($method->getParameters() as $i=>$param)
 93:         {
 94:             $name=$param->getName();
 95:             if(isset($params[$name]))
 96:             {
 97:                 if($param->isArray())
 98:                     $ps[]=is_array($params[$name]) ? $params[$name] : array($params[$name]);
 99:                 elseif(!is_array($params[$name]))
100:                     $ps[]=$params[$name];
101:                 else
102:                     return false;
103:             }
104:             elseif($param->isDefaultValueAvailable())
105:                 $ps[]=$param->getDefaultValue();
106:             else
107:                 return false;
108:         }
109:         $method->invokeArgs($object,$ps);
110:         return true;
111:     }
112: }
113: 
API documentation generated by ApiGen 2.8.0