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

Commit

Permalink
Merge pull request #442 from bossloper/patch-9
Browse files Browse the repository at this point in the history
Update resources.static.php to list all categories, not just those with elements
  • Loading branch information
Dmi3yy committed Nov 2, 2015
2 parents e1a7675 + 69367dd commit 847047f
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit 847047f

Please sign in to comment.