Author: jablko
Date: Mon Oct 25 14:02:15 2010
New Revision: 8482

Log:
Use $route->resource

Modified:
   trunk/apps/qubit/modules/search/templates/indexSuccess.php
   trunk/apps/qubit/modules/term/actions/browseTermAction.class.php
   trunk/apps/qubit/modules/term/templates/browseTermSuccess.php
   trunk/apps/qubit/modules/term/templates/deleteSuccess.php

Modified: trunk/apps/qubit/modules/search/templates/indexSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/search/templates/indexSuccess.php  Mon Oct 25 
13:54:21 2010        (r8481)
+++ trunk/apps/qubit/modules/search/templates/indexSuccess.php  Mon Oct 25 
14:02:15 2010        (r8482)
@@ -15,51 +15,54 @@
 <?php else: ?>
 
   <div class="section">
-    <?php foreach ($informationObjects as $informationObject): ?>
+    <?php foreach ($informationObjects as $item): ?>
       <div class="clearfix search-results <?php echo 0 == ++$row % 2 ? 'even' 
: 'odd' ?>">
 
-        <?php if (isset($informationObject->digitalObjects[0])): ?>
-          <?php if 
(!isset($informationObject->digitalObjects[0]->mediaTypeId)): ?>
-            <?php echo 
link_to(image_tag(QubitDigitalObject::getGenericRepresentation($informationObject->digitalObjects[0]->mediaTypeId,
 QubitTerm::THUMBNAIL_ID)->getFullPath(), array('alt' => 
render_title($informationObject))), array($informationObject, 'module' => 
'informationobject')) ?>
-          <?php elseif (QubitTerm::AUDIO_ID == 
$informationObject->digitalObjects[0]->mediaTypeId): ?>
-            <?php echo link_to(image_tag("play.png", array('alt' => 
render_title($informationObject))), array($informationObject, 'module' => 
'informationobject')) ?>
-          <?php elseif (null !== 
$informationObject->digitalObjects[0]->thumbnail): ?>
-            <?php echo 
link_to(image_tag(public_path($informationObject->digitalObjects[0]->thumbnail->getFullPath()),
 array('alt' => render_title($informationObject))), array($informationObject, 
'module' => 'informationobject')) ?>
+        <?php if (isset($item->digitalObjects[0])): ?>
+          <?php if (!isset($item->digitalObjects[0]->mediaTypeId)): ?>
+            <?php echo 
link_to(image_tag(QubitDigitalObject::getGenericRepresentation($item->digitalObjects[0]->mediaTypeId,
 QubitTerm::THUMBNAIL_ID)->getFullPath(), array('alt' => render_title($item))), 
array($item, 'module' => 'informationobject')) ?>
+          <?php elseif (QubitTerm::AUDIO_ID == 
$item->digitalObjects[0]->mediaTypeId): ?>
+            <?php echo link_to(image_tag("play.png", array('alt' => 
render_title($item))), array($item, 'module' => 'informationobject')) ?>
+          <?php elseif (null !== $item->digitalObjects[0]->thumbnail): ?>
+            <?php echo 
link_to(image_tag(public_path($item->digitalObjects[0]->thumbnail->getFullPath()),
 array('alt' => render_title($item))), array($item, 'module' => 
'informationobject')) ?>
           <?php endif;?>
         <?php endif; ?>
 
-        <h2><?php echo link_to(render_title($informationObject), 
array($informationObject, 'module' => 'informationobject')) ?><?php if 
(QubitTerm::PUBLICATION_STATUS_DRAFT_ID == 
$informationObject->getPublicationStatus()->status->id): ?> <span 
class="publicationStatus"><?php echo 
$informationObject->getPublicationStatus()->status ?></span><?php endif; ?></h2>
+        <h2><?php echo link_to(render_title($item), array($item, 'module' => 
'informationobject')) ?><?php if (QubitTerm::PUBLICATION_STATUS_DRAFT_ID == 
$item->getPublicationStatus()->status->id): ?> <span 
class="publicationStatus"><?php echo $item->getPublicationStatus()->status 
?></span><?php endif; ?></h2>
 
         <div>
-          <?php echo 
highlight_text(truncate_text($informationObject->scopeAndContent, 256), 
$sf_request->query) ?>
+          <?php echo highlight_text(truncate_text($item->scopeAndContent, 
256), $sf_request->query) ?>
         </div>
 
