本文整理匯總了PHP中Opus_Document::setLicence方法的典型用法代碼示例。如果您正苦於以下問題:PHP Opus_Document::setLicence方法的具體用法?PHP Opus_Document::setLicence怎麽用?PHP Opus_Document::setLicence使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Opus_Document
的用法示例。
在下文中一共展示了Opus_Document::setLicence方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: randString
$doc->setThesisPublisher($dnbInstitute);
//
// Subjects
//
$doc->addSubject()->setType('swd')->setValue(randString($counter++));
foreach (array('uncontrolled', 'msc', 'ddc') as $type) {
$doc->addSubject()->setType($type)->setLanguage(randString($counter++))->setValue(randString($counter++))->setExternalKey(randString($counter++));
$doc->addSubject()->setType($type)->setLanguage("eng" . randString($counter++))->setValue(randString($counter++))->setExternalKey(randString($counter++));
$doc->addSubject()->setType($type)->setLanguage("deu")->setValue(randString($counter++))->setExternalKey(randString($counter++));
$doc->addSubject()->setType($type)->setLanguage("eng")->setValue(randString($counter++))->setExternalKey(randString($counter++));
}
//
// Notes
//
$doc->addNote()->setVisibility('public')->setMessage(randString($counter++));
$doc->addNote()->setVisibility('private')->setMessage(randString($counter++));
//
// Licenses
//
$lic = new Opus_Licence();
$lic->setActive(1);
$lic->setLanguage('deu' . randString($counter++));
$lic->setLinkLicence(randString($counter++));
$lic->setNameLong(randString($counter++));
$lic->store();
$doc->setLicence($lic);
//
// Storing...
//
$doc->store();
print "Document stored. ID: " . $doc->getId() . "\n";
示例2: updateModel
/**
* Aktualisiert die Liste der Lizenzen fuer ein Dokument.
* @param Opus_Document $document
*/
public function updateModel($document)
{
$licences = $this->getElements();
$docLicences = array();
foreach ($licences as $element) {
if ($element instanceof Zend_Form_Element_Checkbox) {
$licenceId = $element->getCheckedValue();
if ($element->getValue() !== '0') {
$docLicences[] = new Opus_Licence($licenceId);
}
}
}
$document->setLicence($docLicences);
}