/** * Displays the author dashboard. * @param $args array * @param $request PKPRequest */ function submission($args, $request) { // Pass the authorized submission on to the template. $this->setupTemplate($request); $templateMgr = TemplateManager::getManager($request); $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); $templateMgr->assign('submission', $submission); // Link actions. import('lib.pkp.controllers.modals.submissionMetadata.linkAction.AuthorViewMetadataLinkAction'); $templateMgr->assign('viewMetadataAction', new AuthorViewMetadataLinkAction($request, $submission->getId())); import('lib.pkp.controllers.modals.documentLibrary.linkAction.SubmissionLibraryLinkAction'); $templateMgr->assign('submissionLibraryAction', new SubmissionLibraryLinkAction($request, $submission->getId())); $workflowStages = WorkflowStageDAO::getWorkflowStageKeysAndPaths(); $stageNotifications = array(); foreach (array_keys($workflowStages) as $stageId) { $stageNotifications[$stageId] = false; } $editDecisionDao = DAORegistry::getDAO('EditDecisionDAO'); /* @var $editDecisionDao EditDecisionDAO */ $stageDecisions = $editDecisionDao->getEditorDecisions($submission->getId()); $stagesWithDecisions = array(); foreach ($stageDecisions as $decision) { $stagesWithDecisions[$decision['stageId']] = $decision['stageId']; } $workflowStages = WorkflowStageDAO::getStageStatusesBySubmission($submission, $stagesWithDecisions, $stageNotifications); $templateMgr->assign('workflowStages', $workflowStages); return $templateMgr->display('authorDashboard/authorDashboard.tpl'); }
/** * Return a message string for the notification based on its type * and associated object. * @copydoc INotificationInfoProvider::getNotificationContents() */ public function getNotificationMessage($request, $notification) { $type = $notification->getType(); assert(isset($type)); $submissionDao = Application::getSubmissionDAO(); switch ($type) { case NOTIFICATION_TYPE_SUCCESS: case NOTIFICATION_TYPE_ERROR: case NOTIFICATION_TYPE_WARNING: if (!is_null($this->getNotificationSettings($notification->getId()))) { $notificationSettings = $this->getNotificationSettings($notification->getId()); return $notificationSettings['contents']; } else { return __('common.changesSaved'); } case NOTIFICATION_TYPE_FORM_ERROR: case NOTIFICATION_TYPE_ERROR: $notificationSettings = $this->getNotificationSettings($notification->getId()); assert(!is_null($notificationSettings['contents'])); return $notificationSettings['contents']; case NOTIFICATION_TYPE_PLUGIN_ENABLED: return $this->_getTranslatedKeyWithParameters('common.pluginEnabled', $notification->getId()); case NOTIFICATION_TYPE_PLUGIN_DISABLED: return $this->_getTranslatedKeyWithParameters('common.pluginDisabled', $notification->getId()); case NOTIFICATION_TYPE_LOCALE_INSTALLED: return $this->_getTranslatedKeyWithParameters('admin.languages.localeInstalled', $notification->getId()); case NOTIFICATION_TYPE_NEW_ANNOUNCEMENT: assert($notification->getAssocType() == ASSOC_TYPE_ANNOUNCEMENT); return __('notification.type.newAnnouncement'); case NOTIFICATION_TYPE_ALL_REVIEWS_IN: case NOTIFICATION_TYPE_ALL_REVISIONS_IN: if ($notification->getType() == NOTIFICATION_TYPE_ALL_REVIEWS_IN) { $localeKey = 'notification.type.allReviewsIn'; } else { $localeKey = 'notification.type.allRevisionsIn'; } assert($notification->getAssocType() == ASSOC_TYPE_REVIEW_ROUND && is_numeric($notification->getAssocId())); $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); $reviewRound = $reviewRoundDao->getById($notification->getAssocId()); assert(is_a($reviewRound, 'ReviewRound')); $stagesData = WorkflowStageDAO::getWorkflowStageKeysAndPaths(); return __($localeKey, array('stage' => __($stagesData[$reviewRound->getStageId()]['translationKey']))); case NOTIFICATION_TYPE_APPROVE_SUBMISSION: assert($notification->getAssocType() == ASSOC_TYPE_SUBMISSION && is_numeric($notification->getAssocId())); return __('notification.type.approveSubmission'); case NOTIFICATION_TYPE_REVIEWER_COMMENT: assert($notification->getAssocType() == ASSOC_TYPE_REVIEW_ASSIGNMENT && is_numeric($notification->getAssocId())); $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); /* @var $reviewAssignmentDao ReviewAssignmentDAO */ $reviewAssignment = $reviewAssignmentDao->getById($notification->getAssocId()); $submission = $submissionDao->getById($reviewAssignment->getSubmissionId()); /* @var $submission Submission */ return __('notification.type.reviewerComment', array('title' => $submission->getLocalizedTitle())); case NOTIFICATION_TYPE_LAYOUT_ASSIGNMENT: assert($notification->getAssocType() == ASSOC_TYPE_SUBMISSION && is_numeric($notification->getAssocId())); $submission = $submissionDao->getById($notification->getAssocId()); return __('notification.type.layouteditorRequest', array('title' => $submission->getLocalizedTitle())); case NOTIFICATION_TYPE_INDEX_ASSIGNMENT: assert($notification->getAssocType() == ASSOC_TYPE_SUBMISSION && is_numeric($notification->getAssocId())); $submission = $submissionDao->getById($notification->getAssocId()); return __('notification.type.indexRequest', array('title' => $submission->getLocalizedTitle())); case NOTIFICATION_TYPE_REVIEW_ASSIGNMENT: return __('notification.type.reviewAssignment'); case NOTIFICATION_TYPE_REVIEW_ROUND_STATUS: assert($notification->getAssocType() == ASSOC_TYPE_REVIEW_ROUND && is_numeric($notification->getAssocId())); $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); $reviewRound = $reviewRoundDao->getById($notification->getAssocId()); AppLocale::requireComponents(LOCALE_COMPONENT_APP_EDITOR); // load review round status keys. return __($reviewRound->getStatusKey()); default: return $this->getByDelegate($notification->getType(), $notification->getAssocType(), $notification->getAssocId(), __FUNCTION__, array($request, $notification)); } }
/** * Setup variables for the template * @param $request Request */ function setupTemplate($request) { parent::setupTemplate($request); AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_APP_SUBMISSION, LOCALE_COMPONENT_APP_EDITOR, LOCALE_COMPONENT_PKP_GRID, LOCALE_COMPONENT_PKP_EDITOR); $router = $request->getRouter(); $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE); // Construct array with workflow stages data. $workflowStages = WorkflowStageDAO::getWorkflowStageKeysAndPaths(); $templateMgr = TemplateManager::getManager($request); // Assign the authorized submission. $templateMgr->assign('submission', $submission); // Assign workflow stages related data. $templateMgr->assign('stageId', $stageId); $templateMgr->assign('submissionStageId', $submission->getStageId()); $templateMgr->assign('workflowStages', $workflowStages); import('controllers.modals.submissionMetadata.linkAction.SubmissionEntryLinkAction'); $templateMgr->assign('submissionEntryAction', new SubmissionEntryLinkAction($request, $submission->getId(), $stageId)); import('lib.pkp.controllers.informationCenter.linkAction.SubmissionInfoCenterLinkAction'); $templateMgr->assign('submissionInformationCenterAction', new SubmissionInfoCenterLinkAction($request, $submission->getId())); }
/** * Get the data for an workflow stage by * pending revisions notification type. * @return string */ private function _getStageDataByType() { $stagesData = WorkflowStageDAO::getWorkflowStageKeysAndPaths(); switch ($this->getNotificationType()) { case NOTIFICATION_TYPE_PENDING_INTERNAL_REVISIONS: return $stagesData[WORKFLOW_STAGE_ID_INTERNAL_REVIEW]; case NOTIFICATION_TYPE_PENDING_EXTERNAL_REVISIONS: return $stagesData[WORKFLOW_STAGE_ID_EXTERNAL_REVIEW]; default: assert(false); } }