public function render(Varien_Object $row) { $html = parent::render($row); $hlp = Mage::helper('udropship'); if ($this->getColumn()->getEditable()) { $calGridUrl = Mage::getDesign()->getSkinUrl('images/grid-cal.gif'); $date = $row->getData($this->getColumn()->getIndex()); if ($date) { $date = $hlp->dateInternalToLocale($date); } $_dateFormat = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT); $_calDateFormat = Varien_Date::convertZendToStrFtime($_dateFormat, true, false); $htmlId = '_' . md5(uniqid(microtime(), true)); $html .= <<<EOT <input id="{$htmlId}" type="text" class="input-text" name="{$this->getColumn()->getId()}" value="{$date}" style="width:110px !important;" /> <!--img src="{$calGridUrl}" alt="" class="v-middle"title="" style="" /--> </nobr> <script type="text/javascript"> //<![CDATA[ Calendar.setup({ inputField: "{$htmlId}", ifFormat: "{$_calDateFormat}", showsTime: false, button: "{$htmlId}_trig", align: "Bl", singleClick : true }); //]]> </script> EOT; } return $html; }
public function render(Varien_Object $row) { $content = parent::render($row); $today = strtotime(date('Y-m-d')); $value = strtotime($row->getData($this->getColumn()->getIndex())); $color = $value > $today ? 'green' : 'red'; return "<span style='color:{$color};font-weight:bold;'>{$content}</span>"; }
public function render(Varien_Object $row) { try { return parent::render($row); } catch (Exception $e) { // Exception can be thrown if, eg, values do not correspond to dates return $e->getMessage(); } }
/** * Retrieve date format * * @return string */ protected function _getFormat() { $format = $this->getColumn()->getFormat(); if (!$format) { if (is_null(self::$_format)) { try { self::$_format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM); } catch (Exception $e) { } } $format = self::$_format; } return $format; }
public function render(Varien_Object $row) { $data = $row->getData($this->getColumn()->getIndex()); return is_empty_date($data) ? '' : parent::render($row); }