/**
  * 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);
 }
Exemple #2
0
 /**
  * Render a grid cell for displaying info with css styles
  *
  * @param Varien_Object $row
  *
  * @return string
  */
 public function render(Varien_Object $row)
 {
     $html = parent::render($row);
     $severity = $row->getData('severity');
     $class = "aw-lib-cell-severity-" . $severity;
     return "<div class=" . $class . ">" . $html . "</div>";
 }
 public function render(Varien_Object $row)
 {
     if ($row->getData('total_inventory') > 0) {
         return parent::render($row);
     }
     return $this->__('0');
 }
 /**
  * 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);
     }
 }
Exemple #5
0
 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)
 {
     $columnName = $this->getColumn()->getName();
     $columnName = explode('_', $columnName);
     if ($columnName[1]) {
         $resource = Mage::getSingleton('core/resource');
         $readConnection = $resource->getConnection('core_read');
         $installer = Mage::getModel('core/resource');
         $warehouseId = $columnName[1];
         $purchase_order_id = $this->getRequest()->getParam('id');
         $sql = 'SELECT qty_delivery from ' . $installer->getTableName("erp_inventory_delivery_warehouse") . ' WHERE (purchase_order_id = ' . $purchase_order_id . ') AND (product_id = ' . $row->getProductId() . ') AND (warehouse_id = ' . $warehouseId . ') AND (sametime = ' . $row->getSametime() . ')';
         $results = $readConnection->fetchAll($sql);
         $haveDelivery = 0;
         foreach ($results as $result) {
             if ($result['qty_delivery']) {
                 $haveDelivery = 1;
                 echo $result['qty_delivery'];
             }
         }
         if ($haveDelivery == '0') {
             echo 0;
         }
     } else {
         parent::render($row);
     }
 }
 public function render(Varien_Object $row)
 {
     $customerId = $row->getId();
     $columnIndex = $this->getColumn()->getIndex() . "";
     $elementId = $columnIndex . $customerId;
     switch ($columnIndex) {
         case 'name':
             $columnIndexCode = 1;
             break;
         case 'email':
             $columnIndexCode = 2;
             break;
         case 'telephone':
             $columnIndexCode = 3;
             break;
         case 'customer_satisfaction_type':
             $columnIndexCode = 4;
             break;
     }
     $url = Mage::helper('adminhtml')->getUrl('*/*/updatefield', array('id' => $customerId, 'columnIndexCode' => $columnIndexCode));
     $html = '<div id="' . $elementId . '" style="min-height:20px;">';
     $html .= parent::render($row);
     $html .= '</div>';
     $html .= '<script type="text/javascript">new Ajax.InPlaceEditor("' . $elementId . '", "' . $url . '", {okText: "", cancelText:".....", highlightColor:"#6ADADA"});</script>';
     return $html;
 }
Exemple #8
0
 /**
  * Renders grid column
  *
  * @param   Varien_Object $row
  * @return  string
  */
 public function render(Varien_Object $row)
 {
     $result = parent::render($row);
     $transaction = Mage::getModel('sagepaysuite2/sagepaysuite_transaction')->load($row->getId(), 'id');
     if ($transaction->getId()) {
         if ((string) Mage::getStoreConfig('payment/sagepaysuite/sync_mode') === 'sync') {
             //check date, if transaction is newer than 7 days check status otherwise just show
             $datetime1 = new DateTime($row->getCreatedAt());
             $datetime2 = new DateTime(Mage::getModel('core/date')->gmtDate(null, "-3 day"));
             $trn_state_id = $transaction->getTxStateId();
             if (empty($trn_state_id) && $datetime1 > $datetime2) {
                 $transaction->updateFromApi();
             }
         }
         $result = $transaction->getStatus();
         if (!is_null($transaction->getTxStateId())) {
             $states = $this->helper('sagepaysuite')->getTxStates();
             $result = '<img src="' . $this->_icon($transaction->getTxStateId()) . '" title="Transaction state: ' . $states["stateid_{$transaction->getTxStateId()}"] . '" />';
         }
         //Fraud
         $fraud = Mage::getModel('sagepayreporting/sagepayreporting_fraud')->loadByOrderId($row->getId());
         if (!is_null($fraud->getThirdmanScore())) {
             $title = $this->__("Fraud: %s. Score is: %s", $fraud->getThirdmanAction(), $fraud->getThirdmanScore());
             $result .= '&nbsp;&nbsp;<img src="' . $this->_fraudIcon($fraud->getThirdmanScore()) . '" title="' . $title . '" />';
         }
         //ReD
         $red = (string) $transaction->getRedFraudResponse();
         if (!empty($red)) {
             $redTitle = $this->__("ReD Status: %s.", $red);
             $result .= '&nbsp;&nbsp;<img src="' . $this->_redFraudIcon($fraud->getThirdmanScore()) . '" title="' . $redTitle . '" />';
         }
     }
     return $result;
 }
 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;
 }
 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>';
 }
 /**
  * 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);
 }
Exemple #12
0
 protected function _getValue(Varien_Object $row)
 {
     if (is_array($value = parent::_getValue($row))) {
         return $this->__('Existing');
     } else {
         return $this->__('None');
     }
 }
 /**
  * @param Varien_Object $row
  *
  * @return mixed
  */
 public function render(Varien_Object $row)
 {
     if ($row->getCustomerId() && Mage::getSingleton('admin/session')->isAllowed('customer/manage')) {
         $customerEditUrl = $this->getUrl('*/customer/edit', array('id' => $row->getCustomerId()));
         return sprintf('<a href="%s">%s</a>', $customerEditUrl, parent::render($row));
     }
     return parent::render($row);
 }
