Author: david
Date: 2008-11-12 15:27:05 -0800 (Wed, 12 Nov 2008)
New Revision: 1582

Modified:
   trunk/qubit/apps/qubit/modules/actor/actions/contextMenuComponent.class.php
   trunk/qubit/apps/qubit/modules/actor/templates/_contextMenu.php
   trunk/qubit/lib/model/QubitActor.php
Log:
Update actor context menu so it shows *all* instances of a given event type 
(e.g. creation) under the appropriate title (e.g. "Creator of") instead of just 
the first one. Fixes bug #516.

Modified: 
trunk/qubit/apps/qubit/modules/actor/actions/contextMenuComponent.class.php
===================================================================
--- trunk/qubit/apps/qubit/modules/actor/actions/contextMenuComponent.class.php 
2008-11-12 22:43:02 UTC (rev 1581)
+++ trunk/qubit/apps/qubit/modules/actor/actions/contextMenuComponent.class.php 
2008-11-12 23:27:05 UTC (rev 1582)
@@ -20,7 +20,7 @@
  */
 
 /**
- * Actor components
+ * Actor contextMenu component
  */
 class ActorContextMenuComponent extends sfComponent
 {
@@ -33,10 +33,17 @@
       $this->repository = 
QubitRepository::getById($request->getParameter('id'));
 
       $this->informationObjectRelations = 
$this->actor->getInformationObjectRelations();
+
+      $relatedInfoObjects = array();
+      foreach ($this->actor->getInformationObjectRelations() as $relation)
+      {
+        $relatedInfoObjects[$relation->getType()->getRole()][] = $relation;
+      }
+      $this->relatedInfoObjects = $relatedInfoObjects;
     }
     else
     {
-      $this->informationObjectRelations = null;
+      $this->relatedInfoObjects = null;
       $this->repository = null;
     }
   }

Modified: trunk/qubit/apps/qubit/modules/actor/templates/_contextMenu.php
===================================================================
--- trunk/qubit/apps/qubit/modules/actor/templates/_contextMenu.php     
2008-11-12 22:43:02 UTC (rev 1581)
+++ trunk/qubit/apps/qubit/modules/actor/templates/_contextMenu.php     
2008-11-12 23:27:05 UTC (rev 1582)
@@ -6,14 +6,16 @@
     <?php echo link_to($repository, 
'repository/show?id='.$repository->getId()) ?>
   <?php endif; ?>
 
-  <?php if ($informationObjectRelations): ?>
-    <?php foreach ($informationObjectRelations as $relation): ?>
+  <?php if ($relatedInfoObjects): ?>
+    <?php foreach ($relatedInfoObjects as $role => $relations): ?>
       <div class="label">
-        <?php echo __('%1% of', array('%1%' => 
$relation->getType()->getRole())) ?>
+        <?php echo __('%1% of', array('%1%' => $role)) ?>
       </div>
+      <?php foreach($relations as $relation): ?>
       <div>
         <?php echo link_to($relation->getInformationObject(), 
'informationobject/show?id='.$relation->getInformationObjectId()) ?>
       </div>
+      <?php endforeach;  ?>
     <?php endforeach; ?>
   <?php endif; ?>
 </div>

Modified: trunk/qubit/lib/model/QubitActor.php
===================================================================
--- trunk/qubit/lib/model/QubitActor.php        2008-11-12 22:43:02 UTC (rev 
1581)
+++ trunk/qubit/lib/model/QubitActor.php        2008-11-12 23:27:05 UTC (rev 
1582)
@@ -378,7 +378,7 @@
     $criteria = new Criteria;
     $criteria->add(QubitEvent::ACTOR_ID, $this->getId());
     $criteria->addJoin(QubitEvent::INFORMATION_OBJECT_ID, 
QubitInformationObject::ID);
-    $criteria->addGroupByColumn(QubitEvent::TYPE_ID);
+    $criteria->addAscendingOrderByColumn(QubitEvent::TYPE_ID);
 
     return QubitEvent::get($criteria);
   }


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

Reply via email to