Skip to content

Instantly share code, notes, and snippets.

@sanderpotjer
Created June 19, 2012 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sanderpotjer/2954557 to your computer and use it in GitHub Desktop.
Save sanderpotjer/2954557 to your computer and use it in GitHub Desktop.
administrator/components/com_content/helpers/content.php
/**
* Gets a list of the actions that can be performed.
*
* @param int The category ID.
* @param int The article ID.
*
* @return JObject
* @since 1.6
*/
public static function getActions($categoryId = 0, $articleId = 0)
{
$user = JFactory::getUser();
$result = new JObject;
if (empty($articleId) && empty($categoryId)) {
$assetName = 'com_content';
}
elseif (empty($articleId)) {
$assetName = 'com_content.category.'.(int) $categoryId;
}
else {
$assetName = 'com_content.article.'.(int) $articleId;
}
$actions = JAccess::getActionsFromFile(JPATH_ADMINISTRATOR . '/components/com_content/access.xml');
foreach ($actions as $action) {
$result->set($action->name, $user->authorise($action->name, $assetName));
}
return $result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment