<?php
namespace Claromentis\Calendar\Controller;

$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"] = (@$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"] ?: array()) + array("_ac523730644c48" . "704f408831bcbee" . "b66" => base64_decode("Y2FsZW5kYXIvYWRtaW4vY29u" . "ZmlnLmh0bWw="), "_89f519f306d" . "8d2116b1bcc1" . "e62dbb9fb" => base64_decode("L3Blb3BsZS" . "9hZG1pbi9j" . "b25maWc="), "_d314fa727a3fc693da3f1a15daef" . "765e" => base64_decode("Y29uZmlnX3Jv" . "d3NfY3ljbGUu" . "ZGF0YXNyYw=="), "_677bc33cfc057a689" . "acf596b15f0ae8f" => base64_decode("Y29yZS5pbnRyYW5" . "ldF9wYXRo"), "_9c01f5a3b4a36b396dd3a60e" . "8b0edaec" => base64_decode("Y29tbW9u" . "LmNvbmZp" . "Z3VyYXRp" . "b24="), "_0c5123aa7" . "44f69bbc0e" . "8b3ea2f6e8" . "47d" => base64_decode("bG1z" . "Zw=="), "_d42cb9553419a61f704ec" . "9f8997a3449" => base64_decode("Y2FsZW5kYXIuYWRtaW4ucGFuZWxfaGVh" . "ZGVy"), "_8e4802f4d4a8e515" . "d536aedb0263ab2c" => base64_decode("L3BhbmVscy9jbGFzc2VzL2FkbWluX2NvbW1v" . "bi5waHA="), "_84e603b" . "3bd977a5" . "93799450" . "aff5a873" . "a" => base64_decode("Y2FsZW5kYXIuYWRtaW4uY29" . "uZmlndXJhdGlvbl91cGRhdG" . "Vk"), "_458569b118a8329d6c3288f" . "4a92ea2ef" => base64_decode("L2ludHJhbmV0L3BhbmVscy9jbG5hZG1pbi5w" . "aHA="), "_f73dab60663" . "0b388645c4f7" . "d3fbb13bb" => base64_decode("YXJyYX" . "lfbWVy" . "Z2U="));
use Claromentis\Calendar\CalendarApplication;
use Claromentis\Calendar\Config\ConfigOptions;
use Claromentis\Core\Application;
use Claromentis\Core\Config\ConfigDialog;
use Claromentis\Core\Config\Exception\DialogException;
use Claromentis\Core\Http\gpc;
use Claromentis\Core\Http\RedirectResponse;
use Claromentis\Core\Http\TemplaterCallResponse;
use Psr\Http\Message\ServerRequestInterface;
class CalendarConfigController
{
    public function Show(Application $app, ServerRequestInterface $request)
    {
        $_678d945258a520c3df1c42fe4b558f34 = $GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_0c5123aa744f69bbc0e8b3ea2f6e" . "847d"]($GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_9c01f5a3b4a36b396dd" . "3a60e8b0edaec"]);
        $args = [];
        $options = ConfigOptions::GetAll();
        $config = CalendarApplication::getConfig();
        $config_dialog = new ConfigDialog($options, $config);
        if (gpc::isSubmit($request)) {
            try {
                $config_dialog->Update($request);
                $config->save();
                return RedirectResponse::httpRedirect(gpc::getRequestPath($request), $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_0c5123aa744f69bbc0" . "e8b3ea2f6e847d"]($GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_84e603b3bd977a5937" . "99450aff5a873a"]));
            } catch (DialogException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
                $config_dialog->SetHighlights($_fe441aa3ef350bfb1a1a1ad8520dd530->GetInvalidFields());
                $error_message = $_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage();
            }
        }
        $args[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_d314fa727a3fc" . "693da3f1a15dae" . "f765e"]] = $config_dialog->Show();
        $_9baf5ce1499e925e61d39b41dca766c8 = array($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_0c5123aa7" . "44f69bbc0e" . "8b3ea2f6e8" . "47d"]($GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_d42cb955341" . "9a61f704ec9f" . "8997a3449"]) => $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_458569b118a8329d6c3288f4a92ea2e" . "f"], $_678d945258a520c3df1c42fe4b558f34 => $GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_89f519f3" . "06d8d2116" . "b1bcc1e62" . "dbb9fb"]);
        $_d5076f32b4ae2919e5112adc9215f044 = array();
        require_once $app[$GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_677bc33c" . "fc057a689" . "acf596b15" . "f0ae8f"]] . $GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_8e4802f4d4a8e515d536aedb" . "0263ab2c"];
        $_01f5b6053500ff6a2e331cfd75ebd555 = new \AdminNavigate($_9baf5ce1499e925e61d39b41dca766c8, $_d5076f32b4ae2919e5112adc9215f044);
        $args = $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_f73dab606630b388645c4f7d3f" . "bb13bb"]($args, $_01f5b6053500ff6a2e331cfd75ebd555->Draw());
        $template = $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_ac523730644c48704f408831bcb" . "eeb66"];
        $_fd5a3a643834299cbdadfc3540ba0bcb = new TemplaterCallResponse($template, $args, $_678d945258a520c3df1c42fe4b558f34);
        if (isset($error_message)) {
            $_fd5a3a643834299cbdadfc3540ba0bcb->SetMessage($error_message, true);
        }
        return $_fd5a3a643834299cbdadfc3540ba0bcb;
    }
}