/** * Delete a file or revision * @param $args array * @param $request Request * @return string a serialized JSON object */ function deleteFile($args, &$request) { // FIXME: authorize! $fileId = (int) $request->getUserVar('fileId'); $success = false; if ($fileId) { // Delete all revisions or only one? $revision = $request->getUserVar('revision') ? (int) $request->getUserVar('revision') : null; // Delete the file/revision but only when it belongs to the authorized monograph // and to the right file stage. $monograph =& $this->getMonograph(); $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO'); /* @var $submissionFileDao SubmissionFileDAO */ if ($revision) { $success = (bool) $submissionFileDao->deleteRevisionById($fileId, $revision, $this->getFileStage(), $monograph->getId()); } else { $success = (bool) $submissionFileDao->deleteAllRevisionsById($fileId, $this->getFileStage(), $monograph->getId()); } } if ($success) { return DAO::getDataChangedEvent($fileId); } else { $json = new JSON(false); return $json->getString(); } }
/** * Update proof submission file pub ids. * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function updateIdentifiers($args, $request) { $submissionFile = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE); $stageId = $request->getUserVar('stageId'); import('lib.pkp.controllers.tab.pubIds.form.PKPPublicIdentifiersForm'); $form = new PKPPublicIdentifiersForm($submissionFile, $stageId); $form->readInputData(); if ($form->validate($request)) { $form->execute($request); return DAO::getDataChangedEvent($submissionFile->getId()); } else { return new JSONMessage(true, $form->fetch($request)); } }
/** * Save 'manage final draft files' form * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function updateFinalDraftFiles($args, $request) { $submission = $this->getSubmission(); import('lib.pkp.controllers.grid.files.final.form.ManageFinalDraftFilesForm'); $manageFinalDraftFilesForm = new ManageFinalDraftFilesForm($submission->getId()); $manageFinalDraftFilesForm->readInputData(); if ($manageFinalDraftFilesForm->validate()) { $manageFinalDraftFilesForm->execute($args, $request, $this->getGridCategoryDataElements($request, $this->getStageId())); // Let the calling grid reload itself return DAO::getDataChangedEvent(); } else { return new JSONMessage(false); } }
/** * Save 'manage proof files' form * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function updateProofFiles($args, $request) { $submission = $this->getSubmission(); $representation = $this->getAuthorizedContextObject(ASSOC_TYPE_REPRESENTATION); import('lib.pkp.controllers.grid.files.proof.form.ManageProofFilesForm'); $manageProofFilesForm = new ManageProofFilesForm($submission->getId(), $representation->getId()); $manageProofFilesForm->readInputData(); if ($manageProofFilesForm->validate()) { $manageProofFilesForm->execute($args, $request, $this->getGridCategoryDataElements($request, $this->getStageId()), SUBMISSION_FILE_PROOF); // Let the calling grid reload itself return DAO::getDataChangedEvent(); } else { return new JSONMessage(false); } }
/** * Approve/disapprove the copyediting file, changing its visibility. * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function approveCopyedit($args, $request) { $submissionFile = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE); $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); if ($submissionFile->getViewable()) { // No longer expose the file to be sent to next stage. $submissionFile->setViewable(false); } else { // Expose the file. $submissionFile->setViewable(true); } $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO'); $submissionFileDao->updateObject($submissionFile); return DAO::getDataChangedEvent($submissionFile->getId()); }
/** * Save 'manage review files' form * @param $args array * @param $request PKPRequest * @return string Serialized JSON object */ function updateReviewFiles($args, &$request) { $monograph =& $this->getMonograph(); import('controllers.grid.files.review.form.ManageReviewFilesForm'); $manageReviewFilesForm = new ManageReviewFilesForm($monograph->getId(), $this->getRequestArg('reviewType'), $this->getRequestArg('round')); $manageReviewFilesForm->readInputData(); if ($manageReviewFilesForm->validate()) { $manageReviewFilesForm->execute($args, $request); // Let the calling grid reload itself return DAO::getDataChangedEvent(); } else { $json = new JSON(false); return $json->getString(); } }
/** * Save 'manage query files' form * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function updateQueryNoteFiles($args, $request) { $submission = $this->getSubmission(); $query = $this->getAuthorizedContextObject(ASSOC_TYPE_QUERY); import('lib.pkp.controllers.grid.files.query.form.ManageQueryNoteFilesForm'); $manageQueryNoteFilesForm = new ManageQueryNoteFilesForm($submission->getId(), $query->getId(), $request->getUserVar('noteId')); $manageQueryNoteFilesForm->readInputData(); if ($manageQueryNoteFilesForm->validate()) { $manageQueryNoteFilesForm->execute($args, $request, $this->getGridCategoryDataElements($request, $this->getStageId())); // Let the calling grid reload itself return DAO::getDataChangedEvent(); } else { return new JSONMessage(false); } }
/** * Save 'manage copyedited files' form * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function updateCopyeditFiles($args, $request) { $submission = $this->getSubmission(); import('lib.pkp.controllers.grid.files.copyedit.form.ManageCopyeditFilesForm'); $manageCopyeditFilesForm = new ManageCopyeditFilesForm($submission->getId()); $manageCopyeditFilesForm->readInputData(); if ($manageCopyeditFilesForm->validate()) { $manageCopyeditFilesForm->execute($args, $request, $this->getGridCategoryDataElements($request, $this->getStageId())); $notificationMgr = new NotificationManager(); $notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_ASSIGN_COPYEDITOR, NOTIFICATION_TYPE_AWAITING_COPYEDITS), null, ASSOC_TYPE_SUBMISSION, $submission->getId()); // Let the calling grid reload itself return DAO::getDataChangedEvent(); } else { return new JSONMessage(false); } }
/** * Save 'manage review files' form. * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function updateReviewFiles($args, $request) { $submission = $this->getSubmission(); import('lib.pkp.controllers.grid.files.review.form.ManageReviewFilesForm'); $manageReviewFilesForm = new ManageReviewFilesForm($submission->getId(), $this->getRequestArg('stageId'), $this->getRequestArg('reviewRoundId')); $manageReviewFilesForm->readInputData(); if ($manageReviewFilesForm->validate()) { $dataProvider = $this->getDataProvider(); $manageReviewFilesForm->execute($args, $request, $this->getGridCategoryDataElements($request, $this->getStageId())); $this->setupTemplate($request); $user = $request->getUser(); NotificationManager::createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.updatedReviewFiles'))); // Let the calling grid reload itself return DAO::getDataChangedEvent(); } else { return new JSONMessage(false); } }
/** * Delete a media entry * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function deleteMedia($args, $request) { // Identify the object to be deleted $socialMediaId = (int) $request->getUserVar('socialMediaId'); $context = $this->getContext(); $socialMediaDao = DAORegistry::getDAO('SocialMediaDAO'); $socialMedia = $socialMediaDao->getById($socialMediaId, $context->getId()); if (isset($socialMedia)) { $result = $socialMediaDao->deleteObject($socialMedia); if ($result) { $currentUser = $request->getUser(); $notificationMgr = new NotificationManager(); $notificationMgr->createTrivialNotification($currentUser->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.removedSocialMedia'))); return DAO::getDataChangedEvent(); } else { return new JSONMessage(false, __('manager.setup.errorDeletingItem')); } } else { fatalError('Social Media not in current context context.'); } }
/** * Reload the default localized settings for the journal * @param $args array * @param $request object */ function reloadLocalizedDefaultSettings($args, $request) { // make sure the locale is valid $locale = $request->getUserVar('localeToLoad'); if (!AppLocale::isLocaleValid($locale)) { $json = new JSONMessage(false); return $json->getString(); } $journal = $request->getJournal(); $journalSettingsDao = DAORegistry::getDAO('JournalSettingsDAO'); $journalSettingsDao->reloadLocalizedDefaultSettings($journal->getId(), 'registry/journalSettings.xml', array('indexUrl' => $request->getIndexUrl(), 'journalPath' => $journal->getData('path'), 'primaryLocale' => $journal->getPrimaryLocale(), 'journalName' => $journal->getName($journal->getPrimaryLocale())), $locale); // also reload the user group localizable data $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); $userGroupDao->installLocale($locale, $journal->getId()); return DAO::getDataChangedEvent(); }
/** * Returns a data changd event to re-enable the link action. Refactored out of * recordDownload since library files do not have downloads recorded and are in a * different context. * @param $args aray * @param $request Request * @return JSONMessage JSON object */ function enableLinkAction($args, $request) { return DAO::getDataChangedEvent(); }
/** * Remove an article from the issue. * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function removeArticle($args, $request) { $journal = $request->getJournal(); $articleId = (int) $request->getUserVar('articleId'); $issue = $this->getAuthorizedContextObject(ASSOC_TYPE_ISSUE); $issueDao = DAORegistry::getDAO('IssueDAO'); $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO'); $article = $publishedArticleDao->getPublishedArticleByArticleId($articleId); import('classes.article.ArticleTombstoneManager'); $articleTombstoneManager = new ArticleTombstoneManager(); if ($article && $article->getIssueId() == $issue->getId()) { if ($issue->getPublished()) { $articleTombstoneManager->insertArticleTombstone($article, $journal); } $article->setStatus(STATUS_QUEUED); $article->stampStatusModified(); // If the article is the only one in the section, delete the section from custom issue ordering $sectionId = $article->getSectionId(); $publishedArticleArray = $publishedArticleDao->getPublishedArticlesBySectionId($sectionId, $issue->getId()); if (sizeof($publishedArticleArray) == 1) { $sectionDao = DAORegistry::getDAO('SectionDAO'); $sectionDao->deleteCustomSection($issue->getId(), $sectionId); } $publishedArticleDao->deletePublishedArticleByArticleId($articleId); $publishedArticleDao->resequencePublishedArticles($article->getSectionId(), $issue->getId()); return DAO::getDataChangedEvent(); } // If we've fallen through, it must be a badly-specified article return new JSONMessage(false); }
/** * Update user group data on database and grid. * @param $args array * @param $request PKPRequest */ function updateUserGroup($args, &$request) { $userGroupForm = $this->_getUserGroupForm($request); $userGroupForm->readInputData(); if ($userGroupForm->validate()) { $userGroupForm->execute($request); return DAO::getDataChangedEvent($userGroupForm->getUserGroupId()); } else { $json = new JSON(false); return $json->getString(); } }
/** * Sign off the given file revision. * @param $args array * @param $request Request */ function signOffFile($args, $request) { // Retrieve the file to be signed off. $fileId = (int) $request->getUserVar('fileId'); // Make sure that the file revision is in the grid. $submissionFiles = $this->getGridDataElements($request); if (!isset($submissionFiles[$fileId])) { fatalError('Invalid file id!'); } assert(isset($submissionFiles[$fileId]['submissionFile'])); $submissionFile = $submissionFiles[$fileId]['submissionFile']; assert(is_a($submissionFile, 'SubmissionFile')); // Retrieve the user. $user = $request->getUser(); // Insert or update the sign off corresponding // to this file revision. $signoffDao = DAORegistry::getDAO('SignoffDAO'); /* @var $signoffDao SignoffDAO */ $signoff = $signoffDao->build($this->getSymbolic(), ASSOC_TYPE_SUBMISSION_FILE, $submissionFile->getFileId(), $user->getId()); $signoff->setDateCompleted(Core::getCurrentDate()); $signoffDao->updateObject($signoff); $this->setupTemplate($request); NotificationManager::createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.signedFile'))); return DAO::getDataChangedEvent($fileId); }
/** * Delete a category * @param $args array * @param $request PKPRequest * @return string Serialized JSON object */ function deleteItem($args, $request) { $rowId = $request->getUserVar('rowId'); // Get all categories $categoryDao = DAORegistry::getDAO('CategoryDAO'); $entryDao = $categoryDao->getEntryDAO(); foreach ($categoryDao->getCategories() as $id => $name) { if ($id == $rowId) { $entryDao->deleteObjectById($id); break; } } $categoryDao->rebuildCache(); return DAO::getDataChangedEvent($rowId); }
/** * Save the metadata of the latest revision of * the requested submission file. * @param $args array * @param $request Request * @return JSONMessage JSON object */ function saveMetadata($args, $request) { $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); $submissionFile = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE); $reviewRound = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ROUND); $stageId = $request->getUserVar('stageId'); $metadataForm = $submissionFile->getMetadataForm($stageId, $reviewRound); $metadataForm->readInputData(); if ($metadataForm->validate()) { $metadataForm->execute($args, $request); $submissionFile = $metadataForm->getSubmissionFile(); // Get a list of author user IDs $authorUserIds = array(); $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); $submitterAssignments = $stageAssignmentDao->getBySubmissionAndRoleId($submission->getId(), ROLE_ID_AUTHOR); while ($assignment = $submitterAssignments->next()) { $authorUserIds[] = $assignment->getUserId(); } // Update the notifications $notificationMgr = new NotificationManager(); /* @var $notificationMgr NotificationManager */ $notificationMgr->updateNotification($request, $this->getUpdateNotifications(), $authorUserIds, ASSOC_TYPE_SUBMISSION, $submission->getId()); if ($reviewRound) { $notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_ALL_REVISIONS_IN), null, ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId()); // Delete any 'revision requested' notifications since all revisions are now in. $context = $request->getContext(); $notificationDao = DAORegistry::getDAO('NotificationDAO'); $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); $submitterAssignments = $stageAssignmentDao->getBySubmissionAndRoleId($submission->getId(), ROLE_ID_AUTHOR); while ($assignment = $submitterAssignments->next()) { $notificationDao->deleteByAssoc(ASSOC_TYPE_SUBMISSION, $submission->getId(), $assignment->getUserId(), NOTIFICATION_TYPE_EDITOR_DECISION_PENDING_REVISIONS, $context->getId()); } } // Log the upload event import('lib.pkp.classes.log.SubmissionLog'); import('classes.log.SubmissionEventLogEntry'); import('lib.pkp.classes.log.SubmissionFileEventLogEntry'); // constants $user = $request->getUser(); SubmissionLog::logEvent($request, $submission, $submissionFile->getRevision() > 1 ? SUBMISSION_LOG_FILE_REVISION_UPLOAD : SUBMISSION_LOG_FILE_UPLOAD, $submissionFile->getRevision() > 1 ? 'submission.event.fileRevised' : 'submission.event.fileUploaded', array('fileStage' => $submissionFile->getFileStage(), 'fileId' => $submissionFile->getFileId(), 'fileRevision' => $submissionFile->getRevision(), 'originalFileName' => $submissionFile->getOriginalFileName(), 'submissionId' => $submissionFile->getSubmissionId(), 'username' => $user->getUsername())); return DAO::getDataChangedEvent(); } else { return new JSONMessage(true, $metadataForm->fetch($request)); } }
/** * Delete a file * @param $args array * @param $request PKPRequest * @return string Serialized JSON object */ function deleteFile($args, $request) { $fileId = isset($args['fileId']) ? $args['fileId'] : null; $router = $request->getRouter(); $context = $router->getContext($request); if ($fileId) { $libraryFileManager = new LibraryFileManager($context->getId()); $libraryFileManager->deleteFile($fileId); return DAO::getDataChangedEvent(); } $json = new JSONMessage(false); return $json->getString(); }
/** * Delete a file * @param $args array * @param $request PKPRequest * @return string Serialized JSON object */ function deleteFile($args, &$request) { $fileId = isset($args['fileId']) ? $args['fileId'] : null; $router =& $request->getRouter(); $press =& $router->getContext($request); if ($fileId) { import('classes.file.LibraryFileManager'); $libraryFileManager = new LibraryFileManager($press->getId()); $libraryFileManager->deleteFile($fileId); return DAO::getDataChangedEvent($fileId); } $json = new JSON(false); return $json->getString(); }
/** * Delete a submission * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function deleteSubmission($args, $request) { $submissionDao = Application::getSubmissionDAO(); $submission = $submissionDao->getById((int) $request->getUserVar('submissionId')); // If the submission is incomplete, or this is a manager, allow it to be deleted if ($request->checkCSRF() && $submission && ($this->_isManager || $submission->getSubmissionProgress() != 0)) { $submissionDao->deleteById($submission->getId()); $user = $request->getUser(); NotificationManager::createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.removedSubmission'))); return DAO::getDataChangedEvent($submission->getId()); } return new JSONMessage(false); }
/** * Delete a filter * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function deleteFilter(&$args, $request) { // Identify the filter to be deleted $filter = $this->getFilterFromArgs($request, $args); $filterDao = DAORegistry::getDAO('FilterDAO'); $result = $filterDao->deleteObject($filter); if ($result) { return DAO::getDataChangedEvent(); } else { return new JSONMessage(false, __('manager.setup.filter.grid.errorDeletingFilter')); } }
/** * Delete notifications * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function deleteNotifications($args, $request) { $notificationDao = DAORegistry::getDAO('NotificationDAO'); $user = $request->getUser(); $selectedElements = (array) $request->getUserVar('selectedElements'); foreach ($selectedElements as $notificationId) { if ($notification = $notificationDao->getById($notificationId, $user->getId())) { $notificationDao->deleteObject($notification); } } return DAO::getDataChangedEvent(); }
/** * Removes an issue * @param $args array * @param $request PKPRequest */ function deleteIssue($args, $request) { $issue = $this->getAuthorizedContextObject(ASSOC_TYPE_ISSUE); $issueId = $issue->getId(); $isBackIssue = $issue->getPublished() > 0 ? true : false; // remove all published articles and return original articles to editing queue $articleDao = DAORegistry::getDAO('ArticleDAO'); $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO'); $publishedArticles = $publishedArticleDao->getPublishedArticles($issueId); if (isset($publishedArticles) && !empty($publishedArticles)) { // Insert article tombstone if the issue is published import('classes.article.ArticleTombstoneManager'); $articleTombstoneManager = new ArticleTombstoneManager(); foreach ($publishedArticles as $article) { if ($isBackIssue) { $articleTombstoneManager->insertArticleTombstone($article, $journal); } $articleDao->changeStatus($article->getId(), STATUS_QUEUED); $publishedArticleDao->deletePublishedArticleById($article->getPublishedArticleId()); } } $issueDao = DAORegistry::getDAO('IssueDAO'); $issueDao->deleteObject($issue); if ($issue->getCurrent()) { $issues = $issueDao->getPublishedIssues($journal->getId()); if (!$issues->eof()) { $issue = $issues->next(); $issue->setCurrent(1); $issueDao->updateObject($issue); } } return DAO::getDataChangedEvent($issueId); }
/** * Deletes a context image. * @param $args array * @param $request PKPRequest * @return string */ function deleteFile($args, $request) { $settingName = $request->getUserVar('fileSettingName'); $tabForm = $this->getTabForm(); $tabForm->initData($request); if ($tabForm->deleteFile($settingName, $request)) { return DAO::getDataChangedEvent($settingName); } else { return new JSONMessage(false); } }
/** * Set context primary locale. * @param $args array * @param $request Request * @return JSONMessage JSON object */ function setContextPrimaryLocale($args, $request) { $locale = (string) $request->getUserVar('rowId'); $context = $request->getContext(); $availableLocales = $this->getGridDataElements($request); if (AppLocale::isLocaleValid($locale) && array_key_exists($locale, $availableLocales)) { // Make sure at least the primary locale is chosen as available foreach (array('supportedLocales', 'supportedSubmissionLocales', 'supportedFormLocales') as $name) { ${$name} = $context->getSetting($name); if (!in_array($locale, ${$name})) { array_push(${$name}, $locale); $context->updateSetting($name, ${$name}); } } $context->setPrimaryLocale($locale); $contextDao = $context->getDAO(); $contextDao->updateObject($context); $notificationManager = new NotificationManager(); $user = $request->getUser(); $notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.localeSettingsSaved'))); } return DAO::getDataChangedEvent(); }
/** * Publish issue * @param $args array * @param $request Request */ function publishIssue($args, $request) { $issue = $this->getAuthorizedContextObject(ASSOC_TYPE_ISSUE); $issueId = $issue->getId(); $journal = $request->getJournal(); $journalId = $journal->getId(); $articleSearchIndex = null; if (!$issue->getPublished()) { $confirmationText = __('editor.issues.confirmPublish'); import('controllers.grid.pubIds.form.AssignPublicIdentifiersForm'); $formTemplate = $this->getAssignPublicIdentifiersFormTemplate(); $assignPublicIdentifiersForm = new AssignPublicIdentifiersForm($formTemplate, $issue, true, $confirmationText); if (!$request->getUserVar('confirmed')) { // Display assign pub ids modal $assignPublicIdentifiersForm->initData($args, $request); return new JSONMessage(true, $assignPublicIdentifiersForm->fetch($request)); } // Asign pub ids $assignPublicIdentifiersForm->readInputData(); $assignPublicIdentifiersForm->execute($request); // Set the status of any attendant queued articles to STATUS_PUBLISHED. $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO'); $articleDao = DAORegistry::getDAO('ArticleDAO'); $publishedArticles = $publishedArticleDao->getPublishedArticles($issueId); foreach ($publishedArticles as $publishedArticle) { $article = $articleDao->getById($publishedArticle->getId()); if ($article && $article->getStatus() == STATUS_QUEUED) { $article->setStatus(STATUS_PUBLISHED); $article->stampStatusModified(); $articleDao->updateObject($article); if (!$articleSearchIndex) { import('classes.search.ArticleSearchIndex'); $articleSearchIndex = new ArticleSearchIndex(); } $articleSearchIndex->articleMetadataChanged($publishedArticle); } // delete article tombstone $tombstoneDao = DAORegistry::getDAO('DataObjectTombstoneDAO'); $tombstoneDao->deleteByDataObjectId($article->getId()); } } $issue->setCurrent(1); $issue->setPublished(1); $issue->setDatePublished(Core::getCurrentDate()); // If subscriptions with delayed open access are enabled then // update open access date according to open access delay policy if ($journal->getSetting('publishingMode') == PUBLISHING_MODE_SUBSCRIPTION && $journal->getSetting('enableDelayedOpenAccess')) { $delayDuration = $journal->getSetting('delayedOpenAccessDuration'); $delayYears = (int) floor($delayDuration / 12); $delayMonths = (int) fmod($delayDuration, 12); $curYear = date('Y'); $curMonth = date('n'); $curDay = date('j'); $delayOpenAccessYear = $curYear + $delayYears + (int) floor(($curMonth + $delayMonths) / 12); $delayOpenAccessMonth = (int) fmod($curMonth + $delayMonths, 12); $issue->setAccessStatus(ISSUE_ACCESS_SUBSCRIPTION); $issue->setOpenAccessDate(date('Y-m-d H:i:s', mktime(0, 0, 0, $delayOpenAccessMonth, $curDay, $delayOpenAccessYear))); } $issueDao = DAORegistry::getDAO('IssueDAO'); $issueDao->updateCurrent($journalId, $issue); if ($articleSearchIndex) { $articleSearchIndex->articleChangesFinished(); } // Send a notification to associated users import('classes.notification.NotificationManager'); $notificationManager = new NotificationManager(); $notificationUsers = array(); $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); $allUsers = $userGroupDao->getUsersByContextId($journalId); while ($user = $allUsers->next()) { $notificationUsers[] = array('id' => $user->getId()); } foreach ($notificationUsers as $userRole) { $notificationManager->createNotification($request, $userRole['id'], NOTIFICATION_TYPE_PUBLISHED_ISSUE, $journalId); } $notificationManager->sendToMailingList($request, $notificationManager->createNotification($request, UNSUBSCRIBED_USER_NOTIFICATION, NOTIFICATION_TYPE_PUBLISHED_ISSUE, $journalId)); return DAO::getDataChangedEvent(); }
/** * Set a format's "approved" state * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function setApproved($args, $request) { $submission = $this->getSubmission(); $representationDao = Application::getRepresentationDAO(); $representation = $representationDao->getById($request->getUserVar('representationId'), $submission->getId()); if (!$representation) { return new JSONMessage(false, __('manager.setup.errorDeletingItem')); } $newApprovedState = (int) $request->getUserVar('newApprovedState'); $representation->setIsApproved($newApprovedState); $representationDao->updateObject($representation); return DAO::getDataChangedEvent($representation->getId()); }
/** * Delete a category * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function deleteCategory($args, $request) { // Identify the category to be deleted $categoryDao = DAORegistry::getDAO('CategoryDAO'); $press = $request->getPress(); $category = $categoryDao->getById($request->getUserVar('categoryId'), $press->getId()); // FIXME delete dependent objects? // Delete the category $categoryDao->deleteObject($category); return DAO::getDataChangedEvent(); }
/** * Removes an issue galley * @param $args array * @param $request PKPRequest */ function delete($args, $request) { $issueGalleyDao = DAORegistry::getDAO('IssueGalleyDAO'); $issueGalley = $this->getAuthorizedContextObject(ASSOC_TYPE_ISSUE_GALLEY); $issueGalley->getId(); $issueGalleyDao->deleteObject($issueGalley); return DAO::getDataChangedEvent(); }
/** * Delete a query note. * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function deleteNote($args, $request) { $query = $this->getQuery(); $noteDao = DAORegistry::getDAO('NoteDAO'); $note = $noteDao->getById($request->getUserVar('noteId')); $user = $request->getUser(); if (!$request->checkCSRF() || !$note || $note->getAssocType() != ASSOC_TYPE_QUERY || $note->getAssocId() != $query->getId()) { // The note didn't exist or has the wrong assoc info. return new JSONMessage(false); } if (!$this->getCanManage($note)) { // The user doesn't own the note and isn't priveleged enough to delete it. return new JSONMessage(false); } $noteDao->deleteObject($note); return DAO::getDataChangedEvent($note->getId()); }