コード例 #1
0
ファイル: Value.php プロジェクト: xiaoguizhidao/BumblebeeSite
 public function render(Varien_Object $row)
 {
     $field_id = str_replace('field_', '', $this->getColumn()->getIndex());
     $field = Mage::getModel('webforms/fields')->load($field_id);
     $value = $row->getData($this->getColumn()->getIndex());
     $html = '';
     if ($field->getType() == 'textarea') {
         $html = $this->getTextareaBlock($row);
     }
     if ($field->getType() == 'email') {
         if ($value) {
             $websiteId = Mage::app()->getStore($row->getStoreId())->getWebsite()->getId();
             $customer = Mage::getModel('customer/customer')->setData('website_id', $websiteId)->loadByEmail($value);
             $html = $value;
             if ($customer->getId()) {
                 $html .= " [<a href='" . $this->getCustomerUrl($customer->getId()) . "' target='_blank'>" . $customer->getName() . "</a>]";
             }
         }
     }
     $html_object = new Varien_Object(array('html' => $html));
     Mage::dispatchEvent('webforms_block_adminhtml_results_renderer_value_render', array('field' => $field, 'html_object' => $html_object, 'value' => $value));
     if ($html_object->getHtml()) {
         return $html_object->getHtml();
     }
     return nl2br(htmlspecialchars($value));
 }
コード例 #2
0
ファイル: State.php プロジェクト: xiaoguizhidao/ortodon
 public function getValueHtml($item)
 {
     $result = new Varien_Object();
     $block = $this;
     Mage::dispatchEvent('m_filter_value_html', compact('block', 'item', 'result'));
     return $result->getHtml() ? $result->getHtml() : '';
 }
コード例 #3
0
ファイル: Grid.php プロジェクト: billadams/forever-frame
 /**
  * Call Render Function
  *
  * @param string $parentFunction
  * @param mixed $params
  * @return string
  */
 public function fetchRender($parentFunction, $row)
 {
     $parentBlock = $this->getParentBlock();
     $fetchObj = new Varien_Object(array('function' => $parentFunction, 'html' => false));
     Mage::dispatchEvent("affiliateplus_grid_fetch_render_{$parentFunction}", array('block' => $parentBlock, 'row' => $row, 'fetch' => $fetchObj));
     if ($fetchObj->getHtml()) {
         return $fetchObj->getHtml();
     }
     return $parentBlock->{$parentFunction}($row);
 }
コード例 #4
0
ファイル: Value.php プロジェクト: smitmanglam/staging
 public function render(Varien_Object $row)
 {
     $field_id = str_replace('field_', '', $this->getColumn()->getIndex());
     $field = Mage::getModel('webforms/fields')->load($field_id);
     $value = $row->getData($this->getColumn()->getIndex());
     $html = '';
     if ($field->getType() == 'file') {
         if (strlen($value) > 1) {
             $html = '<nobr><a href="' . $this->getDownloadLink($row) . '">' . $value . '</a> <small>[' . $row->getFileSizeText($field_id, $value) . ']</small></nobr>';
         } else {
             return;
         }
     }
     if ($field->getType() == 'image') {
         if (strlen($value) > 1) {
             if ($this->getImageThumbnail($row)) {
                 $html = '<a href="' . $this->getDownloadLink($row) . '" target="_blank"><img src="' . $this->getImageThumbnail($row) . '"/></a>';
             } else {
                 $html = '<nobr><a href="' . $this->getDownloadLink($row) . '">' . $value . '</a> <small>[' . $row->getFileSizeText($field_id, $value) . ']</small></nobr>';
             }
         } else {
             return;
         }
     }
     if ($field->getType() == 'stars') {
         $html = $this->getStarsBlock($row);
     }
     if ($field->getType() == 'textarea') {
         $html = $this->getTextareaBlock($row);
     }
     if ($field->getType() == 'wysiwyg') {
         $html = $this->getHtmlTextareaBlock($row);
     }
     if (strstr($field->getType(), 'date')) {
         $html = $field->formatDate($value);
     }
     if ($field->getType() == 'email') {
         if ($value) {
             $websiteId = Mage::app()->getStore($row->getStoreId())->getWebsite()->getId();
             $customer = Mage::getModel('customer/customer')->setData('website_id', $websiteId)->loadByEmail($value);
             $html = $value;
             if ($customer->getId()) {
                 $html .= " [<a href='" . $this->getCustomerUrl($customer->getId()) . "' target='_blank'>" . $customer->getName() . "</a>]";
             }
         }
     }
     $html_object = new Varien_Object(array('html' => $html));
     Mage::dispatchEvent('webforms_block_adminhtml_results_renderer_value_render', array('field' => $field, 'html_object' => $html_object, 'value' => $value));
     if ($html_object->getHtml()) {
         return $html_object->getHtml();
     }
     return nl2br(htmlspecialchars($value));
 }
