<?php
/**
 * FW Food menu 5.1.1
 * @copyright (C) 2020 Fastw3b
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @link http://www.fastw3b.net/ Official website
 **/

defined( '_JEXEC' ) or die( 'Restricted access' );

class menuViewCategory extends JViewLegacy {
	function display($tmpl=null) {
		$model = $this->getModel();
		$data = new stdclass;

		switch ($this->getLayout()) {
			case 'quick_categories' :
				$data->result = $model->quickCategories();
				break;
			case 'upload' :
				$data = $model->upload();
				if (empty($data->id)) {
					$data->msg = $model->getError();
				}
			break;
			case 'delete_image' :
				$data = $model->deleteImage();
				if (empty($data->id)) {
					$data->msg = $model->getError();
				}
				break;
		}
		$data->msg = implode('\\n', $model->getErrors());
		die(json_encode($data));
	}
}
