Guest User

Untitled

a guest
Oct 17th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. <?php defined('_JEXEC') or die;
  2.  
  3. class plgSystemDealershipManager extends JPlugin
  4. {
  5. public function __construct(&$subject, $config = array()){
  6. parent::__construct($subject, $config);
  7. $this->loadLanguage();
  8. }
  9.  
  10. public function onAfterInitialise(){
  11. JLoader::register('modQuickIconHelper', JPATH_ADMINISTRATOR.'/modules/mod_quickicon/helper.php');
  12. // We get this by reference so we can add buttons to it
  13. $buttons =& modQuickIconHelper::getButtons();
  14.  
  15. // Even if we use actions to limit which icons we show, we do not want to show some icons
  16. // if this user is a dealership manager, because they only manage a single dealership
  17. $user = JFactory::getUser();
  18. $params = $user->getParam('profile');
  19. if(!$params->dealership){
  20. $buttons[] = array(
  21. 'link' => JRoute::_('index.php?option=com_dealershipmanager&view=dealers'),
  22. 'image' => JURI::root(false).'/media/com_dealershipmanager/images/manager_48x48.png',
  23. 'text' => JText::_('PLG_SYSTEM_DEALERSHIPMANAGER_DEALERSHIPS'),
  24. 'access' => true
  25. );
  26.  
  27. $buttons[] = array(
  28. 'link' => JRoute::_('index.php?option=com_dealershipmanager&view=import'),
  29. 'image' => JURI::root(false).'/media/com_dealershipmanager/images/import_48x48.png',
  30. 'text' => JText::_('PLG_SYSTEM_DEALERSHIPMANAGER_IMPORT'),
  31. 'access' => true
  32. );
  33. }
  34.  
  35. $buttons[] = array(
  36. 'link' => JRoute::_('index.php?option=com_dealershipmanager&view=vehicles'),
  37. 'image' => JURI::root(false).'/media/com_dealershipmanager/images/cabriolet_48x48.png',
  38. 'text' => JText::_('PLG_SYSTEM_DEALERSHIPMANAGER_VEHICLES'),
  39. 'access' => array('core.manage', 'com_dealershipmanager')
  40. );
  41.  
  42. $buttons[] = array(
  43. 'link' => JRoute::_('index.php?option=com_dealershipmanager&view=reports'),
  44. 'image' => JURI::root(false).'/media/com_dealershipmanager/images/reports_48x48.png',
  45. 'text' => JText::_('PLG_SYSTEM_DEALERSHIPMANAGER_REPORTS'),
  46. 'access' => array('core.manage', 'com_dealershipmanager')
  47. );
  48.  
  49. $buttons[] = array(
  50. 'link' => JRoute::_('index.php?option=com_dealershipmanager&view=logs'),
  51. 'image' => JURI::root(false).'/media/com_dealershipmanager/images/logs_48x48.png',
  52. 'text' => JText::_('PLG_SYSTEM_DEALERSHIPMANAGER_LOGS'),
  53. 'access' => array('dealership.manage', 'com_dealershipmanager')
  54. );
  55. }
  56. }
Add Comment
Please, Sign In to add comment