403Webshell
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/prathamtour.com/application/admin/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/prathamtour.com/application/admin/models/CRUD.php
<?php
/***************************************************************
 * Catabatic Technology Pvt. Ltd.
 * File Name    : CRUD.php
 * File Desc.   : CRUD Model
 * Created By    : Piyush Tiwari <piyush@catpl.co.in>
 * Created Date : 23-05-2018
 * Updated Date : 28-06-2018
 * 
***************************************************************/



class Admin_Model_CRUD extends Zend_Db_Table_Abstract
{
     
    protected $db;
    protected $gtxagencysysid;
    

    function init() {
        $this->db = Zend_Db_Table::getDefaultAdapter();
        $options = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOption('bootstrap');
        $this->gtxagencysysid = $options['gtxagencysysid'];
    }
    
    /**
    * rv_create() method is used to add insert into database
    * @param tablename , array
    * @return inserted id
    */
    
    public function rv_insert($tablename, array $addData)
    {
        
        $dbtable = new Zend_Db_Table($tablename);
        
         $agencyIdArray = array("AgencySysId"=>$this->gtxagencysysid);
       
       $addData =  array_merge($addData,$agencyIdArray);

        //echo "<pre>";print_r($addData);exit();
        
        return $dbtable->insert($addData); // return inserted id
    }
    
//    public function rv_insert_footer($tablename, array $addData)
//    {
//        $dbtable = new Zend_Db_Table($tablename);
//        return $dbtable->insert($addData); // return inserted id
//    }
    /**
    * rv_update() method is used to edit 
    * @param table name, array data, where array
    * @return true 
    */
    public function rv_update($tablename, array $editData, array $where)
    {
        $dbtable = new Zend_Db_Table($tablename);
        return $dbtable->update($editData,$where); // return row effected or not
    }
    
    
    /**
    * delete() method is used to add menu
    * @param array
    * @return true 
    */
    public function rv_delete($table , $where)
    {   
        $dbtable = new Zend_Db_Table($table);
        return $dbtable->delete($where);
    }
    
    
    /**
    * rv_select_all() method is used to get all listing
    * @param table name, columns array, where array, order array
    * @return array result set
    */	
    public function rv_select_all($tablename, array $columns, array $where, array $order, $limit =false)
    {
        $dbtable = new Zend_Db_Table($tablename);
        $select = $dbtable->select()->from("$tablename as tbl", $columns)->where("AgencySysId=$this->gtxagencysysid");
        
        if(count($where)){
            foreach ($where as $k => $v)
            $select->where("$k=?","$v");
        }
        if(count($order)){
            foreach ($order as $k => $v)
            $select->order("$k  $v");
        }
        if($limit){
            $select->limit($limit);
        }
//        echo "<pre>" ;print_r($select); die();
        $result = $dbtable->fetchAll($select);
        if($result==NULL)
            return false;
        else
            return $result->toArray();
    }
	public function rv_select_all_common($tablename, array $columns, array $where, array $order, $limit =false)
    {
        $dbtable = new Zend_Db_Table($tablename);
        $select = $dbtable->select()->from("$tablename as tbl", $columns);
        
        if(count($where)){
            foreach ($where as $k => $v)
            $select->where("$k=?","$v");
        }
        if(count($order)){
            foreach ($order as $k => $v)
            $select->order("$k  $v");
        }
        if($limit){
            $select->limit($limit);
        }
//        echo "<pre>" ;print_r($select); die();
        $result = $dbtable->fetchAll($select);
        if($result==NULL)
            return false;
        else
            return $result->toArray();
    }
    
    public function rv_select_blog_all($tablename, array $columns, array $where, array $order, $limit =false)
    {
        $dbtable = Zend_Db_Table::getDefaultAdapter();

        $select="SELECT * FROM tbl_travelogues p LEFT JOIN ( SELECT blogId, COUNT(*) as cc FROM tbl_comments as cn GROUP BY blogId ) x ON x.blogId = p.TravId where p.AgencySysId = '$this->gtxagencysysid' and p.isMarkForDel = '0' order by TravId DESC";
        //$select->where("AgencySysId",2);
        $result = $dbtable->fetchAll($select);

        if($result==NULL)
            return false;
        else
            return $result;
    }
    
    public function rv_select_blog_all_home($tablename, array $columns, array $where, array $order, $limit =false)
    {
        $dbtable = Zend_Db_Table::getDefaultAdapter();

        $select="SELECT * FROM tbl_travelogues p LEFT JOIN ( SELECT blogId, COUNT(*) as cc FROM tbl_comments as cn GROUP BY blogId ) x ON x.blogId = p.TravId where p.isMarkForDel = '0' and p.status = '1' and p.displayOnBanner = '1'";

        $result = $dbtable->fetchAll($select);
        
        if($result==NULL)
            return false;
        else
            return $result;
    }
    
    
       public function rv_select_destination_all($tablename, array $columns)
    {
        $dbtable = new Zend_Db_Table($tablename);
        $select = $dbtable->select()->from("$tablename as tbl", $columns)->where("AgencySysId=$this->gtxagencysysid");
        
//        if(count($where)){
//            foreach ($where as $k => $v)
//            $select->where("$k =?","$v");
//        }
//        if(count($order)){
//            foreach ($order as $k => $v)
//            $select->order("$k  $v");
//        }
//        if($limit){
//            $select->limit($limit);
//        }
//        echo $select;
//        die('here');
        $result = $dbtable->fetchAll($select);
        if($result==NULL)
            return false;
        else
            return $result->toArray();
    }

