Beispiel #1
0
 function AddEditField($id, &$aefield, $dispose_only, $returnid, $message = '')
 {
     $mod = $this->module_ptr;
     if (!empty($message)) {
         $mod->smarty->assign('message', $mod->ShowMessage($message));
     }
     $mod->smarty->assign('backtoform_nav', $mod->CreateLink($id, 'admin_add_edit_form', $returnid, $mod->Lang('link_back_to_form'), array('form_id' => $this->Id)));
     $mainList = array();
     $advList = array();
     $baseList = $aefield->PrePopulateBaseAdminForm($id, $dispose_only);
     if ($aefield->GetFieldType() == '') {
         // still need type
         $mod->smarty->assign('start_form', $mod->CreateFormStart($id, 'admin_add_edit_field', $returnid));
         $fieldList = array('main' => array(), 'adv' => array());
     } else {
         // we have our type
         $mod->smarty->assign('start_form', $mod->CreateFormStart($id, 'admin_add_edit_field', $returnid));
         $fieldList = $aefield->PrePopulateAdminForm($id);
     }
     $mod->smarty->assign('end_form', $mod->CreateFormEnd());
     #### JM fixes for CMSMS 2
     if (!formbuilder_utils::is_CMS2()) {
         $mod->smarty->assign('tab_start', $mod->StartTabHeaders() . $mod->SetTabHeader('maintab', $mod->Lang('tab_main')) . $mod->SetTabHeader('advancedtab', $mod->Lang('tab_advanced')) . $mod->EndTabHeaders() . $mod->StartTabContent());
         $mod->smarty->assign('tabs_end', $mod->EndTabContent());
         $mod->smarty->assign('maintab_start', $mod->StartTab("maintab"));
         $mod->smarty->assign('advancedtab_start', $mod->StartTab("advancedtab"));
         $mod->smarty->assign('tab_end', $mod->EndTab());
     }
     $mod->smarty->assign('notice_select_type', $mod->Lang('notice_select_type'));
     if ($aefield->GetId() != -1) {
         $mod->smarty->assign('op', $mod->CreateInputHidden($id, 'fbrp_op', $mod->Lang('updated')));
         $mod->smarty->assign('submit', $mod->CreateInputSubmit($id, 'fbrp_aef_upd', $mod->Lang('update')));
     } else {
         if ($aefield->GetFieldType() != '') {
             $mod->smarty->assign('op', $mod->CreateInputHidden($id, 'fbrp_op', $mod->Lang('added')));
             $mod->smarty->assign('submit', $mod->CreateInputSubmit($id, 'fbrp_aef_add', $mod->Lang('add')));
         }
     }
     $mod->smarty->assign('cancel', $mod->CreateInputSubmit($id, 'fbrp_cancel', $mod->Lang('cancel')));
     if ($aefield->HasAddOp()) {
         $mod->smarty->assign('add', $mod->CreateInputSubmit($id, 'fbrp_aef_optadd', $aefield->GetOptionAddButton()));
     } else {
         $mod->smarty->assign('add', '');
     }
     if ($aefield->HasDeleteOp()) {
         $mod->smarty->assign('del', $mod->CreateInputSubmit($id, 'fbrp_aef_optdel', $aefield->GetOptionDeleteButton()));
     } else {
         $mod->smarty->assign('del', '');
     }
     $mod->smarty->assign('fb_hidden', $mod->CreateInputHidden($id, 'form_id', $this->Id) . $mod->CreateInputHidden($id, 'field_id', $aefield->GetId()) . $mod->CreateInputHidden($id, 'fbrp_order_by', $aefield->GetOrder()) . $mod->CreateInputHidden($id, 'fbrp_set_from_form', '1'));
     if (!$aefield->IsNonRequirableField()) {
         $mod->smarty->assign('requirable', 1);
     } else {
         $mod->smarty->assign('requirable', 0);
     }
     if (isset($baseList['main'])) {
         foreach ($baseList['main'] as $item) {
             $titleStr = $item[0];
             $inputStr = $item[1];
             $oneset = new stdClass();
             $oneset->title = $titleStr;
             if (is_array($inputStr)) {
                 $oneset->input = $inputStr[0];
                 $oneset->help = $inputStr[1];
             } else {
                 $oneset->input = $inputStr;
                 $oneset->help = '';
             }
             array_push($mainList, $oneset);
         }
     }
     if (isset($baseList['adv'])) {
         foreach ($baseList['adv'] as $item) {
             $titleStr = $item[0];
             $inputStr = $item[1];
             $oneset = new stdClass();
             $oneset->title = $titleStr;
             if (is_array($inputStr)) {
                 $oneset->input = $inputStr[0];
                 $oneset->help = $inputStr[1];
             } else {
                 $oneset->input = $inputStr;
                 $oneset->help = '';
             }
             array_push($advList, $oneset);
         }
     }
     if (isset($fieldList['main'])) {
         foreach ($fieldList['main'] as $item) {
             $titleStr = $item[0];
             $inputStr = $item[1];
             $oneset = new stdClass();
             $oneset->title = $titleStr;
             if (is_array($inputStr)) {
                 $oneset->input = $inputStr[0];
                 $oneset->help = $inputStr[1];
             } else {
                 $oneset->input = $inputStr;
                 $oneset->help = '';
             }
             array_push($mainList, $oneset);
         }
     }
     if (isset($fieldList['adv'])) {
         foreach ($fieldList['adv'] as $item) {
             $titleStr = $item[0];
             $inputStr = $item[1];
             $oneset = new stdClass();
             $oneset->title = $titleStr;
             if (is_array($inputStr)) {
                 $oneset->input = $inputStr[0];
                 $oneset->help = $inputStr[1];
             } else {
                 $oneset->input = $inputStr;
                 $oneset->help = '';
             }
             array_push($advList, $oneset);
         }
     }
     $aefield->PostPopulateAdminForm($mainList, $advList);
     $mod->smarty->assign('mainList', $mainList);
     $mod->smarty->assign('advList', $advList);
     # fixes for CMSMS 2 compatibility (JM)
     # we need this to get (at least) the lang method on the template {$frmbld->Lang('string')}
     $mod->smarty->assign('frmbld', $mod);
     if (formbuilder_utils::is_CMS2()) {
         return $mod->ProcessTemplate('AddEditField2.tpl');
     }
     return $mod->ProcessTemplate('AddEditField.tpl');
 }
