Author: sevein
Date: Wed Oct 27 02:22:20 2010
New Revision: 8532

Log:
Use $resource. Fixes issue 1841.

Modified:
   trunk/apps/qubit/modules/taxonomy/actions/indexAction.class.php
   trunk/apps/qubit/modules/taxonomy/templates/indexSuccess.php

Modified: trunk/apps/qubit/modules/taxonomy/actions/indexAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/taxonomy/actions/indexAction.class.php     Wed Oct 
27 01:30:29 2010        (r8531)
+++ trunk/apps/qubit/modules/taxonomy/actions/indexAction.class.php     Wed Oct 
27 02:22:20 2010        (r8532)
@@ -26,17 +26,15 @@
       $request->limit = sfConfig::get('app_hits_per_page');
     }
 
-    $this->taxonomy = QubitTaxonomy::getById($request->id);
+    $this->resource = $this->getRoute()->resource;
 
-    if (!isset($this->taxonomy))
+    if (!isset($this->resource))
     {
       $this->forward404();
     }
 
-    $request->setAttribute('taxonomy', $this->taxonomy);
-
     $criteria = new Criteria;
-    $criteria->add(QubitTerm::TAXONOMY_ID, $this->taxonomy->id);
+    $criteria->add(QubitTerm::TAXONOMY_ID, $this->resource->id);
     $criteria->add(QubitTerm::PARENT_ID, QubitTerm::ROOT_ID);
 
     $criteria->addAscendingOrderByColumn('name');

Modified: trunk/apps/qubit/modules/taxonomy/templates/indexSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/taxonomy/templates/indexSuccess.php        Wed Oct 
27 01:30:29 2010        (r8531)
+++ trunk/apps/qubit/modules/taxonomy/templates/indexSuccess.php        Wed Oct 
27 02:22:20 2010        (r8532)
@@ -1,32 +1,32 @@
-<h1><?php echo __('List %1%', array('%1%' => render_title($taxonomy))) ?></h1>
+<h1><?php echo __('List %1%', array('%1%' => render_title($resource))) ?></h1>
 
 <table class="sticky-enabled">
   <thead>
     <tr>
       <th>
-        <?php echo __('%1% term', array('%1%' => render_title($taxonomy))) ?>
+        <?php echo __('%1% term', array('%1%' => render_title($resource))) ?>
       </th><th>
         <?php echo __('Scope note') ?>
       </th>
     </tr>
   </thead><tbody>
-    <?php foreach ($terms as $term): ?>
+    <?php foreach ($terms as $item): ?>
       <tr class="<?php echo 0 == ++$row % 2 ? 'even' : 'odd' ?>">
         <td>
 
-          <?php if ($term->isProtected()): ?>
-            <?php echo 
link_to(render_title($term->getName(array('cultureFallback' => true))), 
array($term, 'module' => 'term'), array('class' => 'readOnly')) ?>
+          <?php if ($item->isProtected()): ?>
+            <?php echo 
link_to(render_title($item->getName(array('cultureFallback' => true))), 
array($item, 'module' => 'term'), array('class' => 'readOnly')) ?>
           <?php else: ?>
-            <?php echo 
link_to(render_title($term->getName(array('cultureFallback' => true))), 
array($term, 'module' => 'term')) ?>
+            <?php echo 
link_to(render_title($item->getName(array('cultureFallback' => true))), 
array($item, 'module' => 'term')) ?>
           <?php endif; ?>
 
-          <?php if (0 < count($term->descendants)): ?>
-            <span class="note2">(<?php echo count($term->descendants) 
?>)</span>
+          <?php if (0 < count($item->descendants)): ?>
+            <span class="note2">(<?php echo count($item->descendants) 
?>)</span>
           <?php endif; ?>
 
         </td><td>
           <ul>
-            <?php foreach ($term->getNotesByType(array('noteTypeId' => 
QubitTerm::SCOPE_NOTE_ID)) as $note): ?>
+            <?php foreach ($item->getNotesByType(array('noteTypeId' => 
QubitTerm::SCOPE_NOTE_ID)) as $note): ?>
               <li><?php echo $note->getContent(array('cultureFallback' => 
'true')) ?></li>
             <?php endforeach; ?>
           </ul>
@@ -44,8 +44,8 @@
 
   <div class="content">
     <ul class="clearfix links">
-      <?php if (QubitAcl::check($taxonomy, 'createTerm')): ?>
-        <li><?php echo link_to(__('Add new'), array('module' => 'term', 
'action' => 'add', 'taxonomy' => url_for(array($taxonomy, 'module' => 
'taxonomy')))) ?></li>
+      <?php if (QubitAcl::check($resource, 'createTerm')): ?>
+        <li><?php echo link_to(__('Add new'), array('module' => 'term', 
'action' => 'add', 'taxonomy' => url_for(array($resource, 'module' => 
'taxonomy')))) ?></li>
       <?php endif; ?>
     </ul>
   </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.

Reply via email to