コード例 #5
0
ファイル: Coupon.php プロジェクト: kanotest15/cbmagento
 /**
  * render coupon block
  * 
  * @return html
  */
 protected function _toHtml()
 {
     $container = new Varien_Object(array('html' => '', 'rewrite_core' => false));
     Mage::dispatchEvent('rewardpoints_rewrite_coupon_block_to_html', array('block' => $this, 'container' => $container));
     if ($container->getRewriteCore() && $container->getHtml()) {
         return $container->getHtml();
     }
     if ($this->getChild('checkout.cart.rewardpoints')) {
         return $container->getHtml() . $this->getChildHtml('checkout.cart.rewardpoints') . parent::_toHtml();
     }
     return $container->getHtml() . parent::_toHtml();
 }
コード例 #6
0
ファイル: Value.php プロジェクト: pankajsinghjarial/SYLC
 public function render(Varien_Object $row)
 {
     $field_id = str_replace('field_', '', $this->getColumn()->getIndex());
     $field = Mage::getModel('webforms/fields')->load($field_id);
     $value = $row->getData($this->getColumn()->getIndex());
     $html = '';
     $html_object = new Varien_Object(array('html' => $html));
     Mage::dispatchEvent('webforms_block_adminhtml_results_renderer_value_render', array('field' => $field, 'html_object' => $html_object, 'value' => $value));
     if ($html_object->getHtml()) {
         return $html_object->getHtml();
     }
     return nl2br(htmlspecialchars($value));
 }
コード例 #7
0
ファイル: Abstract.php プロジェクト: sagmahajan/aswan_release
 protected function _afterToHtml($html)
 {
     $html = parent::_afterToHtml($html);
     $transport = new Varien_Object(array('html' => $html));
     Mage::dispatchEvent('aitsys_block_abstract_to_html_after', array('block' => $this, 'transport' => $transport));
     return $transport->getHtml();
 }
コード例 #8
0
ファイル: Event.php プロジェクト: finelinePG/finelink-dev
 public function addAfterToHtml($html, Mage_Core_Block_Abstract $block)
 {
     $transportObject = new Varien_Object();
     $transportObject->setHtml($html);
     Mage::dispatchEvent('aitunits_core_block_template_to_html_after', array('block' => $block, 'transport' => $transportObject));
     $html = $transportObject->getHtml();
     return $html;
 }
コード例 #9
0
ファイル: Simple.php プロジェクト: riker09/DMP_BasePrice
 /**
  * Returns product price block html
  *
  * @param Mage_Catalog_Model_Product $product
  * @param boolean $displayMinimalPrice
  */
 public function getPriceHtml($product, $displayMinimalPrice = false, $idSuffix = '')
 {
     $html = parent::getPriceHtml($product, $displayMinimalPrice, $idSuffix);
     $container = new Varien_Object();
     $container->setHtml($html);
     Mage::dispatchEvent('block_catalog_product_get_price_html', array('block' => $this, 'container' => $container));
     $html = $container->getHtml();
     return $html;
 }
コード例 #10
0
ファイル: Messages.php プロジェクト: guohuadeng/stampApp
 public function getGroupedHtml()
 {
     $html = parent::getGroupedHtml();
     $_transportObject = new Varien_Object();
     $_transportObject->setHtml($html);
     Mage::dispatchEvent('core_block_abstract_to_html_after', array('block' => $this, 'transport' => $_transportObject));
     $html = $_transportObject->getHtml();
     return $html;
 }
コード例 #11
0
ファイル: Messages.php プロジェクト: AndreKlang/Lesti_Fpc
 /**
  * Retrieve messages in HTML format grouped by type
  *
  * @param   string $type
  * @return  string
  */
 public function getGroupedHtml()
 {
     $html = parent::getGroupedHtml();
     /**
      * Use single transport object instance for all blocks
      */
     $_transportObject = new Varien_Object();
     $_transportObject->setHtml($html);
     Mage::dispatchEvent('core_block_messages_get_grouped_html_after', array('block' => $this, 'transport' => $_transportObject));
     $html = $_transportObject->getHtml();
     return $html;
 }
