/** * Outputs the form field for the given params */ function outputField($field_type, $field_name, $def_value, $onchange = '', $id = '') { $return_value = ''; switch ($field_type) { case 'hidden': $return_value = '<input type="hidden"' . HtmlForm::genHiddenField($field_name, $def_value) . ' id="' . $field_name . '" />'; break; case 'rate': $return_value = '<input type="text"' . HtmlForm::genInputTextField('255', $field_name, '70', $def_value, $onchange . 'style="width: 98%;" class="form-control input-sm input-large"') . ' />'; break; case 'visible': $return_value = HtmlForm::genDropdownSingleChoice(array("select_name" => $field_name, "selected_value" => $def_value, "onChange" => $onchange, "values" => array(array('value' => 'Y', 'contents' => getMsg('CR', 'CR_SHOW')), array('value' => 'N', 'contents' => getMsg('CR', 'CR_HIDE'))))); break; case 'checkbox': $return_value = HtmlForm::genCheckbox(array("value" => $def_value, "name" => $field_name, "onclick" => $onchange, "id" => $id, "is_checked" => '')); break; } return $return_value; }
/** * Outputs a label for the search result form */ function outputResultRecords() { global $application; $output = ''; foreach ($this->_labels as $record) { $record = modApiFunc('MultiLang', 'getLabelInformation', $record, $this->_modules, $this->_search_filter['lng']); $template_contents = array('LabelID' => $record['id'], 'LabelName' => $record['sh_label'], 'LabelZone' => $record['zone'], 'LabelType' => $record['module_name'], 'LabelUsage' => htmlspecialchars($record['usage']), 'LabelStatus' => $record['status'], 'LabelValue' => $this->outputLabelValue($record), 'LabelDefValue' => $this->outputLabelDefValue($record), 'CurLang' => $this->_search_filter['lng'], 'DeleteCheckBox' => HtmlForm::genCheckbox(array('value' => $record['id'], 'name' => 'label_id[]', 'id' => 'select_' . $record['id'], 'is_checked' => false, 'onclick' => 'javascript: selectRow(this);'), "class='form-control input-sm'")); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $output .= $this->mTmplFiller->fill('multilang/label_editor/', 'search-results-form-record.tpl.html', array()); } return $output; }
/** * Outputs the language delete checkbox */ function outputLanguageDeleteBox($lng) { return HtmlForm::genCheckbox(array("value" => $lng['lng'], "name" => 'to_delete[' . $lng['lng'] . ']', "onclick" => 'HighLightLanguage(this)', "id" => 'select_' . $lng['lng'], "is_checked" => ''), "class='form-contrl input-sm'"); }
/** * Outputs a review for the search result form */ function outputResultRecords() { global $application; $output = ''; foreach ($this->_found_reviews as $record) { $template_contents = array('DateFilter' => $this->outputRecordFilter('date', $record), 'ProductFilter' => $this->outputRecordFilter('product', $record), 'AuthorFilter' => $this->outputRecordFilter('author', $record), 'IPFilter' => $this->outputRecordFilter('ip_address', $record), 'DateValue' => $this->outputRecordValue('date', $record), 'TimeValue' => $this->outputRecordValue('time', $record), 'ProductValue' => $this->outputRecordValue('product_name', $record), 'AuthorValue' => $this->outputRecordValue('author', $record), 'IPValue' => $this->outputRecordValue('ip_address', $record), 'ReviewStyle' => $record['product_cr'] == 5 || $record['product_cr'] == 6 ? '' : ' color: #BBBBBB;', 'ReviewValue' => str_replace("\n", '<br />', $this->outputRecordValue('review', $record)), 'ProductOpenLink' => $this->outputProductOpenLink($record), 'RatingValue' => $this->outputRating($record), 'EditLinkID' => 'edit_' . $record['cr_id'], 'EditLinkCR' => '&cr_id=' . $record['cr_id'], 'StatusValue' => $this->outputStatusValue($record), 'DeleteValue' => HtmlForm::genCheckbox(array('value' => $record['cr_id'], 'name' => 'review_id[]', 'id' => 'select_' . $record['cr_id'], 'is_checked' => false, 'onclick' => 'javascript: checkSelectedRows(this);'))); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $output .= $this->mTmplFiller->fill('customer_reviews/manage_customer_reviews/', 'search-results-form-record.tpl.html', array()); } return $output; }
/** * @abstract Prepares the list of custom attributes for each group * @param $variantId group id */ function getCustomAttributesList($variantId) { global $application; $ids = modApiFunc('Checkout', 'getPersonInfoAttributeIdList', $variantId, 'CUSTOM_ATTRIBUTES_ONLY'); $value = ""; if (count($ids) == 0) { $value = $this->TemplateFiller->fill("checkout/checkout-info/", "no-custom-attributes.tpl.html", array()); return $value; } foreach ($ids as $attributeId) { $fields = modApiFunc('Checkout', 'getPersonInfoFieldsList', $variantId, $attributeId); $yes_no_tpl = array('name' => '', 'value' => '', 'id' => '', 'is_checked' => '', 'onclick' => ''); $param = ""; $name_textbox = "<input type='text' style='border:1px solid #B2C2DF; font-family:Verdana,Arial,sans-serif; font-size:11px; vertical-align:top;' " . HtmlForm::genInputTextField(40, $fields['attribute_id'] . '[name]', 40, $fields['name'], "onchange='javascript:OnCheckboxClick" . $variantId . "(id)'") . "/>"; if ($this->_Group_Template_Contents["PersonInfoTypeStatus"] == "false") { $name_textbox = $fields['name']; $param = "disabled"; } foreach (array('visible', 'required') as $prop_name) { $var_name = $prop_name . '_checkbox'; ${$var_name} = $yes_no_tpl; ${$var_name}['name'] = $fields['attribute_id'] . '[' . $prop_name . ']'; ${$var_name}['value'] = "1"; ${$var_name}['is_checked'] = $fields[$prop_name] == "1" ? "checked" : ""; ${$var_name}['id'] = $fields['attribute_id'] . '_' . $prop_name; ${$var_name}['onclick'] = 'OnCheckboxClick' . $variantId . "('" . ${$var_name}['id'] . "')"; if (!empty($fields['unremovable'])) { $param = "disabled"; } ${$var_name} = HtmlForm::genCheckbox(${$var_name}, $param); ${$var_name} .= "\n<input type='hidden' " . HtmlForm::genHiddenField($fields['attribute_id'] . '[attr_id]', $attributeId) . " />"; if (!empty($fields['unremovable'])) { ${$var_name} .= "\n<input type='hidden' " . HtmlForm::genHiddenField($fields['attribute_id'] . '[unremovable]', "unremovable") . " />"; } } //$fields['name']; $template_contents = array("VariantId" => $variantId, "AttributeId" => $attributeId, "Name" => $name_textbox, "Descr" => $fields['descr'], "IsVisible" => $visible_checkbox, "IsRequiered" => $required_checkbox); $this->_Template_Contents = array_merge($this->_Template_Contents, $template_contents); $application->registerAttributes($this->_Template_Contents); switch ($this->_Group_Template_Contents["PersonInfoTypeStatus"]) { case "false": $value .= $this->TemplateFiller->fill("checkout/checkout-info/", "attribute_inactive.tpl.html", array()); break; case "true": $value .= $this->TemplateFiller->fill("checkout/checkout-info/", "attribute.tpl.html", array()); break; default: //error break; } } return $value; }
function out_Attributes() { global $application; $html_code = ''; $yes_no_select = array('name' => '', 'value' => '', 'onChange' => '', 'id' => '', 'is_checked' => ''); foreach ($this->reg_form_attrs as $attr_info) { switch ($attr_info['attr_name']) { case 'AccountName': $this->login_attr_id = $attr_info['attr_id']; break; case 'Email': $this->email_attr_id = $attr_info['attr_id']; break; case 'Country': $this->country_attr_id = $attr_info['attr_id']; break; case 'State': $this->state_attr_id = $attr_info['attr_id']; break; } if (in_array($attr_info['attr_name'], $this->hidden_props)) { continue; } foreach (array('is_visible', 'is_required') as $prop_name) { if (in_array($attr_info['attr_name'], $this->not_change_props)) { $param = 'disabled'; } else { $param = ''; } $var_name = $prop_name . '_checkbox'; ${$var_name} = $yes_no_select; ${$var_name}['name'] = $attr_info['attr_name'] . '[' . $prop_name . ']'; ${$var_name}['value'] = "Y"; ${$var_name}['onChange'] = 'onChange_' . $prop_name . '(' . $attr_info['attr_id'] . ');'; ${$var_name}['is_checked'] = $attr_info[$prop_name] == "Y" ? "checked" : ""; ${$var_name}['id'] = $attr_info['attr_id'] . '_' . $prop_name; ${$var_name} = HtmlForm::genCheckbox(${$var_name}, $param); if ($param == 'disabled') { ${$var_name} .= "\n <input type='hidden' " . HtmlForm::genHiddenField($attr_info['attr_name'] . '[disabled]', "disabled") . " />"; } } $template_contents = array('Name' => prepareHTMLDisplay($attr_info['visible_name']), 'AttrID' => $attr_info['attr_id'], 'AttrName' => $attr_info['attr_name'], 'Descr' => getMsg('CA', $attr_info['lang_code']), 'IsVisible' => $is_visible_checkbox, 'IsRequiered' => $is_required_checkbox); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $this->mTmplFiller =& $application->getInstance('TmplFiller'); $html_code .= $this->mTmplFiller->fill("customer_account/register_form_editor/", "attribute.tpl.html", array()); } return $html_code; }