setDateModified() public method

set modified date of file.
public setDateModified ( $dateModified )
$dateModified date
コード例 #1
0
 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);
                 } catch (Exception $e) {
                 }
             }
         }
         $this->nextElement();
     }
 }
コード例 #2
0
ファイル: IssueFileDAO.inc.php プロジェクト: yuricampos/ojs
 /**
  * Internal function to return an IssueFile object from a row.
  * @param $row array
  * @return IssueFile
  */
 function &_returnIssueFileFromRow(&$row)
 {
     $issueFile = new IssueFile();
     $issueFile->setId($row['file_id']);
     $issueFile->setIssueId($row['issue_id']);
     $issueFile->setFileName($row['file_name']);
     $issueFile->setFileType($row['file_type']);
     $issueFile->setFileSize($row['file_size']);
     $issueFile->setContentType($row['content_type']);
     $issueFile->setOriginalFileName($row['original_file_name']);
     $issueFile->setDateUploaded($this->datetimeFromDB($row['date_uploaded']));
     $issueFile->setDateModified($this->datetimeFromDB($row['date_modified']));
     HookRegistry::call('IssueFileDAO::_returnIssueFileFromRow', array(&$issueFile, &$row));
     return $issueFile;
 }
コード例 #3
0
 /**
  * PRIVATE routine to upload the file and add it to the database.
  * @param $fileName string index into the $_FILES array
  * @param $contentType int Issue file content type
  * @param $fileId int ID of an existing file to update
  * @param $overwrite boolean overwrite previous version of the file
  * @return int the file ID
  */
 function _handleUpload($fileName, $contentType, $fileId = null, $overwrite = false)
 {
     if (HookRegistry::call('IssueFileManager::_handleUpload', array(&$fileName, &$contentType, &$fileId, &$overwrite, &$result))) {
         return $result;
     }
     $issueId = $this->getIssueId();
     $issueFileDao =& DAORegistry::getDAO('IssueFileDAO');
     $contentTypePath = $this->contentTypeToPath($contentType);
     $dir = $this->getFilesDir() . $contentTypePath . '/';
     $issueFile = new IssueFile();
     $issueFile->setIssueId($issueId);
     $issueFile->setDateUploaded(Core::getCurrentDate());
     $issueFile->setDateModified(Core::getCurrentDate());
     $issueFile->setFileName('');
     $issueFile->setFileType($this->getUploadedFileType($fileName));
     $issueFile->setFileSize($_FILES[$fileName]['size']);
     $issueFile->setOriginalFileName($this->truncateFileName($_FILES[$fileName]['name'], 127));
     $issueFile->setContentType($contentType);
     // If this is a new issue file, add it to the db and get it's new file id
     if (!$fileId) {
         if (!$issueFileDao->insertIssueFile($issueFile)) {
             return false;
         }
     } else {
         $issueFile->setId($fileId);
     }
     $extension = $this->parseFileExtension($this->getUploadedFileName($fileName));
     $newFileName = $issueFile->getIssueId() . '-' . $issueFile->getId() . '-' . $this->contentTypeToAbbrev($contentType) . '.' . $extension;
     $issueFile->setFileName($newFileName);
     // Upload the actual file
     if (!$this->uploadFile($fileName, $dir . $newFileName)) {
         // Upload failed. If this is a new file, remove newly added db record.
         if (!$fileId) {
             $issueFileDao->deleteIssueFileById($issueFile->getId());
         }
         return false;
     }
     // Upload succeeded. Update issue file record with new filename.
     $issueFileDao->updateIssueFile($issueFile);
     return $issueFile->getId();
 }