<?php

/**
 * Project: 
 * Contenido Content Management System
 * 
 * Description: 
 * 
 * 
 * Requirements: 
 * @con_php_req 5.0
 * 
 *
 * @package    Contenido Backend classes
 * @version    1.0
 * @author     Unknown
 * @copyright  four for business AG <www.4fb.de>
 * @license    http://www.contenido.org/license/LIZENZ.txt
 * @link       http://www.4fb.de
 * @link       http://www.contenido.org
 * 
 * {@internal 
 *   created 
 *   
 *   $Id$:
 * }}
 * 
 */
if (!defined('CON_FRAMEWORK')) {
    die('Illegal call');
}

class cDatefield extends cHTMLTextbox {

    var $_oDate;

    function __construct($name, $initvalue, $width = 10) {
        $this->_oDate = new cDatatypeDateTime;

        $this->_oDate->set($initvalue);

        parent::__construct($name, $initvalue, $width);
    }

    function render() {
        if ($this->_oDate->get(cDateTime_ISO) != "1970-01-01") {
            if ($this->_oDate->_cTargetFormat == cDateTime_Custom) {
                parent::setValue($this->_oDate->render());
            } else {
                parent::setValue($this->_oDate->render(cDateTime_Locale_DateOnly));
            }
        }

        return parent::render();
    }

}
