<?php
/**
 * Adodis Blog package
 * @author J-Extension <contact@jextn.com>
 * @link http://www.jextn.com
 * @copyright (C) 2012 - 2013 J-Extension
 * @license GNU/GPL, see LICENSE.php for full license.
**/

// No direct access
defined('_JEXEC') or die;

/**
 * Adodisblog helper.
 */
class AdodisBlogHelper
{
	/**
	 * Configure the Linkbar.
	 */
	public static function addSubmenu($vName = '')
	{

		JSubMenuHelper::addEntry(
			JText::_('COM_ADODISBLOG_BLOGS'),
			'index.php?option=com_adodisblog&view=blogs',
			$vName == 'blogs'
		);

		JSubMenuHelper::addEntry(
			JText::_('COM_ADODISBLOG_SUBMENU_CATEGORIES'),
			'index.php?option=com_categories&extension=com_adodisblog',
			$vName == 'categories'
		);

		JSubMenuHelper::addEntry(
			JText::_('COM_ADODISBLOG_COMMENTS'),
			'index.php?option=com_adodisblog&view=comments',
			$vName == 'comments'
		);

		JSubMenuHelper::addEntry(
			JText::_('COM_ADODISBLOG_USERS'),
			'index.php?option=com_adodisblog&view=users',
			$vName == 'users'
		);

		JSubMenuHelper::addEntry(
			JText::_('COM_ADODISBLOG_SETTINGS'),
			'index.php?option=com_adodisblog&task=settings.edit&id=1',
			$vName == 'settings'
		);

		if ($vName=='categories') {
			JToolBarHelper::title( JText::sprintf('COM_CATEGORIES_CATEGORIES_TITLE', JText::_('com_adodisblog')), 'blog-categories');
		}
	}


	public static function getActions()
	{
		$user		= JFactory::getUser();
		$result		= new JObject;

		$assetName 	= 'com_adodisblog';

		$actions 	= array(
			'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.own', 'core.edit.state', 'core.delete'
		);

		foreach ($actions as $action) {
			$result->set($action,	$user->authorise($action, $assetName));
		}

		return $result;
	}
}