コード例 #12
0
 protected function _toHtml()
 {
     if (!Mage::getStoreConfig('jeroenvermeulen_solarium/results/autocomplete_product_suggestions')) {
         return parent::_toHtml();
     }
     $productIds = $this->getSuggestProductIds();
     if (empty($productIds)) {
         return parent::_toHtml();
     } else {
         // Magento by default starts with a hidden <li>, don't know why.
         $html = '<ul class="product_suggest"><li style="display: none"></li>';
         $transport = new Varien_Object();
         $transport->setHtml(null);
         // Event listener can fill this with HTML, <li> tags.
         Mage::dispatchEvent('jeroenvermeulen_solarium_get_product_suggest_html', array('product_ids' => $productIds, 'transport' => $transport));
         if (!is_null($transport->getHtml())) {
             $html .= $transport->getHtml();
         } else {
             $productCollection = $products = Mage::getModel('catalog/product')->getCollection()->addAttributeToFilter('entity_id', array('in' => $productIds))->addAttributeToSelect(array('name', 'thumbnail', 'product_url'));
             $counter = 0;
             foreach ($productCollection as $product) {
                 $rowClass = ++$counter % 2 ? 'odd' : 'even';
                 $imageUrl = Mage::helper('catalog/image')->init($product, 'thumbnail')->resize('50');
                 $showName = Mage::helper('core/string')->truncate($product->getName(), 100);
                 $html .= sprintf('<li title="%s" class="%s" data-url="%s">', htmlentities($product->getName()), $rowClass, htmlentities($product->getProductUrl()));
                 $html .= '<span class="suggestions-productimage">';
                 $html .= sprintf('<img src="%s" />', htmlentities($imageUrl));
                 $html .= '</span>';
                 $html .= '<span class="suggestions-productname">';
                 $html .= htmlentities($showName);
                 $html .= '</span>';
                 $html .= '</li>';
             }
         }
         $html .= '</ul>';
     }
     return $html;
 }
コード例 #13
0
ファイル: Price.php プロジェクト: xiaoguizhidao/bilderrahmen
 /**
  * Add content of template block below price html if defined in config
  *
  * @return string
  */
 public function _toHtml()
 {
     $html = trim(parent::_toHtml());
     if (empty($html) || !Mage::getStoreConfigFlag('catalog/price/display_block_below_price')) {
         return $html;
     }
     if ($this->getTemplate() != $this->_tierPriceDefaultTemplate) {
         $htmlObject = new Varien_Object();
         $htmlObject->setParentHtml($html);
         $htmlTemplate = $this->getLayout()->createBlock('core/template')->setTemplate('germansetup/price_info.phtml')->setFormattedTaxRate($this->getFormattedTaxRate())->setIsIncludingTax($this->isIncludingTax())->setIsIncludingShippingCosts($this->isIncludingShippingCosts())->setIsShowShippingLink($this->isShowShippingLink())->toHtml();
         $htmlObject->setHtml($htmlTemplate);
         Mage::dispatchEvent('germansetup_after_product_price', array('html_obj' => $htmlObject, 'block' => $this));
         $html = $htmlObject->getPrefix();
         $html .= $htmlObject->getParentHtml();
         $html .= $htmlObject->getHtml();
         $html .= $htmlObject->getSuffix();
     }
     return $html;
 }
コード例 #14
0
ファイル: Output.php プロジェクト: rajarshc/Rooja
 /**
  * Appends the points balance in the header somewhere
  * @param Mage_Catalog_Block_Product_List $block
  * @param Varien_Object $transport
  */
 public function appendToCatalogListing($block, $transport)
 {
     // Should we be checking this auto-integration?
     if (!Mage::getStoreConfigFlag('rewards/autointegration/product_listing')) {
         return $this;
     }
     // Block is a price block.
     if (!$block instanceof Mage_Catalog_Block_Product_List) {
         return $this;
     }
     $all_products = $block->getLoadedProductCollection();
     $html = $transport->getHtml();
     $html = $this->_getNewCatalogListingHtml($html, $all_products);
     $transport->setHtml($html);
     return $this;
 }
