Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

Update resources.static.php to list all categories, not just those with elements #442

Merged
merged 2 commits into from
Nov 2, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions manager/actions/resources.static.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ function createResourceList($resourceTable,$action,$nameField = 'name') {
$rs = $modx->db->select(
"{$pluginsql} {$nameField} as name, {$v['table']}.id, description, locked, categories.category, categories.id as catid",
$modx->getFullTableName($v['table'])." AS {$v['table']}
LEFT JOIN ".$modx->getFullTableName('categories')." AS categories ON {$v['table']}.category = categories.id",
RIGHT JOIN ".$modx->getFullTableName('categories')." AS categories ON {$v['table']}.category = categories.id",
"",
"5,1"
);
Expand All @@ -218,7 +218,9 @@ function createResourceList($resourceTable,$action,$nameField = 'name') {
$name[$n] = $v['name'];
}

array_multisort($category, SORT_ASC, $name, SORT_ASC, $finalInfo);
$category_lowercase = array_map('strtolower', $category);
$name_lowercase = array_map('strtolower', $name);
array_multisort($category_lowercase, SORT_ASC, SORT_STRING, $name_lowercase, SORT_ASC, SORT_STRING, $finalInfo);

echo '<ul>';
$preCat = '';
Expand All @@ -234,9 +236,11 @@ function createResourceList($resourceTable,$action,$nameField = 'name') {
$insideUl = 1;
}
$class = array_key_exists('disabled',$v) && $v['disabled'] ? ' class="disabledPlugin"' : '';
if ($v['id']) {
?>
<li><span<?php echo $class;?>><a href="index.php?id=<?php echo $v['id']. '&amp;a='.$v['action'];?>"><?php echo $v['name']; ?></a></span><?php echo ' (' . $v['type'] . ')'; echo !empty($v['description']) ? ' - '.$v['description'] : '' ; ?><?php echo $v['locked'] ? ' <em>('.$_lang['locked'].')</em>' : "" ; ?></li>
<?php
}
$preCat = $v['category'];
}
echo $insideUl? '</ul>': '';
Expand Down