helper.php 2.01 KB
<?php
/* ======================================================
# Monthly Archive - Joomla! Component v4.3.3 (PRO version)
# -------------------------------------------------------
# For Joomla! 3.x
# Author: Yiannis Christodoulou (yiannis@web357.eu)
# Copyright (©) 2009-2018 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https://www.web357.eu/
# Demo: http://demo.web357.eu/?item=monthlyarchive
# Support: support@web357.eu
# Last modified: 09 Feb 2018, 13:55:18
========================================================= */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

abstract class MonthlyarchiveHelper
{
	public static function addSubmenu($submenu) 
	{
		JLoader::import( "joomla.version" );
		$version = new JVersion();

		if (!version_compare( $version->RELEASE, "2.5", "<=")) :
			
			// J3X
			JHtmlSidebar::addEntry(JText::_('Overview'), 'index.php?option=com_monthlyarchive&view=overv', $submenu == 'overv');
			JHtmlSidebar::addEntry(JText::_('Settings'), 'index.php?option=com_config&view=component&component=com_monthlyarchive', $submenu == 'settingscore');
			JHtmlSidebar::addEntry(JText::_('About Web357'), 'index.php?option=com_monthlyarchive&view=about', $submenu == 'about');
	
		else:
			
			// J25X
			$vName = JRequest::getCmd('view', 'overv');
			echo JSubMenuHelper::addEntry( JText::_('Overview'), 'index.php?option=com_monthlyarchive&view=overv', $vName == 'overv' );
	
			$vName = JRequest::getCmd('view', 'about');
			echo JSubMenuHelper::addEntry( JText::_('About Web357'), 'index.php?option=com_monthlyarchive&view=about', $vName == 'about' );

		endif; 
	}

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

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

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

		return $result;
	}

}