HEX
Server: Apache
System: Linux v38079.2is.nl 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: democfellows (10015)
PHP: 8.1.34
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/creativefellows.nl/jhtaxatie.creativefellows.nl/classes/SearchController.php
<?php
	
	class SearchController extends BaseController
	{	
		function __construct($db_connection,$router,$user_id,$view=null,$user_role=null,$settings=null)
		{
			
			$this->db 			= $db_connection;
			$this->router		= $router;
			$this->view 		= $view;
			$this->user_role	= $user_role;
			$this->user_id 		= $user_id;
			$this->settings 	= $settings;
			$this->siteUrl 		= $this->settings['siteUrl'];		
					
		}
		
		/*
		 * Search DB for taxations
		 */
	    public function showSearch($request, $response, $args)
		{
			
			$params		= $request->getQueryParams();
			$q			= $params["q"];			
			$view_page	= isset($params["p"]) ? $params["p"] : 1;
			
			// taxations
		    $taxationController = new TaxationController($this->db, $this->router, $this->user_id , null, $this->user_role, $this->settings); 
			$taxationController->setPageMax(50);
			$taxations = $taxationController->searchTaxations($q,$view_page);
			
				
			
			// enquiries
		    $enquiryController = new EnquiryController($this->db, $this->router, $this->user_id , null, $this->user_role, $this->settings);
			$enquiryController->setPageMax(50);
			$enquiries = $enquiryController->search($q,$view_page);
			
			// inspections
		    $inspectionController = new InspectionController($this->db, $this->router, $this->user_id , null, $this->user_role, $this->settings);
			$inspectionController->setPageMax(50);
			$inspections = $inspectionController->search($q,$view_page);
					
			
			
			return $this->view->render($response, 'search.php',[
				"router" => $this->router, 
				"data" 	=> [
					"Taxaties" => $taxations,
					"Aanvragen" => $enquiries,
					"Keuringen" => $inspections
				], 
				"paths" =>
				[
					"Taxaties" => "taxation.view",
					"Aanvragen" => "enquiry.view",
					"Keuringen" => "inspection.view"
				],
				"header_lbl" => "Zoekresultaten",
				"pagination" => $this->pagination,
				"active_page" => $view_page, 
				"q" => $q
			]);
				
	    }
		
		
	
	}
		
		
?>