 public function rv_select_all_package($tablename, array $columns, array $where) {
        $page = isset($this->searchArr['page']) ? intval($this->searchArr['page']) : 1;
        $rows = isset($this->searchArr['rows']) ? intval($this->searchArr['rows']) : 10;
        $sort = isset($this->searchArr['sort']) ? $this->searchArr['sort'] : 'PkgSysId';
        $order = isset($this->searchArr['order']) ? $this->searchArr['order'] : 'DESC';
        $offset = ($page - 1) * $rows;
        $dbtable = new Zend_Db_Table($tablename);
        $select = $dbtable->select()->from("$tablename as tbl", $columns)->where("AgencySysId=$this->gtxagencysysid");

        if (!empty($where)) {
            foreach ($where as $k => $v) {
                $select->where("$k =?", "$v");
            }
        }
//        if (isset($this->searchArr) && !empty($this->searchArr)) {
//
//            $title = $this->searchArr['Destinations'];
//            $select->where('tbl.Destinations LIKE ?', "%$title%");
//        }
        if (isset($this->searchArr) && !empty($this->searchArr)) {
            $GTXPkgId = $this->searchArr['GTXPkgId'];
            $select->where('tbl.GTXPkgId LIKE ?', "%$GTXPkgId%");

            if (isset($this->searchArr['Destinations']) && !empty($this->searchArr['Destinations'])) {
                $title = $this->searchArr['Destinations'];
                $select->where('tbl.Destinations LIKE ?', "%$title%");
            }
            if (isset($this->searchArr['GTXPkgId']) && !empty($this->searchArr['GTXPkgId'])) {
                $GTXPkgId = $this->searchArr['GTXPkgId'];
                $select->where('tbl.GTXPkgId LIKE ?', "%$GTXPkgId%");
            }
            if (isset($this->searchArr['Title']) && !empty($this->searchArr['Title'])) {
                $Title = $this->searchArr['Title'];
                $select->where('tbl.LongJsonInfo LIKE ?', "%$Title%");
            }
            if (isset($this->searchArr['name']) && !empty($this->searchArr['name'])) {
                $Title = $this->searchArr['name'];
                $select->where('tbl.LongJsonInfo LIKE ?', "%$Title%");
            }

        }
        if (!empty($order)) {
            $select->order("$sort $order");
        }
        if ($rows) {
            $select->limit($rows, $offset);
        }
        $result = $dbtable->fetchAll($select);
        if ($result == NULL)

            return false;
        else
            return $result->toArray();
    }

    /**
    * rv_select_all() method is used to get all listing
    * @param table name, columns array, where array, order array
    * @return array result set
    */	
    public function rv_select_all_custom_query($tablename, array $columns, array $where, $whereCustom, array $order, $limit =false)
    {
        $dbtable = new Zend_Db_Table($tablename);
        $select = $dbtable->select()->from("$tablename as tbl", $columns)->where("AgencySysId=$this->gtxagencysysid");
        
        if(count($where)){
            foreach ($where as $k => $v)
            $select->where("$k =?","$v");
        }
        
        if(!empty($whereCustom)){
            $select->where("$whereCustom");
        }
    
        
        
        
        
        if(count($order)){
            foreach ($order as $k => $v)
            $select->order("$k  $v");
        }
        if($limit){
            $select->limit($limit);
        }
//        echo $select;
//        die('here');
        
        $result = $dbtable->fetchAll($select);
        
        if($result==NULL)
            return false;
        else
            return $result->toArray();
    }

    public function themesinPckages($key, array $where)
    {
        $tablename  = 'tb_tbb2c_packages_master';
        $dbtable = new Zend_Db_Table($tablename);
        $select = $dbtable->select()->from("$tablename as tbl", 'count(*)');

        if (count($where)) {
            foreach ($where as $k => $v)
                $select->where("$k =?", "$v");
        }
        if (count(@$order)) {
            foreach ($order as $k => $v)
                $select->order("$k  $v");
        }
        $select->where('FIND_IN_SET(("' . $key . '"),PackageCategory)');
        //echo ($select);die;
        $result = $dbtable->fetchAll($select);
        if ($result == NULL) {
            return false;
        } else {
            return $result->toArray();
        }
    }
    
    public function selectOne($tablename, array $columns, array $where) {
        //echo "hello";die;
        $dbtable = new Zend_Db_Table($tablename);
        $select = $dbtable->select()->from("$tablename as tbl", $columns)->where("AgencySysId=$this->gtxagencysysid");
        
        if(count($where)){
            foreach ($where as $k => $v){
                $select->where("$k =?" , "$v");
            }
        }
        
        $result = $dbtable->fetchRow($select);
        return $result;
    }
    /**
    * rv_select_row() method is used to get all listing
    * @param table name, columns array, where array, order array
    * @return array result set
    */	
    public function rv_select_row($tablename, array $columns, array $where, array $order)
    {
        $dbtable = new Zend_Db_Table($tablename);
        $select = $dbtable->select()->from("$tablename as tbl", $columns)->where("AgencySysId=$this->gtxagencysysid");
        
        if(count($where)){
            foreach ($where as $k => $v){
                $select->where("$k =?" , "$v");
            }
        }
        
        if(count($order)){
            foreach ($order as $k => $v)
            $select->order("$k  $v");
        }
        
//echo $select; die;
        
        $result = $dbtable->fetchRow($select);
        
        if($result==NULL)
            return false;
        else
            return $result->toArray();
    }
	 public function rv_select_row_rate($tablename, array $columns, array $where, array $order)
    {
        $dbtable = new Zend_Db_Table($tablename);
        $select = $dbtable->select()->from("$tablename as tbl", $columns);
        
        if(count($where)){
            foreach ($where as $k => $v){
                $select->where("$k =?" , "$v");
            }
        }
        
        if(count($order)){
            foreach ($order as $k => $v)
            $select->order("$k  $v");
        }
        
//echo $select; die;
        
        $result = $dbtable->fetchRow($select);
        
        if($result==NULL)
            return false;
        else
            return $result->toArray();
    }
    
    /**
    * rv_select_row_where_custom() method is used to get all listing
    * @param table name, columns array, where array, order array
    * @return array result set
    */	
    public function rv_select_row_where_custom($tablename, array $columns, array $where, $whereCustom , array $order , $limit =false)
    {
        $dbtable = new Zend_Db_Table($tablename);
        $select = $dbtable->select()->from("$tablename as tbl", $columns)->where("AgencySysId=$this->gtxagencysysid");
        
        if(count($where)){
            foreach ($where as $k => $v)
            $select->where("$k =?","$v");
        }
        
        if(!empty($whereCustom)){
            $select->where("$whereCustom");
        }
    
        if(count($order)){
            foreach ($order as $k => $v)
            $select->order("$k  $v");
        }
        if($limit){
            $select->limit($limit);
        }
//        echo $select;
//        die('here');
        
        $result = $dbtable->fetchRow($select);
        
        if($result==NULL)
            return false;
        else
            return $result->toArray();
    }
    