Exemple #14
0
 public function render(Varien_Object $row)
 {
     $value = $row->getMemoryUsage();
     if ($value) {
         return number_format($row->getMemoryUsage(), 2) . ' MB';
     }
     return parent::render($row);
 }
Exemple #15
0
 /**
  * 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>';
 }
 /**
  * Renders grid column
  *
  * @param   Varien_Object $row
  * @return  string
  */
 public function render(Varien_Object $row)
 {
     $value = parent::render($row);
     $states = $this->helper('sagepaysuite')->getTxStates();
     if (isset($states["stateid_{$value}"])) {
         $value = $states["stateid_{$value}"];
     }
     return $value;
 }
 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;
 }
Exemple #18
0
 public function render(Varien_Object $row)
 {
     $productId = $row->getProductId();
     $product = Mage::getModel('catalog/product')->load($productId);
     if (!$product->getId()) {
         return $row->getProductName() . '<br/><p class="item-msg error">* This product is not in stock!</p>';
     } else {
         return parent::render($row);
     }
 }
 /**
  * Renders grid column
  *
  * @param   Varien_Object $row
  * @return  string
  */
 public function render(Varien_Object $row)
 {
     $result = parent::render($row);
     $customer = Mage::getModel('customer/customer')->load($row->getCustomerId());
     if ($customer->getId()) {
         $href = Mage::helper('adminhtml')->getUrl('adminhtml/customer/edit', array('id' => $customer->getId()));
         $result = '<a href="' . $href . '" target="_blank">' . $customer->getName() . '</a>';
     }
     return $result;
 }
Exemple #20
0
 /**
  * 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);
 }
 /**
  * Renders grid column
  *
  * @param   Varien_Object $row
  * @return  string
  */
 public function render(Varien_Object $row)
 {
     $result = parent::render($row);
     $order = Mage::getModel('sales/order')->load($row->getOrderId());
     if ($order->getId()) {
         $href = Mage::helper('adminhtml')->getUrl('adminhtml/sales_order/view', array('order_id' => $order->getId()));
         $result = '<a href="' . $href . '" target="_blank">' . $order->getIncrementId() . '</a>';
     }
     return $result;
 }
Exemple #22
0
 /**
  * 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;
 }
Exemple #23
0
 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;
     }
 }
 public function renderHeader()
 {
     if ($this->getColumn()->getHeader()) {
         return parent::renderHeader();
     }
     $checked = '';
     if ($filter = $this->getColumn()->getFilter()) {
         $checked = $filter->getValue() ? 'checked="checked"' : '';
     }
     return '<input type="checkbox" name="' . $this->getColumn()->getFieldName() . '" onclick="' . $this->getColumn()->getGrid()->getJsObjectName() . '.checkCheckboxes(this)" class="checkbox" ' . $checked . ' title="' . AO::helper('adminhtml')->__('Select All') . '"/>';
 }
Exemple #25
0
 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();
 }
 /**
  * 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');
 }
Exemple #30
0
 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;
 }