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/StateController.php
<?php
/**
 * Class City
 *
 * @name		City
 * @author		Ravi Khare
 * @editor		Ranvir Singh
 * @created		13 Sep 2016
 * @updateed		17 Sep 2016
 * @version 	1.0
 * @copyright 	Catabatic India Pvt Ltd
 * Handle City Related function for Front end only
 *
 */

class StateController extends Zend_Controller_Action {
    
    public $imageUrl = NULL;
    
    public $baseUrl = '';
    
    public $tablename   = '';
    public $cityMdl     = '';
    
    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->cityModal = new Travel_Model_TblCity();
        $this->stateMdl = new Travel_Model_TblState();
		
		$this->GeneralFunction_Modal = new Travel_Model_GeneralFunction();  // Make object of generel function class
        
        $this->tablename    = 'TB_Master_Geo_State';
        
        $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/city/";
        
    }
    
     public function indexAction()
    {
        $this->view->messages = $this->_helper->flashMessenger->getMessages();
		
		// get country list array
		$objCountry = new Travel_Model_TblCountry();
        $this->view->countrylist = $objCountry->getCountryList();
		
		// display flash msg 
		$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))
            {
                $dateFrom       = (@$getData['dateFrom']!='')         ? @$getData['dateFrom']       : '';
			    $dateTo         = (@$getData['dateTo']!='')           ? $this->_helper->general->plusOneDay(@$getData['dateTo'])  : '';   // add one day extra while fetching result date results
				$code           = (@$getData['code']!='')             ? @$getData['code']           : '';
				$country_id     = (@$getData['country_id']!=0)        ? @$getData['country_id']     : '';
				$stateName      = (@$getData['stateName']!='')       ? @$getData['stateName']       : '';
				$filter1        = (@$getData['filter1']!='All')       ? @$getData['filter1']        : '';    // status part
				$filter2        = (@$getData['filter2']!='All')       ? @$getData['filter2']        : '';    // verified part
               
			   $searchArr = array(
                            'dateFrom' => $dateFrom,
							'dateTo'   => $dateTo,
							'code'     => $code,
							'stateName' => $stateName,
                            'countryId'=> $country_id,
							'filter1'  => $filter1,
							'filter2'  => $filter2
                            
               );
			  // print_r($getData);
			} 
		} 
		else
		{
				
			$dateFrom   = $this->_getParam('dateFrom');
			$dateTo     = $this->_getParam('dateTo');
			$code       = $this->_getParam('code');
			$stateName  = $this->_getParam('stateName');   // _getParam( $searchArr('Key') );
			$country_id = $this->_getParam('countryId');
			$filter1    = $this->_getParam('filter1');
			$filter2    = $this->_getParam('filter2');
							 
			$dateFrom   = (@$dateFrom!='') ? $dateFrom : '';
			$dateTo     = (@$dateTo!='') ? $dateTo : '';
			$code       = (@$code!='') ? $code : '';
			$stateName  = (@$stateName!='') ? $stateName : '';
			$country_id = (@$country_id!=0) ? $country_id : '';
			$filter1    = (@$filter1!='All') ? $filter1 : '';
			$filter2    = (@$filter2!='All') ? $filter2 : '';
			
			$searchArr = array(
						'dateFrom' => $dateFrom,
						'dateTo'   => $dateTo,
						'code'     => $code,
						'stateName' => $stateName,
						'countryId'=> $country_id,
						'filter1'  => $filter1,
						'filter2'  => $filter2
						
			);
			
			//print_r($searchArr);
				
		}
			//print_r($searchArr);
			$this->stateMdl->searchArr = $searchArr; // send Array - searchArr() to modal just for pagination
			$this->view->searchArr = $searchArr;	
		
		
		// pagination start
		$page = $this->_request->getParam('page',1); //get curent page param, default 1 if param not available.
		
		$data = $this->stateMdl->getStateListingRecord(); // get all cities
		
		$page=$this->_getParam('page',1);
        $paginator = Zend_Paginator::factory($data);      
        $paginator->setCurrentPageNumber($this->getRequest()->getParam('page')); // page number
        $perPage = $paginator->setItemCountPerPage(20); // 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_States();
        $form->setAction($this->baseUrl."/state/add")->setMethod("POST")->setName("addStateForm");
        $this->view->form = $form;
            
            
		if ($this->getRequest()->isPost()) {

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

			if ($form->isValid($post)) {

				try 
				{
				
					$addState = array(
						 'Title'=> $post['Title'],
						 'Code'=> $post['Code'],
						 'ContSysId'=> $post['countryId'],
						 'CreateDate'=> date('Y-m-d H:i:s'),
						 'UpdateDate'=> '',
						 'PIN'=> 0,
						 'IsApprove'=> 0,
						 'IsActive'=> 1,
						 'IsMarkForDelete'=> 0,
					   );

					// check state name already exists or not ( Avoid duplicate state entry)
					if($post['Title']!=''){
						$stateName    = $this->GeneralFunction_Modal->getRecordListingWhere($this->tablename, array('Title'), array('Title'=>$addState['Title']),'Title');
					}
					//print_r($stateName); echo count($stateName);
					if(count($stateName)>=1){
						$this->view->eMsg = "State name already exists.";
					} 
					else
					{
						$isinserted = $this->GeneralFunction_Modal->insertTable($this->tablename, $addState); 
						if($isinserted) {
							$this->_helper->flashMessenger->addMessage("Record inserted successfully.");
							$this->_redirect("state/index");
						}
						
					}
				}
				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);

        //$this->_helper->viewRenderer("places-to-eat-new");
        
       if(!empty($intId) || !is_int($intId) )
        {
            
            # get listings of place to eat
            $colsArr    = array('*');
            $resultset  = $this->GeneralFunction_Modal->getDetailsByUniqueId('TB_Master_Geo_State', $colsArr, 'StateId', $intId);

            $form = new Travel_Form_States();
        
            $form->setMethod("POST")->setName("editStateForm");

            $editdata = array(
                        'Title'=> $resultset['Title'],
                        'countryId'=> $resultset['ContSysId'],
                        'Code'=> $resultset['Code'],
                        'IsApprove'=> $resultset['IsApprove'],
                        'IsActive'=> $resultset['IsActive'],
                        
                      );

            $form->populate($editdata);
        
            $this->view->form = $form;
            
            
            if ($this->getRequest()->isPost()) {

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

                if ($form->isValid($post)) {

                   try {
                        $editStateData = array(
								 'Title'=> $post['Title'],
								 'Code'=> $post['Code'],
								 'ContSysId'=> $post['countryId'],
								 'UpdateDate'=> date('Y-m-d H:i:s'),
								 'IsApprove'=> 0,
								 'IsActive'=> 1,
								 
							 
                               );

                        $tablename  = 'TB_Master_Geo_State';
                        $where      = array('StateId =?'=> $intId);
                        $this->GeneralFunction_Modal->updateTable($tablename, $editStateData, $where);
						
                        $this->_helper->flashMessenger->addMessage("Record updated successfully");
                        $this->_redirect("state");
                        
                    }
                    catch (Zend_Form_Exception $e) {
						$this->view->error_msg  = $e->getMessage();
					} 
                    
                }
            }


            $this->view->others         = array('baseUrl' => $this->baseUrl, 'action_name'=> 'places-to-eat');
            $this->view->resultset      = $resultset;
			$this->view->messages = $this->_helper->flashMessenger->getMessages();

        }
        
    }
    
    
    public function deleteStateAction()
    {
        /* Disable Layout & set Render False */
        $this->_helper->layout->disableLayout();
        $this->_helper->viewRenderer->setNoRender(true);

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

		if($StateId) {
			$editData['IsMarkForDelete']  = 1;           
			$tablename  = "TB_Master_Geo_State";
			$where      = array('StateId =?'=> $StateId);
			$isupdated  = $this->GeneralFunction_Modal->updateTable($this->tablename, $editData, $where);
			if($isupdated)
				{
					$this->_helper->flashMessenger->addMessage("Record Deleted successfully.");
					$this->_redirect("state/index/page/$currentPage");
				}
        }
        else {
                $this->_redirect("state/index/page/$currentPage");
         }   
        
    }
	
	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');
		$StateId  = base64_decode( $this->getRequest()->getParam('id'));
        $currentPage  = base64_decode( $this->getRequest()->getParam('page'));

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

Youez - 2016 - github.com/yon3zu
LinuXploit