Author: david
Date: Mon Oct 24 17:15:29 2011
New Revision: 10180
Log:
Print list of search terms
Added:
trunk/apps/qubit/modules/search/templates/_printAdvancedSearchTerms.php
Modified:
trunk/apps/qubit/modules/search/actions/advancedAction.class.php
trunk/apps/qubit/modules/search/templates/_advancedSearch.php
trunk/apps/qubit/modules/search/templates/_searchFields.php
trunk/apps/qubit/modules/search/templates/advancedSuccess.php
Modified: trunk/apps/qubit/modules/search/actions/advancedAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/search/actions/advancedAction.class.php Mon Oct
24 15:43:10 2011 (r10179)
+++ trunk/apps/qubit/modules/search/actions/advancedAction.class.php Mon Oct
24 17:15:29 2011 (r10180)
@@ -47,6 +47,8 @@
if ($this->form->isValid())
{
if (isset($request->searchFields)) {
+ $this->queryTerms = array();
+
// we are handling a search request
parent::execute($request);
}
@@ -139,12 +141,25 @@
$term = strtolower($searchField['query']);
}
+ $matchString = $term;
+
// limit to specified field
if (!empty($searchField['field']))
{
$term = $searchField['field'] . ':' . $term;
}
+ if (!empty($searchField['field']))
+ {
+ $field = $searchField['field'];
+ }
+ else
+ {
+ $field = ('phrase' == $searchField['match']) ?
$this->getContext()->i18n->__('Phrase') :
$this->getContext()->i18n->__('Keyword(s)');
+ }
+
+ $this->queryTerms[] = array('term' => $field.': '.$matchString,
'operator' => $searchField['operator']);
+
// select which boolean operator to use
if (!isset($searchField['operator'])) $searchField['operator'] = null;
switch ($searchField['operator'])
@@ -178,21 +193,25 @@
if (!empty($this->request->repository))
{
$query->addSubquery(QubitSearch::getInstance()->addTerm($this->request->repository,
'repositoryId'), true);
+ $this->queryTerms[] = array('term' =>
$this->getContext()->i18n->__('Repository').':
'.QubitRepository::getById($this->request->repository)->__toString(),
'operator' => 'and');
}
// digital object filters
if ('true' == $this->request->hasDigitalObject)
{
$query->addSubquery(QubitSearch::getInstance()->addTerm('true',
'hasDigitalObject'), true);
+ $this->queryTerms[] = array('term' =>
$this->getContext()->i18n->__('Digital object is available'), 'operator' =>
'and');
}
else if ('false' == $this->request->hasDigitalObject)
{
$query->addSubquery(QubitSearch::getInstance()->addTerm('false',
'hasDigitalObject'), true);
+ $this->queryTerms[] = array('term' => $this->getContext()->i18n->__('No
digital object is available'), 'operator' => 'and');
}
if (!empty($this->request->mediatype))
{
$query->addSubquery(QubitSearch::getInstance()->addTerm($this->request->mediatype,
'do_mediaTypeId'), true);
+ $this->queryTerms[] = array('term' => 'mediatype:
'.QubitTerm::getById($this->request->mediatyp)->__toString(), 'operator' =>
'and');
}
$query = parent::filterQuery($query);
Modified: trunk/apps/qubit/modules/search/templates/_advancedSearch.php
==============================================================================
--- trunk/apps/qubit/modules/search/templates/_advancedSearch.php Mon Oct
24 15:43:10 2011 (r10179)
+++ trunk/apps/qubit/modules/search/templates/_advancedSearch.php Mon Oct
24 17:15:29 2011 (r10180)
@@ -23,3 +23,14 @@
->renderRow() ?>
</fieldset>
+
+<div class="actions">
+
+ <h2 class="element-invisible"><?php echo __('Actions') ?></h2>
+ <div class="content">
+ <ul class="clearfix links">
+ <input type="submit" name="Submit" class="form-submit" value="Search" />
+ </ul>
+ </div>
+
+</div>
Added: trunk/apps/qubit/modules/search/templates/_printAdvancedSearchTerms.php
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/apps/qubit/modules/search/templates/_printAdvancedSearchTerms.php
Mon Oct 24 17:15:29 2011 (r10180)
@@ -0,0 +1,9 @@
+<h2><?php echo __('Search for') ?></h2>
+<ul>
+<?php $i = 0; foreach ($queryTerms as $item): ?>
+ <li>
+ <?php echo (0 < $i++) ?
'<strong>'.strtoupper($item['operator'])."</strong>\n" : '' ?>
+ <?php echo $item['term'] ?>
+ </li>
+<?php endforeach; ?>
+</ul>
Modified: trunk/apps/qubit/modules/search/templates/_searchFields.php
==============================================================================
--- trunk/apps/qubit/modules/search/templates/_searchFields.php Mon Oct 24
15:43:10 2011 (r10179)
+++ trunk/apps/qubit/modules/search/templates/_searchFields.php Mon Oct 24
17:15:29 2011 (r10180)
@@ -1,5 +1,3 @@
-<?php use_helper('Text') ?>
-
<?php if (isset($sf_request->searchFields)): ?>
<?php foreach ($sf_request->searchFields as $key => $item): ?>
Modified: trunk/apps/qubit/modules/search/templates/advancedSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/search/templates/advancedSuccess.php Mon Oct
24 15:43:10 2011 (r10179)
+++ trunk/apps/qubit/modules/search/templates/advancedSuccess.php Mon Oct
24 17:15:29 2011 (r10180)
@@ -1,3 +1,5 @@
+<?php use_helper('Text') ?>
+
<?php if ('print' == $sf_request->getParameter('media')): ?>
<div id="preview-message">
<?php echo __('Print preview') ?>
@@ -18,18 +20,11 @@
<?php echo $form->renderFormTag(url_for(array('module' => 'search', 'action'
=> 'advanced')), array('method' => 'get')) ?>
- <?php echo get_partial('search/advancedSearch', array('form' => $form)) ?>
-
- <div class="actions">
-
- <h2 class="element-invisible"><?php echo __('Actions') ?></h2>
- <div class="content">
- <ul class="clearfix links">
- <input type="submit" name="Submit" class="form-submit" value="Search"
/>
- </ul>
- </div>
-
- </div>
+ <?php if ('print' != $sf_request->getParameter('media')): ?>
+ <?php echo get_partial('search/advancedSearch', array('form' => $form)) ?>
+ <?php else: ?>
+ <?php echo get_partial('printAdvancedSearchTerms', array('queryTerms' =>
$queryTerms)) ?>
+ <?php endif; ?>
<?php if (isset($error)): ?>
--
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.