Author: peter
Date: 2008-11-11 09:57:59 -0800 (Tue, 11 Nov 2008)
New Revision: 1559

Modified:
   trunk/qubit/apps/qubit/modules/informationobject/actions/editAction.class.php
   trunk/qubit/apps/qubit/modules/informationobject/actions/showAction.class.php
   
trunk/qubit/apps/qubit/modules/informationobject/templates/showIsadSuccess.php
   trunk/qubit/lib/model/QubitEvent.php
   trunk/qubit/lib/model/QubitInformationObject.php
   trunk/qubit/lib/model/QubitTerm.php
Log:
update date display, sort descending by date

Modified: 
trunk/qubit/apps/qubit/modules/informationobject/actions/editAction.class.php
===================================================================
--- 
trunk/qubit/apps/qubit/modules/informationobject/actions/editAction.class.php   
    2008-11-11 17:38:15 UTC (rev 1558)
+++ 
trunk/qubit/apps/qubit/modules/informationobject/actions/editAction.class.php   
    2008-11-11 17:57:59 UTC (rev 1559)
@@ -43,7 +43,7 @@
     $this->getResponse()->addJavaScript('multiInstanceSelect');
 
     //Actor (Event) Relations
-    $this->actorEvents = $this->informationObject->getEvents();
+    $this->actorEvents = $this->informationObject->getActorEvents();
     $this->newActorEvent = new QubitEvent;
     $this->creators = $this->informationObject->getCreators();
     $this->actorEventTypes = 
QubitTerm::getOptionsForSelectList(QubitTaxonomy::EVENT_TYPE_ID);

Modified: 
trunk/qubit/apps/qubit/modules/informationobject/actions/showAction.class.php
===================================================================
--- 
trunk/qubit/apps/qubit/modules/informationobject/actions/showAction.class.php   
    2008-11-11 17:38:15 UTC (rev 1558)
+++ 
trunk/qubit/apps/qubit/modules/informationobject/actions/showAction.class.php   
    2008-11-11 17:57:59 UTC (rev 1559)
@@ -29,17 +29,19 @@
     // HACK: populate information object from ORM
     $request->setAttribute('informationObject', $this->informationObject);
 
-    $this->creators = $this->informationObject->getCreators();
+    // Events
+    $this->actorEvents = $this->informationObject->getActorEvents();
 
-    //Properties
+    // Properties
     $this->languageCodes = $this->informationObject->getProperties($name = 
'information_object_language');
     $this->scriptCodes = $this->informationObject->getProperties($name = 
'information_object_script');
     $this->descriptionLanguageCodes = 
$this->informationObject->getProperties($name = 
'language_of_information_object_description');
     $this->descriptionScriptCodes = 
$this->informationObject->getProperties($name = 
'script_of_information_object_description');
 
+    // Notes
     $this->notes = $this->informationObject->getNotes();
-    $this->datesOfDescription = 
$this->informationObject->getDatesOfDescription();
 
+    // Access points
     $this->subjectAccessPoints = 
$this->informationObject->getSubjectAccessPoints();
     $this->placeAccessPoints = 
$this->informationObject->getPlaceAccessPoints();
     $this->nameAccessPoints = array();
@@ -52,12 +54,14 @@
       }
     }
 
+    // Material types
     $this->materialTypes = $this->informationObject->getMaterialTypes();
 
+    // Physical objects
     $this->physicalObjects = 
QubitRelation::getRelatedSubjectsByObjectId($this->informationObject->getId(),
       array('typeId'=>QubitTerm::HAS_PHYSICAL_OBJECT_ID));
 
