Пример #1
0
    function render($position)
    {
        /** @var $gantry Gantry */
        global $gantry;
        ob_start();
        $now = new GantryDate();
        $format = $this->get('formats');
        ?>
    <div class="date-block">
        <span class="date"><?php 
        echo $now->toFormat($format);
        ?>
</span>
    </div>
	<?php 
        return ob_get_clean();
    }
Пример #2
0
    function render($args, $instance)
    {
        global $gantry;
        if (isset($instance['clientside']) && $instance['clientside']) {
            $gantry->addScript('gantry-date.js');
            $gantry->addDomReadyScript($this->_dateFormat($instance));
        }
        gantry_import('core.utilities.gantrydate');
        $now = new GantryDate();
        $now->_offset = get_option('gmt_offset') * 3600;
        ob_start();
        ?>
    	<div class="date-block">
			<span class="date"><?php 
        echo $now->toFormat($instance['format']);
        ?>
</span>
		</div>
	    <?php 
        echo ob_get_clean();
    }
Пример #3
0
 protected function getOptions()
 {
     $now = new GantryDate();
     // Initialize variables.
     $options = array();
     $translation = $this->element['translation'] ? $this->element['translation'] : true;
     foreach ($this->element->children() as $option) {
         // Only add <option /> elements.
         if ($option->getName() != 'option') {
             continue;
         }
         // Create a new option object based on the <option /> element.
         $tmp = GantryHtmlSelect::option((string) $option['value'], (string) $now->toFormat($option['value']), 'value', 'text', (string) $option['disabled'] == 'true');
         // Set some option attributes.
         $tmp->class = (string) $option['class'];
         // Set some JavaScript option attributes.
         $tmp->onclick = (string) $option['onclick'];
         // Add the option object to the result set.
         $options[] = $tmp;
     }
     reset($options);
     return $options;
 }