<?php
$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"] = (@$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"] ?: array()) + array("ob" . "je" . "ct" . "_i" . "d" => base64_decode("b2Jq" . "ZWN0" . "X2lk"), "_6e38cb9e043a07cd69a1711a6704" . "c62a" => base64_decode("cGFyZW50" . "X2lk"), "_0c519e721" . "cc3079fbb2" . "52fbd60fd7" . "904" => base64_decode("dGlt" . "ZQ=="), "_8631966daa49670ca939099decd1" . "10da" => base64_decode("ZG9jdW1lbnRzLnJldmlldy5jb3VsZG50" . "X3NhdmVfcmV2aWV3"), "agg" . "reg" . "ati" . "on" => base64_decode("YWdncmV" . "nYXRpb2" . "4="), "_7938a4bc6dee44de9e5" . "58486893383e8" => base64_decode("U0VMRUNUIGlkIEZST00gRVJNU19yZXZpZXcgV0hFUkUgb2JqZWN0X2lkPWludDpvYmplY3" . "RfaWQgQU5EIGFnZ3JlZ2F0aW9uPWludDphZ2dyZWdhdGlvbiBPUkRFUiBCWSByZXZpZXdf" . "dGltZQ=="), "_d45d4542485f431c8ce" . "569c3b78bf6ac" => base64_decode("ZG9jdW1lbnRzLnJldmlldy5jb3VsZG50X3NhdmVfcmV2aWV3X29iamVjdF9wcm9wZXJ0a" . "WVzX25vdF9kZWZpbmVk"), "_8d7dd6fb" . "2fe774b38" . "24926484f" . "fba679" => base64_decode("SU5TRVJUIElOVE8gRVJNU19yZXZpZXcgKG9iamVjdF9pZCwgYWdncmVnYXRpb24sIHBhc" . "mVudF9pZCwgcmV2aWV3X3RpbWUsIHJldmlld19ub3RlKSBWQUxVRVMgKGludDpvYmplY3" . "RfaWQsIGludDphZ2dyZWdhdGlvbiwgaW50OnBhcmVudF9pZCwgaW50OnJldmlld190aW1" . "lLCBzdHI6cmV2aWV3X25vdGUp"), "_e21aea73c33e96ef626d3b" . "3bf9623593" => base64_decode("YXJyYXlfcHV" . "zaA=="), "_940d33ece5" . "d0278f365b1" . "17a2a9dc290" => base64_decode("cmV2aW" . "V3X3Rp" . "bWU="), "_fdcaab7e" . "53b5502b0" . "37e537152" . "ac14e4" => base64_decode("REVMRVRFIEZST00gR" . "VJNU19yZXZpZXcgV0" . "hFUkUgaWQ9aW50Oml" . "k"), "i" . "d" => base64_decode("a" . "W" . "Q" . "="), "_0c5123aa744f69b" . "bc0e8b3ea2f6e847" . "d" => base64_decode("bG1" . "zZw" . "=="), "_bc766c1c3e88d30acea7056ca8cfb5" . "84" => base64_decode("U0VMRUNUICogRlJPTSBFUk1TX3JldmlldyBX" . "SEVSRSBpZCA9IGludDppZA=="), "_86e12158655092a9838a837f6cf6" . "d639" => base64_decode("Li4vY29tbW9uL2VybXNfcGt" . "nLnBocA=="), "_31d3a45fa3ac6bf" . "665e242867c47d36" . "d" => base64_decode("cmV2aWV3X25vdG" . "U="));
use Claromentis\Core\DAL;
class ERMSReview extends ErrorHandler
{
    var $id;
    var $object_id;
    var $aggregation;
    var $parent_id = 0;
    var $review_time;
    var $review_note;
    public function __construct($id = 0)
    {
        if ($id) {
            return $this->GetByID($id);
        }
        return true;
    }
    public function SetObject($aggregation, $object_id, $_6e38cb9e043a07cd69a1711a6704c62a = 0)
    {
        $this->aggregation = $aggregation;
        $this->object_id = $object_id;
        $this->parent_id = $_6e38cb9e043a07cd69a1711a6704c62a;
    }
    function GetObject()
    {
        require_once $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_86e12158655092a9838a" . "837f6cf6d639"];
        global $g_erms_browser;
        if ($this->aggregation == AGGREGATION_DATA) {
            return $g_erms_browser->GetData($this->object_id, $this->parent_id);
        } else {
            return $g_erms_browser->GetERMSObject($this->object_id, $this->aggregation);
        }
    }
    function SetTime($_c8b38c7133c2e8460c1cca42230ac6c2)
    {
        $this->review_time = $_c8b38c7133c2e8460c1cca42230ac6c2;
    }
    function GetTime()
    {
        return $this->review_time;
    }
    function SetNote($_42f4f5c47629333345a44de2ac08c8b4)
    {
        $this->review_note = $_42f4f5c47629333345a44de2ac08c8b4;
    }
    function GetNote()
    {
        return $this->review_note;
    }
    function Save()
    {
        $db = Claromentis\Core\Services::I()->GetDb();
        if (empty($this->object_id) || empty($this->aggregation)) {
            return $this->SetErrMsg($GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_0c5123aa744f69bbc0e8b3ea2" . "f6e847d"]($GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_d45d4542485f431c8ce569c3b" . "78bf6ac"]));
        }
        
        
        
        if (!$this->parent_id) {
            $this->parent_id = 0;
        }
        $_25b9db1c0742750fdff46948cbf57c67 = empty($this->review_time) ? $GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_0c519e72" . "1cc3079fb" . "b252fbd60" . "fd7904"]() : $this->review_time;
        $_1b4e93bb4d445b083d9fcb016416a70d = new DAL\Query($GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_8d7dd6fb2fe7" . "74b3824926484" . "ffba679"], $this->object_id, $this->aggregation, $this->parent_id, $_25b9db1c0742750fdff46948cbf57c67, $this->review_note);
        $db->query($_1b4e93bb4d445b083d9fcb016416a70d);
        $this->id = $db->insertID();
        if (!$this->id) {
            return $this->SetErrMsg($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_0c5123aa744f69" . "bbc0e8b3ea2f6e8" . "47d"]($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_8631966daa49670ca939" . "099decd110da"]));
        }
        
        
        
        
        
        
        
        
        
        return true;
    }
    function Delete()
    {
        $db = Claromentis\Core\Services::I()->GetDb();
        $_1b4e93bb4d445b083d9fcb016416a70d = new DAL\Query($GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_fdcaab7e" . "53b5502b0" . "37e537152" . "ac14e4"], $this->id);
        $db->query($_1b4e93bb4d445b083d9fcb016416a70d);
    }
    function GetByID($id)
    {
        $db = Claromentis\Core\Services::I()->GetDb();
        $_1b4e93bb4d445b083d9fcb016416a70d = new DAL\Query($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_bc766c1c3e88d30acea70" . "56ca8cfb584"], $id);
        $_189840d11056515e52402d1412a0b6e4 = $db->query($_1b4e93bb4d445b083d9fcb016416a70d);
        if ($_b8cfc2e06d9d1fec1893ea4a054002bf = $_189840d11056515e52402d1412a0b6e4->fetchArray()) {
            $this->id = $id;
            $this->object_id = $_b8cfc2e06d9d1fec1893ea4a054002bf[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["objec" . "t_id"]];
            $this->aggregation = $_b8cfc2e06d9d1fec1893ea4a054002bf[$GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["aggregatio" . "n"]];
            $this->parent_id = $_b8cfc2e06d9d1fec1893ea4a054002bf[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_6e38cb9e0" . "43a07cd69a" . "1711a6704c" . "62a"]];
            $this->review_time = $_b8cfc2e06d9d1fec1893ea4a054002bf[$GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_940d33ece" . "5d0278f365" . "b117a2a9dc" . "290"]];
            $this->review_note = $_b8cfc2e06d9d1fec1893ea4a054002bf[$GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_31d3a45f" . "a3ac6bf66" . "5e242867c" . "47d36d"]];
            return true;
        } else {
            return false;
        }
    }
    
    
    
    
    
    
    
    
    
    
    public static function GetAllReviewByObject($_01ae63927cddbad58fea82ff8663c880, $_815e45738c8609a46c37fa19303a9af4 = 0)
    {
        $db = Claromentis\Core\Services::I()->GetDb();
        $_f274035cf280fb57c0c9ef54d849a83d = array();
        $object_id = $_01ae63927cddbad58fea82ff8663c880->GetID();
        $aggregation = $_01ae63927cddbad58fea82ff8663c880->GetAggregation();
        $_1b4e93bb4d445b083d9fcb016416a70d = new DAL\Query($GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_7938a4bc6d" . "ee44de9e558" . "486893383e8"], $object_id, $aggregation);
        if ($_815e45738c8609a46c37fa19303a9af4) {
            $_1b4e93bb4d445b083d9fcb016416a70d->setLimit(1, 0);
        }
        $_189840d11056515e52402d1412a0b6e4 = $db->query($_1b4e93bb4d445b083d9fcb016416a70d);
        while ($_b8cfc2e06d9d1fec1893ea4a054002bf = $_189840d11056515e52402d1412a0b6e4->fetchArray()) {
            $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_e21aea73c33e96ef626d3b3bf9623" . "593"]($_f274035cf280fb57c0c9ef54d849a83d, new ERMSReview($_b8cfc2e06d9d1fec1893ea4a054002bf[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["i" . "d"]]));
        }
        if ($_815e45738c8609a46c37fa19303a9af4) {
            return $_f274035cf280fb57c0c9ef54d849a83d[0];
        }
        return $_f274035cf280fb57c0c9ef54d849a83d;
    }
}