-        <?php $isad = new sfIsadPlugin($informationObject); echo 
render_show(__('Reference code'), render_value($isad->referenceCode)) ?>
+        <?php $isad = new sfIsadPlugin($item); echo render_show(__('Reference 
code'), render_value($isad->referenceCode)) ?>
 
         <div class="field">
           <h3><?php echo __('Date(s)') ?></h3>
           <div>
             <ul>
-              <?php foreach ($informationObject->getDates() as $date): ?>
+              <?php foreach ($item->getDates() as $date): ?>
                 <li>
+
                   <?php echo 
Qubit::renderDateStartEnd($date->getDateDisplay(array('cultureFallback' => 
true)), $date->startDate, $date->endDate) ?> (<?php echo 
$date->getType(array('cultureFallback' => true)) ?>)
+
                   <?php if (isset($date->actor)): ?>
                     <?php echo link_to(render_title($date->actor), 
array($date->actor, 'module' => 'actor')) ?>
                   <?php endif; ?>
+
                 </li>
               <?php endforeach; ?>
             </ul>
           </div>
         </div>
 
-        <?php echo render_show(__('Level of description'), 
render_value($informationObject->levelOfDescription)) ?>
+        <?php echo render_show(__('Level of description'), 
render_value($item->levelOfDescription)) ?>
 
-        <?php if (sfConfig::get('app_multi_repository') && 
isset($informationObject->repository)): ?>
-          <?php echo render_show(__('Repository'), 
link_to(render_title($informationObject->repository), 
array($informationObject->repository, 'module' => 'repository'))) ?>
+        <?php if (sfConfig::get('app_multi_repository') && 
isset($item->repository)): ?>
+          <?php echo render_show(__('Repository'), 
link_to(render_title($item->repository), array($item->repository, 'module' => 
'repository'))) ?>
         <?php endif; ?>
 
-        <?php if ($informationObject->getCollectionRoot() !== 
$informationObject): ?>
-          <?php echo render_show(__('Part of'), 
link_to(render_title($informationObject->getCollectionRoot()), 
array($informationObject->getCollectionRoot(), 'module' => 
'informationobject'))) ?>
+        <?php if ($item->getCollectionRoot() !== $item): ?>
+          <?php echo render_show(__('Part of'), 
link_to(render_title($item->getCollectionRoot()), 
array($item->getCollectionRoot(), 'module' => 'informationobject'))) ?>
         <?php endif; ?>
 
       </div>

Modified: trunk/apps/qubit/modules/term/actions/browseTermAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/term/actions/browseTermAction.class.php    Mon Oct 
25 13:54:21 2010        (r8481)
+++ trunk/apps/qubit/modules/term/actions/browseTermAction.class.php    Mon Oct 
25 14:02:15 2010        (r8482)
@@ -26,17 +26,11 @@
       $request->limit = sfConfig::get('app_hits_per_page');
     }
 
-    $this->resource = QubitTerm::getById($request->id);
-
-    if (!isset($this->resource))
-    {
-      $this->forward404();
-    }
+    $this->resource = $this->getRoute()->resource;
 
     $criteria = new Criteria;
     $criteria->add(QubitObjectTermRelation::TERM_ID, $this->resource->id);
     $criteria->addJoin(QubitObjectTermRelation::OBJECT_ID, 
QubitInformationObject::ID);
-    $criteria->addJoin(QubitInformationObject::ID, QubitObject::ID);
 
     $criteria = QubitAcl::addFilterDraftsCriteria($criteria);
 

Modified: trunk/apps/qubit/modules/term/templates/browseTermSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/term/templates/browseTermSuccess.php       Mon Oct 
25 13:54:21 2010        (r8481)
+++ trunk/apps/qubit/modules/term/templates/browseTermSuccess.php       Mon Oct 
25 14:02:15 2010        (r8482)
@@ -3,45 +3,48 @@
 <h1><?php echo render_title($resource->taxonomy) ?> - <?php echo 
render_title($resource) ?></h1>
 
 <div class="section">
-  <?php foreach ($informationObjects as $informationObject): ?>
+  <?php foreach ($informationObjects as $item): ?>
     <div class="clearfix <?php echo 0 == ++$row % 2 ? 'even' : 'odd' ?>">
 
-      <?php if (isset($informationObject->digitalObjects[0])): ?>
-        <?php echo 
link_to(image_tag(public_path($informationObject->digitalObjects[0]->thumbnail->getFullPath()),
 array('alt' => render_title($informationObject))), array($informationObject, 
'module' => 'informationobject')) ?>
+      <?php if (isset($item->digitalObjects[0])): ?>
+        <?php echo 
link_to(image_tag(public_path($item->digitalObjects[0]->thumbnail->getFullPath()),
 array('alt' => render_title($item))), array($item, 'module' => 
'informationobject')) ?>
       <?php endif; ?>
 
-      <h2><?php echo link_to(render_title($informationObject), 
array($informationObject, 'module' => 'informationobject')) ?><?php if 
(QubitTerm::PUBLICATION_STATUS_DRAFT_ID == 
$informationObject->getPublicationStatus()->status->id): ?> <span 
class="publicationStatus"><?php echo 
$informationObject->getPublicationStatus()->status ?></span><?php endif; ?></h2>
+      <h2><?php echo link_to(render_title($item), array($item, 'module' => 
'informationobject')) ?><?php if (QubitTerm::PUBLICATION_STATUS_DRAFT_ID == 
$item->getPublicationStatus()->status->id): ?> <span 
class="publicationStatus"><?php echo $item->getPublicationStatus()->status 
?></span><?php endif; ?></h2>
 
       <div>
-        <?php echo truncate_text($informationObject->scopeAndContent, 250) ?>
+        <?php echo truncate_text($item->scopeAndContent, 250) ?>
       </div>
 
-      <?php $isad = new sfIsadPlugin($informationObject); echo 
render_show(__('Reference code'), render_value($isad->referenceCode)) ?>
+      <?php $isad = new sfIsadPlugin($item); echo render_show(__('Reference 
code'), render_value($isad->referenceCode)) ?>
 
       <div class="field">
         <h3><?php echo __('Date(s)') ?></h3>
         <div>
           <ul>
-            <?php foreach ($informationObject->getDates() as $date): ?>
+            <?php foreach ($item->getDates() as $date): ?>
               <li>
+
                 <?php echo 
Qubit::renderDateStartEnd($date->getDateDisplay(array('cultureFallback' => 
true)), $date->startDate, $date->endDate) ?> (<?php echo 
$date->getType(array('cultureFallback' => true)) ?>)
+
                 <?php if (isset($date->actor)): ?>
                   <?php echo link_to(render_title($date->actor), 
array($date->actor, 'module' => 'actor')) ?>
                 <?php endif; ?>
+
               </li>
             <?php endforeach; ?>
           </ul>
         </div>
       </div>
 
-      <?php echo render_show(__('Level of description'), 
render_value($informationObject->levelOfDescription)) ?>
+      <?php echo render_show(__('Level of description'), 
render_value($item->levelOfDescription)) ?>
 
-      <?php if (sfConfig::get('app_multi_repository') && 
isset($informationObject->repository)): ?>
-        <?php echo render_show(__('Repository'), 
link_to(render_title($informationObject->repository), 
array($informationObject->repository, 'module' => 'repository'))) ?>
+      <?php if (sfConfig::get('app_multi_repository') && 
isset($item->repository)): ?>
+        <?php echo render_show(__('Repository'), 
link_to(render_title($item->repository), array($item->repository, 'module' => 
'repository'))) ?>
       <?php endif; ?>
 
-      <?php if ($informationObject->getCollectionRoot() != 
$informationObject): ?>
-        <?php echo render_show(__('Part of'), 
link_to(render_title($informationObject->getCollectionRoot()), 
array($informationObject->getCollectionRoot(), 'module' => 
'informationobject'))) ?>
+      <?php if ($item->getCollectionRoot() !== $item): ?>
+        <?php echo render_show(__('Part of'), 
link_to(render_title($item->getCollectionRoot()), 
array($item->getCollectionRoot(), 'module' => 'informationobject'))) ?>
       <?php endif; ?>
 
     </div>

Modified: trunk/apps/qubit/modules/term/templates/deleteSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/term/templates/deleteSuccess.php   Mon Oct 25 
13:54:21 2010        (r8481)
+++ trunk/apps/qubit/modules/term/templates/deleteSuccess.php   Mon Oct 25 
14:02:15 2010        (r8482)
@@ -14,7 +14,8 @@
 
   <ul>
     <?php foreach ($resource->events as $item): ?>
-      <li><?php echo 
Qubit::renderDateStartEnd($item->getDateDisplay(array('cultureFallback' => 
true)), $item->startDate, $item->endDate) ?> (<?php echo 
render_title($resource) ?>) <?php echo 
link_to(render_title($item->informationObject), array($item->informationObject, 
'module' => 'informationobject')) ?></li><?php endforeach; ?>
+      <li><?php echo 
Qubit::renderDateStartEnd($item->getDateDisplay(array('cultureFallback' => 
true)), $item->startDate, $item->endDate) ?> (<?php echo 
render_title($resource) ?>) <?php echo 
link_to(render_title($item->informationObject), array($item->informationObject, 
'module' => 'informationobject')) ?></li>
+    <?php endforeach; ?>
   </ul>
 
 <?php endif; ?>

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