Author: peter
Date: Mon Sep 14 16:56:49 2009
New Revision: 3291
Log:
move MODS XML export to use a Symfony template in the informationobject module
Added:
trunk/apps/qubit/modules/informationobject/actions/exportModsAction.class.php
(contents, props changed)
trunk/apps/qubit/modules/informationobject/templates/exportModsSuccess.xml.php
(contents, props changed)
Modified:
trunk/apps/qubit/config/routing.yml
Modified: trunk/apps/qubit/config/routing.yml
==============================================================================
--- trunk/apps/qubit/config/routing.yml Mon Sep 14 16:53:09 2009 (r3290)
+++ trunk/apps/qubit/config/routing.yml Mon Sep 14 16:56:49 2009 (r3291)
@@ -134,6 +134,10 @@
param:
action: exportDc
+exportMods:
+ url: /:module/export/mods/:id
+ param: { action: exportMods }
+
actorCreate:
url: /actor/create/:actor_template
param:
Added:
trunk/apps/qubit/modules/informationobject/actions/exportModsAction.class.php
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++
trunk/apps/qubit/modules/informationobject/actions/exportModsAction.class.php
Mon Sep 14 16:56:49 2009 (r3291)
@@ -0,0 +1,39 @@
+<?php
+
+/*
+ * This file is part of Qubit Toolkit.
+ *
+ * Qubit Toolkit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Qubit Toolkit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Qubit Toolkit. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * Information Object - exportModsXml
+ *
+ * @package qubit
+ * @subpackage informationObject - initialize an exportModsXml template for
exporting an information object
+ * @author Peter Van Garderen <[email protected]>
+ * @version SVN: $Id$
+ */
+
+class InformationObjectExportModsAction extends InformationObjectShowAction
+{
+ public function execute($request)
+ {
+ // run the core informationObject show action commands
+ parent::execute($request);
+
+ // set request format to xml
+ $request->setRequestFormat('xml');
+ }
+}
Added:
trunk/apps/qubit/modules/informationobject/templates/exportModsSuccess.xml.php
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++
trunk/apps/qubit/modules/informationobject/templates/exportModsSuccess.xml.php
Mon Sep 14 16:56:49 2009 (r3291)
@@ -0,0 +1,56 @@
+<?php echo '<?' ?>xml version="1.0" encoding="utf-8" ?>
+
+<mods xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.loc.gov/mods/v3"
+ xsi:schemaLocation="http://www.loc.gov/standards/mods/v3/mods-3-3.xsd"
+ version="3.3">
+
+<titleInfo><title><?php echo htmlentities($informationObject->getTitle())
?></title></titleInfo>
+<?php if (count($modsNames = QubitMods::getNames($informationObject)) > 0): ?>
+ <?php foreach ($modsNames as $modsName): ?>
+<name type="<?php echo $modsName->getActor()->getEntityType()?>">
+ <namePart><?php echo $modsName->getActor() ?></namePart>
+ <role><?php echo $modsName->getType()->getRole() ?></role>
+</name><?php endforeach; ?><?php endif; ?>
+<?php if (count($modsTypes = QubitMods::getTypes($informationObject)) > 0): ?>
+ <?php foreach ($modsTypes as $modsType): ?>
+<typeOfResource><?php echo $modsType->getTerm() ?></typeOfResource><?php
endforeach; ?><?php endif; ?>
+<?php if (count($dates = $informationObject->getDates()) > 0) : ?>
+<originInfo><?php foreach ($dates as $date): ?><?php if ($place =
$date->getPlace()): ?>
+<place><?php echo $place ?></place><?php endif; ?>
+ <?php if ($date->getTypeId() == QubitTerm::CREATION_ID): ?>
+<dateCreated><?php echo $date->getDateDisplay(array('cultureFallback' =>
true)) ?></dateCreated>
+ <?php elseif ($date->getTypeId() == QubitTerm::PUBLICATION_ID): ?>
+<dateIssued><?php echo $date->getDateDisplay(array('cultureFallback' => true))
?></dateIssued>
+ <?php else: ?>
+<dateOther><?php echo $date->getDateDisplay(array('cultureFallback' => true))
?><?php echo ' ('.$date->getType().')' ?></dateOther><?php endif; ?><?php
endforeach; ?>
+</originInfo><?php endif; ?>
+<?php if (count($languageCodes =
QubitMods::getLanguageCodes($informationObject)) > 0) : ?>
+ <?php foreach ($languageCodes as $languageCode): ?>
+<language><?php echo
format_language($languageCode->getValue(array('sourceCulture'=>true)));
?></language><?php endforeach; ?><?php endif; ?>
+<?php if ($digitalObject = QubitMODS::getDigitalObject($informationObject)):
?><?php if ($digitalObject->getMimeType()): ?>
+<physicalDescription><internetMediaType><?php echo
$digitalObject->getMimeType() ?></internetMediaType></physicalDescription><?php
endif; ?><?php endif; ?>
+<?php if (count($subjectAccessPoints =
$informationObject->getSubjectAccessPoints()) > 0) : ?>
+ <?php foreach ($subjectAccessPoints as $subject): ?>
+<subject><?php echo $subject->getTerm() ?></subject><?php endforeach; ?><?php
endif; ?>
+<?php if ($informationObject->getIdentifier()): ?>
+<identifier><?php echo
htmlentities(QubitDc::getIdentifier($informationObject)) ?></identifier><?php
endif; ?>
+<?php if ((QubitMODS::getDigitalObject($informationObject)) ||
($informationObject->getRepository())): ?>
+<location><?php if ($digitalObject =
QubitMODS::getDigitalObject($informationObject)): ?><url usage="primary
display">http://<?php echo
$sf_request->getHost().$sf_request->getRelativeUrlRoot().$digitalObject->getFullPath()
?></url><?php endif; ?>
+ <?php if ($repository = $informationObject->getRepository()): ?>
+ <?php if ($repository->getIdentifier()): ?>
+<physicalLocation><?php echo $repository->getIdentifier()
?></physicalLocation><?php endif; ?><?php if ($repository->__toString()): ?>
<physicalLocation><?php echo $repository->__toString()
?></physicalLocation><?php endif; ?>
+<?php if ($contactInformation = $repository->getPrimaryContact()): ?>
+<physicalLocation><?php echo $contactInformation->getCity() ?><?php if
($contactInformation->getCity()): ?><?php echo ', '?><?php endif; ?><?php echo
$contactInformation->getRegion() ?><?php if ($contactInformation->getRegion()
&& $contactInformation->getCountryCode()): ?><?php echo ', ' ?><?php endif;
?><?php echo format_country($contactInformation->getCountryCode())
?></physicalLocation><?php endif; ?><?php endif; ?>
+</location><?php endif; ?>
+<?php if (count($children = $informationObject->getChildren()) > 0): ?>
+ <?php foreach ($children as $relatedItem): ?>
+<relatedItem type="constituent" ID="<?php echo $relatedItem->getIdentifier()
?>"><?php echo QubitMods::getLabel($relatedItem); ?></relatedItem> <?php
endforeach; ?><?php endif; ?>
+<?php if (strlen($value =
$informationObject->getAccessConditions(array('cultureFallback' => true))) > 0)
: ?><accessCondition><?php echo nl2br($value) ?></accessCondition><?php endif;
?>
+<recordInfo>
+<recordCreationDate><?php echo $informationObject->getCreatedAt()
?></recordCreationDate>
+<?php if ($informationObject->getCreatedAt() !=
$informationObject->getUpdatedAt()): ?>
+<recordChangeDate><?php echo $informationObject->getUpdatedAt()
?></recordChangeDate><?php endif; ?>
+</recordInfo>
+</mods>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---