<?php
$GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"] ?: array()) + array("_0c5123aa744" . "f69bbc0e8b3e" . "a2f6e847d" => base64_decode("bG" . "1z" . "Zw" . "=="), "_77b87bf" . "f222c629" . "b9c6d65d" . "165e5d27" . "d" => base64_decode("e25vd" . "30="), "_71f379c3fb4e9023" . "b8bce154b389ef96" => base64_decode("LnZhbH" . "Vl"), "_524c628f61ffed0f75c1" . "563744b5e356" => base64_decode("Zm9ybXMua" . "W5fZGF0ZS" . "5zdGF0dXM" . "="), "_4d707fab93bebb00bb" . "e69e8159697c90" => base64_decode(""), "_c78e2cab04076935f26a6364" . "a06dc390" => base64_decode("ZGVmYXVsd" . "F92YWx1ZQ" . "=="));
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["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_4d707fab93bebb00bbe69e8159697" . "c90"];
        if (!empty($_bc9ce9668cef2aaf4f81f20379fee62b)) {
            
            
            if ($_bc9ce9668cef2aaf4f81f20379fee62b == $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_77b87bff222c629b9c6d65d165e5d27" . "d"]) {
                $_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"]["_77b87bff222c629b9c6d65d16" . "5e5d27d"]) {
            $info[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_c78e2cab0" . "4076935f26" . "a6364a06dc" . "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["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_0c5123aa" . "744f69bbc" . "0e8b3ea2f" . "6e847d"]($GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_524c628f" . "61ffed0f7" . "5c1563744" . "b5e356"]));
        }
    }
    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["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_71f379c3fb4e" . "9023b8bce154b" . "389ef96"]] = $this->Db2Val($_bc9ce9668cef2aaf4f81f20379fee62b);
        return $_8818f59133fee2753d704649d4fff98c;
    }
}