<?php
$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"] ?: array()) + array("_c78e2cab04076935f26a6" . "364a06dc390" => base64_decode("ZGVmYXVsdF92YWx1Z" . "Q=="), "_4d707fab93bebb00bbe" . "69e8159697c90" => base64_decode(""), "_0c5123aa744f69" . "bbc0e8b3ea2f6e8" . "47d" => base64_decode("bG1zZ" . "w=="), "_71f379c3fb4e9023b8bce154b389ef" . "96" => base64_decode("LnZh" . "bHVl"), "_524c628f61ffed0f75c1563744b5" . "e356" => base64_decode("Zm9ybXMuaW5fZG" . "F0ZS5zdGF0dXM="), "_77b87bff222c629b9c6d65d" . "165e5d27d" => base64_decode("e2" . "5v" . "d3" . "0="));
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"]["_4d707fab93bebb00bbe69e8159697" . "c90"];
        if (!empty($_bc9ce9668cef2aaf4f81f20379fee62b)) {
            
            
            if ($_bc9ce9668cef2aaf4f81f20379fee62b == $GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_77b87bff222c629b9c6d65d16" . "5e5d27d"]) {
                $_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["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_77b87bff222c629" . "b9c6d65d165e5d27" . "d"]) {
            $info[$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_c78e2cab040769" . "35f26a6364a06dc" . "390"]] = $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["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_0c5123aa744" . "f69bbc0e8b3e" . "a2f6e847d"]($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_524c628f61ffed0f75c1" . "563744b5e356"]));
        }
    }
    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["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_71f379c3fb4e9023b8b" . "ce154b389ef96"]] = $this->Db2Val($_bc9ce9668cef2aaf4f81f20379fee62b);
        return $_8818f59133fee2753d704649d4fff98c;
    }
}