本文整理汇总了PHP中Validation::isJournalManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Validation::isJournalManager方法的具体用法?PHP Validation::isJournalManager怎么用?PHP Validation::isJournalManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Validation
的用法示例。
在下文中一共展示了Validation::isJournalManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Display the form.
* @param $request Request
*/
function display($request)
{
$canOnlyRead = true;
$canOnlyReview = false;
if (Validation::isReviewer()) {
$canOnlyRead = false;
$canOnlyReview = true;
}
if (Validation::isSiteAdmin() || Validation::isJournalManager() || Validation::isEditor() || Validation::isSectionEditor()) {
$canOnlyRead = false;
$canOnlyReview = false;
}
$templateMgr =& TemplateManager::getManager();
// Remove the notification setting categories that the user will not be receiving (to simplify the form)
$notificationSettingCategories = $this->_getNotificationSettingCategories();
if ($canOnlyRead || $canOnlyReview) {
unset($notificationSettingCategories['submissions']);
}
if ($canOnlyRead) {
unset($notificationSettingCategories['reviewing']);
}
$templateMgr->assign('notificationSettingCategories', $notificationSettingCategories);
$templateMgr->assign('notificationSettings', $this->_getNotificationSettingsMap());
$templateMgr->assign('titleVar', __('common.title'));
return parent::display($request);
}
示例2: validate
/**
* Ensure that this page is available to the user.
*/
function validate()
{
parent::validate(true);
if (!Validation::isJournalManager()) {
Validation::redirectLogin();
}
}
示例3: validate
/**
* Validate that user has permissions to manage the selected journal.
* Redirects to user index page if not properly authenticated.
*/
function validate()
{
parent::validate();
$journal =& Request::getJournal();
if (!$journal || !Validation::isJournalManager() && !Validation::isSiteAdmin()) {
Validation::redirectLogin();
}
}
示例4: viewPayment
/**
* Display a single Completed payment
*/
function viewPayment($args)
{
$paymentDao =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
$completedPaymentId = $args[0];
$payment =& $paymentDao->getCompletedPayment($completedPaymentId);
$journal =& Request::getJournal();
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('helpTopicId', 'journal.managementPages.payments');
$individualSubscriptionDao =& DAORegistry::getDAO('IndividualSubscriptionDAO');
$institutionalSubscriptionDao =& DAORegistry::getDAO('InstitutionalSubscriptionDAO');
$templateMgr->assign('isJournalManager', Validation::isJournalManager($journal->getId()));
$templateMgr->assign_by_ref('individualSubscriptionDao', $individualSubscriptionDao);
$templateMgr->assign_by_ref('institutionalSubscriptionDao', $institutionalSubscriptionDao);
$templateMgr->assign_by_ref('payment', $payment);
$templateMgr->display('payments/viewPayment.tpl');
}
示例5: display
/**
* Display the form.
*/
function display()
{
$canOnlyRead = true;
$canOnlyReview = false;
if (Validation::isReviewer()) {
$canOnlyRead = false;
$canOnlyReview = true;
}
if (Validation::isSiteAdmin() || Validation::isJournalManager() || Validation::isEditor() || Validation::isSectionEditor()) {
$canOnlyRead = false;
$canOnlyReview = false;
}
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('canOnlyRead', $canOnlyRead);
$templateMgr->assign('canOnlyReview', $canOnlyReview);
return parent::display();
}
示例6: viewPayment
/**
* Display a single Completed payment
*/
function viewPayment($args, $request)
{
$paymentDao = DAORegistry::getDAO('OJSCompletedPaymentDAO');
$completedPaymentId = $args[0];
$payment = $paymentDao->getCompletedPayment($completedPaymentId);
$journal = $request->getJournal();
$templateMgr = TemplateManager::getManager($request);
$individualSubscriptionDao = DAORegistry::getDAO('IndividualSubscriptionDAO');
$institutionalSubscriptionDao = DAORegistry::getDAO('InstitutionalSubscriptionDAO');
$userDao = DAORegistry::getDAO('UserDAO');
$templateMgr->assign('isJournalManager', Validation::isJournalManager($journal->getId()));
$templateMgr->assign('individualSubscriptionDao', $individualSubscriptionDao);
$templateMgr->assign('institutionalSubscriptionDao', $institutionalSubscriptionDao);
$templateMgr->assign('userDao', $userDao);
$templateMgr->assign('payment', $payment);
$templateMgr->display('payments/viewPayment.tpl');
}
示例7: email
function email($args)
{
parent::validate();
parent::setupTemplate(true);
$templateMgr =& TemplateManager::getManager();
$userDao =& DAORegistry::getDAO('UserDAO');
$journal =& Request::getJournal();
$user =& Request::getUser();
// See if this is the Editor or Manager and an email template has been chosen
$template = Request::getUserVar('template');
if (!$journal || empty($template) || !Validation::isJournalManager($journal->getJournalId()) && !Validation::isEditor($journal->getJournalId()) && !Validation::isSectionEditor($journal->getJournalId())) {
$template = null;
}
// Determine whether or not this account is subject to
// email sending restrictions.
$canSendUnlimitedEmails = Validation::isSiteAdmin();
$unlimitedEmailRoles = array(ROLE_ID_JOURNAL_MANAGER, ROLE_ID_EDITOR, ROLE_ID_SECTION_EDITOR);
$roleDao =& DAORegistry::getDAO('RoleDAO');
if ($journal) {
$roles =& $roleDao->getRolesByUserId($user->getUserId(), $journal->getJournalId());
foreach ($roles as $role) {
if (in_array($role->getRoleId(), $unlimitedEmailRoles)) {
$canSendUnlimitedEmails = true;
}
}
}
// Check when this user last sent an email, and if it's too
// recent, make them wait.
if (!$canSendUnlimitedEmails) {
$dateLastEmail = $user->getDateLastEmail();
if ($dateLastEmail && strtotime($dateLastEmail) + (int) Config::getVar('email', 'time_between_emails') > strtotime(Core::getCurrentDate())) {
$templateMgr->assign('pageTitle', 'email.compose');
$templateMgr->assign('message', 'email.compose.tooSoon');
$templateMgr->assign('backLink', 'javascript:history.back()');
$templateMgr->assign('backLinkLabel', 'email.compose');
return $templateMgr->display('common/message.tpl');
}
}
$email = null;
if ($articleId = Request::getUserVar('articleId')) {
// This message is in reference to an article.
// Determine whether the current user has access
// to the article in some form, and if so, use an
// ArticleMailTemplate.
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$article =& $articleDao->getArticle($articleId);
$hasAccess = false;
// First, conditions where access is OK.
// 1. User is submitter
if ($article && $article->getUserId() == $user->getUserId()) {
$hasAccess = true;
}
// 2. User is section editor of article or full editor
$editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
$editAssignments =& $editAssignmentDao->getEditAssignmentsByArticleId($articleId);
while ($editAssignment =& $editAssignments->next()) {
if ($editAssignment->getEditorId() === $user->getUserId()) {
$hasAccess = true;
}
}
if (Validation::isEditor($journal->getJournalId())) {
$hasAccess = true;
}
// 3. User is reviewer
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
foreach ($reviewAssignmentDao->getReviewAssignmentsByArticleId($articleId) as $reviewAssignment) {
if ($reviewAssignment->getReviewerId() === $user->getUserId()) {
$hasAccess = true;
}
}
// 4. User is copyeditor
$copyAssignmentDao =& DAORegistry::getDAO('CopyAssignmentDAO');
$copyAssignment =& $copyAssignmentDao->getCopyAssignmentByArticleId($articleId);
if ($copyAssignment && $copyAssignment->getCopyeditorId() === $user->getUserId()) {
$hasAccess = true;
}
// 5. User is layout editor
$layoutAssignmentDao =& DAORegistry::getDAO('LayoutAssignmentDAO');
$layoutAssignment =& $layoutAssignmentDao->getLayoutAssignmentByArticleId($articleId);
if ($layoutAssignment && $layoutAssignment->getEditorId() === $user->getUserId()) {
$hasAccess = true;
}
// 6. User is proofreader
$proofAssignmentDao =& DAORegistry::getDAO('ProofAssignmentDAO');
$proofAssignment =& $proofAssignmentDao->getProofAssignmentByArticleId($articleId);
if ($proofAssignment && $proofAssignment->getProofreaderId() === $user->getUserId()) {
$hasAccess = true;
}
// Last, "deal-breakers" -- access is not allowed.
if (!$article || $article && $article->getJournalId() !== $journal->getJournalId()) {
$hasAccess = false;
}
if ($hasAccess) {
import('mail.ArticleMailTemplate');
$email =& new ArticleMailTemplate($articleDao->getArticle($articleId, $template));
}
}
if ($email === null) {
import('mail.MailTemplate');
$email =& new MailTemplate($template);
//.........这里部分代码省略.........
示例8: selectBookForReviewAuthor
/**
* Display a list of authors from which to choose a book reviewer.
*/
function selectBookForReviewAuthor($args = array(), &$request)
{
$this->setupTemplate(true);
$journal =& $request->getJournal();
$journalId = $journal->getId();
$bfrPlugin =& PluginRegistry::getPlugin('generic', BOOKS_FOR_REVIEW_PLUGIN_NAME);
$bookId = (int) $args[0];
$returnPage = $request->getUserVar('returnPage') == null ? null : $request->getUserVar('returnPage');
if ($returnPage != null) {
$validPages =& $this->getValidReturnPages();
if (!in_array($returnPage, $validPages)) {
$returnPage = null;
}
}
$bfrDao =& DAORegistry::getDAO('BookForReviewDAO');
// Ensure book for review is for this journal
if ($bfrDao->getBookForReviewJournalId($bookId) != $journalId) {
$request->redirect(null, 'editor', 'booksForReview', $returnPage);
}
$templateMgr =& TemplateManager::getManager();
$roleDao =& DAORegistry::getDAO('RoleDAO');
$searchType = null;
$searchMatch = null;
$search = $searchQuery = $request->getUserVar('search');
$searchInitial = $request->getUserVar('searchInitial');
if (!empty($search)) {
$searchType = $request->getUserVar('searchField');
$searchMatch = $request->getUserVar('searchMatch');
} else {
if (isset($searchInitial)) {
$searchInitial = String::strtoupper($searchInitial);
$searchType = USER_FIELD_INITIAL;
$search = $searchInitial;
}
}
$rangeInfo = Handler::getRangeInfo('users');
$users =& $roleDao->getUsersByRoleId(ROLE_ID_AUTHOR, $journalId, $searchType, $search, $searchMatch, $rangeInfo);
$templateMgr->assign('searchField', $searchType);
$templateMgr->assign('searchMatch', $searchMatch);
$templateMgr->assign('search', $searchQuery);
$templateMgr->assign('searchInitial', $request->getUserVar('searchInitial'));
import('classes.security.Validation');
$templateMgr->assign('isJournalManager', Validation::isJournalManager());
$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_by_ref('users', $users);
$templateMgr->assign('helpTopicId', 'journal.roles.author');
$templateMgr->assign('bookId', $bookId);
$templateMgr->assign('returnPage', $returnPage);
$templateMgr->assign('alphaList', explode(' ', __('common.alphaList')));
$templateMgr->display($bfrPlugin->getTemplatePath() . 'editor' . '/' . 'authors.tpl');
}
示例9: execute
/**
* Register a new user.
*/
function execute()
{
$userDao =& DAORegistry::getDAO('UserDAO');
$journal =& Request::getJournal();
if (isset($this->userId)) {
$user =& $userDao->getUser($this->userId);
}
if (!isset($user)) {
$user =& new User();
}
$user->setSalutation($this->getData('salutation'));
$user->setFirstName($this->getData('firstName'));
$user->setMiddleName($this->getData('middleName'));
$user->setLastName($this->getData('lastName'));
$user->setInitials($this->getData('initials'));
$user->setGender($this->getData('gender'));
$user->setAffiliation($this->getData('affiliation'));
$user->setSignature($this->getData('signature'), null);
// Localized
$user->setEmail($this->getData('email'));
$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->setInterests($this->getData('interests'), null);
// Localized
$user->setMustChangePassword($this->getData('mustChangePassword') ? 1 : 0);
$user->setAuthId((int) $this->getData('authId'));
$site =& Request::getSite();
$availableLocales = $site->getSupportedLocales();
$locales = array();
foreach ($this->getData('userLocales') as $locale) {
if (Locale::isLocaleValid($locale) && in_array($locale, $availableLocales)) {
array_push($locales, $locale);
}
}
$user->setLocales($locales);
if ($user->getAuthId()) {
$authDao =& DAORegistry::getDAO('AuthSourceDAO');
$auth =& $authDao->getPlugin($user->getAuthId());
}
if ($user->getUserId() != null) {
if ($this->getData('password') !== '') {
if (isset($auth)) {
$auth->doSetUserPassword($user->getUsername(), $this->getData('password'));
$user->setPassword(Validation::encryptCredentials($user->getUserId(), Validation::generatePassword()));
// Used for PW reset hash only
} else {
$user->setPassword(Validation::encryptCredentials($user->getUsername(), $this->getData('password')));
}
}
if (isset($auth)) {
// FIXME Should try to create user here too?
$auth->doSetUserInfo($user);
}
$userDao->updateUser($user);
} else {
$user->setUsername($this->getData('username'));
if ($this->getData('generatePassword')) {
$password = Validation::generatePassword();
$sendNotify = true;
} else {
$password = $this->getData('password');
$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->getUserId(), Validation::generatePassword()));
// Used for PW reset hash only
} else {
$user->setPassword(Validation::encryptCredentials($this->getData('username'), $password));
}
$user->setDateRegistered(Core::getCurrentDate());
$userId = $userDao->insertUser($user);
$isManager = Validation::isJournalManager();
if (!empty($this->_data['enrollAs'])) {
foreach ($this->getData('enrollAs') as $roleName) {
// Enroll new user into an initial role
$roleDao =& DAORegistry::getDAO('RoleDAO');
$roleId = $roleDao->getRoleIdFromPath($roleName);
if (!$isManager && $roleId != ROLE_ID_READER) {
continue;
}
if ($roleId != null) {
$role =& new Role();
$role->setJournalId($journal->getJournalId());
$role->setUserId($userId);
$role->setRoleId($roleId);
$roleDao->insertRole($role);
}
}
//.........这里部分代码省略.........
示例10: execute
/**
* Register a new user.
*/
function execute()
{
$userDao =& DAORegistry::getDAO('UserDAO');
$journal =& Request::getJournal();
if (isset($this->userId)) {
$user =& $userDao->getUser($this->userId);
}
if (!isset($user)) {
$user = new User();
}
$user->setSalutation($this->getData('salutation'));
$user->setFirstName($this->getData('firstName'));
$user->setMiddleName($this->getData('middleName'));
$user->setLastName($this->getData('lastName'));
$user->setInitials($this->getData('initials'));
$user->setGender($this->getData('gender'));
$user->setAffiliation($this->getData('affiliation'), null);
// Localized
$user->setSignature($this->getData('signature'), null);
// Localized
$user->setEmail($this->getData('email'));
$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
$user->setMustChangePassword($this->getData('mustChangePassword') ? 1 : 0);
$user->setAuthId((int) $this->getData('authId'));
$site =& Request::getSite();
$availableLocales = $site->getSupportedLocales();
$locales = array();
foreach ($this->getData('userLocales') as $locale) {
if (Locale::isLocaleValid($locale) && in_array($locale, $availableLocales)) {
array_push($locales, $locale);
}
}
$user->setLocales($locales);
if ($user->getAuthId()) {
$authDao =& DAORegistry::getDAO('AuthSourceDAO');
$auth =& $authDao->getPlugin($user->getAuthId());
}
if ($user->getId() != null) {
$userId = $user->getId();
if ($this->getData('password') !== '') {
if (isset($auth)) {
$auth->doSetUserPassword($user->getUsername(), $this->getData('password'));
$user->setPassword(Validation::encryptCredentials($userId, Validation::generatePassword()));
// Used for PW reset hash only
} else {
$user->setPassword(Validation::encryptCredentials($user->getUsername(), $this->getData('password')));
}
}
if (isset($auth)) {
// FIXME Should try to create user here too?
$auth->doSetUserInfo($user);
}
$userDao->updateObject($user);
} else {
$user->setUsername($this->getData('username'));
if ($this->getData('generatePassword')) {
$password = Validation::generatePassword();
$sendNotify = true;
} else {
$password = $this->getData('password');
$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->setDateRegistered(Core::getCurrentDate());
$userId = $userDao->insertUser($user);
$isManager = Validation::isJournalManager();
// EL on March 13th 2013
// If this is used, it should be totally modified
if (!empty($this->_data['enrollAs'])) {
foreach ($this->getData('enrollAs') as $roleName) {
// Enroll new user into an initial role
$roleDao =& DAORegistry::getDAO('RoleDAO');
$roleId = $roleDao->getRoleIdFromPath($roleName);
if (!$isManager && $roleId != ROLE_ID_READER) {
continue;
}
if ($roleId != null) {
$role = new Role();
$role->setJournalId($journal->getId());
$role->setUserId($userId);
//.........这里部分代码省略.........
示例11: _getRoleDataForJournal
/**
* Gather information about a user's role within a journal.
* @param $userId int
* @param $journalId int
* @param $submissionsCount array reference
* @param $isValid array reference
*/
function _getRoleDataForJournal($userId, $journalId, &$submissionsCount, &$isValid)
{
if (Validation::isJournalManager($journalId)) {
$journalDao =& DAORegistry::getDAO('JournalDAO');
$isValid["JournalManager"][$journalId] = true;
}
if (Validation::isSubscriptionManager($journalId)) {
$isValid["SubscriptionManager"][$journalId] = true;
}
if (Validation::isAuthor($journalId)) {
$authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
$submissionsCount["Author"][$journalId] = $authorSubmissionDao->getSubmissionsCount($userId, $journalId);
$isValid["Author"][$journalId] = true;
}
if (Validation::isCopyeditor($journalId)) {
$copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO');
$submissionsCount["Copyeditor"][$journalId] = $copyeditorSubmissionDao->getSubmissionsCount($userId, $journalId);
$isValid["Copyeditor"][$journalId] = true;
}
if (Validation::isLayoutEditor($journalId)) {
$layoutEditorSubmissionDao =& DAORegistry::getDAO('LayoutEditorSubmissionDAO');
$submissionsCount["LayoutEditor"][$journalId] = $layoutEditorSubmissionDao->getSubmissionsCount($userId, $journalId);
$isValid["LayoutEditor"][$journalId] = true;
}
if (Validation::isEditor($journalId)) {
$editorSubmissionDao =& DAORegistry::getDAO('EditorSubmissionDAO');
$submissionsCount["Editor"][$journalId] = $editorSubmissionDao->getEditorSubmissionsCount($journalId);
$isValid["Editor"][$journalId] = true;
}
if (Validation::isSectionEditor($journalId)) {
$sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
$submissionsCount["SectionEditor"][$journalId] = $sectionEditorSubmissionDao->getSectionEditorSubmissionsCount($userId, $journalId);
$isValid["SectionEditor"][$journalId] = true;
}
if (Validation::isProofreader($journalId)) {
$proofreaderSubmissionDao =& DAORegistry::getDAO('ProofreaderSubmissionDAO');
$submissionsCount["Proofreader"][$journalId] = $proofreaderSubmissionDao->getSubmissionsCount($userId, $journalId);
$isValid["Proofreader"][$journalId] = true;
}
if (Validation::isReviewer($journalId)) {
$reviewerSubmissionDao =& DAORegistry::getDAO('ReviewerSubmissionDAO');
$submissionsCount["Reviewer"][$journalId] = $reviewerSubmissionDao->getSubmissionsCount($userId, $journalId);
$isValid["Reviewer"][$journalId] = true;
}
}
示例12: selectSubscriber
/**
* Display a list of users from which to choose a subscriber/subscription contact.
*/
function selectSubscriber($args = array(), $institutional = false)
{
$templateMgr =& TemplateManager::getManager();
if ($institutional) {
$pageTitle = 'manager.subscriptions.selectContact';
$redirect = 'institutional';
} else {
$pageTitle = 'manager.subscriptions.selectUser';
$redirect = 'individual';
}
$userDao =& DAORegistry::getDAO('UserDAO');
$searchType = null;
$searchMatch = null;
$search = $searchQuery = Request::getUserVar('search');
$searchInitial = Request::getUserVar('searchInitial');
if (!empty($search)) {
$searchType = Request::getUserVar('searchField');
$searchMatch = Request::getUserVar('searchMatch');
} else {
if (isset($searchInitial)) {
$searchInitial = String::strtoupper($searchInitial);
$searchType = USER_FIELD_INITIAL;
$search = $searchInitial;
}
}
$rangeInfo = Handler::getRangeInfo('users');
$users =& $userDao->getUsersByField($searchType, $searchMatch, $search, true, $rangeInfo);
$templateMgr->assign('searchField', $searchType);
$templateMgr->assign('searchMatch', $searchMatch);
$templateMgr->assign('search', $searchQuery);
$templateMgr->assign('searchInitial', Request::getUserVar('searchInitial'));
import('classes.security.Validation');
$templateMgr->assign('isJournalManager', Validation::isJournalManager());
$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_by_ref('users', $users);
$templateMgr->assign('helpTopicId', 'journal.managementPages.subscriptions');
$templateMgr->assign('subscriptionId', Request::getUserVar('subscriptionId'));
$templateMgr->assign('pageTitle', $pageTitle);
$templateMgr->assign('redirect', $redirect);
$templateMgr->assign('alphaList', explode(' ', __('common.alphaList')));
$templateMgr->display('subscription/users.tpl');
}
示例13: canAdminister
/**
* Check whether a user is allowed to administer another user.
* @param $journalId int
* @param $userId int
* @return boolean
*/
function canAdminister($journalId, $userId)
{
if (Validation::isSiteAdmin()) {
return true;
}
if (!Validation::isJournalManager($journalId)) {
return false;
}
// Check for roles in other journals that this user
// doesn't have administrative rights over.
$roleDao =& DAORegistry::getDAO('RoleDAO');
$roles =& $roleDao->getRolesByUserId($userId);
foreach ($roles as $role) {
if ($role->getRoleId() == ROLE_ID_SITE_ADMIN) {
return false;
}
if ($role->getJournalId() != $journalId && !Validation::isJournalManager($role->getJournalId())) {
return false;
}
}
// There were no conflicting roles.
return true;
}
示例14: callback
/**
* Hook callback function for TemplateManager::display
* @param $hookName string
* @param $args array
* @return boolean
*/
function callback($hookName, $args)
{
// Only pages requests interest us here
$request =& Registry::get('request');
if (!is_a($request->getRouter(), 'PKPPageRouter')) {
return null;
}
$templateManager =& $args[0];
$page = Request::getRequestedPage();
$op = Request::getRequestedOp();
$enableFields = $this->getEnableFields($templateManager, $page, $op);
if (!empty($enableFields)) {
$baseUrl = $templateManager->get_template_vars('baseUrl');
$additionalHeadData = $templateManager->get_template_vars('additionalHeadData');
$enableFields = join(',', $enableFields);
$allLocales = Locale::getAllLocales();
$localeList = array();
foreach ($allLocales as $key => $locale) {
$localeList[] = String::substr($key, 0, 2);
}
if (Validation::isSiteAdmin() || Validation::isJournalManager()) {
$tinymceScript = '
<script language="javascript" type="text/javascript" src="' . $baseUrl . '/' . TINYMCE_JS_PATH . '/tiny_mce_gzip.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE_GZ.init({
relative_urls : false,
convert_urls : false,
plugins : "paste,ibrowser,fullscreen,table",
forced_root_block : "p",
force_p_newlines : true,
force_br_newlines : false,
themes : "advanced",
languages : "' . join(',', $localeList) . '",
disk_cache : true
});
</script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
entity_encoding : "raw",
plugins : "paste,ibrowser,fullscreen,table",
mode : "exact",
language : "' . String::substr(Locale::getLocale(), 0, 2) . '",
elements : "' . $enableFields . '",
relative_urls : false,
convert_urls : false,
forced_root_block : "p",
force_br_newlines : false,
force_p_newlines : true,
paste_auto_cleanup_on_paste : true,
apply_source_formatting : false,
theme : "advanced",
theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,forecolor,backcolor,|,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,ibrowser,code,|,sub,sup,|,charmap,|,fullscreen",
theme_advanced_buttons3 : "tablecontrols"
});
</script>';
} else {
$tinymceScript = '
<script language="javascript" type="text/javascript" src="' . $baseUrl . '/' . TINYMCE_JS_PATH . '/tiny_mce_gzip.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE_GZ.init({
relative_urls : false,
plugins : "paste,fullscreen,table",
forced_root_block : "p",
force_p_newlines : true,
force_br_newlines : false,
themes : "advanced",
languages : "' . join(',', $localeList) . '",
disk_cache : true
});
</script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
entity_encoding : "raw",
plugins : "paste,fullscreen,table",
mode : "exact",
language : "' . String::substr(Locale::getLocale(), 0, 2) . '",
elements : "' . $enableFields . '",
relative_urls : false,
forced_root_block : "p",
force_p_newlines : true,
force_br_newlines : false,
paste_auto_cleanup_on_paste : true,
apply_source_formatting : false,
theme : "advanced",
theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,forecolor,backcolor,|,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : ""
});
</script>';
}
$templateManager->assign('additionalHeadData', $additionalHeadData . "\n" . $tinymceScript);
}
return false;
//.........这里部分代码省略.........
示例15: validate
function validate()
{
parent::validate(true);
if (!Validation::isJournalManager()) {
Validation::redirectLogin();
}
$plugin =& PluginRegistry::getPlugin('generic', 'CustomLocalePlugin');
return array(&$plugin);
}