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