Author: sevein
Date: Thu Oct 13 13:44:25 2011
New Revision: 10076

Log:
Show search filters from last request

Modified:
   trunk/apps/qubit/modules/search/templates/_searchFields.php

Modified: trunk/apps/qubit/modules/search/templates/_searchFields.php
==============================================================================
--- trunk/apps/qubit/modules/search/templates/_searchFields.php Thu Oct 13 
13:05:23 2011        (r10075)
+++ trunk/apps/qubit/modules/search/templates/_searchFields.php Thu Oct 13 
13:44:25 2011        (r10076)
@@ -1,14 +1,55 @@
+<?php if (isset($sf_request->searchFields)): ?>
+
+  <?php foreach ($sf_request->searchFields as $key => $item): ?>
+    <?php if (0 == strlen($item['query'])) continue ?>
+    <?php @$count++ ?>
+    <tr>
+      <td>
+        <select name="searchFields[<?php echo $key ?>][operator]">
+          <option value="and"<?php echo $item['operator'] == 'and' ? ' 
selected="selected"' : '' ?>>and</option>
+          <option value="or"<?php echo $item['operator'] == 'or' ? ' 
selected="selected"' : '' ?>>or</option>
+          <option value="not"<?php echo $item['operator'] == 'not' ? ' 
selected="selected"' : '' ?>>not</option>
+        </select>
+      </td><td>
+        <input type="text" name="searchFields[<?php echo $key ?>][query]" 
value="<?php echo $item['query'] ?>"/>
+      </td><td>in&nbsp;
+        <select style="width: 90%;" name="searchFields[<?php echo $key 
?>][field]">
+          <option value=""<?php echo $item['field'] == '' ? ' 
selected="selected"' : '' ?>><?php echo __('Any field') ?></option>
+          <option value="title"<?php echo $item['field'] == 'title' ? ' 
selected="selected"' : '' ?>><?php echo __('Title') ?></option>
+          <option value="archivalhistory"<?php echo $item['field'] == 
'archivalhistory' ? ' selected="selected"' : '' ?>><?php echo __('Archival 
history') ?></option>
+          <option value="scopeAndContent"<?php echo $item['field'] == 
'scopeAndContent' ? ' selected="selected"' : '' ?>><?php echo __('Scope and 
content') ?></option>
+          <option value="extentandmedium"<?php echo $item['field'] == 
'extentandmedium' ? ' selected="selected"' : '' ?>><?php echo __('Extent and 
medium') ?></option>
+          <option value="subject"<?php echo $item['field'] == 'subject' ? ' 
selected="selected"' : '' ?>><?php echo __('Subject access points') ?></option>
+          <option value="name"<?php echo $item['field'] == 'name' ? ' 
selected="selected"' : '' ?>><?php echo __('Name access points') ?></option>
+          <option value="place"<?php echo $item['field'] == 'place' ? ' 
selected="selected"' : '' ?>><?php echo __('Place access points') ?></option>
+          <option value="identifier"<?php echo $item['field'] == 'identifier' 
? ' selected="selected"' : '' ?>><?php echo __('Identifier') ?></option>
+        </select>
+      </td><td>using&nbsp;
+        <select name="searchFields[<?php echo $key ?>][match]" style="width: 
100px;">
+          <option value="keyword"<?php echo $item['match'] == 'keyword' ? ' 
selected="selected"' : '' ?>>keyword</option>
+          <option value="phrase"<?php echo $item['match'] == 'phrase' ? ' 
selected="selected"' : '' ?>>phrase</option>
+        </select>
+      </td>
+    </tr>
+  <?php endforeach; ?>
+
+<?php else: ?>
+
+  <?php $count = 0 ?>
+
+<?php endif; ?>
+
 <tr>
   <td>
-    <select name="searchFields[0][operator]">
+    <select name="searchFields[<?php echo $count ?>][operator]">
       <option value="and">and</option>
       <option value="or">or</option>
       <option value="not">not</option>
     </select>
   </td><td>
-    <input type="text" name="searchFields[0][query]"/>
+    <input type="text" name="searchFields[<?php echo $count ?>][query]"/>
   </td><td>in&nbsp;
-    <select style="width: 90%;" name="searchFields[0][field]">
+    <select style="width: 90%;" name="searchFields[<?php echo $count 
?>][field]">
       <option value=""><?php echo __('Any field') ?></option>
       <option value="title"><?php echo __('Title') ?></option>
       <option value="archivalhistory"><?php echo __('Archival history') 
?></option>
@@ -20,7 +61,7 @@
       <option value="identifier"><?php echo __('Identifier') ?></option>
     </select>
   </td><td>using&nbsp;
-    <select name="searchFields[0][match]" style="width: 100px;">
+    <select name="searchFields[<?php echo $count ?>][match]" style="width: 
100px;">
       <option value="keyword">keyword</option>
       <option value="phrase">phrase</option>
     </select>

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