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/b2bzend/application/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/b2bzend/application/models/GeneralFunction.php
<?php

/**
 * Class GeneralFunction  Model
 * Description 	This model class contains the functions needed for manipulation.
 * @name		GeneralFunction  Model
 * @author		Shailender Joshi
 * @editor      Shailender Joshi <shailender@catpl.co.in>
 * @version     1.0
 * @copyright   Catabatic Technologies Pvt Ltd
 *
 */
class Travel_Model_GeneralFunction {

    public $intCityId = NULL;
    public $intContSysId = NULL;
    protected $db = NULL;
    public $imageServerUrl = NULL;
    public $baseUrl = NULL;


    /*  Common to all models */
    public $strCondition = NULL;
    public $deleted = 'N';
    public $status = '1';
    public $strSelectedView = '';
    public $intQueryOffset = 0;
    public $intListPerPage = 10;
    public $intLoginUserId = NULL;
    public $intLoginAgentId = NULL;
    public $strImageFlag = NULL;

    /*     * ************************************ */

    public function __construct() {
        #initialize db adapter
        $this->db = Zend_Db_Table::getDefaultAdapter();
    }

    public function __destruct() {
        $this->db->closeConnection();
    }

    # Start : functions added by Ranvir Singh on 13 Sep 2016

    /**
     * getDetailsByUniqueId() method is used to get details on primary key
     * @param table name, key name, key value
     * @return object 
     */
    public function getDetailsByUniqueId($table, $columnArray, $uniqueId, $uniqueIdVal) {
        $select = $this->db->select()
                ->from("$table", $columnArray)
                ->where("$uniqueId =?", $uniqueIdVal);
        $result = $this->db->fetchRow($select);
        return $result;
    }

# getDetailsByUniqueId

