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


PHP Varien_Event_Observer::getBlock方法代码示例

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


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

示例1: insertBlock

 public function insertBlock(Varien_Event_Observer $observer)
 {
     if (Mage::app()->getFrontController()->getAction()->getFullActionName() === 'adminhtml_dashboard_index') {
         if ($observer->getBlock()->getUseAsDashboardHook()) {
             $html = $observer->getTransport()->getHtml();
             $zendeskDash = $observer->getBlock()->getLayout()->createBlock('zendesk/adminhtml_dashboard')->setName('zendesk_dashboard');
             $zendeskGrid = $zendeskDash->getLayout()->createBlock('zendesk/adminhtml_dashboard_grids')->setName('zendesk_dashboard_grids');
             $zendeskDash->setChild('zendesk_dashboard_grids', $zendeskGrid);
             $html .= $zendeskDash->toHtml();
             $observer->getTransport()->setHtml($html);
         }
     }
 }
开发者ID:drunkvegas,项目名称:done,代码行数:13,代码来源:Observer.php

示例2: adminhtmlBlockHtmlBefore

 /**
  * observe adminhtml_block_html_before
  *
  * @param Varien_Event_Observer $event
  * @return void
  */
 public function adminhtmlBlockHtmlBefore(Varien_Event_Observer $event)
 {
     $block = $event->getBlock();
     if (in_array($block->getId(), Mage::getSingleton('firegento_gridcontrol/config')->getGridList())) {
         Mage::getModel('firegento_gridcontrol/processor')->processBlock($block);
     }
 }
开发者ID:srinathweb,项目名称:GridControl,代码行数:13,代码来源:Observer.php

示例3: adminhtmlWidgetContainerHtmlBefore

 /**
  * Adds a button to the view-shipment page, allowing the merchant to create a MyParcel-consignment.
  * The button is not showed when a consignment is already present.
  *
  * @param Varien_Event_Observer $observer
  *
  * @return $this
  *
  * @event    adminhtml_widget_container_html_before
  *
  * @observer tig_myparcel_adminhtml_view_shipment
  */
 public function adminhtmlWidgetContainerHtmlBefore(Varien_Event_Observer $observer)
 {
     /** @var Mage_Adminhtml_Block_Widget_Container $block ; */
     $block = $observer->getBlock();
     /** @var TIG_MyParcel2014_Helper_Data $helper */
     $helper = Mage::helper('tig_myparcel');
     if ($block instanceof Mage_Adminhtml_Block_Sales_Order_Shipment_View) {
         $shipmentId = $block->getRequest()->getParam('shipment_id');
         $shippingMethod = Mage::getModel('sales/order_shipment')->load($shipmentId)->getOrder()->getShippingMethod();
         if (!$helper->shippingMethodIsMyParcel($shippingMethod)) {
             return;
         }
         $myParcelShipment = Mage::getModel('tig_myparcel/shipment')->load($shipmentId, 'shipment_id');
         if (!$myParcelShipment->hasConsignmentId()) {
             $block->addButton('myparcel_create_consignment', array('label' => $helper->__('Create MyParcel Consignment'), 'id' => 'createMyParcelConsignment', 'class' => 'go'));
             // remove Send Tracking Information button
             $block->removeButton('save');
         } else {
             if ($myParcelShipment->getShipment()->getShippingAddress()->getCountry() == 'NL') {
                 $retourUrl = $block->getUrl(self::RETOURLINK_ROUTE, array('shipment_id' => $shipmentId));
                 $block->addButton('myparcel_create_return_url', array('label' => $helper->__('Mail retour label'), 'class' => 'go', 'onclick' => "setLocation('" . $retourUrl . "')"));
             }
         }
     }
 }
开发者ID:myparcelnl,项目名称:magento1,代码行数:37,代码来源:ViewShipment.php

示例4: handleInlineJs

 /**
  * @param Varien_Event_Observer $observer
  *
  * @return $this
  */
 public function handleInlineJs(Varien_Event_Observer $observer)
 {
     Varien_Profiler::start('MeanbeeFooterJs');
     /** @var Meanbee_Footerjs_Helper_Data $helper */
     $helper = Mage::helper('meanbee_footerjs');
     if (!$helper->isEnabled()) {
         return $this;
     }
     /** @var Mage_Core_Block_Abstract $block */
     $block = $observer->getBlock();
     if (!is_null($block->getParentBlock())) {
         // Only look for JS at the root block
         return $this;
     }
     /** @var Varien_Object $transport */
     $transport = $observer->getTransport();
     $patterns = array('js' => self::REGEX_JS, 'document_end' => self::REGEX_DOCUMENT_END);
     foreach ($patterns as $pattern) {
         $matches = array();
         $html = $transport->getHtml();
         $success = preg_match_all($pattern, $html, $matches);
         if ($success) {
             $text = implode('', $matches[0]);
             $html = preg_replace($pattern, '', $html);
             $transport->setHtml($html . $text);
         }
     }
     Varien_Profiler::stop('MeanbeeFooterJs');
     return $this;
 }
