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


PHP TemporaryFileManager::deleteFile方法代码示例

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


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

示例1: execute

 /**
  * Save the new library file
  * @param $userId int The current user ID (for validation purposes)
  */
 function execute($userId)
 {
     // Fetch the temporary file storing the uploaded library file
     $temporaryFileDao =& DAORegistry::getDAO('TemporaryFileDAO');
     $temporaryFile =& $temporaryFileDao->getTemporaryFile($this->getData('temporaryFileId'), $userId);
     $libraryFileDao =& DAORegistry::getDAO('LibraryFileDAO');
     $libraryFileManager = new LibraryFileManager($this->pressId);
     // Convert the temporary file to a library file and store
     $libraryFile =& $libraryFileManager->copyFromTemporaryFile($temporaryFile);
     assert($libraryFile);
     $libraryFile->setPressId($this->pressId);
     $libraryFile->setName($this->getData('libraryFileName'), null);
     // Localized
     $libraryFile->setType($this->fileType);
     $libraryFileDao->insertObject($libraryFile);
     // Clean up the temporary file
     import('classes.file.TemporaryFileManager');
     $temporaryFileManager = new TemporaryFileManager();
     $temporaryFileManager->deleteFile($this->getData('temporaryFileId'), $userId);
 }
开发者ID:jerico-dev,项目名称:omp,代码行数:24,代码来源:NewLibraryFileForm.inc.php

示例2: execute

 /**
  * Save the new library file.
  * @param $userId int The current user ID (for validation purposes).
  * @return $fileId int The new library file id.
  */
 function execute($userId)
 {
     // Fetch the temporary file storing the uploaded library file
     $temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO');
     $temporaryFile = $temporaryFileDao->getTemporaryFile($this->getData('temporaryFileId'), $userId);
     $libraryFileDao = DAORegistry::getDAO('LibraryFileDAO');
     $libraryFileManager = new LibraryFileManager($this->contextId);
     // Convert the temporary file to a library file and store
     $libraryFile = $libraryFileManager->copyFromTemporaryFile($temporaryFile, $this->getData('fileType'));
     assert(isset($libraryFile));
     $libraryFile->setContextId($this->contextId);
     $libraryFile->setName($this->getData('libraryFileName'), null);
     // Localized
     $libraryFile->setType($this->getData('fileType'));
     $fileId = $libraryFileDao->insertObject($libraryFile);
     // Clean up the temporary file
     import('lib.pkp.classes.file.TemporaryFileManager');
     $temporaryFileManager = new TemporaryFileManager();
     $temporaryFileManager->deleteFile($this->getData('temporaryFileId'), $userId);
     return $fileId;
 }
开发者ID:pkp,项目名称:pkp-lib,代码行数:26,代码来源:NewLibraryFileForm.inc.php

示例3: import

 /**
  * Delete all attachments associated with this message.
  * Called from send().
  * @param $userId int
  */
 function _clearAttachments($userId)
 {
     import('file.TemporaryFileManager');
     $temporaryFileManager = new TemporaryFileManager();
     $persistAttachments = Request::getUserVar('persistAttachments');
     if (is_array($persistAttachments)) {
         foreach ($persistAttachments as $fileId) {
             $temporaryFile = $temporaryFileManager->getFile($fileId, $userId);
             if (!empty($temporaryFile)) {
                 $temporaryFileManager->deleteFile($temporaryFile->getId(), $userId);
             }
         }
     }
 }
开发者ID:anorton,项目名称:pkp-lib,代码行数:19,代码来源:PKPMailTemplate.inc.php

