本文整理汇总了PHP中AO::getBlockSingleton方法的典型用法代码示例。如果您正苦于以下问题:PHP AO::getBlockSingleton方法的具体用法?PHP AO::getBlockSingleton怎么用?PHP AO::getBlockSingleton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AO
的用法示例。
在下文中一共展示了AO::getBlockSingleton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render(Varien_Data_Form_Element_Abstract $element)
{
$html = $this->_getHeaderHtml($element);
$renderer = AO::getBlockSingleton('adminhtml/system_config_form_field');
$attributes = AO::getConfig()->getNode(self::XML_PATH_IMAGE_TYPES)->asArray();
foreach ($attributes as $key => $attribute) {
/**
* Watermark size field
*/
$field = new Varien_Data_Form_Element_Text();
$field->setName("groups[watermark][fields][{$key}_size][value]")->setForm($this->getForm())->setLabel(AO::helper('adminhtml')->__('Size for %s', $attribute['title']))->setRenderer($renderer);
$html .= $field->toHtml();
/**
* Watermark upload field
*/
$field = new Varien_Data_Form_Element_Imagefile();
$field->setName("groups[watermark][fields][{$key}_image][value]")->setForm($this->getForm())->setLabel(AO::helper('adminhtml')->__('Watermark File for %s', $attribute['title']))->setRenderer($renderer);
$html .= $field->toHtml();
/**
* Watermark position field
*/
$field = new Varien_Data_Form_Element_Select();
$field->setName("groups[watermark][fields][{$key}_position][value]")->setForm($this->getForm())->setLabel(AO::helper('adminhtml')->__('Position of Watermark for %s', $attribute['title']))->setRenderer($renderer)->setValues(AO::getSingleton('adminhtml/system_config_source_catalog_product_watermark_position')->toOptionArray());
$html .= $field->toHtml();
}
$html .= $this->_getFooterHtml($element);
return $html;
}
示例2: _getFieldRenderer
protected function _getFieldRenderer()
{
if (empty($this->_fieldRenderer)) {
$this->_fieldRenderer = AO::getBlockSingleton('adminhtml/system_config_form_field');
}
return $this->_fieldRenderer;
}
示例3: _prepareForm
protected function _prepareForm()
{
$model = AO::registry('current_promo_quote_rule');
//$form = new Varien_Data_Form(array('id' => 'edit_form1', 'action' => $this->getData('action'), 'method' => 'post'));
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('rule_');
$renderer = AO::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')->setTemplate('promo/fieldset.phtml')->setNewChildUrl($this->getUrl('*/promo_quote/newConditionHtml/form/rule_conditions_fieldset'));
$fieldset = $form->addFieldset('conditions_fieldset', array('legend' => AO::helper('salesrule')->__('Apply the rule only if the following conditions are met (leave blank for all products)')))->setRenderer($renderer);
$fieldset->addField('conditions', 'text', array('name' => 'conditions', 'label' => AO::helper('salesrule')->__('Conditions'), 'title' => AO::helper('salesrule')->__('Conditions')))->setRule($model)->setRenderer(AO::getBlockSingleton('rule/conditions'));
/*
$fieldset = $form->addFieldset('actions_fieldset', array(
'legend'=>AO::helper('salesrule')->__('Apply the rule to cart items matching the following conditions')
))->setRenderer($renderer);
$fieldset->addField('actions', 'text', array(
'name' => 'actions',
'label' => AO::helper('salesrule')->__('Apply to'),
'title' => AO::helper('salesrule')->__('Apply to'),
'required' => true,
))->setRule($model)->setRenderer(AO::getBlockSingleton('rule/actions'));
*/
$form->setValues($model->getData());
//$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例4: _toHtml
protected function _toHtml()
{
$order = AO::getModel('sales/order');
$passDate = $order->getResource()->formatDate(mktime(0, 0, 0, date('m'), date('d') - 7));
$newurl = AO::helper('adminhtml')->getUrl('adminhtml/sales_order', array('_secure' => true, '_nosecret' => true));
$title = AO::helper('rss')->__('New Orders');
$rssObj = AO::getModel('rss/rss');
$data = array('title' => $title, 'description' => $title, 'link' => $newurl, 'charset' => 'UTF-8');
$rssObj->_addHeader($data);
$collection = $order->getCollection()->addAttributeToFilter('created_at', array('date' => true, 'from' => $passDate))->addAttributeToSort('created_at', 'desc');
$detailBlock = AO::getBlockSingleton('rss/order_details');
AO::getSingleton('core/resource_iterator')->walk($collection->getSelect(), array(array($this, 'addNewOrderXmlCallback')), array('rssObj' => $rssObj, 'order' => $order, 'detailBlock' => $detailBlock));
return $rssObj->createRssXml();
}
示例5: _prepareForm
protected function _prepareForm()
{
$model = AO::registry('current_promo_quote_rule');
//$form = new Varien_Data_Form(array('id' => 'edit_form1', 'action' => $this->getData('action'), 'method' => 'post'));
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('rule_');
$fieldset = $form->addFieldset('action_fieldset', array('legend' => AO::helper('salesrule')->__('Update prices using the following information')));
$fieldset->addField('simple_action', 'select', array('label' => AO::helper('salesrule')->__('Apply'), 'name' => 'simple_action', 'options' => array('by_percent' => AO::helper('salesrule')->__('Percent of product price discount'), 'by_fixed' => AO::helper('salesrule')->__('Fixed amount discount'), 'cart_fixed' => AO::helper('salesrule')->__('Fixed amount discount for whole cart'), 'buy_x_get_y' => AO::helper('salesrule')->__('Buy X get Y free (discount amount is Y)'))));
$fieldset->addField('discount_amount', 'text', array('name' => 'discount_amount', 'required' => true, 'class' => 'validate-not-negative-number', 'label' => AO::helper('salesrule')->__('Discount amount')));
$model->setDiscountAmount($model->getDiscountAmount() * 1);
$fieldset->addField('discount_qty', 'text', array('name' => 'discount_qty', 'label' => AO::helper('salesrule')->__('Maximum Qty Discount is Applied to')));
$model->setDiscountQty($model->getDiscountQty() * 1);
$fieldset->addField('discount_step', 'text', array('name' => 'discount_step', 'label' => AO::helper('salesrule')->__('Discount Qty Step (Buy X)')));
$fieldset->addField('simple_free_shipping', 'select', array('label' => AO::helper('salesrule')->__('Free shipping'), 'title' => AO::helper('salesrule')->__('Free shipping'), 'name' => 'simple_free_shipping', 'options' => array(0 => AO::helper('salesrule')->__('No'), Mage_SalesRule_Model_Rule::FREE_SHIPPING_ITEM => AO::helper('salesrule')->__('For matching items only'), Mage_SalesRule_Model_Rule::FREE_SHIPPING_ADDRESS => AO::helper('salesrule')->__('For shipment with matching items'))));
$fieldset->addField('stop_rules_processing', 'select', array('label' => AO::helper('salesrule')->__('Stop further rules processing'), 'title' => AO::helper('salesrule')->__('Stop further rules processing'), 'name' => 'stop_rules_processing', 'options' => array('1' => AO::helper('salesrule')->__('Yes'), '0' => AO::helper('salesrule')->__('No'))));
$renderer = AO::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')->setTemplate('promo/fieldset.phtml')->setNewChildUrl($this->getUrl('*/promo_quote/newActionHtml/form/rule_actions_fieldset'));
$fieldset = $form->addFieldset('actions_fieldset', array('legend' => AO::helper('salesrule')->__('Apply the rule only to cart items matching the following conditions (leave blank for all items)')))->setRenderer($renderer);
$fieldset->addField('actions', 'text', array('name' => 'actions', 'label' => AO::helper('salesrule')->__('Apply to'), 'title' => AO::helper('salesrule')->__('Apply to'), 'required' => true))->setRule($model)->setRenderer(AO::getBlockSingleton('rule/actions'));
$form->setValues($model->getData());
//$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例6: _prepareForm
protected function _prepareForm()
{
$model = AO::registry('current_promo_catalog_rule');
//$form = new Varien_Data_Form(array('id' => 'edit_form1', 'action' => $this->getData('action'), 'method' => 'post'));
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('rule_');
$renderer = AO::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')->setTemplate('promo/fieldset.phtml')->setNewChildUrl($this->getUrl('*/promo_catalog/newConditionHtml/form/rule_conditions_fieldset'));
$fieldset = $form->addFieldset('conditions_fieldset', array('legend' => AO::helper('catalogrule')->__('Conditions (leave blank for all products)')))->setRenderer($renderer);
$fieldset->addField('conditions', 'text', array('name' => 'conditions', 'label' => AO::helper('catalogrule')->__('Conditions'), 'title' => AO::helper('catalogrule')->__('Conditions'), 'required' => true))->setRule($model)->setRenderer(AO::getBlockSingleton('rule/conditions'));
/*
$fieldset = $form->addFieldset('actions_fieldset', array('legend'=>AO::helper('catalogrule')->__('Actions')));
$fieldset->addField('actions', 'text', array(
'name' => 'actions',
'label' => AO::helper('catalogrule')->__('Actions'),
'title' => AO::helper('catalogrule')->__('Actions'),
'required' => true,
))->setRule($model)->setRenderer(AO::getBlockSingleton('rule/actions'));
$fieldset = $form->addFieldset('options_fieldset', array('legend'=>AO::helper('catalogrule')->__('Options')));
$fieldset->addField('stop_rules_processing', 'select', array(
'label' => AO::helper('catalogrule')->__('Stop further rules processing'),
'title' => AO::helper('catalogrule')->__('Stop further rules processing'),
'name' => 'stop_rules_processing',
'required' => true,
'options' => array(
'1' => AO::helper('catalogrule')->__('Yes'),
'0' => AO::helper('catalogrule')->__('No'),
),
));
*/
$form->setValues($model->getData());
//$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例7: getNewChildElement
public function getNewChildElement()
{
return $this->getForm()->addField('action:' . $this->getId() . ':new_child', 'select', array('name' => 'rule[actions][' . $this->getId() . '][new_child]', 'values' => $this->getNewChildSelectOptions(), 'value_name' => $this->getNewChildName()))->setRenderer(AO::getBlockSingleton('rule/newchild'));
}
示例8: updateModeLayout
/**
* Update layout by specified mode code
*
* @param string $mode
* @return Mage_Adminhtml_Block_Urlrewrite_Edit
* @see Mage_Adminhtml_Block_Urlrewrite_Selector
*/
public function updateModeLayout($mode = null)
{
if (!$mode) {
$modes = array_keys(AO::getBlockSingleton('adminhtml/urlrewrite_selector')->getModes());
$mode = array_shift($modes);
}
// edit form for new custom urlrewrite
if ('id' === $mode) {
$this->_setFormChild();
} elseif ('product' === $mode) {
$this->setChild('products_grid', $this->getLayout()->createBlock('adminhtml/urlrewrite_product_grid'));
} elseif ('category' === $mode) {
$this->setChild('categories_tree', $this->getLayout()->createBlock('adminhtml/urlrewrite_category_tree'));
}
return $this;
}
示例9: _prepareForm
protected function _prepareForm()
{
$rateId = (int) $this->getRequest()->getParam('rate');
$rateObject = new Varien_Object();
$rateModel = AO::getSingleton('tax/calculation_rate');
$rateObject->setData($rateModel->getData());
$form = new Varien_Data_Form();
$countries = AO::getModel('adminhtml/system_config_source_country')->toOptionArray();
unset($countries[0]);
$regionCollection = AO::getModel('directory/region')->getCollection()->addCountryFilter($rateModel->getTaxCountryId());
$regions = $regionCollection->toOptionArray();
if ($regions) {
$regions[0]['label'] = '*';
} else {
$regions = array(array('value' => '', 'label' => '*'));
}
$fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('tax')->__('Tax Rate Information')));
if ($rateObject->getTaxCalculationRateId() > 0) {
$fieldset->addField('tax_calculation_rate_id', 'hidden', array('name' => "tax_calculation_rate_id", 'value' => $rateObject->getTaxCalculationRateId()));
}
$countryId = $rateObject->getTaxCountryId();
if (!$countryId) {
$countryId = AO::getStoreConfig('general/country/default');
}
$fieldset->addField('code', 'text', array('name' => 'code', 'label' => AO::helper('tax')->__('Tax Identifier'), 'title' => AO::helper('tax')->__('Tax Identifier'), 'class' => 'required-entry', 'value' => $rateModel->getCode(), 'required' => true));
$fieldset->addField('tax_country_id', 'select', array('name' => 'tax_country_id', 'label' => AO::helper('tax')->__('Country'), 'title' => AO::helper('tax')->__('Please select Country'), 'class' => 'required-entry', 'required' => true, 'values' => $countries, 'value' => $countryId));
$fieldset->addField('tax_region_id', 'select', array('name' => 'tax_region_id', 'label' => AO::helper('tax')->__('State'), 'title' => AO::helper('tax')->__('Please select State'), 'class' => 'required-entry', 'required' => true, 'values' => $regions, 'value' => $rateObject->getTaxRegionId()));
/* FIXME!!! {*
$fieldset->addField('tax_county_id', 'select',
array(
'name' => 'tax_county_id',
'label' => AO::helper('tax')->__('County'),
'title' => AO::helper('tax')->__('Please select County'),
'values' => array(
array(
'label' => '*',
'value' => ''
)
),
'value' => $rateObject->getTaxCountyId()
)
);
} */
$postcode = $rateObject->getTaxPostcode();
if (!$postcode) {
$postcode = '*';
}
$fieldset->addField('tax_postcode', 'text', array('name' => 'tax_postcode', 'label' => AO::helper('tax')->__('Zip/Post Code'), 'value' => $postcode));
if ($rateObject->getRate()) {
$value = 1 * $rateObject->getRate();
} else {
$value = 0;
}
$fieldset->addField('rate', 'text', array('name' => "rate", 'label' => AO::helper('tax')->__('Rate'), 'title' => AO::helper('tax')->__('Rate'), 'value' => number_format($value, 4), 'required' => true, 'class' => 'validate-not-negative-number required-entry'));
$form->setAction($this->getUrl('*/tax_rate/save'));
$form->setUseContainer(true);
$form->setId('rate_form');
$form->setMethod('post');
if (!AO::app()->isSingleStoreMode()) {
$form->addElement(AO::getBlockSingleton('adminhtml/tax_rate_title_fieldset')->setLegend(AO::helper('tax')->__('Tax Titles')));
}
$this->setForm($form);
return parent::_prepareForm();
}
示例10: initFields
/**
* Init fieldset fields
*
* @param Varien_Data_Form_Element_Fieldset $fieldset
* @param Varien_Simplexml_Element $group
* @param Varien_Simplexml_Element $section
* @param string $fieldPrefix
* @param string $labelPrefix
* @return Mage_Adminhtml_Block_System_Config_Form
*/
public function initFields($fieldset, $group, $section, $fieldPrefix = '', $labelPrefix = '')
{
foreach ($group->fields as $elements) {
$elements = (array) $elements;
usort($elements, array($this, '_sortForm'));
foreach ($elements as $e) {
if (!$this->_canShowField($e)) {
continue;
}
$path = $section->getName() . '/' . $group->getName() . '/' . $fieldPrefix . $e->getName();
$id = $section->getName() . '_' . $group->getName() . '_' . $fieldPrefix . $e->getName();
if (isset($this->_configData[$path])) {
$data = $this->_configData[$path];
$inherit = false;
} else {
$data = $this->_coreConfig->descend($this->_configRoot, $path);
$inherit = true;
}
if ($e->frontend_model) {
$fieldRenderer = AO::getBlockSingleton((string) $e->frontend_model);
} else {
$fieldRenderer = $this->_defaultFieldRenderer;
}
$fieldRenderer->setForm($this);
$fieldRenderer->setConfigData($this->_configData);
$helperName = $this->_configFields->getAttributeModule($section, $group, $e);
$fieldType = (string) $e->frontend_type ? (string) $e->frontend_type : 'text';
$name = 'groups[' . $group->getName() . '][fields][' . $fieldPrefix . $e->getName() . '][value]';
$label = AO::helper($helperName)->__($labelPrefix) . ' ' . AO::helper($helperName)->__((string) $e->label);
$comment = (string) $e->comment ? AO::helper($helperName)->__((string) $e->comment) : '';
if ($e->backend_model) {
$model = AO::getModel((string) $e->backend_model);
if (!$model instanceof Mage_Core_Model_Config_Data) {
AO::throwException('Invalid config field backend model: ' . (string) $e->backend_model);
}
$model->setPath($path)->setValue($data)->afterLoad();
$data = $model->getValue();
}
$field = $fieldset->addField($id, $fieldType, array('name' => $name, 'label' => $label, 'comment' => $comment, 'value' => $data, 'inherit' => $inherit, 'class' => $e->frontend_class, 'field_config' => $e, 'scope' => $this->getScope(), 'scope_id' => $this->getScopeId(), 'can_use_default_value' => $this->canUseDefaultValue((int) $e->show_in_default), 'can_use_website_value' => $this->canUseWebsiteValue((int) $e->show_in_website)));
if (isset($e->frontend_type) && 'multiselect' === (string) $e->frontend_type && isset($e->can_be_empty)) {
$field->setCanBeEmpty(true);
}
$field->setRenderer($fieldRenderer);
if ($e->source_model) {
$sourceModel = AO::getSingleton((string) $e->source_model);
if ($sourceModel instanceof Varien_Object) {
$sourceModel->setPath($path);
}
$field->setValues($sourceModel->toOptionArray($fieldType == 'multiselect'));
}
}
}
return $this;
}
示例11: getValueElementRenderer
public function getValueElementRenderer()
{
if (strpos($this->getValueElementType(), '/') !== false) {
return AO::getBlockSingleton($this->getValueElementType());
}
return AO::getBlockSingleton('rule/editable');
}
示例12: getUrl
/**
* Get filter item url
*
* @return string
*/
public function getUrl()
{
$query = array($this->getFilter()->getRequestVar() => $this->getValue(), AO::getBlockSingleton('page/html_pager')->getPageVarName() => null);
return AO::getUrl('*/*/*', array('_current' => true, '_use_rewrite' => true, '_query' => $query));
}
示例13: getChildrenHtml
public function getChildrenHtml()
{
return AO::getBlockSingleton('adminhtml/tax_rate_title')->toHtml();
}
示例14: categoriesJsonAction
/**
* Ajax categories tree loader action
*
*/
public function categoriesJsonAction()
{
$id = $this->getRequest()->getParam('id', null);
$this->getResponse()->setBody(AO::getBlockSingleton('adminhtml/urlrewrite_category_tree')->getTreeArray($id, true, 1));
}
示例15: getValueElement
public function getValueElement()
{
return $this->getForm()->addField('action:' . $this->getId() . ':value', 'text', array('name' => 'rule[actions][' . $this->getId() . '][value]', 'value' => $this->getValue(), 'value_name' => $this->getValueName()))->setRenderer(AO::getBlockSingleton('rule/editable'));
}