当前位置: 首页>>代码示例>>PHP>>正文


PHP PublicFileManager::getExtension方法代码示例

本文整理汇总了PHP中PublicFileManager::getExtension方法的典型用法代码示例。如果您正苦于以下问题:PHP PublicFileManager::getExtension方法的具体用法?PHP PublicFileManager::getExtension怎么用?PHP PublicFileManager::getExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PublicFileManager的用法示例。


在下文中一共展示了PublicFileManager::getExtension方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: saveLocationSettings

 /**
  * Save changes to location settings.
  */
 function saveLocationSettings()
 {
     $this->validate();
     $this->setupTemplate(true);
     $schedConf =& Request::getSchedConf();
     if (!$schedConf) {
         Request::redirect(null, null, 'index');
     }
     import('manager.form.LocationSettingsForm');
     $settingsForm = new LocationSettingsForm();
     $settingsForm->readInputData();
     $editData = false;
     $locationFiles =& $schedConf->getSetting('locationFiles');
     if (Request::getUserVar('uploadLocationFile')) {
         // Get a numeric key for this file.
         $thisFileKey = 0;
         if (isset($locationFiles[$settingsForm->getFormLocale()])) {
             foreach ($locationFiles[$settingsForm->getFormLocale()] as $key => $junk) {
                 $thisFileKey = $key + 1;
             }
         }
         import('file.PublicFileManager');
         $fileManager = new PublicFileManager();
         $success = !$fileManager->uploadError('locationFile');
         if ($success && ($success = $fileManager->uploadedFileExists('locationFile'))) {
             $oldName = $fileManager->getUploadedFileName('locationFile');
             $extension = $fileManager->getExtension($oldName);
             if (!$extension) {
                 break;
             }
             $uploadName = 'location-' . $thisFileKey . '.' . $extension;
             if ($success && ($success = $fileManager->uploadSchedConfFile($schedConf->getId(), 'locationFile', $uploadName))) {
                 $value = array('name' => $oldName, 'uploadName' => $uploadName, 'dateUploaded' => Core::getCurrentDate(), 'title' => Request::getUserVar('locationFileTitle'));
                 $locationFiles[$settingsForm->getFormLocale()][$thisFileKey] =& $value;
                 $settingsForm->setData('locationFiles', $locationFiles);
                 $settingsForm->setData('locationFileTitle', '');
                 $schedConf->updateSetting('locationFiles', $locationFiles, 'object', true);
             }
         }
         if (!$success) {
             $settingsForm->addError('locationFiles', __('common.uploadFailed'));
         }
         $editData = true;
     } else {
         $formLocale = $settingsForm->getFormLocale();
         $deleteKey = null;
         if (isset($locationFiles[$formLocale])) {
             foreach ($locationFiles[$formLocale] as $key => $junk) {
                 if (Request::getUserVar("deleteLocationFile-{$formLocale}-{$key}")) {
                     $deleteKey = $key;
                 }
             }
         }
         if ($deleteKey !== null) {
             import('file.PublicFileManager');
             $fileManager = new PublicFileManager();
             if ($fileManager->removeSchedConfFile($schedConf->getId(), $locationFiles[$formLocale][$deleteKey]['uploadName'])) {
                 unset($locationFiles[$formLocale][$deleteKey]);
                 $schedConf->updateSetting('locationFiles', $locationFiles, 'object', true);
             }
             $editData = true;
         }
     }
     if (!$editData && $settingsForm->validate()) {
         $settingsForm->execute();
         $templateMgr =& TemplateManager::getManager();
         $templateMgr->assign(array('currentUrl' => Request::url(null, null, null, 'location'), 'pageTitle' => 'schedConf.location', 'message' => 'common.changesSaved', 'backLink' => Request::url(null, null, Request::getRequestedPage()), 'backLinkLabel' => 'manager.conferenceSiteManagement'));
         $templateMgr->display('common/message.tpl');
     } else {
         $settingsForm->display();
     }
 }
开发者ID:pulipulichen,项目名称:ocs,代码行数:75,代码来源:ManagerLocationHandler.inc.php

