|
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 - 2016 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
|
|
|
require_once('include/SubPanel/registered_layout_defs.php'); |
|
42
|
|
|
/** |
|
43
|
|
|
* Subpanel |
|
44
|
|
|
* @api |
|
45
|
|
|
*/ |
|
46
|
|
|
class SubPanel |
|
47
|
|
|
{ |
|
48
|
|
|
var $hideNewButton = false; |
|
49
|
|
|
var $subpanel_id; |
|
50
|
|
|
var $parent_record_id; |
|
51
|
|
|
var $parent_module; // the name of the parent module |
|
52
|
|
|
var $parent_bean; // the instantiated bean of the parent |
|
53
|
|
|
var $template_file; |
|
54
|
|
|
var $linked_fields; |
|
55
|
|
|
var $action = 'DetailView'; |
|
56
|
|
|
var $show_select_button = true; |
|
57
|
|
|
var $subpanel_define = null; // contains the layout_def.php |
|
58
|
|
|
var $subpanel_defs; |
|
59
|
|
|
var $subpanel_query=null; |
|
60
|
|
|
var $layout_def_key=''; |
|
61
|
|
|
var $search_query=''; |
|
62
|
|
|
var $collections = array(); |
|
63
|
|
|
|
|
64
|
|
|
function __construct($module, $record_id, $subpanel_id, $subpanelDef, $layout_def_key='', $collections = array() ) |
|
65
|
|
|
{ |
|
66
|
|
|
global $beanList, $beanFiles, $focus, $app_strings; |
|
67
|
|
|
|
|
68
|
|
|
$this->subpanel_defs=$subpanelDef; |
|
69
|
|
|
$this->subpanel_id = $subpanel_id; |
|
70
|
|
|
$this->parent_record_id = $record_id; |
|
71
|
|
|
$this->parent_module = $module; |
|
72
|
|
|
$this->layout_def_key = $layout_def_key; |
|
73
|
|
|
$this->collections = $collections; |
|
74
|
|
|
|
|
75
|
|
|
$this->parent_bean = $focus; |
|
76
|
|
|
$result = $focus; |
|
77
|
|
|
|
|
78
|
|
|
if(empty($result)) |
|
79
|
|
|
{ |
|
80
|
|
|
$parent_bean_name = $beanList[$module]; |
|
81
|
|
|
$parent_bean_file = $beanFiles[$parent_bean_name]; |
|
82
|
|
|
require_once($parent_bean_file); |
|
83
|
|
|
$this->parent_bean = new $parent_bean_name(); |
|
84
|
|
|
$this->parent_bean->retrieve($this->parent_record_id); |
|
85
|
|
|
$result = $this->parent_bean; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
if($record_id!='fab4' && $result == null) |
|
89
|
|
|
{ |
|
90
|
|
|
sugar_die($app_strings['ERROR_NO_RECORD']); |
|
91
|
|
|
} |
|
92
|
|
|
$this->buildSearchQuery(); |
|
93
|
|
|
if (empty($subpanelDef)) { |
|
94
|
|
|
//load the subpanel by name. |
|
95
|
|
|
if (!class_exists('MyClass')) { |
|
96
|
|
|
require_once 'include/SubPanel/SubPanelDefinitions.php' ; |
|
97
|
|
|
} |
|
98
|
|
|
$panelsdef=new SubPanelDefinitions($result,$layout_def_key); |
|
99
|
|
|
$subpanelDef=$panelsdef->load_subpanel($subpanel_id, false, false, $this->search_query,$collections); |
|
100
|
|
|
$this->subpanel_defs=$subpanelDef; |
|
101
|
|
|
|
|
102
|
|
|
} |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
|
107
|
|
|
*/ |
|
108
|
|
|
function SubPanel($module, $record_id, $subpanel_id, $subpanelDef, $layout_def_key='', $collections = array() ){ |
|
109
|
|
|
$deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
|
110
|
|
|
if(isset($GLOBALS['log'])) { |
|
111
|
|
|
$GLOBALS['log']->deprecated($deprecatedMessage); |
|
112
|
|
|
} |
|
113
|
|
|
else { |
|
114
|
|
|
trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
|
115
|
|
|
} |
|
116
|
|
|
self::__construct($module, $record_id, $subpanel_id, $subpanelDef, $layout_def_key, $collections); |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
function setTemplateFile($template_file) |
|
120
|
|
|
{ |
|
121
|
|
|
$this->template_file = $template_file; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
function setBeanList(&$value){ |
|
125
|
|
|
$this->bean_list =$value; |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
function setHideNewButton($value){ |
|
129
|
|
|
$this->hideNewButton = $value; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
|
|
133
|
|
|
function getHeaderText( $currentModule){ |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
function get_buttons( $panel_query=null) |
|
137
|
|
|
{ |
|
138
|
|
|
|
|
139
|
|
|
$thisPanel =& $this->subpanel_defs; |
|
140
|
|
|
$subpanel_def = $thisPanel->get_buttons(); |
|
141
|
|
|
|
|
142
|
|
|
if(!isset($this->listview)){ |
|
143
|
|
|
$this->listview = new ListView(); |
|
144
|
|
|
} |
|
145
|
|
|
$layout_manager = $this->listview->getLayoutManager(); |
|
146
|
|
|
$widget_contents = '<div><table cellpadding="0" cellspacing="0"><tr>'; |
|
147
|
|
|
foreach($subpanel_def as $widget_data) |
|
148
|
|
|
{ |
|
149
|
|
|
$widget_data['action'] = $_REQUEST['action']; |
|
150
|
|
|
$widget_data['module'] = $thisPanel->get_inst_prop_value('module'); |
|
151
|
|
|
$widget_data['focus'] = $this->parent_bean; |
|
152
|
|
|
$widget_data['subpanel_definition'] = $thisPanel; |
|
153
|
|
|
$widget_contents .= '<td style="padding-right: 2px; padding-bottom: 2px;">' . "\n"; |
|
154
|
|
|
|
|
155
|
|
|
if(empty($widget_data['widget_class'])) |
|
156
|
|
|
{ |
|
157
|
|
|
$widget_contents .= "widget_class not defined for top subpanel buttons"; |
|
158
|
|
|
} |
|
159
|
|
|
else |
|
160
|
|
|
{ |
|
161
|
|
|
$widget_contents .= $layout_manager->widgetDisplay($widget_data); |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
|
|
$widget_contents .= '</td>'; |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
$widget_contents .= '</tr></table></div>'; |
|
168
|
|
|
return $widget_contents; |
|
169
|
|
|
} |
|
170
|
|
|
|
|
171
|
|
|
|
|
172
|
|
|
function ProcessSubPanelListView($xTemplatePath, &$mod_strings) |
|
173
|
|
|
{ |
|
174
|
|
|
global $app_strings; |
|
175
|
|
|
global $current_user; |
|
176
|
|
|
global $sugar_config; |
|
177
|
|
|
|
|
178
|
|
|
if(isset($this->listview)){ |
|
179
|
|
|
$ListView =& $this->listview; |
|
180
|
|
|
}else{ |
|
181
|
|
|
$ListView = new ListView(); |
|
182
|
|
|
} |
|
183
|
|
|
$ListView->initNewXTemplate($xTemplatePath,$this->subpanel_defs->mod_strings); |
|
184
|
|
|
$ListView->xTemplateAssign("RETURN_URL", "&return_module=".$this->parent_module."&return_action=DetailView&return_id=".$this->parent_bean->id); |
|
185
|
|
|
$ListView->xTemplateAssign("RELATED_MODULE", $this->parent_module); // TODO: what about unions? |
|
186
|
|
|
$ListView->xTemplateAssign("RECORD_ID", $this->parent_bean->id); |
|
187
|
|
|
$ListView->xTemplateAssign("EDIT_INLINE_PNG", SugarThemeRegistry::current()->getImage('edit_inline','align="absmiddle" border="0"',null,null,'.gif',$app_strings['LNK_EDIT'])); |
|
188
|
|
|
$ListView->xTemplateAssign("DELETE_INLINE_PNG", SugarThemeRegistry::current()->getImage('delete_inline','align="absmiddle" border="0"',null,null,'.gif',$app_strings['LBL_DELETE_INLINE'])); |
|
189
|
|
|
$ListView->xTemplateAssign("REMOVE_INLINE_PNG", SugarThemeRegistry::current()->getImage('delete_inline','align="absmiddle" border="0"',null,null,'.gif',$app_strings['LBL_ID_FF_REMOVE'])); |
|
190
|
|
|
$header_text= ''; |
|
191
|
|
|
|
|
192
|
|
|
$ListView->xTemplateAssign("SUBPANEL_ID", $this->subpanel_id); |
|
193
|
|
|
$ListView->xTemplateAssign("SUBPANEL_SEARCH", $this->getSearchForm()); |
|
194
|
|
|
$display_sps = ''; |
|
195
|
|
|
if($this->search_query == '' && empty($this->collections)) $display_sps = 'display:none'; |
|
196
|
|
|
$ListView->xTemplateAssign("DISPLAY_SPS",$display_sps); |
|
197
|
|
|
|
|
198
|
|
|
if(is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])) |
|
199
|
|
|
{ |
|
200
|
|
|
$exploded = explode('/', $xTemplatePath); |
|
201
|
|
|
$file_name = $exploded[sizeof($exploded) - 1]; |
|
202
|
|
|
$mod_name = $exploded[sizeof($exploded) - 2]; |
|
203
|
|
|
$header_text= " <a href='index.php?action=index&module=DynamicLayout&from_action=$file_name&from_module=$mod_name&mod_lang=" |
|
204
|
|
|
.$_REQUEST['module']."'>".SugarThemeRegistry::current()->getImage("EditLayout","border='0' align='bottom'",null,null,'.gif','Edit Layout')."</a>"; |
|
205
|
|
|
} |
|
206
|
|
|
$ListView->setHeaderTitle(''); |
|
207
|
|
|
$ListView->setHeaderText(''); |
|
208
|
|
|
|
|
209
|
|
|
ob_start(); |
|
210
|
|
|
|
|
211
|
|
|
$ListView->is_dynamic = true; |
|
212
|
|
|
$ListView->records_per_page = $sugar_config['list_max_entries_per_subpanel'] + 0; |
|
213
|
|
|
if (isset($this->subpanel_defs->_instance_properties['records_per_page'])) { |
|
214
|
|
|
$ListView->records_per_page = $this->subpanel_defs->_instance_properties['records_per_page'] + 0; |
|
215
|
|
|
} |
|
216
|
|
|
$ListView->start_link_wrapper = "javascript:showSubPanel('".$this->subpanel_id."','"; |
|
217
|
|
|
$ListView->subpanel_id = $this->subpanel_id; |
|
218
|
|
|
$ListView->end_link_wrapper = "',true);"; |
|
219
|
|
|
if ( !empty($this->layout_def_key) ) { |
|
220
|
|
|
$ListView->end_link_wrapper = '&layout_def_key='.$this->layout_def_key.$ListView->end_link_wrapper; |
|
221
|
|
|
} |
|
222
|
|
|
|
|
223
|
|
|
$where = ''; |
|
224
|
|
|
$ListView->setQuery($where, '', '', ''); |
|
225
|
|
|
$ListView->show_export_button = false; |
|
226
|
|
|
|
|
227
|
|
|
//function returns the query that was used to populate sub-panel data. |
|
228
|
|
|
|
|
229
|
|
|
$query=$ListView->process_dynamic_listview($this->parent_module, $this->parent_bean,$this->subpanel_defs); |
|
230
|
|
|
$this->subpanel_query=$query; |
|
231
|
|
|
$ob_contents = ob_get_contents(); |
|
232
|
|
|
ob_end_clean(); |
|
233
|
|
|
return $ob_contents; |
|
234
|
|
|
} |
|
235
|
|
|
|
|
236
|
|
|
function display() |
|
237
|
|
|
{ |
|
238
|
|
|
$result_array = array(); |
|
239
|
|
|
|
|
240
|
|
|
$return_string = $this->ProcessSubPanelListView($this->template_file,$result_array); |
|
241
|
|
|
|
|
242
|
|
|
print $return_string; |
|
243
|
|
|
} |
|
244
|
|
|
|
|
245
|
|
|
function getModulesWithSubpanels() |
|
246
|
|
|
{ |
|
247
|
|
|
global $beanList; |
|
248
|
|
|
$dir = dir('modules'); |
|
249
|
|
|
$modules = array(); |
|
250
|
|
|
while($entry = $dir->read()) |
|
251
|
|
|
{ |
|
252
|
|
|
if(file_exists('modules/' . $entry . '/layout_defs.php')) |
|
253
|
|
|
{ |
|
254
|
|
|
$modules[$entry] = $entry; |
|
255
|
|
|
} |
|
256
|
|
|
} |
|
257
|
|
|
return $modules; |
|
258
|
|
|
} |
|
259
|
|
|
|
|
260
|
|
|
static function getModuleSubpanels($module){ |
|
261
|
|
|
require_once('include/SubPanel/SubPanelDefinitions.php'); |
|
262
|
|
|
global $beanList, $beanFiles; |
|
263
|
|
|
if(!isset($beanList[$module])){ |
|
264
|
|
|
return array(); |
|
265
|
|
|
} |
|
266
|
|
|
|
|
267
|
|
|
$class = $beanList[$module]; |
|
268
|
|
|
require_once($beanFiles[$class]); |
|
269
|
|
|
$mod = new $class(); |
|
270
|
|
|
$spd = new SubPanelDefinitions($mod); |
|
271
|
|
|
$tabs = $spd->get_available_tabs(true); |
|
272
|
|
|
$ret_tabs = array(); |
|
273
|
|
|
$reject_tabs = array('history'=>1, 'activities'=>1); |
|
274
|
|
|
foreach($tabs as $key=>$tab){ |
|
275
|
|
|
foreach($tab as $k=>$v){ |
|
276
|
|
|
if (! isset ( $reject_tabs [$k] )) { |
|
277
|
|
|
$ret_tabs [$k] = $v; |
|
278
|
|
|
} |
|
279
|
|
|
} |
|
280
|
|
|
} |
|
281
|
|
|
|
|
282
|
|
|
return $ret_tabs; |
|
283
|
|
|
|
|
284
|
|
|
|
|
285
|
|
|
} |
|
286
|
|
|
|
|
287
|
|
|
//saves overrides for defs |
|
288
|
|
|
function saveSubPanelDefOverride( $panel, $subsection, $override){ |
|
289
|
|
|
global $layout_defs, $beanList; |
|
290
|
|
|
|
|
291
|
|
|
//save the new subpanel |
|
292
|
|
|
$name = "subpanel_layout['list_fields']"; |
|
293
|
|
|
|
|
294
|
|
|
//bugfix: load looks for moduleName/metadata/subpanels, not moduleName/subpanels |
|
295
|
|
|
$path = 'custom/modules/'. $panel->_instance_properties['module'] . '/metadata/subpanels'; |
|
296
|
|
|
|
|
297
|
|
|
//bug# 40171: "Custom subpanels not working as expected" |
|
298
|
|
|
//each custom subpanel needs to have a unique custom def file |
|
299
|
|
|
$filename = $panel->parent_bean->object_name . "_subpanel_" . $panel->name; //bug 42262 (filename with $panel->_instance_properties['get_subpanel_data'] can create problem if had word "function" in it) |
|
300
|
|
|
$oldName1 = '_override' . $panel->parent_bean->object_name .$panel->_instance_properties['module'] . $panel->_instance_properties['subpanel_name'] ; |
|
301
|
|
|
$oldName2 = '_override' . $panel->parent_bean->object_name .$panel->_instance_properties['get_subpanel_data'] ; |
|
302
|
|
|
if (file_exists('custom/Extension/modules/'. $panel->parent_bean->module_dir . "/Ext/Layoutdefs/$oldName1.php")){ |
|
303
|
|
|
unlink('custom/Extension/modules/'. $panel->parent_bean->module_dir . "/Ext/Layoutdefs/$oldName1.php"); |
|
304
|
|
|
} |
|
305
|
|
|
if (file_exists('custom/Extension/modules/'. $panel->parent_bean->module_dir . "/Ext/Layoutdefs/$oldName2.php")){ |
|
306
|
|
|
unlink('custom/Extension/modules/'. $panel->parent_bean->module_dir . "/Ext/Layoutdefs/$oldName2.php"); |
|
307
|
|
|
} |
|
308
|
|
|
$extname = '_override'.$filename; |
|
309
|
|
|
//end of bug# 40171 |
|
310
|
|
|
|
|
311
|
|
|
mkdir_recursive($path, true); |
|
312
|
|
|
write_array_to_file( $name, $override,$path.'/' . $filename .'.php'); |
|
313
|
|
|
|
|
314
|
|
|
//save the override for the layoutdef |
|
315
|
|
|
//tyoung 10.12.07 pushed panel->name to lowercase to match case in subpaneldefs.php files - |
|
316
|
|
|
//gave error on bad index 'module' as this override key didn't match the key in the subpaneldefs |
|
317
|
|
|
$name = "layout_defs['". $panel->parent_bean->module_dir. "']['subpanel_setup']['" .strtolower($panel->name). "']"; |
|
318
|
|
|
// $GLOBALS['log']->debug('SubPanel.php->saveSubPanelDefOverride(): '.$name); |
|
319
|
|
|
$newValue = override_value_to_string($name, 'override_subpanel_name', $filename); |
|
320
|
|
|
mkdir_recursive('custom/Extension/modules/'. $panel->parent_bean->module_dir . '/Ext/Layoutdefs', true); |
|
321
|
|
|
$fp = sugar_fopen('custom/Extension/modules/'. $panel->parent_bean->module_dir . "/Ext/Layoutdefs/$extname.php", 'w'); |
|
322
|
|
|
fwrite($fp, "<?php\n//auto-generated file DO NOT EDIT\n$newValue\n?>"); |
|
323
|
|
|
fclose($fp); |
|
324
|
|
|
require_once('ModuleInstall/ModuleInstaller.php'); |
|
325
|
|
|
$moduleInstaller = new ModuleInstaller(); |
|
326
|
|
|
$moduleInstaller->silent = true; // make sure that the ModuleInstaller->log() function doesn't echo while rebuilding the layoutdefs |
|
327
|
|
|
$moduleInstaller->rebuild_layoutdefs(); |
|
|
|
|
|
|
328
|
|
|
if (file_exists('modules/'. $panel->parent_bean->module_dir . '/layout_defs.php')) |
|
329
|
|
|
include('modules/'. $panel->parent_bean->module_dir . '/layout_defs.php'); |
|
330
|
|
|
if (file_exists('custom/modules/'. $panel->parent_bean->module_dir . '/Ext/Layoutdefs/layoutdefs.ext.php')) |
|
331
|
|
|
include('custom/modules/'. $panel->parent_bean->module_dir . '/Ext/Layoutdefs/layoutdefs.ext.php'); |
|
332
|
|
|
} |
|
333
|
|
|
|
|
334
|
|
|
function get_subpanel_setup($module) |
|
335
|
|
|
{ |
|
336
|
|
|
$subpanel_setup = ''; |
|
337
|
|
|
$layout_defs = get_layout_defs(); |
|
338
|
|
|
|
|
339
|
|
|
if(!empty($layout_defs) && !empty($layout_defs[$module]['subpanel_setup'])) |
|
340
|
|
|
{ |
|
341
|
|
|
$subpanel_setup = $layout_defs[$module]['subpanel_setup']; |
|
342
|
|
|
} |
|
343
|
|
|
|
|
344
|
|
|
return $subpanel_setup; |
|
345
|
|
|
} |
|
346
|
|
|
|
|
347
|
|
|
/** |
|
348
|
|
|
* Retrieve the subpanel definition from the registered layout_defs arrays. |
|
349
|
|
|
*/ |
|
350
|
|
|
function getSubPanelDefine($module, $subpanel_id) |
|
351
|
|
|
{ |
|
352
|
|
|
$default_subpanel_define = SubPanel::_get_default_subpanel_define($module, $subpanel_id); |
|
353
|
|
|
$custom_subpanel_define = SubPanel::_get_custom_subpanel_define($module, $subpanel_id); |
|
354
|
|
|
|
|
355
|
|
|
$subpanel_define = array_merge($default_subpanel_define, $custom_subpanel_define); |
|
356
|
|
|
|
|
357
|
|
|
if(empty($subpanel_define)) |
|
358
|
|
|
{ |
|
359
|
|
|
print('Could not load subpanel definition for: ' . $subpanel_id); |
|
360
|
|
|
} |
|
361
|
|
|
|
|
362
|
|
|
return $subpanel_define; |
|
363
|
|
|
} |
|
364
|
|
|
|
|
365
|
|
|
function _get_custom_subpanel_define($module, $subpanel_id) |
|
366
|
|
|
{ |
|
367
|
|
|
$ret_val = array(); |
|
368
|
|
|
|
|
369
|
|
|
if($subpanel_id != '') |
|
370
|
|
|
{ |
|
371
|
|
|
$layout_defs = get_layout_defs(); |
|
372
|
|
|
|
|
373
|
|
|
if(!empty($layout_defs[$module]['custom_subpanel_defines'][$subpanel_id])) |
|
374
|
|
|
{ |
|
375
|
|
|
$ret_val = $layout_defs[$module]['custom_subpanel_defines'][$subpanel_id]; |
|
376
|
|
|
} |
|
377
|
|
|
} |
|
378
|
|
|
|
|
379
|
|
|
return $ret_val; |
|
380
|
|
|
} |
|
381
|
|
|
|
|
382
|
|
|
function _get_default_subpanel_define($module, $subpanel_id) |
|
383
|
|
|
{ |
|
384
|
|
|
$ret_val = array(); |
|
385
|
|
|
|
|
386
|
|
|
if($subpanel_id != '') |
|
387
|
|
|
{ |
|
388
|
|
|
$layout_defs = get_layout_defs(); |
|
389
|
|
|
|
|
390
|
|
|
if(!empty($layout_defs[$subpanel_id]['default_subpanel_define'])) |
|
391
|
|
|
{ |
|
392
|
|
|
$ret_val = $layout_defs[$subpanel_id]['default_subpanel_define']; |
|
393
|
|
|
} |
|
394
|
|
|
} |
|
395
|
|
|
|
|
396
|
|
|
return $ret_val; |
|
397
|
|
|
} |
|
398
|
|
|
|
|
399
|
|
|
function buildSearchQuery() |
|
400
|
|
|
{ |
|
401
|
|
|
require_once('include/SubPanel/SubPanelSearchForm.php'); |
|
402
|
|
|
|
|
403
|
|
|
$module = 'Meetings'; |
|
404
|
|
|
|
|
405
|
|
|
$seed = new Meeting(); |
|
406
|
|
|
|
|
407
|
|
|
$_REQUEST['searchFormTab'] = 'basic_search'; |
|
408
|
|
|
$searchForm = new SubPanelSearchForm($seed, $module, $this); |
|
409
|
|
|
|
|
410
|
|
|
$searchMetaData = $searchForm->retrieveSearchDefs($module); |
|
|
|
|
|
|
411
|
|
|
$searchForm->setup($searchMetaData['searchdefs'], $searchMetaData['searchFields'], 'SubpanelSearchFormGeneric.tpl', 'basic_search'); |
|
|
|
|
|
|
412
|
|
|
|
|
413
|
|
|
$searchForm->populateFromRequest(); |
|
414
|
|
|
|
|
415
|
|
|
$where_clauses = $searchForm->generateSearchWhere(true, $seed->module_dir); |
|
416
|
|
|
|
|
417
|
|
|
if (count($where_clauses) > 0 )$this->search_query = '('. implode(' ) AND ( ', $where_clauses) . ')'; |
|
418
|
|
|
$GLOBALS['log']->info("Subpanel Where Clause: $this->search_query"); |
|
419
|
|
|
|
|
420
|
|
|
return print_r($where_clauses,true); |
|
421
|
|
|
} |
|
422
|
|
|
|
|
423
|
|
|
function get_searchdefs($module) |
|
424
|
|
|
{ |
|
425
|
|
|
$thisPanel =& $this->subpanel_defs; |
|
426
|
|
|
$subpanel_defs = $thisPanel->_instance_properties; |
|
427
|
|
|
|
|
428
|
|
|
if(isset($subpanel_defs['searchdefs'])){ |
|
429
|
|
|
$searchdefs[$module]['layout']['basic_search'] = $subpanel_defs['searchdefs']; |
|
430
|
|
|
$searchdefs[$module]['templateMeta'] = Array ('maxColumns' => 3, 'maxColumnsBasic' => 4, 'widths' => Array ( 'label' => 10, 'field' => 30 )) ; |
|
431
|
|
|
return $searchdefs; |
|
432
|
|
|
} |
|
433
|
|
|
|
|
434
|
|
|
return false; |
|
435
|
|
|
} |
|
436
|
|
|
|
|
437
|
|
|
function getSearchForm() |
|
438
|
|
|
{ |
|
439
|
|
|
require_once('include/SubPanel/SubPanelSearchForm.php'); |
|
440
|
|
|
|
|
441
|
|
|
$module = 'Meetings'; |
|
442
|
|
|
|
|
443
|
|
|
$seed = new Meeting(); |
|
444
|
|
|
|
|
445
|
|
|
$searchForm = new SubPanelSearchForm($seed, $module, $this); |
|
446
|
|
|
|
|
447
|
|
|
$searchMetaData = $searchForm->retrieveSearchDefs($module); |
|
|
|
|
|
|
448
|
|
|
|
|
449
|
|
|
if ($subpanel_searchMetaData = $this->get_searchdefs($module)){ |
|
450
|
|
|
|
|
451
|
|
|
$searchForm->setup($subpanel_searchMetaData, $searchMetaData['searchFields'], 'SubpanelSearchFormGeneric.tpl', 'basic_search'); |
|
|
|
|
|
|
452
|
|
|
|
|
453
|
|
|
if(!empty($this->collections)) |
|
454
|
|
|
$searchForm->searchFields['collection'] = array(); |
|
455
|
|
|
|
|
456
|
|
|
$searchForm->populateFromRequest(); |
|
457
|
|
|
|
|
458
|
|
|
return $searchForm->display(); |
|
459
|
|
|
} |
|
460
|
|
|
|
|
461
|
|
|
return ''; |
|
462
|
|
|
} |
|
463
|
|
|
} |
|
464
|
|
|
?> |
|
465
|
|
|
|
If you implement
__calland you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__callis implemented by a parent class and only the child class knows which methods exist: