<?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 MenuModelBadges extends JModelLegacy {
    function getUserState($name, $def='', $type='cmd') {
        $app = JFactory::getApplication();
        return $app->getUserStateFromRequest('com_fwfoodmenu.badges.'.$name, $name, $def, $type);
    }
    function getPagination() {
        $app = JFactory::getApplication();
		$input = $app->input;
        jimport('joomla.html.pagination');
        return new JPagination(
        	$this->loadQty(),
    		$input->getInt('limitstart'),
    		$input->getInt('limit', $app->getCfg('list_limit'))
    	);
    }
    function loadList() {
        $list = array();
        $app = JFactory::getApplication();
        $data = $app->triggerEvent('onLoadList', array('com_fwfoodmenu.badges', $this, &$list));
        return $list;
    }
    function loadQty() {
        $qty = 0;
        $app = JFactory::getApplication();
        $data = $app->triggerEvent('onLoadQty', array('com_fwfoodmenu.badges', $this, &$qty));
        return $qty;
    }
    function loadObject() {
        $obj = new stdclass;
        $app = JFactory::getApplication();
        $data = $app->triggerEvent('onLoadObject', array('com_fwfoodmenu.badges', $this, &$obj));
        return $obj;
    }
    function save() {
        $result = false;
        $app = JFactory::getApplication();
        $data = $app->triggerEvent('onSave', array('com_fwfoodmenu.badges', $this, &$result));
        return $result;
    }
    function remove() {
        $result = false;
        $app = JFactory::getApplication();
        $data = $app->triggerEvent('onRemove', array('com_fwfoodmenu.badges', $this, &$result));
        return $result;
    }
}
