Author: david
Date: Fri Oct 14 15:30:36 2011
New Revision: 10109
Log:
Add no results page
Added:
trunk/apps/qubit/modules/informationobject/templates/fileListError.php
Modified:
trunk/apps/qubit/modules/informationobject/actions/fileListAction.class.php
Modified:
trunk/apps/qubit/modules/informationobject/actions/fileListAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/fileListAction.class.php
Fri Oct 14 14:53:20 2011 (r10108)
+++ trunk/apps/qubit/modules/informationobject/actions/fileListAction.class.php
Fri Oct 14 15:30:36 2011 (r10109)
@@ -81,6 +81,11 @@
if ($this->form->isValid())
{
$this->generateReport($request);
+
+ if (0 == count($this->results))
+ {
+ return sfView::ERROR;
+ }
}
}
@@ -116,39 +121,38 @@
$this->results = array();
$this->resultCount = 0;
- if (null !== ($results = QubitInformationObject::get($criteria)))
+ $informationObjects = QubitInformationObject::get($criteria);
+
+ foreach($informationObjects as $item)
{
- foreach($results as $item)
+ if ($lod->id == $item->levelOfDescriptionId)
{
- if ($lod->id == $item->levelOfDescriptionId)
- {
- $parentIsad = new sfIsadPlugin($item->parent);
- $isad = new sfIsadPlugin($item);
- $creationDates = self::getCreationDates($item);
-
- $this->results[$parentIsad->__toString()][] = array(
- 'resource' => $item,
- 'referenceCode' => $isad->referenceCode,
- 'title' => $item->getTitle(array('cultureFallback' => true)),
- 'dates' => (isset($creationDates)) ?
Qubit::renderDateStartEnd($creationDates->getDate(array('cultureFallback' =>
true)), $creationDates->startDate, $creationDates->endDate) : ' ',
- 'startDate' => (isset($creationDates)) ? $creationDates->startDate
: null,
- 'accessConditions' =>
$item->getAccessConditions(array('cultureFallback' => true)),
- 'locations' => self::getLocationString($item)
- );
+ $parentIsad = new sfIsadPlugin($item->parent);
+ $isad = new sfIsadPlugin($item);
+ $creationDates = self::getCreationDates($item);
- $this->resultCount++;
- }
- }
+ $this->results[$parentIsad->__toString()][] = array(
+ 'resource' => $item,
+ 'referenceCode' => $isad->referenceCode,
+ 'title' => $item->getTitle(array('cultureFallback' => true)),
+ 'dates' => (isset($creationDates)) ?
Qubit::renderDateStartEnd($creationDates->getDate(array('cultureFallback' =>
true)), $creationDates->startDate, $creationDates->endDate) : ' ',
+ 'startDate' => (isset($creationDates)) ? $creationDates->startDate :
null,
+ 'accessConditions' =>
$item->getAccessConditions(array('cultureFallback' => true)),
+ 'locations' => self::getLocationString($item)
+ );
- // Sort items by selected criteria
- $sortBy = $this->form->getValue('sortBy');
- foreach ($this->results as $key => &$items)
- {
- uasort($items, function($a, $b) use ($sortBy) {
- return strnatcasecmp($a[$sortBy], $b[$sortBy]);
- });
+ $this->resultCount++;
}
}
+
+ // Sort items by selected criteria
+ $sortBy = $this->form->getValue('sortBy');
+ foreach ($this->results as $key => &$items)
+ {
+ uasort($items, function($a, $b) use ($sortBy) {
+ return strnatcasecmp($a[$sortBy], $b[$sortBy]);
+ });
+ }
}
public static function getLocationString($resource)
Added: trunk/apps/qubit/modules/informationobject/templates/fileListError.php
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/apps/qubit/modules/informationobject/templates/fileListError.php
Fri Oct 14 15:30:36 2011 (r10109)
@@ -0,0 +1,10 @@
+<div class="content">
+ <h1><?php echo __('File list') ?></h1>
+
+ <h1 class="label"><?php echo __('No results') ?></h1>
+
+ <p><?php echo __('Oops, we couldn\'t find any file level descriptions.')
?></p>
+
+ <p><?php echo link_to(__('Back'), array($resource, 'module' =>
'informationobject', 'action' => 'reports')); ?></p>
+ </div>
+</div>
--
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.