Public Member Functions | |
getValue ($index=null) | |
getHtml () | |
getEscapedValue ($index=null) | |
Public Attributes | |
const | END_OF_DAY_IN_SECONDS = 86399 |
Protected Member Functions | |
_convertDate ($date, $locale) |
Definition at line 35 of file Datetime.php.
_convertDate | ( | $ | date, | |
$ | locale | |||
) | [protected] |
Convert given date to default (UTC) timezone
string | $date | |
string | $locale |
Reimplemented from Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Date.
Definition at line 67 of file Datetime.php.
00068 { 00069 if ($this->getColumn()->getFilterTime()) { 00070 try { 00071 $dateObj = $this->getLocale()->date(null, null, $locale, false); 00072 00073 //set default timezone for store (admin) 00074 $dateObj->setTimezone(Mage::app()->getStore()->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE)); 00075 00076 //set date with applying timezone of store 00077 $dateObj->set( 00078 $date, 00079 $this->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT), 00080 $locale 00081 ); 00082 00083 //convert store date to default date in UTC timezone without DST 00084 $dateObj->setTimezone(Mage_Core_Model_Locale::DEFAULT_TIMEZONE); 00085 00086 return $dateObj; 00087 } 00088 catch (Exception $e) { 00089 return null; 00090 } 00091 } 00092 00093 return parent::_convertDate($date, $locale); 00094 }
getEscapedValue | ( | $ | index = null |
) |
Return escaped value for calendar
string | $index |
Reimplemented from Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Date.
Definition at line 148 of file Datetime.php.
00149 { 00150 if ($this->getColumn()->getFilterTime()) { 00151 $value = $this->getValue($index); 00152 if ($value instanceof Zend_Date) { 00153 return $value->toString($this->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)); 00154 } 00155 return $value; 00156 } 00157 00158 return parent::getEscapedValue($index); 00159 }
getHtml | ( | ) |
Render filter html
Reimplemented from Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Date.
Definition at line 101 of file Datetime.php.
00102 { 00103 $htmlId = $this->_getHtmlId() . microtime(true); 00104 $format = $this->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT); 00105 00106 if ($this->getColumn()->getFilterTime()) { 00107 $format .= ' ' . $this->getLocale()->getTimeStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT); 00108 } 00109 00110 $html = '<div class="range"><div class="range-line date"> 00111 <span class="label">' . Mage::helper('adminhtml')->__('From').':</span> 00112 <input type="text" name="'.$this->_getHtmlName().'[from]" id="'.$htmlId.'_from" value="'.$this->getEscapedValue('from').'" class="input-text no-changes"/> 00113 <img src="' . Mage::getDesign()->getSkinUrl('images/grid-cal.gif') . '" alt="" class="v-middle" id="'.$htmlId.'_from_trig" title="'.$this->htmlEscape(Mage::helper('adminhtml')->__('Date selector')).'"/> 00114 </div>'; 00115 $html.= '<div class="range-line date"> 00116 <span class="label">' . Mage::helper('adminhtml')->__('To').' :</span> 00117 <input type="text" name="'.$this->_getHtmlName().'[to]" id="'.$htmlId.'_to" value="'.$this->getEscapedValue('to').'" class="input-text no-changes"/> 00118 <img src="' . Mage::getDesign()->getSkinUrl('images/grid-cal.gif') . '" alt="" class="v-middle" id="'.$htmlId.'_to_trig" title="'.$this->htmlEscape(Mage::helper('adminhtml')->__('Date selector')).'"/> 00119 </div></div>'; 00120 $html.= '<input type="hidden" name="'.$this->_getHtmlName().'[locale]" value="'.$this->getLocale()->getLocaleCode().'"/>'; 00121 $html.= '<script type="text/javascript"> 00122 Calendar.setup({ 00123 inputField : "'.$htmlId.'_from", 00124 ifFormat : "'.$format.'", 00125 button : "'.$htmlId.'_from_trig", 00126 showsTime: '. ( $this->getColumn()->getFilterTime() ? 'true' : 'false') .', 00127 align : "Bl", 00128 singleClick : true 00129 }); 00130 Calendar.setup({ 00131 inputField : "'.$htmlId.'_to", 00132 ifFormat : "'.$format.'", 00133 button : "'.$htmlId.'_to_trig", 00134 showsTime: '. ( $this->getColumn()->getFilterTime() ? 'true' : 'false') .', 00135 align : "Bl", 00136 singleClick : true 00137 }); 00138 </script>'; 00139 return $html; 00140 }
getValue | ( | $ | index = null |
) |
Reimplemented from Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Date.
Definition at line 40 of file Datetime.php.
00041 { 00042 if ($index) { 00043 if ($data = $this->getData('value', 'orig_'.$index)) { 00044 return $data;//date('Y-m-d', strtotime($data)); 00045 } 00046 return null; 00047 } 00048 $value = $this->getData('value'); 00049 if (is_array($value)) { 00050 $value['datetime'] = true; 00051 } 00052 if (!empty($value['to']) && !$this->getColumn()->getFilterTime()) { 00053 $datetimeTo = $value['to']; 00054 //set end of the day 00055 $datetimeTo->addSecond(self::END_OF_DAY_IN_SECONDS); 00056 } 00057 return $value; 00058 }
const END_OF_DAY_IN_SECONDS = 86399 |
Definition at line 38 of file Datetime.php.