Author: sevein
Date: Thu May  3 16:21:28 2012
New Revision: 11619

Log:
Cosmetic changes

Modified:
   branches/2.0/apps/qubit/modules/repository/actions/browseAction.class.php

Modified: 
branches/2.0/apps/qubit/modules/repository/actions/browseAction.class.php
==============================================================================
--- branches/2.0/apps/qubit/modules/repository/actions/browseAction.class.php   
Thu May  3 16:20:13 2012        (r11618)
+++ branches/2.0/apps/qubit/modules/repository/actions/browseAction.class.php   
Thu May  3 16:21:28 2012        (r11619)
@@ -26,6 +26,12 @@
 
 class RepositoryBrowseAction extends sfAction
 {
+  // Arrays not allowed in class constants
+  public static
+    $FACETS = array(
+      'types',
+      'contact.i18n.region');
+
   public function execute($request)
   {
     if (!isset($request->limit))
@@ -39,7 +45,7 @@
     $this->filters = array();
     foreach ($this->request->getGetParameters() as $param => $value)
     {
-      if (in_array(strtr($param, '_', '.'), array('types', 
'contact.i18n.region')))
+      if (in_array(strtr($param, '_', '.'), self::$FACETS))
       {
         foreach (explode(',', $value) as $facetValue)
         {
@@ -65,7 +71,7 @@
       $query->setFrom(($request->page - 1) * $request->limit);
     }
 
-    foreach (array('types', 'contact.i18n.region') as $item)
+    foreach (self::$FACETS as $item)
     {
       $facet = new Elastica_Facet_Terms($item);
       $facet->setField($item);
@@ -95,9 +101,9 @@
         if (isset($facet['terms']))
         {
           $ids = array();
-          foreach ($facet['terms'] as $term)
+          foreach ($facet['terms'] as $item)
           {
-            $ids[$term['term']] = $term['count'];
+            $ids[$item['term']] = $item['count'];
           }
         }
 
@@ -113,20 +119,21 @@
               $typeNames[$item->id] = $item->name;
             }
 
-            foreach ($facet['terms'] as $term)
+            foreach ($facet['terms'] as $item)
             {
-              $facets[strtr($name, '.', '_')]['terms'][$term['term']] = array(
-                'count' => $term['count'],
-                'term' => $typeNames[$term['term']]);        }
+              $facets[strtr($name, '.', '_')]['terms'][$item['term']] = array(
+                'count' => $item['count'],
+                'term' => $typeNames[$item['term']]);
+            }
 
             break;
 
           case 'contact.i18n.region':
-            foreach ($facet['terms'] as $term)
+            foreach ($facet['terms'] as $item)
             {
-              $facets[strtr($name, '.', '_')]['terms'][$term['term']] = array(
-                'count' => $term['count'],
-                'term' => $term['term']);
+              $facets[strtr($name, '.', '_')]['terms'][$item['term']] = array(
+                'count' => $item['count'],
+                'term' => $item['term']);
             }
 
             break;

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to