Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/site/app/controllers/components/amo.php
diff options
context:
space:
mode:
Diffstat (limited to 'site/app/controllers/components/amo.php')
-rw-r--r--site/app/controllers/components/amo.php90
1 files changed, 54 insertions, 36 deletions
diff --git a/site/app/controllers/components/amo.php b/site/app/controllers/components/amo.php
index 92ac9ac..a4c59b7 100644
--- a/site/app/controllers/components/amo.php
+++ b/site/app/controllers/components/amo.php
@@ -340,7 +340,6 @@ class AmoComponent extends Object {
$applicationModel->unbindModel(array('hasAndBelongsToMany' => array('Version'), 'hasMany' => array('Tag')));
$applications = $applicationModel->findAll('Application.supported=1', null, null, null, null, 2);
$appvids = array();
- $versions = array();
foreach ($applications as $application) {
if (!empty($application['Appversion'])) {
$appversions = array();
@@ -668,44 +667,66 @@ class AmoComponent extends Object {
* )
*/
function getNavCategories() {
- global $hybrid_categories, $app_listedtypes, $valid_status;
+ global $hybrid_categories, $app_listedtypes;
if (!empty($this->navCategories)) return $this->navCategories;
+ if(APP_ID == APP_SUGAR) {
+ $catlist = array();
+ } else
// addon type list to be added to regular categories list
- // get "Themes" category name
- if (!isset($this->controller->Addontype)) {
- loadModel('Addontype');
- $this->controller->Addontype = new Addontype();
- }
+ // @partial translation fallback, 4/23/08
+ if (_('nav_category_dicts_langpacks') != 'nav_category_dicts_langpacks') {
+ $catlist = array(
+ array('name' => _('nav_category_dicts_langpacks'),
+ 'type' => ADDON_DICT,
+ 'cat' => 0,
+ 'weight' => 0),
+ array('name' => _('nav_category_themes'),
+ 'type' => ADDON_THEME,
+ 'cat' => 0,
+ 'weight' => 0)
+ );
+ } else {
+ // get "Themes" category name
+ if (!isset($this->controller->Addontype)) {
+ loadModel('Addontype');
+ $this->controller->Addontype = new Addontype();
+ }
- $names = $this->controller->Addontype->getNames();
- $_themes_name = $names[ADDON_THEME];
-
- $catlist = array(
- array('name' => ___('langtools_header_dicts_and_langpacks'),
- 'type' => ADDON_DICT,
- 'cat' => 0,
- 'weight' => 0),
- array('name' => $_themes_name,
- 'type' => ADDON_THEME,
- 'cat' => 0,
- 'weight' => 0)
- );
+ $_themes_name = $this->controller->Addontype->getName(ADDON_THEME);
+
+ $catlist = array(
+ array('name' => _('langtools_header_dicts_and_langpacks'),
+ 'type' => ADDON_DICT,
+ 'cat' => 0,
+ 'weight' => 0),
+ array('name' => $_themes_name,
+ 'type' => ADDON_THEME,
+ 'cat' => 0,
+ 'weight' => 0)
+ );
+ }
// add plugins where appropriate
+ // @partial translation fallback, 4/27/08
if (in_array(ADDON_PLUGIN, $app_listedtypes[APP_ID])) {
- $catlist[] = array(
- 'name' => ___('addons_plugins_pagetitle'),
- 'type' => ADDON_PLUGIN,
- 'cat' => 0,
- 'weight' => 0,
- 'count' => COUNT_ADDON_PLUGIN,
- );
+ if (_('nav_category_plugins') != 'nav_category_plugins') {
+ $catlist[] = array(
+ 'name' => _('nav_category_plugins'),
+ 'type' => ADDON_PLUGIN,
+ 'cat' => 0,
+ 'weight' => 0
+ );
+ } else {
+ $catlist[] = array(
+ 'name' => _('addons_plugins_pagetitle'),
+ 'type' => ADDON_PLUGIN,
+ 'cat' => 0,
+ 'weight' => 0
+ );
+ }
}
-
- // we are sugar
- $catlist = array();
// create two sort arrays that we can use with array_multisort later
$_weights = array();
@@ -716,7 +737,7 @@ class AmoComponent extends Object {
}
// add regular categories to list
- $tags = $this->getTags();
+ $tags = $this->getTags(APP_ID, $app_listedtypes[APP_SUGAR]);
foreach ($tags as $_tag) {
/* support hybrid categories */
if (isset($hybrid_categories[APP_ID][$_tag['Tag']['id']])) {
@@ -729,26 +750,23 @@ class AmoComponent extends Object {
$_name = $_tag['Translation']['name']['string'];
$_weight = $_tag['Tag']['weight'];
- $_count = $_tag['Tag']['count'];
// add item to results array
$catlist[] = array(
'name' => $_name,
'type' => $_type,
'cat' => $_cat,
- 'weight' => $_weight,
- 'count' => $_count
+ 'weight' => $_weight
);
// add item to sort arrays too
$_names[] = strtolower($_name);
$_weights[] = $_weight;
}
-
+
// sort results array by weight and name, then return.
array_multisort($_weights, SORT_ASC, SORT_NUMERIC,
$_names, SORT_ASC, SORT_STRING, $catlist);
- // TODO: Use memcache here?
$this->navCategories = $catlist; // cache result for subsequent calls
return $catlist;
}