    public function getCmsdata($tablename, array $columns, array $where, array $order)
    {
        $dbtable = new Zend_Db_Table($tablename);
       
        $select = $dbtable->select()->from("$tablename as tbl", $columns)->where("AgencySysId=$this->gtxagencysysid");
        
        if(count($where)){
            foreach ($where as $k => $v){
                $select->where("$k =?" , "$v");
            }
        }
        
        if(count($order)){
            foreach ($order as $k => $v)
            $select->order("$k  $v");
        }
        
//echo $select; die;
        
        $result = $dbtable->fetchRow($select);
       // echo "<pre>"; print_r($result);die('tetete');
        return $result;
    }

    
    
    /**
    * rv_rowExists() method is used to check state name exists or not in db
    * @param table name, columns array, where array, order array
    * @return array result set
    */
    
    public function rv_rowExists($tablename, array $columns, array $where, array $order)
    {
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $dbtable->select()->from("$tablename as tbl", $columns)->where("AgencySysId=$this->gtxagencysysid");
        
        if(count($where)){
            foreach ($where as $k => $v)
            $select->where("$k =?","$v");
        }
        if(count($order)){
            foreach ($order as $k => $v)
            $select->order("$k  $v");
        }
        $result = $dbtable->fetchOne($select);
        return $result;

    }
    
    
    public function getDestinations($where , $order =[] , $limit = null ) 
    {
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $dbtable->select()->from("tb_tbb2c_destinations as tbl", ['*']);

        $select->joinLeft(array('tb2' => "tbl_regions"), "tbl.region_id = tb2.sid" , ['title as region_name']);
        
        if(count($where)){
            foreach ($where as $k => $v)
            $select->where("$k =?","$v");
        }
        if(count($order)){
            foreach ($order as $k => $v)
            $select->order("$k  $v");
        }
        if( isset($this->searchArr) && !empty($this->searchArr)) {
            $title = $this->searchArr['Title'];
            $select->where('tbl.Title LIKE ?', "%$title%");
        }
        if($limit) {
            $select->limit($limit);
        }
        
//        echo $select;
        $result = $dbtable->fetchAll($select);
        return $result;
    }
    
     public function getDestinationsInd($where, $order = [], $limit = null) {
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $dbtable->select()->from("tb_tbb2c_destinations as tbl", ['*']);

        $select->joinLeft(array('tb2' => "tbl_regions"), "tbl.region_id = tb2.sid", ['title as region_name']);

        if (count($where)) {
            foreach ($where as $k => $v)
                $select->where("$k =?", "$v");
        }
        if (count($order)) {
            foreach ($order as $k => $v)
                $select->order("$k  $v");
        }
        if (isset($this->searchArr) && !empty($this->searchArr)) {
            $title = $this->searchArr['Title'];
            $select->where('tbl.Title LIKE ?', "%$title%");
        }
        $select->where("tbl.Countries ='India'"); 
        if ($limit) {
            $select->limit($limit);
        }
        $result = $dbtable->fetchAll($select);
        return $result;
    }
    

public function getDestinationsInt($where, $order = [], $limit = null,$CountryIds = null) {
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $dbtable->select()->from("tb_tbb2c_destinations as tbl", ['DesSysId','Title','Image','Tours']);

        $select->joinLeft(array('tb2' => "tbl_regions"), "tbl.region_id = tb2.sid", ['title as region_name']);
        //echo $CountryIds;die;
        if (count($where)) {
            foreach ($where as $k => $v)
                $select->where("$k =?", "$v");
        }
        if (count($order)) {
            foreach ($order as $k => $v)
                $select->order("$k  $v");
        }
        if (isset($this->searchArr) && !empty($this->searchArr)) {
            $title = $this->searchArr['Title'];
            $select->where('tbl.Title LIKE ?', "%$title%");
        }
        if(!empty($CountryIds)){

           $select->where("tbl.CountryIds !=?", $CountryIds); 

          // $select->where("tbl.CountryIds !=?", $CountryIds); 
           $select->where("tbl.Countries !='India'"); 

        }
        if ($limit) {
            $select->limit($limit);
        }

        

//        echo $select;exit;

        $result = $dbtable->fetchAll($select);
        return $result;
    }
    public function getDestinationsHeader($where, $order = [], $limit = null) {
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $dbtable->select()->from("tb_tbb2c_destinations as tbl", ['*']);

        $select->joinLeft(array('tb2' => "tbl_regions"), "tbl.region_id = tb2.sid", ['title as region_name','label as region_label','image as region_image']);

        if (count($where)) {
            foreach ($where as $k => $v)
                $select->where("$k =?", "$v");
        }
        if (count($order)) {
            foreach ($order as $k => $v)
                $select->order("$k  $v");
        }
        if (isset($this->searchArr) && !empty($this->searchArr)) {
            $title = $this->searchArr['Title'];
            $select->where('tbl.Title LIKE ?', "%$title%");
        }
        if ($limit) {
            $select->limit($limit);
        }

        $result = $dbtable->fetchAll($select);
//        echo"<pre>"; print_r($result);die();
        return $result;
    }

    public function getDestinationsForFooter($where, $order = [], $limit = null) {
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $dbtable->select()->from("tb_tbb2c_destinations as tbl", ['*'])->where("AgencySysId=$this->gtxagencysysid");

        $select->joinLeft(array('tb2' => "tbl_regions"), "tbl.region_id = tb2.sid", ['title as region_name']);

        if (count($where)) {
            foreach ($where as $k => $v)
                $select->where("$k =?", "$v");
        }
        if (count($order)) {
            foreach ($order as $k => $v)
                $select->order("$k  $v");
        }
        if (isset($this->searchArr) && !empty($this->searchArr)) {
            $title = $this->searchArr['Title'];
            $select->where('tbl.Title LIKE ?', "%$title%");
        }
        if ($limit) {
            $select->limit($limit);
        }

        $result = $dbtable->fetchAll($select);
        return $result;
    }
    
    public function getDestinationsIndex($where, $order = []){
        $page = isset($this->searchArr['page']) ? intval($this->searchArr['page']) : 1;
        $rows = isset($this->searchArr['rows']) ? intval($this->searchArr['rows']) : 10;
        $offset = ($page - 1) * $rows;
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $dbtable->select()->from("tb_tbb2c_destinations as tbl", ['DesSysId','DisplayOnHeader','DisplayPromotionHome','IsActive','Title','IsFeatured', 'Countries', 'Activities', 'Tours', 'Hotels','Image','Bannerimg','DisplayOnFooter','AgencySysId']);
        

        $select->joinLeft(array('tb2' => "tbl_regions"), "tbl.region_id = tb2.sid", ['title as region_name']);

        if (!empty($where)) {
            foreach ($where as $k => $v) {
                $select->where("$k =?", "$v");
            }
        }
        if (!empty($this->searchArr)) {
            if ($this->searchArr['Title'] != "") {
                $title = $this->searchArr['Title'];
                $select->where('tbl.Title LIKE ?', "%$title%");
            }
            if ($this->searchArr['Countries'] != "") {
                $title = $this->searchArr['Countries'];
                $select->where('tbl.Countries LIKE ?', "%$title%");
            }
            if ($this->searchArr['Region'] != "") {
                $title = $this->searchArr['Region'];
                $select->where('tb2.title LIKE ?', "%$title%");
            }
        }
        if (!empty($order)) {
            foreach ($order as $k => $v)
                $select->order("$k  $v");
        }
        if ($rows) {
            $select->limit($rows, $offset);
        }
//        echo $select;die;

        $result = $dbtable->fetchAll($select);
        return $result;
    }


    public function getExpertCount($where, $order = [], $limit = null) {
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $dbtable->select()->from("tbl_our_expert as tbl", ['ExpertId' => 'COUNT(*)'])->where("AgencySysId=$this->gtxagencysysid");

        $select->joinLeft(array('tb2' => "tbl_regions"), "tbl.ExpertDestination = tb2.sid", ['title as ExpertDestination']);

        if (!empty($where)) {
            foreach ($where as $k => $v)
                $select->where("$k =?", "$v");
        }

        $result = $dbtable->fetchAll($select);
        return $result;
    }

      public function getCategory($where, $order = [], $limit = null) {
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $dbtable->select()->from("tbl_thingstodo as tbl",['*'])->where("AgencySysId=$this->gtxagencysysid");

        $select->joinLeft(array('tb2' => "tb_tbb2c_thingstodo_category"), "tbl.category = tb2.DesSysId", ['category']);

        if (!empty($where)) {
            foreach ($where as $k => $v)
                $select->where("$k =?", "$v");
        }

        $result = $dbtable->fetchAll($select);
        return $result;
    }
   
    public function getExpertIndex($where, $order = []) {
        $page = isset($this->searchArr['page']) ? intval($this->searchArr['page']) : 1;
        $rows = isset($this->searchArr['rows']) ? intval($this->searchArr['rows']) : 10;
        $offset = ($page - 1) * $rows;
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $dbtable->select()->from("tbl_our_expert as tbl", ['ExpertId', 'ExpertName', 'ExpertEmail', 'ExpertPhone', 'ExpertImage', 'status'])->where("AgencySysId=$this->gtxagencysysid");

        $select->joinLeft(array('tb2' => "tbl_regions"), "tbl.ExpertDestination = tb2.sid", ['title as ExpertDestination']);

        if (!empty($where)) {
            foreach ($where as $k => $v) {
                $select->where("$k =?", "$v");
            }
        }
        if (!empty($this->searchArr)) {
            if ($this->searchArr['ExpertDestination'] != "") {
                $title = $this->searchArr['ExpertDestination'];
                $select->where('tb2.title LIKE ?', "%$title%");
            }
            if ($this->searchArr['ExpertName'] != "") {
                $title = $this->searchArr['ExpertName'];
                $select->where('tbl.ExpertName LIKE ?', "%$title%");
            }
        }
        if (!empty($order)) {
            foreach ($order as $k => $v)
                $select->order("$k  $v");
        }
        if ($rows) {
            $select->limit($rows, $offset);
        }
//        echo $select;die;
        $result = $dbtable->fetchAll($select);
        return $result;
    }


    public function getTraveloguesIndex($where, $order = []) {
        $page = isset($this->searchArr['page']) ? intval($this->searchArr['page']) : 1;
        $rows = isset($this->searchArr['rows']) ? intval($this->searchArr['rows']) : 10;
        $offset = ($page - 1) * $rows;
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $dbtable->select()->from("tbl_travelogues as tbl", ['TravId', 'TravTitle','TravDestination', 'TravDate', 'TravDays', 'TravTraveller', 'TravUploadedBy', 'TravImage', 'TravBannerImage', 'status'])->where("AgencySysId=$this->gtxagencysysid");


        $select->joinLeft(array('tb2' => "tb_tbb2c_destinations"), "tb2.DesSysId = tbl.TravDestination" , ['title as TravDestination'])->where("AgencySysId=$this->gtxagencysysid");

        if (!empty($where)) {
            foreach ($where as $k => $v) {
                $select->where("$k =?", "$v");
            }
        }
if (!empty($this->searchArr)) {
            if ($this->searchArr['Title'] != "") {
                $title = $this->searchArr['Title'];
                $select->where('tbl.TravTitle LIKE ?', "%$title%");
            }
           
        }
        if (!empty($order)) {
            foreach ($order as $k => $v)
                $select->order("$k  $v");
        }
        if ($rows) {
            $select->limit($rows, $offset);
        }
//        echo $select;die;
        $result = $dbtable->fetchAll($select);
        return $result;
    }

     public function getpacktypeIndex($where, $order = []) {
        $page = isset($this->searchArr['page']) ? intval($this->searchArr['page']) : 1;
        $rows = isset($this->searchArr['rows']) ? intval($this->searchArr['rows']) : 10;
        $offset = ($page - 1) * $rows;
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $dbtable->select()->from("tbl_pack_type as tbl", ['packType', 'Title','Icon', 'IsActive'])->where("AgencySysId=$this->gtxagencysysid");


//        $select->joinLeft(array('tb2' => "tb_tbb2c_destinations"), "tb2.DesSysId = tbl.TravDestination" , ['title as TravDestination']);

        if (!empty($where)) {
            foreach ($where as $k => $v) {
                $select->where("$k =?", "$v");
            }
        }
if (!empty($this->searchArr)) {
            if ($this->searchArr['Title'] != "") {
                $title = $this->searchArr['Title'];
                $select->where('tbl.Title LIKE ?', "%$title%");
            }
           
        }
        if (!empty($order)) {
            foreach ($order as $k => $v)
                $select->order("$k  $v");
        }
        if ($rows) {
            $select->limit($rows, $offset);
        }
//        echo $select;die;
        $result = $dbtable->fetchAll($select);
        return $result;
    }

    
       public function getTestimonialIndex($where, $order = []) {
        $page = isset($this->searchArr['page']) ? intval($this->searchArr['page']) : 1;
        $rows = isset($this->searchArr['rows']) ? intval($this->searchArr['rows']) : 10;
        $offset = ($page - 1) * $rows;
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $dbtable->select()->from("tbl_testimonials as tbl", ['*'])->where("AgencySysId=$this->gtxagencysysid");


//        $select->joinLeft(array('tb2' => "tb_tbb2c_destinations"), "tb2.DesSysId = tbl.TravDestination" , ['title as TravDestination']);

        if (!empty($where)) {
            foreach ($where as $k => $v) {
                $select->where("$k =?", "$v");
            }
        }
            if (!empty($this->searchArr)) {
            if ($this->searchArr['name'] != "") {
                $title = $this->searchArr['name'];
                $select->where('tbl.name LIKE ?', "%$title%");
            }
           
        }
        if (!empty($order)) {
            foreach ($order as $k => $v)
                $select->order("$k  $v");
        }
        if ($rows) {
            $select->limit($rows, $offset);
        }
//        echo $select;die;
        $result = $dbtable->fetchAll($select);
        return $result;
    }
    
    public function rv_select_all_activitie_custom_query($where)
    {

        $dbtable = Zend_Db_Table::getDefaultAdapter();
        
        $select = "SELECT Image,IsFeatured,PkgSysId FROM tb_tbb2c_packages_master tb1 WHERE ( 3 ) = 
                ( SELECT COUNT( tb2.PkgSysId )
                   FROM tb_tbb2c_packages_master tb2
                   WHERE tb2.PkgSysId >= tb1.PkgSysId
                   AND (tb2.GTXPkgId ='$where[GTXPkgId]') AND (tb2.ItemType ='$where[ItemType]') 
                )
                 AND (tb1.IsActive='0') AND (tb1.IsMarkForDel='1') AND (tb1.IsPublish='0')";

        $result = $dbtable->fetchAll($select);
        
        if($result==NULL){
            return false;
        }
        else{
            return $result;
        }
        
    }
    
    
     public function getCount($tablename, array $where, $Id) {
        $dbtable = new Zend_Db_Table($tablename);
        $select = $dbtable->select()->from("$tablename as tbl", [$Id => 'COUNT(*)'])->where("AgencySysId=$this->gtxagencysysid");;

        if (!empty($where)) {
            foreach ($where as $k => $v)
                $select->where("$k =?", "$v");
        }
        $result = $dbtable->fetchAll($select);
        if ($result == NULL)


            return false;
        else
            return $result->toArray();
    }