-    //determine if user has edit priviliges
+    // Determine if user has edit priviliges
     $this->editCredentials = false;
     if (SecurityPriviliges::editCredentials($this->getUser(), 
'informationObject'))
     {

Modified: 
trunk/qubit/apps/qubit/modules/informationobject/templates/showIsadSuccess.php
===================================================================
--- 
trunk/qubit/apps/qubit/modules/informationobject/templates/showIsadSuccess.php  
    2008-11-11 17:38:15 UTC (rev 1558)
+++ 
trunk/qubit/apps/qubit/modules/informationobject/templates/showIsadSuccess.php  
    2008-11-11 17:57:59 UTC (rev 1559)
@@ -18,20 +18,48 @@
   </tr>
 <?php endif; ?>
 
+<?php if ($informationObject->getLevelOfDescriptionId()) : ?>
+<tr>
+<th><?php echo __('level of description'); ?></th>
+<td><?php echo $informationObject->getLevelOfDescription(); ?></td>
+</tr>
+<?php endif; ?>
+
 <?php if (count($informationObject->getDates()) > 0) : ?>
 <tr><th><?php echo __('dates'); ?></th><td>
 <?php foreach ($informationObject->getDates() as $date): ?>
-<?php echo $date.'<br />' ?>
+  <?php echo $date->getDateDisplay().' ('.$date->getType().')' ?><br />
+    <?php if (($actor=$date->getActor()) || ($place=$date->getPlace()) || 
($note=$date->getDescription())): ?>
+    <div style="margin-left: 30px; color: #999999;">
+    <?php if ($actor): ?>
+      <?php echo $date->getType()->getRole()?>: <?php echo $actor ?><br />
+    <?php endif; ?>
+    <?php if ($place=$date->getPlace()): ?>
+      <?php echo __('place of').' '.$date->getType() ?>: <?php echo $place 
?><br />
+    <?php endif; ?>
+    <?php if ($note=$date->getDescription()): ?>
+      <?php echo __('note') ?>: <?php echo $date->getDescription() ?><br />
+    <?php endif; ?>
+    </div>
+  <?php endif; ?>
+
+<br />
 <?php endforeach; ?>
 </td></tr>
 <?php endif; ?>
 
-<?php if ($informationObject->getLevelOfDescriptionId()) : ?>
-<tr>
-<th><?php echo __('level of description'); ?></th>
-<td><?php echo $informationObject->getLevelOfDescription(); ?></td>
-</tr>
-<?php endif; ?>
+<?php  foreach ($actorEvents as $actorEvent): ?>
+  <tr>
+  <th><?php echo $actorEvent->getType()->getRole(); ?></th>
+  <td><?php echo link_to($actorEvent->getActor(), 
'actor/show?id='.$actorEvent->getActorId()); ?>
+    <?php if ($actorEvent->getActor()->getDatesOfExistence()) echo ' 
('.$actorEvent->getActor()->getDatesOfExistence(array('cultureFallback' => 
true)).')'; ?>
+  <br />
+    <?php if ($actorEvent->getTypeId() == QubitTerm::CREATION_ID): ?>
+      <?php echo 
nl2br($actorEvent->getActor()->getHistory(array('cultureFallback' => true))); ?>
+    <?php endif; ?>
+  </td>
+  </tr>
+<?php endforeach; ?>
 
 <?php if (strlen($value = 
$informationObject->getExtentAndMedium(array('cultureFallback' => true))) > 0) 
: ?>
 <tr>
@@ -57,17 +85,6 @@
     array('informationObject'=>$informationObject, 
'physicalObjects'=>$physicalObjects)); ?>
 <?php endif; ?>
 
-<?php  foreach ($creators as $creator): ?>
-  <tr>
-  <th><?php echo __('creator'); ?></th>
-  <td><?php echo link_to($creator, 'actor/show?id='.$creator->getId()); ?>
-    <?php if ($creator->getDatesOfExistence()) echo ' 
('.$creator->getDatesOfExistence(array('cultureFallback' => true)).')'; ?>
-  <br />
-    <?php echo nl2br($creator->getHistory(array('cultureFallback' => true))); 
?>
-  </td>
-  </tr>
-<?php endforeach; ?>
-
 <?php if ($informationObject->getRepositoryId()) : ?>
 <tr>
 <th><?php echo __('repository'); ?></th>

Modified: trunk/qubit/lib/model/QubitEvent.php
===================================================================
--- trunk/qubit/lib/model/QubitEvent.php        2008-11-11 17:38:15 UTC (rev 
1558)
+++ trunk/qubit/lib/model/QubitEvent.php        2008-11-11 17:57:59 UTC (rev 
1559)
@@ -48,4 +48,24 @@
       SearchIndex::updateTranslatedLanguages($this->getInformationObject());
     }
   }
-}
+
+  public function getPlace(array $options = array())
+  {
+    $criteria = new Criteria;
+    $criteria->add(QubitObjectTermRelation::OBJECT_ID, $this->getId());
+    $criteria->addJoin(QubitObjectTermRelation::TERM_ID, QubitTerm::ID);
+    $criteria->add(QubitTerm::TAXONOMY_ID, QubitTaxonomy::PLACE_ID);
+    $relation = QubitObjectTermRelation::get($criteria);
+
+    if (count($relation) > 0)
+    {
+
+      return $relation[0]->getTerm();
+    }
+    else
+    {
+
+      return null;
+    }
+  }
+}
\ No newline at end of file

