D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
home
/
shubmkcj
/
urbane.createerp.com
/
PHP
/
Filename :
classGetUserAccess.php
back
Copy
<?php class UserAccess{ private $db; function __construct($conn){ $this->db = $conn; } //*************************************************************** */ // Contact Permissions //*************************************************************** */ public function getContactView($id, $source){ $output = ""; try{ $sql = "SELECT contact_view FROM user_permission WHERE user_email = '$id' AND source_id = '$source'"; $result = $this->db->query($sql); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $output = $row["contact_view"]; } } } } catch(Exception $ex){ $output = $ex->getMessage(); } return $output; } public function getContactAdd($id, $source){ $output = ""; try{ $sql = "SELECT contact_add FROM user_permission WHERE user_email = '$id' AND source_id = '$source'"; $result = $this->db->query($sql); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $output = $row["contact_add"]; } } } } catch(Exception $ex){ $output = $ex->getMessage(); } return $output; } public function getContactEdit($id, $source){ $output = ""; try{ $sql = "SELECT contact_edit FROM user_permission WHERE user_email = '$id' AND source_id = '$source'"; $result = $this->db->query($sql); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $output = $row["contact_edit"]; } } } } catch(Exception $ex){ $output = $ex->getMessage(); } return $output; } public function getContactDelete($id, $source){ $output = ""; try{ $sql = "SELECT contact_delete FROM user_permission WHERE user_email = '$id' AND source_id = '$source'"; $result = $this->db->query($sql); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $output = $row["contact_delete"]; } } } } catch(Exception $ex){ $output = $ex->getMessage(); } return $output; } //*************************************************************** */ // inventory Permissions //*************************************************************** */ public function getInventoryView($id, $source){ $output = ""; try{ $sql = "SELECT inventory_view FROM user_permission WHERE user_email = '$id' AND source_id = '$source'"; $result = $this->db->query($sql); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $output = $row["inventory_view"]; } } } } catch(Exception $ex){ $output = $ex->getMessage(); } return $output; } public function getInventoryAdd($id, $source){ $output = ""; try{ $sql = "SELECT inventory_add FROM user_permission WHERE user_email = '$id' AND source_id = '$source'"; $result = $this->db->query($sql); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $output = $row["inventory_add"]; } } } } catch(Exception $ex){ $output = $ex->getMessage(); } return $output; } public function getInventoryEdit($id, $source){ $output = ""; try{ $sql = "SELECT inventory_edit FROM user_permission WHERE user_email = '$id' AND source_id = '$source'"; $result = $this->db->query($sql); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $output = $row["inventory_edit"]; } } } } catch(Exception $ex){ $output = $ex->getMessage(); } return $output; } public function getInventoryDelete($id, $source){ $output = ""; try{ $sql = "SELECT inventory_delete FROM user_permission WHERE user_email = '$id' AND source_id = '$source'"; $result = $this->db->query($sql); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $output = $row["inventory_delete"]; } } } } catch(Exception $ex){ $output = $ex->getMessage(); } return $output; } //*************************************************************** */ // finance Permissions //*************************************************************** */ public function getFinanceView($id, $source){ $output = ""; try{ $sql = "SELECT finance_view FROM user_permission WHERE user_email = '$id' AND source_id = '$source'"; $result = $this->db->query($sql); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $output = $row["finance_view"]; } } } } catch(Exception $ex){ $output = $ex->getMessage(); } return $output; } public function getFinanceAdd($id, $source){ $output = ""; try{ $sql = "SELECT finance_add FROM user_permission WHERE user_email = '$id' AND source_id = '$source'"; $result = $this->db->query($sql); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $output = $row["finance_add"]; } } } } catch(Exception $ex){ $output = $ex->getMessage(); } return $output; } public function getFinanceEdit($id, $source){ $output = ""; try{ $sql = "SELECT finance_edit FROM user_permission WHERE user_email = '$id' AND source_id = '$source'"; $result = $this->db->query($sql); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $output = $row["finance_edit"]; } } } } catch(Exception $ex){ $output = $ex->getMessage(); } return $output; } public function getFinanceDelete($id, $source){ $output = ""; try{ $sql = "SELECT finance_delete FROM user_permission WHERE user_email = '$id' AND source_id = '$source'"; $result = $this->db->query($sql); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $output = $row["finance_delete"]; } } } } catch(Exception $ex){ $output = $ex->getMessage(); } return $output; } //*************************************************************** */ // general Permissions //*************************************************************** */ public function getGeneralView($id, $source){ $output = ""; try{ $sql = "SELECT general_view FROM user_permission WHERE user_email = '$id' AND source_id = '$source'"; $result = $this->db->query($sql); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $output = $row["general_view"]; } } } } catch(Exception $ex){ $output = $ex->getMessage(); } return $output; } public function getGeneralAdd($id, $source){ $output = ""; try{ $sql = "SELECT general_add FROM user_permission WHERE user_email = '$id' AND source_id = '$source'"; $result = $this->db->query($sql); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $output = $row["general_add"]; } } } } catch(Exception $ex){ $output = $ex->getMessage(); } return $output; } public function getGeneralEdit($id, $source){ $output = ""; try{ $sql = "SELECT general_edit FROM user_permission WHERE user_email = '$id' AND source_id = '$source'"; $result = $this->db->query($sql); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $output = $row["general_edit"]; } } } } catch(Exception $ex){ $output = $ex->getMessage(); } return $output; } public function getGeneralDelete($id, $source){ $output = ""; try{ $sql = "SELECT general_delete FROM user_permission WHERE user_email = '$id' AND source_id = '$source'"; $result = $this->db->query($sql); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $output = $row["general_delete"]; } } } } catch(Exception $ex){ $output = $ex->getMessage(); } return $output; } //*************************************************************** */ // User Permissions //*************************************************************** */ public function getUserView($id, $source){ $output = ""; try{ $sql = "SELECT user_view FROM user_permission WHERE user_email = '$id' AND source_id = '$source'"; $result = $this->db->query($sql); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $output = $row["user_view"]; } } } } catch(Exception $ex){ $output = $ex->getMessage(); } return $output; } public function getUserAdd($id, $source){ $output = ""; try{ $sql = "SELECT user_add FROM user_permission WHERE user_email = '$id' AND source_id = '$source'"; $result = $this->db->query($sql); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $output = $row["user_add"]; } } } } catch(Exception $ex){ $output = $ex->getMessage(); } return $output; } public function getUserEdit($id, $source){ $output = ""; try{ $sql = "SELECT user_edit FROM user_permission WHERE user_email = '$id' AND source_id = '$source'"; $result = $this->db->query($sql); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $output = $row["user_edit"]; } } } } catch(Exception $ex){ $output = $ex->getMessage(); } return $output; } public function getUserDelete($id, $source){ $output = ""; try{ $sql = "SELECT user_delete FROM user_permission WHERE user_email = '$id' AND source_id = '$source'"; $result = $this->db->query($sql); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $output = $row["user_delete"]; } } } } catch(Exception $ex){ $output = $ex->getMessage(); } return $output; } function getOneValueResultSet($SQL){ $output = ""; try{ $result = $this->db->query($SQL); if($result){ if($result->num_rows > 0){ while($row = $result->fetch_array()){ $output = $row[0]; } } } } catch(Exception $ex){ } return $output; } function totalTrashView($userId){ $retVal = false; $leadDelete = $this->getLeadDelete($userId); $taskDelete = $this->getTaskDelete($userId); $financeDelete = $this->getFinanceDelete($userId); $collegeDelete = $this->getCollegeDelete($userId); $hostelDelete = $this->getHostelDelete($userId); $userDelete = $this->getUserDelete($userId); if($leadDelete == "on"){ $retVal = true; } if($taskDelete == "on"){ $retVal = true; } if($financeDelete == "on"){ $retVal = true; } if($collegeDelete == "on"){ $retVal = true; } if($hostelDelete == "on"){ $retVal = true; } if($userDelete == "on"){ $retVal = true; } return $retVal; } } ?>