本文整理汇总了PHP中Application::getApplicationStages方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::getApplicationStages方法的具体用法?PHP Application::getApplicationStages怎么用?PHP Application::getApplicationStages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application
的用法示例。
在下文中一共展示了Application::getApplicationStages方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getWorkflowStageTranslationKeys
/**
* Return a mapping of workflow stages and its translation keys.
* @return array
*/
static function getWorkflowStageTranslationKeys()
{
$applicationStages = Application::getApplicationStages();
AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_APP_SUBMISSION);
static $stageMapping = array(WORKFLOW_STAGE_ID_SUBMISSION => 'submission.submission', WORKFLOW_STAGE_ID_INTERNAL_REVIEW => 'workflow.review.internalReview', WORKFLOW_STAGE_ID_EXTERNAL_REVIEW => 'workflow.review.externalReview', WORKFLOW_STAGE_ID_EDITING => 'submission.editorial', WORKFLOW_STAGE_ID_PRODUCTION => 'submission.production');
return array_intersect_key($stageMapping, array_flip($applicationStages));
}
示例2: getCellActions
/**
* @copydoc GridCellProvider::getCellActions()
*/
function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT)
{
$workflowStages = Application::getApplicationStages();
$columnId = $column->getId();
if (in_array($columnId, $workflowStages)) {
$userGroup = $row->getData();
/* @var $userGroup UserGroup */
$userGroupDao = DAORegistry::getDAO('UserGroupDAO');
/* @var $userGroupDao UserGroupDAO */
$assignedStages = $userGroupDao->getAssignedStagesByUserGroupId($userGroup->getContextId(), $userGroup->getId());
$router = $request->getRouter();
$roleDao = DAORegistry::getDAO('RoleDAO');
/* @var $roleDao RoleDAO */
if (!in_array($columnId, $roleDao->getForbiddenStages($userGroup->getRoleId()))) {
if (in_array($columnId, array_keys($assignedStages))) {
$operation = 'unassignStage';
$actionTitleKey = 'grid.userGroup.unassignStage';
} else {
$operation = 'assignStage';
$actionTitleKey = 'grid.userGroup.assignStage';
}
$actionArgs = array_merge(array('stageId' => $columnId), $row->getRequestArgs());
$actionUrl = $router->url($request, null, null, $operation, null, $actionArgs);
import('lib.pkp.classes.linkAction.request.AjaxAction');
$actionRequest = new AjaxAction($actionUrl);
$linkAction = new LinkAction($operation, $actionRequest, __($actionTitleKey), null);
return array($linkAction);
}
}
return parent::getCellActions($request, $row, $column, $position);
}
示例3: effect
/**
* @see AuthorizationPolicy::effect()
*/
function effect()
{
// Check the stage id.
$validAppStages = Application::getApplicationStages();
if (!in_array($this->_stageId, array_values($validAppStages))) {
return AUTHORIZATION_DENY;
}
// Save the workflow stage to the authorization context.
$this->addAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE, $this->_stageId);
return AUTHORIZATION_PERMIT;
}
示例4: deleteParticipant
/**
* Delete the participant from the user groups
* @param $args
* @param $request
* @return JSONMessage JSON object
*/
function deleteParticipant($args, $request)
{
$submission = $this->getSubmission();
$stageId = $this->getStageId();
$assignmentId = (int) $request->getUserVar('assignmentId');
$stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
/* @var $stageAssignmentDao StageAssignmentDAO */
$stageAssignment = $stageAssignmentDao->getById($assignmentId);
if (!$stageAssignment || $stageAssignment->getSubmissionId() != $submission->getId()) {
fatalError('Invalid Assignment');
}
// Delete the assignment
$stageAssignmentDao->deleteObject($stageAssignment);
// FIXME: perhaps we can just insert the notification on page load
// instead of having it there all the time?
$stages = Application::getApplicationStages();
foreach ($stages as $workingStageId) {
// remove user's assignment from this user group from all the stages
// (no need to check if user group is assigned, since nothing will be deleted if there isn't)
$stageAssignmentDao->deleteByAll($submission->getId(), $workingStageId, $stageAssignment->getUserGroupId(), $stageAssignment->getUserId());
}
$notificationMgr = new NotificationManager();
import('classes.workflow.EditorDecisionActionsManager');
$notificationMgr->updateNotification($request, EditorDecisionActionsManager::getStageNotifications(), null, ASSOC_TYPE_SUBMISSION, $submission->getId());
// Log removal.
$userDao = DAORegistry::getDAO('UserDAO');
$assignedUser = $userDao->getById($userId);
$userGroupDao = DAORegistry::getDAO('UserGroupDAO');
$userGroup = $userGroupDao->getById($stageAssignment->getUserGroupId());
import('lib.pkp.classes.log.SubmissionLog');
SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_REMOVE_PARTICIPANT, 'submission.event.participantRemoved', array('name' => $assignedUser->getFullName(), 'username' => $assignedUser->getUsername(), 'userGroupName' => $userGroup->getLocalizedName()));
// Redraw the category
return DAO::getDataChangedEvent($stageAssignment->getUserGroupId());
}
示例5: saveParticipant
/**
* Update the row for the current userGroup's stage participant list.
* @param $args array
* @param $request PKPRequest
* @return JSONMessage JSON object
*/
function saveParticipant($args, $request)
{
$submission = $this->getSubmission();
$stageId = $this->getStageId();
$userGroups = $this->getGridDataElements($request);
import('lib.pkp.controllers.grid.users.stageParticipant.form.AddParticipantForm');
$form = new AddParticipantForm($submission, $stageId);
$form->readInputData();
if ($form->validate()) {
list($userGroupId, $userId, $stageAssignmentId) = $form->execute($request);
$notificationMgr = new NotificationManager();
// Check user group role id.
$userGroupDao = DAORegistry::getDAO('UserGroupDAO');
$stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
$userGroup = $userGroupDao->getById($userGroupId);
import('classes.workflow.EditorDecisionActionsManager');
if ($userGroup->getRoleId() == ROLE_ID_MANAGER) {
$notificationMgr->updateNotification($request, EditorDecisionActionsManager::getStageNotifications(), null, ASSOC_TYPE_SUBMISSION, $submission->getId());
$stages = Application::getApplicationStages();
foreach ($stages as $workingStageId) {
// remove the 'editor required' task if we now have an editor assigned
if ($stageAssignmentDao->editorAssignedToStage($submission->getId(), $stageId)) {
$notificationDao = DAORegistry::getDAO('NotificationDAO');
$notificationDao->deleteByAssoc(ASSOC_TYPE_SUBMISSION, $submission->getId(), null, NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_REQUIRED);
}
}
}
// Create trivial notification.
$user = $request->getUser();
$notificationMgr->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.addedStageParticipant')));
// Log addition.
$userDao = DAORegistry::getDAO('UserDAO');
$assignedUser = $userDao->getById($userId);
import('lib.pkp.classes.log.SubmissionLog');
SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_ADD_PARTICIPANT, 'submission.event.participantAdded', array('name' => $assignedUser->getFullName(), 'username' => $assignedUser->getUsername(), 'userGroupName' => $userGroup->getLocalizedName()));
// send message to user if form is filled in.
if ($form->getData('message')) {
$form->sendMessage($form->getData('userId'), $submission, $request);
$this->_logEventAndCreateNotification($request);
}
return DAO::getDataChangedEvent($userGroupId);
} else {
return new JSONMessage(true, $form->fetch($request));
}
}