<?php
$GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"] = (@$GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"] ?: array()) + array("_524c628f61ffed0f75c156" . "3744b5e356" => base64_decode("Zm9ybXMuaW5fZGF0ZS5z" . "dGF0dXM="), "_71f379c3fb4e9" . "023b8bce154b38" . "9ef96" => base64_decode("Ln" . "Zh" . "bH" . "Vl"), "_0c5123aa74" . "4f69bbc0e8b" . "3ea2f6e847d" => base64_decode("bG" . "1z" . "Zw" . "=="), "_4d707fab93bebb00bbe69e81" . "59697c90" => base64_decode(""), "_77b87bff222c629b9c6" . "d65d165e5d27d" => base64_decode("e25vd" . "30="), "_c78e2cab04076935f26a6364a06dc3" . "90" => base64_decode("ZGVmYXVs" . "dF92YWx1" . "ZQ=="));
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["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_4d707fab93bebb00bbe69e8159" . "697c90"];
        if (!empty($_bc9ce9668cef2aaf4f81f20379fee62b)) {
            
            
            if ($_bc9ce9668cef2aaf4f81f20379fee62b == $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_77b87bff222c629b9" . "c6d65d165e5d27d"]) {
                $_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"]["_77b87bff222c629b9c6d65" . "d165e5d27d"]) {
            $info[$GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_c78e2cab04076935f26a6364a06dc3" . "90"]] = $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["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_0c5123aa744f69bbc0e8b3ea2f6e84" . "7d"]($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_524c628f61" . "ffed0f75c15" . "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["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_71f379c3fb4e" . "9023b8bce154b" . "389ef96"]] = $this->Db2Val($_bc9ce9668cef2aaf4f81f20379fee62b);
        return $_8818f59133fee2753d704649d4fff98c;
    }
}