<?php
$GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"] = (@$GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"] ?: array()) + array("_77b87bf" . "f222c629" . "b9c6d65d" . "165e5d27" . "d" => base64_decode("e25v" . "d30="), "_c78e2cab04076935f26a6364a06dc" . "390" => base64_decode("ZGVmYXVsdF92YW" . "x1ZQ=="), "_4d707fab93bebb00bbe69e8159697" . "c90" => base64_decode(""), "_71f379c3fb4e9023b8bce154b389ef" . "96" => base64_decode("LnZh" . "bHVl"), "_524c628f61f" . "fed0f75c1563" . "744b5e356" => base64_decode("Zm9ybXMuaW5fZGF" . "0ZS5zdGF0dXM="), "_0c5123aa744f69bbc0e" . "8b3ea2f6e847d" => base64_decode("bG1" . "zZw" . "=="));
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["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_4d707fab93bebb00bbe" . "69e8159697c90"];
        if (!empty($_bc9ce9668cef2aaf4f81f20379fee62b)) {
            
            
            if ($_bc9ce9668cef2aaf4f81f20379fee62b == $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_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["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_77b87bff222c6" . "29b9c6d65d165e" . "5d27d"]) {
            $info[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_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["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_0c5123aa744f69b" . "bc0e8b3ea2f6e847" . "d"]($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_524c628f61ffed0f75" . "c1563744b5e356"]));
        }
    }
    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["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_71f379c3fb4" . "e9023b8bce15" . "4b389ef96"]] = $this->Db2Val($_bc9ce9668cef2aaf4f81f20379fee62b);
        return $_8818f59133fee2753d704649d4fff98c;
    }
}