<?php
$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"] = (@$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"] ?: array()) + array("_511be8cd8d8b" . "ae4efce6b6dd4" . "ff70530" => base64_decode("ZWRpd" . "F9ldm" . "VudA=" . "="), "_d706c160e45bf7434fff82" . "a5976f0e19" => base64_decode("YXJyYX" . "lfa2V5" . "cw=="), "_0c5123aa744f69bbc0e8b3ea2f6e8" . "47d" => base64_decode("bG1" . "zZw" . "=="), "_62c6c04046599d440b89" . "fcd177155a32" => base64_decode("cm9vbXMucmJhY3Rpb24uZXZlbnRfbm90X2" . "ZvdW5k"), "_5b81cb6cf0bfd" . "990583fc12ddd8" . "0cd32" => base64_decode("Z" . "m" . "F" . "j"), "_04014b4c4cd7f8beaf" . "c06c912139b979" => base64_decode("aHR0cFJlZGl" . "yZWN0"), "i" . "d" => base64_decode("a" . "W" . "Q" . "="), "_25867e3e3db28969" . "253f3a370c3166ba" => base64_decode("ZGVzYw=" . "="), "n" . "a" . "m" . "e" => base64_decode("bm" . "Ft" . "ZQ" . "=="), "_9ec0673d3f" . "363160cec84" . "2dd84da335d" => base64_decode("ZGVsZ" . "XRlX2" . "V2ZW5" . "0"), "_78b508c82" . "2621d7c477" . "7ed7b8394c" . "1d1" => base64_decode("cmJfZWRp" . "dF9ldmVu" . "dA=="), "_4dbcdc0af6ad69a200eb" . "60c81e26305c" => base64_decode("MDA" . "="), "_2ec9a485dd2" . "85c28c8e85f0" . "1a8945982" => base64_decode("cm9vbXM" . "udG9vbG" . "tpdA=="), "_e21aea73c33e96ef626d3b" . "3bf9623593" => base64_decode("YXJyYXlfcHVz" . "aA=="), "_bf597f0023796d52ab864" . "e5096729090" => base64_decode("cH" . "Jl" . "dg" . "=="), "_be2f530b7f7" . "9423353d454b" . "8acd8ecb4" => base64_decode("bG" . "9u" . "Zw" . "=="), "_2acee84" . "48262945" . "1244aab9" . "6a01623c" . "d" => base64_decode("cm" . "9v" . "bQ" . "=="), "_7277920cd79b728" . "18ba498a7b06d9f7" . "3" => base64_decode("cm9vbXMucmJhY3Rpb24uYm9v" . "a2luZ193YXNfZGVs"), "ed" . "it" . "_i" . "d" => base64_decode("ZWRpd" . "F9pZA" . "=="), "_59be04fc0edf7507f" . "42c6c80666dc1e3" => base64_decode("UEhQX" . "1NFTE" . "Y="), "_66aaa4202afc087ccc629429b94f26" . "cf" => base64_decode("bmV4dA=" . "="));
use Claromentis\Rooms\Exception\EventNotFoundException;






