| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/b2bzend/application/models/ |
Upload File : |
<?php
/*
* Catabatic Technology Pvt. Ltd.
* File Name :TblAgencyUserRole.php
* File Description :TblAgencyUserRole Model managed all data related to roles
* Created By : Shobhit Srivastav
* Created Date: 27-July-2016
*/
class Master_Campaigns{
private $db = NULL;
private $hotelObj;
public function __construct() {
$this->_db = Zend_Db_Table::getDefaultAdapter();
}
public function __destruct() {
$this->db->closeConnection();
}
/**********
* Function: addHotelAmenties() is used to Insert Hotel Amenities.
* @paeam: Array.
* @return: INT.
* Date: 27-07-16.
*****/
public function addHotelAmenties($agencyRoleData = array()) {
try {
$this->db->insert('TB_Agency_UserRoles', $agencyRoleData);
$this->db->lastInsertId('TB_Agency_UserRoles');
} catch (Exception $e) {
die('There has been an error. ' . $e->getMessage());
}
return 1;
}
/*
* getRoleList(); is used to get list of roles
* return array;
* Created By- Pooja
* Created on- 29 June 2016
*/
public function getRoleList($isActive=NULL) {
$roleTitle = unserialize(AGENCY_USER_ROLE);
$whereCondition = " 1 = 1 AND RoleTitle NOT IN ('".$roleTitle[0]."','".$roleTitle[1]."') ";
if(@$_SESSION['sessionLogin_user']['intLoggedinUserAgencySysId']){
$whereCondition .= " AND AgencySysId = " . $_SESSION['sessionLogin_user']['intLoggedinUserAgencySysId'];
}
if ($isActive) {
$whereCondition .= " AND IsActive = ".$isActive;
}
$select = $this->db->select()
->from("TB_Agency_UserRoles")
->where($whereCondition)
->order("RoleSysId DESC");
$result = $this->db->fetchAll($select);
return $result;
}
/*
* getDataByRole(); is used to get role by id
* return array;
* Created By- Pooja
* Created on- 30 June 2016
*/
public function getDataByRole($RoleSysId = NULL) {
$select = $this->db->select()
->from("TB_Agency_UserRoles")
->where("RoleSysId =?", $RoleSysId);
$result = $this->db->fetchRow($select);
return $result;
}
/**
* updateAgencyUserRoleData() method is used to update agency's user role data
* @param array
* @return true
* Created By- Pooja
* Created on- 30 June 2016
*/
public function updateAgencyUserRoleData($agencyRoleData = array(), $RoleSysId = NULL) {
// print_r($agencyRoleData); echo $RoleSysId;
$where = array('RoleSysId =?' => $RoleSysId);
$this->db->update('TB_Agency_UserRoles', $agencyRoleData, $where);
}
/**
* isAgencyRoleExists() method is used to check role is exist or not
* @param array
* @return true
* Created By- Pooja
* Created on- 30 June 2016
*/
public function isAgencyRoleExists($roleTitle,$roleId=NULL) {
$whereCondition = "RoleTitle = '$roleTitle' AND AgencySysId = " . $_SESSION['sessionLogin_user']['intLoggedinUserAgencySysId'];
if ($roleId) {
$whereCondition .= " AND RoleSysId != " . $roleId;
}
$select = $this->db->select()
->from("TB_Agency_UserRoles", array('count(*) AS totalRecords'))
->where($whereCondition);
$count = $this->db->fetchOne($select);
if ($count > 0) {
return true;
}
return false;
}
}