コード例 #15
0
ファイル: Fields.php プロジェクト: smitmanglam/staging
 public function toHtml($custom = '')
 {
     $html = "";
     $filter = $this->getFilter();
     // apply custom filter
     Mage::dispatchEvent('webforms_fields_tohtml_filter', array('filter' => $filter));
     $field_id = "field[" . $this->getId() . "]";
     $field_name = $field_id;
     $field_value = $filter->filter($this->getValue());
     $result = $this->getData('result');
     $customer_value = $result ? $result->getData('field_' . $this->getId()) : false;
     $this->setData('customer_value', $customer_value);
     $field_type = $this->getType();
     $field_class = "input-text";
     $field_style = "";
     $validate = "";
     if ($field_type == 'file' || $field_type == 'image') {
         $field_class = "input-file";
     }
     if ($this->getRequired()) {
         $field_class .= " required-entry";
     }
     if ($field_type == "email") {
         $field_class .= " validate-email";
     }
     if ($field_type == "number") {
         $field_class .= " validate-number";
     }
     if ($field_type == "url") {
         $field_class .= " validate-url";
     }
     if ($this->getCssClass()) {
         $field_class .= ' ' . $this->getCssClass();
     }
     if ($this->getData('validate_length_min') || $this->getData('validate_length_max')) {
         $field_class .= ' validate-length';
     }
     if ($this->getData('validate_length_min')) {
         $field_class .= ' minimum-length-' . $this->getData('validate_length_min');
     }
     if ($this->getData('validate_length_max')) {
         $field_class .= ' maximum-length-' . $this->getData('validate_length_max');
     }
     if ($this->getData('validate_regex')) {
         $field_class .= ' validate-field-' . $this->getId();
     }
     if ($this->getCssStyle()) {
         $field_style = $this->getCssStyle();
     }
     $tinyMCE = false;
     $showTime = false;
     $calendar = false;
     $config = array('field' => $this, 'field_id' => $field_id, 'field_name' => $field_name, 'field_class' => $field_class, 'field_style' => $field_style, 'field_value' => $field_value, 'result' => $result, 'show_time' => 'false', 'customer_value' => $customer_value, 'template' => 'webforms/fields/text.phtml');
     switch ($field_type) {
         case 'textarea':
             if ($customer_value) {
                 $config['field_value'] = $customer_value;
             }
             $config['template'] = 'webforms/fields/textarea' . $custom . '.phtml';
             break;
         case 'wysiwyg':
             $tinyMCE = true;
             if ($customer_value) {
                 $config['field_value'] = $customer_value;
             }
             $config['template'] = 'webforms/fields/wysiwyg.phtml';
             break;
         case 'select':
             $config['field_options'] = $this->getOptionsArray();
             $config['template'] = 'webforms/fields/select.phtml';
             break;
         case 'select/contact':
             $config['field_options'] = $this->getOptionsArray();
             $config['template'] = 'webforms/fields/select_contact.phtml';
             break;
         case 'select/radio':
             $config['field_class'] = $this->getCssClass();
             $config['field_options'] = $this->getOptionsArray();
             $config['template'] = 'webforms/fields/select_radio' . $custom . '.phtml';
             break;
         case 'select/checkbox':
             $config['field_class'] = $this->getCssClass();
             $config['field_options'] = $this->getOptionsArray();
             $config['template'] = 'webforms/fields/select_checkbox' . $custom . '.phtml';
             break;
         case 'subscribe':
             $config['field_class'] = $this->getCssClass();
             $config['template'] = 'webforms/fields/subscribe.phtml';
             break;
         case 'stars':
             $config['field_options'] = $this->getOptionsArray();
             $config['template'] = 'webforms/fields/stars.phtml';
             break;
         case 'image':
         case 'file':
             $config['field_id'] = 'file_' . $this->getId();
             $config['field_name'] = $config['field_id'];
             $config['template'] = 'webforms/fields/file' . $custom . '.phtml';
             break;
         case 'html':
             $config['template'] = 'webforms/fields/html.phtml';
             break;
         case 'datetime':
             $config['show_time'] = 'true';
             $showTime = true;
         case 'date':
         case 'datetime':
             $calendar = true;
             if ($customer_value) {
                 // format customer value
                 $config['customer_value'] = Mage::helper('core')->formatDate($customer_value, $this->getDateType(), $showTime);
             }
             $config['template'] = 'webforms/fields/date.phtml';
             break;
         case 'hidden':
             $config['template'] = 'webforms/fields/hidden.phtml';
             break;
         case 'country':
             $config['template'] = 'webforms/fields/country.phtml';
             break;
         default:
             if ($customer_value) {
                 $config['field_value'] = $customer_value;
             }
             $config['template'] = 'webforms/fields/text' . $custom . '.phtml';
             break;
     }
     $layout = Mage::app()->getLayout();
     $html = $layout->createBlock('core/template', $field_name, $config)->toHtml();
     if ($this->getData('validate_regex')) {
         $validate_message = str_replace("'", "\\'", $this->getData('validate_message'));
         $html .= "<script>Validation.add('validate-field-{$this->getId()}','{$validate_message}',function(v){var r = new RegExp('{$this->getData('validate_regex')}');return Validation.get('IsEmpty').test(v) || r.test(v);})</script>";
     }
     // activate tinyMCE
     if ($tinyMCE && !Mage::registry('tinyMCE')) {
         Mage::register('tinyMCE', true);
         $tiny_mce = $layout->createBlock('core/template', 'tinyMCE', array('template' => 'webforms/scripts/tiny_mce.phtml'));
         $html .= $tiny_mce->toHtml();
     }
     // activate calendar
     if ($calendar && !Mage::registry('calendar')) {
         Mage::register('calendar', true);
         $calendar_block = $layout->createBlock('core/html_calendar', 'calendar_block', array('as' => 'calendar', 'template' => 'page/js/calendar.phtml'));
         $html .= $calendar_block->toHtml();
     }
     // apply custom field type
     $html_object = new Varien_Object(array('html' => $html));
     Mage::dispatchEvent('webforms_fields_tohtml_html', array('field' => $this, 'html_object' => $html_object));
     return $html_object->getHtml();
 }
