| 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 :Travel_Model_TblAgencyUserplan.php
* File Description :TblAgencyUserplan Model managed department data
* Created By : Pooja Choudhary
* Created Date: 07/07/2016 15:48
*/
class Travel_Model_TblAgencyUserplan {
private $db = NULL;
public function __construct() {
$request = Zend_Controller_Front::getInstance()->getRequest();
$this->baseUrl = $request->getScheme() . '://' . $request->getHttpHost();
$this->db = Zend_Db_Table::getDefaultAdapter();
}
public function __destruct() {
$this->db->closeConnection();
}
/**
* Add Agency Userplan.
*
* @param array $agencyUserplanData
* @return int
*/
public function addAgencyUserplan($agencyUserplanData = array()) {
try {
$this->db->insert('TB_Agency_Userplan', $agencyUserplanData);
$lastInsertId = $this->db->lastInsertId('TB_Agency_Userplan');
} catch (Exception $e) {
die('There has been an error. ' . $e->getMessage());
}
return $lastInsertId;
}
public function getUserplanList($isActive = NULL) {
$whereCondition = " OrgSysId = " . CURRENT_AGENCY_SYS_ID;
if ($isActive) {
$whereCondition .= " AND IsActive = ".$isActive;
}
$select = $this->db->select()
->from("TB_Agency_Dept")
->where($whereCondition)
->order("DeptSysId Desc");
$result = $this->db->fetchAll($select);
return $result;
}
/* Not in use. Use the below code accordingly. @SHAKTIRANA */
/*
* getDataByDepartment(); is used to get department by id
* return array;
* Created By- Pooja
* Created on- 29 June 2016
*/
public function getDataByDepartment($DeptSysId = NULL) {
$select = $this->db->select()
->from("TB_Agency_Dept")
->where("DeptSysId =?", $DeptSysId);
$result = $this->db->fetchRow($select);
return $result;
}
/**
* updateAgencyDeptData() method is used to update agency's department data
* @param array
* @return true
* Created By- Pooja
* Created on- 29 June 2016
*/
public function updateAgencyDeptData($agencyUserplanData = array(), $DeptSysId = NULL) {
// print_r($agencyUserplanData); echo $DeptSysId;
$where = array('DeptSysId =?' => $DeptSysId);
$this->db->update('TB_Agency_Dept', $agencyUserplanData, $where);
}
/**
* Is Agency Userplan Exists.
*
* @param string $deptTitle
* @param int $depId
* @return boolean
*/
public function isAgencyUserplanExists($deptTitle, $depId = NULL) {
$whereCondition = "PlanTitel = '$deptTitle' AND OrgSysId = " . CURRENT_AGENCY_SYS_ID;
if ($depId) {
$whereCondition .= " AND DeptSysId != " . $depId;
}
$select = $this->db->select()
->from("TB_Agency_Dept", array('count(*) AS totalRecords'))
->where($whereCondition);
$count = $this->db->fetchOne($select);
if ($count > 0) {
return true;
}
return false;
}
}