<?php
$GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"] = (@$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"] ?: array()) + array("_0c5123aa744f69bbc0e" . "8b3ea2f6e847d" => base64_decode("bG" . "1z" . "Zw" . "=="), "_a452562e90118d3f3b23d94" . "82a407deb" => base64_decode("U0VMRUNUIGlkLCBuY" . "W1lIEZST00gd2ZfY2" . "F0ZWdvcnkgT1JERVI" . "gQlkgbmFtZQ=="), "_a84d4e086479d8" . "e55ffb4e3c8b3c2" . "cf7" => base64_decode("d2ZfY2F0" . "ZWdvcnku" . "cGVybV9p" . "ZA=="), "_0aaf4c263c47ca88308b769cdc0804b" . "e" => base64_decode("IE9SR" . "EVSIE" . "JZIG5" . "hbWU="), "perm" . "s" => base64_decode("cGVybX" . "M="), "_70d2bd7" . "8cab3d15" . "762db35e" . "c8bc6d00" . "f" => base64_decode("Q2Fubm90IGZpbmQgY2F0ZWdvcnkgd2l0aCBzdWNoIG" . "lk"), "_a77286b791af0933c781d2e" . "09d4e2225" => base64_decode("cGFuZWxzLndvcmtmbG9" . "3X2NhdGVnb3J5LmNhbn" . "RfZGVsZXRlX25vbl9lb" . "XB0eQ=="), "_f8713e229" . "c3c165d58b" . "874f896ed8" . "105" => base64_decode("UGVybUNoZWNrQ" . "XNTUUw="), "_b4594f46725555bf20d81748c4d3" . "8459" => base64_decode("d2ZfY2F0ZWdv" . "cnk="), "_75ef4079" . "806c4d475" . "0ceb49f6a" . "576d29" => base64_decode("U0VMRUNUIERJU1RJTkNUIGlkLCBuYW1lIEZST00gd2ZfY2F0ZWdvcnksIHBlcm1pc3Npb25z" . "IFdIRVJFIA=="), "_4d707fab93b" . "ebb00bbe69e8" . "159697c90" => base64_decode(""));
class WFCategory extends DBObject
{
    
    
    
    
    protected $id;
    protected $name;
    protected $description;
    
    
    
    
    
    
    protected $perms;
    
    
    
    
    public function __construct()
    {
        $this->TABLE_NAME = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_b4594f4672" . "5555bf20d81" . "748c4d38459"];
        $this->id = -1;
        $this->name = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_4d707fab93bebb00" . "bbe69e8159697c90"];
        $this->description = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_4d707fab93bebb00" . "bbe69e8159697c90"];
        $this->perms = new UnifiedPermissions();
    }
    
    
    
    
    
    
    
    public function IsSpecial($_40421a4e75c2ba3c82b018e6b56f7425)
    {
        return $_40421a4e75c2ba3c82b018e6b56f7425 == $GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["p" . "e" . "r" . "m" . "s"] || parent::IsSpecial($_40421a4e75c2ba3c82b018e6b56f7425);
    }
    
    
    
    
    
    
    public function HasWorkflows()
    {
        $_b1eaa3313a3fd528f63e18a69460560a = new WFWorkflow();
        $_b1eaa3313a3fd528f63e18a69460560a->SetCategoryId($this->id);
        $_19e43d4a76a795ab7f0432112f84b5ec = $_b1eaa3313a3fd528f63e18a69460560a->GetSameByCategory();
        if ($_b1eaa3313a3fd528f63e18a69460560a->IsError()) {
            return $this->SetErrMsg($_b1eaa3313a3fd528f63e18a69460560a->GetErrMsg());
        }
        return !empty($_19e43d4a76a795ab7f0432112f84b5ec);
    }
    
    
    
    
    
    
    public function GetAllWorkflows()
    {
        $_b1eaa3313a3fd528f63e18a69460560a = new WFWorkflow($this->id);
        return $_b1eaa3313a3fd528f63e18a69460560a->GetSameByCategory();
    }
    
    
    
    
    
    
    protected function DeletePerms()
    {
        return $this->PassError($this->perms->DeleteAll(), $this->perms);
    }
    
    
    
    
    
    
    public function GetId()
    {
        return $this->id;
    }
    
    
    
    
    
    
    public function GetName()
    {
        return $this->name;
    }
    
    
    
    
    
    
    