コード例 #16
0
ファイル: Grid.php プロジェクト: javik223/Evron-Magento
 /**
  * Call Render Function
  *
  * @param string $parentFunction
  * @param mixed $params
  * @return string
  */
 public function fetchRender($parentFunction, $row)
 {
     $parentBlock = $this->getParentBlock();
     $fetchObj = new Varien_Object(array('function' => $parentFunction, 'html' => false));
     if ($fetchObj->getHtml()) {
         return $fetchObj->getHtml();
     }
     return $parentBlock->{$parentFunction}($row);
 }
コード例 #17
0
 public function getEmptyBlockHtml($block)
 {
     Mage::dispatchEvent('core_block_abstract_to_html_before', array('block' => $block));
     if (Mage::getStoreConfig('advanced/modules_disable_output/' . $block->getModuleName())) {
         return '';
     }
     /**
      * Use single transport object instance for all blocks
      */
     $transportObject = new Varien_Object();
     $transportObject->setHtml('');
     Mage::dispatchEvent('core_block_abstract_to_html_after', array('block' => $block, 'transport' => $transportObject));
     $html = $transportObject->getHtml();
     return $html;
 }
コード例 #18
0
ファイル: Abstract.php プロジェクト: cewolf2002/magento
 /**
  * Produce and return block's html output
  *
  * It is a final method, but you can override _toHtml() method in descendants if needed.
  *
  * @return string
  */
 public final function toHtml()
 {
     Mage::dispatchEvent('core_block_abstract_to_html_before', array('block' => $this));
     if (Mage::getStoreConfig('advanced/modules_disable_output/' . $this->getModuleName())) {
         return '';
     }
     $html = $this->_loadCache();
     if ($html === false) {
         $translate = Mage::getSingleton('core/translate');
         /** @var $translate Mage_Core_Model_Translate */
         if ($this->hasData('translate_inline')) {
             $translate->setTranslateInline($this->getData('translate_inline'));
         }
         $this->_beforeToHtml();
         $html = $this->_toHtml();
         $this->_saveCache($html);
         if ($this->hasData('translate_inline')) {
             $translate->setTranslateInline(true);
         }
     }
     $html = $this->_afterToHtml($html);
     /**
      * Check framing options
      */
     if ($this->_frameOpenTag) {
         $html = '<' . $this->_frameOpenTag . '>' . $html . '<' . $this->_frameCloseTag . '>';
     }
     /**
      * Use single transport object instance for all blocks
      */
     if (self::$_transportObject === null) {
         self::$_transportObject = new Varien_Object();
     }
     self::$_transportObject->setHtml($html);
     Mage::dispatchEvent('core_block_abstract_to_html_after', array('block' => $this, 'transport' => self::$_transportObject));
     $html = self::$_transportObject->getHtml();
     return $html;
 }
