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


PHP Varien_Object::addData方法代码示例

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


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

示例1: getConfig

 /**
  * Return Wysiwyg config as Varien_Object
  *
  * Config options description:
  *
  * enabled:                 Enabled Visual Editor or not
  * hidden:                  Show Visual Editor on page load or not
  * use_container:           Wrap Editor contents into div or not
  * no_display:              Hide Editor container or not (related to use_container)
  * translator:              Helper to translate phrases in lib
  * files_browser_*:         Files Browser (media, images) settings
  * encode_directives:       Encode template directives with JS or not
  *
  * @param $data array       constructor params to override default config values
  * @return Varien_Object
  */
 public function getConfig($data = array())
 {
     $config = new Varien_Object();
     $config->setData(array('enabled' => $this->isEnabled(), 'hidden' => $this->isHidden(), 'use_container' => false, 'add_variables' => true, 'add_widgets' => true, 'no_display' => false, 'translator' => Mage::helper('cms'), 'encode_directives' => true, 'directives_url' => Mage::getSingleton('adminhtml/url')->getUrl('*/cms_wysiwyg/directive'), 'popup_css' => Mage::getBaseUrl('js') . 'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/dialog.css', 'content_css' => Mage::getBaseUrl('js') . 'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/content.css', 'width' => '100%', 'plugins' => array()));
     $config->setData('directives_url_quoted', preg_quote($config->getData('directives_url')));
     if (Mage::getSingleton('admin/session')->isAllowed('cms/media_gallery')) {
         $config->addData(array('add_images' => true, 'files_browser_window_url' => Mage::getSingleton('adminhtml/url')->getUrl('*/cms_wysiwyg_images/index'), 'files_browser_window_width' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_width'), 'files_browser_window_height' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_height')));
     }
     if (is_array($data)) {
         $config->addData($data);
     }
     Mage::dispatchEvent('cms_wysiwyg_config_prepare', array('config' => $config));
     return $config;
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:30,代码来源:Config.php

示例2: _prepareForm

 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $dataObj = new Varien_Object(array('store_id' => '', 'store_name_in_store' => '', 'status_in_store' => '', 'description_in_store' => '', 'address_in_store' => '', 'city_in_store' => ''));
     if (Mage::getSingleton('adminhtml/session')->getStoreData()) {
         $data = Mage::getSingleton('adminhtml/session')->getStoreData();
         Mage::getSingleton('adminhtml/session')->setStoreData(null);
     } elseif (Mage::registry('store_data')) {
         $data = Mage::registry('store_data')->getData();
     }
     if (isset($data)) {
         $dataObj->addData($data);
     }
     if ($dataObj->getStoreId()) {
         $warehouse = Mage::getResourceModel('inventoryplus/warehouse_collection')->addFieldToFilter('storepickup_id', $dataObj->getStoreId())->getFirstItem();
         $dataObj->setData('warehouse_id', $warehouse->getId());
         $dataObj->setData('curr_warehouse_id', $warehouse->getId());
     }
     $this->setForm($form);
     $fieldset = $form->addFieldset('store_form', array('legend' => Mage::helper('storepickup')->__('Warehouse Information')));
     $fieldset->addField('warehouse_id', 'select', array('label' => Mage::helper('storepickup')->__('Linked Warehouse'), 'name' => 'warehouse_id', 'values' => $this->getWarehouseOptions(), 'onchange' => 'imStorePickup.changeWarehouse(this);', 'note' => $this->__('If you choose a warehouse, this Store information will be imported from the warehouse after saved.')));
     $fieldset->addField('curr_warehouse_id', 'hidden', array('name' => 'curr_warehouse_id'));
     if (Mage::getSingleton('adminhtml/session')->getStoreData()) {
         $form->setValues(Mage::getSingleton('adminhtml/session')->getStoreData());
         Mage::getSingleton('adminhtml/session')->setStoreData(null);
     } elseif (Mage::registry('store_data')) {
         $form->setValues($dataObj->getData());
     }
     parent::_prepareForm();
 }
开发者ID:javik223,项目名称:Evron-Magento,代码行数:30,代码来源:Selectwarehouse.php

