Subversion-Projekte lars-tiefland.cakephp

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/* SVN FILE: $Id: theme.php 7945 2008-12-19 02:16:01Z gwoo $ */
3
/**
4
 * A custom view class that is used for themeing
5
 *
6
 * PHP versions 4 and 5
7
 *
8
 * CakePHP(tm) :  Rapid Development Framework (http://www.cakephp.org)
9
 * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
10
 *
11
 * Licensed under The MIT License
12
 * Redistributions of files must retain the above copyright notice.
13
 *
14
 * @filesource
15
 * @copyright     Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
16
 * @link          http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
17
 * @package       cake
18
 * @subpackage    cake.cake.libs.view
19
 * @since         CakePHP(tm) v 0.10.0.1076
20
 * @version       $Revision: 7945 $
21
 * @modifiedby    $LastChangedBy: gwoo $
22
 * @lastmodified  $Date: 2008-12-18 18:16:01 -0800 (Thu, 18 Dec 2008) $
23
 * @license       http://www.opensource.org/licenses/mit-license.php The MIT License
24
 */
25
/**
26
 * Theme view class
27
 *
28
 * @package       cake
29
 * @subpackage    cake.cake.libs.view
30
 */
31
class ThemeView extends View {
32
/**
33
 * System path to themed element: themed . DS . theme . DS . elements . DS
34
 *
35
 * @var string
36
 */
37
	var $themeElement = null;
38
/**
39
 * System path to themed layout: themed . DS . theme . DS . layouts . DS
40
 *
41
 * @var string
42
 */
43
	var $themeLayout = null;
44
/**
45
 * System path to themed: themed . DS . theme . DS
46
 *
47
 * @var string
48
 */
49
	var $themePath = null;
50
/**
51
 * Enter description here...
52
 *
53
 * @param unknown_type $controller
54
 */
55
	function __construct (&$controller) {
56
		parent::__construct($controller);
57
		$this->theme =& $controller->theme;
58
 
59
		if (!empty($this->theme)) {
60
			if (is_dir(WWW_ROOT . 'themed' . DS . $this->theme)) {
61
				$this->themeWeb = 'themed/'. $this->theme .'/';
62
			}
63
			/* deprecated: as of 6128 the following properties are no longer needed */
64
			$this->themeElement = 'themed'. DS . $this->theme . DS .'elements'. DS;
65
			$this->themeLayout =  'themed'. DS . $this->theme . DS .'layouts'. DS;
66
			$this->themePath = 'themed'. DS . $this->theme . DS;
67
		}
68
	}
69
 
70
/**
71
 * Return all possible paths to find view files in order
72
 *
73
 * @param string $plugin
74
 * @return array paths
75
 * @access private
76
 */
77
	function _paths($plugin = null, $cached = true) {
78
		$paths = parent::_paths($plugin, $cached);
79
 
80
		if (!empty($this->theme)) {
81
			$count = count($paths);
82
			for ($i = 0; $i < $count; $i++) {
83
				$themePaths[] = $paths[$i] . 'themed'. DS . $this->theme . DS;
84
			}
85
			$paths = array_merge($themePaths, $paths);
86
		}
87
 
88
		if (empty($this->__paths)) {
89
			$this->__paths = $paths;
90
		}
91
 
92
		return $paths;
93
	}
94
}
95
?>