コード例 #19
0
ファイル: Fields.php プロジェクト: EmPeWe/WebForms-2.4.0.4
 public function toHtml()
 {
     $html = "";
     $filter = $this->getFilter();
     // apply custom filter
     Mage::dispatchEvent('webforms_fields_tohtml_filter', array('filter' => $filter));
     $field_id = "field[" . $this->getId() . "]";
     $field_name = $field_id;
     $field_value = $filter->filter($this->getValue());
     $result = $this->getData('result');
     $customer_value = $result ? $result->getData('field_' . $this->getId()) : false;
     $this->setData('customer_value', $customer_value);
     $field_type = $this->getType();
     $field_class = "input-text";
     $field_style = "";
     $validate = "";
     if ($field_type == 'file' || $field_type == 'image') {
         $field_class = "input-file";
     }
     if ($this->getRequired()) {
         $field_class .= " required-entry";
     }
     if ($field_type == "email") {
         $field_class .= " validate-email";
     }
     if ($field_type == "number") {
         $field_class .= " validate-number";
     }
     if ($field_type == "url") {
         $field_class .= " validate-url";
     }
     if ($this->getCssClass()) {
         $field_class .= ' ' . $this->getCssClass();
     }
     if ($this->getData('validate_length_min') || $this->getData('validate_length_max')) {
         $field_class .= ' validate-length';
     }
     if ($this->getData('validate_length_min')) {
         $field_class .= ' minimum-length-' . $this->getData('validate_length_min');
     }
     if ($this->getData('validate_length_max')) {
         $field_class .= ' maximum-length-' . $this->getData('validate_length_max');
     }
     if ($this->getData('validate_regex')) {
         $field_class .= ' validate-field-' . $this->getId();
     }
     if ($this->getCssStyle()) {
         $field_style = $this->getCssStyle();
     }
     $tinyMCE = false;
     $showTime = false;
     $calendar = false;
     $config = array('field' => $this, 'field_id' => $field_id, 'field_name' => $field_name, 'field_class' => $field_class, 'field_style' => $field_style, 'field_value' => $field_value, 'result' => $result, 'show_time' => 'false', 'customer_value' => $customer_value, 'template' => 'webforms/fields/text.phtml');
     switch ($field_type) {
         case 'textarea':
             if ($customer_value) {
                 $config['field_value'] = $customer_value;
             }
             $config['template'] = 'webforms/fields/textarea.phtml';
             break;
         case 'select':
             $config['field_options'] = $this->getOptionsArray();
             $config['template'] = 'webforms/fields/select.phtml';
             break;
         case 'select/radio':
             $config['field_class'] = $this->getCssClass();
             $config['field_options'] = $this->getOptionsArray();
             $config['template'] = 'webforms/fields/select_radio.phtml';
             break;
         case 'select/checkbox':
             $config['field_class'] = $this->getCssClass();
             $config['field_options'] = $this->getOptionsArray();
             $config['template'] = 'webforms/fields/select_checkbox.phtml';
             break;
         case 'upload':
             $config['field_class'] = $this->getCssClass();
             $config['field_options'] = $this->getOptionsArray();
             $config['template'] = 'webforms/fields/upload.phtml';
             break;
         default:
             if ($customer_value) {
                 $config['field_value'] = $customer_value;
             }
             $config['template'] = 'webforms/fields/text.phtml';
             break;
     }
     $layout = Mage::app()->getLayout();
     $html = $layout->createBlock('core/template', $field_name, $config)->toHtml();
     // apply custom field type
     $html_object = new Varien_Object(array('html' => $html));
     Mage::dispatchEvent('webforms_fields_tohtml_html', array('field' => $this, 'html_object' => $html_object));
     return $html_object->getHtml();
 }
コード例 #20
0
ファイル: Pdf.php プロジェクト: xiaoguizhidao/bb
 /**
  * render the html for 1 bundled sales object item line <tr>$trInner</tr>
  *
  * @param      $pdfItem
  * @param      $subItems
  * @param      $vertSpacing
  * @param bool $styleOverride
  * @param int  $position
  *
  * @return string
  * @access public
  */
 public function getPdfBundleItemRow($pdfItem, $subItems, $vertSpacing, $styleOverride = false, $position = 1)
 {
     $columns = $this->getPdfColumnHeaders();
     if ($columns) {
         //check if the subitems of the bundle have separate prices
         $subItemsSum = 0;
         foreach ($subItems as $bundleItem) {
             $subItemsSum += $bundleItem['price'];
         }
         //don't display bundle price if subitems have prices
         if ($subItemsSum > 0) {
             $html = Mage::app()->getLayout()->createBlock('pdfcustomiser/pdf_item')->setPdfHelper($this)->setPdfItem($pdfItem)->setSubItems($subItems)->setVertSpacing($vertSpacing)->setStyleOverride($styleOverride)->setPosition($position)->setTemplate('fooman/pdfcustomiser/bundle-with-subitems.phtml')->toHtml();
         } else {
             $pdfItem['productDetails']['Subitems'] = array();
             foreach ($subItems as $bundleItem) {
                 $bundleItem['Name'] = $bundleItem['productDetails']['Name'];
                 //keep BC
                 $pdfItem['productDetails']['Subitems'][] = $bundleItem;
             }
             $html = $this->getPdfItemRow($pdfItem, $vertSpacing, $styleOverride, $position);
         }
     }
     $transport = new Varien_Object();
     $transport->setHtml($html);
     Mage::dispatchEvent('fooman_pdfcustomiser_pdf_item_row_bundle', array('item' => $pdfItem, 'subitems' => $subItems, 'transport' => $transport));
     return $transport->getHtml();
 }
