本文整理汇总了PHP中Issue::setNumber方法的典型用法代码示例。如果您正苦于以下问题:PHP Issue::setNumber方法的具体用法?PHP Issue::setNumber怎么用?PHP Issue::setNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Issue
的用法示例。
在下文中一共展示了Issue::setNumber方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: importIssue
function importIssue(&$journal, &$issueNode, &$issue, &$errors, &$user, $isCommandLine, &$dependentItems, $cleanupErrors = true)
{
$errors = array();
$issue = null;
$hasErrors = false;
$issueDao =& DAORegistry::getDAO('IssueDAO');
$issue = new Issue();
$issue->setJournalId($journal->getId());
$journalSupportedLocales = array_keys($journal->getSupportedLocaleNames());
// => journal locales must be set up before
$journalPrimaryLocale = $journal->getPrimaryLocale();
/* --- Set title, description, volume, number, and year --- */
$titleExists = false;
for ($index = 0; $node = $issueNode->getChildByName('title', $index); $index++) {
$locale = $node->getAttribute('locale');
if ($locale == '') {
$locale = $journalPrimaryLocale;
} elseif (!in_array($locale, $journalSupportedLocales)) {
$errors[] = array('plugins.importexport.native.import.error.issueTitleLocaleUnsupported', array('issueTitle' => $node->getValue(), 'locale' => $locale));
$hasErrors = true;
continue;
}
$issue->setTitle($node->getValue(), $locale);
$titleExists = true;
}
for ($index = 0; $node = $issueNode->getChildByName('description', $index); $index++) {
$locale = $node->getAttribute('locale');
if ($locale == '') {
$locale = $journalPrimaryLocale;
} elseif (!in_array($locale, $journalSupportedLocales)) {
$errors[] = array('plugins.importexport.native.import.error.issueDescriptionLocaleUnsupported', array('issueTitle' => $issue->getLocalizedTitle(), 'locale' => $locale));
$hasErrors = true;
continue;
}
$issue->setDescription($node->getValue(), $locale);
}
if ($node = $issueNode->getChildByName('volume')) {
$issue->setVolume($node->getValue());
}
if ($node = $issueNode->getChildByName('number')) {
$issue->setNumber($node->getValue());
}
if ($node = $issueNode->getChildByName('year')) {
$issue->setYear($node->getValue());
}
/* --- Set date published --- */
if ($node = $issueNode->getChildByName('date_published')) {
$publishedDate = strtotime($node->getValue());
if ($publishedDate === -1) {
$errors[] = array('plugins.importexport.native.import.error.invalidDate', array('value' => $node->getValue()));
if ($cleanupErrors) {
NativeImportDom::cleanupFailure($dependentItems);
}
return false;
} else {
$issue->setDatePublished($publishedDate);
}
}
/* --- Set attributes: Identification type, published, current, public ID --- */
switch ($value = $issueNode->getAttribute('identification')) {
case 'num_vol_year':
$issue->setShowVolume(1);
$issue->setShowNumber(1);
$issue->setShowYear(1);
$issue->setShowTitle(0);
break;
case 'vol_year':
$issue->setShowVolume(1);
$issue->setShowNumber(0);
$issue->setShowYear(1);
$issue->setShowTitle(0);
break;
case 'vol':
$issue->setShowVolume(1);
$issue->setShowNumber(0);
$issue->setShowYear(0);
$issue->setShowTitle(0);
break;
case 'year':
$issue->setShowVolume(0);
$issue->setShowNumber(0);
$issue->setShowYear(1);
$issue->setShowTitle(0);
break;
case 'title':
case '':
case null:
$issue->setShowVolume(0);
$issue->setShowNumber(0);
$issue->setShowYear(0);
$issue->setShowTitle(1);
break;
default:
$errors[] = array('plugins.importexport.native.import.error.unknownIdentificationType', array('identificationType' => $value, 'issueTitle' => $issue->getLocalizedTitle()));
$hasErrors = true;
break;
}
if (($issueNode->getAttribute('identification') == 'title' || $issueNode->getAttribute('identification') == '') && !$titleExists) {
$errors[] = array('plugins.importexport.native.import.error.titleMissing', array());
// Set a placeholder title so that further errors are
//.........这里部分代码省略.........
示例2: Issue
/**
* creates and returns an issue object from a row
* @param $row array
* @return Issue object
*/
function &_returnIssueFromRow($row)
{
$issue = new Issue();
$issue->setId($row['issue_id']);
$issue->setJournalId($row['journal_id']);
$issue->setVolume($row['volume']);
$issue->setNumber($row['number']);
$issue->setYear($row['year']);
$issue->setPublished($row['published']);
$issue->setCurrent($row['current']);
$issue->setDatePublished($this->datetimeFromDB($row['date_published']));
$issue->setDateNotified($this->datetimeFromDB($row['date_notified']));
$issue->setAccessStatus($row['access_status']);
$issue->setOpenAccessDate($this->datetimeFromDB($row['open_access_date']));
$issue->setPublicIssueId($row['public_issue_id']);
$issue->setShowVolume($row['show_volume']);
$issue->setShowNumber($row['show_number']);
$issue->setShowYear($row['show_year']);
$issue->setShowTitle($row['show_title']);
$issue->setStyleFileName($row['style_file_name']);
$issue->setOriginalStyleFileName($row['original_style_file_name']);
$this->getDataObjectSettings('issue_settings', 'issue_id', $row['issue_id'], $issue);
HookRegistry::call('IssueDAO::_returnIssueFromRow', array(&$issue, &$row));
return $issue;
}
示例3: execute
/**
* Save issue settings.
*/
function execute($issueId = 0)
{
$journal =& Request::getJournal();
$issueDao =& DAORegistry::getDAO('IssueDAO');
if ($issueId) {
$issue = $issueDao->getIssueById($issueId);
$isNewIssue = false;
} else {
$issue = new Issue();
$isNewIssue = true;
}
$volume = $this->getData('volume');
$number = $this->getData('number');
$year = $this->getData('year');
$showVolume = $this->getData('showVolume');
$showNumber = $this->getData('showNumber');
$showYear = $this->getData('showYear');
$showTitle = $this->getData('showTitle');
$issue->setJournalId($journal->getId());
$issue->setTitle($this->getData('title'), null);
// Localized
$issue->setVolume(empty($volume) ? 0 : $volume);
$issue->setNumber(empty($number) ? 0 : $number);
$issue->setYear(empty($year) ? 0 : $year);
if (!$isNewIssue) {
$issue->setDatePublished($this->getData('datePublished'));
}
$issue->setDescription($this->getData('description'), null);
// Localized
$issue->setPublicIssueId($this->getData('publicIssueId'));
$issue->setShowVolume(empty($showVolume) ? 0 : $showVolume);
$issue->setShowNumber(empty($showNumber) ? 0 : $showNumber);
$issue->setShowYear(empty($showYear) ? 0 : $showYear);
$issue->setShowTitle(empty($showTitle) ? 0 : $showTitle);
$issue->setCoverPageDescription($this->getData('coverPageDescription'), null);
// Localized
$issue->setCoverPageAltText($this->getData('coverPageAltText'), null);
// Localized
$showCoverPage = array_map(create_function('$arrayElement', 'return (int)$arrayElement;'), (array) $this->getData('showCoverPage'));
foreach (array_keys($this->getData('coverPageDescription')) as $locale) {
if (!array_key_exists($locale, $showCoverPage)) {
$showCoverPage[$locale] = 0;
}
}
$issue->setShowCoverPage($showCoverPage, null);
// Localized
$hideCoverPageArchives = array_map(create_function('$arrayElement', 'return (int)$arrayElement;'), (array) $this->getData('hideCoverPageArchives'));
foreach (array_keys($this->getData('coverPageDescription')) as $locale) {
if (!array_key_exists($locale, $hideCoverPageArchives)) {
$hideCoverPageArchives[$locale] = 0;
}
}
$issue->setHideCoverPageArchives($hideCoverPageArchives, null);
// Localized
$hideCoverPageCover = array_map(create_function('$arrayElement', 'return (int)$arrayElement;'), (array) $this->getData('hideCoverPageCover'));
foreach (array_keys($this->getData('coverPageDescription')) as $locale) {
if (!array_key_exists($locale, $hideCoverPageCover)) {
$hideCoverPageCover[$locale] = 0;
}
}
$issue->setHideCoverPageCover($hideCoverPageCover, null);
// Localized
$issue->setAccessStatus($this->getData('accessStatus'));
if ($this->getData('enableOpenAccessDate')) {
$issue->setOpenAccessDate($this->getData('openAccessDate'));
} else {
$issue->setOpenAccessDate(null);
}
// if issueId is supplied, then update issue otherwise insert a new one
if ($issueId) {
$issue->setIssueId($issueId);
$issueDao->updateIssue($issue);
} else {
$issue->setPublished(0);
$issue->setCurrent(0);
$issueId = $issueDao->insertIssue($issue);
$issue->setIssueId($issueId);
}
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
if ($publicFileManager->uploadedFileExists('coverPage')) {
$journal = Request::getJournal();
$originalFileName = $publicFileManager->getUploadedFileName('coverPage');
$newFileName = 'cover_issue_' . $issueId . '_' . $this->getFormLocale() . '.' . $publicFileManager->getExtension($originalFileName);
$publicFileManager->uploadJournalFile($journal->getId(), 'coverPage', $newFileName);
$issue->setOriginalFileName($publicFileManager->truncateFileName($originalFileName, 127), $this->getFormLocale());
$issue->setFileName($newFileName, $this->getFormLocale());
// Store the image dimensions.
list($width, $height) = getimagesize($publicFileManager->getJournalFilesPath($journal->getId()) . '/' . $newFileName);
$issue->setWidth($width, $this->getFormLocale());
$issue->setHeight($height, $this->getFormLocale());
$issueDao->updateIssue($issue);
}
if ($publicFileManager->uploadedFileExists('styleFile')) {
$journal = Request::getJournal();
$originalFileName = $publicFileManager->getUploadedFileName('styleFile');
$newFileName = 'style_' . $issueId . '.css';
//.........这里部分代码省略.........
示例4: importIssues
function importIssues()
{
assert($this->xml->name == 'issues');
$issueDAO =& DAORegistry::getDAO('IssueDAO');
$issueFileDAO =& DAORegistry::getDAO('IssueFileDAO');
$issueGalleyDAO =& DAORegistry::getDAO('IssueGalleyDAO');
$sectionDAO =& DAORegistry::getDAO('SectionDAO');
$issues = $issueDAO->getIssues($this->journal->getId());
$publicFileManager =& new PublicFileManager();
$this->nextElement();
while ($this->xml->name == 'issue') {
$issueXML = $this->getCurrentElementAsDom();
$issue = new Issue();
$issue->setJournalId($this->journal->getId());
$issue->setVolume((int) $issueXML->volume);
$issue->setNumber((string) $issueXML->number);
$issue->setYear((int) $issueXML->year);
$issue->setPublished((int) $issueXML->published);
$issue->setCurrent((int) $issueXML->current);
$issue->setDatePublished((string) $issueXML->datePublished);
$issue->setDateNotified((string) $issueXML->dateNotified);
$issue->setLastModified((string) $issueXML->lastModified);
$issue->setAccessStatus((int) $issueXML->accessStatus);
$issue->setOpenAccessDate((string) $issueXML->openAccessDate);
$issue->setShowVolume((int) $issueXML->showVolume);
$issue->setShowNumber((int) $issueXML->showNumber);
$issue->setShowYear((int) $issueXML->showYear);
$issue->setShowTitle((int) $issueXML->showTitle);
$issue->setStyleFileName((string) $issueXML->styleFileName);
$issue->setOriginalStyleFileName((string) $issueXML->originalStyleFileName);
$oldIssueId = (int) $issueXML->oldId;
$issueDAO->insertIssue($issue);
//$issueDAO->insertCustomIssueOrder($this->journal->getId(), $issue->getId(), (int)$issueXML->customOrder);
$this->idTranslationTable->register(INTERNAL_TRANSFER_OBJECT_ISSUE, $oldIssueId, $issue->getId());
$this->restoreDataObjectSettings($issueDAO, $issueXML->settings, 'issue_settings', 'issue_id', $issue->getId());
$issue =& $issueDAO->getIssueById($issue->getId());
// Reload issue to get restored settings
$covers = $issue->getFileName(null);
if ($covers) {
foreach ($covers as $locale => $oldCoverFileName) {
$sourceFile = $this->publicFolderPath . '/' . $oldCoverFileName;
$extension = $publicFileManager->getExtension($oldCoverFileName);
$destFile = 'cover_issue_' . $issue->getId() . "_{$locale}.{$extension}";
$publicFileManager->copyJournalFile($this->journal->getId(), $sourceFile, $destFile);
unlink($sourceFile);
$issue->setFileName($destFile, $locale);
$issueDAO->updateIssue($issue);
}
}
if ($issue->getStyleFileName()) {
$oldStyleFileName = $issue->getStyleFileName();
$sourceFile = $this->publicFolderPath . '/' . $oldStyleFileName;
$destFile = 'style_' . $issue->getId() . '.css';
$publicFileManager->copyJournalFile($this->journal->getId(), $sourceFile, $destFile);
unlink($sourceFile);
$issue->setStyleFileName($destFile);
$issueDAO->updateIssue($issue);
}
$issueFileManager = new IssueFileManager($issue->getId());
foreach ($issueXML->issueFile as $issueFileXML) {
$issueFile = new IssueFile();
$issueFile->setIssueId($issue->getId());
$issueFile->setFileName((string) $issueFileXML->fileName);
$issueFile->setFileType((string) $issueFileXML->fileType);
$issueFile->setFileSize((int) $issueFileXML->fileSize);
$issueFile->setContentType((string) $issueFileXML->contentType);
$issueFile->setOriginalFileName((string) $issueFileXML->originalFileName);
$issueFile->setDateUploaded((string) $issueFileXML->dateUploaded);
$issueFile->setDateModified((string) $issueFileXML->dateModified);
$issueFileDAO->insertIssueFile($issueFile);
$oldFileName = $issueFile->getFileName();
$extension = $issueFileManager->parseFileExtension($oldFileName);
$contentPath = $issueFileManager->contentTypeToPath($issueFile->getContentType());
$contentAbbrev = $issueFileManager->contentTypeToAbbrev($issueFile->getContentType());
$fileInTransferPackage = $this->journalFolderPath . "/issues/{$oldIssueId}/{$contentPath}/{$oldFileName}";
$newFileName = $issue->getId() . '-' . $issueFile->getId() . '-' . $contentAbbrev . '.' . $extension;
$newFilePath = "{$contentPath}/{$newFileName}";
$issueFileManager->copyFile($fileInTransferPackage, $issueFileManager->getFilesDir() . $newFilePath);
unlink($fileInTransferPackage);
$issueFile->setFileName($newFileName);
$issueFileDAO->updateIssueFile($issueFile);
$this->idTranslationTable->register(INTERNAL_TRANSFER_OBJECT_ISSUE_FILE, (int) $issueFileXML->oldId, $issueFile->getId());
}
foreach ($issueXML->issueGalley as $issueGalleyXML) {
$issueGalley = new issueGalley();
$issueGalley->setIssueId($issue->getId());
$issueGalley->setLocale((string) $issueGalleyXML->locale);
$issueGalley->setFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ISSUE_FILE, (int) $issueGalleyXML->fileId));
$issueGalley->setLabel((string) $issueGalleyXML->label);
$issueGalley->setSequence((int) $issueGalleyXML->sequence);
$issueGalleyDAO->insertGalley($issueGalley);
$this->idTranslationTable->register(INTERNAL_TRANSFER_OBJECT_ISSUE_GALLEY, (int) $issueGalleyXML->oldId, $issueGalley->getId());
$this->restoreDataObjectSettings($issueGalleyDAO, $issueGalleyXML->settings, 'issue_galley_settings', 'galley_id', $issueGalley->getId());
}
if (isset($issueXML->customSectionOrder)) {
foreach ($issueXML->customSectionOrder->sectionOrder as $sectionOrderXML) {
try {
$sectionId = $this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_SECTION, (int) $sectionOrderXML['sectionId']);
$seq = (int) $sectionOrderXML['seq'];
$sectionDAO->insertCustomSectionOrder($issue->getId(), $sectionId, $seq);
//.........这里部分代码省略.........
示例5: execute
/**
* Save issue settings.
*/
function execute($issueId = 0)
{
$journal =& Request::getJournal();
$issueDao =& DAORegistry::getDAO('IssueDAO');
if ($issueId) {
$issue = $issueDao->getIssueById($issueId);
$isNewIssue = false;
} else {
$issue = new Issue();
$isNewIssue = true;
}
$volume = $this->getData('volume');
$number = $this->getData('number');
$year = $this->getData('year');
$showVolume = $this->getData('showVolume');
$showNumber = $this->getData('showNumber');
$showYear = $this->getData('showYear');
$showTitle = $this->getData('showTitle');
$issue->setJournalId($journal->getId());
$issue->setTitle($this->getData('title'), null);
// Localized
$issue->setVolume(empty($volume) ? 0 : $volume);
$issue->setNumber(empty($number) ? 0 : $number);
$issue->setYear(empty($year) ? 0 : $year);
if (!$isNewIssue) {
$issue->setDatePublished($this->getData('datePublished'));
// If the Editor has asked to reset article publication dates for content
// in this issue, set them all to the specified issue publication date.
if ($this->getData('resetArticlePublicationDates')) {
$publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
$publishedArticles =& $publishedArticleDao->getPublishedArticles($issue->getId());
foreach ($publishedArticles as $publishedArticle) {
$publishedArticle->setDatePublished($this->getData('datePublished'));
$publishedArticleDao->updatePublishedArticle($publishedArticle);
}
}
}
$issue->setDescription($this->getData('description'), null);
// Localized
$issue->setStoredPubId('publisher-id', $this->getData('publicIssueId'));
$issue->setShowVolume(empty($showVolume) ? 0 : $showVolume);
$issue->setShowNumber(empty($showNumber) ? 0 : $showNumber);
$issue->setShowYear(empty($showYear) ? 0 : $showYear);
$issue->setShowTitle(empty($showTitle) ? 0 : $showTitle);
$issue->setCoverPageDescription($this->getData('coverPageDescription'), null);
// Localized
$issue->setCoverPageAltText($this->getData('coverPageAltText'), null);
// Localized
$showCoverPage = array_map(create_function('$arrayElement', 'return (int)$arrayElement;'), (array) $this->getData('showCoverPage'));
foreach (array_keys($this->getData('coverPageDescription')) as $locale) {
if (!array_key_exists($locale, $showCoverPage)) {
$showCoverPage[$locale] = 0;
}
}
$issue->setShowCoverPage($showCoverPage, null);
// Localized
$hideCoverPageArchives = array_map(create_function('$arrayElement', 'return (int)$arrayElement;'), (array) $this->getData('hideCoverPageArchives'));
foreach (array_keys($this->getData('coverPageDescription')) as $locale) {
if (!array_key_exists($locale, $hideCoverPageArchives)) {
$hideCoverPageArchives[$locale] = 0;
}
}
$issue->setHideCoverPageArchives($hideCoverPageArchives, null);
// Localized
$hideCoverPageCover = array_map(create_function('$arrayElement', 'return (int)$arrayElement;'), (array) $this->getData('hideCoverPageCover'));
foreach (array_keys($this->getData('coverPageDescription')) as $locale) {
if (!array_key_exists($locale, $hideCoverPageCover)) {
$hideCoverPageCover[$locale] = 0;
}
}
$issue->setHideCoverPageCover($hideCoverPageCover, null);
// Localized
$issue->setAccessStatus($this->getData('accessStatus') ? $this->getData('accessStatus') : ISSUE_ACCESS_OPEN);
// See bug #6324
if ($this->getData('enableOpenAccessDate')) {
$issue->setOpenAccessDate($this->getData('openAccessDate'));
} else {
$issue->setOpenAccessDate(null);
}
// consider the additional field names from the public identifer plugins
import('classes.plugins.PubIdPluginHelper');
$pubIdPluginHelper = new PubIdPluginHelper();
$pubIdPluginHelper->execute($this, $issue);
// if issueId is supplied, then update issue otherwise insert a new one
if ($issueId) {
$issue->setId($issueId);
$this->issue =& $issue;
parent::execute();
$issueDao->updateIssue($issue);
} else {
$issue->setPublished(0);
$issue->setCurrent(0);
$issueId = $issueDao->insertIssue($issue);
$issue->setId($issueId);
}
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
//.........这里部分代码省略.........