]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/Popups/PopupSmarty.php
Release 6.2.3
[Github/sugarcrm.git] / include / Popups / PopupSmarty.php
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-2011 SugarCRM Inc.
6  * 
7  * This program is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Affero General Public License version 3 as published by the
9  * Free Software Foundation with the addition of the following permission added
10  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13  * 
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
17  * details.
18  * 
19  * You should have received a copy of the GNU Affero General Public License along with
20  * this program; if not, see http://www.gnu.org/licenses or write to the Free
21  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22  * 02110-1301 USA.
23  * 
24  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26  * 
27  * The interactive user interfaces in modified source and object code versions
28  * of this program must display Appropriate Legal Notices, as required under
29  * Section 5 of the GNU Affero General Public License version 3.
30  * 
31  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32  * these Appropriate Legal Notices must retain the display of the "Powered by
33  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34  * technical reasons, the Appropriate Legal Notices must display the words
35  * "Powered by SugarCRM".
36  ********************************************************************************/
37
38 require_once('include/ListView/ListViewSmarty.php'); 
39
40 require_once('include/TemplateHandler/TemplateHandler.php');
41 require_once('include/SearchForm/SearchForm2.php');
42 define("NUM_COLS", 2);
43 class PopupSmarty extends ListViewSmarty{
44         
45         var $contextMenus = false;
46         var $export = false;
47         var $mailmerge = false;
48         var $mergeduplicates = false;
49         var $quickViewLinks = false;
50         var $multiSelect = false;
51         var $headerTpl;
52     var $footerTpl;
53     var $th;
54     var $tpl;
55     var $view;
56     var $field_defs;
57     var $formData;
58     var $_popupMeta;
59     var $_create = false;
60     var $searchdefs = array();
61     var $listviewdefs = array();
62     var $searchFields = array();
63     var $customFieldDefs;
64     var $filter_fields = array();
65     //rrs
66     var $searchForm;
67     var $module;
68     var $massUpdateData = '';
69         
70         function PopupSmarty($seed, $module){
71                 parent::ListViewSmarty();
72                 $this->th = new TemplateHandler();
73                 $this->th->loadSmarty();
74                 $this->seed = $seed;
75                 $this->view = 'Popup';
76                 $this->module = $module;
77                 $this->searchForm = new SearchForm($this->seed, $this->module);
78                 $this->th->deleteTemplate($module, $this->view); 
79                         
80         }
81         
82         /**
83      * Processes the request. Calls ListViewData process. Also assigns all lang strings, export links,
84      * This is called from ListViewDisplay
85      *    
86      * @param file file Template file to use
87      * @param data array from ListViewData
88      * @param html_var string the corresponding html var in xtpl per row
89      *
90      */ 
91         function process($file, $data, $htmlVar) {
92
93                 global $odd_bg, $even_bg, $hilite_bg, $click_bg, $app_strings;
94                 parent::process($file, $data, $htmlVar);
95                 
96                 $this->tpl = $file;
97                 $this->data = $data;
98                 
99         $totalWidth = 0;
100         foreach($this->displayColumns as $name => $params) {
101             $totalWidth += $params['width'];
102         }
103         $adjustment = $totalWidth / 100;
104
105         $contextMenuObjectsTypes = array();
106         foreach($this->displayColumns as $name => $params) {
107             $this->displayColumns[$name]['width'] = round($this->displayColumns[$name]['width'] / $adjustment, 2);
108             // figure out which contextMenu objectsTypes are required
109             if(!empty($params['contextMenu']['objectType'])) 
110                 $contextMenuObjectsTypes[$params['contextMenu']['objectType']] = true;
111         }
112                 $this->th->ss->assign('displayColumns', $this->displayColumns);
113         
114        
115                 $this->th->ss->assign('bgHilite', $hilite_bg);
116                 $this->th->ss->assign('colCount', count($this->displayColumns) + 1);
117                 $this->th->ss->assign('htmlVar', strtoupper($htmlVar));
118                 $this->th->ss->assign('moduleString', $this->moduleString);
119         $this->th->ss->assign('editLinkString', $GLOBALS['app_strings']['LBL_EDIT_BUTTON']);
120         $this->th->ss->assign('viewLinkString', $GLOBALS['app_strings']['LBL_VIEW_BUTTON']);
121         
122         //rrs
123         $this->searchForm->parsedView = 'popup_query_form';
124         $this->searchForm->displayType = 'popupView';
125                 $this->th->ss->assign('searchForm', $this->searchForm->display(false));
126         //rrs
127
128                 if($this->overlib) $this->th->ss->assign('overlib', true);
129                 if($this->export) $this->th->ss->assign('exportLink', $this->buildExportLink());
130                 $this->th->ss->assign('quickViewLinks', $this->quickViewLinks);
131                 if($this->mailMerge) $this->th->ss->assign('mergeLink', $this->buildMergeLink()); // still check for mailmerge access
132                 if($this->mergeduplicates) $this->th->ss->assign('mergedupLink', $this->buildMergeDuplicatesLink());
133         
134
135                 if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') {
136                         $this->multiSelect = true;
137                 }
138                 // handle save checks and stuff
139                 if($this->multiSelect) {
140                         $this->th->ss->assign('selectedObjectsSpan', $this->buildSelectedObjectsSpan());
141                         $this->th->ss->assign('multiSelectData', $this->getMultiSelectData());
142                         $this->th->ss->assign('MODE', "<input type='hidden' name='mode' value='MultiSelect'>");
143             $pageTotal = $this->data['pageData']['offsets']['next'] - $this->data['pageData']['offsets']['current'];
144             if($this->data['pageData']['offsets']['next'] < 0){ // If we are on the last page, 'next' is -1, which means we have to have a custom calculation
145                 $pageTotal = $this->data['pageData']['offsets']['total'] - $this->data['pageData']['offsets']['current'];
146             }
147                 $this->th->ss->assign('selectLink', $this->buildSelectLink('select_link', $this->data['pageData']['offsets']['total'], $pageTotal));
148                 }
149                 
150                 $this->processArrows($data['pageData']['ordering']);
151                 $this->th->ss->assign('prerow', $this->multiSelect);
152                 $this->th->ss->assign('rowColor', array('oddListRow', 'evenListRow'));
153                 $this->th->ss->assign('bgColor', array($odd_bg, $even_bg));
154         $this->th->ss->assign('contextMenus', $this->contextMenus);
155         
156
157         if($this->contextMenus && !empty($contextMenuObjectsTypes)) {
158             $script = '';
159             $cm = new contextMenu();
160             foreach($contextMenuObjectsTypes as $type => $value) {
161                 $cm->loadFromFile($type);
162                 $script .= $cm->getScript();
163                 $cm->menuItems = array(); // clear menuItems out
164             }
165             $this->th->ss->assign('contextMenuScript', $script);
166         }
167         
168         //rrs
169         $this->_build_field_defs();
170         }
171         
172         /*
173          * Display the Smarty template.  Here we are using the TemplateHandler for caching per the module.
174          */
175         function display($end = true) {
176         global $app_strings;
177               
178         if(!is_file($GLOBALS['sugar_config']['cache_dir'] . 'jsLanguage/' . $GLOBALS['current_language'] . '.js')) {
179             require_once('include/language/jsLanguage.php');
180             jsLanguage::createAppStringsCache($GLOBALS['current_language']);
181         }
182         $jsLang = '<script type="text/javascript" src="' . $GLOBALS['sugar_config']['cache_dir'] . 'jsLanguage/' . $GLOBALS['current_language'] . '.js?s=' . $GLOBALS['sugar_version'] . '&c=' . $GLOBALS['sugar_config']['js_custom_version'] . '&j=' . $GLOBALS['sugar_config']['js_lang_version'] . '"></script>';
183         
184         $this->th->ss->assign('data', $this->data['data']);
185                 $this->data['pageData']['offsets']['lastOffsetOnPage'] = $this->data['pageData']['offsets']['current'] + count($this->data['data']);
186                 $this->th->ss->assign('pageData', $this->data['pageData']);
187         
188         $navStrings = array('next' => $GLOBALS['app_strings']['LNK_LIST_NEXT'],
189                             'previous' => $GLOBALS['app_strings']['LNK_LIST_PREVIOUS'],
190                             'end' => $GLOBALS['app_strings']['LNK_LIST_END'],
191                             'start' => $GLOBALS['app_strings']['LNK_LIST_START'],
192                             'of' => $GLOBALS['app_strings']['LBL_LIST_OF']);
193         $this->th->ss->assign('navStrings', $navStrings);
194                 
195                 
196                 $associated_row_data = array();
197                 
198                 //C.L. - Bug 44324 - Override the NAME entry to not display salutation so that the data returned from the popup can be searched on correctly
199                 $searchNameOverride = !empty($this->seed) && $this->seed instanceof Person && (isset($this->data['data'][0]['FIRST_NAME']) && isset($this->data['data'][0]['LAST_NAME'])) ? true : false;
200                 
201                 global $locale;
202                 foreach($this->data['data'] as $val)
203                 {
204                         $associated_row_data[$val['ID']] = $val;
205                         if($searchNameOverride)
206                         {
207                            $associated_row_data[$val['ID']]['NAME'] = $locale->getLocaleFormattedName($val['FIRST_NAME'], $val['LAST_NAME']);
208                         }
209                 }
210                 $is_show_fullname = showFullName() ? 1 : 0;
211                 $json = getJSONobj();
212                 $this->th->ss->assign('jsLang', $jsLang);
213                 $this->th->ss->assign('lang', substr($GLOBALS['current_language'], 0, 2));
214                 $this->th->ss->assign('headerTpl', 'include/Popups/tpls/header.tpl');
215         $this->th->ss->assign('footerTpl', 'include/Popups/tpls/footer.tpl');
216         $this->th->ss->assign('ASSOCIATED_JAVASCRIPT_DATA', 'var associated_javascript_data = '.$json->encode($associated_row_data). '; var is_show_fullname = '.$is_show_fullname.';');
217                 $this->th->ss->assign('module', $this->seed->module_dir);
218                 $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
219                 $this->th->ss->assign('request_data', $request_data);
220                 $this->th->ss->assign('fields', $this->fieldDefs);
221                 $this->th->ss->assign('formData', $this->formData);
222                 $this->th->ss->assign('APP', $GLOBALS['app_strings']);
223                 $this->th->ss->assign('MOD', $GLOBALS['mod_strings']);
224                 $this->th->ss->assign('popupMeta', $this->_popupMeta);
225         $this->th->ss->assign('current_query', base64_encode(serialize($_REQUEST)));
226                 $this->th->ss->assign('customFields', $this->customFieldDefs);
227                 $this->th->ss->assign('numCols', NUM_COLS);
228                 $this->th->ss->assign('massUpdateData', $this->massUpdateData);
229                 $this->th->ss->assign('jsCustomVersion', $GLOBALS['sugar_config']['js_custom_version']);
230                 $this->th->ss->assign('sugarVersion', $GLOBALS['sugar_version']);
231         $this->th->ss->assign('should_process', $this->should_process);
232                 
233                 if($this->_create){
234                         $this->th->ss->assign('ADDFORM', $this->getQuickCreate());//$this->_getAddForm());
235                         $this->th->ss->assign('ADDFORMHEADER', $this->_getAddFormHeader());
236                         $this->th->ss->assign('object_name', $this->seed->object_name);
237                 }
238                 $this->th->ss->assign('LIST_HEADER', get_form_header($GLOBALS['mod_strings']['LBL_LIST_FORM_TITLE'], '', false));
239                 $this->th->ss->assign('SEARCH_FORM_HEADER', get_form_header($GLOBALS['mod_strings']['LBL_SEARCH_FORM_TITLE'], '', false));
240                 $str = $this->th->displayTemplate($this->seed->module_dir, $this->view, $this->tpl);
241                 return $str;
242         }
243         
244         /*
245          * Setup up the smarty template. we added an extra step here to add the order by from the popupdefs.
246          */
247         function setup($file) {
248
249             if(isset($this->_popupMeta)){
250                         if(isset($this->_popupMeta['create']['formBase'])) {
251                                 require_once('modules/' . $this->seed->module_dir . '/' . $this->_popupMeta['create']['formBase']);
252                                 $this->_create = true;
253                         }
254                 }
255             if(!empty($this->_popupMeta['create'])){
256                         $formBase = new $this->_popupMeta['create']['formBaseClass']();
257                         if(isset($_REQUEST['doAction']) && $_REQUEST['doAction'] == 'save')
258                         {
259                                 //If it's a new record, set useRequired to false
260                                 $useRequired = empty($_REQUEST['id']) ? false : true;
261                                 $formBase->handleSave('', false, $useRequired);
262                         }
263                 }
264             
265                 $params = array();
266                 if(!empty($this->_popupMeta['orderBy'])){
267                         $params['orderBy'] = $this->_popupMeta['orderBy'];
268                 }
269
270                 if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){
271                         require('custom/modules/'.$this->module.'/metadata/metafiles.php');     
272                 }elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){
273                         require('modules/'.$this->module.'/metadata/metafiles.php');
274                 }
275
276                 if(!empty($metafiles[$this->module]['searchfields'])) {
277                         require($metafiles[$this->module]['searchfields']);
278                 } elseif(file_exists('modules/'.$this->module.'/metadata/SearchFields.php')) {
279                         require('modules/'.$this->module.'/metadata/SearchFields.php');
280             }
281         $this->searchdefs[$this->module]['templateMeta']['maxColumns'] = 2;
282         $this->searchdefs[$this->module]['templateMeta']['widths']['label'] = 10;
283         $this->searchdefs[$this->module]['templateMeta']['widths']['field'] = 30;
284
285         $this->searchForm->view = 'PopupSearchForm';
286                 $this->searchForm->setup($this->searchdefs, $searchFields, 'include/SearchForm/tpls/SearchFormGenericAdvanced.tpl', 'advanced_search', $this->listviewdefs);
287                 
288                 $lv = new ListViewSmarty();
289                 $displayColumns = array();
290                 if(!empty($_REQUEST['displayColumns'])) {
291                     foreach(explode('|', $_REQUEST['displayColumns']) as $num => $col) {
292                         if(!empty($listViewDefs[$this->module][$col])) 
293                             $displayColumns[$col] = $this->listviewdefs[$this->module][$col];
294                     }    
295                 }
296                 else {
297                     foreach($this->listviewdefs[$this->module] as $col => $para) {
298                         if(!empty($para['default']) && $para['default'])
299                             $displayColumns[$col] = $para;
300                     }
301                 } 
302                 $params['massupdate'] = true;
303                 if(!empty($_REQUEST['orderBy'])) {
304                     $params['orderBy'] = $_REQUEST['orderBy'];
305                     $params['overrideOrder'] = true;
306                     if(!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder'];
307                 }
308                 
309                 $lv->displayColumns = $displayColumns;
310         $this->searchForm->lv = $lv;
311         $this->searchForm->displaySavedSearch = false;
312
313         
314         $this->searchForm->populateFromRequest('advanced_search');
315         $searchWhere = $this->_get_where_clause();
316         $this->searchColumns = $this->searchForm->searchColumns;
317         //parent::setup($this->seed, $file, $searchWhere, $params, 0, -1, $this->filter_fields);
318
319         $this->should_process = true;
320         
321         if(isset($params['export'])) {
322           $this->export = $params['export'];
323         }
324         if(!empty($params['multiSelectPopup'])) {
325                   $this->multi_select_popup = $params['multiSelectPopup'];
326         }
327                 if(!empty($params['massupdate']) && $params['massupdate'] != false) {
328                         $this->show_mass_update_form = true;
329                         $this->mass = new MassUpdate();
330                         $this->mass->setSugarBean($this->seed);
331                         if(!empty($params['handleMassupdate']) || !isset($params['handleMassupdate'])) {
332                 $this->mass->handleMassUpdate();
333             }
334                 }
335
336         // create filter fields based off of display columns
337         if(empty($this->filter_fields) || $this->mergeDisplayColumns) {
338             foreach($this->displayColumns as $columnName => $def) {
339                $this->filter_fields[strtolower($columnName)] = true;
340                if(!empty($def['related_fields'])) {
341                     foreach($def['related_fields'] as $field) {
342                         //id column is added by query construction function. This addition creates duplicates
343                         //and causes issues in oracle. #10165
344                         if ($field != 'id') {
345                             $this->filter_fields[$field] = true;
346                         }
347                     }
348                 }
349                 if (!empty($this->seed->field_defs[strtolower($columnName)]['db_concat_fields'])) {
350                         foreach($this->seed->field_defs[strtolower($columnName)]['db_concat_fields'] as $index=>$field){
351                             if(!isset($this->filter_fields[strtolower($field)]) || !$this->filter_fields[strtolower($field)])
352                             {
353                                 $this->filter_fields[strtolower($field)] = true;
354                             }
355                         }
356                 }
357             }
358             foreach ($this->searchColumns as $columnName => $def )
359             {
360                 $this->filter_fields[strtolower($columnName)] = true;
361             }
362         }
363         
364
365                 if (!empty($_REQUEST['query']) || (!empty($GLOBALS['sugar_config']['save_query']) && $GLOBALS['sugar_config']['save_query'] != 'populate_only')) {
366                         $data = $this->lvd->getListViewData($this->seed, $searchWhere, 0, -1, $this->filter_fields, $params, 'id');
367                 } else {
368                         $this->should_process = false;
369                         $data = array(
370                                 'data'=>array(),
371                             'pageData'=>array(
372                                 'bean'=>array('moduleDir'=>$this->seed->module_dir),
373                                         'ordering'=>'',
374                                         'offsets'=>array('total'=>0,'next'=>0,'current'=>0),
375                                 ),
376                         );
377                 }
378                 
379                 foreach($this->displayColumns as $columnName => $def)
380                 {
381                         $seedName =  strtolower($columnName);
382                         
383                         if(empty($this->displayColumns[$columnName]['type'])){
384                                 if(!empty($this->lvd->seed->field_defs[$seedName]['type'])){
385                                         $seedDef = $this->lvd->seed->field_defs[$seedName];
386                             $this->displayColumns[$columnName]['type'] = (!empty($seedDef['custom_type']))?$seedDef['custom_type']:$seedDef['type'];
387                         }else{
388                                 $this->displayColumns[$columnName]['type'] = '';
389                         }
390                         }//fi empty(...)
391                         
392                         if(!empty($this->lvd->seed->field_defs[$seedName]['options'])){
393                                         $this->displayColumns[$columnName]['options'] = $this->lvd->seed->field_defs[$seedName]['options'];
394                         }
395
396                 //C.L. Fix for 11177
397                 if($this->displayColumns[$columnName]['type'] == 'html') {
398                     $cField = $this->seed->custom_fields;
399                        if(isset($cField) && isset($cField->bean->$seedName)) {
400                                 $seedName2 = strtoupper($columnName);
401                                 $htmlDisplay = html_entity_decode($cField->bean->$seedName);
402                                 $count = 0;
403                                 while($count < count($data['data'])) {
404                                         $data['data'][$count][$seedName2] = &$htmlDisplay;
405                                     $count++;
406                                 }
407                         }
408                 }//fi == 'html'
409
410                         if (!empty($this->lvd->seed->field_defs[$seedName]['sort_on'])) {
411                         $this->displayColumns[$columnName]['orderBy'] = $this->lvd->seed->field_defs[$seedName]['sort_on'];
412                     }
413                 }
414
415                 $this->process($file, $data, $this->seed->object_name);
416         }       
417         
418         /*
419          * Return the where clause as per the REQUEST. 
420          */
421         function _get_where_clause()
422         {
423                 $where = '';
424                 $where_clauses = $this->searchForm->generateSearchWhere(true, $this->seed->module_dir);
425                 // Bug 43452 - FG - Changed the way generated Where array is imploded into the string.
426                 //                  Now it's imploding in the same way view.list.php do.
427                 if (count($where_clauses) > 0 ) {
428                     $where = '( ' . implode(' and ', $where_clauses) . ' )';
429         }
430         
431         // Need to include the default whereStatement
432                 if(!empty($this->_popupMeta['whereStatement'])){
433             if(!empty($where))$where .= ' AND ';
434             $where .= $this->_popupMeta['whereStatement'];
435                 }
436
437                 return $where;
438         }
439         
440         /*
441          * Generate the data for the search form on the header of the Popup.
442          */
443                 function _build_field_defs(){
444                 $this->formData = array();
445                 $this->customFieldDefs = array();
446                 foreach($this->searchdefs[$this->module]['layout']['advanced_search'] as $data){
447                         if(is_array($data)){
448                                 
449                                 $this->formData[] = array('field' => $data);
450                                 $value = '';
451                                 $this->customFieldDefs[$data['name']]= $data;
452                                 if(!empty($_REQUEST[$data['name']]))
453                         $value = $_REQUEST[$data['name']];
454                     $this->customFieldDefs[$data['name']]['value'] = $value;
455                         }else
456                                 $this->formData[] = array('field' => array('name'=>$data));
457                 }
458                 $this->fieldDefs = array();
459                 if($this->seed){
460                         $this->seed->fill_in_additional_detail_fields();
461                         
462                 foreach($this->seed->toArray() as $name => $value) {
463                     $this->fieldDefs[$name] = $this->seed->field_defs[$name];
464                     //if we have a relate type then reset to name so that we end up with a textbox
465                     //rather than a select button
466                     $this->fieldDefs[$name]['name'] = $this->fieldDefs[$name]['name'];
467                     if($this->fieldDefs[$name]['type'] == 'relate')
468                         $this->fieldDefs[$name]['type'] = 'name';
469                     if(isset($this->fieldDefs[$name]['options']) && isset($GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']])) {
470                         $this->fieldDefs[$name]['options'] = $GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']]; // fill in enums
471                     }
472                     if(!empty($_REQUEST[$name]))
473                         $value = $_REQUEST[$name];
474                     $this->fieldDefs[$name]['value'] = $value;
475                 }
476                 }
477         }
478         
479         function _getAddForm(){
480                 $addform = '';
481         if(!$this->seed->ACLAccess('save')){
482             return;
483         }
484                 if(!empty($this->_popupMeta['create'])){
485                         $formBase = new $this->_popupMeta['create']['formBaseClass']();
486                                 
487                         
488                 
489                                 // TODO: cleanup the construction of $addform
490                                 $prefix = empty($this->_popupMeta['create']['getFormBodyParams'][0]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][0];
491                                 $mod = empty($this->_popupMeta['create']['getFormBodyParams'][1]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][1];
492                                 $formBody = empty($this->_popupMeta['create']['getFormBodyParams'][2]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][2];
493                                 
494                                 $getFormMethod = (empty($this->_popupMeta['create']['getFormMethod']) ? 'getFormBody' : $this->_popupMeta['create']['getFormMethod']);  
495                                 $formbody = $formBase->$getFormMethod($prefix, $mod, $formBody);
496                                 
497                                 $addform = '<table><tr><td nowrap="nowrap" valign="top">'
498                                         . str_replace('<br>', '</td><td nowrap="nowrap" valign="top">&nbsp;', $formbody)
499                                         . '</td></tr></table>'
500                                         . '<input type="hidden" name="action" value="Popup" />';
501                                         
502                         return $addform;
503                 }
504         }
505         
506         function _getAddFormHeader(){
507                 $lbl_save_button_title = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_TITLE'];
508                 $lbl_save_button_key = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_KEY'];
509                 $lbl_save_button_label = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_LABEL'];
510                 $module_dir = $this->seed->module_dir;
511 $formSave = <<<EOQ
512                         <input type="hidden" name="create" value="true">
513                         <input type="hidden" name="popup" value="true">
514                         <input type="hidden" name="to_pdf" value="true">
515                         <input type="hidden" name="return_module" value="$module_dir">
516                         <input type="hidden" name="return_action" value="Popup">
517 EOQ;
518                 // if metadata contains custom inputs for the quickcreate 
519                 if(!empty($this->_popupMeta['customInput']) && is_array($this->_popupMeta['customInput'])) {
520                         foreach($this->_popupMeta['customInput'] as $key => $value)
521                                 $formSave .= '<input type="hidden" name="' . $key . '" value="'. $value .'">\n';                                
522                 }
523
524
525                 $addformheader = get_form_header($this->_popupMeta['create']['createButton'], $formSave, false);
526                 return $addformheader;
527         }
528         
529         function getQuickCreate(){
530                 require_once("include/EditView/PopupQuickCreate.php");
531                 $qc = new PopupQuickCreate($this->module);
532                 return $qc->process($this->module);
533         }
534 }
535 ?>