00001 <?php 00002 /* SVN FILE: $Id: theme.php 7847 2008-11-08 02:54:07Z renan.saddam $ */ 00003 /** 00004 * A custom view class that is used for themeing 00005 * 00006 * PHP versions 4 and 5 00007 * 00008 * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org) 00009 * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) 00010 * 00011 * Licensed under The MIT License 00012 * Redistributions of files must retain the above copyright notice. 00013 * 00014 * @filesource 00015 * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) 00016 * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project 00017 * @package cake 00018 * @subpackage cake.cake.libs.view 00019 * @since CakePHP(tm) v 0.10.0.1076 00020 * @version $Revision: 7847 $ 00021 * @modifiedby $LastChangedBy: renan.saddam $ 00022 * @lastmodified $Date: 2008-11-07 21:54:07 -0500 (Fri, 07 Nov 2008) $ 00023 * @license http://www.opensource.org/licenses/mit-license.php The MIT License 00024 */ 00025 /** 00026 * Theme view class 00027 * 00028 * @package cake 00029 * @subpackage cake.cake.libs.view 00030 */ 00031 class ThemeView extends View { 00032 /** 00033 * System path to themed element: themed . DS . theme . DS . elements . DS 00034 * 00035 * @var string 00036 */ 00037 var $themeElement = null; 00038 /** 00039 * System path to themed layout: themed . DS . theme . DS . layouts . DS 00040 * 00041 * @var string 00042 */ 00043 var $themeLayout = null; 00044 /** 00045 * System path to themed: themed . DS . theme . DS 00046 * 00047 * @var string 00048 */ 00049 var $themePath = null; 00050 /** 00051 * Enter description here... 00052 * 00053 * @param unknown_type $controller 00054 */ 00055 function __construct (&$controller) { 00056 parent::__construct($controller); 00057 $this->theme =& $controller->theme; 00058 00059 if (!empty($this->theme)) { 00060 if (is_dir(WWW_ROOT . 'themed' . DS . $this->theme)) { 00061 $this->themeWeb = 'themed/'. $this->theme .'/'; 00062 } 00063 /* deprecated: as of 6128 the following properties are no longer needed */ 00064 $this->themeElement = 'themed'. DS . $this->theme . DS .'elements'. DS; 00065 $this->themeLayout = 'themed'. DS . $this->theme . DS .'layouts'. DS; 00066 $this->themePath = 'themed'. DS . $this->theme . DS; 00067 } 00068 } 00069 00070 /** 00071 * Return all possible paths to find view files in order 00072 * 00073 * @param string $plugin 00074 * @return array paths 00075 * @access private 00076 */ 00077 function _paths($plugin = null, $cached = true) { 00078 $paths = parent::_paths($plugin, $cached); 00079 00080 if (!empty($this->theme)) { 00081 $count = count($paths); 00082 for ($i = 0; $i < $count; $i++) { 00083 $themePaths[] = $paths[$i] . 'themed'. DS . $this->theme . DS; 00084 } 00085 $paths = array_merge($themePaths, $paths); 00086 } 00087 00088 if (empty($this->__paths)) { 00089 $this->__paths = $paths; 00090 } 00091 00092 return $paths; 00093 } 00094 } 00095 ?>
1.4.7