//$this->GetPreference('show_fieldids','0')). $this->Lang('title_show_fieldids_long'));
//$smarty->assign('title_show_fieldaliases',$this->Lang('title_show_fieldaliases'));
//$smarty->assign('input_show_fieldaliases',
//$this->CreateInputcheckbox($id,'fbrp_show_fieldaliases',1,
//$this->GetPreference('show_fieldaliases','1')). $this->Lang('title_show_fieldaliases_long'));
//$smarty->assign('title_show_version',$this->Lang('title_show_version'));
//$smarty->assign('input_show_version',$this->CreateInputCheckbox($id, 'fbrp_show_version', 1, $this->GetPreference('show_version','1')). $this->Lang('title_show_version_long'));
$smarty->assign('title_blank_invalid', $this->Lang('title_blank_invalid'));
$smarty->assign('input_blank_invalid', $this->CreateInputCheckbox($id, 'fbrp_blank_invalid', 1, $this->GetPreference('blank_invalid', '0')) . $this->Lang('title_blank_invalid_long'));
$smarty->assign('submit', $this->CreateInputSubmit($id, 'fbrp_submit', $this->Lang('save')));
$smarty->assign('end_configform', $this->CreateFormEnd());
$smarty->assign('start_xmlform', $this->CreateFormStart($id, 'importxml', $returnid, 'post', 'multipart/form-data'));
$smarty->assign('submitxml', $this->CreateInputSubmit($id, 'fbrp_submit', $this->Lang('upload')));
$smarty->assign('end_xmlform', $this->CreateFormEnd());
$smarty->assign('input_xml_to_upload', $this->CreateInputFile($id, 'fbrp_xmlfile'));
$smarty->assign('title_xml_to_upload', $this->Lang('title_xml_to_upload'));
$smarty->assign('title_xml_upload_formname', $this->Lang('title_xml_upload_formname'));
$smarty->assign('input_xml_upload_formname', $this->CreateInputText($id, 'fbrp_import_formname', '', 25));
$smarty->assign('title_xml_upload_formalias', $this->Lang('title_xml_upload_formalias'));
$smarty->assign('input_xml_upload_formalias', $this->CreateInputText($id, 'fbrp_import_formalias', '', 25));
$smarty->assign('info_leaveempty', $this->Lang('help_leaveempty'));
$smarty->assign('legend_xml_import', $this->Lang('title_import_legend'));
$smarty->assign('forms', $formArray);
if (formbuilder_utils::is_CMS2()) {
    echo $this->ProcessTemplate('AdminMain2.tpl');
} else {
    echo $this->ProcessTemplate('AdminMain.tpl');
}
#
# EOF
#