| 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
/**
* Class Agency
* Description This model contains the functions related to Agency.
* @name Agency
* @author Ravi Khare
* @version 1.0
* @copyright Catabatic Automation Pvt. Ltd.
* Handle Agency Related function
*
*/
class Travel_Model_TblPermission {
public $db = NULL;
public function __construct() {
$this->db = Zend_Db_Table::getDefaultAdapter();
}
public function __destruct() {
$this->db->closeConnection();
}
public function deleteRecord($whereCondition, $tableName) {
try {
$isDeleted = $this->db->update($tableName, array('IsActive' => 0), $whereCondition);
} catch (Exception $e) {
die('There has been an error. ' . $e->getMessage());
}
return @$isDeleted ? $isDeleted : 0;
}
public function getModuleData($AgencySysId, $AgentSysId, $moduleKey) {
$select = $this->db->select()
->from(array("TBA" => "TB_Agency_UserRole_Permission"), array('PermissionSysId'))
->where("TBA.AgencySysId =?", $AgencySysId)
->where("TBA.val =?", $moduleKey)
->where("TBA.IsMarkForDelete =?", 0)
->where("TBA.AgentSysId =?", $AgentSysId);
// echo $select; exit;
$result = $this->db->fetchAll($select);
return $result;
}
public function updateData($table, $data, $where) {
$result = $this->db->update($table, $data, $where);
return $result;
}
public function insertData($table, $data) {
//echo "<pre>";print_r($data);exit;
$this->db->insert($table, $data);
return $this->db->lastInsertId();
}
public function deleteData($table, $where) {
$this->db->delete($table, $where);
}
public function getModuleDataForAclMobile($AgencySysId, $AgentSysId, $display = null) {
$select = $this->db->select()
->from(array("t1" => "Tb_Agency_User_Permissions"), array())
->joinLeft(array('t2' => 'Tb_Master_Permission_Content'), 't1.ContentSysId = t2.ContentSysId', array('ControllerName', 'IsActive AS is_active', 'Title as title', 'ContentSysId AS val', 'ContentSysId AS content_sys_id', 'IsDisplayLeftNev AS is_display_left_nev', 'ISNULL(t2.IsOrder, 0 ) AS IsOrder', 'ISNULL(url, 0 ) AS url', 'ModuleName As module_name', 'ActionType as ModuleType', 'ISNULL(ParentId, 0 ) AS parent_id'))
->where("t1.IsActive =?", 1)
->where("t1.AgencySysId =?", $AgencySysId)
->where("t1.AgentSysId =?", $AgentSysId)
->where("t1.IsMarkForDel =?", 0)
->where("t2.IsDisplayLeftNev=1 OR t2.ParentId > 0")
->where("t2.IsMarkForDelete =?", 0)
->where("t2.IsActive =?", 1)
->order("t2.IsOrder");
// echo $select; exit;
$result = $this->db->fetchAll($select);
return $result;
}
public function getModuleDataForAcl($AgencySysId, $AgentSysId, $display = null) {
$select = $this->db->select()
->from(array("TBA" => "TB_Agency_UserRole_Permission"), array('ControllerName', 'IsActive AS is_active', 'Title as title', 'val', 'val AS content_sys_id', 'IsDisplayLeftNev AS is_display_left_nev', 'IsOrder', 'url', 'ModuleName As module_name', 'ModuleType', 'ParentCode AS parent_id'))
->where("TBA.AgencySysId =?", $AgencySysId)
->where("TBA.IsMarkForDelete =?", 0);
$select->where("TBA.AgentSysId =?", $AgentSysId);
if ($display) {
$select->where("TBA.IsDisplayLeftNev =?", 1);
$select->where("TBA.IsActive =?", 1);
}
$select->order("TBA.IsOrder ASC");
// echo $select; exit;
$result = $this->db->fetchAll($select);
return $result;
}
public function getModuleParent($mainArray, $childArray) {
//echo "<pre>";print
$returnArray = array();
if (!empty($childArray)) {
foreach ($childArray as $valChild) {
foreach ($mainArray as $valParent) {
if ($valChild == $valParent['val']) {
$returnArray[] = $valParent['ParentCode'];
}
}
}
}
return $returnArray;
}
public function selectActiveAgency($AgencySysId = NULL) {
$select = $this->db->select()
->from(array("TBA" => "TB_Agency"), array())
->joinLeft(array('t2' => 'TB_Agency_User'), 't2.AgencySysId = TBA.AgencySysId', array("AgencySysId", "UserSysId"))
->joinLeft(array('t3' => 'TB_Agency_UserRoles'), 't2.UserRole = t3.RoleSysId', array("RoleTitle"))
->where("TBA.IsActive =?", 1)
->where("t2.IsB2BAgent =?", 0)
->where("TBA.MasterAgencySysId =?", 0)
->where("TBA.IsVarified =?", 1)
->where("TBA.IsMarkForDelete =?", 0)
->where("t2.IsActive =?", 1)
->where("t2.IsMarkForDel =?", 0);
$select->where("TBA.IsApproved =?", 1);
if ($AgencySysId) {
$select->where("TBA.AgencySysId =?", $AgencySysId);
}
$result = $this->db->fetchAll($select);
return $result;
}
public function getAgencySysIdFromSecurityKey($SecurityKey) {
$select = $this->db->select()
->from(array("TBA" => "TB_Agency"), array('AgencySysId'));
$select->where("TBA.SecurityKey =?", $SecurityKey);
$result = $this->db->fetchAll($select);
return $result;
}
}