    public function SetName($name)
    {
        $this->name = $name;
        return true;
    }
    
    
    
    
    
    
    public function GetDescription()
    {
        return $this->description;
    }
    
    
    
    
    
    
    public function SetDescription($_28fd57f750dbb5ffb3ffad3a888358a9)
    {
        $this->description = $_28fd57f750dbb5ffb3ffad3a888358a9;
        return true;
    }
    
    
    
    
    public function GetDefaultWFPermissions()
    {
        return $this->perms;
    }
    
    
    
    
    
    
    
    public function SetDefaultWFPermissions($perms)
    {
        $this->perms = $perms;
        return true;
    }
    public function Load($id = -1)
    {
        parent::Load($id);
        if (!$this->id) {
            return $this->SetErrMsg($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_70d2bd78cab3d15762db35ec8bc6d" . "00f"]);
        }
        
        
        if ($this->perm_id) {
            $this->perms->Load($this->perm_id);
        }
        if ($this->perms->IsError()) {
            return $this->SetErrMsg($this->perms->GetErrMsg());
        }
        return true;
    }
    public function Save()
    {
        global $db;
        if (!$this->perms->Save()) {
            return $this->SetErrMsg($this->perms->GetErrMsg());
        }
        $this->perm_id = $this->perms->id;
        parent::Save();
        return true;
    }
    
    
    
    
    
    
    public function Delete()
    {
        if ($this->HasWorkflow()) {
            return $this->SetErrMsg($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_0c5123aa744" . "f69bbc0e8b3e" . "a2f6e847d"]($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_a77286b791" . "af0933c781d" . "2e09d4e2225"]));
        }
        parent::Delete();
        $this->DeletePerms();
        return true;
    }
    public function GetPerms()
    {
        return $this->GetDefaultWFPermissions();
    }
    
    
    
    
    
    
    
    
    public function UserHasPermission($perms, $_3877cdf57a61e49b56aeab7af930ee82 = false)
    {
        return $this->GetPerms()->UserHasPermission($perms, 0, $_3877cdf57a61e49b56aeab7af930ee82);
    }
    
    
    
    
    
    
    public static function GetCategoryList($admin_mode, $rights)
    {
        global $db;
        $_1f24efd4735b7a11b391147435e7d35d = array();
        if ($admin_mode) {
            $_7f5aa4e96d4b415a86ed72ebff677cbe = $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_a452562e90118d3f3b23d9482a40" . "7deb"];
        } else {
            $_7f5aa4e96d4b415a86ed72ebff677cbe = $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_75ef4079806c4d4750ceb49f6a576d2" . "9"] . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_f8713e229c" . "3c165d58b87" . "4f896ed8105"](PERM_CLASS_UNIFIED, $GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_a84d4e086479d8e55ffb4e3c8b3c2" . "cf7"], $rights) . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_0aaf4c263c47ca88308b769cd" . "c0804be"];
        }
        $_a606a2dcd236a549db0574a9c1675927 = $db->query(new Query($_7f5aa4e96d4b415a86ed72ebff677cbe));
        while (list($_016db8297b062559d6c50204224476d1, $_e4858e7761a793faacb8c393283a3d5e) = $_a606a2dcd236a549db0574a9c1675927->fetchRow()) {
            $_1f24efd4735b7a11b391147435e7d35d[$_016db8297b062559d6c50204224476d1] = $_e4858e7761a793faacb8c393283a3d5e;
        }
        return $_1f24efd4735b7a11b391147435e7d35d;
    }
    
    
    
    
    
    
    
    public function HasWorkflow()
    {
        return $this->HasWorkflows();
    }
}