public function GetFieldInput($id, &$params, $returnid) { $mod = $this->form_ptr->module_ptr; $js = $this->GetOption('javascript', ''); $check_value = $this->_check_value(); $output = array(); $box_label = ''; $text_label = ''; if (!$this->Value['box'] && $this->GetOption('is_checked', '0') == '1') { $this->Value['box'] = 't'; } if (strlen($this->GetOption('box_label', '')) > 0) { $box_label = '<label for="' . $this->GetCSSId('_0') . '">' . $this->GetOption('box_label') . '</label>'; } if (strlen($this->GetOption('text_label', '')) > 0) { $text_label = '<label for="' . $this->GetCSSId('_1') . '">' . $this->GetOption('text_label') . '</label>'; } $obj = new stdClass(); $obj->name = $box_label; $obj->input = $mod->CreateInputCheckbox($id, 'fbrp__' . $this->Id . '[box]', 't', $this->Value['box'], $js . $this->GetCSSIdTag('_0')); $output[] = $obj; if ($this->GetOption('show_textfield')) { $val = ''; if ($check_value['text']) { $val = $this->Value['text']; } $obj = new stdClass(); $obj->name = $text_label; $obj->input = formbuilder_utils::create_input_text($id, $this->GetCSSId() . '[text]', $val, 25, 25, $js, 'text', $this->isRequired(), 1); $output[] = $obj; } return $output; }
public function GetFieldInput($id, &$params, $returnid) { $val = ''; $length = $this->GetOption('length') < 25 ? $this->GetOption('length') : 25; $js = $this->GetOption('javascript', ''); $ro = ''; $html5 = ''; if ($this->GetOption('html5', '0') == '1') { $val = $this->Value; $html5 = ' placeholder="' . $this->GetOption('default') . '"'; } else { $val = $this->HasValue() ? $this->Value : $this->GetOption('default'); if ($this->GetOption('clear_default', '0') == 1) { $js .= ' onfocus="if(this.value==this.defaultValue) this.value=\'\';" onblur="if(this.value==\'\') this.value=this.defaultValue;"'; } } if ($this->GetOption('readonly', '0') == '1') { $ro = ' readonly="readonly"'; } switch ($this->ValidationType) { default: return formbuilder_utils::create_input_text($id, $this->GetCSSId(), $val, $length, $this->GetOption('length'), $js . $ro . $html5, 'text', $this->IsRequired()); break; case 'usphone': return formbuilder_utils::create_input_text($id, $this->GetCSSId(), $val, $length, $this->GetOption('length'), $js . $ro . $html5, 'tel', $this->IsRequired()); break; case 'email': return formbuilder_utils::create_input_text($id, $this->GetCSSId(), $val, $length, $this->GetOption('length'), $js . $ro . $html5, 'email', $this->IsRequired()); break; } }
public function GetFieldInput($id, &$params, $returnid) { $label = ''; if (strlen($this->GetOption('label', '')) > 0) { $label = ' <label for="' . $this->GetCSSId() . '">' . $this->GetOption('label') . '</label>'; } if ($this->Value === false && $this->GetOption('is_checked', '0') == '1') { $this->Value = 't'; } $js = $this->GetOption('javascript', ''); return formbuilder_utils::create_input_checkbox($id, $this->GetCSSId(), 't', $this->Value, $js) . $label; }
public function GetFieldInput($id, &$params, $returnid) { $js = $this->GetOption('javascript', ''); $val = ''; if ($this->Value) { $val = $this->Value; } if ($this->GetOption('hide', '1') == '0') { return formbuilder_utils::create_input_text($id, $this->GetCSSId(), $val, $this->GetOption('length'), 255, $js, 'text', $this->isRequired()); } else { return formbuilder_utils::create_input_text($id, $this->GetCSSId(), $val, $this->GetOption('length'), 255, $js, 'password', $this->isRequired()); } }
public function GetFieldInput($id, &$params, $returnid) { $mod = $this->form_ptr->module_ptr; $js = $this->GetOption('javascript', ''); $sibling_id = $this->GetOption('siblings', ''); $hidebuttons = $this->GetOption('hidebuttons', ''); if (!is_array($this->Value)) { $vals = 1; } else { $vals = count($this->Value); } foreach ($params as $pKey => $pVal) { if (substr($pKey, 0, 9) == 'fbrp_FeX_') { $pts = explode('_', $pKey); if ($pts[2] == $this->Id || $pts[2] == $sibling_id) { // add row $this->Value[$vals] = ''; $vals++; } } elseif (substr($pKey, 0, 9) == 'fbrp_FeD_') { $pts = explode('_', $pKey); if ($pts[2] == $this->Id || $pts[2] == $sibling_id) { // delete row if (isset($this->Value[$pts[3]])) { array_splice($this->Value, $pts[3], 1); } $vals--; } } } // Input fields $ret = array(); for ($i = 0; $i < $vals; $i++) { $length = $this->GetOption('length') < 25 ? $this->GetOption('length') : 25; $thisRow = new stdClass(); $thisRow->input = formbuilder_utils::create_input_text($id, $this->GetCSSId() . '[]', $this->Value[$i], $length, $this->GetOption('length'), $js, 'text', false, $i); if (!$hidebuttons) { $thisRow->op = $mod->fbCreateInputSubmit($id, 'fbrp_FeD_' . $this->Id . '_' . $i, $this->GetOption('del_button', 'X'), $this->GetCSSIdTag('_del_' . $i) . ($vals == 1 ? ' disabled="disabled"' : '')); } array_push($ret, $thisRow); } // Add button $thisRow = new stdClass(); if (!$hidebuttons) { $thisRow->op = $mod->fbCreateInputSubmit($id, 'fbrp_FeX_' . $this->Id . '_' . $i, $this->GetOption('add_button', '+'), $this->GetCSSIdTag('_add_' . $i)); } array_push($ret, $thisRow); return $ret; }
public function GetFieldInput($id, &$params, $returnid) { $val = ''; $js = $this->GetOption('javascript', ''); $html5 = ''; if ($this->GetOption('html5', '0') == '1') { $val = $this->Value; $html5 = ' placeholder="' . $this->GetOption('default') . '"'; } else { $val = $this->HasValue() ? $this->Value : $this->GetOption('default'); if ($this->GetOption('clear_default', '0') == 1) { $js .= ' onfocus="if(this.value==this.defaultValue) this.value=\'\';" onblur="if(this.value==\'\') this.value=this.defaultValue;"'; } } return formbuilder_utils::create_input_text($id, $this->GetCSSId(), $val, 25, 128, $js . $html5, 'text', $this->IsRequired()); }
public function GetFieldInput($id, &$params, $returnid) { $mod = $this->form_ptr->module_ptr; $js = $this->GetOption('javascript', ''); $ro = ''; $val = ''; if ($this->GetOption('readonly', '0') == '1') { $ro = ' readonly="readonly"'; } if ($this->Value) { $val = $this->Value; } if ($this->GetOption('hide', '1') == '0') { return formbuilder_utils::create_input_text($id, $this->GetCssId(), $val, $this->GetOption('length'), 255, $js . $ro, 'text', $this->isRequired()); } else { return formbuilder_utils::create_input_text($id, $this->GetCssId(), $val, $this->GetOption('length'), 255, $js . $ro, 'password', $this->isRequired()); } }
public function GetFieldInput($id, &$params, $returnid) { $mod = $this->form_ptr->module_ptr; $js = $this->GetOption('javascript', ''); $val = ''; $rq = ''; $html5 = ''; if ($this->GetOption('html5', '0') == '1') { $val = $this->Value[0]; $html5 = ' placeholder="' . $this->GetOption('default') . '"'; } else { $val = $this->Value[0] ? $this->Value[0] : $this->GetOption('default'); if ($this->GetOption('clear_default', '0') == 1) { $js .= ' onfocus="if(this.value==this.defaultValue) this.value=\'\';" onblur="if(this.value==\'\') this.value=this.defaultValue;"'; } } $input = formbuilder_utils::create_input_text($id, $this->GetCSSId(), $val, 25, 128, $js . $html5, 'email', $this->IsRequired()); if ($this->GetOption('send_user_copy', 'n') == 'c') { $input .= formbuilder_utils::create_input_checkbox($id, $this->GetCSSId(), 1, 0, '', 1); $input .= formbuilder_utils::create_label($id, $this->GetCSSId('_1'), $this->GetOption('send_user_label', $mod->Lang('title_send_me_a_copy'))); } return $input; }
public function GetFieldInput($id, &$params, $returnid) { $mod = $this->form_ptr->module_ptr; $js = $this->GetOption('javascript', ''); // why all this? Associative arrays are not guaranteed to preserve // order, except in "chronological" creation order. $sorted = array(); $subjects = $this->GetOptionRef('option_name'); if (count($subjects) > 1) { for ($i = 0; $i < count($subjects); $i++) { $sorted[$subjects[$i]] = $i + 1; } if ($this->GetOption('sort') == '1') { ksort($sorted); } } else { $sorted[$subjects] = '1'; } if ($this->GetOption('select_one', '') != '') { $sorted = array(' ' . $this->GetOption('select_one', '') => '') + $sorted; } return formbuilder_utils::create_input_dropdown($id, $this->GetCSSId(), $sorted, -1, $this->Value, $js, $this->isRequired()); }
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 #