Skip to content

Commit

Permalink
Merge pull request joomla#157 from joomla/quickicons-split-modules
Browse files Browse the repository at this point in the history
Split the quickicon module into three modules
  • Loading branch information
chmst authored May 5, 2019
2 parents 375fe59 + d73fb69 commit f82d66d
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 79 deletions.
12 changes: 5 additions & 7 deletions administrator/components/com_cpanel/tmpl/cpanel/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,16 @@
);
?>
<?php if ($this->quickicons) : ?>
<div class="row">
<div class="col-md-12">
<?php
// Display the icon position modules
<div id="cpanel-modules" class="row">
<?php // Display the icon position modules
foreach ($this->quickicons as $iconmodule)
{
echo ModuleHelper::renderModule($iconmodule);
echo ModuleHelper::renderModule($iconmodule, array('style' => 'well'));
}
?>
</div>
?>
</div>
<?php endif; ?>

<div id="cpanel-modules" class="row">
<?php
foreach ($this->modules as $module)
Expand Down
20 changes: 17 additions & 3 deletions administrator/language/en-GB/en-GB.mod_quickicon.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@
; Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8

MOD_QUICKICON_TYPE="Icon Type"
MOD_QUICKICON_SELECT_TYPE="- Select Icon Panel Type -"
MOD_QUICKICON_UPDATE="Icons Update"
MOD_QUICKICON_SYSTEM="Icons System"
MOD_QUICKICON_SITE="Icons Site"
MOD_QUICKICON="Quick Icons"
MOD_QUICKICON_ADD_NEW="New %s"
MOD_QUICKICON_ARTICLE_MANAGER="Articles"
MOD_QUICKICON_ARTICLE_MANAGER_1="Article"
MOD_QUICKICON="Quick Icons"
MOD_QUICKICON_CACHE="Cache"
MOD_QUICKICON_CHECKIN="Checkin"
MOD_QUICKICON_CHECKIN_ALL="Global Checkin"
MOD_QUICKICON_CATEGORY_ADD="New Category"
MOD_QUICKICON_CATEGORY_MANAGER="Article Categories"
MOD_QUICKICON_CATEGORY_MANAGER_1="Article Category"
MOD_QUICKICON_CHECKINS="Global Checkin"
Expand All @@ -21,8 +30,10 @@ MOD_QUICKICON_INSTALL_EXTENSIONS="Install Extensions"
MOD_QUICKICON_LANGUAGE_MANAGER="Languages"
MOD_QUICKICON_MAINTENANCE="Maintenance"
MOD_QUICKICON_MEDIA_MANAGER="Media"
MOD_QUICKICON_MENUITEMS_ADD="New Menu Item"
MOD_QUICKICON_MENUITEMS_MANAGER="Menu Items"
MOD_QUICKICON_MENUITEMS_MANAGER_1="Menu Item"
MOD_QUICKICON_MODULE_ADD="New Module"
MOD_QUICKICON_MODULE_MANAGER="Modules"
MOD_QUICKICON_MODULE_MANAGER_1="Module"
MOD_QUICKICON_NAV_LABEL="Quick Links"
Expand All @@ -31,15 +42,18 @@ MOD_QUICKICON_TEMPLATES="Templates"
MOD_QUICKICON_TEMPLATE_MANAGER="Template"
MOD_QUICKICON_TEMPLATE_MANAGER_1="Templates"
MOD_QUICKICON_SHOW_ARTICLES_LABEL="Articles Icon"
MOD_QUICKICON_SHOW_CATEGORIES_LABEL="Categories Icon"
MOD_QUICKICON_SHOW_GLOBAL_LABEL="Global Configuration Icon"
MOD_QUICKICON_SHOW_CACHE_LABEL="Cache Icon"
MOD_QUICKICON_SHOW_CATEGORIES_LABEL="Categories Icon"
MOD_QUICKICON_SHOW_CHECKIN_LABEL="Checkin Icon"
MOD_QUICKICON_SHOW_GLOBAL_LABEL="Global Configuration Icon"
MOD_QUICKICON_SHOW_CHECKINS_LABEL="Checkin Icon"
MOD_QUICKICON_SHOW_MEDIA_LABEL="Media Icon"
MOD_QUICKICON_SHOW_MENUITEMS_LABEL="Menu Items Icon"
MOD_QUICKICON_SHOW_MODULES_LABEL="Modules Icon"
MOD_QUICKICON_SHOW_PLUGINS_LABEL="Plugins Icon"
MOD_QUICKICON_SHOW_TEMPLATES_LABEL="Templates Icon"
MOD_QUICKICON_SHOW_USERS_LABEL="User Icon"
MOD_QUICKICON_SITE="Icons Site"
MOD_QUICKICON_STRUCTURE="Structure"
MOD_QUICKICON_TEMPLATE_MANAGER="Templates"
MOD_QUICKICON_USER_MANAGER="Users"
Expand Down
127 changes: 70 additions & 57 deletions administrator/modules/mod_quickicon/Helper/QuickIconHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,82 @@ public static function &getButtons(Registry $params, CMSApplication $application

if (!isset(self::$buttons[$key]))
{
$context = $params->get('context', 'mod_quickicon');
// Load mod_quickicon language file in case this method is called before rendering the module
$application->getLanguage()->load('mod_quickicon');

self::$buttons[$key] = [];
// Update Panel, icons come from plugins quickicons
if ($params->get('icon_type', 'site') === 'update')
{
// Update Panel, icons come from plugins quickicons
$context = $params->get('context', 'mod_quickicon');

// Include buttons defined by published quickicon plugins
PluginHelper::importPlugin('quickicon');

$arrays = (array) $application->triggerEvent(
'onGetIcons',
new QuickIconsEvent('onGetIcons', ['context' => $context])
);

if ($context === 'mod_quickicon')
foreach ($arrays as $response)
{
foreach ($response as $icon)
{
$default = array(
'link' => null,
'image' => null,
'text' => null,
'access' => true,
'class' => true,
'group' => 'MOD_QUICKICON_EXTENSIONS',
);
$icon = array_merge($default, $icon);

if (!is_null($icon['link']) && !is_null($icon['text']))
{
self::$buttons[$key][] = $icon;
}
}
}
}
elseif ($params->get('icon_type', 'site') === 'system')
{
// Load mod_quickicon language file in case this method is called before rendering the module
$application->getLanguage()->load('mod_quickicon');

if ($params->get('show_checkin', '1'))
{
self::$buttons[$key][] = [
'amount' => self::countCheckin(),
'link' => Route::_('index.php?option=com_checkin'),
'text' => Text::_('MOD_QUICKICON_CHECKINS'),
'access' => array('core.admin', 'com_checkin'),
'group' => 'MOD_QUICKICON_SYSTEM'
];
}
if ($params->get('show_cache', '1'))
{
self::$buttons[$key][] = [
'amount' => '123kB',
'link' => Route::_('index.php?option=com_chache'),
'text' => Text::_('MOD_QUICKICON_CACHE'),
'access' => array('core.admin', 'com_cache'),
'group' => 'MOD_QUICKICON_SYTEM'
];
}
if ($params->get('show_global', '1'))
{
self::$buttons[$key][] = [
'link' => Route::_('index.php?option=com_config'),
'image' => 'fa fa-cog',
'text' => Text::_('MOD_QUICKICON_GLOBAL_CONFIGURATION'),
'access' => array('core.manage', 'com_config', 'core.admin', 'com_config'),
'group' => 'MOD_QUICKICON_CONFIGURATION',
'group' => 'MOD_QUICKICON_SYSTEM',
];
}

}
elseif ($params->get('icon_type', 'site') === 'site')
{
if ($params->get('show_users', '1'))
{
$amount = self::countUsers();
Expand All @@ -99,7 +155,7 @@ public static function &getButtons(Registry $params, CMSApplication $application
'addwhat' => Text::plural('MOD_QUICKICON_USER_MANAGER', 1),
'name' => Text::plural('MOD_QUICKICON_USER_MANAGER', $amount),
'access' => array('core.manage', 'com_users', 'core.create', 'com_users'),
'group' => 'MOD_QUICKICON_USERS',
'group' => 'MOD_QUICKICON_SITE',
];
}

Expand Down Expand Up @@ -129,10 +185,10 @@ public static function &getButtons(Registry $params, CMSApplication $application
'addwhat' => Text::plural('MOD_QUICKICON_ARTICLE_MANAGER', 1),
'name' => Text::plural('MOD_QUICKICON_ARTICLE_MANAGER', $amount),
'access' => array('core.manage', 'com_content', 'core.create', 'com_content'),
'group' => 'MOD_QUICKICON_CONTENT',
'group' => 'MOD_QUICKICON_SITE',
];
}

if ($params->get('show_categories', '1'))
{
$amount = self::countArticleCategories();
Expand All @@ -144,7 +200,7 @@ public static function &getButtons(Registry $params, CMSApplication $application
'linkadd' => Route::_('index.php?option=com_categories&task=category.add'),
'name' => Text::plural('MOD_QUICKICON_CATEGORY_MANAGER', $amount),
'access' => array('core.manage', 'com_categories', 'core.create', 'com_categories'),
'group' => 'MOD_QUICKICON_CONTENT',
'group' => 'MOD_QUICKICON_SITE',
];
}

Expand All @@ -155,7 +211,7 @@ public static function &getButtons(Registry $params, CMSApplication $application
'link' => Route::_('index.php?option=com_media'),
'text' => Text::_('MOD_QUICKICON_MEDIA_MANAGER'),
'access' => array('core.manage', 'com_media'),
'group' => 'MOD_QUICKICON_CONTENT',
'group' => 'MOD_QUICKICON_SITE',
];
}

Expand All @@ -168,7 +224,7 @@ public static function &getButtons(Registry $params, CMSApplication $application
'link' => Route::_('index.php?option=com_modules'),
'text' => Text::plural('MOD_QUICKICON_MODULE_MANAGER', $amount),
'access' => array('core.manage', 'com_modules'),
'group' => 'MOD_QUICKICON_CONTENT'
'group' => 'MOD_QUICKICON_SITE'
];
}

Expand All @@ -181,18 +237,7 @@ public static function &getButtons(Registry $params, CMSApplication $application
'link' => Route::_('index.php?option=com_plugins'),
'text' => Text::plural('MOD_QUICKICON_PLUGIN_MANAGER', $amount),
'access' => array('core.manage', 'com_plugins'),
'group' => 'MOD_QUICKICON_MAINTENANCE'
];
}

if ($params->get('show_checkin', '1'))
{
self::$buttons[$key][] = [
'amount' => self::countCheckin(),
'link' => Route::_('index.php?option=com_checkin'),
'text' => Text::_('MOD_QUICKICON_CHECKINS'),
'access' => array('core.admin', 'com_checkin'),
'group' => 'MOD_QUICKICON_CONTENT'
'group' => 'MOD_QUICKICON_SITE'
];
}

Expand All @@ -203,47 +248,15 @@ public static function &getButtons(Registry $params, CMSApplication $application
'link' => Route::_('index.php?option=com_templates&client_id=0'),
'text' => Text::_('MOD_QUICKICON_TEMPLATES'),
'access' => array('core.admin', 'com_templates'),
'group' => 'MOD_QUICKICON_TEMPLATES'
'group' => 'MOD_QUICKICON_SITE'
];
}
}

// Include buttons defined by published quickicon plugins
PluginHelper::importPlugin('quickicon');

$arrays = (array) $application->triggerEvent(
'onGetIcons',
new QuickIconsEvent('onGetIcons', ['context' => $context])
);

foreach ($arrays as $response)
{
foreach ($response as $icon)
{
$default = array(
'amount' => null,
'link' => null,
'addwhat' => null,
'linkadd' => null,
'name' => null,
'image' => null,
'text' => null,
'access' => true,
'group' => 'MOD_QUICKICON_EXTENSIONS',
);
$icon = array_merge($default, $icon);

if (!is_null($icon['link']) && !is_null($icon['text']))
{
self::$buttons[$key][] = $icon;
}
}
}
}

return self::$buttons[$key];
}

/**
* Method to get the number of published modules in frontend.
*
Expand Down
Loading

0 comments on commit f82d66d

Please sign in to comment.