setTitle() 공개 메소드

set title
public setTitle ( $title, $locale )
$title string
$locale string
 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
         // somewhat meaningful; this placeholder will not be
         // inserted into the database.
         $issue->setTitle(__('plugins.importexport.native.import.error.defaultTitle'), $journalPrimaryLocale);
         $hasErrors = true;
     }
     switch ($value = $issueNode->getAttribute('published')) {
         case 'true':
             $issue->setPublished(1);
             break;
         case 'false':
         case '':
         case null:
             $issue->setPublished(0);
             break;
         default:
             $errors[] = array('plugins.importexport.native.import.error.invalidBooleanValue', array('value' => $value));
             $hasErrors = true;
             break;
     }
     switch ($value = $issueNode->getAttribute('current')) {
         case 'true':
             $issue->setCurrent(1);
             break;
         case 'false':
         case '':
         case null:
             $issue->setCurrent(0);
             break;
         default:
             $errors[] = array('plugins.importexport.native.import.error.invalidBooleanValue', array('value' => $value));
             $hasErrors = true;
             break;
     }
     if (($value = $issueNode->getAttribute('public_id')) != '') {
         $anotherIssue = $issueDao->getIssueByPublicIssueId($value, $journal->getId());
         if ($anotherIssue) {
             $errors[] = array('plugins.importexport.native.import.error.duplicatePublicId', array('issueTitle' => $issue->getIssueIdentification(), 'otherIssueTitle' => $anotherIssue->getIssueIdentification()));
             $hasErrors = true;
         } else {
             $issue->setPublicIssueId($value);
         }
     }
     /* --- Access Status --- */
     $node = $issueNode->getChildByName('open_access');
     $issue->setAccessStatus($node ? ISSUE_ACCESS_OPEN : ISSUE_ACCESS_SUBSCRIPTION);
     if ($node = $issueNode->getChildByName('access_date')) {
         $accessDate = strtotime($node->getValue());
         if ($accessDate === -1) {
             $errors[] = array('plugins.importexport.native.import.error.invalidDate', array('value' => $node->getValue()));
             $hasErrors = true;
         } else {
             $issue->setOpenAccessDate($accessDate);
         }
     }
     /* --- All processing that does not require an inserted issue ID
        --- has been performed by this point. If there were no errors
        --- then insert the issue and carry on. If there were errors,
        --- then abort without performing the insertion. */
     if ($hasErrors) {
         $issue = null;
         if ($cleanupErrors) {
             NativeImportDom::cleanupFailure($dependentItems);
         }
         return false;
     } else {
         if ($issue->getCurrent()) {
             $issueDao->updateCurrentIssue($journal->getId());
         }
         $issue->setIssueId($issueDao->insertIssue($issue));
         $dependentItems[] = array('issue', $issue);
     }
     /* --- Handle cover --- */
     for ($index = 0; $node = $issueNode->getChildByName('cover', $index); $index++) {
         if (!NativeImportDom::handleCoverNode($journal, $node, $issue, $coverErrors, $isCommandLine)) {
             $errors = array_merge($errors, $coverErrors);
             $hasErrors = true;
         }
     }
     /* --- Handle sections --- */
     for ($index = 0; $node = $issueNode->getChildByName('section', $index); $index++) {
         if (!NativeImportDom::handleSectionNode($journal, $node, $issue, $sectionErrors, $user, $isCommandLine, $dependentItems, $index)) {
             $errors = array_merge($errors, $sectionErrors);
             $hasErrors = true;
         }
     }
     /* --- See if any errors occurred since last time we checked.
        --- If so, delete the created issue and return failure.
        --- Otherwise, the whole process was successful. */
     if ($hasErrors) {
         $issue = null;
         // Don't pass back a reference to a dead issue
         if ($cleanupErrors) {
             NativeImportDom::cleanupFailure($dependentItems);
         }
         return false;
     }
     $issueDao->updateIssue($issue);
     return true;
 }
예제 #2
0
파일: folder.php 프로젝트: ratbird/hope
    if ($open_cmd == 'a') {
        $permission = 7;
        if ($open_id == $SessSemName[1]) {
            $titel=_("Allgemeiner Dateiordner");
            $description= sprintf(_("Ablage für allgemeine Ordner und Dokumente der %s"), $SessSemName["art_generic"]);
        } else if ($open_id == md5('new_top_folder')){
            $titel = Request::get('top_folder_name') ? Request::get('top_folder_name') : _("Neuer Ordner");
            $open_id = md5($SessSemName[1] . 'top_folder');
        } elseif($titel = GetStatusgruppeName($open_id)) {
            $titel = _("Dateiordner der Gruppe:") . ' ' . $titel;
            $description = _("Ablage für Ordner und Dokumente dieser Gruppe");
            $permission = 15;
        } else if ($data = SingleDateDB::restoreSingleDate($open_id)) {
            // If we create a folder which has not yet an issue, we just create one
            $issue = new Issue(array('seminar_id' => $SessSemName[1]));
            $issue->setTitle(_("Ohne Titel"));
            $termin = new SingleDate($open_id);
            $termin->addIssueID($issue->getIssueID());
            $issue->store();
            $termin->store();

            $open_id = $issue->getIssueID();
            $titel = $issue->getTitle();
            $description= _("Themenbezogener Dateiordner");
        } else {
            $query = "SELECT title FROM themen WHERE issue_id = ?";
            $statement = DBManager::get()->prepare($query);
            $statement->execute(array($open_id));
            if ($result = $statement->fetch()) {
                $titel = $result["title"];
                $description= _("Themenbezogener Dateiordner");
예제 #3
0
 /**
  * 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';
         $publicFileManager->uploadJournalFile($journal->getId(), 'styleFile', $newFileName);
         $issue->setStyleFileName($newFileName);
         $issue->setOriginalStyleFileName($publicFileManager->truncateFileName($originalFileName, 127));
         $issueDao->updateIssue($issue);
     }
     return $issueId;
 }
예제 #4
0
 /**
  * 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();
     if ($publicFileManager->uploadedFileExists('coverPage')) {
         $journal = Request::getJournal();
         $originalFileName = $publicFileManager->getUploadedFileName('coverPage');
         $type = $publicFileManager->getUploadedFileType('coverPage');
         $newFileName = 'cover_issue_' . $issueId . '_' . $this->getFormLocale() . $publicFileManager->getImageExtension($type);
         $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';
         $publicFileManager->uploadJournalFile($journal->getId(), 'styleFile', $newFileName);
         $issue->setStyleFileName($newFileName);
         $issue->setOriginalStyleFileName($publicFileManager->truncateFileName($originalFileName, 127));
         $issueDao->updateIssue($issue);
     }
     return $issueId;
 }