<?php

include_once './core/search.class.php';

class admin_search {
	
	private $layout_object;
	
	public function __construct($base_object, $layout_object) {
		$this->layout_object = $layout_object;
	}
	
	function run() {
		$search = $_GET['search'];
		
		
		$customers = Search::customers($search);
		$this->layout_object->assign('customer_hits', $customers['hits']);
		$this->layout_object->assign('customer_search', $customers['results']);
		
		$orders = Search::orders($search);
		$this->layout_object->assign('order_hits', $orders['hits']);
		$this->layout_object->assign('order_search', $orders['results']);
		
		$items = Search::items($search);
		$this->layout_object->assign('item_hits', $items['hits']);
		$this->layout_object->assign('item_search', $items['results']);
		
		$manufacturers = Search::manufacturers($search);
		$this->layout_object->assign('manufacturer_hits', $manufacturers['hits']);
		$this->layout_object->assign('manufacturer_search', $manufacturers['results']);
		
		echo $this->layout_object->fetch('admin_search.tpl');
	}
	
}