/** * Renders grid column * * @param Varien_Object $row * @return mixed */ public function _getValue(Varien_Object $row) { $format = $this->getColumn()->getFormat() ? $this->getColumn()->getFormat() : null; $defaultValue = $this->getColumn()->getDefault(); if (is_null($format)) { // If no format and it column not filtered specified return data as is. $data = parent::_getValue($row); $string = is_null($data) ? $defaultValue : $data; if ($this->getColumn()->getId() == 'purchaseorder_purchase_order_id') { $string = Mage::helper('inventorybarcode')->__('PO#') . $string; } if ($this->getColumn()->getId() == 'supplier_supplier_id') { $string = Mage::getModel('inventorypurchasing/supplier')->load($string)->getSupplierName(); } return $this->escapeHtml($string); } elseif (preg_match_all($this->_variablePattern, $format, $matches)) { // Parsing of format string $formattedString = $format; foreach ($matches[0] as $matchIndex => $match) { $value = $row->getData($matches[1][$matchIndex]); $formattedString = str_replace($match, $value, $formattedString); } return $formattedString; } else { return $this->escapeHtml($format); } }
public function render(Varien_Object $row) { return '<textarea name="' . $this->getColumn()->getId() . '" class="textarea" rows="5" cols="65" class="input-text ' . $this->getColumn()->getInlineCss() . '" >' . parent::_getValue($row) . '</textarea>'; }
/** * Renders grid column * * @param Varien_Object $row * @return mixed */ public function _getValue(Varien_Object $row) { $format = $this->getColumn()->getFormat() ? $this->getColumn()->getFormat() : null; $defaultValue = $this->getColumn()->getDefault(); if (is_null($format)) { // If no format and it column not filtered specified return data as is. $data = parent::_getValue($row); $string = is_null($data) ? $defaultValue : $data; $url = htmlspecialchars($string); } elseif (preg_match_all($this->_variablePattern, $format, $matches)) { // Parsing of format string $formatedString = $format; foreach ($matches[0] as $matchIndex => $match) { $value = $row->getData($matches[1][$matchIndex]); $formatedString = str_replace($match, $value, $formatedString); } $url = $formatedString; } else { $url = htmlspecialchars($format); } $location = Mage::getStoreConfig('web/secure/base_url'); return "<img src='" . $location . "media/import/{$url}' alt='{$url}' title='{$url}' width='150' />"; //return "<img src='". $location ."media/catalog/product{$url}' alt='{$url}' title='{$url}' width='150' />"; // return parent::_getValue($row); }
public function _getValue(Varien_Object $row) { if (!is_null($size = parent::_getValue($row))) { return Mage::helper('fileattributes')->getFileSizeForDisplay($size, 2); } return null; }
public function render(Varien_Object $row) { $text = parent::_getValue($row); if ($parseTags = $this->getColumn()->getParseTags()) { $processor = null; if ($parseTags == 'block') { $processor = Mage::helper('cms')->getBlockTemplateProcessor(); } elseif ($parseTags == 'page') { $processor = Mage::helper('cms')->getPageTemplateProcessor(); } if (!is_null($processor) && is_callable(array($processor, 'filter'))) { $text = $processor->filter($text); } } if (($truncate = $this->getColumn()->getTruncate()) && $truncate != 'no') { $truncateHelper = $this->helper('customgrid/string'); $truncateLength = intval($this->getColumn()->getTruncateAt()); $truncateEnding = $this->getColumn()->getTruncateEnding(); $truncateExact = (bool) $this->getColumn()->getTruncateExact(); $remainder = ''; if ($truncate == 'html') { $text = $truncateHelper->truncateHtml($text, $truncateLength, $truncateEnding, $remainder, !$truncateExact); } else { $text = $truncateHelper->truncateText($text, $truncateLength, $truncateEnding, $remainder, !$truncateExact); } } if ($this->getColumn()->getEscapeHtml()) { $text = $this->htmlEscape($text); } if ($this->getColumn()->getNl2br()) { $text = nl2br($text); } return $text; }
protected function _getValue(Varien_Object $row) { if (is_array($value = parent::_getValue($row))) { return $this->__('Existing'); } else { return $this->__('None'); } }
/** * Render "Expired / not expired" reward "Reason" field * * @param Varien_Object $row * @return string */ protected function _getValue(Varien_Object $row) { $expired = ''; if ($row->getData('is_duplicate_of') !== null) { $expired = '<em>' . Mage::helper('enterprise_reward')->__('Expired reward.') . '</em> '; } return $expired . parent::_getValue($row); }
/** * Renders grid column * * @param Varien_Object $row * @return mixed */ public function _getValue(Varien_Object $row) { $format = $this->getColumn()->getFormat() ? $this->getColumn()->getFormat() : null; $defaultValue = $this->getColumn()->getDefault(); // If no format and it column not filtered specified return data as is. $data = parent::_getValue($row); $string = is_null($data) ? $defaultValue : $data; return '<span style="' . $this->_getTextStyle($string) . '">' . $string . '</span>'; }
public function _getValue(Varien_Object $row) { $title = parent::_getValue($row); $resizeTitle = Mage::helper('core/string')->truncate($title, 50); $title = $this->escapeHtml($title); $resizeTitle = $this->escapeHtml($resizeTitle); $html = "<span title='" . $title . "'>" . $resizeTitle . "</span>"; return $html; }
/** * Renders grid column * * @param Varien_Object $row * @return string */ public function render(Varien_Object $row) { $line = parent::_getValue($row); $wrappedLine = ''; $lineLength = $this->getColumn()->getData('lineLength') ? $this->getColumn()->getData('lineLength') : $this->_defaultMaxLineLength; for ($i = 0, $n = floor(Mage::helper('core/string')->strlen($line) / $lineLength); $i <= $n; $i++) { $wrappedLine .= Mage::helper('core/string')->substr($line, $lineLength * $i, $lineLength) . "<br />"; } return $wrappedLine; }
protected function _getValue(Varien_Object $row) { $data = parent::_getValue($row); if (!is_null($data)) { $value = $data * 1; return $value ? $value : '0'; // fixed for showing zero in grid } return $this->getColumn()->getDefault(); }
/** * Renders grid column * * @param Varien_Object $row * @return mixed */ public function _getValue(Varien_Object $row) { $format = $this->getColumn()->getFormat() ? $this->getColumn()->getFormat() : null; $defaultValue = $this->getColumn()->getDefault(); // If no format and it column not filtered specified return data as is. $data = parent::_getValue($row); $string = is_null($data) ? $defaultValue : $data; $string = $this->helper('sagepaysuite')->getCardNiceDate($string); return htmlspecialchars($string); }
protected function _getValue(Varien_Object $row) { $data = parent::_getValue($row); if (intval($data) == $data) { return (string) number_format($data, 2); } if (!is_null($data)) { return $data * 1; } return $this->getColumn()->getDefault(); }
public function render(Varien_Object $row) { $maxLenght = $this->getColumn()->getStringLimit() ? $this->getColumn()->getStringLimit() : 250; $text = parent::_getValue($row); $suffix = $this->getColumn()->getSuffix() ? $this->getColumn()->getSuffix() : '...'; if (strlen($text) > $maxLenght) { return substr($text, 0, $maxLenght) . $suffix; } else { return $text; } }
/** * Renders quantity as integer * * @param Varien_Object $row * @return int|string */ public function _getValue(Varien_Object $row) { if ($row->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) { return ''; } $quantity = parent::_getValue($row); if ($row->getIsQtyDecimal()) { return sprintf("%01.4f", $quantity); } else { return intval($quantity); } }
public function _getValue(Varien_Object $row) { $text = parent::_getValue($row); if (is_null($this->__getPreviousText($text)) || is_null($this->__getDatetime($text))) { return $this->__('Unlocked'); } $title = $this->__getPreviousText($text) . $this->__getDatetime($text); $lockElement = $this->__('Unlocked'); if ($title) { $lockElement = "<span title='" . $title . "'>" . $this->__('Locked') . "</span>"; } return $lockElement; }
protected function _getValue(Varien_Object $row) { if (is_array($value = parent::_getValue($row))) { usort($value, array($this, '_sortValues')); $html = array(); foreach ($value as $variable) { $html[] = '<strong>' . $this->htmlEscape($variable['code']) . '</strong>' . ' : ' . $this->htmlEscape($variable['value']); } return implode('<br />', $html); } else { return $this->__('None'); } }
public function _getValue(Varien_Object $row) { $data = parent::_getValue($row); $resultLabels = array(); if ($data) { if (!is_array($data)) { $data = @explode(',', $data); } foreach ($data as $scopeId) { $resultLabels[] = Mage::getModel('helpdeskultimate/source_rejectedemails_scope')->getOptionLabel($scopeId); } } return $resultLabels ? implode(', ', $resultLabels) : $this->__('N/A'); }
protected function _getValue(Varien_Object $row) { $data = parent::_getValue($row); if (!is_null($data)) { $value = $data * 1; $sign = (bool) (int) $this->getColumn()->getShowNumberSign() && $value > 0 ? '+' : ''; if ($sign) { $value = $sign . $value; } return $value ? $value : '0'; // fixed for showing zero in grid } return $this->getColumn()->getDefault(); }
/** * Renders grid column * * @param Varien_Object $row * @return mixed */ public function _getValue(Varien_Object $row) { $value = parent::_getValue($row); $recipient = $row->getRecipient(); if ($recipient instanceof Mzax_Emarketing_Model_Recipient) { $campaign = $recipient->getCampaign(); $subject = $campaign->getRecipientProvider()->getSubject(); if ($subject) { $url = $subject->getAdminUrl($recipient->getObjectId()); return sprintf('<a href="%s">%s</a>', $url, $value); } } return $value; }
public function _getValue(Varien_Object $row) { $data = parent::_getValue($row); $file = $row->getData('url'); $_html = ''; if ($data && $file) { $_imageAddress = Mage::app()->getStore()->getConfig(Mage::helper('awfeatured')->isHttps() ? Mage_Core_Model_Store::XML_PATH_SECURE_BASE_URL : Mage_Core_Model_Store::XML_PATH_UNSECURE_BASE_URL); $_imageUrl = Mage_Core_Model_Store::URL_TYPE_MEDIA . DS . Mage::helper('awfeatured/images')->getFolderName() . DS . Mage::helper('awfeatured/images')->imageResizeRemote($file, $data); if ($_imageUrl) { $_html .= '<div class="a-center"><img src="' . $_imageAddress . $_imageUrl . '" /></div>'; } } return $_html; }
public function render(Varien_Object $row) { $value = (array) parent::_getValue($row); if ($pluck = $this->getColumn()->getPluck()) { $array = array(); foreach ($value as $_value) { if (isset($_value[$pluck])) { $array[] = $_value[$pluck]; } } } else { $array = $value; } $glue = $this->getColumn()->getGlue() ? $this->getColumn()->getGlue() : '<br/>'; return implode($glue, $array); }
/** * Renders grid column * * @param Varien_Object $row * @return mixed */ public function _getValue(Varien_Object $row) { $format = $this->getColumn()->getFormat() ? $this->getColumn()->getFormat() : null; $defaultValue = $this->getColumn()->getDefault(); #If no format and it column not filtered specified return data as is. $data = parent::_getValue($row); $string = is_null($data) ? $defaultValue : $data; if (false !== strpos($string, 'NOT')) { $string = $this->getSkinUrl('sagepaysuite/images/flag_red.png'); } else { if (false !== strpos($string, 'OK')) { $string = $this->getSkinUrl('sagepaysuite/images/flag_green.png'); } } return '<img src="' . $string . '" alt="' . $data . '" title="' . $data . '" />'; }
/** * Renders grid column * * @param Varien_Object $row * @return string */ public function _getValue(Varien_Object $row) { $defaultValue = $this->getColumn()->getDefault(); $data = parent::_getValue($row); $data = is_null($data) ? $defaultValue : unserialize($data); if (is_string($data)) { return htmlspecialchars($data); } $result = ''; if (is_array($data)) { foreach ($data as $key => $val) { $val = $this->getValueToString($val); $result .= $key . ": " . $val . "\n"; } } return nl2br($result); }
/** * Render contents as a long text * * Text will be truncated as specified in string_limit, truncate or 250 by default * Also it can be html-escaped and nl2br() * * @param Varien_Object $row * @return string */ public function render(Varien_Object $row) { $truncateLength = 250; // stringLength() is for legacy purposes if ($this->getColumn()->getStringLimit()) { $truncateLength = $this->getColumn()->getStringLimit(); } if ($this->getColumn()->getTruncate()) { $truncateLength = $this->getColumn()->getTruncate(); } $text = Mage::helper('core/string')->truncate(parent::_getValue($row), $truncateLength); if ($this->getColumn()->getEscape()) { $text = $this->escapeHtml($text); } if ($this->getColumn()->getNl2br()) { $text = nl2br($text); } return $text; }
public function _getValue(Varien_Object $row) { $defaultValue = $this->getColumn()->getDefault(); $data = parent::_getValue($row); switch ($data) { default: case null: case 0: case "0": $data = __("0: Nein"); break; case 1: case "1": case "Ja": $data = __("1: Ja"); break; } $res = is_null($data) ? $defaultValue : $data; return $this->escapeHtml($res); }
/** * Renders grid column * * @param Varien_Object $row * @return mixed */ public function _getValue(Varien_Object $row) { $format = $this->getColumn()->getFormat() ? $this->getColumn()->getFormat() : null; $defaultValue = $this->getColumn()->getDefault(); if (is_null($format)) { // If no format and it column not filtered specified return data as is. $data = parent::_getValue($row); $string = is_null($data) ? $defaultValue : $data; return $this->escapeHtml($string); } elseif (preg_match_all($this->_variablePattern, $format, $matches)) { // Parsing of format string $formattedString = $format; foreach ($matches[0] as $matchIndex => $match) { $value = $row->getData($matches[1][$matchIndex]); $formattedString = str_replace($match, $value, $formattedString); } return $formattedString; } else { return $this->escapeHtml($format); } }
public function _getValue(Varien_Object $row) { $_errMsg = $this->__('No Image'); $_canChangeImage = $_imurl = false; $_wrapper = '<div class="a-center">%s</div>'; try { $data = parent::_getValue($row); if ($data) { $_product = Mage::getModel('catalog/product')->load($data); if ($_product->getData()) { $_productImages = Mage::getModel('awfeatured/data_collection')->createFrom($_product->getMediaGalleryImages()); $_imurl = Mage::helper('awfeatured/images')->getProductImage($_product, $row->getData('image_id'), 120); $_canChangeImage = (bool) ($_productImages->getSize() > 1 && $this->getRequest()->getParam('id')); } } } catch (Exception $ex) { $_imurl = false; $_errMsg = $ex->getMessage(); } return sprintf($_wrapper, ($_imurl ? '<img src="' . $_imurl . '" />' : $_errMsg) . $this->_getChangeButtonHtml($_canChangeImage, $data)); }
public function _getValue(Varien_Object $row) { $format = $this->getColumn()->getFormat() ? $this->getColumn()->getFormat() : null; $defaultValue = $this->getColumn()->getDefault(); $htmlId = 'editable_' . $row->getId(); $saveUrl = $this->getUrl('*/*/ajaxSave'); if (is_null($format)) { $data = parent::_getValue($row); $string = is_null($data) ? $defaultValue : $data; $html = sprintf('<div id="%s" control="text" saveUrl="%s" attr="%s" entity="%s" class="editable">%s</div>', $htmlId, $saveUrl, $this->getColumn()->getIndex(), $row->getId(), $this->escapeHtml($string)); } elseif (preg_match_all($this->_variablePattern, $format, $matches)) { $formattedString = $format; foreach ($matches[0] as $matchIndex => $match) { $value = $row->getData($matches[1][$matchIndex]); $formattedString = str_replace($match, $value, $formattedString); } $html = sprintf('<div id="%s" control="text" saveUrl="%s" attr="%s" entity="%s" class="editable">%s</div>', $htmlId, $saveUrl, $this->getColumn()->getIndex(), $row->getId(), $formattedString); } else { $html = sprintf('<div id="%s" control="text" saveUrl="%s" attr="%s" entity="%s" class="editable">%s</div>', $htmlId, $saveUrl, $this->getColumn()->getIndex(), $row->getId(), $this->escapeHtml($format)); } return $html . "<script>if (bindInlineEdit) bindInlineEdit('{$htmlId}');</script>"; }
/** * Renders grid column * * @param Varien_Object $row * @return mixed */ public function _getValue(Varien_Object $row) { $format = $this->getColumn()->getFormat() ? $this->getColumn()->getFormat() : null; $defaultValue = $this->getColumn()->getDefault(); if (is_null($format)) { // If no format and it column not filtered specified return data as is. $data = parent::_getValue($row); $string = is_null($data) ? $defaultValue : $data; $val = htmlspecialchars($string); } elseif (preg_match_all($this->_variablePattern, $format, $matches)) { // Parsing of format string $formatedString = $format; foreach ($matches[0] as $matchIndex => $match) { $value = $row->getData($matches[1][$matchIndex]); $formatedString = str_replace($match, $value, $formatedString); } $val = $formatedString; } else { $val = htmlspecialchars($format); } // $location = Mage::getStoreConfig('web/secure/base_url'); return "{$val}"; }