本文整理汇总了PHP中Opus_Document::getType方法的典型用法代码示例。如果您正苦于以下问题:PHP Opus_Document::getType方法的具体用法?PHP Opus_Document::getType怎么用?PHP Opus_Document::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Opus_Document
的用法示例。
在下文中一共展示了Opus_Document::getType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDocType
/**
* Returns document type.
* @return string
*/
public function getDocType()
{
try {
return htmlspecialchars($this->document->getType());
} catch (Exception $e) {
return 'undefined';
}
}
示例2: testGetRecordOaiDcDoc91DocType
/**
* Regression test for OPUSVIER-2379
*/
public function testGetRecordOaiDcDoc91DocType()
{
$doc = new Opus_Document(91);
$this->assertEquals("report", $doc->getType(), "testdata changed");
$this->dispatch('/oai?verb=GetRecord&metadataPrefix=oai_dc&identifier=oai::91');
$this->assertResponseCode(200);
$response = $this->getResponse();
$badStrings = array("Exception", "Error", "Stacktrace", "badVerb");
$this->checkForCustomBadStringsInHtml($response->getBody(), $badStrings);
$xpath = $this->prepareXpathFromResultString($response->getBody());
// Regression test for OPUSVIER-2379 (show doc-type:report)
$elements = $xpath->query('//oai_dc:dc/dc:type[text()="doc-type:report"]');
$this->assertEquals(1, $elements->length, "Unexpected count for doc-type:report");
}
示例3: ucfirst
echo "parameter --enrichment not specified; function will now exit" . PHP_EOL;
exit;
} else {
$enrichmentField = $options['enrichment'];
}
$getType = 'getTitle' . ucfirst(strtolower($options['type']));
$addType = 'addTitle' . ucfirst(strtolower($options['type']));
if ($dryrun) {
_log("TEST RUN: NO DATA WILL BE MODIFIED");
}
$docFinder = new Opus_DocumentFinder();
$docIds = $docFinder->setEnrichmentKeyExists($enrichmentField)->ids();
_log(count($docIds) . " documents found");
foreach ($docIds as $docId) {
$doc = new Opus_Document($docId);
if ($doc->getType() == $doctype || $doctype == '') {
$enrichments = $doc->getEnrichment();
foreach ($enrichments as $enrichment) {
$enrichmentArray = $enrichment->toArray();
if ($enrichmentArray['KeyName'] == $enrichmentField) {
$titles = $doc->{$getType}();
if (count($titles) > 0) {
_log('Title ' . ucfirst(strtolower($options['type'])) . ' already exists for Document #' . $docId . '. Skipping.. ');
} else {
$title = $doc->{$addType}();
$title->setValue($enrichmentArray['Value']);
if (!$dryrun) {
$doc->store();
}
_log('Document #' . $docId . ' updated');
}
示例4: populateFromModel
/**
* Befuellt das Formular anhand der Metadaten eines Dokuments.
* @param Opus_Document $document
*/
public function populateFromModel($document)
{
$datesHelper = $this->getDatesHelper();
$this->getElement(self::ELEMENT_LANGUAGE)->setValue($document->getLanguage());
$this->getElement(self::ELEMENT_TYPE)->setValue($document->getType());
$date = $datesHelper->getDateString($document->getCompletedDate());
$this->getElement(self::ELEMENT_COMPLETED_DATE)->setValue($date);
$this->getElement(self::ELEMENT_COMPLETED_YEAR)->setValue($document->getCompletedYear());
$date = $datesHelper->getDateString($document->getPublishedDate());
$this->getElement(self::ELEMENT_PUBLISHED_DATE)->setValue($date);
$this->getElement(self::ELEMENT_PUBLISHED_YEAR)->setValue($document->getPublishedYear());
$date = $datesHelper->getDateString($document->getEmbargoDate());
$this->getElement(self::ELEMENT_EMBARGO_DATE)->setValue($date);
}
示例5: getTemplateForDocument
/**
*
* @param Opus_Document $document
* @throws CitationExport_Module_Exception in case of an invalid parameter value
*
* @return string
*/
public function getTemplateForDocument($document, $outputFormat)
{
if (is_null($outputFormat)) {
throw new CitationExport_Model_Exception('invalid_format');
}
$stylesheetsAvailable = $this->getAvailableStylesheets();
// check for document type specific stylesheet
$pos = array_search($outputFormat . '_' . $document->getType(), $stylesheetsAvailable);
if ($pos !== FALSE) {
return $stylesheetsAvailable[$pos] . '.xslt';
}
// check for generic stylesheet for format
$pos = array_search($outputFormat, $stylesheetsAvailable);
if ($pos !== FALSE) {
return $stylesheetsAvailable[$pos] . '.xslt';
}
// no applicable stylesheet found
throw new CitationExport_Model_Exception('invalid_format');
}
示例6: getTemplateForDocument
/**
*
* @param Opus_Document $document
* @throws CitationExport_Module_Exception in case of an invalid parameter value
*
* @return string
*/
private function getTemplateForDocument($document)
{
$outputFormat = $this->getRequest()->getParam('output');
if (is_null($outputFormat)) {
throw new CitationExport_Model_Exception('invalid_format');
}
$stylesheetsAvailable = array();
$dir = new DirectoryIterator($this->view->getScriptPath('index'));
foreach ($dir as $file) {
if ($file->isFile() && $file->getFilename() != '.' && $file->getFilename() != '..' && $file->isReadable()) {
array_push($stylesheetsAvailable, $file->getBasename('.xslt'));
}
}
$pos = array_search($outputFormat . '_' . $document->getType(), $stylesheetsAvailable);
if ($pos !== FALSE) {
return $stylesheetsAvailable[$pos] . '.xslt';
}
$pos = array_search($outputFormat, $stylesheetsAvailable);
if ($pos !== FALSE) {
return $stylesheetsAvailable[$pos] . '.xslt';
}
throw new CitationExport_Model_Exception('invalid_format');
}