Author: jablko
Date: Sat Aug 29 17:03:57 2009
New Revision: 3122
Log:
Take stab at factoring common pattern from show templates into render_show()
helper
Modified:
trunk/apps/qubit/lib/helper/QubitHelper.php
trunk/apps/qubit/modules/informationobject/templates/showDcSuccess.php
trunk/apps/qubit/modules/informationobject/templates/showIsadSuccess.php
trunk/apps/qubit/modules/informationobject/templates/showRadSuccess.php
Modified: trunk/apps/qubit/lib/helper/QubitHelper.php
==============================================================================
--- trunk/apps/qubit/lib/helper/QubitHelper.php Sat Aug 29 16:16:34 2009
(r3121)
+++ trunk/apps/qubit/lib/helper/QubitHelper.php Sat Aug 29 17:03:57 2009
(r3122)
@@ -78,6 +78,23 @@
EOF;
}
+function render_show($label, $value)
+{
+ if (0 < strlen($value))
+ {
+ return <<<EOF
+<tr>
+ <th>
+ $label
+ </th><td>
+ $value
+ </td>
+</tr>
+
+EOF;
+ }
+}
+
function render_title($object)
{
// TODO: Workaround for PHP bug: http://bugs.php.net/bug.php?id=47522
Modified: trunk/apps/qubit/modules/informationobject/templates/showDcSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/showDcSuccess.php
Sat Aug 29 16:16:34 2009 (r3121)
+++ trunk/apps/qubit/modules/informationobject/templates/showDcSuccess.php
Sat Aug 29 17:03:57 2009 (r3122)
@@ -119,12 +119,7 @@
<?php endif; ?>
<?php endif; ?>
-<?php if (0 < strlen($value =
$informationObject->getPropertyByName('relation', array('scope' =>
'dc'))->value)): ?>
- <tr>
- <th><?php echo __('relation') ?></th>
- <td><?php echo $value ?></td>
- </tr>
-<?php endif; ?>
+<?php echo render_show(__('relation'),
$informationObject->getPropertyByName('relation', array('scope' =>
'dc'))->value) ?>
<?php if (0 < count($informationObject->language)): ?>
<?php foreach ($informationObject->language as $code): ?>
Modified:
trunk/apps/qubit/modules/informationobject/templates/showIsadSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/showIsadSuccess.php
Sat Aug 29 16:16:34 2009 (r3121)
+++ trunk/apps/qubit/modules/informationobject/templates/showIsadSuccess.php
Sat Aug 29 17:03:57 2009 (r3122)
@@ -430,10 +430,7 @@
<td><?php echo
$informationObject->getDescriptionIdentifier(array('cultureFallback' => true))
?></td></tr>
<?php endif; ?>
-<?php if (0 < strlen($value =
$informationObject->getInstitutionResponsibleIdentifier(array('cultureFallback'
=> true)))): ?>
- <tr><th><?php echo __('institution identifier') ?></th>
- <td><?php echo $value ?></td></tr>
-<?php endif; ?>
+<?php echo render_show(__('institution identifier'),
$informationObject->getInstitutionResponsibleIdentifier(array('cultureFallback'
=> true))) ?>
<?php if (0 < strlen($value =
$informationObject->getRules(array('cultureFallback' => true)))): ?>
<tr><th><?php echo __('rules') ?></th>
Modified:
trunk/apps/qubit/modules/informationobject/templates/showRadSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/showRadSuccess.php
Sat Aug 29 16:16:34 2009 (r3121)
+++ trunk/apps/qubit/modules/informationobject/templates/showRadSuccess.php
Sat Aug 29 17:03:57 2009 (r3122)
@@ -30,12 +30,7 @@
<?php endif; ?>
<!-- title and statement of responsibility area -->
-<?php if (0 < strlen($value =
$informationObject->getTitle(array('cultureFallback' => true)))): ?>
- <tr>
- <th><?php echo __('title proper') ?></th>
- <td><?php echo $value ?></td>
- </tr>
-<?php endif; ?>
+<?php echo render_show(__('title proper'),
$informationObject->getTitle(array('cultureFallback' => true))) ?>
<?php if (0 < count($informationObject->getMaterialTypes())): ?>
<tr>
@@ -51,26 +46,11 @@
</tr>
<?php endif; ?>
-<?php if (0 < strlen($value =
$informationObject->getAlternateTitle(array('cultureFallback' => true)))): ?>
- <tr>
- <th><?php echo __('parallel title') ?></th>
- <td><?php echo $value ?></td>
- </tr>
-<?php endif; ?>
+<?php echo render_show(__('parallel title'),
$informationObject->getAlternateTitle(array('cultureFallback' => true))) ?>
-<?php if (0 < strlen($value =
$informationObject->getPropertyByName('otherTitleInformation', array('scope' =>
'rad'))->getValue(array('cultureFallback' => true)))): ?>
- <tr>
- <th><?php echo __('other title information') ?></th>
- <td><?php echo $value ?></td>
- </tr>
-<?php endif; ?>
+<?php echo render_show(__('other title information'),
$informationObject->getPropertyByName('otherTitleInformation', array('scope' =>
'rad'))->getValue(array('cultureFallback' => true))) ?>
-<?php if (0 < strlen($value =
$informationObject->getPropertyByName('titleStatementOfResponsibility',
array('scope' => 'rad'))->getValue(array('cultureFallback' => true)))): ?>
- <tr>
- <th><?php echo __('title statements of responsibility') ?></th>
- <td><?php echo $value ?></td>
- </tr>
-<?php endif; ?>
+<?php echo render_show(__('title statements of responsibility'),
$informationObject->getPropertyByName('titleStatementOfResponsibility',
array('scope' => 'rad'))->getValue(array('cultureFallback' => true))) ?>
<?php if (0 < count($titleNotes)): ?>
<tr>
@@ -109,56 +89,21 @@
<!-- End title and statement of responsibility area -->
<!-- Edition area -->
-<?php if (0 < strlen($value =
$informationObject->getEdition(array('cultureFallback' => true)))): ?>
- <tr>
- <th><?php echo __('edition statement') ?></th>
- <td><?php echo $value ?></td>
- </tr>
-<?php endif; ?>
+<?php echo render_show(__('edition statement'),
$informationObject->getEdition(array('cultureFallback' => true))) ?>
-<?php if (0 < strlen($value =
$informationObject->getPropertyByName('editionStatementOfResponsibility',
array('scope' => 'rad'))->getValue(array('cultureFallback' => true)))): ?>
- <tr>
- <th><?php echo __('edition statement of responsibility') ?></th>
- <td><?php echo $value ?></td>
- </tr>
-<?php endif; ?>
+<?php echo render_show(__('edition statement of responsibility'),
$informationObject->getPropertyByName('editionStatementOfResponsibility',
array('scope' => 'rad'))->getValue(array('cultureFallback' => true))) ?>
<!-- End edition area -->
<!-- Class of material specific details area -->
-<?php if (0 < strlen($value =
$informationObject->getPropertyByName('statementOfScaleCartographic',
array('scope' => 'rad'))->getValue(array('cultureFallback' => true)))): ?>
- <tr>
- <th><?php echo __('statement of scale (cartographic)') ?></th>
- <td><?php echo $value ?></td>
- </tr>
-<?php endif; ?>
+<?php echo render_show(__('statement of scale (cartographic)'),
$informationObject->getPropertyByName('statementOfScaleCartographic',
array('scope' => 'rad'))->getValue(array('cultureFallback' => true))) ?>
-<?php if (0 < strlen($value =
$informationObject->getPropertyByName('statementOfProjection', array('scope' =>
'rad'))->getValue(array('cultureFallback' => true)))): ?>
- <tr>
- <th><?php echo __('statement of projection (cartographic)') ?></th>
- <td><?php echo $value ?></td>
- </tr>
-<?php endif; ?>
+<?php echo render_show(__('statement of projection (cartographic)'),
$informationObject->getPropertyByName('statementOfProjection', array('scope' =>
'rad'))->getValue(array('cultureFallback' => true))) ?>
-<?php if (0 < strlen($value =
$informationObject->getPropertyByName('statementOfCoordinates', array('scope'
=> 'rad'))->getValue(array('cultureFallback' => true)))): ?>
- <tr>
- <th><?php echo __('statement of coordinates (cartographic)') ?></th>
- <td><?php echo $value ?></td>
- </tr>
-<?php endif; ?>
+<?php echo render_show(__('statement of coordinates (cartographic)'),
$informationObject->getPropertyByName('statementOfCoordinates', array('scope'
=> 'rad'))->getValue(array('cultureFallback' => true))) ?>
-<?php if (0 < strlen($value =
$informationObject->getPropertyByName('statementOfScaleArchitectural',
array('scope' => 'rad'))->getValue(array('cultureFallback' => true)))): ?>
- <tr>
- <th><?php echo __('statement of scale (architectural)') ?></th>
- <td><?php echo $value ?></td>
- </tr>
-<?php endif; ?>
+<?php echo render_show(__('statement of scale (architectural)'),
$informationObject->getPropertyByName('statementOfScaleArchitectural',
array('scope' => 'rad'))->getValue(array('cultureFallback' => true))) ?>
-<?php if (0 < strlen($value =
$informationObject->getPropertyByName('issuingJursidictionAndDenomination',
array('scope' => 'rad'))->getValue(array('cultureFallback' => true)))): ?>
- <tr>
- <th><?php echo __('issuing jurisdiction and denomination (philatelic)')
?></th>
- <td><?php echo $value ?></td>
- </tr>
-<?php endif; ?>
+<?php echo render_show(__('issuing jurisdiction and denomination
(philatelic)'),
$informationObject->getPropertyByName('issuingJursidictionAndDenomination',
array('scope' => 'rad'))->getValue(array('cultureFallback' => true))) ?>
<!-- End class of material specific details area -->
<!-- Dates of creation area -->
@@ -224,47 +169,17 @@
<!-- End physical description area -->
<!-- Publisher's series area -->
-<?php if (0 < strlen($value =
$informationObject->getPropertyByName('titleProperOfPublishersSeries',
array('scope' => 'rad'))->getValue(array('cultureFallback' => true)))): ?>
- <tr>
- <th><?php echo __('title proper of publisher\'s series') ?></th>
- <td><?php echo $value ?></td>
- </tr>
-<?php endif; ?>
+<?php echo render_show(__('title proper of publisher\'s series'),
$informationObject->getPropertyByName('titleProperOfPublishersSeries',
array('scope' => 'rad'))->getValue(array('cultureFallback' => true))) ?>
-<?php if (0 < strlen($value =
$informationObject->getPropertyByName('parallelTitlesOfPublishersSeries',
array('scope' => 'rad'))->getValue(array('cultureFallback' => true)))): ?>
- <tr>
- <th><?php echo __('parallel titles of publisher\'s series') ?></th>
- <td><?php echo $value ?></td>
- </tr>
-<?php endif; ?>
+<?php echo render_show(__('parallel titles of publisher\'s series'),
$informationObject->getPropertyByName('parallelTitlesOfPublishersSeries',
array('scope' => 'rad'))->getValue(array('cultureFallback' => true))) ?>
-<?php if (0 < strlen($value =
$informationObject->getPropertyByName('otherTitleInformationOfPublishersSeries',
array('scope' => 'rad'))->getValue(array('cultureFallback' => true)))): ?>
- <tr>
- <th><?php echo __('other title information of publisher\'s series') ?></th>
- <td><?php echo $value ?></td>
- </tr>
-<?php endif; ?>
+<?php echo render_show(__('other title information of publisher\'s series'),
$informationObject->getPropertyByName('otherTitleInformationOfPublishersSeries',
array('scope' => 'rad'))->getValue(array('cultureFallback' => true))) ?>
-<?php if (0 < strlen($value =
$informationObject->getPropertyByName('statementOfResponsibilityRelatingToPublishersSeries',
array('scope' => 'rad'))->getValue(array('cultureFallback' => true)))): ?>
- <tr>
- <th><?php echo __('statement of responsibility relating to publisher\'s
series') ?></th>
- <td><?php echo $value ?></td>
- </tr>
-<?php endif; ?>
+<?php echo render_show(__('statement of responsibility relating to
publisher\'s series'),
$informationObject->getPropertyByName('statementOfResponsibilityRelatingToPublishersSeries',
array('scope' => 'rad'))->getValue(array('cultureFallback' => true))) ?>
-<?php if (0 < strlen($value =
$informationObject->getPropertyByName('numberingWithinPublishersSeries',
array('scope' => 'rad'))->getValue(array('cultureFallback' => true)))): ?>
- <tr>
- <th><?php echo __('numbering within publisher\'s series') ?></th>
- <td><?php echo $value ?></td>
- </tr>
-<?php endif; ?>
+<?php echo render_show(__('numbering within publisher\'s series'),
$informationObject->getPropertyByName('numberingWithinPublishersSeries',
array('scope' => 'rad'))->getValue(array('cultureFallback' => true))) ?>
-<?php if (0 < strlen($value =
$informationObject->getPropertyByName('noteOnPublishersSeries', array('scope'
=> 'rad'))->getValue(array('cultureFallback' => true)))): ?>
- <tr>
- <th><?php echo __('Note on publisher\'s series') ?></th>
- <td><?php echo $value ?></td>
- </tr>
-<?php endif; ?>
+<?php echo render_show(__('Note on publisher\'s series'),
$informationObject->getPropertyByName('noteOnPublishersSeries', array('scope'
=> 'rad'))->getValue(array('cultureFallback' => true))) ?>
<!-- End publisher's series area -->
<!-- Archival description area -->
@@ -402,12 +317,7 @@
<!-- End notes area -->
<!-- Standard number area -->
-<?php if (0 < strlen($value =
$informationObject->getPropertyByName('standardNumber', array('scope' =>
'rad'))->getValue(array('cultureFallback' => true)))): ?>
- <tr>
- <th><?php echo __('standard number') ?></th>
- <td><?php echo $value ?></td>
- </tr>
-<?php endif; ?>
+<?php echo render_show(__('standard number'),
$informationObject->getPropertyByName('standardNumber', array('scope' =>
'rad'))->getValue(array('cultureFallback' => true))) ?>
<!-- End standard number area -->
<!-- Access Points -->
@@ -462,12 +372,7 @@
</tr>
<?php endif; ?>
-<?php if (0 < strlen($value =
$informationObject->getInstitutionResponsibleIdentifier(array('cultureFallback'
=> true)))): ?>
- <tr>
- <th><?php echo __('institution identifier') ?></th>
- <td><?php echo $value ?></td>
- </tr>
-<?php endif; ?>
+<?php echo render_show(__('institution identifier'),
$informationObject->getInstitutionResponsibleIdentifier(array('cultureFallback'
=> true))) ?>
<?php if (0 < strlen($value =
$informationObject->getRules(array('cultureFallback' => true)))): ?>
<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.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---