开发者ID:roman204,项目名称:magento-footer-js,代码行数:35,代码来源:Observer.php

示例5: addSortableScriptOnGrid

 /**
  * Appends the "sortable" js code to the bottom of ajax-Request for the category-products loaded after
  * changing sort order.
  *
  * @param Varien_Event_Observer $observer
  */
 public function addSortableScriptOnGrid(Varien_Event_Observer $observer)
 {
     $_block = $observer->getBlock();
     $_type = $_block->getType();
     if (Mage::helper('ffuenf_categoryproductsortbackend')->isExtensionActive() && $_type == 'adminhtml/catalog_category_tab_product') {
         $content = $observer->getTransport()->getHtml();
         $dom = new DOMDocument('1.0', 'utf-8');
         $doc = new DOMDocument('1.0', 'utf-8');
         $dom->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8'));
         foreach ($dom->getElementsByTagName('select') as $element) {
             if ($element->getAttribute('name') == 'limit') {
                 $option = $dom->createElement('option');
                 $option->appendChild($dom->createTextNode('All'));
                 $option->setAttribute('value', 0);
                 $option = $element->appendChild($option);
             }
         }
         $additionalHtml = $this->appendScript($content);
         $additionalDoc = new DOMDocument();
         $additionalDoc->loadHTML($additionalHtml);
         $additionalDocScript = $additionalDoc->getElementsByTagName('script')->item(0);
         $body = $dom->getElementsByTagName('body')->item(0);
         foreach ($body->childNodes as $child) {
             $doc->appendChild($doc->importNode($child, true));
         }
         $doc->appendChild($doc->importNode($additionalDocScript, true));
         $content = $doc->saveHTML();
         $observer->getTransport()->setHtml($content);
     }
 }
开发者ID:WestAgency,项目名称:Ffuenf_CategoryProductSortBackend,代码行数:36,代码来源:Observer.php

示例6: layerLoadBefore

 /**
  * override the template of option edit tab
  *
  * @param   Varien_Event_Observer $observer
  */
 public function layerLoadBefore(Varien_Event_Observer $observer)
 {
     $block = $observer->getBlock();
     if (Mage::getStoreConfig('magetools_optionfilter/setting/enabled') && $block instanceof Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Option) {
         $block->setTemplate('magetools/optionfilter/product_option.phtml');
     }
 }
开发者ID:santhosh400,项目名称:ecart,代码行数:12,代码来源:Observer.php

示例7: changeOptionsTypeSelectTemplate

 /**
  * Rewrite select template 
  * 
  * @see core_block_abstract_to_html_before
  * @param Varien_Event_Observer $observer
  */
 public function changeOptionsTypeSelectTemplate($observer)
 {
     $block = $observer->getBlock();
     if (get_class($block) == 'Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Type_Select') {
         $block->setTemplate('aydus/customconfigurable/catalog/product/edit/options/type/select.phtml');
     }
     return $this;
 }
开发者ID:zhangjiachao,项目名称:CustomConfigurable,代码行数:14,代码来源:Observer.php

示例8: addMassaction

 public function addMassaction(Varien_Event_Observer $observer)
 {
     $block = $observer->getBlock();
     if (!isset($block)) {
         return;
     }
     $block->getMassactionBlock()->addItem('set_fetured', array('label' => Mage::helper('sm_featured')->__('Set featured'), 'url' => Mage::app()->getStore()->getUrl('*/*/massFeatured', array('_current' => true)), 'additional' => array('visibility' => array('name' => 'status', 'type' => 'select', 'class' => 'required-entry', 'label' => Mage::helper('sm_featured')->__('Status'), 'values' => array(0 => 'Disable', 1 => 'Enable')))));
 }
开发者ID:sonbui00,项目名称:magento-mock,代码行数:8,代码来源:Observer.php

示例9: adminhtmlBlockHtmlBefore

 /**
  * Prepare the adminhtml category products view
  *
  * @param Varien_Event_Observer $observer Observer Instance
  */
 public function adminhtmlBlockHtmlBefore(Varien_Event_Observer $observer)
 {
     /* @var $block Mage_Adminhtml_Block_Widget_Grid */
     $block = $observer->getBlock();
     if ($block instanceof Mage_Adminhtml_Block_Widget_Grid && $block->getId() == 'catalog_category_products' && $block->getCategory()->getId()) {
         $block->addColumn('dynamic', array('header' => Mage::helper('catalog')->__('Type'), 'width' => '80', 'index' => 'dynamic', 'sortable' => false, 'filter' => false, 'frame_callback' => array($this, 'decorateType')));
     }
 }
