本文整理汇总了PHP中Request::getPress方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getPress方法的具体用法?PHP Request::getPress怎么用?PHP Request::getPress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Request
的用法示例。
在下文中一共展示了Request::getPress方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Save modified settings.
*/
function execute()
{
$press =& Request::getPress();
$settingsDao =& DAORegistry::getDAO('PressSettingsDAO');
// Verify additional locales
foreach (array('supportedLocales', 'supportedSubmissionLocales', 'supportedFormLocales') as $name) {
${$name} = array();
foreach ($this->getData($name) as $locale) {
if (Locale::isLocaleValid($locale) && in_array($locale, $this->availableLocales)) {
array_push(${$name}, $locale);
}
}
}
$primaryLocale = $this->getData('primaryLocale');
// Make sure at least the primary locale is chosen as available
if ($primaryLocale != null && !empty($primaryLocale)) {
foreach (array('supportedLocales', 'supportedSubmissionLocales', 'supportedFormLocales') as $name) {
if (!in_array($primaryLocale, ${$name})) {
array_push(${$name}, $primaryLocale);
}
}
}
$this->setData('supportedLocales', $supportedLocales);
$this->setData('supportedSubmissionLocales', $supportedSubmissionLocales);
$this->setData('supportedFormLocales', $supportedFormLocales);
foreach ($this->_data as $name => $value) {
if (!in_array($name, array_keys($this->settings))) {
continue;
}
$settingsDao->updateSetting($press->getId(), $name, $value, $this->settings[$name]);
}
$pressDao =& DAORegistry::getDAO('PressDAO');
$press->setPrimaryLocale($this->getData('primaryLocale'));
$pressDao->updatePress($press);
}
示例2: initData
/**
* Initialize form data from current settings.
* @param $args array
* @param $request PKPRequest
*/
function initData($args, &$request)
{
$press =& Request::getPress();
$submissionChecklistAll = $press->getSetting('submissionChecklist');
$checklistItem = array();
// preparea localizable array for this checklist Item
foreach (Locale::getSupportedLocales() as $locale => $name) {
$checklistItem[$locale] = null;
}
// if editing, set the content
// use of 'content' as key is for backwards compatibility
if (isset($this->submissionChecklistId)) {
foreach (Locale::getSupportedLocales() as $locale => $name) {
if (!isset($submissionChecklistAll[$locale][$this->submissionChecklistId]['content'])) {
$checklistItem[$locale] = '';
} else {
$checklistItem[$locale] = $submissionChecklistAll[$locale][$this->submissionChecklistId]['content'];
}
}
}
// assign the data to the form
$this->_data = array('checklistItem' => $checklistItem);
// grid related data
$this->_data['gridId'] = $args['gridId'];
$this->_data['rowId'] = $args['rowId'];
}
示例3: display
/**
* Display the form.
*/
function display()
{
$press =& Request::getPress();
$user =& Request::getUser();
$submission = $this->reviewerSubmission;
$reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO');
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$reviewAssignment = $reviewAssignmentDao->getById($submission->getReviewId());
if ($submission->getDateConfirmed() == null) {
$confirmedStatus = 0;
} else {
$confirmedStatus = 1;
}
$templateMgr =& TemplateManager::getManager();
$reviewerRequestParams = array('reviewer' => $reviewAssignment->getReviewerFullName(), 'personalNote' => 'EDITOR NOTE', 'editor' => $press->getSetting('contactName'));
$templateMgr->assign('reviewerRequest', Locale::translate('reviewer.step1.requestBoilerplate', $reviewerRequestParams));
$templateMgr->assign_by_ref('submission', $submission);
$templateMgr->assign_by_ref('reviewAssignment', $reviewAssignment);
$templateMgr->assign_by_ref('press', $press);
$templateMgr->assign_by_ref('reviewGuidelines', $press->getLocalizedSetting('reviewGuidelines'));
$templateMgr->assign('step', 1);
$templateMgr->assign('completedSteps', $submission->getStatus());
$templateMgr->assign('blindReview', true);
// FIXME: Need to be able to get/set if a review is blind or not
// FIXME: Need press setting that denotes competing interests are required
$templateMgr->assign('competingInterestsText', $submission->getCompetingInterests());
import('classes.submission.reviewAssignment.ReviewAssignment');
$templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
$templateMgr->assign('helpTopicId', 'editorial.reviewersRole.review');
parent::display();
}
示例4: SubmissionSubmitStep3Form
/**
* Constructor.
*/
function SubmissionSubmitStep3Form($monograph)
{
parent::SubmissionSubmitForm($monograph, 3);
$press =& Request::getPress();
// Validation checks for this form
$this->addCheck(new FormValidatorLocale($this, 'title', 'required', 'submission.submit.form.titleRequired'));
}
示例5: become
/**
* Become a given role.
*/
function become($args)
{
parent::validate(true);
$press =& Request::getPress();
$user =& Request::getUser();
switch (array_shift($args)) {
case 'author':
$roleId = ROLE_ID_AUTHOR;
$setting = 'allowRegAuthor';
$deniedKey = 'user.noRoles.submitMonographRegClosed';
break;
case 'reviewer':
$roleId = ROLE_ID_REVIEWER;
$setting = 'allowRegReviewer';
$deniedKey = 'user.noRoles.regReviewerClosed';
break;
default:
Request::redirect(null, null, 'index');
}
if ($press->getSetting($setting)) {
$userGroupDao =& DAORegistry::getDAO('UserGroupDAO');
$userGroup =& $userGroupDao->getDefaultByRoleId($press->getId(), $roleId);
$userGroupDao->assignUserToGroup($user->getId(), $userGroup->getId());
Request::redirectUrl(Request::getUserVar('source'));
} else {
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('message', $deniedKey);
return $templateMgr->display('common/message.tpl');
}
}
示例6: display
/**
* Display the form.
*/
function display()
{
$templateMgr =& TemplateManager::getManager();
$press = Request::getPress();
$templateMgr->assign_by_ref('submission', $this->reviewerSubmission);
$templateMgr->assign_by_ref('press', $press);
$templateMgr->assign('step', 3);
$reviewAssignment =& $this->getReviewAssignment();
$templateMgr->assign_by_ref('reviewAssignment', $reviewAssignment);
/* FIXME #5123: Include when review form infrastructure is in place
if($reviewAssignment->getReviewFormId()) {
// Get the review form components
$reviewFormElementDao =& DAORegistry::getDAO('ReviewFormElementDAO');
$reviewFormElements =& $reviewFormElementDao->getReviewFormElements($reviewAssignment->getReviewFormId());
$reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO');
$reviewFormResponses =& $reviewFormResponseDao->getReviewReviewFormResponseValues($reviewAssignment->getReviewId());
$reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
$reviewformid = $reviewAssignment->getReviewFormId();
$reviewForm =& $reviewFormDao->getReviewForm($reviewAssignment->getReviewFormId(), ASSOC_TYPE_PRESS, $press->getId());
$templateMgr->assign_by_ref('reviewForm', $reviewForm);
$templateMgr->assign('reviewFormElements', $reviewFormElements);
$templateMgr->assign('reviewFormResponses', $reviewFormResponses);
$templateMgr->assign('isLocked', isset($reviewAssignment) && $reviewAssignment->getDateCompleted() != null);
}*/
parent::display();
}
示例7: define
/**
* Used by subclasses to validate access keys when they are allowed.
* @param $userId int The user this key refers to
* @param $reviewId int The ID of the review this key refers to
* @param $newKey string The new key name, if one was supplied; otherwise, the existing one (if it exists) is used
* @return object Valid user object if the key was valid; otherwise NULL.
*/
function &validateAccessKey($userId, $reviewId, $newKey = null)
{
$press =& Request::getPress();
if (!$press || !$press->getSetting('reviewerAccessKeysEnabled')) {
$accessKey = false;
return $accessKey;
}
define('REVIEWER_ACCESS_KEY_SESSION_VAR', 'ReviewerAccessKey');
import('lib.pkp.classes.security.AccessKeyManager');
$accessKeyManager = new AccessKeyManager();
$session =& Request::getSession();
// Check to see if a new access key is being used.
if (!empty($newKey)) {
if (Validation::isLoggedIn()) {
Validation::logout();
}
$keyHash = $accessKeyManager->generateKeyHash($newKey);
$session->setSessionVar(REVIEWER_ACCESS_KEY_SESSION_VAR, $keyHash);
} else {
$keyHash = $session->getSessionVar(REVIEWER_ACCESS_KEY_SESSION_VAR);
}
// Now that we've gotten the key hash (if one exists), validate it.
$accessKey =& $accessKeyManager->validateKey('ReviewerContext', $userId, $keyHash, $reviewId);
if ($accessKey) {
$userDao =& DAORegistry::getDAO('UserDAO');
$user =& $userDao->getUser($accessKey->getUserId(), false);
return $user;
}
// No valid access key -- return NULL.
return $accessKey;
}
示例8: execute
/**
* Save group group.
* @see Form::execute()
*/
function execute()
{
$groupDao =& DAORegistry::getDAO('GroupDAO');
$press =& Request::getPress();
if (!isset($this->group)) {
$this->group = $groupDao->newDataObject();
}
$this->group->setAssocType(ASSOC_TYPE_PRESS);
$this->group->setAssocId($press->getId());
$this->group->setTitle($this->getData('title'), Locale::getLocale());
// Localized
$this->group->setContext($this->getData('context'));
// Eventually this will be a general Groups feature; for now,
// we're just using it to display press team entries in About.
$this->group->setAboutDisplayed(true);
// Update or insert group group
if ($this->group->getId() != null) {
$groupDao->updateObject($this->group);
} else {
$this->group->setSequence(REALLY_BIG_NUMBER);
$groupDao->insertGroup($this->group);
// Re-order the groups so the new one is at the end of the list.
$groupDao->resequenceGroups($this->group->getAssocType(), $this->group->getAssocId());
}
return true;
}
示例9: display
/**
* Display the form.
*/
function display()
{
$press =& Request::getPress();
$templateMgr =& TemplateManager::getManager();
if (Config::getVar('email', 'allow_envelope_sender')) {
$templateMgr->assign('envelopeSenderEnabled', true);
}
$templateMgr->assign('pressEnabled', $press->getEnabled());
parent::display();
}
示例10: execute
/**
* Save modified settings.
*/
function execute()
{
$press =& Request::getPress();
$settingsDao =& DAORegistry::getDAO('PressSettingsDAO');
foreach ($this->_data as $name => $value) {
if (isset($this->settings[$name])) {
$isLocalized = in_array($name, $this->getLocaleFieldNames());
$settingsDao->updateSetting($press->getId(), $name, $value, $this->settings[$name], $isLocalized);
}
}
}
示例11: getContents
function getContents(&$templateMgr)
{
$user =& Request::getUser();
$press =& Request::getPress();
if ($user && $press) {
$userId = $user->getId();
$notificationDao =& DAORegistry::getDAO('NotificationDAO');
$templateMgr->assign('unreadNotifications', $notificationDao->getUnreadNotificationCount($userId));
}
return parent::getContents($templateMgr);
}
示例12: getContents
/**
* Get the HTML contents for this block.
* @param $templateMgr object
* @return $string
*/
function getContents(&$templateMgr)
{
$press =& Request::getPress();
if (!$press) {
return '';
}
$templateMgr->assign('forReaders', $press->getLocalizedSetting('readerInformation'));
$templateMgr->assign('forAuthors', $press->getLocalizedSetting('authorInformation'));
$templateMgr->assign('forLibrarians', $press->getLocalizedSetting('librarianInformation'));
return parent::getContents($templateMgr);
}
示例13: _setMailFrom
/**
* Helper Function - set mail from address
* @param MailTemplate $mail
*/
function _setMailFrom(&$mail)
{
$site =& Request::getSite();
$press =& Request::getPress();
// Set the sender based on the current context
if ($press && $press->getSetting('supportEmail')) {
$mail->setFrom($press->getSetting('supportEmail'), $press->getSetting('supportName'));
} else {
$mail->setFrom($site->getLocalizedContactEmail(), $site->getLocalizedContactName());
}
}
示例14: assignParams
function assignParams($paramArray = array())
{
$monograph =& $this->monograph;
$press = isset($this->press) ? $this->press : Request::getPress();
$paramArray['monographTitle'] = strip_tags($monograph->getLocalizedTitle());
$paramArray['monographId'] = $monograph->getId();
$paramArray['pressName'] = strip_tags($press->getLocalizedName());
$paramArray['seriesName'] = strip_tags($monograph->getSeriesTitle());
$paramArray['monographAbstract'] = String::html2text($monograph->getLocalizedAbstract());
$paramArray['authorString'] = strip_tags($monograph->getAuthorString());
parent::assignParams($paramArray);
}
示例15: display
/**
* Display the form.
*/
function display()
{
$templateMgr =& TemplateManager::getManager();
$press = Request::getPress();
$reviewerGuidelines = $press->getLocalizedSetting('reviewGuidelines');
if (empty($reviewerGuidelines)) {
$reviewerGuidelines = Locale::translate('reviewer.monograph.noGuidelines');
}
$templateMgr->assign_by_ref('reviewerGuidelines', $press->getLocalizedSetting('reviewGuidelines'));
$templateMgr->assign_by_ref('submission', $this->reviewerSubmission);
$templateMgr->assign('step', 2);
parent::display();
}