protected function _toHtml()
 {
     $displayFormat = Varien_Date::convertZendToStrFtime($this->getFormat(), true, (bool) $this->getTime());
     $html = '<input type="text" name="' . $this->getName() . '" id="' . $this->getId() . '" ';
     $html .= 'value="' . $this->escapeHtml($this->getValue()) . '" class="' . $this->getClass() . '" ' . $this->getExtraParams() . '/> ';
     $html .= '<img src="' . $this->getImage() . '" alt="' . $this->helper('core')->__('Select Date') . '" class="v-middle" ';
     $html .= 'title="' . $this->helper('core')->__('Select Date') . '" id="' . $this->getId() . '_trig" />';
     $html .= '<script type="text/javascript">
     //<![CDATA[
         var calendarSetupObject = {
             inputField  : "' . $this->getId() . '",
             ifFormat    : "' . $displayFormat . '",
             showsTime   : "' . ($this->getTime() ? 'true' : 'false') . '",
             button      : "' . $this->getId() . '_trig",
             align       : "Bl",
             singleClick : true
         }';
     $calendarYearsRange = $this->getYearsRange();
     if ($calendarYearsRange) {
         $html .= '
             calendarSetupObject.range = ' . $calendarYearsRange . '
             ';
     }
     $html .= '
         Calendar.setup(calendarSetupObject);
     //]]>
     </script>';
     return $html;
 }
Пример #2
0
 public function getElementHtml()
 {
     $this->addClass('input-text');
     $html = sprintf('<input name="%s" id="%s" value="%s" %s style="width:110px !important; float:left;" />' . ' <img src="%s" alt="" class="v-middle" id="%s_trig" title="%s" style="position: relative;top: 8px;left:3px%s" />' . '<div style="clear: both;"></div>', $this->getName(), $this->getHtmlId(), $this->_escape($this->getValue()), $this->serialize($this->getHtmlAttributes()), $this->getImage(), $this->getHtmlId(), 'Select Date', $this->getDisabled() ? 'display:none;' : '');
     $outputFormat = $this->getFormat();
     if (empty($outputFormat)) {
         throw new Exception('Output format is not specified. Please, specify "format" key in constructor, or set it using setFormat().');
     }
     $displayFormat = Varien_Date::convertZendToStrFtime($outputFormat, true, (bool) $this->getTime());
     $html .= sprintf('
         <script type="text/javascript">
         //<![CDATA[
             Calendar.setup({
                 inputField: "%s",
                 ifFormat: "%s",
                 showsTime: %s,
                 button: "%s_trig",
                 align: "Bl",
                 singleClick : true
             });
         //]]>
         </script>', $this->getHtmlId(), $displayFormat, $this->getTime() ? 'true' : 'false', $this->getHtmlId());
     $html .= $this->getAfterElementHtml();
     return $html;
 }
Пример #3
0
    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;
    }
Пример #4
0
 protected function _toHtml()
 {
     $displayFormat = Varien_Date::convertZendToStrFtime($this->getFormat(), true, (bool) $this->getTime());
     $html = '<div style="white-space: nowrap;"><input type="text" name="' . $this->getName() . '" id="' . $this->getId() . '" ';
     //$html .= 'value="' . $this->escapeHtml($this->getValue()) . '" class="' . $this->getClass() . '" ' . $this->getExtraParams() . '/> ';
     $html .= 'value="#{' . $this->getTitle() . '}" class="' . $this->getClass() . '" ' . $this->getExtraParams() . '/> ';
     $html .= '<img src="' . $this->getImage() . '" alt="' . $this->helper('core')->__('Select Date') . '" class="v-middle j2t-buttons-date-admin" ';
     $html .= 'title="' . $this->helper('core')->__('Select Date') . '" />';
     $html .= '<script type="text/javascript">refreshJ2tDateAdminButons(\\\'' . $displayFormat . '\\\');<\\/script></div>';
     return $html;
 }
