本文整理汇总了PHP中Validation::isSiteAdmin方法的典型用法代码示例。如果您正苦于以下问题:PHP Validation::isSiteAdmin方法的具体用法?PHP Validation::isSiteAdmin怎么用?PHP Validation::isSiteAdmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Validation
的用法示例。
在下文中一共展示了Validation::isSiteAdmin方法的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: display
/**
* Display the form.
* @param $request Request
*/
function display($request)
{
$conferenceDao = DAORegistry::getDAO('ConferenceDAO');
$conferences =& $conferenceDao->getNames();
$canOnlyRead = true;
$canOnlyReview = false;
if (Validation::isReviewer()) {
$canOnlyRead = false;
$canOnlyReview = true;
}
if (Validation::isSiteAdmin() || Validation::isConferenceManager() || Validation::isDirector()) {
$canOnlyRead = false;
$canOnlyReview = false;
}
// 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 =& TemplateManager::getManager();
$templateMgr->assign('notificationSettingCategories', $notificationSettingCategories);
$templateMgr->assign('notificationSettings', $this->_getNotificationSettingsMap());
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('canOnlyRead', $canOnlyRead);
$templateMgr->assign('canOnlyReview', $canOnlyReview);
return parent::display($request);
}
示例3: display
/**
* @see ReportPlugin::display()
*/
function display(&$args, &$request)
{
parent::display($args, $request);
$journal =& $request->getJournal();
if (!Validation::isSiteAdmin()) {
Validation::redirectLogin();
}
$this->setBreadcrumbs();
if ($request->getUserVar('type')) {
$oldStats = (bool) $request->getUserVar('useOldCounterStats');
$year = (string) $request->getUserVar('year');
$type = (string) $request->getUserVar('type');
switch ($type) {
case 'report':
$this->_report($request, $year, $oldStats);
break;
case 'reportxml':
$this->_reportXml($request, $year, $oldStats);
break;
case 'sushixml':
$this->_sushiXML($oldStats);
break;
}
} else {
$years = $this->_getYears();
$legacyYears = $this->_getYears(true);
$templateManager =& TemplateManager::getManager();
$templateManager->assign('years', $years);
if (!empty($legacyYears)) {
$templateManager->assign('legacyYears', $legacyYears);
}
$templateManager->display($this->getTemplatePath() . 'index.tpl');
}
}
示例4: validate
/**
* Validate that user has admin privileges and is not trying to access the admin module with a journal selected.
* Redirects to the user index page if not properly authenticated.
*/
function validate()
{
parent::validate();
if (!Validation::isSiteAdmin() || Request::getRequestedJournalPath() != 'index') {
Validation::redirectLogin();
}
}
示例5: plugins
/**
* Display a list of plugins along with management options.
*/
function plugins($args)
{
$category = isset($args[0]) ? $args[0] : null;
parent::validate();
$categories = PluginRegistry::getCategories();
if (isset($category)) {
// The user specified a category of plugins to view;
// get the plugins in that category only.
$plugins =& PluginRegistry::loadCategory($category);
} else {
// No plugin specified; display all.
$plugins = array();
foreach ($categories as $category) {
$newPlugins =& PluginRegistry::loadCategory($category);
if (isset($newPlugins)) {
$plugins = array_merge($plugins, PluginRegistry::loadCategory($category));
}
}
}
parent::setupTemplate(true);
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign_by_ref('plugins', $plugins);
$templateMgr->assign_by_ref('categories', $categories);
$templateMgr->assign('isSiteAdmin', Validation::isSiteAdmin());
$templateMgr->assign('helpTopicId', 'journal.managementPages.plugins');
$templateMgr->display('manager/plugins/plugins.tpl');
}
示例6: index
/**
* Display the site or press index page.
* (If a site admin is logged in and no presses exist, redirect to the
* press administration page -- this may be useful upon install.)
*
* @param $args array
* @param $request Request
*/
function index($args, $request)
{
$targetPress = $this->getTargetContext($request);
$press = $request->getPress();
$user = $request->getUser();
if ($user && !$targetPress && Validation::isSiteAdmin()) {
// If the user is a site admin and no press exists,
// send them to press administration to create one.
return $request->redirect(null, 'admin', 'contexts');
}
// Public access.
$this->setupTemplate($request);
$templateMgr = TemplateManager::getManager($request);
if ($press) {
// Display the current press home.
$this->_displayPressIndexPage($press, $templateMgr);
} elseif ($targetPress) {
// We're not on a press homepage, but there's one
// available; redirect there.
$request->redirect($targetPress->getPath());
} else {
// A target press couldn't be determined for some reason.
if ($user) {
// Redirect to user profile.
$request->redirect(null, 'user', 'profile');
} else {
// Not logged in. Redirect to login page.
$request->redirect(null, 'login');
}
}
}
示例7: plugins
/**
* Display a list of plugins along with management options.
* @param $args array
* @param $request PKPRequest
*/
function plugins($args, &$request)
{
$category = isset($args[0]) ? $args[0] : null;
$categories = PluginRegistry::getCategories();
$templateMgr =& TemplateManager::getManager();
$this->validate();
if (isset($category) && in_array($category, $categories)) {
// The user specified a category of plugins to view;
// get the plugins in that category only.
$mainPage = false;
$plugins =& PluginRegistry::loadCategory($category);
$this->setupTemplate(false);
$templateMgr->assign('pageTitle', 'plugins.categories.' . $category);
$templateMgr->assign('pageHierarchy', $this->setBreadcrumbs($request, true));
} else {
// No plugin specified; display all.
$mainPage = true;
$plugins = array();
foreach ($categories as $category) {
$newPlugins =& PluginRegistry::loadCategory($category);
if (isset($newPlugins)) {
$plugins = array_merge($plugins, PluginRegistry::loadCategory($category));
}
}
$this->setupTemplate(true);
$templateMgr->assign('pageTitle', 'manager.plugins.pluginManagement');
$templateMgr->assign('pageHierarchy', $this->setBreadcrumbs($request, false));
}
$templateMgr->assign_by_ref('plugins', $plugins);
$templateMgr->assign_by_ref('categories', $categories);
$templateMgr->assign('mainPage', $mainPage);
$templateMgr->assign('isSiteAdmin', Validation::isSiteAdmin());
$templateMgr->assign('helpTopicId', 'journal.managementPages.plugins');
$templateMgr->display('manager/plugins/plugins.tpl');
}
示例8: 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();
}
}
示例9: addArchiveFormChecks
function addArchiveFormChecks(&$form)
{
$this->import('OAIHarvester');
$oaiHarvester = new OAIHarvester($this->archive);
$form->addCheck(new FormValidator($form, 'harvesterUrl', 'required', 'plugins.harvesters.oai.archive.form.harvesterUrlRequired'));
$form->addCheck(new FormValidatorInSet($form, 'oaiIndexMethod', 'optional', 'plugins.harvesters.oai.archive.form.oaiIndexMethodRequired', array(OAI_INDEX_METHOD_LIST_RECORDS, OAI_INDEX_METHOD_LIST_IDENTIFIERS)));
$form->addCheck(new FormValidatorCustom($form, 'harvesterUrl', 'required', 'plugins.harvester.oai.archive.form.harvesterUrlInvalid', array(&$oaiHarvester, 'validateHarvesterURL'), array(Request::getUserVar('isStatic'))));
$form->addCheck(new FormValidatorEmail($form, 'adminEmail', Validation::isSiteAdmin() ? 'optional' : 'required', 'plugins.harvesters.oai.archive.form.adminEmailInvalid'));
$form->addCheck(new FormValidatorCustom($form, 'harvesterUrl', 'required', 'plugins.harvester.oai.archive.form.harvesterUrlDuplicate', array(&$this, 'duplicateHarvesterUrlDoesNotExist'), array(Request::getUserVar('archiveId'))));
}
示例10: displayMenuOption
function displayMenuOption($hookName, $args)
{
if (!Validation::isSiteAdmin()) {
return false;
}
$params =& $args[0];
$smarty =& $args[1];
$output =& $args[2];
$output .= '<li>» <a href="' . Request::url(null, 'counter') . '">' . __('plugins.generic.counter') . '</a></li>';
return false;
}
示例11: validate
/**
* The site setting option 'preventManagerPluginManagement' must not be set for
* journal managers to be able to manage plugins.
* @param $request PKPRequest
*/
function validate($request)
{
parent::validate();
if (!Validation::isSiteAdmin()) {
$site =& $request->getSite();
$preventManagerPluginManagement = $site->getSetting('preventManagerPluginManagement');
if ($preventManagerPluginManagement) {
$request->redirect(null, 'manager', 'plugins');
}
}
}
示例12: register
/**
* Register the plugin, if enabled; note that this plugin
* runs under both Conference and Site contexts.
* @param $category string
* @param $path string
* @return boolean
*/
function register($category, $path)
{
if (parent::register($category, $path)) {
$this->addLocaleData();
if ($this->getEnabled() && Validation::isSiteAdmin()) {
HookRegistry::register('Templates::Admin::Index::AdminFunctions', array($this, 'addLink'));
HookRegistry::register('LoadHandler', array($this, 'handleRequest'));
}
return true;
}
return false;
}
示例13: index
/**
* Display user index page.
*/
function index()
{
$this->validate();
$templateMgr =& TemplateManager::getManager();
$roleDao =& DAORegistry::getDAO('RoleDAO');
$user =& Request::getUser();
$site =& Request::getSite();
$this->setupTemplate();
$templateMgr->assign('isSiteAdmin', Validation::isSiteAdmin());
$templateMgr->assign('userRoles', $roleDao->getRolesByUserId($user->getId()));
$templateMgr->assign('enableSubmit', $site->getSetting('enableSubmit'));
$templateMgr->display('user/index.tpl');
}
示例14: TemplateManager
/**
* Constructor.
* Initialize template engine and assign basic template variables.
* @param $request PKPRequest FIXME: is optional for backwards compatibility only - make mandatory
*/
function TemplateManager($request = null)
{
// FIXME: for backwards compatibility only - remove
if (!isset($request)) {
// FIXME: Trigger a deprecation warning when enough instances of this
// call have been fixed to not clutter the error log.
$request =& Registry::get('request');
}
assert(is_a($request, 'PKPRequest'));
parent::PKPTemplateManager($request);
if (!defined('SESSION_DISABLE_INIT')) {
/**
* Kludge to make sure no code that tries to connect to
* the database is executed (e.g., when loading
* installer pages).
*/
$site =& $request->getSite();
$siteFilesDir = $request->getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath();
$this->assign('sitePublicFilesDir', $siteFilesDir);
$this->assign('publicFilesDir', $siteFilesDir);
$this->assign('isAdmin', Validation::isSiteAdmin());
// assign an empty home context
$this->assign('homeContext', array());
$siteStyleFilename = PublicFileManager::getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
if (file_exists($siteStyleFilename)) {
$this->addStyleSheet($request->getBaseUrl() . '/' . $siteStyleFilename);
}
// Load and apply theme plugin, if chosen
$themePluginPath = $site->getSetting('theme');
if (!empty($themePluginPath)) {
// Load and activate the theme
$themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
if ($themePlugin) {
$themePlugin->activate($this);
}
}
// Add the site-wide logo, if set for this locale or the primary locale
$this->assign('displayPageHeaderTitle', $site->getLocalizedPageHeaderTitle());
$customLogo = $site->getSetting('customLogo');
if ($customLogo) {
$this->assign('displayPageHeaderLogo', $customLogo);
}
$this->assign('siteTitle', $site->getLocalizedTitle());
$this->assign('enableSubmit', $site->getSetting('enableSubmit'));
// Add java script for notifications
$user =& $request->getUser();
if ($user) {
$this->addJavaScript('lib/pkp/js/lib/jquery/plugins/jquery.pnotify.js');
}
}
}
示例15: getManagementVerbs
/**
* Generic plug-ins implement the enabled/disabled logic
* by default. This is necessary so that we can make sure
* that disabled plug-ins will not have to be instantiated.
*
* Call this method with a list of management verbs (if any)
* generated by the custom plug-in.
*
* @see Plugin::getManagementVerbs()
*/
function getManagementVerbs()
{
// Site plug-ins can only be administered by site admins
if ($this->isSitePlugin() && !Validation::isSiteAdmin()) {
return array();
}
$verbs = parent::getManagementVerbs();
if ($this->getEnabled()) {
$verbs[] = array('disable', __('common.disable'));
} else {
$verbs[] = array('enable', __('common.enable'));
}
return $verbs;
}