本文整理汇总了PHP中Validation::isConferenceManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Validation::isConferenceManager方法的具体用法?PHP Validation::isConferenceManager怎么用?PHP Validation::isConferenceManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Validation
的用法示例。
在下文中一共展示了Validation::isConferenceManager方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: TimelineForm
/**
* Constructor.
* @param $trackId int omit for a new track
*/
function TimelineForm($overrideDates = false, $readOnly = false)
{
$this->canEdit = false;
if (!$readOnly && Validation::isConferenceManager()) {
$this->canEdit = true;
}
if ($this->canEdit) {
parent::Form('manager/timelineEdit.tpl');
} else {
parent::Form('manager/timelineView.tpl');
}
if (!$overrideDates) {
// Conference start must happen before conference end
$this->addCheck(new FormValidatorCustom($this, 'endDate', 'required', 'manager.timeline.form.conferenceEndDateBeforeConferenceStart', create_function('$endDate,$form', 'return ($endDate >= $form->getData(\'startDate\'));'), array(&$this)));
// Conference start must happen before site move to archive
$this->addCheck(new FormValidatorCustom($this, 'siteEndDate', 'required', 'manager.timeline.form.siteEndDateBeforeConferenceStart', create_function('$endDate,$form', 'return ($endDate >= $form->getData(\'startDate\'));'), array(&$this)));
// Conference start must happen after submission close
$this->addCheck(new FormValidatorCustom($this, 'startDate', 'required', 'manager.timeline.form.conferenceStartDateBeforeSubmissionsClose', create_function('$startDate,$form', 'return ($startDate >= $form->getData(\'submissionsCloseDate\'));'), array(&$this)));
// Conference site start must happen before site end
$this->addCheck(new FormValidatorCustom($this, 'siteStartDate', 'required', 'manager.timeline.form.siteEndDateBeforeSiteStart', create_function('$siteStartDate,$form', 'return ($siteStartDate <= $form->getData(\'siteEndDate\'));'), array(&$this)));
// Conference start must happen after site go-live
$this->addCheck(new FormValidatorCustom($this, 'siteStartDate', 'required', 'manager.timeline.form.conferenceStartBeforeSiteStart', create_function('$siteStartDate,$form', 'return ($siteStartDate <= $form->getData(\'startDate\'));'), array(&$this)));
// Move to Conference Archive must come after Last Day of Conf
$this->addCheck(new FormValidatorCustom($this, 'siteEndDate', 'required', 'manager.timeline.form.siteEndBeforeLastDay', create_function('$siteEndDate,$form', 'return ($siteEndDate >= $form->getData(\'endDate\'));'), array(&$this)));
// regAuthorOpenDate must be before regAuthorCloseDate
$this->addCheck(new FormValidatorCustom($this, 'regAuthorOpenDate', 'required', 'manager.timeline.form.regAuthorCloseDateBeforeRegAuthorOpenDate', create_function('$regAuthorOpenDate,$form', 'return ($regAuthorOpenDate <= $form->getData(\'regAuthorCloseDate\'));'), array(&$this)));
// regReviewerOpenDate must be before regReviewerCloseDate
$this->addCheck(new FormValidatorCustom($this, 'regReviewerOpenDate', 'required', 'manager.timeline.form.regReviewerCloseDateBeforeRegReviewerOpenDate', create_function('$regReviewerOpenDate,$form', 'return ($regReviewerOpenDate <= $form->getData(\'regReviewerCloseDate\'));'), array(&$this)));
// Submission CfP must come before Close Submissions
$this->addCheck(new FormValidatorCustom($this, 'showCFPDate', 'required', 'manager.timeline.form.submissionsCloseBeforeCFP', create_function('$showCFPDate,$form', 'return ($showCFPDate <= $form->getData(\'submissionsCloseDate\'));'), array(&$this)));
}
$this->addCheck(new FormValidatorPost($this));
}
示例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: validate
/**
* Validate that user has permissions to manage e-mail templates.
* Redirects to user index page if not properly authenticated.
* @param $request PKPRequest
*/
function validate(&$request)
{
parent::validate();
$schedConf =& $request->getSchedConf();
// If the user is a Conference Manager, but has specified a scheduled conference,
// redirect so no scheduled conference is present (otherwise they would end up managing
// scheduled conference e-mails.)
if ($schedConf && !Validation::isConferenceManager()) {
$request->redirect(null, 'index', $request->getRequestedPage(), $request->getRequestedOp());
}
return true;
}
示例4: display
/**
* Display the form.
*/
function display()
{
$conferenceDao =& DAORegistry::getDAO('ConferenceDAO');
$conferences =& $conferenceDao->getConferenceTitles();
$canOnlyRead = true;
$canOnlyReview = false;
if (Validation::isReviewer()) {
$canOnlyRead = false;
$canOnlyReview = true;
}
if (Validation::isSiteAdmin() || Validation::isConferenceManager() || Validation::isDirector()) {
$canOnlyRead = false;
$canOnlyReview = false;
}
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('canOnlyRead', $canOnlyRead);
$templateMgr->assign('canOnlyReview', $canOnlyReview);
return parent::display();
}
示例5: checkRole
function checkRole(&$conference, &$schedConf)
{
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('isConferenceManager', Validation::isConferenceManager($conference->getId()));
$templateMgr->assign('isDirector', Validation::isDirector($conference->getId(), $schedConf->getId()));
$templateMgr->assign('isTrackDirector', Validation::isTrackDirector($conference->getId(), $schedConf->getId()));
$templateMgr->assign('isAuthor', Validation::isAuthor($conference->getId(), $schedConf->getId()));
}
示例6: getRoleDataForConference
/**
* Gather information about a user's role within a conference.
* @param $userId int
* @param $conferenceId int
* @param $submissionsCount array reference
* @param $isValid array reference
*/
function getRoleDataForConference($userId, $conferenceId, $schedConfId, &$submissionsCount, &$isValid)
{
if (Validation::isConferenceManager($conferenceId)) {
$conferenceDao =& DAORegistry::getDAO('ConferenceDAO');
$isValid["ConferenceManager"][$conferenceId][$schedConfId] = true;
}
if (Validation::isDirector($conferenceId, $schedConfId)) {
$isValid["Director"][$conferenceId][$schedConfId] = true;
$directorSubmissionDao =& DAORegistry::getDAO('DirectorSubmissionDAO');
$submissionsCount["Director"][$conferenceId][$schedConfId] = $directorSubmissionDao->getDirectorSubmissionsCount($schedConfId);
}
if (Validation::isTrackDirector($conferenceId, $schedConfId)) {
$trackDirectorSubmissionDao =& DAORegistry::getDAO('TrackDirectorSubmissionDAO');
$submissionsCount["TrackDirector"][$conferenceId][$schedConfId] = $trackDirectorSubmissionDao->getTrackDirectorSubmissionsCount($userId, $schedConfId);
$isValid["TrackDirector"][$conferenceId][$schedConfId] = true;
}
if (Validation::isReviewer($conferenceId, $schedConfId)) {
$reviewerSubmissionDao =& DAORegistry::getDAO('ReviewerSubmissionDAO');
$submissionsCount["Reviewer"][$conferenceId][$schedConfId] = $reviewerSubmissionDao->getSubmissionsCount($userId, $schedConfId);
$isValid["Reviewer"][$conferenceId][$schedConfId] = true;
}
if (Validation::isAuthor($conferenceId, $schedConfId)) {
$authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
$submissionsCount["Author"][$conferenceId][$schedConfId] = $authorSubmissionDao->getSubmissionsCount($userId, $schedConfId);
$isValid["Author"][$conferenceId][$schedConfId] = true;
}
}
示例7: enroll
/**
* Enroll a user in a role.
*/
function enroll($args)
{
$this->validate();
$roleId = (int) (isset($args[0]) ? $args[0] : Request::getUserVar('roleId'));
// Get a list of users to enroll -- either from the
// submitted array 'users', or the single user ID in
// 'userId'
$users = Request::getUserVar('users');
if (!isset($users) && Request::getUserVar('userId') != null) {
$users = array(Request::getUserVar('userId'));
}
$conference =& Request::getConference();
$schedConf =& Request::getSchedConf();
$roleDao =& DAORegistry::getDAO('RoleDAO');
$rolePath = $roleDao->getRolePath($roleId);
$isConferenceManager = Validation::isConferenceManager($conference->getId()) || Validation::isSiteAdmin();
// Don't allow scheduled conference directors (who can end up here) to enroll
// conference managers or scheduled conference directors.
if ($users != null && is_array($users) && $rolePath != '' && $rolePath != ROLE_PATH_SITE_ADMIN && $isConferenceManager) {
$schedConfId = $schedConf ? $schedConf->getId() : 0;
for ($i = 0; $i < count($users); $i++) {
if (!$roleDao->userHasRole($conference->getId(), $schedConfId, $users[$i], $roleId)) {
if ($schedConfId == 0) {
// In case they're enrolled in individual scheduled conferences and we want to enrol
// them in the whole conference, ensure they don't have multiple roles
$roleDao->deleteRoleByUserId($users[$i], $conference->getId(), $roleId);
} else {
if ($roleDao->userHasRole($conference->getId(), 0, $users[$i], $roleId)) {
// If they're enrolled in the whole conference, this individual
// enrollment isn't valuable.
return;
}
}
$role = new Role();
$role->setConferenceId($conference->getId());
if ($schedConf && $rolePath != ROLE_PATH_CONFERENCE_MANAGER) {
$role->setSchedConfId($schedConfId);
} else {
$role->setSchedConfId(0);
}
$role->setUserId($users[$i]);
$role->setRoleId($roleId);
$roleDao->insertRole($role);
}
}
}
Request::redirect(null, null, null, 'people', empty($rolePath) ? null : $rolePath . 's');
}
示例8: setupTemplate
/**
* Given a scheduled conference, set up the template with all the
* required variables for schedConf/view.tpl to function properly.
* @param $schedConf object The scheduled conference to display
* the cover page will be displayed. Otherwise table of contents
* will be displayed.
*/
function setupTemplate(&$conference, &$schedConf)
{
parent::setupTemplate();
$templateMgr =& TemplateManager::getManager();
Locale::requireComponents(array(LOCALE_COMPONENT_OCS_MANAGER));
// Ensure the user is entitled to view the scheduled conference...
if (isset($schedConf) && ($conference->getEnabled() || (Validation::isDirector($conference->getId()) || Validation::isConferenceManager($conference->getId())))) {
// Assign header and content for home page
$templateMgr->assign('displayPageHeaderTitle', $conference->getPageHeaderTitle(true));
$templateMgr->assign('displayPageHeaderLogo', $conference->getPageHeaderLogo(true));
$templateMgr->assign('displayPageHeaderTitleAltText', $conference->getLocalizedSetting('homeHeaderTitleImageAltText'));
$templateMgr->assign('displayPageHeaderLogoAltText', $conference->getLocalizedSetting('homeHeaderLogoImageAltText'));
$templateMgr->assign_by_ref('schedConf', $schedConf);
$templateMgr->assign('additionalHomeContent', $conference->getLocalizedSetting('additionalHomeContent'));
} else {
Request::redirect(null, 'index');
}
if ($styleFileName = $schedConf->getStyleFileName()) {
import('file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$templateMgr->addStyleSheet(Request::getBaseUrl() . '/' . $publicFileManager->getConferenceFilesPath($conference->getId()) . '/' . $styleFileName);
}
}
示例9: canAdminister
/**
* Check whether a user is allowed to administer another user.
* @param $conferenceId int
* @param $userId int
* @return boolean
*/
function canAdminister($conferenceId, $userId)
{
if (Validation::isSiteAdmin()) {
return true;
}
if (!Validation::isConferenceManager($conferenceId)) {
return false;
}
// Check for roles in other conferences that this user
// doesn't have administrative rights over.
$roleDao =& DAORegistry::getDAO('RoleDAO');
$roles =& $roleDao->getRolesByUserId($userId);
foreach ($roles as $role) {
// Other user cannot be site admin
if ($role->getRoleId() == ROLE_ID_SITE_ADMIN) {
return false;
}
if ($role->getConferenceId() != $conferenceId) {
// Other conferences: We must have admin privileges there too
if (!Validation::isConferenceManager($role->getConferenceId())) {
return false;
}
}
}
return true;
}
示例10: unEnroll
/**
* Unenroll a user from a role.
*/
function unEnroll($args)
{
$roleId = isset($args[0]) ? $args[0] : 0;
$this->validate();
$conference =& Request::getConference();
$isConferenceManager = Validation::isConferenceManager($conference->getId()) || Validation::isSiteAdmin();
$roleDao =& DAORegistry::getDAO('RoleDAO');
// Don't allow scheduled conference managers to unenroll scheduled conference managers or
// conference managers. FIXME is this still relevant?
if ($roleId != ROLE_ID_SITE_ADMIN && $isConferenceManager) {
$roleDao->deleteRoleByUserId(Request::getUserVar('userId'), $conference->getId(), $roleId);
}
Request::redirect(null, null, null, 'people', $roleDao->getRolePath($roleId) . 's');
}
示例11: TemplateManager
/**
* Return an instance of the template manager.
* @param $request PKPRequest FIXME: is optional for backwards compatibility only - make mandatory
* @return TemplateManager the template manager object
*/
function &getManager($request = null)
{
$instance =& Registry::get('templateManager', true, null);
if ($instance === null) {
$instance = new TemplateManager($request);
}
$supportedLocales = AppLocale::getSupportedLocales();
$instance->assign('supportedLocales', $supportedLocales);
$instance->assign('localePrecedence', AppLocale::getLocalePrecedence());
$instance->assign('requestedPage', Request::getRequestedPage());
$instance->assign('requestedOp', Request::getRequestedOp());
$conference =& Request::getConference();
if (isset($conference)) {
$instance->assign('conferenceId', $conference->getId());
$instance->assign('isConferenceManager', Validation::isConferenceManager($conference->getId()));
$instance->assign('analyticsTrackingID', $conference->getSetting('analyticsTrackingID'));
$schedConf =& Request::getSchedConf();
if (isset($schedConf)) {
$instance->assign('isDirector', Validation::isDirector($conference->getId(), $schedConf->getId()));
$instance->assign('isTrackDirector', Validation::isTrackDirector($conference->getId(), $schedConf->getId()));
$instance->assign('isAuthor', Validation::isAuthor($conference->getId(), $schedConf->getId()));
$registrationDao =& DAORegistry::getDAO('RegistrationDAO');
$user = Request::getUser();
if (isset($user)) {
$instance->assign('isRegistrationUser', $registrationDao->isValidRegistrationByUser($user->getUserId(), $schedConf->getId()));
}
}
}
AppLocale::requireComponents(array(LOCALE_COMPONENT_OCS_MANAGER, LOCALE_COMPONENT_OCS_ADMIN, LOCALE_COMPONENT_OCS_DIRECTOR, LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_PKP_SUBMISSION));
// FIXME: For timeline constants
return $instance;
}
示例12: delete
/**
* Delete the specified comment and all its children.
*/
function delete($args)
{
$paperId = isset($args[0]) ? (int) $args[0] : 0;
$galleyId = isset($args[1]) ? (int) $args[1] : 0;
$commentId = isset($args[2]) ? (int) $args[2] : 0;
$this->validate($paperId);
$user =& Request::getUser();
$userId = isset($user) ? $user->getId() : null;
$commentDao =& DAORegistry::getDAO('CommentDAO');
if (!Validation::isConferenceManager()) {
Request::redirect(null, null, 'index');
}
$comment =& $commentDao->getComment($commentId, $paperId, PAPER_COMMENT_RECURSE_ALL);
if ($comment) {
$commentDao->deleteComment($comment);
}
Request::redirect(null, null, null, 'view', array($paperId, $galleyId), array('refresh' => 1));
}
示例13: mayViewPapers
/**
* Checks if a user has access to view papers
* @param $schedConf object
* @param $conference object
* @return bool
*/
function mayViewPapers(&$schedConf, &$conference)
{
if (Validation::isSiteAdmin() || Validation::isConferenceManager() || Validation::isDirector() || Validation::isTrackDirector()) {
return true;
}
if (!SchedConfAction::mayViewSchedConf($schedConf)) {
return false;
}
// Allow open access once the "open access" date has passed.
$paperAccess = $conference->getSetting('paperAccess');
if ($paperAccess == PAPER_ACCESS_OPEN) {
return true;
}
if ($schedConf->getSetting('delayOpenAccess') && time() > $schedConf->getSetting('delayOpenAccessDate')) {
if (Validation::isReader() && $paperAccess == PAPER_ACCESS_ACCOUNT_REQUIRED) {
return true;
}
}
if ($schedConf->getSetting('postPapers') && time() > $schedConf->getSetting('postPapersDate')) {
if (SchedConfAction::registeredUser($schedConf)) {
return true;
}
if (SchedConfAction::registeredDomain($schedConf)) {
return true;
}
}
return false;
}
示例14: email
function email($args)
{
$this->validate();
$this->setupTemplate(true);
$conference =& Request::getConference();
$schedConf =& Request::getSchedConf();
$templateMgr =& TemplateManager::getManager();
$userDao =& DAORegistry::getDAO('UserDAO');
$user =& Request::getUser();
// See if this is the Director or Manager and an email template has been chosen
$template = Request::getUserVar('template');
if (!$conference || empty($template) || !Validation::isConferenceManager() && !Validation::isDirector() && !Validation::isTrackDirector()) {
$template = null;
}
// Determine whether or not this account is subject to
// email sending restrictions.
$canSendUnlimitedEmails = Validation::isSiteAdmin();
$unlimitedEmailRoles = array(ROLE_ID_CONFERENCE_MANAGER, ROLE_ID_DIRECTOR, ROLE_ID_TRACK_DIRECTOR);
$roleDao =& DAORegistry::getDAO('RoleDAO');
if ($conference) {
$roles =& $roleDao->getRolesByUserId($user->getId(), $conference->getId());
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 ($paperId = Request::getUserVar('paperId')) {
// This message is in reference to a paper.
// Determine whether the current user has access
// to the paper in some form, and if so, use an
// PaperMailTemplate.
$paperDao =& DAORegistry::getDAO('PaperDAO');
$paper =& $paperDao->getPaper($paperId);
$hasAccess = false;
// First, conditions where access is OK.
// 1. User is submitter
if ($paper && $paper->getUserId() == $user->getId()) {
$hasAccess = true;
}
// 2. User is director
$editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
$editAssignments =& $editAssignmentDao->getEditAssignmentsByPaperId($paperId);
while ($editAssignment =& $editAssignments->next()) {
if ($editAssignment->getDirectorId() === $user->getId()) {
$hasAccess = true;
}
}
if (Validation::isDirector()) {
$hasAccess = true;
}
// 3. User is reviewer
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
foreach ($reviewAssignmentDao->getBySubmissionId($paperId) as $reviewAssignment) {
if ($reviewAssignment->getReviewerId() === $user->getId()) {
$hasAccess = true;
}
}
// Last, "deal-breakers" -- access is not allowed.
if ($paper && $paper->getSchedConfId() !== $schedConf->getId()) {
$hasAccess = false;
}
if ($hasAccess) {
import('classes.mail.PaperMailTemplate');
$email = new PaperMailTemplate($paperDao->getPaper($paperId));
}
}
if ($email === null) {
import('classes.mail.MailTemplate');
$email = new MailTemplate();
}
if (Request::getUserVar('send') && !$email->hasErrors()) {
$recipients = $email->getRecipients();
$ccs = $email->getCcs();
$bccs = $email->getBccs();
// Make sure there aren't too many recipients (to
// prevent use as a spam relay)
$recipientCount = 0;
if (is_array($recipients)) {
$recipientCount += count($recipients);
}
if (is_array($ccs)) {
$recipientCount += count($ccs);
}
if (is_array($bccs)) {
$recipientCount += count($bccs);
}
//.........这里部分代码省略.........