Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
103 - 1
<?php
2
 
3
/***************************************************************************
4
 *   Copyright (C) 2009-2011 by Geo Varghese(www.seopanel.in)  	           *
5
 *   sendtogeo@gmail.com   												   *
6
 *                                                                         *
7
 *   This program is free software; you can redistribute it and/or modify  *
8
 *   it under the terms of the GNU General Public License as published by  *
9
 *   the Free Software Foundation; either version 2 of the License, or     *
10
 *   (at your option) any later version.                                   *
11
 *                                                                         *
12
 *   This program is distributed in the hope that it will be useful,       *
13
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
14
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
15
 *   GNU General Public License for more details.                          *
16
 *                                                                         *
17
 *   You should have received a copy of the GNU General Public License     *
18
 *   along with this program; if not, write to the                         *
19
 *   Free Software Foundation, Inc.,                                       *
20
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
21
 ***************************************************************************/
22
 
23
# class defines all view functions
24
class View extends Seopanel{
25
 
26
	function render($viewFile, $layout='default', $printContent=true){
27
 
28
		$spText = $_SESSION['text'];
29
		if(count($this->data) > 0){
30
			foreach ($this->data as $varName => $varValue){
31
				$$varName = $varValue;
32
			}
33
		}
34
		ob_start();
35
		include_once(SP_VIEWPATH."/".$viewFile.".ctp.php");
36
		$viewContent = ob_get_contents();
37
		ob_end_clean();
38
 
39
		ob_start();
40
		if($layout == 'ajax'){
41
			if($printContent){
42
				print $viewContent;
43
			}else{
44
				return $viewContent;
45
			}
46
		}else{
47
 
48
			$langCtrler = New LanguageController();
49
			$langList = $langCtrler->__getAllLanguages(" where translated=1");
50
			$userLang = empty($_SESSION['lang_code']) ? SP_DEFAULTLANG : $_SESSION['lang_code'];
51
			$redirectUrl = $langCtrler->getRedirectUrl();
52
 
53
			$spTextPanel = $langCtrler->getLanguageTexts('panel', $_SESSION['lang_code']);
54
			$spTextLogin = $langCtrler->getLanguageTexts('login', $_SESSION['lang_code']);
55
			include_once(SP_VIEWPATH."/layout/".$layout.".ctp.php");
56
		}
57
	}
58
 
59
	function getViewContent($viewFile){
60
 
61
		$spText = $_SESSION['text'];
62
		if(count($this->data) > 0){
63
			foreach ($this->data as $varName => $varValue){
64
				$$varName = $varValue;
65
			}
66
		}
67
 
68
		ob_start();
69
		include(SP_VIEWPATH."/".$viewFile.".ctp.php");
70
		$viewContent = ob_get_contents();
71
		ob_end_clean();
72
		return $viewContent;
73
	}
74
 
75
	#func to fetch the ctp file content
76
	function fetchViewFile($viewFile, $data=array()) {
77
 
78
		$spText = $_SESSION['text'];
79
		if(count($data) > 0){
80
			foreach ($data as $varName => $varValue){
81
				$$varName = $varValue;
82
			}
83
		}
84
 
85
		ob_start();
86
		include(SP_VIEWPATH."/".$viewFile.".ctp.php");
87
		$viewContent = ob_get_contents();
88
		ob_end_clean();
89
		return $viewContent;
90
	}
91
 
92
	# plugin render functions
93
	function pluginRender($viewFile, $layout='default', $printContent=true){
94
 
95
		$spText = $_SESSION['text'];
96
		$viewContent = $this->getPluginViewContent($viewFile);
97
		ob_start();
98
		if($layout == 'ajax'){
99
			if($printContent){
100
				print $viewContent;
101
			}else{
102
				return $viewContent;
103
			}
104
		}else{
105
			$langCtrler = New LanguageController();
106
			$spTextPanel = $langCtrler->getLanguageTexts('panel', $_SESSION['lang_code']);
107
			$spTextLogin = $langCtrler->getLanguageTexts('login', $_SESSION['lang_code']);
108
			include(SP_VIEWPATH."/layout/".$layout.".ctp.php");
109
		}
110
	}
111
 
112
	function getPluginViewContent($viewFile){
113
 
114
		$spText = $_SESSION['text'];
115
		if(count($this->data) > 0){
116
			foreach ($this->data as $varName => $varValue){
117
				$$varName = $varValue;
118
			}
119
		}
120
 
121
		ob_start();
122
		include(PLUGIN_VIEWPATH."/".$viewFile.".ctp.php");
123
		$viewContent = ob_get_contents();
124
		ob_end_clean();
125
		return $viewContent;
126
	}
127
 
128
	#func to fetch the ctp file
129
	function fetchFile($viewFile, $data=array()) {
130
 
131
		$spText = $_SESSION['text'];
132
		if(count($data) > 0){
133
			foreach ($data as $varName => $varValue){
134
				$$varName = $varValue;
135
			}
136
		}
137
 
138
		ob_start();
139
		include($viewFile);
140
		$viewContent = ob_get_contents();
141
		ob_end_clean();
142
		return $viewContent;
143
	}
144
 
145
}
146
?>