<?PHP

require_once('api/Simpla.php');

class MarkasAdmin extends Simpla
{
	function fetch()
	{

		// Обработка действий 	
		if($this->request->method('post'))
		{

			// Действия с выбранными
			$ids = $this->request->post('check');

			if(is_array($ids))
			switch($this->request->post('action'))
			{
				case 'delete':
				{
					foreach($ids as $id)
						$this->marka->delete_brand($id);    
		        break;
				}
			}
		}	

		$brands = $this->marka->get_brands();
		
		foreach($brands as $brand) $brand->models = $this->marka->getModels($brand);
 
		$this->design->assign('brands', $brands);
		return $this->body = $this->design->fetch('markas.tpl');
	}
}