    public function rv_select_static($tablename, array $columns, array $where, array $order) {
        $page = isset($this->searchArr['page']) ? intval($this->searchArr['page']) : 1;
        $rows = isset($this->searchArr['rows']) ? intval($this->searchArr['rows']) : 10;
        $offset = ($page - 1) * $rows;
        $dbtable = new Zend_Db_Table($tablename);
        $select = $dbtable->select()->from("$tablename as tbl", $columns)->where("AgencySysId=$this->gtxagencysysid");

        if (!empty($where)) {
            foreach ($where as $k => $v) {
                $select->where("$k =?", "$v");
            }
        }
        

        if (isset($this->searchArr) && !empty($this->searchArr)) {
            if (isset($this->searchArr['Title']) && !empty($this->searchArr['Title'])) {
            $title = $this->searchArr['Title'];
            $select->where('tbl.page_title LIKE ?', "%$title%");
            }
            if (isset($this->searchArr['Titles']) && !empty($this->searchArr['Titles'])) {
            $title = $this->searchArr['Titles'];
            $select->where('tbl.Title LIKE ?', "%$title%");
            }
        }
       // $select->where("AgencySysId=2");
        
        if (!empty($order)) {
            foreach ($order as $k => $v)
                $select->order("$k  $v");
        }
        if ($rows) {
            $select->limit($rows, $offset);
        }
        $result = $dbtable->fetchAll($select);
        if ($result == NULL)

            return false;
        else
            return $result->toArray();
    }

    
      public function getFlightIndex($where, $order = []) {
        $page = isset($this->searchArr['page']) ? intval($this->searchArr['page']) : 1;
        $rows = isset($this->searchArr['rows']) ? intval($this->searchArr['rows']) : 10;
        $offset = ($page - 1) * $rows;
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $dbtable->select()->from("tbl_flight_booking as tbl", ['id', 'response', 'IsActive', 'CreatedDate'])->where("AgencySysId=$this->gtxagencysysid");

//        $select->joinLeft(array('tb2' => "tbl_regions"), "tbl.ExpertDestination = tb2.sid", ['title as ExpertDestination']);

        if (!empty($where)) {
            foreach ($where as $k => $v) {
                $select->where("$k =?", "$v");
            }
        }
        if (!empty($this->searchArr)) {
            if ($this->searchArr['bookingId'] != "") {
                $title = $this->searchArr['bookingId'];
                $select->where('tbl.response LIKE ?', "%$title%");
            }
           
        }
        if (!empty($order)) {
            foreach ($order as $k => $v)
                $select->order("$k  $v");
        }
        if ($rows) {
            $select->limit($rows, $offset);
        }
//        echo $select;die;
        $result = $dbtable->fetchAll($select);
        return $result;
    }

    
    public function getInternationalDestination($tablename, array $columns, $limit =false) {
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $this->db->select()
                ->from(array("a" => $tablename), $columns)
                ->where("a.IsActive=?", 1)
                ->where("a.IsFeatured=?", 1)
                ->where("a.IsPublish=?", 1)
                ->where("a.IsMarkForDel=?", 0)
                ->where("a.CountryIds !=?", 101);
        if($limit){
            $select->limit($limit);
        }
        //echo $select;
        $result = $dbtable->fetchAll($select);
        return $result;
    }
     public function getCategory1($tablename, array $columns, $limit =false) {
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $this->db->select()
                ->from(array("a" => $tablename), $columns)
                ->where("a.IsActive=?", 1)
                ->where("a.IsFeatured=?", 1)
                ->where("a.IsPublish=?", 1)
                ->where("a.IsMarkForDel=?", 0)
                ->where("a.CountryIds !=?", 101);
        if($limit){
            $select->limit($limit);
        }
        //echo $select;
        $result = $dbtable->fetchAll($select);
        return $result;
    }
    public function getBuyHotelCityAutoSuggest($keyword) {
        $keyword = trim($keyword);
        $response = array();
        $rowset = $this->getCityListWithCountryDetail($keyword);
        $respon = array();
        if (count($rowset) > 0) {
            foreach ($rowset as $row) {
                $response[] = array('CityId' => $row['CityId'], 'CityName' => stripslashes($row['cityTitle']), 'label' => $row['cityTitle'].'('.$row['Country'].')','countryTitle' => trim($row['Country']));
            }
        }
        return $response;
    }
    	public function getCityListWithCountryDetail($where){
//		$country = array('ContId','Title as countryTitle','Code as countryCode');	
		$city=array('CityId','TBBCityId','Title as cityTitle','Alias as cityAlias','Country');		
		$select = $this->db->select();
		$select->from(array('tbl' => "tb_master_geo_city") ,$city);
		//$select->joinInner(array('tb2' => "tb_master_geo_city"), "tbl.GTXCityId = tb2.CityId");
		$select->where($where);
		$select->where("tbl.IsActive = ?", 1 );
		$select->where("tbl.IsApproved = ?", 1 );
		$select->where("tbl.IsMarkForDel = ?", 0 );
		//$select->where("tb2.IsActive = ?", 1);
                //echo $select;die;
		$result = $this->db->fetchAll($select);
        return $result;
	}
    
        
        public function rv_select_promotion_all($table,$where, $order = []) {
        $page = isset($this->searchArr['page']) ? intval($this->searchArr['page']) : 1;
        $rows = isset($this->searchArr['rows']) ? intval($this->searchArr['rows']) : 10;
        $offset = ($page - 1) * $rows;
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $dbtable->select()->from($table, ['*'])->where("AgencySysId=$this->gtxagencysysid");

      
        if (count($where)) {
            foreach ($where as $k => $v) {
                $select->where("$k =?", "$v");
            }
        }
        
        if (count($order)) {
            foreach ($order as $k => $v)
                $select->order("$k  $v");
        }
        if ($rows) {
            $select->limit($rows, $offset);
        }
        echo $select;die;
        $result = $dbtable->fetchAll($select);
        return $result;
    }
    
    public function getRegionImage($region){
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = "SELECT image from tbl_regions where label like '%$region%'";

        $result = $dbtable->fetchOne($select);
        return $result; 
    }
    public function getInternationalDestinationAll($tablename, array $columns, $limit = false) {
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $this->db->select()
                ->from(array("a" => $tablename), $columns)
                ->where("a.IsActive=?", 1)
               
                ->where("a.IsMarkForDel=?", 0)
                ->where("a.CountryIds !=?", 101);
        if ($limit) {
            $select->limit($limit);
        }
        //echo $select;
        $result = $dbtable->fetchAll($select);
        return $result;
    }
    
     public function rv_select_all_countries() {
        $page = isset($this->searchContArr['page']) ? intval($this->searchContArr['page']) : 1;
        $rows = isset($this->searchContArr['rows']) ? intval($this->searchContArr['rows']) : 10;
        $offset = ($page - 1) * $rows;
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $dbtable->select()->from("tbl_countries as tb1", ['*'])->where("AgencySysId=$this->gtxagencysysid");
        $select->where("tb1.IsMarkForDel = ?", '0');
        
        if (isset($this->searchContArr) && !empty($this->searchContArr)) {
            $title = $this->searchContArr['title'];
            $select->where('tb1.title LIKE ?', "%$title%");
        }
         if ($rows) {
            $select->limit($rows, $offset);
        }
        //$select->where("tb2.IsMarkForDel = ?", '0');
          $select->order("tb1.title ASC");
//        echo $select;die;
        $result = $dbtable->fetchAll($select);
        return $result;     
        }
    public function getAllCountyDetailForHomePage(){    
                $select="SELECT Countries,CountryIds FROM tb_tbb2c_packages_master where AgencySysId = '$this->gtxagencysysid' AND ItemType = '6' AND IsMarkForDel = '0' AND IsActive = '1' ORDER BY Countries";
                $result = $this->db->fetchAll($select);
        return $result;
    }
            public function getSeoContentFromDestination($keyword){
            $select="SELECT * FROM tb_tbb2c_destinations where AgencySysId = '$this->gtxagencysysid' AND IsMarkForDel = '0' AND Countries like '%$keyword%'";
               $result = $this->db->fetchAll($select);
        return $result;
        }
        public function rv_select_all_states() {
         $page = isset($this->searchStateArr['page']) ? intval($this->searchStateArr['page']) : 1;
        $rows = isset($this->searchStateArr['rows']) ? intval($this->searchStateArr['rows']) : 10;
        $offset = ($page - 1) * $rows;    
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $dbtable->select()->from("tbl_states as tb1", ['*'])->where("AgencySysId=$this->gtxagencysysid");
       $select->where("tb1.IsMarkForDel = ?", '0');
        
         if (isset($this->searchStateArr) && !empty($this->searchStateArr)) {
            $title = $this->searchStateArr['title'];
            $select->where('tb1.title LIKE ?', "%$title%");
        }
         if ($rows) {
            $select->limit($rows, $offset);
        }
        //$select->where("tb2.IsMarkForDel = ?", '0');
          $select->order("tb1.title ASC");
//        echo $select;die;
        $result = $dbtable->fetchAll($select);
        return $result;     
        }
        public function rv_select_all_region() {
         $page = isset($this->searchStateArr['page']) ? intval($this->searchStateArr['page']) : 1;
        $rows = isset($this->searchStateArr['rows']) ? intval($this->searchStateArr['rows']) : 10;
        $offset = ($page - 1) * $rows;    
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $dbtable->select()->from("tbl_regions as tb1", ['*'])->where("AgencySysId=$this->gtxagencysysid");
       $select->where("tb1.IsMarkForDel = ?", '0');
        
         if (isset($this->searchRegionsArr) && !empty($this->searchRegionsArr)) {
            $title = $this->searchRegionsArr['title'];
            $select->where('tb1.title LIKE ?', "%$title%");
        }
         if ($rows) {
            $select->limit($rows, $offset);
        }
        //$select->where("tb2.IsMarkForDel = ?", '0');
          $select->order("tb1.title ASC");
//        echo $select;die;
        $result = $dbtable->fetchAll($select);
        return $result;     
        }
        public function checkStateData($id,$AgencySysId) {
            $dbtable = Zend_Db_Table::getDefaultAdapter();
            $select = $this->db->select()
                    ->from(array("a" => "tbl_states"))
                    ->where("a.stateId = $id AND a.AgencySysId= $AgencySysId" );
            $result = $dbtable->fetchAll($select);
            return $result;
        }
            public function checkCityData($id,$AgencySysId) {
            $dbtable = Zend_Db_Table::getDefaultAdapter();
            $select = $this->db->select()
                    ->from(array("a" => "tb_tbb2c_destinations"))
                    ->where("a.DesId = $id AND a.AgencySysId= $AgencySysId");
            $result = $dbtable->fetchAll($select);
            return $result;
        }
	public function runMyQuery($query){    
                //$select="SELECT Countries,CountryIds FROM tb_tbb2c_packages_master where ItemType = '6' AND IsMarkForDel = '0' AND IsActive = '1' GROUP BY CountryIds ORDER BY Countries";
                $result = $this->db->fetchAll($query);
        return $result;
    }
    public function getDestinationAutoSuggest($keyword) {
        $keyword = trim($keyword);
        $response = array();
        $rowset = $this->getDestinationListDetail($keyword);
        $respon = array();
        if (count($rowset) > 0) {
            foreach ($rowset as $row) {
//                $response[] = array('CityId' => $row['CityId'], 'CityName' => stripslashes($row['cityTitle']), 'label' => $row['cityTitle'],'countryTitle' => trim($row['Country']));
                $response[] = array('DesSysId' => $row['DesSysId'], 'DesName' => stripslashes($row['Title']), 'label' => $row['Title']);
            }
        }
        
        return $response;
    }
    public function getDestinationListDetail($where){
//		$country = array('ContId','Title as countryTitle','Code as countryCode');	
        $city=array('Title','DesSysId','region_id','DesId');		
        $select = $this->db->select();
        $select->from(array('tbl' => "tb_tbb2c_destinations") ,$city);
        //$select->joinInner(array('tb2' => "tb_master_geo_city"), "tbl.GTXCityId = tb2.CityId");
        $select->where($where);
        $select->where("tbl.IsActive = ?", 1 );
        $select->where("tbl.IsMarkForDel = ?", 0 );
        //echo $select;die;
        $result = $this->db->fetchAll($select);
        return $result;
	}
    public function getCountryAutoSuggest($keyword) {
        $keyword = trim($keyword);
        $response = array();
        $rowset = $this->getCountryListDetail($keyword);
//        echo "<pre>";print_r($rowset);die;
        $respon = array();
        if (count($rowset) > 0) {
            foreach ($rowset as $row) {
//                $response[] = array('CityId' => $row['CityId'], 'CityName' => stripslashes($row['cityTitle']), 'label' => $row['cityTitle'],'countryTitle' => trim($row['Country']));
                $response[] = array('DesSysId' => $row['DesSysId'], 'DesName' => stripslashes($row['Title']), 'label' => $row['Title']);
            }
        }
        
        return $response;
    }
public function getaddress($where, $order = [], $limit = null) {
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $dbtable->select()->from("tbl_branches as tbl",['*']);

        //->where("AgencySysId=$this->gtxagencysysid");
        $select->joinLeft(array('tb2' => "tb_tbb2c_contactus_address"), "tbl.address = tb2.DesSysId and tbl.AgencySysId = tb2.AgencySysId", ['tb2.address','tb2.DesSysId as address_id']);
 //echo '<pre>'; print_r($where);die;
        if (count($where)) {
            foreach ($where as $k => $v)
                $select->where("$k =?", "$v");
				
        }

        $result = $dbtable->fetchAll($select);
        return $result;
    }	
    public function getCountryListDetail($where){
//		$country = array('ContId','Title as countryTitle','Code as countryCode');	
        $city=array('title as Title','countryId as DesSysId','region_id');		
        $select = $this->db->select();
        $select->from(array('tbl' => "tbl_countries") ,$city);
        //$select->joinInner(array('tb2' => "tb_master_geo_city"), "tbl.GTXCityId = tb2.CityId");
        $select->where($where);
        $select->where("tbl.IsActive = ?", '1' );
        $select->where("tbl.IsMarkForDel = ?", '0' );
//        echo $select;die;
        $result = $this->db->fetchAll($select);
        return $result;
    }
    public function rv_select_all_destinationByIds($table,$columns,$where,$idsColumn,$ids){
            
        $dbtable = Zend_Db_Table::getDefaultAdapter();
        $select = $dbtable->select()->from($table." as tb1", $columns)->where("AgencySysId=$this->gtxagencysysid");
         if (count($where)) {
            foreach ($where as $k => $v)
                $select->where("$k =?", "$v");
        }
         $select->where('tb1.'.$idsColumn.'  IN (' . $ids . ')');
          $result = $dbtable->fetchAll($select);
        return $result;
        }