コード例 #21
0
 /**
  * Mark content via the event transport mechanism. Magento 1.4.1+ 
  *
  * @param $containerArgs array
  * @param $transport Varien_Object
  * @return void
  */
 public function markContentViaTransport($containerArgs, Varien_Object $transport)
 {
     $transport->setHtml("<!-- BRIM_FPC {$containerArgs['name']} {$this->registerBlockUpdateData($containerArgs)} -->\n" . $transport->getHtml() . "\n" . "<!-- /BRIM_FPC {$containerArgs['name']} -->");
 }
コード例 #22
0
 /**
  * Produce and return block's html output
  *
  * It is a final method, but you can override _toHtml() method in descendants if needed.
  *
  * @return string
  */
 public final function toHtml()
 {
     Mage::dispatchEvent('core_block_abstract_to_html_before', array('block' => $this));
     if (Mage::getStoreConfig('advanced/modules_disable_output/' . $this->getModuleName())) {
         return '';
     }
     /* START: Added by Cm_Diehard */
     // if setBlockIsDynamic and setSuppressOutput then we automatically render only a placeholder tag.
     if ($this->getBlockIsDynamic() && Mage::registry('diehard_lifetime')) {
         if ($this->getSuppressOutput()) {
             return '<div id="' . substr($this->getDiehardSelector(), 1) . '"></div>';
         } else {
             if (FALSE) {
                 return '<!-- DIEHARD_BLOCK|' . $this->getDiehardSelector() . '|' . json_encode($this->getCacheKeyInfo()) . ' -->';
             }
         }
     }
     /* END: Added by Cm_Diehard */
     $html = $this->_loadCache();
     if ($html === false) {
         $translate = Mage::getSingleton('core/translate');
         /** @var $translate Mage_Core_Model_Translate */
         if ($this->hasData('translate_inline')) {
             $translate->setTranslateInline($this->getData('translate_inline'));
         }
         $this->_beforeToHtml();
         $html = $this->_toHtml();
         $this->_saveCache($html);
         if ($this->hasData('translate_inline')) {
             $translate->setTranslateInline(true);
         }
     }
     $html = $this->_afterToHtml($html);
     /**
      * Check framing options
      */
     if ($this->_frameOpenTag) {
         $html = '<' . $this->_frameOpenTag . '>' . $html . '<' . $this->_frameCloseTag . '>';
     }
     /**
      * Use single transport object instance for all blocks
      */
     if (self::$_transportObject === null) {
         self::$_transportObject = new Varien_Object();
     }
     self::$_transportObject->setHtml($html);
     Mage::dispatchEvent('core_block_abstract_to_html_after', array('block' => $this, 'transport' => self::$_transportObject));
     $html = self::$_transportObject->getHtml();
     return $html;
 }
コード例 #23
0
 public function testShowWarningForOpenInvoicePayments()
 {
     $transport = new Varien_Object();
     $transport->setHtml('Foo');
     $observer = Mage::getModel('ops/observer');
     $event = new Varien_Event_Observer();
     $event->setBlock('');
     $observer->appendPartialCaptureWarningForOpenInvoice($event);
     $this->assertEquals('Foo', $transport->getHtml());
     $order = new Varien_Object();
     $payment = new Varien_Object();
     $methodInstance = Mage::getModel('ops/payment_openInvoiceNl');
     $payment->setMethodInstance($methodInstance);
     $order->setPayment($payment);
     $invoice = $this->getModelMock('sales/order_invoice', array('getOrder'));
     $invoice->expects($this->any())->method('getOrder')->will($this->returnValue($order));
     Mage::register('current_invoice', $invoice);
     $block = Mage::app()->getLayout()->getBlockSingleton('adminhtml/sales_order_invoice_totals');
     $blockMock = $this->getBlockMock('ops/adminhtml_sales_order_invoice_warning_openInvoice', array('renderView'));
     $blockMock->expects($this->once())->method('renderView')->will($this->returnValue('<b>warning</b>'));
     $this->replaceByMock('block', 'ops/adminhtml_sales_order_invoice_warning_openInvoice', $blockMock);
     $event->setBlock($block);
     $event->setTransport($transport);
     $observer->appendPartialCaptureWarningForOpenInvoice($event);
     $this->assertEquals('Foo<b>warning</b>', $transport->getHtml());
     $this->assertNotEquals('Bar<span>warning</span>', $transport->getHtml());
     Mage::unregister('current_invoice');
 }