    public function getRecordListing($table, $columnArray, $uniqueId, $uniqueIdVal, $markForDel = '', $orderby = '', $order = "ASC") {
        $select = $this->db->select()->from("$table", $columnArray)
                ->where("$uniqueId =?", $uniqueIdVal);

        if ($markForDel !== '') {
            $select->where("IsMarkForDel =?", $markForDel);
        }

        if (!empty($orderby))
            $select->order("$orderby $order");

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

# getRecordListing

    public function getRecordListingaAdmin($table, $columnArray, $uniqueId, $uniqueIdVal, $markForDel = '', $orderby = '', $order = "ASC") {
        $select = $this->db->select()->from("$table", $columnArray)
                ->where("$uniqueId =?", $uniqueIdVal);

        if ($markForDel !== '') {
            $select->where("IsMarkForDelete =?", $markForDel);
        }

        if (!empty($orderby))
            $select->order("$orderby $order");

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

# getRecordListing

    // $where       =  array('column'=>value,'column'=>'value',.......);
    // $columnArray =  array('column1','column2','column3',...........);
    public function getRecordListingWhere($table, $columnArray, $where, $orderby = '', $order = "ASC") {
        $select = $this->db->select()->from($table, $columnArray);

        foreach ($where as $col => $val) {
            if ($val !== '') {
                $select->where("$col =?", $val);
            }
        }

        if (!empty($orderby))
            $select->order("$orderby $order");
//         echo $select;        die;
        $result = $this->db->fetchAll($select);
        return $result;
    }

# getRecordListing

    public function getRecordListingWhereWithSearch($table, $columnArray, $where, $orderby = '', $order = "ASC", $searchArr = array()) {
        // $searchInColumn = array('column1','column2','column3'......); // apply search on the following columns

        $select = $this->db->select()->from($table, $columnArray);

        foreach ($where as $col => $val) {
            $select->where("$col =?", $val);
        }


        if (!empty($this->searchArr)) {
            //echo "<pre>"; print_r($this->searchArr); die;
            if ($this->searchArr['search'] != '') {
                $count = 0;
                foreach ($columnArray as $col) {
                    if ($count == 0)
                        $select->where("$col LIKE ?", "%" . $this->searchArr['search'] . "%");
                    else
                        $select->ORwhere("$col LIKE ?", "%" . $this->searchArr['search'] . "%");

                    $count++;
                }
            }
        }

        if (!empty($orderby))
            $select->order("$orderby $order");

//        echo $select; die;
        $result = $this->db->fetchAll($select);
        return $result;
    }

# getRecordListing

    public function getRecordListingWhereWithSearch_RV($table, $columnArray, $where, $orderby = '', $order = "ASC", $searchArr = array()) {
        $select = $this->db->select()->from($table, $columnArray);

        foreach ($where as $col => $val) {
            $select->where("$col =?", $val);
        }

        if (!empty($searchArr)) {

            $count = 0;
            foreach ($searchArr as $key => $col) {
                if ($count == 0)
                    $select->where(" $key LIKE ?", "%" . $col . "%");
                else
                    $select->ORwhere(" $key LIKE ?", "%" . $col . "%");

                $count++;
            }
        }

        if (!empty($orderby))
            $select->order("$orderby $order");

//        echo $select;
        $result = $this->db->fetchAll($select);
        return $result;
    }

# getRecordListing
    # to get records from 2 tables

    public function getRecordFromTwoTablesById($t1, $colsArr1, $t2, $colsArr2, $joinCol1, $joinCol2, $whereArr, $orderby = '', $order = "ASC") {
        $select = $this->db->select();
        $select->from(array("t1" => "$t1"), $colsArr1);
        $select->joinLeft(array('t2' => "$t2"), "t1.$joinCol1 = t2.$joinCol2", $colsArr2);

        foreach ($whereArr as $col => $val) {
            $select->where("t1.$col =?", $val);
        }

        if (!empty($orderby))
            $select->order("$orderby $order");

        $result = $this->db->fetchRow($select);
        return $result;
    }

# getRecordListingFromTwoTablesWhere
    # to get records from 3 tables

    public function getRecordFromThreeTablesById($t1, $colsArr1, $t2, $colsArr2, $t3, $colsArr3, $joinCols1, $joinCols2, $whereArr, $orderby = '', $order = "ASC") {
        $select = $this->db->select();
        $select->from(array("t1" => "$t1"), $colsArr1);
        $select->joinLeft(array('t2' => "$t2"), "t1." . $joinCols1[0] . "= t2." . $joinCols1[1], $colsArr2);

        $select->joinLeft(array('t3' => "$t3"), "t2." . $joinCols2[0] . "= t3." . $joinCols2[1], $colsArr3);

        foreach ($whereArr as $col => $val) {
            $select->where("t1.$col =?", $val);
        }

        if (!empty($orderby))
            $select->order("$orderby $order");
//echo $select;
        $result = $this->db->fetchRow($select);
        return $result;
    }

# getRecordListingFromTwoTablesWhere
    # to get records from 3 tables

    public function getRecordFromThreeTablesById_RV($t1, $colsArr1, $t2, $colsArr2, $t3, $colsArr3, $joinCols1, $joinCols2, $whereArr, $orderby = '', $order = "ASC") {
        $select = $this->db->select();
        $select->from(array("t1" => "$t1"), $colsArr1);
        $select->joinLeft(array('t2' => "$t2"), $joinCols1[0] . " = " . $joinCols1[1], $colsArr2);

        $select->joinLeft(array('t3' => "$t3"), $joinCols2[0] . " = " . $joinCols2[1], $colsArr3);

        foreach ($whereArr as $col => $val) {
            $select->where("t1.$col =?", $val);
        }

        if (!empty($orderby))
            $select->order("$orderby $order");
//echo $select;
        $result = $this->db->fetchRow($select);
        return $result;
    }

# getRecordListingFromTwoTablesWhere
    # to get records listings from 2 tables

    public function getRecordListingFromTwoTablesWhere($t1, $colsArr1, $t2, $colsArr2, $joinGlueArr, $whereArr, $whereFromTbl = 't1', $orderby = '', $order = "ASC") {
        $select = $this->db->select();
        $select->from(array("t1" => "$t1"), $colsArr1);
        $select->joinLeft(array('t2' => "$t2"), " t1.$joinGlueArr[0] = t2.$joinGlueArr[1] ", $colsArr2);

        $strWhereFromTbl = ($whereFromTbl == 2) ? 't2' : 't1';
        foreach ($whereArr as $col => $val) {
            $select->where("$strWhereFromTbl.$col =?", $val);
        }

        if (!empty($orderby))
            $select->order("$orderby $order");

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

# getRecordListingFromTwoTablesWhere

    public function insertTable($table, $data) {
        $dbtable = new Zend_Db_Table("$table");
        return $dbtable->insert($data);
    }

    /**
     * updateTable() method is used to update data on table primary key basis
     * @param table name, data array, where condition
     * @return object
     */
    public function updateTable($table, $editData, $where) {
        $dbtable = new Zend_Db_Table("$table");
        return $dbtable->update($editData, $where);
    }

    # End : functions added by Shailender Joshi on 7 Oct 2016

    // $where       =  array('column'=>value,'column'=>'value',.......);
    // $columnArray =  array('column1','column2','column3',...........);
    public function getRoomTypeAgencyWise($title =null, $agencySysId = null) {
        $select = $this->db->select();
        $select->from(array('tbl' => "TB_Master_RoomType"), array('RoomType', 'Title'));
        $select->where('tbl.IsActive = 1 AND tbl.IsMarkForDel = 0');
        if($title) {
        $select->where('tbl.Title like (?)', '%' . $title . '%');
        }
        if ($agencySysId) {
            $select->Where('tbl.IsMaster = 1 OR tbl.AgencySysId = ?', $agencySysId);
        } else {
            $select->where('tbl.IsMaster = 1');
        }
       // echo $select;exit;
        $result = $this->db->fetchAll($select);
        return $result;
    }

    public function getRecordListingWhereLike($table, $columnArray, $whereStatic, $whereArr, $orderby = '', $order = "ASC") {
        $select = $this->db->select()->from($table, $columnArray);

        foreach ($whereStatic as $col => $val) {
            if ($val !== '') {
                $select->where("$col =?", $val);
            }
        }
        foreach ($whereArr as $col => $val) {
            if ($val !== '') {
                $select->where("$col LIKE ?", "%" . $val . "%");
            }
        }
        //$select->where("IsMarkForDel ='0'");
        if (!empty($orderby))
            $select->order("$orderby $order");
//         echo $select;die;
        $result = $this->db->fetchAll($select);
        return $result;
    }

# getRecordListing

    public function getRecordListingWhereIn($table, $columnArray, $whereStatic, $whereArr, $whereInArr, $orderby = '', $order = "ASC") {
        $select = $this->db->select()->from($table, $columnArray);

        foreach ($whereStatic as $col => $val) {
            if ($val !== '') {
                $select->where("$col =?", $val);
            }
        }
        foreach ($whereArr as $col => $val) {
            if ($val !== '') {
                $select->where("$col LIKE ?", $val . "%");
            }
        }
        foreach ($whereInArr as $col => $val) {
            if ($val !== '') {
                $select->where("$col IN (" . $val . ")");
            }
        }

        if (!empty($orderby))
            $select->order("$orderby $order");
        // echo $select;die;
        $result = $this->db->fetchAll($select);
        return $result;
    }

# getRecordListing

    public function getRecordListingWhereInOther($table, $columnArray, $whereStatic, $whereArr, $whereInArr, $orderby = '', $order = "ASC") {
        $select = $this->db->select()->from($table, $columnArray);

        foreach ($whereStatic as $col => $val) {
            if ($val !== '') {
                $select->where("$col =?", $val);
            }
        }
        foreach ($whereArr as $col => $val) {
            if ($val !== '') {
                $select->where("$col LIKE ?", $val . "%");
            }
        }

//        foreach($whereInArr as $col=>$val)
//        {
//            if($val!==''){
//               $select->where("$col IN (".$val.")");
//            }
//        }

        if (!empty($orderby))
            $select->order("$orderby $order");
        // echo $select;die;
        $result = $this->db->fetchAll($select);
        return $result;
    }

# getRecordListing

    public function getCitySearchbuildpck($term) {
        $select = $this->db->select();
        $selectarray = array('CityId', 'Title', 'Country', 'ContSysId');

        $select->from(array('tb1' => "TB_Master_Geo_City"), $selectarray);

        $select->where('Title LIKE ?', '%' . $term . '%');
        $select->where("tb1.IsMarkForDel =?", 0);
        $select->where("tb1.IsActive =?", 1);
        $select->order(array('Title ASC'));
        $result = $this->db->fetchAll($select);
        if (count($result) > 0) {
            foreach ($result as $row) {
                $dataName = $row['Title'];
                $response[] = array('CityId' => $row['CityId'], 'Title' => $row['Title'], 'Country' => $row['Country'], 'value' => $dataName, 'label' => $dataName);
            }
        }
//            else {
//                $response[] = array('CityId' => 0, 'Title' => 0,'Country' => 0,'MiscCost' => 0, 'GSTPercentage'=>0, 'value' => 'Add New Item', 'label' => 'Add New Item');
//            }
        return $response;
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit