aboutsummaryrefslogtreecommitdiff
path: root/views/default/admin/plugins/advanced.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-06-09 17:50:25 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-06-09 17:50:25 +0000
commita7274e5b6ade1a47e2bda837ddf01b5a2087c198 (patch)
treed9502350979caf95cbc19767113f519b71d8d384 /views/default/admin/plugins/advanced.php
parent23f9b08e966cb37034993f705f58ab611abca044 (diff)
downloadelgg-a7274e5b6ade1a47e2bda837ddf01b5a2087c198.tar.gz
elgg-a7274e5b6ade1a47e2bda837ddf01b5a2087c198.tar.bz2
Refs #2871 filter plugins by active/inactive state
git-svn-id: http://code.elgg.org/elgg/trunk@9152 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/admin/plugins/advanced.php')
-rw-r--r--views/default/admin/plugins/advanced.php35
1 files changed, 30 insertions, 5 deletions
diff --git a/views/default/admin/plugins/advanced.php b/views/default/admin/plugins/advanced.php
index 4cefa0b3e..dad1b778d 100644
--- a/views/default/admin/plugins/advanced.php
+++ b/views/default/admin/plugins/advanced.php
@@ -10,7 +10,7 @@
elgg_generate_plugin_entities();
$installed_plugins = elgg_get_plugins('any');
-$show_category = get_input('category', null);
+$show_category = get_input('category', 'all');
// Get a list of the all categories
// and trim down the plugin list if we're not viewing all categories.
@@ -26,9 +26,28 @@ foreach ($installed_plugins as $id => $plugin) {
// handle plugins that don't declare categories
// unset them here because this is the list we foreach
- if ($show_category && !in_array($show_category, $plugin_categories)) {
- unset($installed_plugins[$id]);
+ switch ($show_category) {
+ case 'all':
+ break;
+ case 'active':
+ if (!$plugin->isActive()) {
+ unset($installed_plugins[$id]);
+ }
+ break;
+ case 'inactive':
+ if ($plugin->isActive()) {
+ unset($installed_plugins[$id]);
+ }
+ break;
+ default:
+ if (!in_array($show_category, $plugin_categories)) {
+ unset($installed_plugins[$id]);
+ }
+ break;
}
+ //if ($show_category && !in_array($show_category, $plugin_categories)) {
+ // unset($installed_plugins[$id]);
+ //}
if (isset($plugin_categories)) {
foreach ($plugin_categories as $category) {
@@ -41,7 +60,13 @@ foreach ($installed_plugins as $id => $plugin) {
asort($categories);
-$categories = array_merge(array('' => elgg_echo('admin:plugins:category:all')), $categories);
+$common_categories = array(
+ 'all' => elgg_echo('admin:plugins:category:all'),
+ 'active' => elgg_echo('admin:plugins:category:active'),
+ 'inactive' => elgg_echo('admin:plugins:category:inactive'),
+);
+
+$categories = array_merge($common_categories, $categories);
$category_dropdown = elgg_view('input/dropdown', array(
'name' => 'category',
@@ -62,7 +87,7 @@ $category_form = elgg_view('input/form', array(
));
// @todo Until "en/deactivate all" means "All plugins on this page" hide when not looking at all.
-if (!isset($show_category) || empty($show_category)) {
+if ($show_category == 'all') {
$activate_url = "action/admin/plugins/activate_all";
$activate_url = elgg_add_action_tokens_to_url($activate_url);
$deactivate_url = "action/admin/plugins/deactivate_all";