示例3: getSearchResultCollection

 private function getSearchResultCollection()
 {
     $collection = new Varien_Data_Collection();
     $index = Mage::helper('searchindex/index')->getIndex('mage_catalog_product');
     $storeId = $this->getStoreId();
     if (($query = $this->getRequest()->getParam('q')) && $index) {
         $engine = Mage::helper('searchindex')->getSearchEngine();
         $start = microtime(true);
         try {
             $result = $engine->query($query, $storeId, $index);
         } catch (Exception $e) {
             try {
                 $engine = Mage::getModel('searchsphinx/engine_fulltext');
                 $result = $engine->query($query, $storeId, $index);
             } catch (Exception $e) {
                 Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
                 $result = array();
             }
         }
         $end = microtime(true);
         $this->searchTime = round($end - $start, 4);
         foreach ($result as $productId => $relevance) {
             $varienObject = new Varien_Object();
             $varienObject->addData(array('id' => $productId, 'relevance' => $relevance));
             $collection->addItem($varienObject);
         }
         $this->resultSize = $collection->getSize();
     }
     return $collection;
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:30,代码来源:Speed.php

示例4: orderLocation

 /**
  * Adds GeoIP location html to order view
  *
  * @param Varien_Event_Observer $observer
  * @return MageWorx_CustomerLocation_Model_Observer
  */
 public function orderLocation(Varien_Event_Observer $observer)
 {
     if (Mage::helper('mageworx_geolocation')->isEnabledForOrders()) {
         $_order = null;
         $block = $observer->getEvent()->getBlock();
         $controller = Mage::app()->getRequest()->getControllerName();
         if ($block instanceof Mage_Adminhtml_Block_Sales_Order_View_Info && $controller == 'sales_order') {
             $_order = $block->getOrder();
         } else {
             if ($block instanceof Mage_Adminhtml_Block_Sales_Order_Shipment_View_Form && $controller == 'sales_order_shipment') {
                 $_order = $block->getShipment()->getOrder();
             } else {
                 if ($block instanceof Mage_Adminhtml_Block_Sales_Order_Invoice_View_Form && $controller == 'sales_order_invoice') {
                     $_order = $block->getInvoice()->getOrder();
                 }
             }
         }
         if (!is_null($_order)) {
             $ip = $_order->getRemoteIp();
             if (!$ip) {
                 return $this;
             }
             $geoIpObj = Mage::getModel('mageworx_geoip/geoip')->getLocation($ip);
             if ($geoIpObj->getCode()) {
                 $obj = new Varien_Object();
                 $obj->addData(array('geo_ip' => $geoIpObj, 'ip' => $ip));
                 $block->getOrder()->setRemoteIp(Mage::helper('mageworx_geolocation')->getGeoIpHtml($obj));
             }
         }
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:MyMagento,代码行数:38,代码来源:Observer.php

示例5: extractDataFromFile

 /**
  * Extracts information from report's filepath
  *
  * @param string $filepath
  * @return Varien_Object
  */
 public function extractDataFromFile($filepath)
 {
     // Read the unserialize content of the file
     $content = unserialize(file_get_contents($filepath));
     // Loop through the array
     foreach ($content as $key => $value) {
         // Value with key = 0 is always the error message
         if (!$key) {
             $error = $value;
         } elseif ($key == "url") {
             $url = $value;
         } elseif ($key == "script_name") {
             $script_name = $value;
         } elseif ($key == "skin") {
             $skin = $value;
         } else {
             // The trace has the key = 1, we do it last
             $trace = $value;
         }
     }
     // Create the result object
     $result = new Varien_Object();
     $result->addData(array('error' => $error ? $error : "", 'url' => $url ? $url : "", 'script_name' => $script_name ? $script_name : "", 'skin' => $skin ? $skin : "", 'trace' => $trace ? $trace : "", 'time' => filemtime($filepath)));
     return $result;
 }
开发者ID:digitalpianism,项目名称:reportsviewer,代码行数:31,代码来源:Data.php

示例6: getLastVisits

 /**
  * Loads the data from the Piwik instance and
  * ass assembles a collection with the live 
  * users.
  * 
  * @param array $params 
  * 		Array with additional params for requesting the Piwik API
  * @return Varien_Data_Collection The collection with the live users
  */
 public function getLastVisits(array $params)
 {
     try {
         // load the data and decode it
         $phpNative = $this->decode($params);
         // initialize the collection
         foreach ($phpNative as $date => $values) {
             // initialize an empty object
             $obj = new Varien_Object();
             // pass the data
             if (is_array($values)) {
                 $obj->addData($values);
             }
             // add the object to the collection
             $this->_collection->addItem($obj);
         }
     } catch (Exception $e) {
         // log the exception
         Mage::logException($e);
         // add an error to the session
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('piwik')->__('900.error.invalid.piwik-configuration'));
     }
     // return the collection
     return $this->_collection;
 }
开发者ID:BGCX067,项目名称:faett-piwik-svn-to-git,代码行数:34,代码来源:Live.php

示例7: popupajaxAction

 public function popupajaxAction()
 {
     $response = new Varien_Object();
     $response->setError(0);
     try {
         $pageName = $this->getRequest()->getParam('page');
         if (!$pageName) {
             throw new Exception($this->__('PageType not found'));
         }
         $pageName = Mage::helper('core')->escapeHtml($pageName);
         $popup = Mage::helper('promotional')->getPopup($pageName);
         if (isset($popup['promotional_id'])) {
             Mage::helper('promotional')->setViewedPopup($popup['promotional_id']);
             $response->addData($popup->toArray());
             $autoHideTime = Mage::helper('promotional')->getAutoHide();
             if ($autoHideTime > 0) {
                 $response->setAutoHideTime($autoHideTime);
             }
         } else {
             throw new Exception('Promotional Popup not found');
         }
     } catch (Exception $e) {
         $response->setError(1);
         $response->setErrorMessage($e->getMessage());
     }
     $this->getResponse()->setBody($response->toJson());
     return;
 }
开发者ID:xiaoguizhidao,项目名称:cupboardglasspipes.ecomitize.com,代码行数:28,代码来源:IndexController_20082015.php

示例8: get

 /**
  * Loads the data from the Piwik instance and
  * ass assembles a collection with the summary
  * of the visits for a given time.
  * 
  * @param array $params 
  * 		Array with additional params for requesting the Piwik API
  * @return Varien_Data_Collection The collection with the live users
  */
 public function get(array $params)
 {
     try {
         // load the data and decode it
         $phpNative = $this->decode($params);
         // initialize the collection
         foreach ($phpNative as $date => $values) {
             // pass the data
             if (is_array($values)) {
                 // check if a value for the unique visitors exists
                 if (array_key_exists('nb_uniq_visitors', $values)) {
                     // if yes, initialize an empty object
                     $obj = new Varien_Object();
                     $obj->addData($values);
                     $obj->setUsers($values['nb_uniq_visitors']);
                     $obj->setRange($date);
                     // add the object to the collection
                     $this->_collection->addItem($obj);
                 }
             }
         }
     } catch (Exception $e) {
         // log the exception
         Mage::logException($e);
         // add an error to the session
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('piwik')->__('900.error.invalid.piwik-configuration'));
     }
     // return the collection
     return $this->_collection;
 }
开发者ID:BGCX067,项目名称:faett-piwik-svn-to-git,代码行数:39,代码来源:VisitsSummary.php

示例9: _loadXmlElementCustomParams

 protected function _loadXmlElementCustomParams($element)
 {
     $params = array();
     $sortOrder = 0;
     foreach ($element->asCanonicalArray() as $key => $data) {
         if (is_array($data)) {
             $data['sort_order'] = isset($data['sort_order']) ? (int) $data['sort_order'] : 'top';
             // Prepare values (for dropdowns) specified directly in configuration
             $values = array();
             if (isset($data['values']) && is_array($data['values'])) {
                 foreach ($data['values'] as $value) {
                     if (isset($value['label']) && isset($value['value'])) {
                         $values[] = $value;
                     }
                 }
             }
             $data['values'] = $values;
             // Prepare helper block object
             if (isset($data['helper_block'])) {
                 $helper = new Varien_Object();
                 if (isset($data['helper_block']['data']) && is_array($data['helper_block']['data'])) {
                     $helper->addData($data['helper_block']['data']);
                 }
                 if (isset($data['helper_block']['type'])) {
                     $helper->setType($data['helper_block']['type']);
                 }
                 $data['helper_block'] = $helper;
             }
             $params[$key] = $data;
             $sortOrder++;
         }
     }
     return $params;
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:34,代码来源:Type.php

示例10: _prepareForm

    protected function _prepareForm()
    {
        $form = new Varien_Data_Form();
        $dataObj = new Varien_Object(array('package_name', 'description', 'package_status'));
        $this->setForm($form);
        if (Mage::getSingleton('adminhtml/session')->getStoreData()) {
            $data = Mage::getSingleton('adminhtml/session')->getStoreData();
            Mage::getSingleton('adminhtml/session')->setStoreData(null);
        } elseif (Mage::registry('package_data')) {
            $data = Mage::registry('package_data')->getData();
        }
        if (isset($data)) {
            $dataObj->addData($data);
        }
        $data = $dataObj->getData();
        $this->setForm($form);
        $inStore = $this->getRequest()->getParam('store');
        $defaultLabel = Mage::helper('membership')->__('Use Default');
        $defaultTitle = Mage::helper('membership')->__('-- Please Select --');
        $scopeLabel = Mage::helper('membership')->__('STORE VIEW');
        $websiteLabel = Mage::helper('membership')->__('WEBSITE');
        $fieldset = $form->addFieldset('membership_form', array('legend' => Mage::helper('membership')->__('Item information')));
        $fieldset->addField('package_name', 'text', array('label' => Mage::helper('membership')->__('Name'), 'class' => 'required-entry', 'required' => true, 'name' => 'package_name', 'disabled' => $inStore && !$data['package_name_in_store'], 'after_element_html' => $inStore ? '</td><td class="use-default">
			<input id="package_name_default" name="package_name_default" type="checkbox" value="1" class="checkbox config-inherit" ' . ($data['package_name_in_store'] ? '' : 'checked="checked"') . ' onclick="toggleValueElements(this, Element.previous(this.parentNode))" />
			<label for="package_name_default" class="inherit" title="' . $defaultTitle . '">' . $defaultLabel . '</label>
          </td><td class="scope-label">
			[' . $scopeLabel . ']
          ' : '</td><td class="scope-label">
			[' . $scopeLabel . ']'));
        $fieldset->addField('package_price', 'text', array('label' => Mage::helper('membership')->__('Price'), 'required' => true, 'name' => 'package_price'));
        $fieldset->addField('package_product_price', 'text', array('label' => Mage::helper('membership')->__('Product Price'), 'name' => 'package_product_price', 'class' => 'required-entry', 'required' => true));
        $fieldset->addField('custom_option_discount', 'select', array('label' => Mage::helper('membership')->__('Custom Option Discount'), 'name' => 'custom_option_discount', 'required' => true, 'values' => array(array('value' => 'yes', 'label' => Mage::helper('membership')->__('Yes')), array('value' => 'no', 'label' => Mage::helper('membership')->__('No')))));
        $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
        $fieldset->addField('duration', 'text', array('label' => Mage::helper('membership')->__('Duration'), 'required' => true, 'name' => 'duration', 'note' => 'months'));
        $fieldset->addField('description', 'editor', array('name' => 'description', 'label' => Mage::helper('membership')->__('Description'), 'wysiwyg' => false, 'required' => false, 'disabled' => $inStore && !$data['description_in_store'], 'after_element_html' => $inStore ? '</td><td class="use-default">
			<input id="description_default" name="description_default" type="checkbox" value="1" class="checkbox config-inherit" ' . ($data['description_in_store'] ? '' : 'checked="checked"') . ' onclick="toggleValueElements(this, Element.previous(this.parentNode))" />
			<label for="description_default" class="inherit" title="' . $defaultTitle . '">' . $defaultLabel . '</label>
          </td><td class="scope-label">
			[' . $scopeLabel . ']
          ' : '</td><td class="scope-label">
			[' . $scopeLabel . ']'));
        $fieldset->addField('sort_order', 'text', array('name' => 'sort_order', 'label' => Mage::helper('membership')->__('Sort Order'), 'required' => true));
        $fieldset->addField('package_status', 'select', array('label' => Mage::helper('membership')->__('Status'), 'name' => 'package_status', 'required' => true, 'values' => array(array('value' => 1, 'label' => Mage::helper('membership')->__('Enabled')), array('value' => 2, 'label' => Mage::helper('membership')->__('Disabled'))), 'disabled' => $inStore && !$data['package_status_in_store'], 'after_element_html' => $inStore ? '</td><td class="use-default">
			<input id="package_status_default" name="package_status_default" type="checkbox" value="1" class="checkbox config-inherit" ' . ($data['package_status_in_store'] ? '' : 'checked="checked"') . ' onclick="toggleValueElements(this, Element.previous(this.parentNode))" />
			<label for="package_status_default" class="inherit" title="' . $defaultTitle . '">' . $defaultLabel . '</label>
          </td><td class="scope-label">
			[' . $websiteLabel . ']
          ' : '</td><td class="scope-label">
			[' . $websiteLabel . ']'));
        if (Mage::getSingleton('adminhtml/session')->getPackageData()) {
            $form->setValues(Mage::getSingleton('adminhtml/session')->getPackageData());
            Mage::getSingleton('adminhtml/session')->setPackageData(null);
        } elseif (Mage::registry('package_data')) {
            $form->setValues(Mage::registry('package_data')->getData());
        }
        return parent::_prepareForm();
    }
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:57,代码来源:Form.php

示例11: testAddData

 /**
  * Tests Varien_Object->addData()
  */
 public function testAddData()
 {
     $this->_object->addData(array('test' => 'value'));
     $this->assertEquals('value', $this->_object->getData('test'));
     $this->_object->addData(array('test' => 'value1'));
     $this->assertEquals('value1', $this->_object->getData('test'));
     $this->_object->addData(array('test2' => 'value2'));
     $this->assertEquals(array('test' => 'value1', 'test2' => 'value2'), $this->_object->getData());
 }
开发者ID:natxetee,项目名称:magento2,代码行数:12,代码来源:ObjectTest.php

示例12: assignData

 /**
  * Assign data to info model instance
  *
  * @param Varien_Object|Array $data
  * @return TemplateTag_Stripe_Model_Payment
  */
 public function assignData($data)
 {
     if (is_array($data)) {
         $data = new Varien_Object($data);
     }
     try {
         $token = $this->getToken($data->getStripeToken());
         $data->addData(array('cc_last4' => $token->card->last4, 'cc_type' => $token->card->type, 'cc_owner' => $token->card->name));
     } catch (Exception $e) {
     }
     $data->setData('stripe_test', $this->_getHelper()->getTest());
     return parent::assignData($data);
 }
开发者ID:sigues,项目名称:openpay-magento,代码行数:19,代码来源:Info.php

示例13: _prepareCollection

 public function _prepareCollection()
 {
     $collection = new Varien_Data_Collection();
     $page_list = $this->getImportPage();
     foreach ($page_list->page as $key => $v) {
         $data = new Varien_Object();
         $data->setData('page_id', $key);
         $data->addData(Mage::helper('themeframework/managetheme')->_xmlToArray($v));
         $collection->addItem($data);
     }
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }
开发者ID:ahsanmage,项目名称:vr,代码行数:13,代码来源:Cmspage.php

示例14: getFormData

 /**
  * Retrieve form data
  *
  * @return Varien_Object
  */
 public function getFormData()
 {
     $data = $this->getData('form_data');
     if (is_null($data)) {
         $formData = Mage::getSingleton('customer/session')->getRegistrationFormData(true);
         $data = new Varien_Object();
         if ($formData) {
             $data->addData($formData);
         }
         $this->setData('form_data', $data);
     }
     return $data;
 }
开发者ID:jronatay,项目名称:ultimo-magento-jron,代码行数:18,代码来源:Register.php

示例15: load

 /**
  * Load data into object
  *
  * @param bool $printQuery
  * @param bool $logQuery
  * @return Ebizmarts_MageMonkey_Model_Custom_Collection
  */
 public function load($printQuery = false, $logQuery = false)
 {
     if ($this->isLoaded() || is_null($this->_toload)) {
         return $this;
     }
     foreach ($this->_toload as $row) {
         $item = new Varien_Object();
         $item->addData($row);
         $this->addItem($item);
     }
     $this->_setIsLoaded();
     return $this;
 }
开发者ID:CEMD-CN,项目名称:magemonkey,代码行数:20,代码来源:Customcollection.php


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