Author: jablko
Date: Sat Oct 23 10:27:47 2010
New Revision: 8400

Log:
Factor into Qubit::renderDateStartEnd()

Modified:
   trunk/lib/model/QubitRelation.php
   trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/indexSuccess.php

Modified: trunk/lib/model/QubitRelation.php
==============================================================================
--- trunk/lib/model/QubitRelation.php   Sat Oct 23 09:32:05 2010        (r8399)
+++ trunk/lib/model/QubitRelation.php   Sat Oct 23 10:27:47 2010        (r8400)
@@ -353,26 +353,4 @@
 
     return QubitNote::getOne($criteria);
   }
-
-  /**
-   * Get start and end date as an array
-   *
-   * @return array start date and/or end date
-   */
-  public function getDates()
-  {
-    $dateArray = array();
-
-    if (isset($this->startDate))
-    {
-      $dateArray['start'] = $this->startDate;
-    }
-
-    if (isset($this->endDate))
-    {
-      $dateArray['end'] = $this->endDate;
-    }
-
-    return $dateArray;
-  }
 }

Modified: 
trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/indexSuccess.php
==============================================================================
--- trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/indexSuccess.php  
Sat Oct 23 09:32:05 2010        (r8399)
+++ trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/indexSuccess.php  
Sat Oct 23 10:27:47 2010        (r8400)
@@ -79,22 +79,9 @@
 
         <?php echo render_show(__('Category of relationship'), 
render_value($item->type)) ?>
 
-        <?php if (null !== $note = 
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DESCRIPTION_ID)): ?>
-          <?php echo render_show(__('Description of relationship'), 
render_value($note->getContent(array('cultureFallback' => true)))) ?>
-        <?php endif; ?>
+        <?php echo render_show(__('Description of relationship'), 
render_value($item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DESCRIPTION_ID))) 
?>
 
-        <div class="field">
-          <h3><?php echo __('Dates of relationship') ?></h3>
-          <div>
-            <?php if (null !== $note = 
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID)): ?>
-              <?php echo 
render_value($note->getContent(array('cultureFallback' => true))) ?>
-            <?php elseif (1 < count($dateArray = $relation->getDates())): ?>
-              <?php echo __('%1% - %2%', array('%1%' => 
Qubit::renderDate($dateArray['start']), '%2%' => 
Qubit::renderDate($dateArray['end']))) ?>
-            <?php else: ?>
-              <?php echo Qubit::renderDate(array_shift($dateArray)) ?>
-            <?php endif; ?>
-          </div>
-        </div>
+        <?php echo render_show(__('Dates of relationship'), 
Qubit::renderDateStartEnd($item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID),
 $item->startDate, $item->endDate)) ?>
 
       </div>
     </div>
@@ -113,18 +100,7 @@
           <?php echo render_show(__('Nature of relationship'), 
render_value($note->getContent(array('cultureFallback' => true)))) ?>
         <?php endif; ?>
 
-        <div class="field">
-          <h3><?php echo __('Dates of the relationship') ?></h3>
-          <div>
-            <?php if (null !== $note = 
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID)): ?>
-              <?php echo 
render_value($note->getContent(array('cultureFallback' => true))) ?>
-            <?php elseif (1 < count($dateArray = $item->getDates())): ?>
-              <?php echo __('%1% - %2%', array('%1%' => 
Qubit::renderDate($dateArray['start']), '%2%' => 
Qubit::renderDate($dateArray['end']))) ?>
-            <?php else: ?>
-              <?php echo Qubit::renderDate(array_shift($dateArray)) ?>
-            <?php endif; ?>
-          </div>
-        </div>
+        <?php echo render_show(__('Dates of the relationship'), 
Qubit::renderDateStartEnd($item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID),
 $item->startDate, $item->endDate)) ?>
 
       </div>
     </div>
@@ -144,18 +120,7 @@
           <?php echo render_show(__('Nature of relationship'), 
render_value($note->getContent(array('cultureFallback' => true)))) ?>
         <?php endif; ?>
 
-        <div class="field">
-          <h3><?php echo __('Dates of the relationship') ?></h3>
-          <div>
-            <?php if (null !== $note = 
$item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID)): ?>
-              <?php echo 
render_value($note->getContent(array('cultureFallback' => true))) ?>
-            <?php elseif (1 < count($item->getDates())): ?>
-              <?php echo __('%1% - %2%', array('%1%' => 
Qubit::renderDate($dateArray['start']), '%2%' => 
Qubit::renderDate($dateArray['end']))) ?>
-            <?php else: ?>
-              <?php echo Qubit::renderDate(array_shift($dateArray)) ?>
-            <?php endif; ?>
-          </div>
-        </div>
+        <?php echo render_show(__('Dates of the relationship'), 
Qubit::renderDateStartEnd($item->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID),
 $item->startDate, $item->endDate)) ?>
 
       </div>
     </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