Author: sevein
Date: Tue Aug 16 14:13:21 2011
New Revision: 9502

Log:
Show all fields into right view component and check for rights in ancestors 
(inheritance)

Modified:
   trunk/apps/qubit/modules/right/actions/relatedRightsComponent.class.php
   trunk/apps/qubit/modules/right/templates/_relatedRights.php

Modified: 
trunk/apps/qubit/modules/right/actions/relatedRightsComponent.class.php
==============================================================================
--- trunk/apps/qubit/modules/right/actions/relatedRightsComponent.class.php     
Tue Aug 16 14:12:10 2011        (r9501)
+++ trunk/apps/qubit/modules/right/actions/relatedRightsComponent.class.php     
Tue Aug 16 14:13:21 2011        (r9502)
@@ -21,13 +21,12 @@
 {
   public function execute($request)
   {
-    if (isset($this->resource))
+    foreach ($this->resource->ancestors->andSelf()->orderBy('rgt') as 
$this->ancestor)
     {
-      $this->rights = 
QubitRelation::getRelationsBySubjectId($this->resource->id, array('typeId' => 
QubitTerm::RIGHT_ID));
-    }
-    else
-    {
-      return sfView::NONE;
+      if (0 < count($this->ancestor->getRights()))
+      {
+        break;
+      }
     }
   }
 }

Modified: trunk/apps/qubit/modules/right/templates/_relatedRights.php
==============================================================================
--- trunk/apps/qubit/modules/right/templates/_relatedRights.php Tue Aug 16 
14:12:10 2011        (r9501)
+++ trunk/apps/qubit/modules/right/templates/_relatedRights.php Tue Aug 16 
14:13:21 2011        (r9502)
@@ -1,10 +1,58 @@
-<div class="field">
-  <h3><?php echo __('Related rights') ?></h3>
-  <div>
-    <ul>
-      <?php foreach ($rights as $item): ?>
-        <li><?php echo render_title($item->object) ?></li>
-      <?php endforeach; ?>
-    </ul>
+<?php foreach ($ancestor->getRights() as $item): ?>
+  <div class="field">
+    <h3><?php echo __('Related right') ?></h3>
+    <div>
+
+      <?php if (0 == count($resource->getRights())): ?>
+        <?php echo link_to(render_title($item->subject), array($item->subject, 
'module' => 'informationobject'), array('title' => __('Inherited from %1%', 
array('%1%' => $ancestor)))) ?>
+      <?php endif; ?>
+
+      <?php // echo render_title($item->object) ?>
+
+      <?php echo render_show(__('Act'), render_value($item->object->act)) ?>
+
+      <?php echo render_show(__('Restriction'), 
render_value($item->object->getRestriction(array('cultureFallback' => true)))) 
?>
+
+      <?php echo render_show(__('Start date'), 
render_value($item->object->startDate)) ?>
+
+      <?php echo render_show(__('End date'), 
render_value($item->object->endDate)) ?>
+
+      <?php echo render_show(__('Rights holder'), 
render_value($item->object->rightsHolder)) ?>
+
+      <?php echo render_show(__('Right note'), 
render_value($item->object->getRightNote(array('cultureFallback' => true)))) ?>
+
+      <?php echo render_show(__('Basis'), render_value($item->object->basis)) 
?>
+
+      <?php if (QubitTerm::RIGHT_BASIS_COPYRIGHT_ID == 
$item->object->basisId): ?>
+
+        <?php echo render_show(__('Copyright status'), 
render_value($item->object->copyrightStatus)) ?>
+
+        <?php echo render_show(__('Copyright status date'), 
render_value($item->object->copyrightStatusDate)) ?>
+
+        <?php echo render_show(__('Copyright jurisdiction'), 
render_value($item->object->copyrightJurisdiction)) ?>
+
+        <?php echo render_show(__('Copyright note'), 
render_value($item->object->getCopyrightNote(array('cultureFallback' => 
true)))) ?>
+
+      <?php elseif (QubitTerm::RIGHT_BASIS_LICENSE_ID == 
$item->object->basisId): ?>
+
+        <?php echo render_show(__('License identifier'), 
render_value($item->object->getLicenseIdentifier(array('cultureFallback' => 
true)))) ?>
+
+        <?php echo render_show(__('License terms'), 
render_value($item->object->getLicenseTerms(array('cultureFallback' => true)))) 
?>
+
+        <?php echo render_show(__('License note'), 
render_value($item->object->getLicenseNote(array('cultureFallback' => true)))) 
?>
+
+      <?php elseif (QubitTerm::RIGHT_BASIS_STATUTE_ID == 
$item->object->basisId): ?>
+
+        <?php echo render_show(__('Statute jurisdiction'), 
render_value($item->object->getStatuteJurisdiction(array('cultureFallback' => 
true)))) ?>
+
+        <?php echo render_show(__('Statute citation'), 
render_value($item->object->getStatuteCitation(array('cultureFallback' => 
true)))) ?>
+
+        <?php echo render_show(__('Statute determination date'), 
render_value($item->object->statuteDeterminationDate)) ?>
+
+        <?php echo render_show(__('Statute note'), 
render_value($item->object->getStatuteNote(array('cultureFallback' => true)))) 
?>
+
+      <?php endif; ?>
+
+    </div>
   </div>
-</div>
+<?php endforeach; ?>

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