示例2: handleArticleCoverNode

 function handleArticleCoverNode(&$journal, &$coverNode, &$article, &$errors, $isCommandLine)
 {
     $errors = array();
     $hasErrors = false;
     $journalSupportedLocales = array_keys($journal->getSupportedLocaleNames());
     // => journal locales must be set up before
     $journalPrimaryLocale = $journal->getPrimaryLocale();
     $locale = $coverNode->getAttribute('locale');
     if ($locale == '') {
         $locale = $journalPrimaryLocale;
     } elseif (!in_array($locale, $journalSupportedLocales)) {
         $errors[] = array('plugins.importexport.native.import.error.coverLocaleUnsupported', array('issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
         return false;
     }
     $article->setShowCoverPage(1, $locale);
     if ($node = $coverNode->getChildByName('altText')) {
         $article->setCoverPageAltText($node->getValue(), $locale);
     }
     if ($node = $coverNode->getChildByName('image')) {
         import('classes.file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $newName = 'cover_article_' . $article->getId() . "_{$locale}" . '.';
         if ($href = $node->getChildByName('href')) {
             $url = $href->getAttribute('src');
             if ($isCommandLine || NativeImportDom::isAllowedMethod($url)) {
                 if ($isCommandLine && NativeImportDom::isRelativePath($url)) {
                     // The command-line tool does a chdir; we need to prepend the original pathname to relative paths so we're not looking in the wrong place.
                     $url = PWD . '/' . $url;
                 }
                 $originalName = basename($url);
                 $newName .= $publicFileManager->getExtension($originalName);
                 if (!$publicFileManager->copyJournalFile($journal->getId(), $url, $newName)) {
                     $errors[] = array('plugins.importexport.native.import.error.couldNotCopy', array('url' => $url));
                     $hasErrors = true;
                 }
                 $article->setFileName($newName, $locale);
                 $article->setOriginalFileName($publicFileManager->truncateFileName($originalName, 127), $locale);
             }
         }
         if ($embed = $node->getChildByName('embed')) {
             if (($type = $embed->getAttribute('encoding')) !== 'base64') {
                 $errors[] = array('plugins.importexport.native.import.error.unknownEncoding', array('type' => $type));
                 $hasErrors = true;
             } else {
                 $originalName = $embed->getAttribute('filename');
                 $newName .= $publicFileManager->getExtension($originalName);
                 $article->setFileName($newName, $locale);
                 $article->setOriginalFileName($publicFileManager->truncateFileName($originalName, 127), $locale);
                 if ($publicFileManager->writeJournalFile($journal->getId(), $newName, base64_decode($embed->getValue())) === false) {
                     $errors[] = array('plugins.importexport.native.import.error.couldNotWriteFile', array('originalName' => $originalName));
                     $hasErrors = true;
                 }
             }
         }
         // Store the image dimensions.
         list($width, $height) = getimagesize($publicFileManager->getJournalFilesPath($journal->getId()) . '/' . $newName);
         $article->setWidth($width, $locale);
         $article->setHeight($height, $locale);
     }
     if ($hasErrors) {
         return false;
     }
     return true;
 }
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:64,代码来源:NativeImportDom.inc.php

示例3: uploadProgram

 /**
  * Uploads a program file.
  * @param $settingName string setting key associated with the file
  * @param $locale string
  */
 function uploadProgram($settingName, $locale)
 {
     $schedConf =& Request::getSchedConf();
     import('file.PublicFileManager');
     $fileManager = new PublicFileManager();
     if ($fileManager->uploadError($settingName)) {
         return false;
     }
     if ($fileManager->uploadedFileExists($settingName)) {
         $oldName = $fileManager->getUploadedFileName('programFile');
         $extension = $fileManager->getExtension($oldName);
         if (!$extension) {
             return false;
         }
         $uploadName = 'program-' . $locale . '.' . $extension;
         if ($fileManager->uploadSchedConfFile($schedConf->getId(), $settingName, $uploadName)) {
             $value = $schedConf->getSetting($settingName);
             $value[$locale] = array('name' => $oldName, 'uploadName' => $uploadName, 'dateUploaded' => Core::getCurrentDate());
             $schedConf->updateSetting($settingName, $value, 'object', true);
             return true;
         }
     }
     return false;
 }
开发者ID:jalperin,项目名称:ocs,代码行数:29,代码来源:ProgramSettingsForm.inc.php

示例4: execute

 /**
  * Save changes to article.
  * @return int the article ID
  */
 function execute()
 {
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     $authorDao =& DAORegistry::getDAO('AuthorDAO');
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     // Update article
     $article =& $this->article;
     $article->setTitle($this->getData('title'), null);
     // Localized
     $section =& $sectionDao->getSection($article->getSectionId());
     $article->setAbstract($this->getData('abstract'), null);
     // Localized
     import('file.PublicFileManager');
     $publicFileManager = new PublicFileManager();
     if ($publicFileManager->uploadedFileExists('coverPage')) {
         $journal = Request::getJournal();
         $originalFileName = $publicFileManager->getUploadedFileName('coverPage');
         $newFileName = 'cover_article_' . $this->getData('articleId') . '_' . $this->getFormLocale() . '.' . $publicFileManager->getExtension($originalFileName);
         $publicFileManager->uploadJournalFile($journal->getId(), 'coverPage', $newFileName);
         $article->setOriginalFileName($publicFileManager->truncateFileName($originalFileName, 127), $this->getFormLocale());
         $article->setFileName($newFileName, $this->getFormLocale());
         // Store the image dimensions.
         list($width, $height) = getimagesize($publicFileManager->getJournalFilesPath($journal->getId()) . '/' . $newFileName);
         $article->setWidth($width, $this->getFormLocale());
         $article->setHeight($height, $this->getFormLocale());
     }
     $article->setCoverPageAltText($this->getData('coverPageAltText'), null);
     // Localized
     $showCoverPage = array_map(create_function('$arrayElement', 'return (int)$arrayElement;'), (array) $this->getData('showCoverPage'));
     foreach (array_keys($this->getData('coverPageAltText')) as $locale) {
         if (!array_key_exists($locale, $showCoverPage)) {
             $showCoverPage[$locale] = 0;
         }
     }
     $article->setShowCoverPage($showCoverPage, null);
     // Localized
     $hideCoverPageToc = array_map(create_function('$arrayElement', 'return (int)$arrayElement;'), (array) $this->getData('hideCoverPageToc'));
     foreach (array_keys($this->getData('coverPageAltText')) as $locale) {
         if (!array_key_exists($locale, $hideCoverPageToc)) {
             $hideCoverPageToc[$locale] = 0;
         }
     }
     $article->setHideCoverPageToc($hideCoverPageToc, null);
     // Localized
     $hideCoverPageAbstract = array_map(create_function('$arrayElement', 'return (int)$arrayElement;'), (array) $this->getData('hideCoverPageAbstract'));
     foreach (array_keys($this->getData('coverPageAltText')) as $locale) {
         if (!array_key_exists($locale, $hideCoverPageAbstract)) {
             $hideCoverPageAbstract[$locale] = 0;
         }
     }
     $article->setHideCoverPageAbstract($hideCoverPageAbstract, null);
     // Localized
     $article->setDiscipline($this->getData('discipline'), null);
     // Localized
     $article->setSubjectClass($this->getData('subjectClass'), null);
     // Localized
     $article->setSubject($this->getData('subject'), null);
     // Localized
     $article->setCoverageGeo($this->getData('coverageGeo'), null);
     // Localized
     $article->setCoverageChron($this->getData('coverageChron'), null);
     // Localized
     $article->setCoverageSample($this->getData('coverageSample'), null);
     // Localized
     $article->setType($this->getData('type'), null);
     // Localized
     $article->setLanguage($this->getData('language'));
     // Localized
     $article->setSponsor($this->getData('sponsor'), null);
     // Localized
     $article->setCitations($this->getData('citations'));
     if ($this->isEditor) {
         $article->setHideAuthor($this->getData('hideAuthor') ? $this->getData('hideAuthor') : 0);
     }
     // Update authors
     $authors = $this->getData('authors');
     for ($i = 0, $count = count($authors); $i < $count; $i++) {
         if ($authors[$i]['authorId'] > 0) {
             // Update an existing author
             $author =& $article->getAuthor($authors[$i]['authorId']);
             $isExistingAuthor = true;
         } else {
             // Create a new author
             $author = new Author();
             $isExistingAuthor = false;
         }
         if ($author != null) {
             $author->setFirstName($authors[$i]['firstName']);
             $author->setMiddleName($authors[$i]['middleName']);
             $author->setLastName($authors[$i]['lastName']);
             $author->setAffiliation($authors[$i]['affiliation']);
             $author->setCountry($authors[$i]['country']);
             $author->setEmail($authors[$i]['email']);
             $author->setUrl($authors[$i]['url']);
             if (array_key_exists('competingInterests', $authors[$i])) {
                 $author->setCompetingInterests($authors[$i]['competingInterests'], null);
//.........这里部分代码省略.........
开发者ID:philschatz,项目名称:ojs,代码行数:101,代码来源:MetadataForm.inc.php

示例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'));
     }
     $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';
//.........这里部分代码省略.........
开发者ID:JovanyJeff,项目名称:hrp,代码行数:101,代码来源:IssueForm.inc.php

示例6: execute

 /**
  * Save book. 
  */
 function execute()
 {
     $bfrPlugin =& PluginRegistry::getPlugin('generic', $this->parentPluginName);
     $bfrPlugin->import('classes.BookForReview');
     $bfrPlugin->import('classes.BookForReviewAuthor');
     $bfrDao =& DAORegistry::getDAO('BookForReviewDAO');
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     $user =& Request::getUser();
     $editorId = $user->getId();
     if ($this->book == null) {
         $book = new BookForReview();
         $book->setJournalId($journalId);
         $book->setEditorId($editorId);
         $book->setStatus(BFR_STATUS_AVAILABLE);
         $book->setDateCreated(Core::getCurrentDate());
     } else {
         $book =& $this->book;
     }
     $book->setAuthorType($this->getData('authorType'));
     $book->setPublisher($this->getData('publisher'));
     $book->setYear($this->getData('year'));
     $book->setLanguage($this->getData('language'));
     $book->setCopy($this->getData('copy') == null ? 0 : 1);
     $book->setUrl($this->getData('url'));
     $book->setEdition($this->getData('edition') == 0 ? null : $this->getData('edition'));
     $book->setPages($this->getData('pages') == '' ? null : $this->getData('pages'));
     $book->setISBN($this->getData('isbn'));
     $book->setDateDue($this->getData('dateDue'));
     $book->setUserId($this->getData('userId'));
     $book->setArticleId($this->getData('articleId'));
     $book->setNotes($this->getData('notes'));
     $book->setTitle($this->getData('title'), null);
     // Localized
     $book->setDescription($this->getData('description'), null);
     // Localized
     $book->setCoverPageAltText($this->getData('coverPageAltText'), null);
     // Localized
     // Update authors
     $authors = $this->getData('authors');
     for ($i = 0, $count = count($authors); $i < $count; $i++) {
         if ($authors[$i]['authorId'] > 0) {
             // Update an existing author
             $author =& $book->getAuthor($authors[$i]['authorId']);
             $isExistingAuthor = true;
         } else {
             // Create a new author
             // PHP4 Requires explicit instantiation-by-reference
             if (checkPhpVersion('5.0.0')) {
                 $author = new BookForReviewAuthor();
             } else {
                 $author =& new BookForReviewAuthor();
             }
             $isExistingAuthor = false;
         }
         if ($author != null) {
             $author->setFirstName($authors[$i]['firstName']);
             $author->setMiddleName($authors[$i]['middleName']);
             $author->setLastName($authors[$i]['lastName']);
             $author->setSequence($authors[$i]['seq']);
             if ($isExistingAuthor == false) {
                 $book->addAuthor($author);
             }
         }
     }
     // Remove deleted authors
     $deletedAuthors = explode(':', $this->getData('deletedAuthors'));
     for ($i = 0, $count = count($deletedAuthors); $i < $count; $i++) {
         $book->removeAuthor($deletedAuthors[$i]);
     }
     // Insert or update book for review
     if ($book->getId() == null) {
         $bfrDao->insertObject($book);
     } else {
         $bfrDao->updateObject($book);
     }
     // Handle book for review cover image
     import('classes.file.PublicFileManager');
     $publicFileManager = new PublicFileManager();
     $formLocale = $this->getFormLocale();
     if ($publicFileManager->uploadedFileExists('coverPage')) {
         $originalFileName = $publicFileManager->getUploadedFileName('coverPage');
         $newFileName = 'cover_bfr_' . $book->getId() . '_' . $formLocale . '.' . $publicFileManager->getExtension($originalFileName);
         $publicFileManager->uploadJournalFile($journalId, 'coverPage', $newFileName);
         $book->setOriginalFileName($publicFileManager->truncateFileName($originalFileName, 127), $formLocale);
         $book->setFileName($newFileName, $formLocale);
         // Store the image dimensions
         list($width, $height) = getimagesize($publicFileManager->getJournalFilesPath($journalId) . '/' . $newFileName);
         $book->setWidth($width, $formLocale);
         $book->setHeight($height, $formLocale);
         $bfrDao->updateObject($book);
     }
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:96,代码来源:BookForReviewForm.inc.php

示例7: execute

 /**
  * @see Form::execute()
  */
 function execute()
 {
     $ofrPlugin =& PluginRegistry::getPlugin('generic', $this->parentPluginName);
     $ofrPlugin->import('classes.ObjectForReview');
     $ofrPlugin->import('classes.ObjectForReviewPerson');
     $ofrPlugin->import('classes.ReviewObjectMetadata');
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     $ofrDao =& DAORegistry::getDAO('ObjectForReviewDAO');
     $objectForReview =& $ofrDao->getById($this->objectId);
     if ($objectForReview == null) {
         $objectForReview = new ObjectForReview();
         $objectForReview->setContextId($journalId);
         $objectForReview->setReviewObjectTypeId($this->reviewObjectTypeId);
         $objectForReview->setDateCreated(Core::getCurrentDate());
     }
     $objectForReview->setNotes($this->getData('notes'));
     $objectForReview->setEditorId($this->getData('editorId'));
     $objectForReview->setPublisherId($this->getData('publisherId'));
     $objectForReview->setAvailable($this->getData('available'));
     // Insert or update object for review
     if ($objectForReview->getId() == null) {
         $ofrDao->insertObject($objectForReview);
     } else {
         $ofrDao->updateObject($objectForReview);
     }
     // Update object for review settings
     $reviewObjectMetadataDao =& DAORegistry::getDAO('ReviewObjectMetadataDAO');
     $reviewObjectTypeMetadata = $reviewObjectMetadataDao->getArrayByReviewObjectTypeId($objectForReview->getReviewObjectTypeId());
     foreach ($reviewObjectTypeMetadata as $metadataId => $reviewObjectMetadata) {
         if ($reviewObjectMetadata->getKey() == 'reviewerPDF') {
             continue;
         }
         if ($reviewObjectMetadata->getMetadataType() != REVIEW_OBJECT_METADATA_TYPE_ROLE_DROP_DOWN_BOX && $reviewObjectMetadata->getMetadataType() != REVIEW_OBJECT_METADATA_TYPE_COVERPAGE) {
             $ofrSettings = $this->getData('ofrSettings');
             $ofrSettingValue = null;
             if (isset($ofrSettings[$metadataId])) {
                 $ofrSettingValue = $ofrSettings[$metadataId];
             }
             $metadataType = $reviewObjectMetadata->getMetadataType();
             switch ($metadataType) {
                 case REVIEW_OBJECT_METADATA_TYPE_SMALL_TEXT_FIELD:
                 case REVIEW_OBJECT_METADATA_TYPE_TEXT_FIELD:
                 case REVIEW_OBJECT_METADATA_TYPE_TEXTAREA:
                     $objectForReview->updateSetting((int) $metadataId, $ofrSettingValue, 'string');
                     break;
                 case REVIEW_OBJECT_METADATA_TYPE_RADIO_BUTTONS:
                 case REVIEW_OBJECT_METADATA_TYPE_DROP_DOWN_BOX:
                 case REVIEW_OBJECT_METADATA_TYPE_CHECKBOXES:
                 case REVIEW_OBJECT_METADATA_TYPE_LANG_DROP_DOWN_BOX:
                     if (!isset($ofrSettingValue)) {
                         $ofrSettingValue = array();
                     }
                     $objectForReview->updateSetting((int) $metadataId, $ofrSettingValue, 'object');
                     break;
             }
         }
     }
     // Handle object for review cover image
     import('classes.file.PublicFileManager');
     $publicFileManager = new PublicFileManager();
     $coverPageAltText = $this->getData('coverPageAltText');
     $coverPageMetadataId = $reviewObjectMetadataDao->getMetadataId($this->reviewObjectTypeId, REVIEW_OBJECT_METADATA_KEY_COVERPAGE);
     // If a cover page is uploaded
     if ($publicFileManager->uploadedFileExists('coverPage')) {
         $originalFileName = $publicFileManager->getUploadedFileName('coverPage');
         $type = $publicFileManager->getUploadedFileType('coverPage');
         $newFileName = 'cover_ofr_' . $objectForReview->getId() . $publicFileManager->getImageExtension($type);
         $publicFileManager->uploadJournalFile($journalId, 'coverPage', $newFileName);
         list($width, $height) = getimagesize($publicFileManager->getJournalFilesPath($journalId) . '/' . $newFileName);
         $coverPageSetting = array('originalFileName' => $publicFileManager->truncateFileName($originalFileName, 127), 'fileName' => $newFileName, 'width' => $width, 'height' => $height, 'altText' => $coverPageAltText);
         $objectForReview->updateSetting((int) $coverPageMetadataId, $coverPageSetting, 'object');
     } else {
         // If cover page exists, update alt texts
         $coverPageSetting = $objectForReview->getSetting($coverPageMetadataId);
         if ($coverPageSetting) {
             $coverPageSetting['altText'] = $coverPageAltText;
             $objectForReview->updateSetting((int) $coverPageMetadataId, $coverPageSetting, 'object');
         }
     }
     // Handle reviewer PDF uploads
     if ($publicFileManager->uploadedFileExists('reviewerPDF')) {
         $reviewerPDFMetadataId = $reviewObjectMetadataDao->getMetadataId($this->reviewObjectTypeId, REVIEW_OBJECT_METADATA_KEY_REVIEWER_PDF);
         $originalFileName = $publicFileManager->getUploadedFileName('reviewerPDF');
         $newFileName = 'reviewer_pdf_ofr_' . $objectForReview->getId() . '.' . $publicFileManager->getExtension($originalFileName);
         $publicFileManager->uploadJournalFile($journalId, 'reviewerPDF', $newFileName);
         $reviewerPDFSetting = array('reviewerPDFOriginalFileName' => $publicFileManager->truncateFileName($originalFileName, 127), 'reviewerPDFFileName' => $newFileName);
         $objectForReview->updateSetting((int) $reviewerPDFMetadataId, $reviewerPDFSetting, 'object');
     }
     $ofrPersonDao =& DAORegistry::getDAO('ObjectForReviewPersonDAO');
     // Insert/update persons
     $persons = $this->getData('persons');
     for ($i = 0, $count = count($persons); $i < $count; $i++) {
         if ($persons[$i]['personId'] > 0) {
             $isExistingPerson = true;
             $person =& $ofrPersonDao->getById($persons[$i]['personId']);
         } else {
//.........这里部分代码省略.........
开发者ID:justinshaffner,项目名称:AAAObjectsForReview,代码行数:101,代码来源:ObjectForReviewForm.inc.php


注:本文中的PublicFileManager::getExtension方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。