当前位置: 首页>>代码示例>>PHP>>正文


PHP AO::registry方法代码示例

本文整理汇总了PHP中AO::registry方法的典型用法代码示例。如果您正苦于以下问题:PHP AO::registry方法的具体用法?PHP AO::registry怎么用?PHP AO::registry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AO的用法示例。


在下文中一共展示了AO::registry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _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();
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:26,代码来源:Promo_Quote_Edit_Tab_Conditions.php

示例2: _prepareForm

 protected function _prepareForm()
 {
     $model = AO::registry('api_user');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('user_');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('adminhtml')->__('Account Information')));
     if ($model->getUserId()) {
         $fieldset->addField('user_id', 'hidden', array('name' => 'user_id'));
     } else {
         if (!$model->hasData('is_active')) {
             $model->setIsActive(1);
         }
     }
     $fieldset->addField('username', 'text', array('name' => 'username', 'label' => AO::helper('adminhtml')->__('User Name'), 'id' => 'username', 'title' => AO::helper('adminhtml')->__('User Name'), 'required' => true));
     $fieldset->addField('firstname', 'text', array('name' => 'firstname', 'label' => AO::helper('adminhtml')->__('First Name'), 'id' => 'firstname', 'title' => AO::helper('adminhtml')->__('First Name'), 'required' => true));
     $fieldset->addField('lastname', 'text', array('name' => 'lastname', 'label' => AO::helper('adminhtml')->__('Last Name'), 'id' => 'lastname', 'title' => AO::helper('adminhtml')->__('Last Name'), 'required' => true));
     $fieldset->addField('email', 'text', array('name' => 'email', 'label' => AO::helper('adminhtml')->__('Email'), 'id' => 'customer_email', 'title' => AO::helper('adminhtml')->__('User Email'), 'class' => 'required-entry validate-email', 'required' => true));
     if ($model->getUserId()) {
         $fieldset->addField('password', 'password', array('name' => 'new_api_key', 'label' => AO::helper('adminhtml')->__('New Api Key'), 'id' => 'new_pass', 'title' => AO::helper('adminhtml')->__('New Api Key'), 'class' => 'input-text validate-password'));
         $fieldset->addField('confirmation', 'password', array('name' => 'api_key_confirmation', 'label' => AO::helper('adminhtml')->__('Api Key Confirmation'), 'id' => 'confirmation', 'class' => 'input-text validate-cpassword'));
     } else {
         $fieldset->addField('password', 'password', array('name' => 'api_key', 'label' => AO::helper('adminhtml')->__('Api Key'), 'id' => 'customer_pass', 'title' => AO::helper('adminhtml')->__('Api Key'), 'class' => 'input-text required-entry validate-password', 'required' => true));
         $fieldset->addField('confirmation', 'password', array('name' => 'api_key_confirmation', 'label' => AO::helper('adminhtml')->__('Api Key Confirmation'), 'id' => 'confirmation', 'title' => AO::helper('adminhtml')->__('Api Key Confirmation'), 'class' => 'input-text required-entry validate-cpassword', 'required' => true));
     }
     if (AO::getSingleton('admin/session')->getUser()->getId() != $model->getUserId()) {
         $fieldset->addField('is_active', 'select', array('name' => 'is_active', 'label' => AO::helper('adminhtml')->__('This account is'), 'id' => 'is_active', 'title' => AO::helper('adminhtml')->__('Account status'), 'class' => 'input-select', 'style' => 'width: 80px', 'options' => array('1' => AO::helper('adminhtml')->__('Active'), '0' => AO::helper('adminhtml')->__('Inactive'))));
     }
     $fieldset->addField('user_roles', 'hidden', array('name' => 'user_roles', 'id' => '_user_roles'));
     $data = $model->getData();
     unset($data['password']);
     $form->setValues($data);
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:34,代码来源:Api_User_Edit_Tab_Main.php

