<?php
$GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"] ?: array()) + array("_e21aea73c33e96ef" . "626d3b3bf9623593" => base64_decode("YXJyYXlfc" . "HVzaA=="), "_0f21b7f12090a4a551ae" . "636be15bc235" => base64_decode("ZG9jdW1lbnRzLmF1ZGl0LnVua25vd25fYWdncmVnYXR" . "pb24="), "_4d707fab93bebb00bbe69e815969" . "7c90" => base64_decode(""), "_eba5e0f2b" . "ed17756eca" . "5406633c28" . "b03" => base64_decode("Zm9s" . "ZGVy" . "cw=="), "_2da6e43eb49a13" . "e85f6500bfe4fce" . "b5b" => base64_decode("IC0" . "g"), "_8c3c3445" . "4cbcd9535" . "b2e99795d" . "4d5ba7" => base64_decode("IEFORCBzdW" . "JfY2F0IGVx" . "OnN0cjpuX3" . "N1Yg=="), "_579a56d075a77c2" . "a32e4456504b0c2d" . "6" => base64_decode("REVMRVRFIEZST00gRVJNU19hdWRpdF9sb2dfdHh0IFdIRVJFIGNhdGVnb3J5IGVxOnN0cjpuX2" . "NhdCBBTkQgb2JqX2lkPWludDpvYmpfaWQ="), "_c33d78c9ec104" . "343758d5486340" . "b15c9" => base64_decode("ZG9jdW1lbnRzLmF1ZGl" . "0LnBhcmFtZXRlcnNfaW" . "5jb21wbGV0ZQ=="), "_0c5123aa744f69b" . "bc0e8b3ea2f6e847" . "d" => base64_decode("bG1zZw" . "=="), "_5846ddea7ff6d30bd" . "0e7b4a81710776e" => base64_decode("YXJyYXlfc2hpZ" . "nQ="), "_008f6ae2e5f89e09baf" . "f34c0d2fea915" => base64_decode("ZG9jdW1lbn" . "Rz"), "_42e4988f0cb4bcf672244a70" . "3a3b6636" => base64_decode("ZG9jdW1lbnRzLmF1ZGl0Lm9ia" . "mVjdF9pZF9ub3RfZGVmaW5lZA" . "=="), "_de24642" . "72b3994f" . "282dc91c" . "611bc9d5" . "5" => base64_decode("IE9SREVSIEJZIGR0IEFTQy" . "wgZHQyIEFTQw=="), "_47b0f57fdca53ee7" . "6624f970bcfe6b86" => base64_decode("U0VMRUNUIGR0LHVzZXJpZCxpcF9hZGRyLHByb3h5X2lwLHR5cGUsY2F0ZWdvcnksc3ViX2NhdCxvYmpfaWQsZGV0YWlscyBGUk9NIEVSTVNfYXVkaXRfbG9nX3R4dAoJCSAgICAgICAgICAgICAgICBXSEVSRSBjYXRlZ29" . "yeSBlcTpzdHI6bl9jYXQgQU5EIG9ial9pZD1pbnQ6b2JqX2lk"));
use Claromentis\Core\DAL;
class ERMSAudit extends ErrorHandler
{
    protected $obj_id;
    protected $obj_type;
    protected $audit_category;
    protected $audit_events;
    public function __construct($_01ae63927cddbad58fea82ff8663c880 = null)
    {
        $this->audit_events = array();
        if ($_01ae63927cddbad58fea82ff8663c880) {
            $this->LoadObjectProp($_01ae63927cddbad58fea82ff8663c880);
        }
    }
    
    
    
    
    
    
    
    
    
    
    public function AuditStore($_1f24efd4735b7a11b391147435e7d35d, $_c5eb4e7a08c3ad983e33b7ea72cd01de, $_9ffe981cb9413551842195b3adb6bb3d)
    {
        if (!$_c5eb4e7a08c3ad983e33b7ea72cd01de) {
            return $this->SetErrMsg($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_0c5123aa744f" . "69bbc0e8b3ea2" . "f6e847d"]($GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_c33d78c9ec" . "104343758d5" . "486340b15c9"]));
        }
        if (!ClaAudit::Need2Store($this->audit_category, $_c5eb4e7a08c3ad983e33b7ea72cd01de)) {
            return true;
        }
        $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_e21aea73c" . "33e96ef626" . "d3b3bf9623" . "593"]($this->audit_events, array($_1f24efd4735b7a11b391147435e7d35d, $_c5eb4e7a08c3ad983e33b7ea72cd01de, $_9ffe981cb9413551842195b3adb6bb3d));
        return true;
    }
    
    
    
    
    
    public function FlushAuditEvents()
    {
        if (!$this->obj_id) {
            return;
        }
        while ($event = $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_5846ddea7ff6d30bd0e7b4a" . "81710776e"]($this->audit_events)) {
            ClaAudit::Store($event[0], $this->audit_category, $event[1], $this->obj_id, $event[2]);
        }
    }
    
    
    
    
    
    public function emptyAuditEvents()
    {
        $this->audit_events = array();
    }
    
    
    
    
    
    
    
    public function LoadObjectProp($_01ae63927cddbad58fea82ff8663c880)
    {
        $this->SetObjectID($_01ae63927cddbad58fea82ff8663c880->GetID());
        return $this->SetAggregation($_01ae63927cddbad58fea82ff8663c880->GetAggregation());
    }
    
    
    
    
    
    
    
    public function SetAggregation($aggregation)
    {
        $this->obj_type = $aggregation;
        switch ($aggregation) {
            case AGGREGATION_DATA:
                $_df219e31260c5102c6e8dcf2b6e61703 = $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_008f6ae" . "2e5f89e0" . "9baff34c" . "0d2fea91" . "5"];
                break;
            case AGGREGATION_FOLDER:
                $_df219e31260c5102c6e8dcf2b6e61703 = $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_eba5e0f2bed17756eca5406633c28" . "b03"];
                break;
            default:
                return $this->SetErrMsg($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_0c5123aa" . "744f69bbc" . "0e8b3ea2f" . "6e847d"]($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_0f21b7f120" . "90a4a551ae6" . "36be15bc235"]) . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_2da6e43eb" . "49a13e85f6" . "500bfe4fce" . "b5b"] . $aggregation);
        }
        $this->audit_category = $_df219e31260c5102c6e8dcf2b6e61703;
        return true;
    }
    
    
    
    
    
    
    
    public function SetObjectID($id)
    {
        if (!$id) {
            return $this->SetErrMsg($GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_0c5123aa744f69bbc0e8b3e" . "a2f6e847d"]($GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_42e4988f0cb4bcf672244a703a3b" . "6636"]));
        }
        $this->obj_id = $id;
        return true;
    }
    
    
    
    
    
    public function DeleteAuditEvents()
    {
        $db = \Claromentis\Core\Services::I()->GetDb();
        if (!$this->obj_id) {
            return;
        }
        $db->query($GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_579a56d075a77c2a3" . "2e4456504b0c2d6"], $this->audit_category, $this->obj_id);
    }
    
    
    
    
    
    
    
    
    public function GetAuditEvents($_c5eb4e7a08c3ad983e33b7ea72cd01de = '')
    {
        $db = \Claromentis\Core\Services::I()->GetDb();
        $_189840d11056515e52402d1412a0b6e4 = array();
        $_43da825a668db5edc85134eb06cc1e0e = $_c5eb4e7a08c3ad983e33b7ea72cd01de ? new DAL\QueryPart($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_8c3c3445" . "4cbcd9535" . "b2e99795d" . "4d5ba7"], $_c5eb4e7a08c3ad983e33b7ea72cd01de) : new DAL\QueryPart($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_4d707fab93bebb00bbe69e815969" . "7c90"]);
        $_d88b50ddb42db648a9c7ac08065b9409 = new DAL\Query($GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_47b0f57fdc" . "a53ee76624f" . "970bcfe6b86"] . $_43da825a668db5edc85134eb06cc1e0e->AsPart() . $GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_de2464272" . "b3994f282d" . "c91c611bc9" . "d55"], $this->audit_category, $this->obj_id);
        $_d88b50ddb42db648a9c7ac08065b9409->BindPart($_43da825a668db5edc85134eb06cc1e0e);
        $_1f24efd4735b7a11b391147435e7d35d = $db->query($_d88b50ddb42db648a9c7ac08065b9409);
        while ($_343a395319323dd7609bcbc465b4d034 = $_1f24efd4735b7a11b391147435e7d35d->fetchArray()) {
            $_189840d11056515e52402d1412a0b6e4[] = $_343a395319323dd7609bcbc465b4d034;
        }
        return $_189840d11056515e52402d1412a0b6e4;
    }
    public function GetAuditCategory()
    {
        return $this->audit_category;
    }
}