本文整理汇总了PHP中SectionEditorAction::assignLayoutEditor方法的典型用法代码示例。如果您正苦于以下问题:PHP SectionEditorAction::assignLayoutEditor方法的具体用法?PHP SectionEditorAction::assignLayoutEditor怎么用?PHP SectionEditorAction::assignLayoutEditor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SectionEditorAction
的用法示例。
在下文中一共展示了SectionEditorAction::assignLayoutEditor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assignLayoutEditor
/**
* Assign/reassign a layout editor to the submission.
* @param $args array ($articleId, [$userId])
*/
function assignLayoutEditor($args)
{
$articleId = isset($args[0]) ? (int) $args[0] : 0;
$editorId = isset($args[1]) ? (int) $args[1] : 0;
list($journal, $submission) = SubmissionEditHandler::validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
$roleDao =& DAORegistry::getDAO('RoleDAO');
if ($editorId && $roleDao->roleExists($journal->getJournalId(), $editorId, ROLE_ID_LAYOUT_EDITOR)) {
SectionEditorAction::assignLayoutEditor($submission, $editorId);
Request::redirect(null, null, 'submissionEditing', $articleId);
} else {
$searchType = null;
$searchMatch = null;
$search = $searchQuery = Request::getUserVar('search');
$searchInitial = Request::getUserVar('searchInitial');
if (isset($search)) {
$searchType = Request::getUserVar('searchField');
$searchMatch = Request::getUserVar('searchMatch');
} else {
if (isset($searchInitial)) {
$searchInitial = String::strtoupper($searchInitial);
$searchType = USER_FIELD_INITIAL;
$search = $searchInitial;
}
}
$layoutEditors = $roleDao->getUsersByRoleId(ROLE_ID_LAYOUT_EDITOR, $journal->getJournalId(), $searchType, $search, $searchMatch);
$sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
$layoutEditorStatistics = $sectionEditorSubmissionDao->getLayoutEditorStatistics($journal->getJournalId());
parent::setupTemplate(true, $articleId, 'editing');
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('searchField', $searchType);
$templateMgr->assign('searchMatch', $searchMatch);
$templateMgr->assign('search', $searchQuery);
$templateMgr->assign('searchInitial', Request::getUserVar('searchInitial'));
$templateMgr->assign('alphaList', explode(' ', Locale::translate('common.alphaList')));
$templateMgr->assign('pageTitle', 'user.role.layoutEditors');
$templateMgr->assign('pageSubTitle', 'editor.article.selectLayoutEditor');
$templateMgr->assign('actionHandler', 'assignLayoutEditor');
$templateMgr->assign('articleId', $articleId);
$templateMgr->assign_by_ref('users', $layoutEditors);
$layoutAssignment =& $submission->getLayoutAssignment();
if ($layoutAssignment) {
$templateMgr->assign('currentUser', $layoutAssignment->getEditorId());
}
$templateMgr->assign('fieldOptions', array(USER_FIELD_FIRSTNAME => 'user.firstName', USER_FIELD_LASTNAME => 'user.lastName', USER_FIELD_USERNAME => 'user.username', USER_FIELD_EMAIL => 'user.email'));
$templateMgr->assign('statistics', $layoutEditorStatistics);
$templateMgr->assign('helpTopicId', 'journal.roles.layoutEditor');
$templateMgr->display('sectionEditor/selectUser.tpl');
}
}
示例2: assignLayoutEditor
/**
* Assign/reassign a layout editor to the submission.
* @param $args array ($articleId, [$userId])
* @param $request object
*/
function assignLayoutEditor($args, $request)
{
$articleId = (int) array_shift($args);
$editorId = (int) array_shift($args);
$this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
$journal =& $request->getJournal();
$submission =& $this->submission;
$roleDao =& DAORegistry::getDAO('RoleDAO');
$signoffDao =& DAORegistry::getDAO('SignoffDAO');
if ($editorId && $roleDao->userHasRole($journal->getId(), $editorId, ROLE_ID_LAYOUT_EDITOR)) {
SectionEditorAction::assignLayoutEditor($submission, $editorId, $request);
$request->redirect(null, null, 'submissionEditing', $articleId);
} else {
$searchType = null;
$searchMatch = null;
$search = $searchQuery = $request->getUserVar('search');
$searchInitial = $request->getUserVar('searchInitial');
if (!empty($search)) {
$searchType = $request->getUserVar('searchField');
$searchMatch = $request->getUserVar('searchMatch');
} elseif (!empty($searchInitial)) {
$searchInitial = String::strtoupper($searchInitial);
$searchType = USER_FIELD_INITIAL;
$search = $searchInitial;
}
$layoutEditors = $roleDao->getUsersByRoleId(ROLE_ID_LAYOUT_EDITOR, $journal->getId(), $searchType, $search, $searchMatch);
$sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
$layoutEditorStatistics = $sectionEditorSubmissionDao->getLayoutEditorStatistics($journal->getId());
$this->setupTemplate(true, $articleId, 'editing');
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('searchField', $searchType);
$templateMgr->assign('searchMatch', $searchMatch);
$templateMgr->assign('search', $searchQuery);
$templateMgr->assign('searchInitial', $request->getUserVar('searchInitial'));
$templateMgr->assign('alphaList', explode(' ', __('common.alphaList')));
$templateMgr->assign('pageTitle', 'user.role.layoutEditors');
$templateMgr->assign('pageSubTitle', 'editor.article.selectLayoutEditor');
$templateMgr->assign('actionHandler', 'assignLayoutEditor');
$templateMgr->assign('articleId', $articleId);
$templateMgr->assign_by_ref('users', $layoutEditors);
$layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
if ($layoutSignoff) {
$templateMgr->assign('currentUser', $layoutSignoff->getUserId());
}
$templateMgr->assign('fieldOptions', array(USER_FIELD_FIRSTNAME => 'user.firstName', USER_FIELD_LASTNAME => 'user.lastName', USER_FIELD_USERNAME => 'user.username', USER_FIELD_EMAIL => 'user.email'));
$templateMgr->assign('statistics', $layoutEditorStatistics);
$templateMgr->assign('helpTopicId', 'journal.roles.layoutEditor');
$templateMgr->display('sectionEditor/selectUser.tpl');
}
}