开发者ID:amorkan,项目名称:firegento-dynamiccategory,代码行数:13,代码来源:Observer.php

示例10: coreBlockAbstractToHtmlBefore

 public function coreBlockAbstractToHtmlBefore(Varien_Event_Observer $observer)
 {
     /** @var Mage_Core_Block_Abstract $block */
     $block = $observer->getBlock();
     if ($block instanceof Mage_Core_Block_Template && Mage::helper('sse_debugerrors')->isEnabled()) {
         $this->_checkPossibleTemplateErrors($block);
     }
 }
开发者ID:schmengler,项目名称:DebugErrors,代码行数:8,代码来源:Observer.php

示例11: addExtraColumnsToGrid

 /**
  * @param Varien_Event_Observer $observer
  */
 public function addExtraColumnsToGrid(Varien_Event_Observer $observer)
 {
     // Get the block
     $block = $observer->getBlock();
     if ($block instanceof Mage_Adminhtml_Block_Report_Shopcart_Abandoned_Grid) {
         $block->addColumnAfter('abandoned_notified', array('header' => Mage::helper('abandonedcarts')->__('Abandoned cart email sent'), 'index' => 'abandoned_notified', 'type' => 'options', 'options' => array(0 => Mage::helper('abandonedcarts')->__('No'), 1 => Mage::helper('abandonedcarts')->__('Yes'))), 'remote_ip');
         $block->addColumnAfter('abandoned_sale_notified', array('header' => Mage::helper('abandonedcarts')->__('Abandoned cart sale email sent'), 'index' => 'abandoned_sale_notified', 'type' => 'options', 'options' => array(0 => Mage::helper('abandonedcarts')->__('No'), 1 => Mage::helper('abandonedcarts')->__('Yes'))), 'abandoned_notified');
     }
 }
开发者ID:digitalpianism,项目名称:abandonedcarts,代码行数:12,代码来源:Observer.php

示例12: removePopupBlockFromLayout

 /**
  * Remove popup block after rendering, so that following renderers can use their own instance
  * 
  * @param Varien_Event_Observer $observer
  */
 public function removePopupBlockFromLayout(Varien_Event_Observer $observer)
 {
     $block = $observer->getBlock();
     if ($this->_shouldAddPopup($block)) {
         /* @var $container Mage_Core_Block_Text_List */
         $container = $block->getLayout()->getBlock('additional.product.info');
         $container->unsetChild(self::POPUP_ALIAS_IN_LAYOUT);
     }
 }
开发者ID:helirexi,项目名称:EditCustomOptions,代码行数:14,代码来源:Observer.php

示例13: addFeaturedColumn

 public function addFeaturedColumn(Varien_Event_Observer $observer)
 {
     //        echo __METHOD__;
     $block = $observer->getBlock();
     if ($block->getType() == 'adminhtml/catalog_product_grid') {
         //        if ($block->getId() == 'productGrid'){
         $block->addColumnAfter('featured', array('header' => Mage::helper('catalog')->__('is Featured'), 'width' => '70px', 'index' => 'is_featured', 'type' => 'options', 'options' => array(0 => 'No', 1 => 'Category', 2 => 'Home')), 'action');
     }
 }
开发者ID:luoi,项目名称:mockmagentosample,代码行数:9,代码来源:CustomizeProductGrid.php

示例14: prepareCollectionForGrid

 /**
  * Set flag to add unprocessed event count after load.
  * Uses core_block_abstract_to_html_before because this is the only event fired before
  * grid is prepared and collection loaded. Cannot use collection flag because collection
  * is not instantiated yet.
  * 
  * @see event core_block_abstract_to_html_before
  * @param Varien_Event_Observer $observer
  * @return Hackathon_AsyncIndex_Model_Observer
  */
 public function prepareCollectionForGrid(Varien_Event_Observer $observer)
 {
     /* @var $block Mage_Core_Block_Abstract $block */
     $block = $observer->getBlock();
     if ($block instanceof Mage_Index_Block_Adminhtml_Process_Grid) {
         $this->_shouldLoadUnprocessedEventCount = true;
     }
     return $this;
 }
开发者ID:itmyprofession,项目名称:AsyncIndex,代码行数:19,代码来源:Observer.php

示例15: addIndexStatusColumn

 /**
  * @see event adminhtml_block_html_before
  * @return 
  */
 public function addIndexStatusColumn(Varien_Event_Observer $observer)
 {
     /** @var Mage_Adminhtml_Block_Template $block */
     $block = $observer->getBlock();
     if ($block instanceof Mage_Index_Block_Adminhtml_Process_Grid) {
         $this->_addIndexStatusColumnTo($block);
         $this->_changeActionColumnToAjax($block);
     }
 }
开发者ID:toanloau,项目名称:Hackathon_IndexerStats,代码行数:13,代码来源:Observer.php


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