/** * Save site settings. */ function execute($request) { parent::execute(); $siteDao = DAORegistry::getDAO('SiteDAO'); $site = $siteDao->getSite(); $site->setRedirect($this->getData('redirect')); $site->setMinPasswordLength($this->getData('minPasswordLength')); // Clear the template cache if theme has changed if ($this->getData('themePluginPath') != $site->getSetting('themePluginPath')) { $templateMgr = TemplateManager::getManager($request); $templateMgr->clearTemplateCache(); $templateMgr->clearCssCache(); } $siteSettingsDao = $this->siteSettingsDao; foreach ($this->getLocaleFieldNames() as $setting) { $siteSettingsDao->updateSetting($setting, $this->getData($setting), null, true); } $setting = $site->getSetting('pageHeaderTitleImage'); if (!empty($setting)) { $imageAltText = $this->getData('pageHeaderTitleImageAltText'); $locale = $this->getFormLocale(); $setting[$locale]['altText'] = $imageAltText[$locale]; $site->updateSetting('pageHeaderTitleImage', $setting, 'object', true); } $site->updateSetting('showThumbnail', $this->getData('showThumbnail'), 'bool'); $site->updateSetting('showTitle', $this->getData('showTitle'), 'bool'); $site->updateSetting('showDescription', $this->getData('showDescription'), 'bool'); $siteDao->updateObject($site); return true; }
/** * @copydoc Form::execute() */ function execute($request) { parent::execute($request); // Retrieve the temporary file. $user = $request->getUser(); $temporaryFileId = $this->getData('temporaryFileId'); $temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO'); $temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $user->getId()); $pluginHelper = new PluginHelper(); $errorMsg = null; $pluginDir = $pluginHelper->extractPlugin($temporaryFile->getFilePath(), $temporaryFile->getOriginalFileName(), $errorMsg); $notificationMgr = new NotificationManager(); if ($pluginDir) { if ($this->_function == PLUGIN_ACTION_UPLOAD) { $pluginVersion = $pluginHelper->installPlugin($pluginDir, $errorMsg); if ($pluginVersion) { $notificationMgr->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('manager.plugins.installSuccessful', array('versionNumber' => $pluginVersion->getVersionString(false))))); } } else { if ($this->_function == PLUGIN_ACTION_UPGRADE) { $pluginVersion = $pluginHelper->upgradePlugin($request->getUserVar('category'), $request->getUserVar('plugin'), $pluginDir, $errorMsg); if ($pluginVersion) { $notificationMgr->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('manager.plugins.upgradeSuccessful', array('versionString' => $pluginVersion->getVersionString(false))))); } } } } else { $errorMsg = __('manager.plugins.invalidPluginArchive'); } if ($errorMsg) { $notificationMgr->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_ERROR, array('contents' => $errorMsg)); return false; } return true; }
public function testSuccess() { $data = ['data']; $this->session->expects($this->once())->method('getOrderCreateData')->willReturn($data); $this->session->expects($this->once())->method('setOrderCreateData')->with($this->equalTo(null)); $block = $this->getMockBuilder(\Magento\Framework\View\Element\Template::class)->setMethods(['setOrderCreateData'])->disableOriginalConstructor()->getMock(); $block->expects($this->once())->method('setOrderCreateData')->with($this->equalTo($data)); $layout = $this->getMockBuilder(\Magento\Framework\View\Layout::class)->disableOriginalConstructor()->getMock(); $layout->expects($this->once())->method('getBlock')->with($this->equalTo('orba.payupl.classic.form'))->willReturn($block); $page = $this->getMockBuilder(\Magento\Framework\View\Result\Page::class)->disableOriginalConstructor()->getMock(); $defaultLayoutHandle = 'handle'; $page->expects($this->once())->method('getDefaultLayoutHandle')->willReturn($defaultLayoutHandle); $page->expects($this->once())->method('addHandle')->with($this->equalTo($defaultLayoutHandle)); $page->expects($this->once())->method('getLayout')->willReturn($layout); $this->resultPageFactory->expects($this->once())->method('create')->with($this->equalTo(true), $this->equalTo(['template' => 'Orba_Payupl::emptyroot.phtml']))->willReturn($page); $this->assertEquals($page, $this->controller->execute()); }
/** * Save form values into the database */ function execute() { parent::execute(); $public = $this->getData('vgWortPublic'); $private = $this->getData('vgWortPrivate'); $submissionFileId = $this->_submissionFileId; $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO'); $file = $submissionFileDao->getLatestRevision($submissionFileId); $file->setData('vgWortPublic', $public); $file->setData('vgWortPrivate', $private); $submissionFileDao->updateDataObjectSettings('submission_file_settings', $file, array('file_id' => $file->getFileId())); return $submissionFileId; }
/** * Save changes to the proposal. * @return int the article ID */ function execute() { $articleDao =& DAORegistry::getDAO('ArticleDAO'); $article =& $this->article; $journal = Request::getJournal(); $articleTexts = $this->getData('articleTexts'); foreach ($journal->getSupportedLocaleNames() as $localeKey => $localeValue) { $articleText = $article->getArticleTextByLocale($localeKey); if ($articleText != null) { $articleText->setRecruitmentInfo($articleTexts[$localeKey]); } unset($articleText); } $articleDetails = $article->getArticleDetails(); $articleDetails->setRecruitmentStatus($this->getData('recruitStatus')); parent::execute(); // Save the article $articleDao->updateArticle($article); return true; }
/** * Save issue settings. * @param $request PKPRequest * @return int Issue ID for created/updated issue */ function execute($request) { $journal = $request->getJournal(); $issueDao = DAORegistry::getDAO('IssueDAO'); if ($this->issue) { $isNewIssue = false; $issue = $this->issue; } else { $issue = $issueDao->newDataObject(); $isNewIssue = true; } $volume = $this->getData('volume'); $number = $this->getData('number'); $year = $this->getData('year'); $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->setStoredPubId('publisher-id', $this->getData('publicIssueId')); $issue->setShowVolume($this->getData('showVolume')); $issue->setShowNumber($this->getData('showNumber')); $issue->setShowYear($this->getData('showYear')); $issue->setShowTitle($this->getData('showTitle')); $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 (!$isNewIssue) { parent::execute(); $issueDao->updateObject($issue); } else { $issue->setPublished(0); $issue->setCurrent(0); $issueDao->insertObject($issue); } // Copy an uploaded CSS file for the issue, if there is one. // (Must be done after insert for new issues as issue ID is in the filename.) if ($temporaryFileId = $this->getData('temporaryFileId')) { $user = $request->getUser(); $temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO'); $temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $user->getId()); import('classes.file.PublicFileManager'); $publicFileManager = new PublicFileManager(); $newFileName = 'style_' . $issue->getId() . '.css'; $publicFileManager->copyJournalFile($journal->getId(), $temporaryFile->getFilePath(), $newFileName); $issue->setStyleFileName($newFileName); $issue->setOriginalStyleFileName($publicFileManager->truncateFileName($temporaryFile->getOriginalFileName(), 127)); $issueDao->updateObject($issue); } }
/** * Register a new user. * @param $request PKPRequest * @return int|null User ID, or false on failure */ function execute($request) { $requireValidation = Config::getVar('email', 'require_validation'); $userDao = DAORegistry::getDAO('UserDAO'); // New user $user = $userDao->newDataObject(); $user->setUsername($this->getData('username')); // Set the base user fields (name, etc.) $user->setFirstName($this->getData('firstName')); $user->setMiddleName($this->getData('middleName')); $user->setLastName($this->getData('lastName')); $user->setInitials($this->getData('initials')); $user->setEmail($this->getData('email')); $user->setCountry($this->getData('country')); $user->setAffiliation($this->getData('affiliation'), null); // Localized $user->setDateRegistered(Core::getCurrentDate()); $user->setInlineHelp(1); // default new users to having inline help visible. if (isset($this->defaultAuth)) { $user->setPassword($this->getData('password')); // FIXME Check result and handle failures $this->defaultAuth->doCreateUser($user); $user->setAuthId($this->defaultAuth->authId); } $user->setPassword(Validation::encryptCredentials($this->getData('username'), $this->getData('password'))); if ($requireValidation) { // The account should be created in a disabled // state. $user->setDisabled(true); $user->setDisabledReason(__('user.login.accountNotValidated')); } parent::execute($user); $userDao->insertObject($user); $userId = $user->getId(); if (!$userId) { return false; } // Associate the new user with the existing session $sessionManager = SessionManager::getManager(); $session = $sessionManager->getUserSession(); $session->setSessionVar('username', $user->getUsername()); // Save the roles import('lib.pkp.classes.user.form.UserFormHelper'); $userFormHelper = new UserFormHelper(); $userFormHelper->saveRoleContent($this, $user); // Insert the user interests import('lib.pkp.classes.user.InterestManager'); $interestManager = new InterestManager(); $interestManager->setInterestsForUser($user, $this->getData('interests')); import('lib.pkp.classes.mail.MailTemplate'); if ($requireValidation) { // Create an access key import('lib.pkp.classes.security.AccessKeyManager'); $accessKeyManager = new AccessKeyManager(); $accessKey = $accessKeyManager->createKey('RegisterContext', $user->getId(), null, Config::getVar('email', 'validation_timeout')); // Send email validation request to user $mail = new MailTemplate('USER_VALIDATE'); $this->_setMailFrom($request, $mail); $context = $request->getContext(); $mail->assignParams(array('userFullName' => $user->getFullName(), 'activateUrl' => $request->url($context->getPath(), 'user', 'activateUser', array($this->getData('username'), $accessKey)))); $mail->addRecipient($user->getEmail(), $user->getFullName()); $mail->send(); unset($mail); } return $userId; }
global $nuForm; $nuForm->appendJSFunction($pCode); } //---get form tab details FROM zzsys_object $t = nuRunQuery("SELECT sob_all_tab_title FROM zzsys_object WHERE sob_zzsys_form_id = '" . $nuForm->form->zzsys_form_id . "' {$inString} GROUP BY sob_all_tab_title ORDER BY sob_all_tab_number"); while ($r = db_fetch_row($t)) { $nuForm->formTabs[] = $r[0]; $nuForm->formTabNames[$r[0]] = count($nuForm->formTabs); } $nuForm->access_level = $session->sss_access_level; $nuForm->session_id = $session->sss_session_id; $nuForm->zzsys_user_id = $session->sss_zzsys_user_id; $nuForm->zzsys_user_group_name = $session->sss_zzsys_user_group_name; $nuForm->inString = $inString; $nuForm->setSessionVariables(); $nuForm->execute(); nuRunQuery("DROP TABLE {$nuForm->objectTableName}"); class Form { public $form = array(); public $setup = array(); public $formTabs = array(); public $formTabNames = array(); public $recordValues = array(); public $arrayOfHashVariables = array(); //---this array holds all the values from this record plus values that might be in a display or lookup. private $formObjects = array(); public $textObjects = array(); public $subformNames = array(); public $subformTabs = array(); private $jsFunctions = array();
/** * Save author * @see Form::execute() * @see Form::execute() */ function execute() { $authorDao = DAORegistry::getDAO('AuthorDAO'); $submission = $this->getSubmission(); $author = $this->getAuthor(); if (!$author) { // this is a new submission contributor $author = new Author(); $author->setSubmissionId($submission->getId()); $existingAuthor = false; } else { $existingAuthor = true; if ($submission->getId() !== $author->getSubmissionId()) { fatalError('Invalid author!'); } } $author->setFirstName($this->getData('firstName')); $author->setMiddleName($this->getData('middleName')); $author->setLastName($this->getData('lastName')); $author->setSuffix($this->getData('suffix')); $author->setAffiliation($this->getData('affiliation'), null); // localized $author->setCountry($this->getData('country')); $author->setEmail($this->getData('email')); $author->setUrl($this->getData('userUrl')); $author->setOrcid($this->getData('orcid')); $author->setUserGroupId($this->getData('userGroupId')); $author->setBiography($this->getData('biography'), null); // localized $author->setPrimaryContact($this->getData('primaryContact') ? true : false); $author->setIncludeInBrowse($this->getData('includeInBrowse') ? true : false); // in order to be able to use the hook parent::execute(); if ($existingAuthor) { $authorDao->updateObject($author); $authorId = $author->getId(); } else { $authorId = $authorDao->insertObject($author); } return $authorId; }
/** * Save section. */ function execute() { $journal =& Request::getJournal(); $journalId = $journal->getId(); // We get the section DAO early on so that // the section class will be imported. $sectionDao =& DAORegistry::getDAO('SectionDAO'); $section =& $this->section; if (!is_a($section, 'Section')) { $section = new Section(); $section->setJournalId($journalId); $section->setSequence(REALLY_BIG_NUMBER); } $section->setTitle($this->getData('title'), null); // Localized $section->setAbbrev($this->getData('abbrev'), null); // Localized $reviewFormId = $this->getData('reviewFormId'); if ($reviewFormId === '') { $reviewFormId = null; } $section->setReviewFormId($reviewFormId); $section->setMetaIndexed($this->getData('metaIndexed') ? 0 : 1); // #2066: Inverted $section->setMetaReviewed($this->getData('metaReviewed') ? 0 : 1); // #2066: Inverted $section->setAbstractsNotRequired($this->getData('abstractsNotRequired') ? 1 : 0); $section->setIdentifyType($this->getData('identifyType'), null); // Localized $section->setEditorRestricted($this->getData('editorRestriction') ? 1 : 0); $section->setHideTitle($this->getData('hideTitle') ? 1 : 0); $section->setHideAuthor($this->getData('hideAuthor') ? 1 : 0); $section->setHideAbout($this->getData('hideAbout') ? 1 : 0); $section->setDisableComments($this->getData('disableComments') ? 1 : 0); $section->setPolicy($this->getData('policy'), null); // Localized $section->setAbstractWordCount($this->getData('wordCount')); $section =& parent::execute($section); if ($section->getId() != null) { $sectionDao->updateSection($section); $sectionId = $section->getId(); } else { $sectionId = $sectionDao->insertSection($section); $sectionDao->resequenceSections($journalId); } // Save assigned editors $assignedEditorIds = Request::getUserVar('assignedEditorIds'); if (empty($assignedEditorIds)) { $assignedEditorIds = array(); } elseif (!is_array($assignedEditorIds)) { $assignedEditorIds = array($assignedEditorIds); } $sectionEditorsDao =& DAORegistry::getDAO('SectionEditorsDAO'); $sectionEditorsDao->deleteEditorsBySectionId($sectionId, $journalId); foreach ($this->sectionEditors as $key => $junk) { $sectionEditor =& $this->sectionEditors[$key]; $userId = $sectionEditor->getId(); // We don't have to worry about omit- and include- // section editors because this function is only called // when the Save button is pressed and those are only // used in other cases. if (in_array($userId, $assignedEditorIds)) { $sectionEditorsDao->insertEditor($journalId, $sectionId, $userId, Request::getUserVar('canReview' . $userId), Request::getUserVar('canEdit' . $userId)); } unset($sectionEditor); } }
/** * 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); $publishedMonograph->setDatePublished(Core::getCurrentDate()); $publishedMonographDao->updateObject($publishedMonograph); $notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_APPROVE_SUBMISSION), null, ASSOC_TYPE_MONOGRAPH, $publishedMonograph->getId()); // Remove publication format tombstones. $publicationFormatTombstoneMgr->deleteTombstonesByPublicationFormats($publicationFormats); // Update the search index for this published monograph. import('classes.search.MonographSearchIndex'); MonographSearchIndex::indexMonographMetadata($monograph); // Log the publication event. import('lib.pkp.classes.log.SubmissionLog'); SubmissionLog::logEvent($request, $monograph, SUBMISSION_LOG_METADATA_PUBLISH, 'submission.event.metadataPublished'); } else { if ($isExistingEntry) { // Update the monograph status. $monograph->setStatus(STATUS_QUEUED); $monographDao->updateObject($monograph); // Unpublish monograph. $publishedMonograph->setDatePublished(null); $publishedMonographDao->updateObject($publishedMonograph); $notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_APPROVE_SUBMISSION), null, ASSOC_TYPE_MONOGRAPH, $publishedMonograph->getId()); // Create tombstones for each publication format. $publicationFormatTombstoneMgr->insertTombstonesByPublicationFormats($publicationFormats, $request->getContext()); // Log the unpublication event. import('lib.pkp.classes.log.SubmissionLog'); SubmissionLog::logEvent($request, $monograph, SUBMISSION_LOG_METADATA_UNPUBLISH, 'submission.event.metadataUnpublished'); } } }
/** * @copydoc Form::execute() */ function execute($request) { return parent::execute($request); }
/** * Register a new user. * @return userId int */ function execute() { $userDao =& DAORegistry::getDAO('UserDAO'); $user = new User(); $user->setSalutation($this->getData('salutation')); $user->setFirstName($this->getData('firstName')); $user->setMiddleName($this->getData('middleName')); $user->setLastName($this->getData('lastName')); $user->setGender($this->getData('gender')); $user->setInitials($this->getData('initials')); $user->setAffiliation($this->getData('affiliation'), null); // Localized $user->setEmail($this->getData('email')); $user->setData('orcid', $this->getData('orcid')); $user->setUrl($this->getData('userUrl')); $user->setPhone($this->getData('phone')); $user->setFax($this->getData('fax')); $user->setMailingAddress($this->getData('mailingAddress')); $user->setCountry($this->getData('country')); $user->setBiography($this->getData('biography'), null); // Localized $user->setGossip($this->getData('gossip'), null); // Localized $authDao =& DAORegistry::getDAO('AuthSourceDAO'); $auth =& $authDao->getDefaultPlugin(); $user->setAuthId($auth ? $auth->getAuthId() : 0); $site =& Request::getSite(); $availableLocales = $site->getSupportedLocales(); $locales = array(); foreach ($this->getData('userLocales') as $locale) { if (AppLocale::isLocaleValid($locale) && in_array($locale, $availableLocales)) { array_push($locales, $locale); } } $user->setLocales($locales); $user->setUsername($this->getData('username')); $password = Validation::generatePassword(); $sendNotify = $this->getData('sendNotify'); if (isset($auth)) { $user->setPassword($password); // FIXME Check result and handle failures $auth->doCreateUser($user); $user->setAuthId($auth->authId); $user->setPassword(Validation::encryptCredentials($user->getId(), Validation::generatePassword())); // Used for PW reset hash only } else { $user->setPassword(Validation::encryptCredentials($this->getData('username'), $password)); } $user->setMustChangePassword(isset($auth) ? 0 : 1); $user->setDateRegistered(Core::getCurrentDate()); parent::execute($user); $userId = $userDao->insertUser($user); // Insert the user interests $interests = $this->getData('interestsKeywords') ? $this->getData('interestsKeywords') : $this->getData('interestsTextOnly'); import('lib.pkp.classes.user.InterestManager'); $interestManager = new InterestManager(); $interestManager->setInterestsForUser($user, $interests); $roleDao =& DAORegistry::getDAO('RoleDAO'); $journal =& Request::getJournal(); $role = new Role(); $role->setJournalId($journal->getId()); $role->setUserId($userId); $role->setRoleId(ROLE_ID_REVIEWER); $roleDao->insertRole($role); if ($sendNotify) { // Send welcome email to user import('classes.mail.MailTemplate'); $mail = new MailTemplate('REVIEWER_REGISTER'); $mail->setReplyTo(null); $mail->assignParams(array('username' => $this->getData('username'), 'password' => $password, 'userFullName' => $user->getFullName())); $mail->addRecipient($user->getEmail(), $user->getFullName()); $mail->send(); } return $userId; }
/** * Save changes to article. * @param $request PKPRequest * @return int the article ID */ function execute(&$request) { $articleDao =& DAORegistry::getDAO('ArticleDAO'); $article =& $this->article; // Retrieve the previous citation list for comparison. $previousRawCitationList = $article->getCitations(); parent::execute(); // Save the article $articleDao->updateArticle($article); // Update references list if it changed. $citationDao =& DAORegistry::getDAO('CitationDAO'); $rawCitationList = $article->getCitations(); if ($previousRawCitationList != $rawCitationList) { $citationDao->importCitations($request, ASSOC_TYPE_ARTICLE, $article->getId(), $rawCitationList); } }
/** * 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->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; }
/** * Save changes to the supplementary file. * @return int the supplementary file ID */ function execute($fileName = null) { import('classes.file.ArticleFileManager'); $articleFileManager = new ArticleFileManager($this->article->getArticleId()); $suppFileDao =& DAORegistry::getDAO('SuppFileDAO'); $fileName = isset($fileName) ? $fileName : 'uploadSuppFile'; if (isset($this->suppFile)) { parent::execute(); // Upload file, if file selected. if ($articleFileManager->uploadedFileExists($fileName)) { $fileId = $this->suppFile->getFileId(); if ($fileId != 0) { $articleFileManager->uploadSuppFile($fileName, $fileId); } else { $fileId = $articleFileManager->uploadSuppFile($fileName); $this->suppFile->setFileId($fileId); } import('classes.search.ArticleSearchIndex'); ArticleSearchIndex::updateFileIndex($this->article->getArticleId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $fileId); } // Index metadata ArticleSearchIndex::indexSuppFileMetadata($this->suppFile); // Update existing supplementary file $this->setSuppFileData($this->suppFile); $suppFileDao->updateSuppFile($this->suppFile); } else { // Upload file, if file selected. if ($articleFileManager->uploadedFileExists($fileName)) { $fileId = $articleFileManager->uploadSuppFile($fileName); import('classes.search.ArticleSearchIndex'); ArticleSearchIndex::updateFileIndex($this->article->getArticleId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $fileId); } else { $fileId = 0; } // Insert new supplementary file $this->suppFile = new SuppFile(); $this->suppFile->setArticleId($this->article->getArticleId()); $this->suppFile->setFileId($fileId); parent::execute(); $this->setSuppFileData($this->suppFile); $suppFileDao->insertSuppFile($this->suppFile); $this->suppFileId = $this->suppFile->getId(); } return $this->suppFileId; }
/** * Perform a test login and store the details. * @param $plugin DuraCloudImportExportPlugin * @return boolean success */ function execute(&$plugin) { parent::execute(); $plugin->storeDuraCloudConfiguration($this->getData('duracloudUrl'), $this->getData('duracloudUsername'), $this->getData('duracloudPassword')); }
/** * 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); // Localized } $author->setBiography($authors[$i]['biography'], null); // Localized $author->setPrimaryContact($this->getData('primaryContact') == $i ? 1 : 0); $author->setSequence($authors[$i]['seq']); if ($isExistingAuthor == false) { $article->addAuthor($author); } } } // Remove deleted authors $deletedAuthors = explode(':', $this->getData('deletedAuthors')); for ($i = 0, $count = count($deletedAuthors); $i < $count; $i++) { $article->removeAuthor($deletedAuthors[$i]); } parent::execute(); // Save the article $articleDao->updateArticle($article); // Update search index import('search.ArticleSearchIndex'); ArticleSearchIndex::indexArticleMetadata($article); return $article->getId(); }
/** * Save changes to the galley. * @return int the galley ID */ function execute($fileName = null, $createRemote = false) { import('classes.file.ArticleFileManager'); $articleFileManager = new ArticleFileManager($this->articleId); $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO'); $fileName = isset($fileName) ? $fileName : 'galleyFile'; $journal =& Request::getJournal(); $fileId = null; $articleDao =& DAORegistry::getDAO('ArticleDAO'); $article =& $articleDao->getArticle($this->articleId, $journal->getId()); if (isset($this->galley)) { $galley =& $this->galley; // Upload galley file if ($articleFileManager->uploadedFileExists($fileName)) { if ($galley->getFileId()) { $articleFileManager->uploadPublicFile($fileName, $galley->getFileId()); $fileId = $galley->getFileId(); } else { $fileId = $articleFileManager->uploadPublicFile($fileName); $galley->setFileId($fileId); } // Update file search index import('classes.search.ArticleSearchIndex'); $articleSearchIndex = new ArticleSearchIndex(); $articleSearchIndex->articleFileChanged($this->articleId, ARTICLE_SEARCH_GALLEY_FILE, $galley->getFileId()); $articleSearchIndex->articleChangesFinished(); } if ($articleFileManager->uploadedFileExists('styleFile')) { // Upload stylesheet file $styleFileId = $articleFileManager->uploadPublicFile('styleFile', $galley->getStyleFileId()); $galley->setStyleFileId($styleFileId); } else { if ($this->getData('deleteStyleFile')) { // Delete stylesheet file $styleFile =& $galley->getStyleFile(); if (isset($styleFile)) { $articleFileManager->deleteFile($styleFile->getFileId()); } } } // Update existing galley $galley->setLabel($this->getData('label')); if ($journal->getSetting('enablePublicGalleyId')) { $galley->setStoredPubId('publisher-id', $this->getData('publicGalleyId')); } $galley->setLocale($this->getData('galleyLocale')); if ($this->getData('remoteURL')) { $galley->setRemoteURL($this->getData('remoteURL')); } // consider the additional field names from the public identifer plugins import('classes.plugins.PubIdPluginHelper'); $pubIdPluginHelper = new PubIdPluginHelper(); $pubIdPluginHelper->execute($this, $galley); parent::execute(); $galleyDao->updateGalley($galley); } else { // Upload galley file if ($articleFileManager->uploadedFileExists($fileName)) { $fileType = $articleFileManager->getUploadedFileType($fileName); $fileId = $articleFileManager->uploadPublicFile($fileName); } if (isset($fileType) && strstr($fileType, 'html')) { // Assume HTML galley $galley = new ArticleHTMLGalley(); } else { $galley = new ArticleGalley(); } $galley->setArticleId($this->articleId); $galley->setFileId($fileId); if ($this->getData('label') == null) { // Generate initial label based on file type $enablePublicGalleyId = $journal->getSetting('enablePublicGalleyId'); if ($galley->isHTMLGalley()) { $galley->setLabel('HTML'); if ($enablePublicGalleyId) { $galley->setStoredPubId('publisher-id', 'html'); } } else { if ($createRemote) { $galley->setLabel(__('common.remote')); $galley->setRemoteURL(__('common.remoteURL')); if ($enablePublicGalleyId) { $galley->setStoredPubId('publisher-id', strtolower(__('common.remote'))); } } else { if (isset($fileType)) { if (strstr($fileType, 'pdf')) { $galley->setLabel('PDF'); if ($enablePublicGalleyId) { $galley->setStoredPubId('publisher-id', 'pdf'); } } else { if (strstr($fileType, 'postscript')) { $galley->setLabel('PostScript'); if ($enablePublicGalleyId) { $galley->setStoredPubId('publisher-id', 'ps'); } } else { if (strstr($fileType, 'xml')) { $galley->setLabel('XML'); if ($enablePublicGalleyId) { $galley->setStoredPubId('publisher-id', 'xml'); } } else { if (strstr($fileType, 'epub')) { $galley->setLabel('EPUB'); if ($enablePublicGalleyId) { $galley->setStoredPubId('publisher-id', 'epub'); } } } } } } } } if ($galley->getLabel() == null) { $galley->setLabel(__('common.untitled')); } } else { $galley->setLabel($this->getData('label')); } $galley->setLocale($article->getLocale()); if ($enablePublicGalleyId) { // check to make sure the assigned public id doesn't already exist for another galley of this article $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO'); /* @var $galleylDao ArticleGalleyDAO */ $publicGalleyId = $galley->getPubId('publisher-id'); $suffix = ''; $i = 1; while ($galleyDao->getGalleyByPubId('publisher-id', $publicGalleyId . $suffix, $this->articleId)) { $suffix = '_' . $i++; } $galley->setStoredPubId('publisher-id', $publicGalleyId . $suffix); } parent::execute(); // Insert new galley $galleyDao->insertGalley($galley); $this->galleyId = $galley->getId(); } if ($fileId) { // Update file search index import('classes.search.ArticleSearchIndex'); $articleSearchIndex = new ArticleSearchIndex(); $articleSearchIndex->articleFileChanged($this->articleId, ARTICLE_SEARCH_GALLEY_FILE, $fileId); $articleSearchIndex->articleChangesFinished(); } // Stamp the article modification (for OAI) $articleDao->updateArticle($article); return $this->galleyId; }
/** * @see Form::execute() */ function execute($request) { parent::execute(); $router = $request->getRouter(); /* @var $router PageRouter */ $context = $router->getContext($request); $statsHelper = new StatisticsHelper(); $columns = $this->getData('columns'); $filter = array(); if ($this->getData('objectTypes')) { $filter[STATISTICS_DIMENSION_ASSOC_TYPE] = $this->getData('objectTypes'); } if ($this->getData('objectIds') && count($filter[STATISTICS_DIMENSION_ASSOC_TYPE] == 1)) { $objectIds = explode(',', $this->getData('objectIds')); $filter[STATISTICS_DIMENSION_ASSOC_ID] = $objectIds; } if ($this->getData('fileTypes')) { $filter[STATISTICS_DIMENSION_FILE_TYPE] = $this->getData('fileTypes'); } $filter[STATISTICS_DIMENSION_CONTEXT_ID] = $context->getId(); if ($this->getData('issues')) { $filter[STATISTICS_DIMENSION_ISSUE_ID] = $this->getData('issues'); } if ($this->getData('articles')) { $filter[STATISTICS_DIMENSION_SUBMISSION_ID] = $this->getData('articles'); } // Get the time filter data, if any. $startTime = $request->getUserDateVar('dateStart', 1, 1, 1, 23, 59, 59); $endTime = $request->getUserDateVar('dateEnd', 1, 1, 1, 23, 59, 59); if ($startTime && $endTime) { $startYear = date('Y', $startTime); $endYear = date('Y', $endTime); $startMonth = date('m', $startTime); $endMonth = date('m', $endTime); $startDay = date('d', $startTime); $endDay = date('d', $endTime); } $timeFilterOption = $this->getData('timeFilterOption'); switch ($timeFilterOption) { case TIME_FILTER_OPTION_YESTERDAY: $filter[STATISTICS_DIMENSION_DAY] = STATISTICS_YESTERDAY; break; case TIME_FILTER_OPTION_CURRENT_MONTH: $filter[STATISTICS_DIMENSION_MONTH] = STATISTICS_CURRENT_MONTH; break; case TIME_FILTER_OPTION_RANGE_DAY: case TIME_FILTER_OPTION_RANGE_MONTH: if ($timeFilterOption == TIME_FILTER_OPTION_RANGE_DAY) { $startDate = $startYear . $startMonth . $startDay; $endDate = $endYear . $endMonth . $endDay; } else { $startDate = $startYear . $startMonth; $endDate = $endYear . $endMonth; } if ($startTime == $endTime) { // The start and end date are the same, there is no range defined // only one specific date. Use the start time. $filter[STATISTICS_DIMENSION_MONTH] = $startDate; } else { $filter[STATISTICS_DIMENSION_DAY]['from'] = $startDate; $filter[STATISTICS_DIMENSION_DAY]['to'] = $endDate; } break; default: break; } if ($this->getData('countries')) { $filter[STATISTICS_DIMENSION_COUNTRY] = $this->getData('countries'); } if ($this->getData('regions')) { $filter[STATISTICS_DIMENSION_REGION] = $this->getData('regions'); } if ($this->getData('cityNames')) { $cityNames = explode(',', $this->getData('cityNames')); $filter[STATISTICS_DIMENSION_CITY] = $cityNames; } $orderBy = array(); if ($this->getData('orderByColumn') && $this->getData('orderByDirection')) { $orderByColumn = $this->getData('orderByColumn'); $orderByDirection = $this->getData('orderByDirection'); $columnIndex = 0; foreach ($orderByColumn as $column) { if ($column != '0' && !isset($orderBy[$column])) { $orderByDir = $orderByDirection[$columnIndex]; if ($orderByDir == STATISTICS_ORDER_ASC || $orderByDir == STATISTICS_ORDER_DESC) { $orderBy[$column] = $orderByDir; } } $columnIndex++; } } return $statsHelper->getReportUrl($request, $this->_metricType, $columns, $filter, $orderBy); }
/** * @copydoc Form::execute() */ function execute($request) { $submissionDao = Application::getSubmissionDAO(); $submission = $submissionDao->getById($this->_submissionId); foreach ((array) $this->getData('userIds') as $userId) { $this->sendMessage($userId, $submission, $request); } return parent::execute($request); }
/** * Save profile settings. */ function execute() { $user =& Request::getUser(); $user->setSalutation($this->getData('salutation')); $user->setFirstName($this->getData('firstName')); $user->setMiddleName($this->getData('middleName')); $user->setLastName($this->getData('lastName')); $user->setGender($this->getData('gender')); $user->setInitials($this->getData('initials')); $user->setAffiliation($this->getData('affiliation'), null); // Localized $user->setSignature($this->getData('signature'), null); // Localized $user->setEmail($this->getData('email')); $user->setData('orcid', $this->getData('orcid')); $user->setUrl($this->getData('userUrl')); $user->setPhone($this->getData('phone')); $user->setFax($this->getData('fax')); $user->setMailingAddress($this->getData('mailingAddress')); $user->setCountry($this->getData('country')); $user->setBiography($this->getData('biography'), null); // Localized // Insert the user interests $interests = $this->getData('interestsKeywords') ? $this->getData('interestsKeywords') : $this->getData('interestsTextOnly'); import('lib.pkp.classes.user.InterestManager'); $interestManager = new InterestManager(); $interestManager->setInterestsForUser($user, $interests); $site =& Request::getSite(); $availableLocales = $site->getSupportedLocales(); $locales = array(); foreach ($this->getData('userLocales') as $locale) { if (AppLocale::isLocaleValid($locale) && in_array($locale, $availableLocales)) { array_push($locales, $locale); } } $user->setLocales($locales); parent::execute($user); $userDao =& DAORegistry::getDAO('UserDAO'); $userDao->updateObject($user); $roleDao =& DAORegistry::getDAO('RoleDAO'); $journalDao =& DAORegistry::getDAO('JournalDAO'); // Roles $journal =& Request::getJournal(); if ($journal) { $role = new Role(); $role->setUserId($user->getId()); $role->setJournalId($journal->getId()); if ($journal->getSetting('allowRegReviewer')) { $role->setRoleId(ROLE_ID_REVIEWER); $hasRole = Validation::isReviewer(); $wantsRole = Request::getUserVar('reviewerRole'); if ($hasRole && !$wantsRole) { $roleDao->deleteRole($role); } if (!$hasRole && $wantsRole) { $roleDao->insertRole($role); } } if ($journal->getSetting('allowRegAuthor')) { $role->setRoleId(ROLE_ID_AUTHOR); $hasRole = Validation::isAuthor(); $wantsRole = Request::getUserVar('authorRole'); if ($hasRole && !$wantsRole) { $roleDao->deleteRole($role); } if (!$hasRole && $wantsRole) { $roleDao->insertRole($role); } } if ($journal->getSetting('allowRegReader')) { $role->setRoleId(ROLE_ID_READER); $hasRole = Validation::isReader(); $wantsRole = Request::getUserVar('readerRole'); if ($hasRole && !$wantsRole) { $roleDao->deleteRole($role); } if (!$hasRole && $wantsRole) { $roleDao->insertRole($role); } } } $openAccessNotify = Request::getUserVar('openAccessNotify'); $userSettingsDao =& DAORegistry::getDAO('UserSettingsDAO'); $journals =& $journalDao->getJournals(true); $journals =& $journals->toArray(); foreach ($journals as $thisJournal) { if ($thisJournal->getSetting('publishingMode') == PUBLISHING_MODE_SUBSCRIPTION && $thisJournal->getSetting('enableOpenAccessNotification')) { $currentlyReceives = $user->getSetting('openAccessNotification', $thisJournal->getJournalId()); $shouldReceive = !empty($openAccessNotify) && in_array($thisJournal->getJournalId(), $openAccessNotify); if ($currentlyReceives != $shouldReceive) { $userSettingsDao->updateSetting($user->getId(), 'openAccessNotification', $shouldReceive, 'bool', $thisJournal->getJournalId()); } } } if ($user->getAuthId()) { $authDao =& DAORegistry::getDAO('AuthSourceDAO'); $auth =& $authDao->getPlugin($user->getAuthId()); } if (isset($auth)) { $auth->doSetUserInfo($user); } }
/** * Save changes to article. * @param $request PKPRequest * @return int the article ID */ function execute(&$request) { $articleDao =& DAORegistry::getDAO('ArticleDAO'); $authorDao =& DAORegistry::getDAO('AuthorDAO'); $sectionDao =& DAORegistry::getDAO('SectionDAO'); $citationDao =& DAORegistry::getDAO('CitationDAO'); /* @var $citationDao CitationDAO */ $article =& $this->article; // Retrieve the previous citation list for comparison. $previousRawCitationList = $article->getCitations(); // Update article $article->setTitle($this->getData('title'), null); // Localized $section =& $sectionDao->getSection($article->getSectionId()); $article->setAbstract($this->getData('abstract'), null); // Localized import('classes.file.PublicFileManager'); $publicFileManager = new PublicFileManager(); if ($publicFileManager->uploadedFileExists(COVER_PAGE_IMAGE_NAME)) { $journal = Request::getJournal(); $originalFileName = $publicFileManager->getUploadedFileName(COVER_PAGE_IMAGE_NAME); $type = $publicFileManager->getUploadedFileType(COVER_PAGE_IMAGE_NAME); $newFileName = 'cover_article_' . $this->article->getId() . '_' . $this->getFormLocale() . $publicFileManager->getImageExtension($type); $publicFileManager->uploadJournalFile($journal->getId(), COVER_PAGE_IMAGE_NAME, $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); } // consider the additional field names from the public identifer plugins import('classes.plugins.PubIdPluginHelper'); $pubIdPluginHelper = new PubIdPluginHelper(); $pubIdPluginHelper->execute($this, $article); // 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 =& $authorDao->getAuthor($authors[$i]['authorId'], $article->getId()); $isExistingAuthor = true; } else { // Create a new author if (checkPhpVersion('5.0.0')) { // *5488* PHP4 Requires explicit instantiation-by-reference $author = new Author(); } else { $author =& new Author(); } $isExistingAuthor = false; } if ($author != null) { $author->setSubmissionId($article->getId()); $author->setFirstName($authors[$i]['firstName']); $author->setMiddleName($authors[$i]['middleName']); $author->setLastName($authors[$i]['lastName']); $author->setAffiliation($authors[$i]['affiliation'], null); // Localized $author->setCountry($authors[$i]['country']); $author->setEmail($authors[$i]['email']); $author->setData('orcid', $authors[$i]['orcid']); $author->setUrl($authors[$i]['url']); if (array_key_exists('competingInterests', $authors[$i])) { $author->setCompetingInterests($authors[$i]['competingInterests'], null); // Localized } $author->setBiography($authors[$i]['biography'], null); // Localized $author->setPrimaryContact($this->getData('primaryContact') == $i ? 1 : 0); $author->setSequence($authors[$i]['seq']); HookRegistry::call('Submission::Form::MetadataForm::Execute', array(&$author, &$authors[$i])); if ($isExistingAuthor) { $authorDao->updateAuthor($author); } else { $authorDao->insertAuthor($author); } unset($author); } } // Remove deleted authors $deletedAuthors = preg_split('/:/', $this->getData('deletedAuthors'), -1, PREG_SPLIT_NO_EMPTY); for ($i = 0, $count = count($deletedAuthors); $i < $count; $i++) { $authorDao->deleteAuthorById($deletedAuthors[$i], $article->getId()); } if ($this->isEditor) { $article->setCopyrightHolder($this->getData('copyrightHolder'), null); $article->setCopyrightYear($this->getData('copyrightYear')); $article->setLicenseURL($this->getData('licenseURL')); } parent::execute(); // Save the article $articleDao->updateArticle($article); // Update search index import('classes.search.ArticleSearchIndex'); $articleSearchIndex = new ArticleSearchIndex(); $articleSearchIndex->articleMetadataChanged($article); $articleSearchIndex->articleChangesFinished(); // Update references list if it changed. $rawCitationList = $article->getCitations(); if ($previousRawCitationList != $rawCitationList) { $citationDao->importCitations($request, ASSOC_TYPE_ARTICLE, $article->getId(), $rawCitationList); } return $article->getId(); }
/** * Assign pub ids. * @param $request PKPRequest * @param $save boolean * true if the pub id shall be saved here * false if this form is integrated somewhere else, where the pub object will be updated. */ function execute($request, $save = false) { parent::execute($request); $pubObject = $this->getPubObject(); $pubIdPluginHelper = new PKPPubIdPluginHelper(); $pubIdPluginHelper->assignPubId($this->getContextId(), $this, $pubObject, $save); }
/** * Store objects with pub ids. * @copydoc Form::execute() */ function execute($request) { parent::execute($request); $pubObject = $this->getPubObject(); $pubObject->setStoredPubId('publisher-id', $this->getData('publisherId')); $pubIdPluginHelper = new PKPPubIdPluginHelper(); $pubIdPluginHelper->execute($this->getContextId(), $this, $pubObject); if (is_a($pubObject, 'Submission')) { $submissionDao = Application::getSubmissionDAO(); $submissionDao->updateObject($pubObject); } elseif (is_a($pubObject, 'Representation')) { $representationDao = Application::getRepresentationDAO(); $representationDao->updateObject($pubObject); } elseif (is_a($pubObject, 'SubmissionFile')) { $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO'); $submissionFileDao->updateObject($pubObject); } }
/** * Save issue settings. * @param $request PKPRequest * @return int Issue ID for created/updated issue */ function execute($request) { $journal = $request->getJournal(); $issueDao = DAORegistry::getDAO('IssueDAO'); if ($this->issue) { $isNewIssue = false; $issue = $this->issue; } else { $issue = $issueDao->newDataObject(); $isNewIssue = true; } $volume = $this->getData('volume'); $number = $this->getData('number'); $year = $this->getData('year'); $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->setShowVolume($this->getData('showVolume')); $issue->setShowNumber($this->getData('showNumber')); $issue->setShowYear($this->getData('showYear')); $issue->setShowTitle($this->getData('showTitle')); $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); } // If it is a new issue, first insert it, then update the cover // because the cover name needs an issue id. if ($isNewIssue) { $issue->setPublished(0); $issue->setCurrent(0); $issueDao->insertObject($issue); } // Copy an uploaded cover file for the issue, if there is one. if ($temporaryFileId = $this->getData('temporaryFileId')) { $user = $request->getUser(); $temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO'); $temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $user->getId()); import('classes.file.PublicFileManager'); $publicFileManager = new PublicFileManager(); $newFileName = 'cover_issue_' . $issue->getId() . $publicFileManager->getImageExtension($temporaryFile->getFileType()); $journal = $request->getJournal(); $publicFileManager->copyJournalFile($journal->getId(), $temporaryFile->getFilePath(), $newFileName); $issue->setCoverImage($newFileName); $issueDao->updateObject($issue); } $issue->setCoverImageAltText($this->getData('coverImageAltText')); parent::execute(); $issueDao->updateObject($issue); }
/** * Save changes to submission. * @param $request PKPRequest */ function execute($request) { $submission = $this->getSubmission(); parent::execute($submission); // Execute submission metadata related operations. $this->_metadataFormImplem->execute($submission, $request); }
/** * Save the metadata and store the catalog data for this specific publication format. */ function execute($request) { parent::execute(); $monograph = $this->getMonograph(); $publicationFormatDao = DAORegistry::getDAO('PublicationFormatDAO'); $publicationFormat = $publicationFormatDao->getById($this->getPublicationFormatId(), $monograph->getId()); assert($publicationFormat); // Manage tombstones for the publication format. if ($publicationFormat->getIsApproved() && !$this->getData('isApproved')) { // Publication format was approved and its being disabled. Create // a tombstone for it. $press = $request->getPress(); import('classes.publicationFormat.PublicationFormatTombstoneManager'); $publicationFormatTombstoneMgr = new PublicationFormatTombstoneManager(); $publicationFormatTombstoneMgr->insertTombstoneByPublicationFormat($publicationFormat, $press); // Log unpublish event. import('lib.pkp.classes.log.SubmissionLog'); SubmissionLog::logEvent($request, $monograph, SUBMISSION_LOG_PUBLICATION_FORMAT_UNPUBLISH, 'submission.event.publicationFormatUnpublished', array('publicationFormatName' => $publicationFormat->getLocalizedName())); } elseif (!$publicationFormat->getIsApproved() && $this->getData('isApproved')) { // Wasn't approved and now it is. Delete tombstone. $tombstoneDao = DAORegistry::getDAO('DataObjectTombstoneDAO'); $tombstoneDao->deleteByDataObjectId($publicationFormat->getId()); // Log publish event. import('lib.pkp.classes.log.SubmissionLog'); SubmissionLog::logEvent($request, $monograph, SUBMISSION_LOG_PUBLICATION_FORMAT_PUBLISH, 'submission.event.publicationFormatPublished', array('publicationFormatName' => $publicationFormat->getLocalizedName())); } // populate the published monograph with the cataloging metadata $publicationFormat->setFileSize($this->getData('override') ? $this->getData('fileSize') : null); $publicationFormat->setFrontMatter($this->getData('frontMatter')); $publicationFormat->setBackMatter($this->getData('backMatter')); $publicationFormat->setHeight($this->getData('height')); $publicationFormat->setHeightUnitCode($this->getData('heightUnitCode')); $publicationFormat->setWidth($this->getData('width')); $publicationFormat->setWidthUnitCode($this->getData('widthUnitCode')); $publicationFormat->setThickness($this->getData('thickness')); $publicationFormat->setThicknessUnitCode($this->getData('thicknessUnitCode')); $publicationFormat->setWeight($this->getData('weight')); $publicationFormat->setWeightUnitCode($this->getData('weightUnitCode')); $publicationFormat->setProductCompositionCode($this->getData('productCompositionCode')); $publicationFormat->setProductFormDetailCode($this->getData('productFormDetailCode')); $publicationFormat->setCountryManufactureCode($this->getData('countryManufactureCode')); $publicationFormat->setImprint($this->getData('imprint')); $publicationFormat->setProductAvailabilityCode($this->getData('productAvailabilityCode')); $publicationFormat->setTechnicalProtectionCode($this->getData('technicalProtectionCode')); $publicationFormat->setReturnableIndicatorCode($this->getData('returnableIndicatorCode')); $publicationFormat->setIsApproved($this->getData('isApproved') ? true : false); // consider the additional field names from the public identifer plugins $pubIdPluginHelper = $this->_getPubIdPluginHelper(); $pubIdPluginHelper->execute($this, $publicationFormat); $publicationFormatDao->updateObject($publicationFormat); }
/** * Save changes to article. * @param $request PKPRequest * @return int the article ID */ function execute(&$request) { $articleDao =& DAORegistry::getDAO('ArticleDAO'); $article =& $this->article; // Retrieve the previous citation list for comparison. $previousRawCitationList = $article->getCitations(); /////////////////////////////////////////// ////////////// 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->setSubmissionId($article->getId()); if (isset($authors[$i]['firstName'])) { $author->setFirstName($authors[$i]['firstName']); } if (isset($authors[$i]['middleName'])) { $author->setMiddleName($authors[$i]['middleName']); } if (isset($authors[$i]['lastName'])) { $author->setLastName($authors[$i]['lastName']); } if (isset($authors[$i]['affiliation'])) { $author->setAffiliation($authors[$i]['affiliation']); } if (isset($authors[$i]['phone'])) { $author->setPhoneNumber($authors[$i]['phone']); } if (isset($authors[$i]['email'])) { $author->setEmail($authors[$i]['email']); } $author->setPrimaryContact($this->getData('primaryContact') == $i ? 1 : 0); $author->setSequence($authors[$i]['seq']); if ($isExistingAuthor == false) { $article->addAuthor($author); } } unset($author); } // Remove deleted authors $deletedAuthors = explode(':', $this->getData('deletedAuthors')); for ($i = 0, $count = count($deletedAuthors); $i < $count; $i++) { $article->removeAuthor($deletedAuthors[$i]); } /////////////////////////////////////////// //////////// Update Abstract(s) /////////// /////////////////////////////////////////// import('classes.article.ProposalAbstract'); $journal = Request::getJournal(); $abstracts = $this->getData('abstracts'); foreach ($journal->getSupportedLocaleNames() as $localeKey => $localeValue) { if ($abstracts[$localeKey]['abstractId'] > 0) { $abstract = $article->getAbstractByLocale($localeKey); $isExistingAbstract = true; } else { $abstract = new ProposalAbstract(); $isExistingAbstract = false; } if ($abstract != null) { $abstract->setArticleId($article->getId()); $abstract->setLocale($localeKey); $abstract->setScientificTitle($abstracts[$localeKey]['scientificTitle']); $abstract->setPublicTitle($abstracts[$localeKey]['publicTitle']); $abstract->setBackground($abstracts[$localeKey]['background']); $abstract->setObjectives($abstracts[$localeKey]['objectives']); $abstract->setStudyMethods($abstracts[$localeKey]['studyMethods']); $abstract->setExpectedOutcomes($abstracts[$localeKey]['expectedOutcomes']); $abstract->setKeywords($abstracts[$localeKey]['keywords']); if ($isExistingAbstract == false) { $article->addAbstract($abstract); } } unset($abstract); } /////////////////////////////////////////// ///////// Update Proposal Details ///////// /////////////////////////////////////////// $proposalDetailsData = $this->getData('proposalDetails'); import('classes.article.ProposalDetails'); $proposalDetails = new ProposalDetails(); $institutionDao =& DAORegistry::getDAO('InstitutionDAO'); import('classes.journal.Institution'); $proposalDetails->setArticleId($article->getId()); $proposalDetails->setStudentResearch($proposalDetailsData['studentInitiatedResearch']); $proposalDetails->setStartDate($proposalDetailsData['startDate']); $proposalDetails->setEndDate($proposalDetailsData['endDate']); if ($proposalDetailsData['keyImplInstitution'] == "OTHER") { $institution = new Institution(); $institution->setInstitutionName($proposalDetailsData['otherInstitutionName']); $institution->setInstitutionAcronym($proposalDetailsData['otherInstitutionAcronym']); $institution->setInstitutionType($proposalDetailsData['otherInstitutionType']); $institution->setInstitutionInternational($proposalDetailsData['international']); if ($proposalDetailsData['international'] == INSTITUTION_NATIONAL) { $institution->setInstitutionLocation($proposalDetailsData['locationCountry']); } elseif ($proposalDetailsData['international'] == INSTITUTION_INTERNATIONAL) { $institution->setInstitutionLocation($proposalDetailsData['locationInternational']); } $institutionId = $institutionDao->insertInstitution($institution); $proposalDetails->setKeyImplInstitution($institutionId); unset($institution); } else { $proposalDetails->setKeyImplInstitution($proposalDetailsData['keyImplInstitution']); } $proposalDetails->setMultiCountryResearch($proposalDetailsData['multiCountryResearch']); if ($proposalDetailsData['multiCountryResearch'] == PROPOSAL_DETAIL_YES) { $countriesArray = $proposalDetailsData['countries']; $countries = implode(",", $countriesArray); $proposalDetails->setCountries($countries); } $proposalDetails->setNationwide($proposalDetailsData['nationwide']); if ($proposalDetailsData['nationwide'] != PROPOSAL_DETAIL_YES) { $geoAreasArray = $proposalDetailsData['geoAreas']; $proposalDetails->setGeoAreasFromArray($geoAreasArray); } $researchDomainsArray = $proposalDetailsData['researchDomains']; $proposalDetails->setResearchDomainsFromArray($researchDomainsArray); $researchFieldsArray = $proposalDetailsData['researchFields']; foreach ($researchFieldsArray as $i => $field) { if ($field == "OTHER") { $otherField = $proposalDetailsData['otherResearchField']; if ($otherField != "") { $researchFieldsArray[$i] = "Other (" . $otherField . ")"; } } } $proposalDetails->setResearchFieldsFromArray($researchFieldsArray); $proposalDetails->setHumanSubjects($proposalDetailsData['withHumanSubjects']); if ($proposalDetailsData['withHumanSubjects'] == PROPOSAL_DETAIL_YES) { $proposalTypesArray = $proposalDetailsData['proposalTypes']; foreach ($proposalTypesArray as $i => $type) { if ($type == "OTHER") { $otherType = $proposalDetailsData['otherProposalType']; if ($otherType != "") { $proposalTypesArray[$i] = "Other (" . $otherType . ")"; } } } $proposalDetails->setProposalTypesFromArray($proposalTypesArray); } $proposalDetails->setDataCollection($proposalDetailsData['dataCollection']); if ($proposalDetailsData['reviewedByOtherErc'] == PROPOSAL_DETAIL_YES) { $proposalDetails->setCommitteeReviewed($proposalDetailsData['otherErcDecision']); } else { $proposalDetails->setCommitteeReviewed(PROPOSAL_DETAIL_NO); } // Update or insert student research import('classes.article.StudentResearch'); $studentResearchInfo = new StudentResearch(); $studentResearchInfo->setArticleId($article->getId()); $studentResearchData = $this->getData('studentResearch'); $studentResearchInfo->setInstitution($studentResearchData['studentInstitution']); $studentResearchInfo->setDegree($studentResearchData['academicDegree']); $studentResearchInfo->setSupervisorName($studentResearchData['supervisorName']); $studentResearchInfo->setSupervisorEmail($studentResearchData['supervisorEmail']); $proposalDetails->setStudentResearchInfo($studentResearchInfo); $article->setProposalDetails($proposalDetails); /////////////////////////////////////////// //////// Update Sources of Monetary /////// /////////////////////////////////////////// $sources = $article->getSources(); $sourcesData = $this->getData('sources'); //Remove sources foreach ($sources as $source) { $isPresent = false; foreach ($sourcesData as $sourceData) { if (!empty($sourceData['sourceId'])) { if ($source->getSourceId() == $sourceData['sourceId']) { $isPresent = true; } } } if (!$isPresent) { $article->removeSource($source->getSourceId()); } unset($source); } for ($i = 0, $count = count($sourcesData); $i < $count; $i++) { if (!empty($sourcesData[$i]['sourceId'])) { // Update an existing source $source =& $article->getSource($sourcesData[$i]['sourceId']); $isExistingSource = true; } else { // Create a new source $source = new ProposalSource(); $isExistingSource = false; } if ($source != null) { $source->setArticleId($article->getId()); if ($sourcesData[$i]['institution'] == "OTHER") { $institution = new Institution(); $institution->setInstitutionName($sourcesData[$i]['otherInstitutionName']); $institution->setInstitutionAcronym($sourcesData[$i]['otherInstitutionAcronym']); $institution->setInstitutionType($sourcesData[$i]['otherInstitutionType']); $institution->setInstitutionInternational($sourcesData[$i]['international']); if ($sourcesData[$i]['international'] == INSTITUTION_NATIONAL) { $institution->setInstitutionLocation($sourcesData[$i]['locationCountry']); } elseif ($proposalDetailsData['international'] == INSTITUTION_INTERNATIONAL) { $institution->setInstitutionLocation($sourcesData[$i]['locationInternational']); } $institutionId = $institutionDao->insertInstitution($institution); $source->setInstitutionId($institutionId); unset($institution); } elseif ($sourcesData[$i]['institution'] == "KII") { $source->setInstitutionId($proposalDetails->getKeyImplInstitution()); } else { $source->setInstitutionId($sourcesData[$i]['institution']); } $source->setSourceAmount($sourcesData[$i]['amount']); if (!$isExistingSource) { $article->addSource($source); } } unset($source); } /////////////////////////////////////////// ///////////// Risk Assessment ///////////// /////////////////////////////////////////// import('classes.article.RiskAssessment'); $riskAssessment = new RiskAssessment(); $riskAssessmentData = $this->getData('riskAssessment'); $riskAssessment->setArticleId($article->getId()); $riskAssessment->setIdentityRevealed($riskAssessmentData['identityRevealed']); $riskAssessment->setUnableToConsent($riskAssessmentData['unableToConsent']); $riskAssessment->setUnder18($riskAssessmentData['under18']); $riskAssessment->setDependentRelationship($riskAssessmentData['dependentRelationship']); $riskAssessment->setEthnicMinority($riskAssessmentData['ethnicMinority']); $riskAssessment->setImpairment($riskAssessmentData['impairment']); $riskAssessment->setPregnant($riskAssessmentData['pregnant']); $riskAssessment->setNewTreatment($riskAssessmentData['newTreatment']); $riskAssessment->setBioSamples($riskAssessmentData['bioSamples']); $riskAssessment->setExportHumanTissue($riskAssessmentData['exportHumanTissue']); $riskAssessment->setExportReason($riskAssessmentData['exportReason']); $riskAssessment->setRadiation($riskAssessmentData['radiation']); $riskAssessment->setDistress($riskAssessmentData['distress']); $riskAssessment->setInducements($riskAssessmentData['inducements']); $riskAssessment->setSensitiveInfo($riskAssessmentData['sensitiveInfo']); $riskAssessment->setReproTechnology($riskAssessmentData['reproTechnology']); $riskAssessment->setGenetic($riskAssessmentData['genetic']); $riskAssessment->setStemCell($riskAssessmentData['stemCell']); $riskAssessment->setBiosafety($riskAssessmentData['biosafety']); $riskAssessment->setRiskLevel($riskAssessmentData['riskLevel']); $riskAssessment->setListRisks($riskAssessmentData['listRisks']); $riskAssessment->setHowRisksMinimized($riskAssessmentData['howRisksMinimized']); $riskAssessment->setRisksToTeam(isset($riskAssessmentData['risksToTeam']) ? 1 : 0); $riskAssessment->setRisksToSubjects(isset($riskAssessmentData['risksToSubjects']) ? 1 : 0); $riskAssessment->setRisksToCommunity(isset($riskAssessmentData['risksToCommunity']) ? 1 : 0); $riskAssessment->setBenefitsToParticipants(isset($riskAssessmentData['benefitsToParticipants']) ? 1 : 0); $riskAssessment->setKnowledgeOnCondition(isset($riskAssessmentData['knowledgeOnCondition']) ? 1 : 0); $riskAssessment->setKnowledgeOnDisease(isset($riskAssessmentData['knowledgeOnDisease']) ? 1 : 0); $riskAssessment->setMultiInstitutions($riskAssessmentData['multiInstitutions']); $riskAssessment->setConflictOfInterest($riskAssessmentData['conflictOfInterest']); $article->setRiskAssessment($riskAssessment); parent::execute(); // Save the article $articleDao->updateArticle($article); // Update references list if it changed. $citationDao =& DAORegistry::getDAO('CitationDAO'); $rawCitationList = $article->getCitations(); if ($previousRawCitationList != $rawCitationList) { $citationDao->importCitations($request, ASSOC_TYPE_ARTICLE, $article->getId(), $rawCitationList); } }
/** * Save the metadata and store the catalog data for this published * monograph. */ function execute($request) { parent::execute($request); $submission = $this->getSubmission(); $context = $request->getContext(); $waivePublicationFee = $request->getUserVar('waivePublicationFee') ? true : false; if ($waivePublicationFee) { $markAsPaid = $request->getUserVar('markAsPaid'); import('classes.payment.ojs.OJSPaymentManager'); $paymentManager = new OJSPaymentManager($request); $user = $request->getUser(); // Get a list of author user IDs $authorUserIds = array(); $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); $submitterAssignments = $stageAssignmentDao->getBySubmissionAndRoleId($submission->getId(), ROLE_ID_AUTHOR); $submitterAssignment = $submitterAssignments->next(); assert($submitterAssignment); // At least one author should be assigned $queuedPayment =& $paymentManager->createQueuedPayment($context->getId(), PAYMENT_TYPE_PUBLICATION, $markAsPaid ? $submitterAssignment->getUserId() : $user->getId(), $submission->getId(), $markAsPaid ? $context->getSetting('publicationFee') : 0, $markAsPaid ? $context->getSetting('currency') : ''); $paymentManager->queuePayment($queuedPayment); // Since this is a waiver, fulfill the payment immediately $paymentManager->fulfillQueuedPayment($request, $queuedPayment, $markAsPaid ? 'ManualPayment' : 'Waiver'); } else { // Get the issue for publication. $issueDao = DAORegistry::getDAO('IssueDAO'); $issueId = $this->getData('issueId'); $issue = $issueDao->getById($issueId, $context->getId()); $sectionDao = DAORegistry::getDAO('SectionDAO'); $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO'); $publishedArticle = $publishedArticleDao->getPublishedArticleByArticleId($submission->getId(), null, false); /* @var $publishedArticle PublishedArticle */ if ($publishedArticle) { if (!$issue || !$issue->getPublished()) { $fromIssue = $issueDao->getById($publishedArticle->getIssueId(), $context->getId()); if ($fromIssue->getPublished()) { // Insert article tombstone import('classes.article.ArticleTombstoneManager'); $articleTombstoneManager = new ArticleTombstoneManager(); $articleTombstoneManager->insertArticleTombstone($submission, $context); } } } import('classes.search.ArticleSearchIndex'); $articleSearchIndex = new ArticleSearchIndex(); // define the access status for the article if none is set. $accessStatus = $this->getData('accessStatus') != '' ? $this->getData('accessStatus') : ARTICLE_ACCESS_ISSUE_DEFAULT; $articleDao = DAORegistry::getDAO('ArticleDAO'); if (!is_null($this->getData('pages'))) { $submission->setPages($this->getData('pages')); } if ($issue) { // Schedule against an issue. if ($publishedArticle) { $publishedArticle->setIssueId($issueId); $publishedArticle->setSequence(REALLY_BIG_NUMBER); $publishedArticle->setDatePublished($this->getData('datePublished')); $publishedArticle->setAccessStatus($accessStatus); $publishedArticleDao->updatePublishedArticle($publishedArticle); // Re-index the published article metadata. $articleSearchIndex->articleMetadataChanged($publishedArticle); } else { $publishedArticle = $publishedArticleDao->newDataObject(); $publishedArticle->setId($submission->getId()); $publishedArticle->setIssueId($issueId); $publishedArticle->setDatePublished(Core::getCurrentDate()); $publishedArticle->setSequence(REALLY_BIG_NUMBER); $publishedArticle->setAccessStatus($accessStatus); $publishedArticleDao->insertObject($publishedArticle); // If we're using custom section ordering, and if this is the first // article published in a section, make sure we enter a custom ordering // for it. (Default at the end of the list.) if ($sectionDao->customSectionOrderingExists($issueId)) { if ($sectionDao->getCustomSectionOrder($issueId, $submission->getSectionId()) === null) { $sectionDao->insertCustomSectionOrder($issueId, $submission->getSectionId(), REALLY_BIG_NUMBER); $sectionDao->resequenceCustomSectionOrders($issueId); } } // Index the published article metadata and files for the first time. $articleSearchIndex->articleMetadataChanged($publishedArticle); $articleSearchIndex->submissionFilesChanged($publishedArticle); } } else { if ($publishedArticle) { // This was published elsewhere; make sure we don't // mess up sequencing information. $issueId = $publishedArticle->getIssueId(); $publishedArticleDao->deletePublishedArticleByArticleId($submission->getId()); // Delete the article from the search index. $articleSearchIndex->submissionFileDeleted($submission->getId()); } } if ($this->getData('attachPermissions')) { $submission->setCopyrightYear($this->getData('copyrightYear')); $submission->setCopyrightHolder($this->getData('copyrightHolder'), null); // Localized $submission->setLicenseURL($this->getData('licenseURL')); } else { $submission->setCopyrightYear(null); $submission->setCopyrightHolder(null, null); $submission->setLicenseURL(null); } // Resequence the articles. $publishedArticleDao->resequencePublishedArticles($submission->getSectionId(), $issueId); $submission->stampStatusModified(); if ($issue && $issue->getPublished()) { $submission->setStatus(STATUS_PUBLISHED); // delete article tombstone $tombstoneDao = DAORegistry::getDAO('DataObjectTombstoneDAO'); $tombstoneDao->deleteByDataObjectId($submission->getId()); } else { $submission->setStatus(STATUS_QUEUED); } $articleDao->updateObject($submission); $articleSearchIndex->articleChangesFinished(); } }