Author: david
Date: 2008-09-17 11:08:02 -0700 (Wed, 17 Sep 2008)
New Revision: 1388
Modified:
trunk/apps/qubit/modules/digitalobject/actions/browseAction.class.php
trunk/apps/qubit/modules/digitalobject/actions/browseComponent.class.php
trunk/apps/qubit/modules/digitalobject/templates/_browse.php
trunk/apps/qubit/modules/digitalobject/templates/browseSuccess.php
Log:
Implement pagination for digitalobject/browse - showing 8 thumbnails per page
by default.
Modified: trunk/apps/qubit/modules/digitalobject/actions/browseAction.class.php
===================================================================
--- trunk/apps/qubit/modules/digitalobject/actions/browseAction.class.php
2008-09-17 18:06:46 UTC (rev 1387)
+++ trunk/apps/qubit/modules/digitalobject/actions/browseAction.class.php
2008-09-17 18:08:02 UTC (rev 1388)
@@ -24,5 +24,6 @@
public function execute($request)
{
$this->mediaType = QubitTerm::getById($request->getParameter('mediatype'));
+ $this->page = $request->getParameter('page', 1);
}
}
\ No newline at end of file
Modified:
trunk/apps/qubit/modules/digitalobject/actions/browseComponent.class.php
===================================================================
--- trunk/apps/qubit/modules/digitalobject/actions/browseComponent.class.php
2008-09-17 18:06:46 UTC (rev 1387)
+++ trunk/apps/qubit/modules/digitalobject/actions/browseComponent.class.php
2008-09-17 18:08:02 UTC (rev 1388)
@@ -37,16 +37,7 @@
}
else
{
- $criteria = new Criteria;
-
- if (isset($this->mediaType))
- {
- $criteria->add(QubitDigitalObject::MEDIA_TYPE_ID,
$this->mediaType->getId());
- }
- $criteria->add(QubitDigitalObject::INFORMATION_OBJECT_ID, null,
Criteria::ISNOTNULL);
- $criteria->addAscendingOrderByColumn(QubitDigitalObject::NAME);
-
- $this->digitalObjects = QubitDigitalObject::get($criteria);
+ $this->digitalObjects =
QubitDigitalObject::getIconList($this->mediaTypeId, $this->page);
}
if (count($this->digitalObjects) == 0)
Modified: trunk/apps/qubit/modules/digitalobject/templates/_browse.php
===================================================================
--- trunk/apps/qubit/modules/digitalobject/templates/_browse.php
2008-09-17 18:06:46 UTC (rev 1387)
+++ trunk/apps/qubit/modules/digitalobject/templates/_browse.php
2008-09-17 18:08:02 UTC (rev 1388)
@@ -1,6 +1,9 @@
+<?php echo __('Found %1% objects',
array('%1%'=>$digitalObjects->getNbResults())) ?><br />
+<?php echo __('Displaying results %1% to %2%',
+ array('%1%' => $digitalObjects->getFirstIndice(), '%2%' =>
$digitalObjects->getLastIndice())) ?>
<table class="digitalObjectBrowse">
<tr>
-<?php foreach ($digitalObjects as $i => $digitalObject): ?>
+<?php foreach ($digitalObjects->getResults() as $i => $digitalObject): ?>
<?php $informationObject = $digitalObject->getInformationObject(); ?>
<?php $collectionRoot = $informationObject->getCollectionRoot(); ?>
<td class="digitalObjectBrowse"><div class="digitalObject">
@@ -13,7 +16,7 @@
)); ?>
</div>
<div class="digitalObjectDesc">
- <?php echo string_wrap($informationObject->getTitle(), 16, 3); ?><br />
+ <?php echo
string_wrap($informationObject->getTitle(array('cultureFallback'=>true)), 16,
3); ?><br />
<b><?php echo __('Part of') ?>:</b>
<?php echo link_to($collectionRoot->getTitle(array('cultureFallback'
=> true)), 'informationobject/show?id='.$collectionRoot->getId()); ?>
</div>
@@ -24,4 +27,22 @@
<?php endif; ?>
<?php endforeach; ?>
</tr>
-</table>
\ No newline at end of file
+</table>
+<?php if ($digitalObjects->haveToPaginate()): ?>
+<p><div class="pager" style="text-align: center; font-size: 12px">
+ Pages:<br />
+ <?php $links = $digitalObjects->getLinks(); ?>
+ <?php if ($digitalObjects->getFirstPage() <
$digitalObjects->getfirstPageLink()): ?>
+ <?php echo link_to($digitalObjects->getFirstPage(),
'digitalobject/browse?mediatype='.$mediaTypeId.'&page='.$digitalObjects->getFirstPage())
?>
+ ...
+ <?php endif; ?>
+ <?php foreach ($links as $page): ?>
+ <?php echo ($page == $digitalObjects->getPage()) ? $page : link_to($page,
'digitalobject/browse?mediatype='.$mediaTypeId.'&page='.$page) ?>
+ <?php if ($page != $digitalObjects->getCurrentMaxLink()): ?> <?php endif ?>
+ <?php endforeach ?>
+ <?php if ($digitalObjects->getLastPage() >
$digitalObjects->getLastPageLink()): ?>
+ ...
+ <?php echo link_to($digitalObjects->getLastPage(),
'digitalobject/browse?mediatype='.$mediaTypeId.'&page='.$digitalObjects->getLastPage())
?>
+ <?php endif; ?>
+</div></p>
+<?php endif ?><br />
\ No newline at end of file
Modified: trunk/apps/qubit/modules/digitalobject/templates/browseSuccess.php
===================================================================
--- trunk/apps/qubit/modules/digitalobject/templates/browseSuccess.php
2008-09-17 18:06:46 UTC (rev 1387)
+++ trunk/apps/qubit/modules/digitalobject/templates/browseSuccess.php
2008-09-17 18:08:02 UTC (rev 1388)
@@ -2,4 +2,4 @@
<?php echo __('browse %1%s', array('%1%' =>
sfConfig::get('app_ui_label_digitalobject'))) ?>
- <?php echo $mediaType->getName(); ?>
</div>
-<?php include_component('digitalobject', 'browse',
array('mediaType'=>$mediaType)); ?>
\ No newline at end of file
+<?php include_component('digitalobject', 'browse',
array('mediaTypeId'=>$mediaType->getId(), 'page'=>$page)); ?>
\ No newline at end of file
--~--~---------~--~----~------------~-------~--~----~
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.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---