Author: david
Date: Fri Dec 11 14:42:57 2009
New Revision: 4153

Log:
Display related functions on ISDF show page.

Modified:
   trunk/apps/qubit/modules/function/actions/showAction.class.php
   trunk/apps/qubit/modules/function/templates/showIsdfSuccess.php

Modified: trunk/apps/qubit/modules/function/actions/showAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/function/actions/showAction.class.php      Fri Dec 
11 13:58:56 2009        (r4152)
+++ trunk/apps/qubit/modules/function/actions/showAction.class.php      Fri Dec 
11 14:42:57 2009        (r4153)
@@ -26,10 +26,8 @@
 
     $this->parallelNames = $this->func->getOtherNames(array('typeId' => 
QubitTerm::PARALLEL_FORM_OF_NAME_ID));
     $this->otherNames = $this->func->getOtherNames(array('typeId' => 
QubitTerm::OTHER_FORM_OF_NAME_ID));
-
     $this->maintenanceNotes = $this->func->getNotesByType(array('noteTypeId' 
=> QubitTerm::MAINTENANCE_NOTE_ID));
-    // TODO Get relationships
-    $this->relations = array();
+    $this->relations = QubitRelation::getBySubjectOrObjectId($this->func->id);
 
     // ISDF validation rules
     if (QubitAcl::check($this->func, QubitAclAction::UPDATE_ID))

Modified: trunk/apps/qubit/modules/function/templates/showIsdfSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/function/templates/showIsdfSuccess.php     Fri Dec 
11 13:58:56 2009        (r4152)
+++ trunk/apps/qubit/modules/function/templates/showIsdfSuccess.php     Fri Dec 
11 14:42:57 2009        (r4153)
@@ -113,49 +113,65 @@
 <?php endif; ?>
 
 <!-- Relationships area -->
-<?php if (0 < count($relations)): ?>
   <tr id="relationshipsArea">
     <td colspan="2" class="subHeaderCell">
       <?php echo link_to_if(QubitAcl::check($func, QubitAclAction::UPDATE_ID), 
__('relationships area'), array('module' => 'function', 'action' => 'edit', 
'id' => $func->id), array('anchor' => 'relationshipsArea', 'title' => __('Edit 
relationships area'))) ?>
     </td>
   </tr>
 
+<?php if (0 < count($relations)): ?>
   <?php foreach ($relations as $relation): ?>
   <tr>
-    <th><?php echo __('related entity') ?></th>
+    <th><?php echo __('related function') ?></th>
     <td>
-      <?php if ($func->getId() == $funcRelation->getObjectId()): ?>
-        <?php $relatedActor = $funcRelation->getSubject() ?>
-        <?php echo 
link_to($relatedActor->getAuthorizedFormOfName(array('cultureFallback' => 
true)),
-        array('module' => 'actor', 'action' => 'show', 'id' => 
$funcRelation->getSubjectId())) ?>
-        <?php if ($existence = 
$relatedActor->getDatesOfExistence(array('cultureFallback' => true))): ?><span 
class="note2"> (<?php echo $existence ?>)</span><?php endif; ?>
+      <?php if ($func->id == $relation->objectId): ?>
+        <?php $relatedFunction = $relation->getSubject() ?>
+        <?php echo 
link_to($relatedFunction->getAuthorizedFormOfName(array('cultureFallback' => 
true)),
+        array('module' => 'function', 'action' => 'show', 'id' => 
$relation->subjectId)) ?>
       <?php else: ?>
-        <?php $relatedActor = $funcRelation->getObject() ?>
-        <?php echo 
link_to($relatedActor->getAuthorizedFormOfName(array('cultureFallback' => 
true)),
-        array('module' => 'actor', 'action' => 'show', 'id' => 
$funcRelation->getObjectId())) ?>
-        <?php if ($existence = 
$relatedActor->getDatesOfExistence(array('cultureFallback' => true))): ?><span 
class="note2"> (<?php echo $existence ?>)</span><?php endif; ?>
+        <?php $relatedFunction = $relation->getObject() ?>
+        <?php echo 
link_to($relatedFunction->getAuthorizedFormOfName(array('cultureFallback' => 
true)),
+        array('module' => 'function', 'action' => 'show', 'id' => 
$relation->objectId)) ?>
+      <?php endif; ?>
+      
+      <!-- Identifier -->
+      <?php if (0 < strlen($identifier = 
$relatedFunction->getDescriptionIdentifier(array('cultureFallback' => true)))): 
?>
+        (<?php echo $identifier ?>)
       <?php endif; ?>
 
-      <table class="detail" style="margin-top: 5px;">
-        <?php if (0 < strlen($relatedActor->getCorporateBodyIdentifiers())): ?>
+      <table class="inline" style="margin-top: 5px;">
+        <?php if (0 < $relatedFunction->typeId): ?>
+        <!-- Type of function -->
         <tr>
-          <th style="text-align: left; padding: 1px;"><?php echo 
__('identifier of the related entity') ?></th>
+          <th style="text-align: left; padding: 1px;"><?php echo __('type') 
?></th>
         </tr>
         <tr>
-          <td><?php echo $relatedActor->getCorporateBodyIdentifiers() ?></td>
+          <td><?php echo 
$relatedFunction->type->getName(array('cultureFallback' => true)) ?></td>
         </tr>
         <?php endif; ?>
-
-        <?php if (0 < $funcRelation->getTypeId()): ?>
+        
+        <?php if (0 < $relation->typeId): ?>
+        <!-- Category of relationship -->
         <tr>
           <th style="text-align: left; padding: 1px;"><?php echo __('category 
of the relationship') ?></th>
         </tr>
         <tr>
-          <td><?php echo $funcRelation->getType()->getName() ?></td>
+          <td><?php echo $relation->type->getName() ?></td>
+        </tr>
+        <?php endif; ?>
+
+        <?php if (null !== ($descriptionNote = 
$relation->getNoteByTypeId(QubitTerm::RELATION_NOTE_DESCRIPTION_ID))): ?>
+        <!-- Description of relationship -->
+        <tr>
+          <th style="text-align: left; padding: 1px;"><?php echo 
__('description of relationship') ?></th>
+        </tr>
+        <tr>
+          <td><?php echo $descriptionNote->getContent(array('cultureFallback' 
=> true)) ?></td>
         </tr>
         <?php endif; ?>
 
-        <?php if (null !== ($dateDisplayNote = 
$funcRelation->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID)) || 0 
< count($dateArray = $funcRelation->getDates())): ?>
+        <?php if (null !== ($dateDisplayNote = 
$relation->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID)) || 0 < 
count($dateArray = $relation->getDates())): ?>
+        <!-- Dates of relationship -->
         <tr>
           <th style="text-align: left; padding: 1px;"><?php echo __('dates of 
the relationship') ?></th>
         </tr>
@@ -171,15 +187,6 @@
           </td>
         </tr>
         <?php endif; ?>
-
-        <?php if (null !== ($descriptionNote = 
$funcRelation->getNoteByTypeId(QubitTerm::RELATION_NOTE_DESCRIPTION_ID))): ?>
-        <tr>
-          <th style="text-align: left; padding: 1px;"><?php echo 
__('description of relationship') ?></th>
-        </tr>
-        <tr>
-          <td><?php echo $descriptionNote->getContent(array('cultureFallback' 
=> true)) ?></td>
-        </tr>
-        <?php endif; ?>
       </table>
     </td>
   </tr>

--

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