Modified: trunk/qubit/lib/model/QubitInformationObject.php
===================================================================
--- trunk/qubit/lib/model/QubitInformationObject.php    2008-11-11 17:38:15 UTC 
(rev 1558)
+++ trunk/qubit/lib/model/QubitInformationObject.php    2008-11-11 17:57:59 UTC 
(rev 1559)
@@ -273,7 +273,7 @@
     $criteria->add(QubitEvent::INFORMATION_OBJECT_ID, $this->getId());
     if (isset($options['eventTypeId']))
     {
-      $criteria->add(QubitEvent::TYPE_ID, 111);
+      $criteria->add(QubitEvent::TYPE_ID, $options['eventTypeId']);
     }
     $criteria->addGroupByColumn(QubitEvent::ACTOR_ID);
 
@@ -283,14 +283,6 @@
   public function getCreators()
   {
     return $this->getActors($options = array('eventTypeId' => 
QubitTerm::CREATION_ID));
-
-    /*$criteria = new Criteria;
-    $criteria->add(QubitEvent::INFORMATION_OBJECT_ID, $this->getId());
-    $criteria->add(QubitEvent::EVENT_TYPE_ID, QubitTerm::CREATION_ID);
-    $criteria->addJoin(QubitActor::ID, QubitEvent::ACTOR_ID, 
Criteria::INNER_JOIN);
-
-    $actors = QubitActor::get($criteria);
-    return $actors;*/
   }
 
   public function getActorEvents(array $options = array())
@@ -309,17 +301,22 @@
   public function getCreationEvents()
   {
     return $this->getActorEvents($options = array('eventTypeId' => 
QubitTerm::CREATION_ID));
+  }
 
-    /*$criteria = new Criteria;
+  //TODO: like getCreationEvents, use the getActorEvents method. Need to find 
out how to pass
+  //the additional '$criteria->add(QubitEvent::START_DATE, null, 
Criteria::ISNOTNULL)' as an $option
+  public function getDates(array $options = array())
+  {
+    $criteria = new Criteria;
     $criteria->add(QubitEvent::INFORMATION_OBJECT_ID, $this->getId());
+    $criteria->add(QubitEvent::START_DATE, null, Criteria::ISNOTNULL);
+    if (isset($options['type_id']))
+    {
+      $criteria->add(QubitEvent::TYPE_ID, $options['type_id']);
+    }
     $criteria->addDescendingOrderByColumn(QubitEvent::START_DATE);
-    // check for Events that have a creator OR are of the type 'creation'
-    $crit0 = $criteria->getNewCriterion(QubitEvent::TYPE_ID, 
QubitTerm::CREATION_ID);
-    $crit1 = $criteria->getNewCriterion(QubitEvent::ACTOR_ROLE_ID, 
QubitTerm::CREATOR_ID);
-    $crit0->addOr($crit1);
-    $criteria->add($crit0);
 
-    return QubitEvent::get($criteria);*/
+    return QubitEvent::get($criteria);
   }
 
   /**
@@ -352,20 +349,6 @@
     return $thumbnails;
   }
 
-  public function getDates(array $options = array())
-  {
-    $criteria = new Criteria;
-    $criteria->add(QubitEvent::INFORMATION_OBJECT_ID, $this->getId());
-    $criteria->add(QubitEvent::START_DATE, null, Criteria::ISNOTNULL);
-    if (isset($options['type_id']))
-    {
-      $criteria->add(QubitEvent::TYPE_ID, $options['type_id']);
-    }
-    $criteria->addDescendingOrderByColumn(QubitEvent::START_DATE);
-
-    return QubitEvent::get($criteria);
-  }
-
   public function getDatesOfDescription()
   {
     //from system event object

Modified: trunk/qubit/lib/model/QubitTerm.php
===================================================================
--- trunk/qubit/lib/model/QubitTerm.php 2008-11-11 17:38:15 UTC (rev 1558)
+++ trunk/qubit/lib/model/QubitTerm.php 2008-11-11 17:57:59 UTC (rev 1559)
@@ -145,7 +145,16 @@
   {
     $notes = $this->getNotesByType($noteTypeId = QubitTerm::DISPLAY_NOTE_ID);
 
-    return $notes[0]->getContent($options = array('cultureFallback' => true));
+    if (count($notes) > 0)
+    {
+
+      return $notes[0]->getContent($options = array('cultureFallback' => 
true));
+    }
+    else
+    {
+
+      return $this->getName();
+    }
   }
 
   public static function getLevelsOfDescription($options = array())


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