Author: sevein
Date: Sat Apr 28 22:00:42 2012
New Revision: 11548

Log:
Add closing tag, fix indentation, check if facets are set before using them

Modified:
   branches/2.0/apps/qubit/modules/search/templates/_searchResults.php

Modified: branches/2.0/apps/qubit/modules/search/templates/_searchResults.php
==============================================================================
--- branches/2.0/apps/qubit/modules/search/templates/_searchResults.php Sat Apr 
28 21:55:29 2012        (r11547)
+++ branches/2.0/apps/qubit/modules/search/templates/_searchResults.php Sat Apr 
28 22:00:42 2012        (r11548)
@@ -20,42 +20,44 @@
 
   <?php if (sfConfig::get('app_multi_repository')): ?>
 
-  <div class="row">
-
-    <div class="span12" id="top-facet">
-
-      <h2 class="visible-phone widebtn btn-huge" data-toggle="collapse" 
data-target="#institutions"><?php echo __('Institutions') ?></h2>
+    <div class="row">
 
-      <div class="section well clearfix" id="institutions">
+      <div class="span12" id="top-facet">
 
-        <div class="institution mini">
-          <h2 class="filltext active"><?php echo link_to(__('All 
Institutions'), array('repository_id' => null, 'page' => null) + 
$sf_request->getParameterHolder()->getAll()) ?></h2>
-        </div>
+        <h2 class="visible-phone widebtn btn-huge" data-toggle="collapse" 
data-target="#institutions"><?php echo __('Institutions') ?></h2>
 
-        <?php $numNav = 7; $i = 0; // NB: numNav could be hardcoded but might 
change ?>
-        <?php foreach ($pager->facets['repository_id']['terms'] as $id => 
$term): ?>
-          <?php $i++; ?>
+        <div class="section well clearfix" id="institutions">
 
           <div class="institution mini">
-            <h2 class="filltext"><?php echo link_to(__($term['term']), 
array('repository_id' => $id, 'page' => null) + 
$sf_request->getParameterHolder()->getAll()) ?></h2>
+            <h2 class="filltext active"><?php echo link_to(__('All 
Institutions'), array('repository_id' => null, 'page' => null) + 
$sf_request->getParameterHolder()->getAll()) ?></h2>
           </div>
 
-          <?php if ($i >= $numNav) break ?>
-        <?php endforeach; ?>
-
-      </div>
+          <?php $numNav = 7; $i = 0; // NB: numNav could be hardcoded but 
might change ?>
+          <?php foreach ($pager->facets['repository_id']['terms'] as $id => 
$term): ?>
+            <?php $i++; ?>
 
-      <div id="more-institutions" class="clearfix pull-right">
+            <div class="institution mini">
+              <h2 class="filltext"><?php echo link_to(__($term['term']), 
array('repository_id' => $id, 'page' => null) + 
$sf_request->getParameterHolder()->getAll()) ?></h2>
+            </div>
 
-        <select id="respository" data-placeholder="22 more institutions with 
results" class="chzn-select" style="width:400px;" tabindex="2">
-          <option value="" selected="selected"><?php echo __('%1% more 
institutions with results', array('%1%' => 
count($pager->facets['repository_id']['terms']) - $numNav)) ?></option>
-          <?php $i = 0; ?>
-          <?php foreach($pager->facets['repository_id']['terms'] as $id => 
$term): ?>
-            <?php $i++; ?>
-            <?php if ($i <= $numNav) continue; ?>
-            <option value="<?php echo $id; ?>"><?php echo __($term['term']) 
?></option>
+            <?php if ($i >= $numNav) break ?>
           <?php endforeach; ?>
-        </select>
+
+        </div>
+
+        <div id="more-institutions" class="clearfix pull-right">
+
+          <select id="respository" data-placeholder="22 more institutions with 
results" class="chzn-select" style="width:400px;" tabindex="2">
+            <option value="" selected="selected"><?php echo __('%1% more 
institutions with results', array('%1%' => 
count($pager->facets['repository_id']['terms']) - $numNav)) ?></option>
+            <?php $i = 0; ?>
+            <?php foreach($pager->facets['repository_id']['terms'] as $id => 
$term): ?>
+              <?php $i++; ?>
+              <?php if ($i <= $numNav) continue; ?>
+              <option value="<?php echo $id; ?>"><?php echo __($term['term']) 
?></option>
+            <?php endforeach; ?>
+          </select>
+
+        </div>
 
       </div>
 
@@ -182,15 +184,19 @@
 
       <div class="listings">
 
-        <?php $numResults = 0 ?>
-        <?php foreach ($pager->facets['digitalObject_mediaTypeId']['terms'] as 
$mediaType): ?>
-          <?php $numResults += $mediaType['count']; ?>
-        <?php endforeach; ?>
+        <?php if (isset($pager->facets['digitalObject_mediaTypeId'])): ?>
+
+          <?php $numResults = 0 ?>
+          <?php foreach ($pager->facets['digitalObject_mediaTypeId']['terms'] 
as $mediaType): ?>
+            <?php $numResults += $mediaType['count']; ?>
+          <?php endforeach; ?>
+
+          <?php if ($numResults > 0): ?>
+            <div class="result media">
+              <h3><a href="#"><?php echo __('%1% results with digital media', 
array('%1%' => $numResults)) ?><strong><?php echo __('Show all') 
?></strong></a></h3>
+            </div>
+          <?php endif; ?>
 
-        <?php if ($numResults > 0): ?>
-          <div class="result media">
-            <h3><a href="#"><?php echo __('%1% results with digital media', 
array('%1%' => $numResults)) ?><strong><?php echo __('Show all') 
?></strong></a></h3>
-          </div>
         <?php endif; ?>
 
         <?php foreach ($pager->getResults() as $hit): ?>

-- 
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