Пример #5
0
 public function calendarDateFormat()
 {
     return Varien_Date::convertZendToStrFtime($this->dateFormat());
 }
Пример #6
0
    public function getElementHtml()
    {
        $this->addClass('input-text');
        $html = sprintf('<input name="%s" id="%s" readonly="readonly" value="%s" %s style="width:65px !important;border:0 !important;background:none !important;font-weight:bold !important;" />' . ' <img src="%s" alt="" class="v-middle" id="%s_trig" title="%s" style="%s" />', $this->getName(), $this->getHtmlId(), $this->_escape($this->getValue()), $this->serialize($this->getHtmlAttributes()), $this->getImage(), $this->getHtmlId(), Mage::helper('gomage_checkout')->__('Select Date'), $this->getDisabled() ? 'display:none;' : '');
        $outputFormat = $this->getFormat();
        if (empty($outputFormat)) {
            throw new Exception('Output format is not specified. Please, specify "format" key in constructor, or set it using setFormat().');
        }
        $displayFormat = Varien_Date::convertZendToStrFtime($outputFormat, true, (bool) $this->getTime());
        $available_days = Mage::helper('gomage_deliverydate')->getDeliveryDays();
        $available_days = array_keys($available_days);
        $interval = intval(Mage::helper('gomage_checkout')->getConfigData('deliverydate/interval_days'));
        $disabled_dates_conf = '';
        $_disabled_dates_conf = array('false');
        $disabled_dates = array_diff(array(0, 1, 2, 3, 4, 5, 6), $available_days);
        if (!empty($disabled_dates)) {
            foreach ($disabled_dates as $day) {
                $_disabled_dates_conf[] = sprintf('(date.getDay() == %d)', $day);
            }
        }
        $nonworking_days = Mage::helper('gomage_deliverydate')->getNonWorkingDays();
        foreach ($nonworking_days as $_value) {
            $_disabled_dates_conf[] = sprintf('(date.getDate() == %d && date.getMonth() == %d)', $_value['day'], $_value['month']);
        }
        $disabled_dates_conf = 'disabled: function(date) {
		
				        if (' . implode('||', $_disabled_dates_conf) . ') {
				            return true;
				        } else {
				            return false;
				        }
				    }';
        switch (intval(Mage::helper('gomage_checkout')->getConfigData('deliverydate/dateformat'))) {
            case GoMage_DeliveryDate_Model_Adminhtml_System_Config_Source_Dateformat::EUROPEAN:
                $value_format = 'd.m.Y';
                break;
            default:
                $value_format = 'm.d.Y';
        }
        $html .= sprintf('
            <script type="text/javascript">
            //<![CDATA[
            	
            	function initDeliveryDateCallendar(){
            	
                LightCheckoutCalendar.setup({
                	fdow:0,
                    inputField : "%s",
                    dateFormat : "%s",
                    showsTime: %s,
                    trigger: "%s_trig",
                    align: "Bl",
                    bottomBar: false,
                    min:"' . date($value_format, time() + $interval * 60 * 60 * 24) . '",
                    singleClick : true' . ($disabled_dates_conf ? ',' . $disabled_dates_conf : '') . ',
                    onSelect   : function() { this.hide() },
                    addelClass : "' . (Mage::helper('gomage_checkout')->isLefttoRightWrite() ? "glc-rtl" : "") . '"
                });
                
    			}
    			initDeliveryDateCallendar();
    			
    			var glc_delivery_days = ' . Zend_Json::encode(Mage::helper('gomage_deliverydate')->getDeliveryDays()) . ';
    			var glc_time_values = ' . Zend_Json::encode(Mage::getModel('gomage_deliverydate/adminhtml_system_config_source_hour')->toOptionHash()) . ';
    			
            //]]>
            </script>', $this->getHtmlId(), $displayFormat, $this->getTime() ? 'true' : 'false', $this->getHtmlId());
        $html .= $this->getAfterElementHtml();
        return $html;
    }