本文整理汇总了PHP中AdminController::renderForm方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminController::renderForm方法的具体用法?PHP AdminController::renderForm怎么用?PHP AdminController::renderForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AdminController
的用法示例。
在下文中一共展示了AdminController::renderForm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderForm
public function renderForm()
{
if (!$this->object->id) {
$this->object->price = -1;
}
$this->fields_form = array('legend' => array('title' => $this->l('Catalog price rules'), 'icon' => 'icon-dollar'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'maxlength' => 32, 'required' => true, 'hint' => $this->l('Forbidden characters') . ' <>;=#{}'), array('type' => 'select', 'label' => $this->l('Shop'), 'name' => 'shop_id', 'options' => array('query' => Shop::getShops(), 'id' => 'id_shop', 'name' => 'name'), 'condition' => Shop::isFeatureActive(), 'default_value' => Shop::getContextShopID()), array('type' => 'select', 'label' => $this->l('Currency'), 'name' => 'id_currency', 'options' => array('query' => array_merge(array(0 => array('id_currency' => 0, 'name' => $this->l('All currencies'))), Currency::getCurrencies()), 'id' => 'id_currency', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'options' => array('query' => array_merge(array(0 => array('id_country' => 0, 'name' => $this->l('All countries'))), Country::getCountries((int) $this->context->language->id)), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Group'), 'name' => 'id_group', 'options' => array('query' => array_merge(array(0 => array('id_group' => 0, 'name' => $this->l('All groups'))), Group::getGroups((int) $this->context->language->id)), 'id' => 'id_group', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('From quantity'), 'name' => 'from_quantity', 'maxlength' => 10, 'required' => true), array('type' => 'text', 'label' => $this->l('Price (tax excl.)'), 'name' => 'price', 'disabled' => $this->object->price == -1 ? 1 : 0, 'maxlength' => 10, 'suffix' => $this->context->currency->getSign('right')), array('type' => 'checkbox', 'name' => 'leave_bprice', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->l('Leave base price'), 'val' => '1', 'checked' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'datetime', 'label' => $this->l('From'), 'name' => 'from'), array('type' => 'datetime', 'label' => $this->l('To'), 'name' => 'to'), array('type' => 'select', 'label' => $this->l('Reduction type'), 'name' => 'reduction_type', 'options' => array('query' => array(array('reduction_type' => 'amount', 'name' => $this->l('Amount')), array('reduction_type' => 'percentage', 'name' => $this->l('Percentage'))), 'id' => 'reduction_type', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Reduction with or without taxes'), 'name' => 'reduction_tax', 'align' => 'center', 'options' => array('query' => array(array('lab' => $this->l('Tax included'), 'val' => 1), array('lab' => $this->l('Tax excluded'), 'val' => 0)), 'id' => 'val', 'name' => 'lab')), array('type' => 'text', 'label' => $this->l('Reduction'), 'name' => 'reduction', 'required' => true)), 'submit' => array('title' => $this->l('Save')));
if (($value = $this->getFieldValue($this->object, 'price')) != -1) {
$price = number_format($value, 6);
} else {
$price = '';
}
$this->fields_value = array('price' => $price, 'from_quantity' => ($value = $this->getFieldValue($this->object, 'from_quantity')) ? $value : 1, 'reduction' => number_format(($value = $this->getFieldValue($this->object, 'reduction')) ? $value : 0, 6), 'leave_bprice_on' => $price ? 0 : 1);
$attribute_groups = array();
$attributes = Attribute::getAttributes((int) $this->context->language->id);
foreach ($attributes as $attribute) {
if (!isset($attribute_groups[$attribute['id_attribute_group']])) {
$attribute_groups[$attribute['id_attribute_group']] = array('id_attribute_group' => $attribute['id_attribute_group'], 'name' => $attribute['attribute_group']);
}
$attribute_groups[$attribute['id_attribute_group']]['attributes'][] = array('id_attribute' => $attribute['id_attribute'], 'name' => $attribute['name']);
}
$features = Feature::getFeatures((int) $this->context->language->id);
foreach ($features as &$feature) {
$feature['values'] = FeatureValue::getFeatureValuesWithLang((int) $this->context->language->id, $feature['id_feature'], true);
}
$this->tpl_form_vars = array('manufacturers' => Manufacturer::getManufacturers(), 'suppliers' => Supplier::getSuppliers(), 'attributes_group' => $attribute_groups, 'features' => $features, 'categories' => Category::getSimpleCategories((int) $this->context->language->id), 'conditions' => $this->object->getConditions(), 'is_multishop' => Shop::isFeatureActive());
return parent::renderForm();
}
示例2: renderForm
public function renderForm()
{
$this->fields_form = array('legend' => array('title' => $this->l('SQL query'), 'icon' => 'icon-cog'), 'input' => array(array('type' => 'text', 'label' => $this->l('SQL query name'), 'name' => 'name', 'size' => 103, 'required' => true), array('type' => 'textarea', 'label' => $this->l('SQL query'), 'name' => 'sql', 'cols' => 100, 'rows' => 10, 'required' => true)), 'submit' => array('title' => $this->l('Save')));
$request = new RequestSql();
$this->tpl_form_vars = array('tables' => $request->getTables());
return parent::renderForm();
}
示例3: renderForm
public function renderForm()
{
$this->fields_form = array('legend' => array('title' => $this->l('Print a PDF'), 'image' => '../img/admin/pdf.gif'), 'input' => array(array('type' => 'date', 'label' => $this->l('From:'), 'name' => 'date_from', 'size' => 20, 'maxlength' => 10, 'required' => true, 'desc' => $this->l('Format: 2011-12-31 (inclusive)')), array('type' => 'date', 'label' => $this->l('To:'), 'name' => 'date_to', 'size' => 20, 'maxlength' => 10, 'required' => true, 'desc' => $this->l('Format: 2012-12-31 (inclusive)'))), 'submit' => array('title' => $this->l('Generate PDF file'), 'class' => 'button', 'id' => 'submitPrint'));
$this->fields_value = array('date_from' => date('Y-m-d'), 'date_to' => date('Y-m-d'));
$this->show_toolbar = false;
return parent::renderForm();
}
示例4: renderForm
public function renderForm()
{
$this->fields_form = array('legend' => array('title' => $this->l('Print a PDF'), 'icon' => 'icon-print'), 'input' => array(array('type' => 'date', 'label' => $this->l('From'), 'name' => 'date_from', 'maxlength' => 10, 'required' => true, 'hint' => $this->l('Format: 2011-12-31 (inclusive).')), array('type' => 'date', 'label' => $this->l('To'), 'name' => 'date_to', 'maxlength' => 10, 'required' => true, 'hint' => $this->l('Format: 2012-12-31 (inclusive).'))), 'submit' => array('title' => $this->l('Generate PDF file'), 'id' => 'submitPrint', 'icon' => 'process-icon-download-alt'));
$this->fields_value = array('date_from' => date('Y-m-d'), 'date_to' => date('Y-m-d'));
$this->show_toolbar = false;
return parent::renderForm();
}
示例5: renderForm
public function renderForm()
{
if (!($obj = $this->loadObject(true))) {
return;
}
$address_layout = AddressFormat::getAddressCountryFormat($obj->id);
if ($value = Tools::getValue('address_layout')) {
$address_layout = $value;
}
$default_layout = '';
$default_layout_tab = array(array('firstname', 'lastname'), array('company'), array('vat_number'), array('address1'), array('address2'), array('postcode', 'city'), array('Country:name'), array('phone'), array('phone_mobile'));
foreach ($default_layout_tab as $line) {
$default_layout .= implode(' ', $line) . "\r\n";
}
$this->fields_form = array('legend' => array('title' => $this->l('Countries'), 'image' => '../img/admin/world.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Country:'), 'name' => 'name', 'lang' => true, 'size' => 30, 'required' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}', 'desc' => $this->l('Country name')), array('type' => 'text', 'label' => $this->l('ISO code:'), 'name' => 'iso_code', 'size' => 4, 'maxlength' => 3, 'class' => 'uppercase', 'required' => true, 'desc' => $this->l('Two -- or three -- letter ISO code (e.g. U.S. for United States)') . '.
<a href="http://www.iso.org/iso/country_codes/iso_3166_code_lists/country_names_and_code_elements.htm" target="_blank">' . $this->l('Official list here') . '
</a>.'), array('type' => 'text', 'label' => $this->l('Call prefix:'), 'name' => 'call_prefix', 'size' => 4, 'maxlength' => 3, 'class' => 'uppercase', 'required' => true, 'desc' => $this->l('International call prefix, (e.g. 1 for United States)')), array('type' => 'select', 'label' => $this->l('Default currency:'), 'name' => 'id_currency', 'options' => array('query' => Currency::getCurrencies(), 'id' => 'id_currency', 'name' => 'name', 'default' => array('label' => $this->l('Default store currency'), 'value' => 0))), array('type' => 'select', 'label' => $this->l('Zone:'), 'name' => 'id_zone', 'options' => array('query' => Zone::getZones(), 'id' => 'id_zone', 'name' => 'name'), 'desc' => $this->l('Geographical region')), array('type' => 'radio', 'label' => $this->l('Need zip/postal code:'), 'name' => 'need_zip_code', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'need_zip_code_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'need_zip_code_off', 'value' => 0, 'label' => $this->l('No')))), array('type' => 'text', 'label' => $this->l('Zip/post code format:'), 'name' => 'zip_code_format', 'class' => 'uppercase', 'required' => true, 'desc' => $this->l('Zip Code format (L for a letter, N for a number and C for the ISO code). For example, NNNNN for the United States. No verification if undefined.')), array('type' => 'address_layout', 'label' => $this->l('Address format:'), 'name' => 'address_layout', 'address_layout' => $address_layout, 'encoding_address_layout' => urlencode($address_layout), 'encoding_default_layout' => urlencode($default_layout), 'display_valid_fields' => $this->displayValidFields()), array('type' => 'radio', 'label' => $this->l('Address Standardization:'), 'name' => 'standardization', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'standardization_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'standardization_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'radio', 'label' => $this->l('Active:'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'desc' => $this->l('Display this country to your customers (the selected country will always be displayed in the Back Office)')), array('type' => 'radio', 'label' => $this->l('Contains following states:'), 'name' => 'contains_states', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'contains_states_on', 'value' => 1, 'label' => '<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />' . $this->l('Yes')), array('id' => 'contains_states_off', 'value' => 0, 'label' => '<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" />' . $this->l('No')))), array('type' => 'radio', 'label' => $this->l('Do you need a tax identification number?'), 'name' => 'need_identification_number', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'need_identification_number_on', 'value' => 1, 'label' => '<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />' . $this->l('Yes')), array('id' => 'need_identification_number_off', 'value' => 0, 'label' => '<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" />' . $this->l('No')))), array('type' => 'radio', 'label' => $this->l('Display tax label (e.g. "Tax incl."):'), 'name' => 'display_tax_label', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'display_tax_label_on', 'value' => 1, 'label' => '<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />' . $this->l('Yes')), array('id' => 'display_tax_label_off', 'value' => 0, 'label' => '<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" />' . $this->l('No'))))));
if (Shop::isFeatureActive()) {
$this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso');
}
$this->fields_form['submit'] = array('title' => $this->l('Save '), 'class' => 'button');
if ($this->object->iso_code == 'US') {
$this->object->standardization = Configuration::get('PS_TAASC');
}
return parent::renderForm();
}
示例6: initFormByStatus
public function initFormByStatus()
{
$this->fields_form = array('legend' => array('title' => $this->l('By order status'), 'image' => '../img/admin/pdf.gif'), 'input' => array(array('type' => 'checkboxStatuses', 'label' => $this->l('Statuses:'), 'name' => 'id_order_state', 'values' => array('query' => OrderState::getOrderStates($this->context->language->id), 'id' => 'id_order_state', 'name' => 'name'), 'desc' => $this->l('You can also export orders which have not been charged yet.') . ' (<img src="../img/admin/charged_ko.gif" alt="" />).')), 'submit' => array('title' => $this->l('Generate PDF file by status.'), 'class' => 'button', 'id' => 'submitPrint2'));
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT COUNT(o.id_order) as nbOrders, (
SELECT oh.id_order_state
FROM ' . _DB_PREFIX_ . 'order_history oh
WHERE oh.id_order = oi.id_order
ORDER BY oh.date_add DESC, oh.id_order_history DESC
LIMIT 1
) id_order_state
FROM ' . _DB_PREFIX_ . 'order_invoice oi
LEFT JOIN ' . _DB_PREFIX_ . 'orders o ON (oi.id_order = o.id_order)
WHERE o.id_shop IN(' . implode(', ', Shop::getContextListShopID()) . ')
GROUP BY id_order_state
');
$status_stats = array();
foreach ($result as $row) {
$status_stats[$row['id_order_state']] = $row['nbOrders'];
}
$this->tpl_form_vars = array('statusStats' => $status_stats, 'style' => '');
$this->table = 'invoice_status';
$this->show_toolbar = false;
return parent::renderForm();
}
示例7: renderForm
public function renderForm()
{
// loads current warehouse
if (!($obj = $this->loadObject(true))) {
return;
}
$this->fields_form = array('legend' => array('title' => $this->l('Suppliers'), 'image' => '../img/admin/suppliers.gif'), 'input' => array(array('type' => 'hidden', 'name' => 'id_address'), array('type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'size' => 40, 'required' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'textarea', 'label' => $this->l('Description:'), 'name' => 'description', 'cols' => 60, 'rows' => 10, 'lang' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}', 'desc' => $this->l('Will appear in the supplier list')), array('type' => 'text', 'label' => $this->l('Phone:'), 'name' => 'phone', 'size' => 15, 'maxlength' => 16, 'desc' => $this->l('Phone number for this supplier')), array('type' => 'text', 'label' => $this->l('Address:'), 'name' => 'address', 'size' => 100, 'maxlength' => 128, 'required' => true), array('type' => 'text', 'label' => $this->l('Address:') . ' (2)', 'name' => 'address2', 'size' => 100, 'maxlength' => 128), array('type' => 'text', 'label' => $this->l('Postal Code/Zip Code:'), 'name' => 'postcode', 'size' => 10, 'maxlength' => 12, 'required' => true), array('type' => 'text', 'label' => $this->l('City:'), 'name' => 'city', 'size' => 20, 'maxlength' => 32, 'required' => true), array('type' => 'select', 'label' => $this->l('Country:'), 'name' => 'id_country', 'required' => true, 'default_value' => (int) $this->context->country->id, 'options' => array('query' => Country::getCountries($this->context->language->id, false), 'id' => 'id_country', 'name' => 'name'), 'desc' => $this->l('Country where the state, region or city is located')), array('type' => 'select', 'label' => $this->l('State'), 'name' => 'id_state', 'options' => array('id' => 'id_state', 'query' => array(), 'name' => 'name')), array('type' => 'file', 'label' => $this->l('Logo:'), 'name' => 'logo', 'display_image' => true, 'desc' => $this->l('Upload a supplier logo from your computer')), array('type' => 'text', 'label' => $this->l('Meta title:'), 'name' => 'meta_title', 'lang' => true, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}'), array('type' => 'text', 'label' => $this->l('Meta description:'), 'name' => 'meta_description', 'lang' => true, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}'), array('type' => 'tags', 'label' => $this->l('Meta keywords:'), 'name' => 'meta_keywords', 'lang' => true, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}', 'desc' => $this->l('To add "tags" click in the field, write something and then press "Enter"')), array('type' => 'radio', 'label' => $this->l('Enable:'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))))), 'submit' => array('title' => $this->l(' Save '), 'class' => 'button'));
// loads current address for this supplier - if possible
$address = null;
if (isset($obj->id)) {
$id_address = Address::getAddressIdBySupplierId($obj->id);
if ($id_address > 0) {
$address = new Address((int) $id_address);
}
}
// force specific fields values (address)
if ($address != null) {
$this->fields_value = array('id_address' => $address->id, 'phone' => $address->phone, 'address' => $address->address1, 'address2' => $address->address2, 'postcode' => $address->postcode, 'city' => $address->city, 'id_country' => $address->id_country, 'id_state' => $address->id_state);
} else {
$this->fields_value = array('id_address' => 0, 'id_country' => Configuration::get('PS_COUNTRY_DEFAULT'));
}
if (Shop::isFeatureActive()) {
$this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso');
}
// set logo image
$image = ImageManager::thumbnail(_PS_SUPP_IMG_DIR_ . '/' . $this->object->id . '.jpg', $this->table . '_' . (int) $this->object->id . '.' . $this->imageType, 350, $this->imageType, true);
$this->fields_value['image'] = $image ? $image : false;
$this->fields_value['size'] = $image ? filesize(_PS_SUPP_IMG_DIR_ . '/' . $this->object->id . '.jpg') / 1000 : false;
return parent::renderForm();
}
示例8: renderForm
public function renderForm()
{
$update_htaccess = Tools::modRewriteActive() && (file_exists('.htaccess') && is_writable('.htaccess') || is_writable(dirname('.htaccess')));
$this->multiple_fieldsets = true;
if (!$update_htaccess) {
$desc_virtual_uri = array('<span class="warning_mod_rewrite">' . $this->l('You need to activate URL Rewriting if you want to add a virtual URL.') . '</span>');
} else {
$desc_virtual_uri = array($this->l('You can use this option if you want to create a store with a URL that doesn\'t exist on your server (e.g. if you want your store to be available with the URL www.my-prestashop.com/my-store/shoes/, you have to set shoes/ in this field, assuming that my-store/ is your Physical URL).'), '<strong>' . $this->l('URL rewriting must be activated on your server to use this feature.') . '</strong>');
}
$this->fields_form = array(array('form' => array('legend' => array('title' => $this->l('URL options'), 'icon' => 'icon-cogs'), 'input' => array(array('type' => 'select', 'label' => $this->l('Shop'), 'name' => 'id_shop', 'onchange' => 'checkMainUrlInfo(this.value);', 'options' => array('optiongroup' => array('query' => Shop::getTree(), 'label' => 'name'), 'options' => array('query' => 'shops', 'id' => 'id_shop', 'name' => 'name'))), array('type' => 'switch', 'label' => $this->l('Main URL'), 'name' => 'main', 'class' => 't', 'values' => array(array('id' => 'main_on', 'value' => 1), array('id' => 'main_off', 'value' => 0)), 'desc' => array($this->l('If you set this URL as the Main URL for the selected shop, all URLs set to this shop will be redirected to this URL (you can only have one Main URL per shop).'), array('text' => $this->l('Since the selected shop has no main URL, you have to set this URL as the Main URL.'), 'id' => 'mainUrlInfo'), array('text' => $this->l('The selected shop already has a Main URL. Therefore, if you set this one as the Main URL, the older of the two will be set as the normal URL.'), 'id' => 'mainUrlInfoExplain'))), array('type' => 'switch', 'label' => $this->l('Enabled'), 'name' => 'active', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'active_on', 'value' => 1), array('id' => 'active_off', 'value' => 0)))), 'submit' => array('title' => $this->l('Save')))), array('form' => array('legend' => array('title' => $this->l('Shop URL'), 'icon' => 'icon-shopping-cart'), 'input' => array(array('type' => 'text', 'label' => $this->l('Domain'), 'name' => 'domain', 'size' => 50), array('type' => 'text', 'label' => $this->l('Domain SSL'), 'name' => 'domain_ssl', 'size' => 50)), 'submit' => array('title' => $this->l('Save')))));
if (!defined('_PS_HOST_MODE_')) {
$this->fields_form[1]['form']['input'] = array_merge($this->fields_form[1]['form']['input'], array(array('type' => 'text', 'label' => $this->l('Physical URL'), 'name' => 'physical_uri', 'desc' => $this->l('This is the physical folder for your store on the server. Leave this field empty if your store is installed on the root path (e.g. if your store is available at www.my-prestashop.com/my-store/, you input my-store/ in this field).'), 'size' => 50)));
}
$this->fields_form[1]['form']['input'] = array_merge($this->fields_form[1]['form']['input'], array(array('type' => 'text', 'label' => $this->l('Virtual URL'), 'name' => 'virtual_uri', 'desc' => $desc_virtual_uri, 'size' => 50, 'hint' => !$update_htaccess ? $this->l('Warning: URL rewriting (e.g. mod_rewrite for Apache) seems to be disabled. If your URL doesn\'t work, please check with your host provider on how to activate URL rewriting.') : null), array('type' => 'text', 'label' => $this->l('Your final URL will be'), 'name' => 'final_url', 'size' => 76, 'readonly' => true)));
if (!($obj = $this->loadObject(true))) {
return;
}
self::$currentIndex = self::$currentIndex . '&id_shop=' . $obj->id;
$current_shop = Shop::initialize();
$list_shop_with_url = array();
foreach (Shop::getShops(false, null, true) as $id) {
$list_shop_with_url[$id] = (bool) count(ShopUrl::getShopUrls($id));
}
$this->tpl_form_vars = array('js_shop_url' => Tools::jsonEncode($list_shop_with_url));
$this->fields_value = array('domain' => Validate::isLoadedObject($obj) ? $this->getFieldValue($obj, 'domain') : $current_shop->domain, 'domain_ssl' => Validate::isLoadedObject($obj) ? $this->getFieldValue($obj, 'domain_ssl') : $current_shop->domain_ssl, 'physical_uri' => Validate::isLoadedObject($obj) ? $this->getFieldValue($obj, 'physical_uri') : $current_shop->physical_uri, 'active' => true);
return parent::renderForm();
}
示例9: renderForm
public function renderForm()
{
// loads current warehouse
if (!($obj = $this->loadObject(true))) {
return;
}
$image = _PS_SUPP_IMG_DIR_ . $obj->id . '.jpg';
$image_url = ImageManager::thumbnail($image, $this->table . '_' . (int) $obj->id . '.' . $this->imageType, 350, $this->imageType, true, true);
$image_size = file_exists($image) ? filesize($image) / 1000 : false;
$tmp_addr = new Address();
$res = $tmp_addr->getFieldsRequiredDatabase();
$required_fields = array();
foreach ($res as $row) {
$required_fields[(int) $row['id_required_field']] = $row['field_name'];
}
$this->fields_form = array('legend' => array('title' => $this->l('Suppliers'), 'icon' => 'icon-truck'), 'input' => array(array('type' => 'hidden', 'name' => 'id_address'), array('type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'required' => true, 'col' => 4, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), in_array('company', $required_fields) ? array('type' => 'text', 'label' => $this->l('Company'), 'name' => 'company', 'display' => in_array('company', $required_fields), 'required' => in_array('company', $required_fields), 'maxlength' => 16, 'col' => 4, 'hint' => $this->l('Company name for this supplier')) : null, array('type' => 'textarea', 'label' => $this->l('Description'), 'name' => 'description', 'lang' => true, 'hint' => array($this->l('Invalid characters:') . ' <>;=#{}', $this->l('Will appear in the list of suppliers.')), 'autoload_rte' => 'rte'), array('type' => 'text', 'label' => $this->l('Phone'), 'name' => 'phone', 'required' => in_array('phone', $required_fields), 'maxlength' => 16, 'col' => 4, 'hint' => $this->l('Phone number for this supplier')), array('type' => 'text', 'label' => $this->l('Mobile phone'), 'name' => 'phone_mobile', 'required' => in_array('phone_mobile', $required_fields), 'maxlength' => 16, 'col' => 4, 'hint' => $this->l('Mobile phone number for this supplier.')), array('type' => 'text', 'label' => $this->l('Address'), 'name' => 'address', 'maxlength' => 128, 'col' => 6, 'required' => true), array('type' => 'text', 'label' => $this->l('Address') . ' (2)', 'name' => 'address2', 'required' => in_array('address2', $required_fields), 'col' => 6, 'maxlength' => 128), array('type' => 'text', 'label' => $this->l('Zip/postal code'), 'name' => 'postcode', 'required' => in_array('postcode', $required_fields), 'maxlength' => 12, 'col' => 2), array('type' => 'text', 'label' => $this->l('City'), 'name' => 'city', 'maxlength' => 32, 'col' => 4, 'required' => true), array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'required' => true, 'col' => 4, 'default_value' => (int) $this->context->country->id, 'options' => array('query' => Country::getCountries($this->context->language->id, false), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('State'), 'name' => 'id_state', 'col' => 4, 'options' => array('id' => 'id_state', 'query' => array(), 'name' => 'name')), array('type' => 'file', 'label' => $this->l('Logo'), 'name' => 'logo', 'display_image' => true, 'image' => $image_url ? $image_url : false, 'size' => $image_size, 'hint' => $this->l('Upload a supplier logo from your computer.')), array('type' => 'text', 'label' => $this->l('Meta title'), 'name' => 'meta_title', 'lang' => true, 'col' => 4, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}'), array('type' => 'text', 'label' => $this->l('Meta description'), 'name' => 'meta_description', 'lang' => true, 'col' => 6, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}'), array('type' => 'tags', 'label' => $this->l('Meta keywords'), 'name' => 'meta_keywords', 'lang' => true, 'col' => 6, 'hint' => array($this->l('To add "tags" click in the field, write something and then press "Enter".'), $this->l('Forbidden characters:') . ' <>;=#{}')), array('type' => 'switch', 'label' => $this->l('Enable'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))))), 'submit' => array('title' => $this->l('Save')));
// loads current address for this supplier - if possible
$address = null;
if (isset($obj->id)) {
$id_address = Address::getAddressIdBySupplierId($obj->id);
if ($id_address > 0) {
$address = new Address((int) $id_address);
}
}
// force specific fields values (address)
if ($address != null) {
$this->fields_value = array('id_address' => $address->id, 'phone' => $address->phone, 'phone_mobile' => $address->phone_mobile, 'address' => $address->address1, 'address2' => $address->address2, 'postcode' => $address->postcode, 'city' => $address->city, 'id_country' => $address->id_country, 'id_state' => $address->id_state);
} else {
$this->fields_value = array('id_address' => 0, 'id_country' => Configuration::get('PS_COUNTRY_DEFAULT'));
}
if (Shop::isFeatureActive()) {
$this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association'), 'name' => 'checkBoxShopAsso');
}
return parent::renderForm();
}
示例10: renderForm
/**
* AdminController::renderForm() override
* @see AdminController::renderForm()
*/
public function renderForm()
{
$current_profile = (int) $this->getCurrentProfileId();
$profiles = Profile::getProfiles($this->context->language->id);
$tabs = Tab::getTabs($this->context->language->id);
$accesses = array();
foreach ($profiles as $profile) {
$accesses[$profile['id_profile']] = Profile::getProfileAccesses($profile['id_profile']);
}
// Deleted id_tab that do not have access
foreach ($tabs as $key => $tab) {
// Don't allow permissions for unnamed tabs (ie. AdminLogin)
if (empty($tab['name'])) {
unset($tabs[$key]);
}
foreach ($this->accesses_black_list as $id_tab) {
if ($tab['id_tab'] == (int) $id_tab) {
unset($tabs[$key]);
}
}
}
$modules = array();
foreach ($profiles as $profile) {
$modules[$profile['id_profile']] = Module::getModulesAccessesByIdProfile($profile['id_profile']);
uasort($modules[$profile['id_profile']], array($this, 'sortModuleByName'));
}
$this->fields_form = array('');
$this->tpl_form_vars = array('profiles' => $profiles, 'accesses' => $accesses, 'id_tab_parentmodule' => (int) Tab::getIdFromClassName('AdminParentModules'), 'id_tab_module' => (int) Tab::getIdFromClassName('AdminModules'), 'tabs' => $this->displayTabs($tabs), 'current_profile' => (int) $current_profile, 'admin_profile' => (int) _PS_ADMIN_PROFILE_, 'access_edit' => $this->access('edit'), 'perms' => array('view', 'add', 'edit', 'delete'), 'modules' => $modules, 'link' => $this->context->link);
return parent::renderForm();
}
示例11: renderForm
public function renderForm()
{
$this->fields_form = array('legend' => array('title' => $this->l('Addresses'), 'icon' => 'icon-envelope-alt'), 'input' => array(array('type' => 'text_customer', 'label' => $this->l('Customer'), 'name' => 'id_customer', 'required' => false), array('type' => 'text', 'label' => $this->l('Identification Number'), 'name' => 'dni', 'required' => false, 'col' => '4', 'hint' => $this->l('DNI / NIF / NIE')), array('type' => 'text', 'label' => $this->l('Floor'), 'name' => 'floor', 'required' => true, 'col' => '4', 'hint' => $this->l('Floor')), array('type' => 'text', 'label' => $this->l('Lift'), 'name' => 'lift', 'required' => true, 'col' => '4', 'hint' => $this->l('Lift')), array('type' => 'text', 'label' => $this->l('Code_intercom'), 'name' => 'code_intercom', 'required' => false, 'col' => '4', 'hint' => $this->l('Code_intercom')), array('type' => 'text', 'label' => $this->l('Address alias'), 'name' => 'alias', 'required' => true, 'col' => '4', 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'textarea', 'label' => $this->l('Other'), 'name' => 'other', 'required' => false, 'cols' => 15, 'rows' => 3, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}')), 'submit' => array('title' => $this->l('Save')));
$id_customer = (int) Tools::getValue('id_customer');
if (!$id_customer && Validate::isLoadedObject($this->object)) {
$id_customer = $this->object->id_customer;
}
if ($id_customer) {
$customer = new Customer((int) $id_customer);
$token_customer = Tools::getAdminToken('AdminCustomers' . (int) Tab::getIdFromClassName('AdminCustomers') . (int) $this->context->employee->id);
}
$this->tpl_form_vars = array('customer' => isset($customer) ? $customer : null, 'tokenCustomer' => isset($token_customer) ? $token_customer : null);
// Order address fields depending on country format
$addresses_fields = $this->processAddressFormat();
// we use delivery address
$addresses_fields = $addresses_fields['dlv_all_fields'];
// get required field
$required_fields = AddressFormat::getFieldsRequired();
// Merge with field required
$addresses_fields = array_unique(array_merge($addresses_fields, $required_fields));
$temp_fields = array();
foreach ($addresses_fields as $addr_field_item) {
if ($addr_field_item == 'company') {
$temp_fields[] = array('type' => 'text', 'label' => $this->l('Company'), 'name' => 'company', 'required' => in_array('company', $required_fields), 'col' => '4', 'hint' => $this->l('Invalid characters:') . ' <>;=#{}');
$temp_fields[] = array('type' => 'text', 'label' => $this->l('VAT number'), 'col' => '2', 'name' => 'vat_number', 'required' => in_array('vat_number', $required_fields));
} elseif ($addr_field_item == 'lastname') {
if (isset($customer) && !Tools::isSubmit('submit' . strtoupper($this->table)) && Validate::isLoadedObject($customer) && !Validate::isLoadedObject($this->object)) {
$default_value = $customer->lastname;
} else {
$default_value = '';
}
$temp_fields[] = array('type' => 'text', 'label' => $this->l('Last Name'), 'name' => 'lastname', 'required' => in_array('lastname', $required_fields), 'col' => '4', 'hint' => $this->l('Invalid characters:') . ' 0-9!&lt;&gt;,;?=+()@#"�{}_$%:', 'default_value' => $default_value);
} elseif ($addr_field_item == 'firstname') {
if (isset($customer) && !Tools::isSubmit('submit' . strtoupper($this->table)) && Validate::isLoadedObject($customer) && !Validate::isLoadedObject($this->object)) {
$default_value = $customer->firstname;
} else {
$default_value = '';
}
$temp_fields[] = array('type' => 'text', 'label' => $this->l('First Name'), 'name' => 'firstname', 'required' => in_array('firstname', $required_fields), 'col' => '4', 'hint' => $this->l('Invalid characters:') . ' 0-9!&lt;&gt;,;?=+()@#"�{}_$%:', 'default_value' => $default_value);
} elseif ($addr_field_item == 'address1') {
$temp_fields[] = array('type' => 'text', 'label' => $this->l('Address'), 'name' => 'address1', 'col' => '6', 'required' => in_array('address1', $required_fields));
} elseif ($addr_field_item == 'address2') {
$temp_fields[] = array('type' => 'text', 'label' => $this->l('Address') . ' (2)', 'name' => 'address2', 'col' => '6', 'required' => in_array('address2', $required_fields));
} elseif ($addr_field_item == 'postcode') {
$temp_fields[] = array('type' => 'text', 'label' => $this->l('Zip/Postal Code'), 'name' => 'postcode', 'col' => '2', 'required' => in_array('postcode', $required_fields));
} elseif ($addr_field_item == 'city') {
$temp_fields[] = array('type' => 'text', 'label' => $this->l('City'), 'name' => 'city', 'col' => '4', 'required' => in_array('city', $required_fields));
} elseif ($addr_field_item == 'country' || $addr_field_item == 'Country:name') {
$temp_fields[] = array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'required' => in_array('Country:name', $required_fields) || in_array('country', $required_fields), 'col' => '4', 'default_value' => (int) $this->context->country->id, 'options' => array('query' => Country::getCountries($this->context->language->id), 'id' => 'id_country', 'name' => 'name'));
$temp_fields[] = array('type' => 'select', 'label' => $this->l('State'), 'name' => 'id_state', 'required' => false, 'col' => '4', 'options' => array('query' => array(), 'id' => 'id_state', 'name' => 'name'));
} elseif ($addr_field_item == 'phone') {
$temp_fields[] = array('type' => 'text', 'label' => $this->l('Home phone'), 'name' => 'phone', 'required' => in_array('phone', $required_fields) || Configuration::get('PS_ONE_PHONE_AT_LEAST'), 'col' => '4', 'hint' => Configuration::get('PS_ONE_PHONE_AT_LEAST') ? sprintf($this->l('You must register at least one phone number.')) : '');
} elseif ($addr_field_item == 'phone_mobile') {
$temp_fields[] = array('type' => 'text', 'label' => $this->l('Mobile phone'), 'name' => 'phone_mobile', 'required' => in_array('phone_mobile', $required_fields) || Configuration::get('PS_ONE_PHONE_AT_LEAST'), 'col' => '4', 'hint' => Configuration::get('PS_ONE_PHONE_AT_LEAST') ? sprintf($this->l('You must register at least one phone number.')) : '');
}
}
// merge address format with the rest of the form
array_splice($this->fields_form['input'], 3, 0, $temp_fields);
return AdminController::renderForm();
}
示例12: renderForm
public function renderForm()
{
$this->fields_form = array('legend' => array('title' => $this->l('Contacts'), 'icon' => 'icon-envelope-alt'), 'input' => array(array('type' => 'text', 'label' => $this->l('Title'), 'name' => 'name', 'required' => true, 'lang' => true, 'col' => 4, 'hint' => $this->l('Contact name (e.g. Customer Support).')), array('type' => 'text', 'label' => $this->l('Email address'), 'name' => 'email', 'required' => false, 'col' => 4, 'hint' => $this->l('Emails will be sent to this address.')), array('type' => 'switch', 'label' => $this->l('Save messages?'), 'name' => 'customer_service', 'required' => false, 'class' => 't', 'is_bool' => true, 'hint' => $this->l('If enabled, all messages will be saved in the "Customer Service" page under the "Customer" menu.'), 'values' => array(array('id' => 'customer_service_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'customer_service_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'textarea', 'label' => $this->l('Description'), 'name' => 'description', 'required' => false, 'lang' => true, 'col' => 6, 'hint' => $this->l('Further information regarding this contact.'))), 'submit' => array('title' => $this->l('Save')));
if (Shop::isFeatureActive()) {
$this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association'), 'name' => 'checkBoxShopAsso');
}
return parent::renderForm();
}
示例13: renderForm
public function renderForm()
{
$this->fields_form = array('legend' => array('title' => $this->l('Contacts'), 'image' => '../img/admin/contact.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Title:'), 'name' => 'name', 'size' => 33, 'required' => true, 'lang' => true, 'desc' => $this->l('Contact name (e.g. Technical Support)')), array('type' => 'text', 'label' => $this->l('E-mail address'), 'name' => 'email', 'size' => 33, 'required' => false, 'desc' => $this->l('E-mails will be sent to this address')), array('type' => 'radio', 'label' => $this->l('Save messages?'), 'name' => 'customer_service', 'required' => false, 'class' => 't', 'is_bool' => true, 'desc' => $this->l('If enabled, all messages will be saved in the "Customer Service" page under the "Customer" menu'), 'values' => array(array('id' => 'customer_service_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'customer_service_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'textarea', 'label' => $this->l('Description'), 'name' => 'description', 'required' => false, 'lang' => true, 'cols' => 36, 'rows' => 5, 'desc' => $this->l('Additional information about this contact'))), 'submit' => array('title' => $this->l(' Save '), 'class' => 'button'));
if (Shop::isFeatureActive()) {
$this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso');
}
return parent::renderForm();
}
示例14: renderForm
public function renderForm()
{
$this->fields_form = array('legend' => array('title' => $this->l('Ingredients:'), 'image' => '../img/admin/delivery.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name:'), 'name' => 'name', 'lang' => true, 'size' => 40, 'required' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'text', 'label' => $this->l('Price:'), 'name' => 'price', 'lang' => false, 'size' => 40, 'required' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'text', 'label' => $this->l('Max amount:'), 'name' => 'max_amount', 'size' => 40, 'required' => true)), 'submit' => array('title' => $this->l('Save'), 'class' => 'btn btn-default pull-right'));
if (!($obj = $this->loadObject(true))) {
return;
}
return parent::renderForm();
}
示例15: renderForm
public function renderForm()
{
if (!($obj = $this->loadObject(true))) {
return;
}
$this->fields_form = array('legend' => array('title' => $this->l('Tag')), 'input' => array(array('type' => 'text', 'label' => $this->l('Name:'), 'name' => 'name', 'required' => true), array('type' => 'select', 'label' => $this->l('Language:'), 'name' => 'id_lang', 'required' => true, 'options' => array('query' => Language::getLanguages(false), 'id' => 'id_lang', 'name' => 'name'))), 'selects' => array('products' => $obj->getProducts(true), 'products_unselected' => $obj->getProducts(false)), 'submit' => array('title' => $this->l('Save '), 'class' => 'button'));
return parent::renderForm();
}