示例3: getCategory

 public function getCategory()
 {
     if (!$this->_category) {
         $this->_category = AO::registry('category');
     }
     return $this->_category;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:Catalog_Category_Tab_Design.php

示例4: getTag

 public function getTag()
 {
     if (!$this->_tag) {
         $this->_tag = AO::registry('tagModel');
     }
     return $this->_tag;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:Customer_Edit.php

示例5: saveAction

 public function saveAction()
 {
     $this->_initEnityId();
     if ($this->getRequest()->getPost()) {
         try {
             $ratingModel = AO::getModel('rating/rating');
             $stores = $this->getRequest()->getParam('stores');
             $stores[] = 0;
             $ratingModel->setRatingCode($this->getRequest()->getParam('rating_code'))->setRatingCodes($this->getRequest()->getParam('rating_codes'))->setStores($stores)->setId($this->getRequest()->getParam('id'))->setEntityId(AO::registry('entityId'))->save();
             $options = $this->getRequest()->getParam('option_title');
             if (is_array($options)) {
                 $i = 1;
                 foreach ($options as $key => $optionCode) {
                     $optionModel = AO::getModel('rating/rating_option');
                     if (!preg_match("/^add_([0-9]*?)\$/", $key)) {
                         $optionModel->setId($key);
                     }
                     $optionModel->setCode($optionCode)->setValue($i)->setRatingId($ratingModel->getId())->setPosition($i)->save();
                     $i++;
                 }
             }
             AO::getSingleton('adminhtml/session')->addSuccess(AO::helper('adminhtml')->__('Rating was successfully saved'));
             AO::getSingleton('adminhtml/session')->setRatingData(false);
             $this->_redirect('*/*/');
             return;
         } catch (Exception $e) {
             AO::getSingleton('adminhtml/session')->addError($e->getMessage());
             AO::getSingleton('adminhtml/session')->setRatingData($this->getRequest()->getPost());
             $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
             return;
         }
     }
     $this->_redirect('*/*/');
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:34,代码来源:RatingController.php

示例6: __construct

 public function __construct()
 {
     parent::__construct();
     $this->setTemplate('sales/order/details.phtml');
     $this->setOrder(AO::getModel('sales/order')->load($this->getRequest()->getParam('order_id')));
     AO::registry('action')->getLayout()->getBlock('root')->setHeaderTitle(AO::helper('sales')->__('Order Details'));
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:Order_Details.php

示例7: _prepareForm

 protected function _prepareForm()
 {
     $model = AO::registry('cms_block');
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $form->setHtmlIdPrefix('block_');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('cms')->__('General Information'), 'class' => 'fieldset-wide'));
     if ($model->getBlockId()) {
         $fieldset->addField('block_id', 'hidden', array('name' => 'block_id'));
     }
     $fieldset->addField('title', 'text', array('name' => 'title', 'label' => AO::helper('cms')->__('Block Title'), 'title' => AO::helper('cms')->__('Block Title'), 'required' => true));
     $fieldset->addField('identifier', 'text', array('name' => 'identifier', 'label' => AO::helper('cms')->__('Identifier'), 'title' => AO::helper('cms')->__('Identifier'), 'required' => true, 'class' => 'validate-xml-identifier'));
     /**
      * Check is single store mode
      */
     if (!AO::app()->isSingleStoreMode()) {
         $fieldset->addField('store_id', 'multiselect', array('name' => 'stores[]', 'label' => AO::helper('cms')->__('Store View'), 'title' => AO::helper('cms')->__('Store View'), 'required' => true, 'values' => AO::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
     } else {
         $fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => AO::app()->getStore(true)->getId()));
         $model->setStoreId(AO::app()->getStore(true)->getId());
     }
     $fieldset->addField('is_active', 'select', array('label' => AO::helper('cms')->__('Status'), 'title' => AO::helper('cms')->__('Status'), 'name' => 'is_active', 'required' => true, 'options' => array('1' => AO::helper('cms')->__('Enabled'), '0' => AO::helper('cms')->__('Disabled'))));
     $fieldset->addField('content', 'editor', array('name' => 'content', 'label' => AO::helper('cms')->__('Content'), 'title' => AO::helper('cms')->__('Content'), 'style' => 'height:36em', 'wysiwyg' => false, 'required' => true));
     $form->setValues($model->getData());
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:27,代码来源:Cms_Block_Edit_Form.php

示例8: _prepareLayout

 /**
  * Prepare form for render
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $form = new Varien_Data_Form();
     $customerGroup = AO::registry('current_group');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('customer')->__('Group Information')));
     $name = $fieldset->addField('customer_group_code', 'text', array('name' => 'code', 'label' => AO::helper('customer')->__('Group Name'), 'title' => AO::helper('customer')->__('Group Name'), 'class' => 'required-entry', 'required' => true));
     if ($customerGroup->getId() == 0 && $customerGroup->getCustomerGroupCode()) {
         $name->setDisabled(true);
     }
     $fieldset->addField('tax_class_id', 'select', array('name' => 'tax_class', 'label' => AO::helper('customer')->__('Tax class'), 'title' => AO::helper('customer')->__('Tax class'), 'class' => 'required-entry', 'required' => true, 'values' => AO::getSingleton('tax/class_source_customer')->toOptionArray()));
     if (!is_null($customerGroup->getId())) {
         // If edit add id
         $form->addField('id', 'hidden', array('name' => 'id', 'value' => $customerGroup->getId()));
     }
     if (AO::getSingleton('adminhtml/session')->getCustomerGroupData()) {
         $form->addValues(AO::getSingleton('adminhtml/session')->getCustomerGroupData());
         AO::getSingleton('adminhtml/session')->setCustomerGroupData(null);
     } else {
         $form->addValues($customerGroup->getData());
     }
     $form->setUseContainer(true);
     $form->setId('edit_form');
     $form->setAction($this->getUrl('*/*/save'));
     $this->setForm($form);
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:29,代码来源:Customer_Group_Edit_Form.php

示例9: _prepareForm

 /**
  * Prepare form fields
  *
  * @return Mage_Adminhtml_Block_Catalog_Search_Edit_Form
  */
 protected function _prepareForm()
 {
     $model = AO::registry('current_catalog_search');
     /* @var $model Mage_CatalogSearch_Model_Query */
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('catalog')->__('General Information')));
     $yesno = array(array('value' => 0, 'label' => AO::helper('catalog')->__('No')), array('value' => 1, 'label' => AO::helper('catalog')->__('Yes')));
     if ($model->getId()) {
         $fieldset->addField('query_id', 'hidden', array('name' => 'query_id'));
     }
     $fieldset->addField('query_text', 'text', array('name' => 'query_text', 'label' => AO::helper('catalog')->__('Search Query'), 'title' => AO::helper('catalog')->__('Search Query'), 'required' => true));
     if (!AO::app()->isSingleStoreMode()) {
         $fieldset->addField('store_id', 'select', array('name' => 'store_id', 'label' => AO::helper('catalog')->__('Store'), 'title' => AO::helper('catalog')->__('Store'), 'values' => AO::getSingleton('adminhtml/system_store')->getStoreValuesForForm(true, false), 'required' => true));
     } else {
         $fieldset->addField('store_id', 'hidden', array('name' => 'store_id'));
         $model->setStoreId(AO::app()->getStore(true)->getId());
     }
     if ($model->getId()) {
         $fieldset->addField('num_results', 'text', array('name' => 'num_results', 'label' => AO::helper('catalog')->__('Number of results<br/>(For last time placed)'), 'title' => AO::helper('catalog')->__('Number of results<br/>(For last time placed)'), 'required' => true));
         $fieldset->addField('popularity', 'text', array('name' => 'popularity', 'label' => AO::helper('catalog')->__('Number of Uses'), 'title' => AO::helper('catalog')->__('Number of Uses'), 'required' => true));
     }
     $afterElementHtml = '<p class="nm"><small>' . AO::helper('catalog')->__('(Will make search for the query above return results for this search.)') . '</small></p>';
     $fieldset->addField('synonim_for', 'text', array('name' => 'synonim_for', 'label' => AO::helper('catalog')->__('Synonym For'), 'title' => AO::helper('catalog')->__('Synonym For'), 'after_element_html' => $afterElementHtml));
     $afterElementHtml = '<p class="nm"><small>' . AO::helper('catalog')->__('ex. http://domain.com') . '</small></p>';
     $fieldset->addField('redirect', 'text', array('name' => 'redirect', 'label' => AO::helper('catalog')->__('Redirect URL'), 'title' => AO::helper('catalog')->__('Redirect URL'), 'after_element_html' => $afterElementHtml));
     $fieldset->addField('display_in_terms', 'select', array('name' => 'display_in_terms', 'label' => AO::helper('catalog')->__('Display in Suggested Terms'), 'title' => AO::helper('catalog')->__('Display in Suggested Terms'), 'values' => $yesno));
     $form->setValues($model->getData());
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:36,代码来源:Catalog_Search_Edit_Form.php

示例10: _getProductCollection

 /**
  * Retrieve loaded category collection
  *
  * @return Mage_Eav_Model_Entity_Collection_Abstract
  */
 protected function _getProductCollection()
 {
     if (is_null($this->_productCollection)) {
         $layer = AO::getSingleton('catalog/layer');
         /* @var $layer Mage_Catalog_Model_Layer */
         if ($this->getShowRootCategory()) {
             $this->setCategoryId(AO::app()->getStore()->getRootCategoryId());
         }
         // if this is a product view page
         if (AO::registry('product')) {
             // get collection of categories this product is associated with
             $categories = AO::registry('product')->getCategoryCollection()->setPage(1, 1)->load();
             // if the product is associated with any category
             if ($categories->count()) {
                 // show products from this category
                 $this->setCategoryId(current($categories->getIterator()));
             }
         }
         $origCategory = null;
         if ($this->getCategoryId()) {
             $category = AO::getModel('catalog/category')->load($this->getCategoryId());
             if ($category->getId()) {
                 $origCategory = $layer->getCurrentCategory();
                 $layer->setCurrentCategory($category);
             }
         }
         $this->_productCollection = $layer->getProductCollection();
         $this->prepareSortableFieldsByCategory($layer->getCurrentCategory());
         if ($origCategory) {
             $layer->setCurrentCategory($origCategory);
         }
     }
     return $this->_productCollection;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:39,代码来源:Product_List.php

示例11: _prepareForm

 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     /**
      * Initialize product object as form property
      * for using it in elements generation
      */
     $form->setDataObject(AO::registry('product'));
     $fieldset = $form->addFieldset('group_fields', array());
     $attributes = $this->getGroupAttributes();
     $this->_setFieldset($attributes, $fieldset, array('gallery'));
     $values = AO::registry('product')->getData();
     /**
      * Set attribute default values for new product
      */
     if (!AO::registry('product')->getId()) {
         foreach ($attributes as $attribute) {
             if (!isset($values[$attribute->getAttributeCode()])) {
                 $values[$attribute->getAttributeCode()] = $attribute->getDefaultValue();
             }
         }
     }
     AO::dispatchEvent('adminhtml_catalog_product_edit_prepare_form', array('form' => $form));
     $form->addValues($values);
     $form->setFieldNameSuffix('product');
     $this->setForm($form);
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:27,代码来源:Catalog_Product_Attribute_New_Product_Attributes.php

示例12: sendAction

 public function sendAction()
 {
     $product = $this->_initProduct();
     $this->_initSendToFriendModel();
     if (!$product || !$product->isVisibleInCatalog()) {
         $this->_forward('noRoute');
         return;
     }
     $productHelper = AO::helper('catalog/product');
     $sendToFriendModel = AO::registry('send_to_friend_model');
     /**
      * check if user is allowed to send product to a friend
      */
     if (!$sendToFriendModel->canEmailToFriend()) {
         AO::getSingleton('catalog/session')->addError($this->__('You cannot email this product to a friend'));
         $this->_redirectReferer($product->getProductUrl());
         return;
     }
     $maxSendsToFriend = $sendToFriendModel->getMaxSendsToFriend();
     if ($maxSendsToFriend) {
         AO::getSingleton('catalog/session')->addNotice($this->__('You cannot send more than %d times in an hour', $maxSendsToFriend));
     }
     $this->loadLayout();
     $this->_initLayoutMessages('catalog/session');
     $this->renderLayout();
     AO::dispatchEvent('sendfriend_product', array('product' => $product));
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:27,代码来源:ProductController.php

示例13: getWishlistCustomer

 public function getWishlistCustomer()
 {
     if (is_null($this->_customer)) {
         $this->_customer = AO::getModel('customer/customer')->load(AO::registry('shared_wishlist')->getCustomerId());
     }
     return $this->_customer;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:Share_Wishlist.php

示例14: _initRule

 protected function _initRule()
 {
     AO::register('current_promo_quote_rule', AO::getModel('salesrule/rule'));
     if ($id = (int) $this->getRequest()->getParam('id')) {
         AO::registry('current_promo_quote_rule')->load($id);
     }
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:QuoteController.php

示例15: _beforeToHtml

 public function _beforeToHtml()
 {
     $this->_currency = AO::getModel('directory/currency')->load(AO::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE));
     $this->_collection = AO::getResourceModel('sales/sale_collection')->setCustomerFilter(AO::registry('current_customer'))->load();
     $this->_groupedCollection = array();
     foreach ($this->_collection as $sale) {
         if (!is_null($sale->getStoreId())) {
             $store = AO::app()->getStore($sale->getStoreId());
             $websiteId = $store->getWebsiteId();
             $groupId = $store->getGroupId();
             $storeId = $store->getId();
             $sale->setWebsiteId($store->getWebsiteId());
             $sale->setWebsiteName($store->getWebsite()->getName());
             $sale->setGroupId($store->getGroupId());
             $sale->setGroupName($store->getGroup()->getName());
         } else {
             $websiteId = 0;
             $groupId = 0;
             $storeId = 0;
             $sale->setStoreName(AO::helper('customer')->__('Deleted Stores'));
         }
         $this->_groupedCollection[$websiteId][$groupId][$storeId] = $sale;
         $this->_websiteCounts[$websiteId] = isset($this->_websiteCounts[$websiteId]) ? $this->_websiteCounts[$websiteId] + 1 : 1;
     }
     return parent::_beforeToHtml();
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:26,代码来源:Customer_Edit_Tab_View_Sales.php


注:本文中的AO::registry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。