ACC SHELL

Path : /srv/www/vhosts/duklavysco/libs/
File Upload :
Current File : /srv/www/vhosts/duklavysco/libs/DatePicker.php

<?php


require_once LIBS_DIR . '/Nette/Forms/Controls/TextInput.php';


/**
 * DatePicker input control.
 *
 * @author     Tomáš Kraina, Roman Sklenář
 * @package    Nette\Extras
 */
class DatePicker extends Nette\Forms\Controls\TextInput
{
    
    private $yearLength = 4;

	/**
	 * @param  string  label
	 * @param  int  width of the control
	 * @param  int  maximum number of characters the user may enter
	 */
	public function __construct($label, $cols = NULL, $maxLenght = NULL)
	{
		parent::__construct($label, $cols, $maxLenght);
	}


	/**
	 * Returns control's value.
	 * @return mixed 
	 */
//	public function getValue()
//	{
//		if (strlen($this->value)) {
//			$tmp = preg_replace('~([[:space:]])~', '', $this->value);
//			$tmp = explode('.', $tmp);
//			
//			return substr($tmp[2], 0, $this->yearLength) . '-' . $tmp[1] . '-' . $tmp[0] . ' ' . substr($tmp[2], $this->yearLength);
//		}
//		
//		return $this->value;
//	}


	/**
	 * Sets control's value.
	 * @param  string
	 * @return void
	 */
//	public function setValue($value)
//	{
//        dump($value);
//        $tmp = explode(' ', $value);
//        $date = explode('-', $tmp[0]);
//        $time = explode(':', $tmp[1]);
//        $value = $date[2] . '. ' . $date[1] . '. ' . $date[0] . ' ' . $time[0] . ':' . $time[1];
//		parent::setValue($value);
//	}


	/**
	 * Generates control's HTML element.
	 * @return Html
	 */
	public function getControl()
	{		
		$control = parent::getControl();
		$control->class = 'datepicker';
		
		return $control;
	}

}

ACC SHELL 2018