        public function getDestinationSearch($where, $order = []){
            $page = isset($this->searchArr['page']) ? intval($this->searchArr['page']) : 1;
            $rows = isset($this->searchArr['rows']) ? intval($this->searchArr['rows']) : 10;
            $offset = ($page - 1) * $rows;
            $dbtable = Zend_Db_Table::getDefaultAdapter();
            $select = $dbtable->select()->from("tb_tbb2c_destinations as tbl", ['DesSysId','DisplayOnHeader','DisplayPromotionHome','IsActive','Title','IsFeatured', 'Countries', 'Activities', 'Tours', 'Hotels','Image','Bannerimg','DisplayOnFooter'])->where("AgencySysId=$this->gtxagencysysid");
             //echo "<pre>";print_r($select);die;
    
            $select->joinLeft(array('tb2' => "tbl_regions"), "tbl.region_id = tb2.sid", ['title as region_name']);
    
            if (count($where)) {
                foreach ($where as $k => $v) {
                    $select->where("$k =?", "$v");
                }
            }
            if (!empty($this->searchArr)) {
                if ($this->searchArr['Title'] != "") {
                    $title = $this->searchArr['Title'];
                    $select->where('tbl.Title LIKE ?', "%$title%");
                }
                if ($this->searchArr['Countries'] != "") {
                    $title = $this->searchArr['Countries'];
                    $select->where('tbl.Countries LIKE ?', "%$title%");
                }
                if ($this->searchArr['Region'] != "") {
                    $title = $this->searchArr['Region'];
                    $select->where('tb2.title LIKE ?', "%$title%");
                }
            }
            if (count($order)) {
                foreach ($order as $k => $v)
                    $select->order("$k  $v");
            }
            if ($rows) {
                $select->limit($rows, $offset);
            }
    //        echo $select;die;
            $result = $dbtable->fetchAll($select);
            return $result;
        }
		public function getPackageByPackageIds($where,$PackageSearchString,$limit = '')
        {
            $dbtable = Zend_Db_Table::getDefaultAdapter();
            $select = $dbtable->select()->from("tb_tbb2c_packages_master as tbl", ['PkgSysId','CountryIds','AgencySysId' ,'PackageCategory','ItemType','PackageType','PackageSubType','GTXPkgSourceId','HotDeal','DestinationsId','ShortJsonInfo','Destinations','Destinations AS MainDestination','Image', 'GTXPkgId',  'Countries', 'BookingValidUntil', 'LongJsonInfo', 'Nights', 'StarRating', 'MinPax', 'MaxPrice', 'MinPrice', 'PackageSearchString','PkgValidFrom','PkgValidUntil', 'packageNameUrl']);
            
            if (count($where)) {
                foreach ($where as $k => $v) {
                    $select->where("$k =?", "$v");
                }
            }
            $select->where('tbl.GTXPkgId IN (?)', $PackageSearchString);
            $select->where("IsActive =?", "1");
            $select->where("IsPublish =?", "1");
            $select->where("AgencySysId =?", "$this->gtxagencysysid");
            $select->where("IsMarkForDel =?", "0");
            $select->order("MinPrice ASC");   
            if ($limit) {
                $select->limit($limit);
            }
            
            $result = $dbtable->fetchAll($select);
             
            return $result;
        }	
	 public function rv_random_popads($tablename, array $columns, array $where)
    {
        $date = date('Y-m-d');
        $dbtable = new Zend_Db_Table($tablename);
        $select = $dbtable->select()->from("$tablename as tbl", $columns);
        if (count($where)) {
            foreach ($where as $k => $v) {
                $select->where("$k =?", "$v");
            }
        }
        $select->where('DATE(expiryDate) >= "' . $date . '"');
        $select->order(new Zend_Db_Expr('RAND()'));
        $result = $dbtable->fetchRow($select);
        if ($result == NULL)
            return false;
        else
            return $result->toArray();
    }
	
	function convertToWebP($source, $destination, $quality = 80) {
			// Get image information
			$info = getimagesize($source);
			$mime = $info['mime'];

			// Create an image resource from the source file
			switch ($mime) {
				case 'image/jpeg':
				case 'image/jpg':
					$image = imagecreatefromjpeg($source);
					break;
				case 'image/png':
					$image = imagecreatefrompng($source);
					imagepalettetotruecolor($image); // Convert palette-based PNG to true color
					imagealphablending($image, false);
					imagesavealpha($image, true);
					break;
				case 'image/gif':
					$image = imagecreatefromgif($source);
					break;
				 case 'image/webp':
            $image = imagecreatefromwebp($source);
            break;	
				default:
					return false; // Unsupported format
			}

			// Convert and save the image as WebP
			if ($image) {
				imagewebp($image, $destination, $quality);
				imagedestroy($image);
				return true;
			}
			return false;
		}
		public function getPackageByDestinationName($where,$PackageSearchString,$PackTypeMask = 'Holidays',$limit = '')
        {
            $dbtable = Zend_Db_Table::getDefaultAdapter();
            $select = $dbtable->select()->from("tb_tbb2c_packages_master as tbl", ['PkgSysId','CountryIds','AgencySysId' ,'PackageCategory','ItemType','PackageType','PackageSubType','GTXPkgSourceId','HotDeal','DestinationsId','ShortJsonInfo','Destinations','Destinations AS MainDestination','Image', 'GTXPkgId',  'Countries', 'BookingValidUntil', 'LongJsonInfo', 'Nights', 'StarRating', 'MinPax', 'MaxPrice', 'MinPrice', 'PackageSearchString','PkgValidFrom','PkgValidUntil', 'packageNameUrl']);
            
            if (count($where)) {
                foreach ($where as $k => $v) {
                    $select->where("$k =?", "$v");
                }
            }
            $select->where('tbl.PackageSearchString LIKE ?', "%$PackageSearchString%");
            $select->where("IsActive =?", "1");
            $select->where("IsPublish =?", "1");
            $select->where("AgencySysId =?", "$this->gtxagencysysid");
            $select->where("IsMarkForDel =?", "0");
            $select->order("MinPrice ASC");   
            if ($limit) {
                $select->limit($limit);
            }
            if($PackTypeMask){
                $select->where("PackTypeMask =?", $PackTypeMask);
            }
            $result = $dbtable->fetchAll($select);
           // echo $select; die; 
            return $result;
        }
}

Youez - 2016 - github.com/yon3zu
LinuXploit