示例4: execute

 /**
  * Save the metadata and store the catalog data for this published
  * monograph.
  */
 function execute($request)
 {
     parent::execute();
     $monograph = $this->getMonograph();
     $monographDao = DAORegistry::getDAO('MonographDAO');
     $publishedMonographDao = DAORegistry::getDAO('PublishedMonographDAO');
     $publishedMonograph = $publishedMonographDao->getById($monograph->getId(), null, false);
     /* @var $publishedMonograph PublishedMonograph */
     $isExistingEntry = $publishedMonograph ? true : false;
     if (!$publishedMonograph) {
         $publishedMonograph = $publishedMonographDao->newDataObject();
         $publishedMonograph->setId($monograph->getId());
     }
     // Populate the published monograph with the cataloging metadata
     $publishedMonograph->setAudience($this->getData('audience'));
     $publishedMonograph->setAudienceRangeQualifier($this->getData('audienceRangeQualifier'));
     $publishedMonograph->setAudienceRangeFrom($this->getData('audienceRangeFrom'));
     $publishedMonograph->setAudienceRangeTo($this->getData('audienceRangeTo'));
     $publishedMonograph->setAudienceRangeExact($this->getData('audienceRangeExact'));
     // If a cover image was uploaded, deal with it.
     if ($temporaryFileId = $this->getData('temporaryFileId')) {
         // Fetch the temporary file storing the uploaded library file
         $temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO');
         $temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $this->_userId);
         $temporaryFilePath = $temporaryFile->getFilePath();
         import('classes.file.SimpleMonographFileManager');
         $simpleMonographFileManager = new SimpleMonographFileManager($monograph->getPressId(), $publishedMonograph->getId());
         $basePath = $simpleMonographFileManager->getBasePath();
         // Delete the old file if it exists
         $oldSetting = $publishedMonograph->getCoverImage();
         if ($oldSetting) {
             $simpleMonographFileManager->deleteFile($basePath . $oldSetting['thumbnailName']);
             $simpleMonographFileManager->deleteFile($basePath . $oldSetting['catalogName']);
             $simpleMonographFileManager->deleteFile($basePath . $oldSetting['name']);
         }
         // The following variables were fetched in validation
         assert($this->_sizeArray && $this->_imageExtension);
         // Load the cover image for surrogate production
         $cover = null;
         // Scrutinizer
         switch ($this->_imageExtension) {
             case '.jpg':
                 $cover = imagecreatefromjpeg($temporaryFilePath);
                 break;
             case '.png':
                 $cover = imagecreatefrompng($temporaryFilePath);
                 break;
             case '.gif':
                 $cover = imagecreatefromgif($temporaryFilePath);
                 break;
         }
         assert(isset($cover));
         // Copy the new file over (involves creating the appropriate subdirectory too)
         $filename = 'cover' . $this->_imageExtension;
         $simpleMonographFileManager->copyFile($temporaryFile->getFilePath(), $basePath . $filename);
         // Generate surrogate images (thumbnail and catalog image)
         $press = $request->getPress();
         $coverThumbnailsMaxWidth = $press->getSetting('coverThumbnailsMaxWidth');
         $coverThumbnailsMaxHeight = $press->getSetting('coverThumbnailsMaxHeight');
         $thumbnailImageInfo = $this->_buildSurrogateImage($cover, $basePath, SUBMISSION_IMAGE_TYPE_THUMBNAIL, $coverThumbnailsMaxWidth, $coverThumbnailsMaxHeight);
         $catalogImageInfo = $this->_buildSurrogateImage($cover, $basePath, SUBMISSION_IMAGE_TYPE_CATALOG);
         // Clean up
         imagedestroy($cover);
         $publishedMonograph->setCoverImage(array('name' => $filename, 'width' => $this->_sizeArray[0], 'height' => $this->_sizeArray[1], 'thumbnailName' => $thumbnailImageInfo['filename'], 'thumbnailWidth' => $thumbnailImageInfo['width'], 'thumbnailHeight' => $thumbnailImageInfo['height'], 'catalogName' => $catalogImageInfo['filename'], 'catalogWidth' => $catalogImageInfo['width'], 'catalogHeight' => $catalogImageInfo['height'], 'uploadName' => $temporaryFile->getOriginalFileName(), 'dateUploaded' => Core::getCurrentDate()));
         // Clean up the temporary file
         import('lib.pkp.classes.file.TemporaryFileManager');
         $temporaryFileManager = new TemporaryFileManager();
         $temporaryFileManager->deleteFile($temporaryFileId, $this->_userId);
     }
     if ($this->getData('attachPermissions')) {
         $monograph->setCopyrightYear($this->getData('copyrightYear'));
         $monograph->setCopyrightHolder($this->getData('copyrightHolder'), null);
         // Localized
         $monograph->setLicenseURL($this->getData('licenseURL'));
     } else {
         $monograph->setCopyrightYear(null);
         $monograph->setCopyrightHolder(null, null);
         $monograph->setLicenseURL(null);
     }
     $monographDao->updateObject($monograph);
     // Update the modified fields or insert new.
     if ($isExistingEntry) {
         $publishedMonographDao->updateObject($publishedMonograph);
     } else {
         $publishedMonographDao->insertObject($publishedMonograph);
     }
     import('classes.publicationFormat.PublicationFormatTombstoneManager');
     $publicationFormatTombstoneMgr = new PublicationFormatTombstoneManager();
     $publicationFormatDao = DAORegistry::getDAO('PublicationFormatDAO');
     $publicationFormatFactory = $publicationFormatDao->getBySubmissionId($monograph->getId());
     $publicationFormats = $publicationFormatFactory->toAssociativeArray();
     $notificationMgr = new NotificationManager();
     if ($this->getData('confirm')) {
         // Update the monograph status.
         $monograph->setStatus(STATUS_PUBLISHED);
         $monographDao->updateObject($monograph);
//.........这里部分代码省略.........
开发者ID:josekarvalho,项目名称:omp,代码行数:101,代码来源:CatalogEntryCatalogMetadataForm.inc.php

示例5: execute

 /**
  * Save series.
  * @param $args array
  * @param $request PKPRequest
  */
 function execute($args, $request)
 {
     $seriesDao = DAORegistry::getDAO('SeriesDAO');
     $press = $request->getPress();
     // Get or create the series object
     if ($this->getSeriesId()) {
         $series = $seriesDao->getById($this->getSeriesId(), $press->getId());
     } else {
         $series = $seriesDao->newDataObject();
         $series->setPressId($press->getId());
     }
     // Populate/update the series object from the form
     $series->setPath($this->getData('path'));
     $series->setFeatured($this->getData('featured'));
     $series->setTitle($this->getData('title'), null);
     // Localized
     $series->setDescription($this->getData('description'), null);
     // Localized
     $series->setPrefix($this->getData('prefix'), null);
     // Localized
     $series->setSubtitle($this->getData('subtitle'), null);
     // Localized
     $series->setEditorRestricted($this->getData('restricted'));
     $series->setOnlineISSN($this->getData('onlineIssn'));
     $series->setPrintISSN($this->getData('printIssn'));
     $series->setSortOption($this->getData('sortOption'));
     // Insert or update the series in the DB
     if ($this->getSeriesId()) {
         $seriesDao->updateObject($series);
     } else {
         $this->setSeriesId($seriesDao->insertObject($series));
     }
     // Handle the image upload if there was one.
     if ($temporaryFileId = $this->getData('temporaryFileId')) {
         // Fetch the temporary file storing the uploaded library file
         $temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO');
         $temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $this->_userId);
         $temporaryFilePath = $temporaryFile->getFilePath();
         import('lib.pkp.classes.file.ContextFileManager');
         $pressFileManager = new ContextFileManager($press->getId());
         $basePath = $pressFileManager->getBasePath() . '/series/';
         // Delete the old file if it exists
         $oldSetting = $series->getImage();
         if ($oldSetting) {
             $pressFileManager->deleteFile($basePath . $oldSetting['thumbnailName']);
             $pressFileManager->deleteFile($basePath . $oldSetting['name']);
         }
         // The following variables were fetched in validation
         assert($this->_sizeArray && $this->_imageExtension);
         // Generate the surrogate image.
         switch ($this->_imageExtension) {
             case '.jpg':
                 $image = imagecreatefromjpeg($temporaryFilePath);
                 break;
             case '.png':
                 $image = imagecreatefrompng($temporaryFilePath);
                 break;
             case '.gif':
                 $image = imagecreatefromgif($temporaryFilePath);
                 break;
             default:
                 $image = null;
                 // Suppress warn
         }
         assert($image);
         $coverThumbnailsMaxWidth = $press->getSetting('coverThumbnailsMaxWidth');
         $coverThumbnailsMaxHeight = $press->getSetting('coverThumbnailsMaxHeight');
         $thumbnailFilename = $series->getId() . '-series-thumbnail' . $this->_imageExtension;
         $xRatio = min(1, $coverThumbnailsMaxWidth / $this->_sizeArray[0]);
         $yRatio = min(1, $coverThumbnailsMaxHeight / $this->_sizeArray[1]);
         $ratio = min($xRatio, $yRatio);
         $thumbnailWidth = round($ratio * $this->_sizeArray[0]);
         $thumbnailHeight = round($ratio * $this->_sizeArray[1]);
         $thumbnail = imagecreatetruecolor($thumbnailWidth, $thumbnailHeight);
         imagecopyresampled($thumbnail, $image, 0, 0, 0, 0, $thumbnailWidth, $thumbnailHeight, $this->_sizeArray[0], $this->_sizeArray[1]);
         // Copy the new file over
         $filename = $series->getId() . '-series' . $this->_imageExtension;
         $pressFileManager->copyFile($temporaryFile->getFilePath(), $basePath . $filename);
         switch ($this->_imageExtension) {
             case '.jpg':
                 imagejpeg($thumbnail, $basePath . $thumbnailFilename);
                 break;
             case '.png':
                 imagepng($thumbnail, $basePath . $thumbnailFilename);
                 break;
             case '.gif':
                 imagegif($thumbnail, $basePath . $thumbnailFilename);
                 break;
         }
         imagedestroy($thumbnail);
         imagedestroy($image);
         $series->setImage(array('name' => $filename, 'width' => $this->_sizeArray[0], 'height' => $this->_sizeArray[1], 'thumbnailName' => $thumbnailFilename, 'thumbnailWidth' => $thumbnailWidth, 'thumbnailHeight' => $thumbnailHeight, 'uploadName' => $temporaryFile->getOriginalFileName(), 'dateUploaded' => Core::getCurrentDate()));
         // Clean up the temporary file
         import('lib.pkp.classes.file.TemporaryFileManager');
         $temporaryFileManager = new TemporaryFileManager();
//.........这里部分代码省略.........
开发者ID:NateWr,项目名称:omp,代码行数:101,代码来源:SeriesForm.inc.php

示例6: execute

 /**
  * @see Form::execute()
  */
 function execute($request)
 {
     $categoryId = $this->getCategoryId();
     $categoryDao = DAORegistry::getDAO('CategoryDAO');
     // Get a category object to edit or create
     if ($categoryId == null) {
         $category = $categoryDao->newDataObject();
         $category->setPressId($this->getPressId());
     } else {
         $category = $categoryDao->getById($categoryId, $this->getPressId());
     }
     // Set the editable properties of the category object
     $category->setTitle($this->getData('name'), null);
     // Localized
     $category->setDescription($this->getData('description'), null);
     // Localized
     $category->setParentId($this->getData('parentId'));
     $category->setPath($this->getData('path'));
     $category->setSortOption($this->getData('sortOption'));
     // Update or insert the category object
     if ($categoryId == null) {
         $category->setId($categoryDao->insertObject($category));
     } else {
         $category->setSequence(REALLY_BIG_NUMBER);
         $categoryDao->updateObject($category);
         $categoryDao->resequenceCategories($this->getPressId());
     }
     // Handle the image upload if there was one.
     if ($temporaryFileId = $this->getData('temporaryFileId')) {
         // Fetch the temporary file storing the uploaded library file
         $temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO');
         $temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $this->_userId);
         $temporaryFilePath = $temporaryFile->getFilePath();
         import('lib.pkp.classes.file.ContextFileManager');
         $pressFileManager = new ContextFileManager($this->getPressId());
         $basePath = $pressFileManager->getBasePath() . '/categories/';
         // Delete the old file if it exists
         $oldSetting = $category->getImage();
         if ($oldSetting) {
             $pressFileManager->deleteFile($basePath . $oldSetting['thumbnailName']);
             $pressFileManager->deleteFile($basePath . $oldSetting['name']);
         }
         // The following variables were fetched in validation
         assert($this->_sizeArray && $this->_imageExtension);
         // Generate the surrogate images.
         switch ($this->_imageExtension) {
             case '.jpg':
                 $image = imagecreatefromjpeg($temporaryFilePath);
                 break;
             case '.png':
                 $image = imagecreatefrompng($temporaryFilePath);
                 break;
             case '.gif':
                 $image = imagecreatefromgif($temporaryFilePath);
                 break;
             default:
                 $image = null;
                 // Suppress warn
         }
         assert($image);
         $press = $request->getPress();
         $coverThumbnailsMaxWidth = $press->getSetting('coverThumbnailsMaxWidth');
         $coverThumbnailsMaxHeight = $press->getSetting('coverThumbnailsMaxHeight');
         $thumbnailFilename = $category->getId() . '-category-thumbnail' . $this->_imageExtension;
         $xRatio = min(1, $coverThumbnailsMaxWidth / $this->_sizeArray[0]);
         $yRatio = min(1, $coverThumbnailsMaxHeight / $this->_sizeArray[1]);
         $ratio = min($xRatio, $yRatio);
         $thumbnailWidth = round($ratio * $this->_sizeArray[0]);
         $thumbnailHeight = round($ratio * $this->_sizeArray[1]);
         $thumbnail = imagecreatetruecolor($thumbnailWidth, $thumbnailHeight);
         imagecopyresampled($thumbnail, $image, 0, 0, 0, 0, $thumbnailWidth, $thumbnailHeight, $this->_sizeArray[0], $this->_sizeArray[1]);
         // Copy the new file over
         $filename = $category->getId() . '-category' . $this->_imageExtension;
         $pressFileManager->copyFile($temporaryFile->getFilePath(), $basePath . $filename);
         switch ($this->_imageExtension) {
             case '.jpg':
                 imagejpeg($thumbnail, $basePath . $thumbnailFilename);
                 break;
             case '.png':
                 imagepng($thumbnail, $basePath . $thumbnailFilename);
                 break;
             case '.gif':
                 imagegif($thumbnail, $basePath . $thumbnailFilename);
                 break;
         }
         imagedestroy($thumbnail);
         imagedestroy($image);
         $category->setImage(array('name' => $filename, 'width' => $this->_sizeArray[0], 'height' => $this->_sizeArray[1], 'thumbnailName' => $thumbnailFilename, 'thumbnailWidth' => $thumbnailWidth, 'thumbnailHeight' => $thumbnailHeight, 'uploadName' => $temporaryFile->getOriginalFileName(), 'dateUploaded' => Core::getCurrentDate()));
         // Clean up the temporary file
         import('lib.pkp.classes.file.TemporaryFileManager');
         $temporaryFileManager = new TemporaryFileManager();
         $temporaryFileManager->deleteFile($temporaryFileId, $this->_userId);
     }
     // Update category object to store image information.
     $categoryDao->updateObject($category);
     return $category;
 }
开发者ID:NateWr,项目名称:omp,代码行数:100,代码来源:CategoryForm.inc.php

示例7: removeTemporaryFile

 /**
  * Clean temporary file.
  * @param $request Request
  */
 function removeTemporaryFile($request)
 {
     $user = $request->getUser();
     import('lib.pkp.classes.file.TemporaryFileManager');
     $temporaryFileManager = new TemporaryFileManager();
     $temporaryFileManager->deleteFile($this->getData('temporaryFileId'), $user->getId());
 }
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:11,代码来源:SettingsFileUploadForm.inc.php

示例8: display

 /**
  * Display the plugin.
  * @param $args array
  * @param $request PKPRequest
  */
 function display($args, $request)
 {
     $templateMgr = TemplateManager::getManager($request);
     $context = $request->getContext();
     parent::display($args, $request);
     $templateMgr->assign('plugin', $this);
     switch (array_shift($args)) {
         case 'index':
         case '':
             $templateMgr->display($this->getTemplatePath() . 'index.tpl');
             break;
         case 'uploadImportXML':
             $user = $request->getUser();
             import('lib.pkp.classes.file.TemporaryFileManager');
             $temporaryFileManager = new TemporaryFileManager();
             $temporaryFile = $temporaryFileManager->handleUpload('uploadedFile', $user->getId());
             if ($temporaryFile) {
                 $json = new JSONMessage(true);
                 $json->setAdditionalAttributes(array('temporaryFileId' => $temporaryFile->getId()));
             } else {
                 $json = new JSONMessage(false, __('common.uploadFailed'));
             }
             return $json->getString();
         case 'importBounce':
             $json = new JSONMessage(true);
             $json->setEvent('addTab', array('title' => __('plugins.importexport.users.results'), 'url' => $request->url(null, null, null, array('plugin', $this->getName(), 'import'), array('temporaryFileId' => $request->getUserVar('temporaryFileId')))));
             return $json->getString();
         case 'import':
             $temporaryFileId = $request->getUserVar('temporaryFileId');
             $temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO');
             $user = $request->getUser();
             $temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $user->getId());
             if (!$temporaryFile) {
                 $json = new JSONMessage(true, __('plugins.importexport.users.uploadFile'));
                 return $json->getString();
             }
             $temporaryFilePath = $temporaryFile->getFilePath();
             libxml_use_internal_errors(true);
             $users = $this->importUsers(file_get_contents($temporaryFilePath), $context, $user);
             $validationErrors = array_filter(libxml_get_errors(), create_function('$a', 'return $a->level == LIBXML_ERR_ERROR ||  $a->level == LIBXML_ERR_FATAL;'));
             $templateMgr->assign('validationErrors', $validationErrors);
             libxml_clear_errors();
             $templateMgr->assign('users', $users);
             $json = new JSONMessage(true, $templateMgr->fetch($this->getTemplatePath() . 'results.tpl'));
             return $json->getString();
         case 'export':
             $exportXml = $this->exportUsers((array) $request->getUserVar('selectedUsers'), $request->getContext(), $request->getUser());
             import('lib.pkp.classes.file.FileManager');
             $fileManager = new FileManager();
             $exportFileName = $this->getExportFileName($this->getExportPath(), 'users', $context, '.xml');
             $fileManager->writeFile($exportFileName, $exportXml);
             $fileManager->downloadFile($exportFileName);
             $fileManager->deleteFile($exportFileName);
             break;
         case 'exportAllUsers':
             $exportXml = $this->exportAllUsers($request->getContext(), $request->getUser());
             import('lib.pkp.classes.file.TemporaryFileManager');
             $fileManager = new TemporaryFileManager();
             $exportFileName = $this->getExportFileName($this->getExportPath(), 'users', $context, '.xml');
             $fileManager->writeFile($exportFileName, $exportXml);
             $fileManager->downloadFile($exportFileName);
             $fileManager->deleteFile($exportFileName);
             break;
         default:
             $dispatcher = $request->getDispatcher();
             $dispatcher->handle404();
     }
 }
