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:  * CTheme 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:  * CTheme represents an application theme.
 13:  *
 14:  * @property string $name Theme name.
 15:  * @property string $baseUrl The relative URL to the theme folder (without ending slash).
 16:  * @property string $basePath The file path to the theme folder.
 17:  * @property string $viewPath The path for controller views. Defaults to 'ThemeRoot/views'.
 18:  * @property string $systemViewPath The path for system views. Defaults to 'ThemeRoot/views/system'.
 19:  * @property string $skinPath The path for widget skins. Defaults to 'ThemeRoot/views/skins'.
 20:  *
 21:  * @author Qiang Xue <qiang.xue@gmail.com>
 22:  * @package system.web
 23:  * @since 1.0
 24:  */
 25: class CTheme extends CComponent
 26: {
 27:     private $_name;
 28:     private $_basePath;
 29:     private $_baseUrl;
 30: 
 31:     /**
 32:      * Constructor.
 33:      * @param string $name name of the theme
 34:      * @param string $basePath base theme path
 35:      * @param string $baseUrl base theme URL
 36:      */
 37:     public function __construct($name,$basePath,$baseUrl)
 38:     {
 39:         $this->_name=$name;
 40:         $this->_baseUrl=$baseUrl;
 41:         $this->_basePath=$basePath;
 42:     }
 43: 
 44:     /**
 45:      * @return string theme name
 46:      */
 47:     public function getName()
 48:     {
 49:         return $this->_name;
 50:     }
 51: 
 52:     /**
 53:      * @return string the relative URL to the theme folder (without ending slash)
 54:      */
 55:     public function getBaseUrl()
 56:     {
 57:         return $this->_baseUrl;
 58:     }
 59: 
 60:     /**
 61:      * @return string the file path to the theme folder
 62:      */
 63:     public function getBasePath()
 64:     {
 65:         return $this->_basePath;
 66:     }
 67: 
 68:     /**
 69:      * @return string the path for controller views. Defaults to 'ThemeRoot/views'.
 70:      */
 71:     public function getViewPath()
 72:     {
 73:         return $this->_basePath.DIRECTORY_SEPARATOR.'views';
 74:     }
 75: 
 76:     /**
 77:      * @return string the path for system views. Defaults to 'ThemeRoot/views/system'.
 78:      */
 79:     public function getSystemViewPath()
 80:     {
 81:         return $this->getViewPath().DIRECTORY_SEPARATOR.'system';
 82:     }
 83: 
 84:     /**
 85:      * @return string the path for widget skins. Defaults to 'ThemeRoot/views/skins'.
 86:      * @since 1.1
 87:      */
 88:     public function getSkinPath()
 89:     {
 90:         return $this->getViewPath().DIRECTORY_SEPARATOR.'skins';
 91:     }
 92: 
 93:     /**
 94:      * Finds the view file for the specified controller's view.
 95:      * @param CController $controller the controller
 96:      * @param string $viewName the view name
 97:      * @return string the view file path. False if the file does not exist.
 98:      */
 99:     public function getViewFile($controller,$viewName)
100:     {
101:         $moduleViewPath=$this->getViewPath();
102:         if(($module=$controller->getModule())!==null)
103:             $moduleViewPath.='/'.$module->getId();
104:         return $controller->resolveViewFile($viewName,$this->getViewPath().'/'.$controller->getUniqueId(),$this->getViewPath(),$moduleViewPath);
105:     }
106: 
107:     /**
108:      * Finds the layout file for the specified controller's layout.
109:      * @param CController $controller the controller
110:      * @param string $layoutName the layout name
111:      * @return string the layout file path. False if the file does not exist.
112:      */
113:     public function getLayoutFile($controller,$layoutName)
114:     {
115:         $moduleViewPath=$basePath=$this->getViewPath();
116:         $module=$controller->getModule();
117:         if(empty($layoutName))
118:         {
119:             while($module!==null)
120:             {
121:                 if($module->layout===false)
122:                     return false;
123:                 if(!empty($module->layout))
124:                     break;
125:                 $module=$module->getParentModule();
126:             }
127:             if($module===null)
128:                 $layoutName=Yii::app()->layout;
129:             else
130:             {
131:                 $layoutName=$module->layout;
132:                 $moduleViewPath.='/'.$module->getId();
133:             }
134:         }
135:         elseif($module!==null)
136:             $moduleViewPath.='/'.$module->getId();
137: 
138:         return $controller->resolveViewFile($layoutName,$moduleViewPath.'/layouts',$basePath,$moduleViewPath);
139:     }
140: }
141: 
API documentation generated by ApiGen 2.8.0