1
|
|
|
<?php |
2
|
|
|
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
3
|
|
|
/********************************************************************************* |
4
|
|
|
* SugarCRM Community Edition is a customer relationship management program developed by |
5
|
|
|
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
6
|
|
|
|
7
|
|
|
* SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd. |
8
|
|
|
* Copyright (C) 2011 - 2014 Salesagility Ltd. |
9
|
|
|
* |
10
|
|
|
* This program is free software; you can redistribute it and/or modify it under |
11
|
|
|
* the terms of the GNU Affero General Public License version 3 as published by the |
12
|
|
|
* Free Software Foundation with the addition of the following permission added |
13
|
|
|
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK |
14
|
|
|
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY |
15
|
|
|
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. |
16
|
|
|
* |
17
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT |
18
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
19
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more |
20
|
|
|
* details. |
21
|
|
|
* |
22
|
|
|
* You should have received a copy of the GNU Affero General Public License along with |
23
|
|
|
* this program; if not, see http://www.gnu.org/licenses or write to the Free |
24
|
|
|
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
25
|
|
|
* 02110-1301 USA. |
26
|
|
|
* |
27
|
|
|
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, |
28
|
|
|
* SW2-130, Cupertino, CA 95014, USA. or at email address [email protected]. |
29
|
|
|
* |
30
|
|
|
* The interactive user interfaces in modified source and object code versions |
31
|
|
|
* of this program must display Appropriate Legal Notices, as required under |
32
|
|
|
* Section 5 of the GNU Affero General Public License version 3. |
33
|
|
|
* |
34
|
|
|
* In accordance with Section 7(b) of the GNU Affero General Public License version 3, |
35
|
|
|
* these Appropriate Legal Notices must retain the display of the "Powered by |
36
|
|
|
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not |
37
|
|
|
* reasonably feasible for technical reasons, the Appropriate Legal Notices must |
38
|
|
|
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
39
|
|
|
********************************************************************************/ |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Generic formatter |
43
|
|
|
* @api |
44
|
|
|
*/ |
45
|
|
|
class default_formatter { |
46
|
|
|
|
47
|
|
|
protected $_ss; |
48
|
|
|
protected $_component; |
49
|
|
|
protected $_tplFileName; |
50
|
|
|
protected $_module; |
51
|
|
|
protected $_hoverField; |
52
|
|
|
|
53
|
|
|
public function __construct() {} |
54
|
|
|
|
55
|
|
|
public function getDetailViewFormat() { |
56
|
|
|
$source = $this->_component->getSource(); |
57
|
|
|
$class = get_class($source); |
58
|
|
|
$dir = str_replace('_', '/', $class); |
59
|
|
|
$config = $source->getConfig(); |
60
|
|
|
$this->_ss->assign('config', $config); |
61
|
|
|
$this->_ss->assign('source', $class); |
62
|
|
|
$this->_ss->assign('module', $this->_module); |
63
|
|
|
$mapping = $source->getMapping(); |
64
|
|
|
$mapping = !empty($mapping['beans'][$this->_module]) ? implode(',', array_values($mapping['beans'][$this->_module])) : ''; |
65
|
|
|
$this->_ss->assign('mapping', $mapping); |
66
|
|
|
|
67
|
|
|
if(file_exists("custom/modules/Connectors/connectors/formatters/{$dir}/tpls/{$this->_module}.tpl")) { |
68
|
|
|
return $this->_ss->fetch("custom/modules/Connectors/connectors/formatters/{$dir}/tpls/{$this->_module}.tpl"); |
69
|
|
|
} else if(file_exists("modules/Connectors/connectors/formatters/{$dir}/tpls/{$this->_module}.tpl")) { |
70
|
|
|
return $this->_ss->fetch("modules/Connectors/connectors/formatters/{$dir}/tpls/{$this->_module}.tpl"); |
71
|
|
|
} else if(file_exists("custom/modules/Connectors/connectors/formatters/{$dir}/tpls/default.tpl")) { |
72
|
|
|
return $this->_ss->fetch("custom/modules/Connectors/connectors/formatters/{$dir}/tpls/default.tpl"); |
73
|
|
|
} else if(file_exists("modules/Connectors/connectors/formatters/{$dir}/tpls/default.tpl")) { |
74
|
|
|
return $this->_ss->fetch("modules/Connectors/connectors/formatters/{$dir}/tpls/default.tpl"); |
75
|
|
|
} else if(preg_match('/_soap_/', $class)) { |
76
|
|
|
return $this->_ss->fetch("include/connectors/formatters/ext/soap/tpls/default.tpl"); |
77
|
|
|
} else { |
78
|
|
|
return $this->_ss->fetch("include/connectors/formatters/ext/rest/tpls/default.tpl"); |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
public function getEditViewFormat() { |
83
|
|
|
return ''; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function getListViewFormat() { |
87
|
|
|
return ''; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function getSearchFormFormat() { |
91
|
|
|
return ''; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
protected function fetchSmarty(){ |
95
|
|
|
$source = $this->_component->getSource(); |
96
|
|
|
$class = get_class($source); |
97
|
|
|
$dir = str_replace('_', '/', $class); |
98
|
|
|
$config = $source->getConfig(); |
99
|
|
|
$this->_ss->assign('config', $config); |
100
|
|
|
$this->_ss->assign('source', $class); |
101
|
|
|
$this->_ss->assign('module', $this->_module); |
102
|
|
|
if(file_exists("custom/modules/Connectors/connectors/formatters/{$dir}/tpls/{$this->_module}.tpl")) { |
103
|
|
|
return $this->_ss->fetch("custom/modules/Connectors/connectors/formatters/{$dir}/tpls/{$this->_module}.tpl"); |
104
|
|
|
} else if(file_exists("modules/Connectors/connectors/formatters/{$dir}/tpls/{$this->_module}.tpl")) { |
105
|
|
|
return $this->_ss->fetch("modules/Connectors/connectors/formatters/{$dir}/tpls/{$this->_module}.tpl"); |
106
|
|
|
} else if(file_exists("custom/modules/Connectors/connectors/formatters/{$dir}/tpls/default.tpl")) { |
107
|
|
|
return $this->_ss->fetch("custom/modules/Connectors/connectors/formatters/{$dir}/tpls/default.tpl"); |
108
|
|
|
} else { |
109
|
|
|
return $this->_ss->fetch("modules/Connectors/connectors/formatters/{$dir}/tpls/default.tpl"); |
110
|
|
|
} |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
public function getSourceMapping(){ |
114
|
|
|
$source = $this->_component->getSource(); |
115
|
|
|
$mapping = $source->getMapping(); |
116
|
|
|
return $mapping; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function setSmarty($smarty) { |
120
|
|
|
$this->_ss = $smarty; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
public function getSmarty() { |
124
|
|
|
return $this->_ss; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
public function setComponent($component) { |
128
|
|
|
$this->_component = $component; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
public function getComponent() { |
132
|
|
|
return $this->_component; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
public function getTplFileName(){ |
136
|
|
|
return $this->tplFileName; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
public function setTplFileName($tplFileName){ |
140
|
|
|
$this->tplFileName = $tplFileName; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
public function setModule($module) { |
144
|
|
|
$this->_module = $module; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
public function getModule() { |
148
|
|
|
return $this->_module; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
public function getIconFilePath() { |
152
|
|
|
return ''; |
153
|
|
|
} |
154
|
|
|
} |
155
|
|
|
?> |