<?php
$GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"] ?: array()) + array("_77b87bff222c" . "629b9c6d65d16" . "5e5d27d" => base64_decode("e25v" . "d30="), "_c78e2cab04076935f26a6364a0" . "6dc390" => base64_decode("ZGVmYXV" . "sdF92YW" . "x1ZQ=="), "_0c5123aa744f69" . "bbc0e8b3ea2f6e8" . "47d" => base64_decode("bG1zZw" . "=="), "_524c628f61ffed0f" . "75c1563744b5e356" => base64_decode("Zm9ybXMuaW5fZGF0ZS5zdGF0d" . "XM="), "_4d707fab93b" . "ebb00bbe69e8" . "159697c90" => base64_decode(""), "_71f379c3fb4e902" . "3b8bce154b389ef9" . "6" => base64_decode("LnZhb" . "HVl"));
use Claromentis\Core\Date\DateFormatter;




class FBTypeDatePicker extends FBType
{
    public function GetDBColumnType($info)
    {
        return FBField::DB_COLUMN_INT;
    }
    public function Val2Db($value, &$info)
    {
        $value = FBType::GetDateByTimestamp($value);
        if (!$value instanceof DateDay) {
            $_bc9ce9668cef2aaf4f81f20379fee62b = 0;
        } else {
            $_bc9ce9668cef2aaf4f81f20379fee62b = $value->getDate(DATE_FORMAT_DATE_DAY);
        }
        return $_bc9ce9668cef2aaf4f81f20379fee62b;
    }
    public function Db2Val($_bc9ce9668cef2aaf4f81f20379fee62b)
    {
        $_07af7964f51512e67eca70b67f086fce = FBType::GetDateByTimestamp($_bc9ce9668cef2aaf4f81f20379fee62b);
        return $_07af7964f51512e67eca70b67f086fce;
    }
    public function Db2Html($_bc9ce9668cef2aaf4f81f20379fee62b, &$info)
    {
        $_f04732dff212ac8d0172dd5f61cc2b19 = $this->Db2Text($_bc9ce9668cef2aaf4f81f20379fee62b, $info);
        return parent::Db2Html($_f04732dff212ac8d0172dd5f61cc2b19, $info);
    }
    public function Db2Text($_bc9ce9668cef2aaf4f81f20379fee62b, &$info)
    {
        $_f04732dff212ac8d0172dd5f61cc2b19 = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_4d707fab93bebb00bbe69e8159697c" . "90"];
        if (!empty($_bc9ce9668cef2aaf4f81f20379fee62b)) {
            
            
            if ($_bc9ce9668cef2aaf4f81f20379fee62b == $GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_77b87bff222c629b9c6d65d165e" . "5d27d"]) {
                $_07af7964f51512e67eca70b67f086fce = new DateDay();
            } else {
                $_07af7964f51512e67eca70b67f086fce = FBType::GetDateByTimestamp($_bc9ce9668cef2aaf4f81f20379fee62b);
            }
            if ($_07af7964f51512e67eca70b67f086fce !== false) {
                
                
                $_f04732dff212ac8d0172dd5f61cc2b19 = $_07af7964f51512e67eca70b67f086fce->getDate(DateFormatter::SHORT_DATE);
            }
        }
        return $_f04732dff212ac8d0172dd5f61cc2b19;
    }
    
    
    
    
    
    
    
    public function SetDefaultValue($value, &$info)
    {
        if ($value === $GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_77b87bff222c629b9c6" . "d65d165e5d27d"]) {
            $info[$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_c78e2cab04076935f26a6364a06" . "dc390"]] = $value;
        } else {
            parent::SetDefaultValue($value, $info);
        }
        return true;
    }
    public function CheckFormat($value, &$info)
    {
        if (empty($value)) {
            return;
        }
        if (!($value instanceof DateDay || $value instanceof Date) && FBType::GetDateByTimestamp($value) === false) {
            throw new Exception($GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_0c5123aa" . "744f69bbc" . "0e8b3ea2f" . "6e847d"]($GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_524c628f61ffed0f75c15" . "63744b5e356"]));
        }
    }
    public function CheckConstraints($value, &$info)
    {
        FBTypeDate::CheckDateConstraints($value, $info);
    }
    protected function GetAvailableConstraints(&$info)
    {
        return FB_CONSTRAINT_REGEXP | FB_CONSTRAINT_VALUE;
    }
    public function ShowInput($_bc9ce9668cef2aaf4f81f20379fee62b, $prefix, $info)
    {
        $_8818f59133fee2753d704649d4fff98c = parent::ShowInput($_bc9ce9668cef2aaf4f81f20379fee62b, $prefix, $info);
        $_c3ce94c36958286ed6aca023a01b3b2a = $this->GetElementName($info);
        $_8818f59133fee2753d704649d4fff98c[$_c3ce94c36958286ed6aca023a01b3b2a . $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_71f379c3fb4e9023b8bce15" . "4b389ef96"]] = $this->Db2Val($_bc9ce9668cef2aaf4f81f20379fee62b);
        return $_8818f59133fee2753d704649d4fff98c;
    }
}