コード例 #24
0
ファイル: Sidebar.php プロジェクト: VinuWebtech/production267
 /**
  * Processing block html after rendering
  *
  * @param   string $html
  * @return  string
  */
 protected function _afterToHtml($html)
 {
     $html = parent::_afterToHtml($html);
     $transport = new Varien_Object();
     $transport->setHtml($html);
     Mage::dispatchEvent('checkout_block_cart_sidebar_aftertohtml', array('block' => $this, 'transport' => $transport));
     return $transport->getHtml();
 }
コード例 #25
0
ファイル: Abstract.php プロジェクト: eperrotta/lts2
 /**
  * Produce and return block's html output
  *
  * It is a final method, but you can override _toHtml() method in descendants if needed.
  *
  * @return string
  */
 public final function toHtml()
 {
     // MSP HACK: Start
     /* @var $ltsCache MSP_LTS2_Model_Cache */
     $ltsCache = Mage::getSingleton('msp_lts2/cache');
     if ($ltsCache->isActive() && !Mage::helper('msp_lts2')->isAdminArea() && $ltsCache->canCacheAction()) {
         $blockName = $this->getNameInLayout();
         $blockCacheHandling = $ltsCache->getBlockCacheHandling($blockName);
         if (in_array($blockCacheHandling, array(MSP_LTS2_Model_Rule_Cache::HANDLING_CACHE))) {
             $cacheKey = $ltsCache->getBlockCacheKey($blockName);
             if ($ltsCache->cacheItemExists($cacheKey)) {
                 $ltsCache->setCacheBlockStatus($blockName, MSP_LTS2_Model_Cache::CACHE_STATUS_HIT);
                 return $ltsCache->getBlockPlaceholder($blockName, true);
             }
         }
     }
     // MSP HACK: End
     Mage::dispatchEvent('core_block_abstract_to_html_before', array('block' => $this));
     if (Mage::getStoreConfig('advanced/modules_disable_output/' . $this->getModuleName())) {
         return '';
     }
     $html = $this->_loadCache();
     if ($html === false) {
         $translate = Mage::getSingleton('core/translate');
         /** @var $translate Mage_Core_Model_Translate */
         if ($this->hasData('translate_inline')) {
             $translate->setTranslateInline($this->getData('translate_inline'));
         }
         $this->_beforeToHtml();
         $html = $this->_toHtml();
         $this->_saveCache($html);
         if ($this->hasData('translate_inline')) {
             $translate->setTranslateInline(true);
         }
     }
     $html = $this->_afterToHtml($html);
     /**
      * Check framing options
      */
     if ($this->_frameOpenTag) {
         $html = '<' . $this->_frameOpenTag . '>' . $html . '<' . $this->_frameCloseTag . '>';
     }
     /**
      * Use single transport object instance for all blocks
      */
     if (self::$_transportObject === null) {
         self::$_transportObject = new Varien_Object();
     }
     self::$_transportObject->setHtml($html);
     Mage::dispatchEvent('core_block_abstract_to_html_after', array('block' => $this, 'transport' => self::$_transportObject));
     $html = self::$_transportObject->getHtml();
     // MSP HACK: Start
     if ($ltsCache->isActive() && !Mage::helper('msp_lts2')->isAdminArea() && $ltsCache->canCacheAction()) {
         if (in_array($blockCacheHandling, array(MSP_LTS2_Model_Rule_Cache::HANDLING_CACHE))) {
             $ltsCache->setBlock($blockName, $html);
         } elseif (in_array($blockCacheHandling, array(MSP_LTS2_Model_Rule_Cache::HANDLING_NOCACHE))) {
             $ltsCache->setTmpBlock($blockName, $html);
         }
         if (in_array($blockCacheHandling, array(MSP_LTS2_Model_Rule_Cache::HANDLING_CACHE, MSP_LTS2_Model_Rule_Cache::HANDLING_NOCACHE))) {
             return $ltsCache->getBlockPlaceholder($blockName);
         }
     }
     // MSP HACK: End
     return $html;
 }