public function __construct($FacilityID, $ElementID = 0, $DeputyID = "", $ModuleID = "") { $db = parent::getPdoObject(config::$db_servers['master']["host"], config::$db_servers['master']["framework_user"], config::$db_servers['master']["framework_pass"], "framework"); if ($DeputyID != "" && $ModuleID != "") { $this->DeputyID = $DeputyID; $this->ModuleID = $ModuleID; $this->ElementID = $ElementID; } else { if (!empty($FacilityID)) { $query = "select * from SystemFacilities where FacilityID=?"; $dt = parent::runquery($query, array($FacilityID), $db); if (parent::GetExceptionCount() != 0) { return; } if (count($dt) == 0) { return; } $this->DeputyID = $dt[0]["DeputyID"]; $this->ModuleID = $dt[0]["ModuleID"]; $this->ElementID = $ElementID; } else { return; } } $this->UserID = $_SESSION["User"]->UserID; $this->Roles = UserRole::GetUserRole($this->DeputyID, $this->UserID); if (parent::GetExceptionCount() != 0) { return; } $rolesStr = "-1"; if (count($this->Roles) != 0) { for ($i = 0; $i < count($this->Roles); $i++) { $rolesStr .= "," . $this->Roles[$i]->UserRole; } } $query = "select DeputyID,ModuleID,ElementID,\r\n\t\t\t\t\t\tmax(AcInsert) as AcInsert,\r\n\t\t\t\t\t\tmax(AcFullUpdate) as AcFullUpdate,\r\n\t\t\t\t\t\tmax(AcUpdate) as AcUpdate,\r\n\t\t\t\t\t\tmax(AcFullDelete) as AcFullDelete,\r\n\t\t\t\t\t\tmax(AcDelete) as AcDelete\r\n\t\t\t\tfrom ModuleAccess\r\n\t\t\t\twhere (RoleID in({$rolesStr}) OR UserID=:uid)\r\n\t\t\t\t\tAND DeputyID=:did AND ModuleID=:mid AND ElementID=:eid\r\n\t\t\t\tgroup by DeputyID,ModuleID,ElementID"; $dt = parent::runquery($query, array(":uid" => $this->UserID, ":did" => $this->DeputyID, ":mid" => $this->ModuleID, ":eid" => $this->ElementID), $db); if (parent::GetExceptionCount() != 0 || count($dt) == 0) { return; } $this->AcInsert = $dt[0]["AcInsert"] == 0 ? false : true; $this->AcFullUpdate = $dt[0]["AcFullUpdate"] == 0 ? false : true; $this->AcUpdate = $dt[0]["AcUpdate"] == 0 ? false : true; $this->AcFullDelete = $dt[0]["AcFullDelete"] == 0 ? false : true; $this->AcDelete = $dt[0]["AcDelete"] == 0 ? false : true; }