class RBActionsProcessor extends ErrorHandler
{
    const DIAGRAM_PERIOD_WEEK = 0;
    const DIAGRAM_PERIOD_BIWEEK = 1;
    const DIAGRAM_PERIOD_DAY = 2;
    protected $redir = false;
    protected $message;
    protected $is_error = false;
    protected $allow_redirect = true;
    
    
    
    
    protected $toolkit;
    public function __construct($_8360eb382bc61a4bb036cc1aa0860698 = true)
    {
        global $g_application;
        $this->allow_redirect = $_8360eb382bc61a4bb036cc1aa0860698;
        $this->toolkit = $g_application[$GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_2ec9a485dd285c28c8e85f0" . "1a8945982"]];
        
        
    }
    
    
    
    
    
    
    public function ProcessAction($action)
    {
        switch ($action) {
            case $GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_9ec0673d3f363160cec842dd8" . "4da335d"]:
                gpc::CheckToken();
                $this->_delEvent();
                break;
            case $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_511be8cd8d8bae4" . "efce6b6dd4ff7053" . "0"]:
                $this->_editEvent();
                break;
            case $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_66aaa4202afc087ccc629429b94f26" . "cf"]:
                $this->_processNextScreen();
                break;
            case $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_bf597f00237" . "96d52ab864e5" . "096729090"]:
                $this->_processPrevScreen();
                break;
        }
        $this->_setGraphInterval();
        $this->toolkit->SaveStateInSession();
        if ($this->redir) {
            $this->_redirPage();
        }
    }
    
    
    
    
    protected function _editEvent()
    {
        $_68ffaaa31e3ba49ed9d6159fbee9f043 = new RBBooking(new RBFacade());
        $_68ffaaa31e3ba49ed9d6159fbee9f043->Load($this->toolkit->GetEventId());
        $_343a395319323dd7609bcbc465b4d034 = $_68ffaaa31e3ba49ed9d6159fbee9f043->_getChildList();
        $GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_e21aea73c33e96ef626d3b3bf962359" . "3"]($_343a395319323dd7609bcbc465b4d034, $_68ffaaa31e3ba49ed9d6159fbee9f043->id);
        $_SESSION[$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_78b508c82" . "2621d7c477" . "7ed7b8394c" . "1d1"]] = array($GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["i" . "d"] => $_343a395319323dd7609bcbc465b4d034, $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["edit_i" . "d"] => $_68ffaaa31e3ba49ed9d6159fbee9f043->id, $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["nam" . "e"] => $_68ffaaa31e3ba49ed9d6159fbee9f043->name, $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_25867e3e3db28969253f3a370c3166b" . "a"] => $_68ffaaa31e3ba49ed9d6159fbee9f043->desc, $GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_2acee84482629451244aab96a0" . "1623cd"] => $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_d706c160e45" . "bf7434fff82a" . "5976f0e19"]($_68ffaaa31e3ba49ed9d6159fbee9f043->GetObjList($GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_2acee84482629451244aab96a0" . "1623cd"])));
        $_343a395319323dd7609bcbc465b4d034 = $this->_createFacArray($_68ffaaa31e3ba49ed9d6159fbee9f043);
        $this->_initFormFromEditingEvent($_68ffaaa31e3ba49ed9d6159fbee9f043);
    }
    
    
    
    
    
    
    
    public function UpdateEvent($_697c39cdce3e4154b716cdd3b4e80ff5, $_5693d84b45564f912e36404cbe8957e8, $_4d031b4f6f4558056f5ba8c4e193225a, $_68850b1507f146443ff5d1f5a5460e75)
    {
        $_68ffaaa31e3ba49ed9d6159fbee9f043 = new RBBooking(new RBFacade());
        $_68ffaaa31e3ba49ed9d6159fbee9f043->Load($_697c39cdce3e4154b716cdd3b4e80ff5);
        $this->_changeEvent($_68ffaaa31e3ba49ed9d6159fbee9f043, $_5693d84b45564f912e36404cbe8957e8, $_4d031b4f6f4558056f5ba8c4e193225a, $_68850b1507f146443ff5d1f5a5460e75);
        $_dcd18f1ae5fbc1bd429492db158908aa = new RBFacade();
        $_c8b38c7133c2e8460c1cca42230ac6c2 = $_dcd18f1ae5fbc1bd429492db158908aa->DeleteEvent($_68ffaaa31e3ba49ed9d6159fbee9f043->id);
    }
    
    
    
    
    
    
    
    
    
    protected function _changeEvent($_68ffaaa31e3ba49ed9d6159fbee9f043, $_5693d84b45564f912e36404cbe8957e8, $_4d031b4f6f4558056f5ba8c4e193225a, $_68850b1507f146443ff5d1f5a5460e75)
    {
        $_dcd18f1ae5fbc1bd429492db158908aa = new RBFacade();
        $_dcd18f1ae5fbc1bd429492db158908aa->ChangeEvent($this->toolkit->GetDatePeriodDialog(), $_5693d84b45564f912e36404cbe8957e8, $_4d031b4f6f4558056f5ba8c4e193225a, $_68850b1507f146443ff5d1f5a5460e75, $this->toolkit->GetCheckedFacilities(), AuthUser::I()->GetId(), $_68ffaaa31e3ba49ed9d6159fbee9f043);
        $this->_initDateForm(new Date($this->toolkit->GetDatePeriodDialog()->GetHeadDatePeriod()->start[$GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_be2f530b" . "7f7942335" . "3d454b8ac" . "d8ecb4"]] . $GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_4dbcdc0af6ad69a200eb60c81e2630" . "5c"]));
        
        
    }
    
    
    
    
    
    protected function _createFacArray($_68ffaaa31e3ba49ed9d6159fbee9f043)
    {
        $_343a395319323dd7609bcbc465b4d034 = $_68ffaaa31e3ba49ed9d6159fbee9f043->GetObjList($GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_5b81cb6cf0" . "bfd990583fc" . "12ddd80cd32"]);
        $_094e18a2dde09a1246a956dacefdbc9c = array();
        foreach ((array) $_343a395319323dd7609bcbc465b4d034 as $key => $_c96f552040dea8086bf8bdd70059542f) {
            $_5b81cb6cf0bfd990583fc12ddd80cd32 = new RBFac(new RBFacade());
            $_5b81cb6cf0bfd990583fc12ddd80cd32->Load($key);
            $_094e18a2dde09a1246a956dacefdbc9c[$_5b81cb6cf0bfd990583fc12ddd80cd32->pid][$key] = 1;
        }
        return $_094e18a2dde09a1246a956dacefdbc9c;
    }
    
    
    
    
    protected function _initFormFromEditingEvent($_68ffaaa31e3ba49ed9d6159fbee9f043)
    {
        $_a335e14ddefbedf8ca192d19ab93691e = new RBDatePeriodDialog();
        $_a335e14ddefbedf8ca192d19ab93691e->CreateFromEvent($_68ffaaa31e3ba49ed9d6159fbee9f043);
        $this->toolkit->SetDatePeriodDialog($_a335e14ddefbedf8ca192d19ab93691e);
    }
    
    
    
    
    
    
    
    
    
    public function AddEvent($_68850b1507f146443ff5d1f5a5460e75, $_5693d84b45564f912e36404cbe8957e8, $_df4ae3ddb85ca6bd03e27e1d86fa3c41)
    {
        $_dcd18f1ae5fbc1bd429492db158908aa = new RBFacade();
        $_18cb991d3787967aac03336ac7811b3d = $_dcd18f1ae5fbc1bd429492db158908aa->CreateEvent($this->toolkit->GetDatePeriodDialog(), $_5693d84b45564f912e36404cbe8957e8, $_df4ae3ddb85ca6bd03e27e1d86fa3c41, $_68850b1507f146443ff5d1f5a5460e75, $this->toolkit->GetCheckedFacilities(), AuthUser::I()->GetId());
        $this->_initDateForm(new Date($this->toolkit->GetDatePeriodDialog()->GetHeadDatePeriod()->start[$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_be2f530b7f79423353d454b8acd8ec" . "b4"]] . $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_4dbcdc0af6ad69a200eb60c81e2" . "6305c"]));
        return $_18cb991d3787967aac03336ac7811b3d;
    }
    
    
    
    
    protected function _initDateForm($_91d10773c15d92f509551b22650c8a4e)
    {
        $this->toolkit->SetDatePoint($_91d10773c15d92f509551b22650c8a4e);
        $this->toolkit->GetDatePeriodDialog()->InitDefaultDateForm($_91d10773c15d92f509551b22650c8a4e);
    }
    
    
    
    
    protected function _delEvent($_81c1fba056fca0b94d585482be6fe046 = false)
    {
        if (!$_81c1fba056fca0b94d585482be6fe046) {
            $_81c1fba056fca0b94d585482be6fe046 = $this->toolkit->GetEventId();
        }
        $_dcd18f1ae5fbc1bd429492db158908aa = new RBFacade();
        try {
            $_c8b38c7133c2e8460c1cca42230ac6c2 = $_dcd18f1ae5fbc1bd429492db158908aa->DeleteEvent($_81c1fba056fca0b94d585482be6fe046);
            $this->_initDateForm(new Date($_c8b38c7133c2e8460c1cca42230ac6c2 . $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_4dbcdc0af6ad69a200eb60c" . "81e26305c"]));
            $this->message = $GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_0c5123aa744f69bbc0e8b3ea2f6e847" . "d"]($GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_7277920cd79b7281" . "8ba498a7b06d9f73"]);
        } catch (EventNotFoundException $e) {
            $this->is_error = true;
            $this->message = $GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_0c5123aa744f69bbc" . "0e8b3ea2f6e847d"]($GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_62c6c04046599d440b89fcd1771" . "55a32"]);
        }
        $this->redir = true;
    }
    
    
    
    
    protected function _redirPage()
    {
        if ($this->allow_redirect) {
            $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_04014b4c4cd7f8" . "beafc06c912139b" . "979"]($_SERVER[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_59be04fc0edf750" . "7f42c6c80666dc1e" . "3"]], $this->message, $this->is_error);
            exit;
        }
    }
    
    
    
    
    protected function _processNextScreen()
    {
        $_67a0d624aebcceb0abd5ce56a53ff06f = $this->toolkit->GetDatePoint();
        switch ($this->toolkit->GetDiagramLength()) {
            case self::DIAGRAM_PERIOD_WEEK:
                $this->toolkit->SetDatePoint($_67a0d624aebcceb0abd5ce56a53ff06f->getBeginOfNextWeek());
                break;
            case self::DIAGRAM_PERIOD_BIWEEK:
                $this->toolkit->SetDatePoint($_67a0d624aebcceb0abd5ce56a53ff06f->getBeginOfNextWeek()->getBeginOfNextWeek());
                break;
            case self::DIAGRAM_PERIOD_DAY:
                $this->toolkit->SetDatePoint($_67a0d624aebcceb0abd5ce56a53ff06f->getNextDay());
                break;
        }
    }
    
    
    
    
    protected function _processPrevScreen()
    {
        $_67a0d624aebcceb0abd5ce56a53ff06f = $this->toolkit->GetDatePoint();
        switch ($this->toolkit->GetDiagramLength()) {
            case self::DIAGRAM_PERIOD_WEEK:
                $this->toolkit->SetDatePoint($_67a0d624aebcceb0abd5ce56a53ff06f->getBeginOfPrevWeek());
                break;
            case self::DIAGRAM_PERIOD_BIWEEK:
                $this->toolkit->SetDatePoint($_67a0d624aebcceb0abd5ce56a53ff06f->getBeginOfPrevWeek()->getBeginOfPrevWeek());
                break;
            case self::DIAGRAM_PERIOD_DAY:
                $this->toolkit->SetDatePoint($_67a0d624aebcceb0abd5ce56a53ff06f->getPrevDay());
                break;
        }
    }
    
    
    
    
    protected function _setGraphInterval()
    {
        $_67a0d624aebcceb0abd5ce56a53ff06f = $this->toolkit->GetDatePoint();
        switch ($this->toolkit->GetDiagramLength()) {
            case self::DIAGRAM_PERIOD_BIWEEK:
                $this->toolkit->SetDiagramEdges($_67a0d624aebcceb0abd5ce56a53ff06f->getBeginOfWeek(), $_67a0d624aebcceb0abd5ce56a53ff06f->getBeginOfNextWeek()->getEndOfWeek());
                break;
            case self::DIAGRAM_PERIOD_DAY:
                $this->toolkit->SetDiagramEdges($_67a0d624aebcceb0abd5ce56a53ff06f, $_67a0d624aebcceb0abd5ce56a53ff06f);
                break;
            default:
                $this->toolkit->SetDiagramEdges($_67a0d624aebcceb0abd5ce56a53ff06f->getBeginOfWeek(), $_67a0d624aebcceb0abd5ce56a53ff06f->getEndOfWeek());
                break;
        }
    }
}