开发者ID:pkp,项目名称:pkp-lib,代码行数:73,代码来源:PKPUserImportExportPlugin.inc.php

示例9: uploadONIXObjectForReview


//.........这里部分代码省略.........
                     $typeNode = $node->getChildByName($this->_getOnixTag('TextTypeCode', $shortTags));
                     if ($typeNode && $typeNode->getValue() == '01') {
                         $textNode = $node->getChildByName($this->_getOnixTag('Text', $shortTags));
                         if ($textNode) {
                             $abstract = strip_tags($textNode->getValue());
                         }
                         break;
                     }
                 }
                 $importData['abstract'] = $abstract;
                 // ISBN-13
                 for ($productIdentifierIndex = 0; $node = $productNode->getChildByName($this->_getOnixTag('ProductIdentifier', $shortTags), $productIdentifierIndex); $productIdentifierIndex++) {
                     $idTypeNode = $node->getChildByName($this->_getOnixTag('ProductIDType', $shortTags));
                     if ($idTypeNode && $idTypeNode->getValue() == '15') {
                         // ISBN-13
                         $textNode = $node->getChildByName($this->_getOnixTag('IDValue', $shortTags));
                         if ($textNode) {
                             $importData['book_isbn'] = $textNode->getValue();
                         }
                         break;
                     }
                 }
                 // Subjects
                 $importData['subjectKeywords'] = '';
                 $subjects = array();
                 for ($subjectIndex = 0; $node = $productNode->getChildByName($this->_getOnixTag('Subject', $shortTags), $subjectIndex); $subjectIndex++) {
                     $textNode = $node->getChildByName($this->_getOnixTag('SubjectHeadingText', $shortTags));
                     if ($textNode) {
                         $subjects[] = $textNode->getValue();
                     }
                 }
                 $importData['subjectKeywords'] = join(', ', $subjects);
                 $publicationDateNode = $productNode->getChildByName($this->_getOnixTag('PublicationDate', $shortTags));
                 if ($publicationDateNode) {
                     $publicationDate = $publicationDateNode->getValue();
                     $importData['date'] = $publicationDate;
                 }
                 // Contributors.
                 $persons = array();
                 for ($authorIndex = 0; $node = $productNode->getChildByName($this->_getOnixTag('Contributor', $shortTags), $authorIndex); $authorIndex++) {
                     $firstNameNode = $node->getChildByName($this->_getOnixTag('NamesBeforeKey', $shortTags));
                     if ($firstNameNode) {
                         $firstName = $firstNameNode->getValue();
                     }
                     $lastNameNode = $node->getChildByName($this->_getOnixTag('KeyNames', $shortTags));
                     if ($lastNameNode) {
                         $lastName = $lastNameNode->getValue();
                     }
                     $seqNode = $node->getChildByName($this->_getOnixTag('SequenceNumber', $shortTags));
                     if ($seqNode) {
                         $seq = $seqNode->getValue();
                     }
                     $contributorRoleNode = $node->getChildByName($this->_getOnixTag('ContributorRole', $shortTags));
                     $contributorRole = '';
                     if ($contributorRoleNode) {
                         switch ($contributorRoleNode->getValue()) {
                             case 'A01':
                                 $contributorRole = '1';
                                 break;
                             case 'B01':
                                 $contributorRole = '3';
                                 break;
                             case 'B09':
                                 $contributorRole = '4';
                                 break;
                             case 'B06':
                                 $contributorRole = '5';
                                 break;
                             default:
                                 $contributorRole = '2';
                                 // Contributor
                                 break;
                         }
                     }
                     $persons[] = array('personId' => '', 'role' => $contributorRole, 'firstName' => $firstName, 'middleName' => '', 'lastName' => $lastName, 'seq' => (int) $seq);
                     unset($node);
                 }
                 $importData['persons'] = $persons;
                 if (!$multiple) {
                     $temporaryFileManager->deleteFile($temporaryFile->getId(), $user->getId());
                     $this->editObjectForReview($args, &$request, $importData);
                     break;
                 } else {
                     // we are processing more than one Product.  Instaniate the form and let it
                     // handle the object creation.
                     $ofrForm = new ObjectForReviewForm($ofrPlugin->getName(), null, $reviewObjectTypeId, $importData);
                     $ofrForm->initData();
                     $ofrForm->execute();
                 }
             } else {
                 $request->redirect(null, 'editor', 'objectsForReview', 'onixError');
             }
         }
         $request->redirect(null, 'editor', 'objectsForReview');
     } else {
         // this deleteFile is only called if the document does not parse.
         $temporaryFileManager->deleteFile($temporaryFile->getId(), $user->getId());
         $request->redirect(null, 'editor', 'objectsForReview');
     }
 }
开发者ID:justinshaffner,项目名称:AAAObjectsForReview,代码行数:101,代码来源:ObjectsForReviewEditorHandler.inc.php


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