本文整理汇总了PHP中AO::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP AO::getConfig方法的具体用法?PHP AO::getConfig怎么用?PHP AO::getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AO
的用法示例。
在下文中一共展示了AO::getConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct(AO::getSingleton('core/resource')->getConnection('directory_read'));
$this->_countryTable = AO::getSingleton('core/resource')->getTableName('directory/country');
$this->_select->from(array('country' => $this->_countryTable));
$this->setItemObjectClass(AO::getConfig()->getModelClassName('directory/country'));
}
示例2: _construct
/**
* Init configuration for webservices api
*
* @return Mage_Api_Model_Config
*/
protected function _construct()
{
if (AO::app()->useCache('config_api')) {
if ($this->loadCache()) {
return $this;
}
}
$mergeConfig = AO::getModel('core/config_base');
$config = AO::getConfig();
$modules = $config->getNode('modules')->children();
// check if local modules are disabled
$disableLocalModules = (string) $config->getNode('global/disable_local_modules');
$disableLocalModules = !empty($disableLocalModules) && ('true' === $disableLocalModules || '1' === $disableLocalModules);
$configFile = $config->getModuleDir('etc', 'Mage_Api') . DS . 'api.xml';
if ($mergeConfig->loadFile($configFile)) {
$config->extend($mergeConfig, true);
}
foreach ($modules as $modName => $module) {
if ($module->is('active')) {
if ($disableLocalModules && 'local' === (string) $module->codePool || $modName == 'Mage_Api') {
continue;
}
$configFile = $config->getModuleDir('etc', $modName) . DS . 'api.xml';
if ($mergeConfig->loadFile($configFile)) {
$config->extend($mergeConfig, true);
}
}
}
$this->setXml($config->getNode('api'));
if (AO::app()->useCache('config_api')) {
$this->saveCache();
}
return $this;
}
示例3: _getCurrencyDefault
/**
* Retrieve Default desplay Currency value for current scope
*
* @return string
*/
protected function _getCurrencyDefault()
{
if (!($value = $this->getData('groups/options/fields/default/value'))) {
$value = AO::getConfig()->getNode(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_DEFAULT, $this->getScope(), $this->getScopeId());
}
return strval($value);
}
示例4: globalSearchAction
public function globalSearchAction()
{
$searchModules = AO::getConfig()->getNode("adminhtml/global_search");
$items = array();
if (!AO::getSingleton('admin/session')->isAllowed('admin/global_search')) {
$items[] = array('id' => 'error', 'type' => 'Error', 'name' => AO::helper('adminhtml')->__('Access Deny'), 'description' => AO::helper('adminhtml')->__('You have not enought permissions to use this functionality.'));
$totalCount = 1;
} else {
if (empty($searchModules)) {
$items[] = array('id' => 'error', 'type' => 'Error', 'name' => AO::helper('adminhtml')->__('No search modules registered'), 'description' => AO::helper('adminhtml')->__('Please make sure that all global admin search modules are installed and activated.'));
$totalCount = 1;
} else {
$start = $this->getRequest()->getParam('start', 1);
$limit = $this->getRequest()->getParam('limit', 10);
$query = $this->getRequest()->getParam('query', '');
foreach ($searchModules->children() as $searchConfig) {
$className = $searchConfig->getClassName();
if (empty($className)) {
continue;
}
$searchInstance = new $className();
$results = $searchInstance->setStart($start)->setLimit($limit)->setQuery($query)->load()->getResults();
$items = array_merge_recursive($items, $results);
}
$totalCount = sizeof($items);
}
}
$block = $this->getLayout()->createBlock('adminhtml/template')->setTemplate('system/autocomplete.phtml')->assign('items', $items);
$this->getResponse()->setBody($block->toHtml());
}
示例5: _prepareLayout
protected function _prepareLayout()
{
parent::_prepareLayout();
$this->getLayout()->createBlock('catalog/breadcrumbs');
if ($headBlock = $this->getLayout()->getBlock('head')) {
if ($title = $this->getCurrentCategory()->getMetaTitle()) {
$headBlock->setTitle($title);
}
if ($description = $this->getCurrentCategory()->getMetaDescription()) {
$headBlock->setDescription($description);
}
if ($keywords = $this->getCurrentCategory()->getMetaKeywords()) {
$headBlock->setKeywords($keywords);
}
/*
want to show rss feed in the url
*/
if ($this->IsRssCatalogEnable() && $this->IsTopCategory()) {
$title = $this->helper('rss')->__('%s RSS Feed', $this->getCurrentCategory()->getName());
$headBlock->addItem('rss', $this->getRssLink(), 'title="' . $title . '"');
}
}
if ($layout = $this->getCurrentCategory()->getPageLayout()) {
if ($template = (string) AO::getConfig()->getNode('global/cms/layouts/' . $layout . '/template')) {
$this->getLayout()->getBlock('root')->setTemplate($template);
}
}
return $this;
}
示例6: loadAclResources
/**
* Load Acl resources from config
*
* @param Mage_Admin_Model_Acl $acl
* @param Mage_Core_Model_Config_Element $resource
* @param string $parentName
* @return Mage_Admin_Model_Config
*/
public function loadAclResources(Mage_Admin_Model_Acl $acl, $resource = null, $parentName = null)
{
if (is_null($resource)) {
$resource = AO::getConfig()->getNode("adminhtml/acl/resources");
$resourceName = null;
} else {
$resourceName = (is_null($parentName) ? '' : $parentName . '/') . $resource->getName();
$acl->add(AO::getModel('admin/acl_resource', $resourceName), $parentName);
}
if (isset($resource->all)) {
$acl->add(AO::getModel('admin/acl_resource', 'all'), null);
}
if (isset($resource->admin)) {
$children = $resource->admin;
} elseif (isset($resource->children)) {
$children = $resource->children->children();
}
if (empty($children)) {
return $this;
}
foreach ($children as $res) {
$this->loadAclResources($acl, $res, $resourceName);
}
return $this;
}
示例7: fetchRatesAction
public function fetchRatesAction()
{
try {
$service = $this->getRequest()->getParam('rate_services');
$this->_getSession()->setCurrencyRateService($service);
if (!$service) {
throw new Exception(AO::helper('adminhtml')->__('Invalid Import Service Specified'));
}
try {
$importModel = AO::getModel(AO::getConfig()->getNode('global/currency/import/services/' . $service . '/model')->asArray());
} catch (Exception $e) {
AO::throwException(AO::helper('adminhtml')->__('Unable to initialize import model'));
}
$rates = $importModel->fetchRates();
$errors = $importModel->getMessages();
if (sizeof($errors) > 0) {
foreach ($errors as $error) {
AO::getSingleton('adminhtml/session')->addWarning($error);
}
AO::getSingleton('adminhtml/session')->addWarning(AO::helper('adminhtml')->__('All possible rates were fetched, click on "Save" to apply'));
} else {
AO::getSingleton('adminhtml/session')->addSuccess(AO::helper('adminhtml')->__('All rates were fetched, click on "Save" to apply'));
}
AO::getSingleton('adminhtml/session')->setRates($rates);
} catch (Exception $e) {
AO::getSingleton('adminhtml/session')->addError($e->getMessage());
}
$this->_redirect('*/*/');
}
示例8: 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;
}
示例9: getFields
public function getFields()
{
if (!$this->_fields) {
$this->_fields = AO::getConfig()->getFieldset('customer_dataflow', 'admin');
}
return $this->_fields;
}
示例10: scheduledUpdateCurrencyRates
public function scheduledUpdateCurrencyRates($schedule)
{
$importWarnings = array();
if (!AO::getStoreConfig(self::IMPORT_ENABLE) || !AO::getStoreConfig(self::CRON_STRING_PATH)) {
return;
}
$service = AO::getStoreConfig(self::IMPORT_SERVICE);
if (!$service) {
$importWarnings[] = AO::helper('directory')->__('FATAL ERROR:') . ' ' . AO::helper('directory')->__('Invalid Import Service Specified');
}
try {
$importModel = AO::getModel(AO::getConfig()->getNode('global/currency/import/services/' . $service . '/model')->asArray());
} catch (Exception $e) {
$importWarnings[] = AO::helper('directory')->__('FATAL ERROR:') . ' ' . AO::throwException(AO::helper('directory')->__('Unable to initialize import model'));
}
$rates = $importModel->fetchRates();
$errors = $importModel->getMessages();
if (sizeof($errors) > 0) {
foreach ($errors as $error) {
$importWarnings[] = AO::helper('directory')->__('WARNING:') . ' ' . $error;
}
}
if (sizeof($importWarnings) == 0) {
AO::getModel('directory/currency')->saveRates($rates);
} else {
$translate = AO::getSingleton('core/translate');
/* @var $translate Mage_Core_Model_Translate */
$translate->setTranslateInline(false);
/* @var $mailTemplate Mage_Core_Model_Email_Template */
$mailTemplate = AO::getModel('core/email_template');
$mailTemplate->setDesignConfig(array('area' => 'frontend'))->sendTransactional(AO::getStoreConfig(self::XML_PATH_ERROR_TEMPLATE), AO::getStoreConfig(self::XML_PATH_ERROR_IDENTITY), AO::getStoreConfig(self::XML_PATH_ERROR_RECIPIENT), null, array('warnings' => join("\n", $importWarnings)));
$translate->setTranslateInline(true);
}
}
示例11: saveAction
public function saveAction()
{
$request = $this->getRequest();
$template = AO::getModel('core/email_template');
if ($id = (int) $request->getParam('id')) {
$template->load($id);
}
try {
$template->setTemplateSubject($request->getParam('template_subject'))->setTemplateCode($request->getParam('template_code'))->setTemplateText($request->getParam('template_text'))->setModifiedAt(AO::getSingleton('core/date')->gmtDate());
if (!$template->getId()) {
$type = constant(AO::getConfig()->getModelClassName('core/email_template') . "::TYPE_HTML");
$template->setTemplateType($type);
}
if ($this->getRequest()->getParam('_change_type_flag')) {
$type = constant(AO::getConfig()->getModelClassName('core/email_template') . "::TYPE_TEXT");
$template->setTemplateType($type);
}
$template->save();
$this->_redirect('*/*');
} catch (Exception $e) {
AO::getSingleton('adminhtml/session')->setData('email_template_form_data', $this->getRequest()->getParams());
AO::getSingleton('adminhtml/session')->addError($e->getMessage());
$this->_forward('new');
}
}
示例12: __construct
public function __construct()
{
parent::__construct(AO::getSingleton('core/resource')->getConnection('core_read'));
$this->_templateTable = AO::getSingleton('core/resource')->getTableName('core/email_template');
$this->_select->from($this->_templateTable, array('template_id', 'template_code', 'template_type', 'template_subject', 'template_sender_name', 'template_sender_email', 'added_at', 'modified_at'));
$this->setItemObjectClass(AO::getConfig()->getModelClassName('core/email_template'));
}
示例13: __construct
public function __construct()
{
parent::__construct(AO::getSingleton('core/resource')->getConnection('admin_read'));
$this->_roleTable = AO::getSingleton('core/resource')->getTableName('admin/role');
$this->_select->from($this->_roleTable);
$this->setItemObjectClass(AO::getConfig()->getModelClassName('admin/acl_role'));
}
示例14: renderPrepare
/**
* Prepare form for render
*/
public function renderPrepare($template)
{
$form = new Varien_Data_Form();
if ($this->getRequest()->isPost()) {
$post = $this->getRequest()->getPost();
if (isset($post['template_id'])) {
unset($post['template_id']);
}
if (isset($post['template_type'])) {
unset($post['template_type']);
}
$template->addData($post);
}
$fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('newsletter')->__('Template Information'), 'class' => 'fieldset-wide'));
$fieldset->addField('code', 'text', array('name' => 'code', 'label' => AO::helper('newsletter')->__('Template Name'), 'title' => AO::helper('newsletter')->__('Template Name'), 'class' => 'required-entry', 'required' => true, 'value' => $template->getTemplateCode()));
$fieldset->addField('subject', 'text', array('name' => 'subject', 'label' => AO::helper('newsletter')->__('Template Subject'), 'title' => AO::helper('newsletter')->__('Template Subject'), 'class' => 'required-entry', 'required' => true, 'value' => $template->getTemplateSubject()));
$fieldset->addField('sender_name', 'text', array('name' => 'sender_name', 'label' => AO::helper('newsletter')->__('Sender Name'), 'title' => AO::helper('newsletter')->__('Sender Name'), 'class' => 'required-entry', 'required' => true, 'value' => $template->getTemplateSenderName()));
$fieldset->addField('sender_email', 'text', array('name' => 'sender_email', 'label' => AO::helper('newsletter')->__('Sender Email'), 'title' => AO::helper('newsletter')->__('Sender Email'), 'class' => 'required-entry validate-email', 'required' => true, 'value' => $template->getTemplateSenderEmail()));
$txtType = constant(AO::getConfig()->getModelClassName('newsletter/template') . '::TYPE_TEXT');
$fieldset->addField('text', 'editor', array('name' => 'text', 'wysiwyg' => $template->getTemplateType() != $txtType, 'label' => AO::helper('newsletter')->__('Template Content'), 'title' => AO::helper('newsletter')->__('Template Content'), 'theme' => 'advanced', 'class' => 'required-entry', 'required' => true, 'state' => 'html', 'value' => $template->getTemplateText(), 'style' => 'height:36em;'));
if ($template->getId()) {
// If edit add id
$form->addField('id', 'hidden', array('name' => 'id', 'value' => $template->getId()));
}
if ($values = AO::getSingleton('adminhtml/session')->getData('newsletter_template_form_data', true)) {
$form->setValues($values);
}
$this->setForm($form);
return $this;
}
示例15: getClassNameByType
public function getClassNameByType($type)
{
if (strpos($type, '/') !== false) {
return AO::getConfig()->getModelClassName($type);
}
return parent::getClassNameByType($type);
}