本文整理汇总了PHP中Request::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getUser方法的具体用法?PHP Request::getUser怎么用?PHP Request::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Request
的用法示例。
在下文中一共展示了Request::getUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayPaymentForm
function displayPaymentForm($queuedPaymentId, &$queuedPayment)
{
if (!$this->isConfigured()) {
return false;
}
$schedConf =& Request::getSchedConf();
$user =& Request::getUser();
$params = array('business' => $this->getSetting($schedConf->getConferenceId(), $schedConf->getId(), 'selleraccount'), 'item_name' => $queuedPayment->getDescription(), 'amount' => $queuedPayment->getAmount(), 'quantity' => 1, 'no_note' => 1, 'no_shipping' => 1, 'currency_code' => $queuedPayment->getCurrencyCode(), 'lc' => String::substr(Locale::getLocale(), 3), 'custom' => $queuedPaymentId, 'notify_url' => Request::url(null, null, 'payment', 'plugin', array($this->getName(), 'ipn')), 'return' => $queuedPayment->getRequestUrl(), 'cancel_return' => Request::url(null, null, 'payment', 'plugin', array($this->getName(), 'cancel')), 'first_name' => $user ? $user->getFirstName() : '', 'last_name' => $user ? $user->getLastname() : '', 'item_number' => 1, 'cmd' => '_xclick');
$templateMgr =& TemplateManager::getManager();
switch ($queuedPayment->getType()) {
case QUEUED_PAYMENT_TYPE_REGISTRATION:
// Provide registration-specific details to template.
$registrationDao =& DAORegistry::getDAO('RegistrationDAO');
$registrationOptionDao =& DAORegistry::getDAO('RegistrationOptionDAO');
$registrationTypeDao =& DAORegistry::getDAO('RegistrationTypeDAO');
$registration =& $registrationDao->getRegistration($queuedPayment->getAssocId());
if (!$registration || $registration->getUserId() != $queuedPayment->getUserId() || $registration->getSchedConfId() != $queuedPayment->getSchedConfId()) {
break;
}
$registrationOptionIterator =& $registrationOptionDao->getRegistrationOptionsBySchedConfId($schedConf->getId());
$registrationOptionCosts = $registrationTypeDao->getRegistrationOptionCosts($registration->getTypeId());
$registrationOptionIds = $registrationOptionDao->getRegistrationOptions($registration->getRegistrationId());
$templateMgr->assign('registration', $registration);
$templateMgr->assign('registrationType', $registrationTypeDao->getRegistrationType($registration->getTypeId()));
$templateMgr->assign('registrationOptions', $registrationOptionIterator->toArray());
$templateMgr->assign('registrationOptionCosts', $registrationOptionCosts);
$templateMgr->assign('registrationOptionIds', $registrationOptionIds);
}
$templateMgr->assign('params', $params);
$templateMgr->assign('paypalFormUrl', $this->getSetting($schedConf->getConferenceId(), $schedConf->getId(), 'paypalurl'));
$templateMgr->display($this->getTemplatePath() . 'paymentForm.tpl');
}
示例2: MetadataForm
/**
* Constructor.
*/
function MetadataForm($paper)
{
$roleDao =& DAORegistry::getDAO('RoleDAO');
$schedConf =& Request::getSchedConf();
$user =& Request::getUser();
$roleId = $roleDao->getRoleIdFromPath(Request::getRequestedPage());
// If the user is a director of this paper, make the form editable.
$this->canEdit = false;
if ($roleId != null && ($roleId == ROLE_ID_DIRECTOR || $roleId == ROLE_ID_TRACK_DIRECTOR)) {
$this->canEdit = true;
}
// Check if the author can modify metadata.
if ($roleId == ROLE_ID_AUTHOR) {
if (AuthorAction::mayEditPaper($paper)) {
$this->canEdit = true;
}
}
if ($this->canEdit) {
parent::Form('submission/metadata/metadataEdit.tpl');
$this->addCheck(new FormValidatorLocale($this, 'title', 'required', 'author.submit.form.titleRequired'));
$this->addCheck(new FormValidatorArray($this, 'authors', 'required', 'author.submit.form.authorRequiredFields', array('firstName', 'lastName')));
$this->addCheck(new FormValidatorArrayCustom($this, 'authors', 'required', 'author.submit.form.authorRequiredFields', create_function('$email, $regExp', 'return String::regexp_match($regExp, $email);'), array(ValidatorEmail::getRegexp()), false, array('email')));
$this->addCheck(new FormValidatorArrayCustom($this, 'authors', 'required', 'user.profile.form.urlInvalid', create_function('$url, $regExp', 'return empty($url) ? true : String::regexp_match($regExp, $url);'), array(ValidatorUrl::getRegexp()), false, array('url')));
} else {
parent::Form('submission/metadata/metadataView.tpl');
}
// If the user is a reviewer of this paper, do not show authors.
$this->canViewAuthors = true;
if ($roleId != null && $roleId == ROLE_ID_REVIEWER) {
$this->canViewAuthors = false;
}
$this->paper = $paper;
$this->addCheck(new FormValidatorPost($this));
}
示例3: _assignTemplateCounterXML
/**
* Internal function to assign information for the Counter part of a report
*/
function _assignTemplateCounterXML($templateManager, $begin, $end = '')
{
$journal =& Request::getJournal();
$counterReportDao =& DAORegistry::getDAO('CounterReportDAO');
$journalDao =& DAORegistry::getDAO('JournalDAO');
$journalIds = $counterReportDao->getJournalIds();
if ($end == '') {
$end = $begin;
}
$i = 0;
foreach ($journalIds as $journalId) {
$journal =& $journalDao->getById($journalId);
if (!$journal) {
continue;
}
$entries = $counterReportDao->getMonthlyLogRange($journalId, $begin, $end);
$journalsArray[$i]['entries'] = $this->_arrangeEntries($entries, $begin, $end);
$journalsArray[$i]['journalTitle'] = $journal->getLocalizedTitle();
$journalsArray[$i]['publisherInstitution'] = $journal->getSetting('publisherInstitution');
$journalsArray[$i]['printIssn'] = $journal->getSetting('printIssn');
$journalsArray[$i]['onlineIssn'] = $journal->getSetting('onlineIssn');
$i++;
}
$siteSettingsDao =& DAORegistry::getDAO('SiteSettingsDAO');
$siteTitle = $siteSettingsDao->getSetting('title', AppLocale::getLocale());
$base_url =& Config::getVar('general', 'base_url');
$reqUser =& Request::getUser();
$templateManager->assign_by_ref('reqUser', $reqUser);
$templateManager->assign_by_ref('journalsArray', $journalsArray);
$templateManager->assign('siteTitle', $siteTitle);
$templateManager->assign('base_url', $base_url);
}
示例4: logEventEntry
/**
* Add an event log entry to this conference.
* @param $conferenceId int
* @param $schedConfId int optional
* @param $entry ConferenceEventLogEntry
*/
function logEventEntry($conferenceId, $schedConfId = null, &$entry)
{
$conferenceDao =& DAORegistry::getDAO('ConferenceDAO');
$schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
$conference = $conferenceDao->getConference($conferenceId);
if (!$conference) {
// Conference is invalid.
return false;
}
$schedConf = null;
if ($schedConfId != null) {
$schedConf = $schedConfDao->getSchedConf($schedConfId);
}
if ($conference && !$conference->getSetting('conferenceEventLog')) {
// Event logging is disabled
return false;
}
// Add the entry
$entry->setConferenceId($conferenceId);
$entry->setSchedConfId($schedConfId);
if ($entry->getUserId() == null) {
$user =& Request::getUser();
$entry->setUserId($user == null ? 0 : $user->getId());
}
$logDao =& DAORegistry::getDAO('ConferenceEventLogDAO');
return $logDao->insertLogEntry($entry);
}
示例5: display
/**
* Display the form.
*/
function display(&$args)
{
$meetingId = isset($args[0]) ? $args[0] : 0;
$journal =& Request::getJournal();
$journalId = $journal->getId();
$user =& Request::getUser();
$sectionDecisionDao =& DAORegistry::getDAO('SectionDecisionDAO');
$sort = Request::getUserVar('sort');
$sort = isset($sort) ? $sort : 'id';
$sortDirection = Request::getUserVar('sortDirection');
$availableSectionDecisions =& $sectionDecisionDao->getSectionDecisionsAvailableForMeeting($user->getSecretaryCommitteeId(), $journalId, $sort, $sortDirection);
/*Get the selected submissions to be reviewed*/
$meetingDao =& DAORegistry::getDAO('MeetingDAO');
$meeting =& $meetingDao->getMeetingById($meetingId);
/*Get the selected submissions to be reviewed*/
$meetingSectionDecisionDao =& DAORegistry::getDAO('MeetingSectionDecisionDAO');
$mSectionDecisions = $meetingSectionDecisionDao->getMeetingSectionDecisionsByMeetingId($meetingId);
$sectionDecisionsId = array();
foreach ($mSectionDecisions as $mSectionDecision) {
array_push($sectionDecisionsId, $mSectionDecision->getSectionDecisionId());
}
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('sort', $sort);
$templateMgr->assign('sortDirection', $sortDirection);
$templateMgr->assign('meetingId', $meetingId);
$templateMgr->assign('meetingDate', $meeting->getDate());
$templateMgr->assign('meetingLength', $meeting->getLength());
$templateMgr->assign('location', $meeting->getLocation());
$templateMgr->assign('investigator', $meeting->getInvestigator());
$templateMgr->assign_by_ref('availableSectionDecisions', $availableSectionDecisions);
$templateMgr->assign_by_ref('sectionDecisionsId', $sectionDecisionsId);
$templateMgr->assign('baseUrl', Config::getVar('general', "base_url"));
parent::display();
}
示例6: index
/**
* Display proofreader index page.
*/
function index($args)
{
$this->validate();
$this->setupTemplate();
$journal =& Request::getJournal();
$user =& Request::getUser();
$proofreaderSubmissionDao =& DAORegistry::getDAO('ProofreaderSubmissionDAO');
// Get the user's search conditions, if any
$searchField = Request::getUserVar('searchField');
$dateSearchField = Request::getUserVar('dateSearchField');
$searchMatch = Request::getUserVar('searchMatch');
$search = Request::getUserVar('search');
$fromDate = Request::getUserDateVar('dateFrom', 1, 1);
if ($fromDate !== null) {
$fromDate = date('Y-m-d H:i:s', $fromDate);
}
$toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
if ($toDate !== null) {
$toDate = date('Y-m-d H:i:s', $toDate);
}
$rangeInfo = Handler::getRangeInfo('submissions');
$page = isset($args[0]) ? $args[0] : '';
switch ($page) {
case 'completed':
$active = false;
break;
default:
$page = 'active';
$active = true;
}
$sort = Request::getUserVar('sort');
$sort = isset($sort) ? $sort : 'title';
$sortDirection = Request::getUserVar('sortDirection');
$countryField = Request::getUserVar('countryField');
$submissions = $proofreaderSubmissionDao->getSubmissions($user->getId(), $journal->getId(), $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $countryField, $active, $rangeInfo, $sort, $sortDirection);
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('pageToDisplay', $page);
$templateMgr->assign_by_ref('submissions', $submissions);
// Set search parameters
$duplicateParameters = array('searchField', 'searchMatch', 'search', 'dateFromMonth', 'dateFromDay', 'dateFromYear', 'dateToMonth', 'dateToDay', 'dateToYear', 'dateSearchField');
foreach ($duplicateParameters as $param) {
$templateMgr->assign($param, Request::getUserVar($param));
}
$templateMgr->assign('dateFrom', $fromDate);
$templateMgr->assign('dateTo', $toDate);
$templateMgr->assign('fieldOptions', array(SUBMISSION_FIELD_TITLE => 'article.title', SUBMISSION_FIELD_AUTHOR => 'user.role.author', SUBMISSION_FIELD_EDITOR => 'user.role.editor'));
$templateMgr->assign('dateFieldOptions', array(SUBMISSION_FIELD_DATE_SUBMITTED => 'submissions.submitted', SUBMISSION_FIELD_DATE_COPYEDIT_COMPLETE => 'submissions.copyeditComplete', SUBMISSION_FIELD_DATE_LAYOUT_COMPLETE => 'submissions.layoutComplete', SUBMISSION_FIELD_DATE_PROOFREADING_COMPLETE => 'submissions.proofreadingComplete'));
$extraFieldDao =& DAORegistry::getDAO('ExtraFieldDAO');
$countries =& $extraFieldDao->getExtraFieldsList(EXTRA_FIELD_GEO_AREA);
$templateMgr->assign_by_ref('countries', $countries);
import('classes.issue.IssueAction');
$issueAction = new IssueAction();
$templateMgr->register_function('print_issue_id', array($issueAction, 'smartyPrintIssueId'));
$templateMgr->assign('helpTopicId', 'editorial.proofreadersRole.submissions');
$templateMgr->assign('sort', $sort);
$templateMgr->assign('sortDirection', $sortDirection);
// Added by igm 9/24/11
$templateMgr->assign('countryField', $countryField);
$templateMgr->display('proofreader/index.tpl');
}
示例7: become
/**
* Become a given role.
*/
function become($args)
{
parent::validate(true, true);
$user =& Request::getUser();
if (!$user) {
Request::redirect(null, null, 'index');
}
switch (array_shift($args)) {
case 'submitter':
$roleId = ROLE_ID_SUBMITTER;
$setting = 'enableSubmit';
$deniedKey = 'user.noRoles.enableSubmitClosed';
break;
default:
Request::redirect('index');
}
$site =& Request::getSite();
if ($site->getSetting($setting)) {
$role = new Role();
$role->setRoleId($roleId);
$role->setUserId($user->getId());
$roleDao =& DAORegistry::getDAO('RoleDAO');
$roleDao->insertRole($role);
Request::redirectUrl(Request::getUserVar('source'));
} else {
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('message', $deniedKey);
return $templateMgr->display('common/message.tpl');
}
}
示例8: index
/**
* Display reviewer index page.
*/
function index($args)
{
$this->validate();
$this->setupTemplate();
$schedConf =& Request::getSchedConf();
$user =& Request::getUser();
$reviewerSubmissionDao =& DAORegistry::getDAO('ReviewerSubmissionDAO');
$rangeInfo = Handler::getRangeInfo('submissions');
$page = isset($args[0]) ? $args[0] : '';
switch ($page) {
case 'completed':
$active = false;
break;
default:
$page = 'active';
$active = true;
}
$submissions = $reviewerSubmissionDao->getReviewerSubmissionsByReviewerId($user->getId(), $schedConf->getId(), $active, $rangeInfo);
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
$templateMgr->assign('pageToDisplay', $page);
$templateMgr->assign_by_ref('submissions', $submissions);
$templateMgr->assign_by_ref('schedConf', $schedConf);
import('submission.reviewAssignment.ReviewAssignment');
$templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
$templateMgr->assign('helpTopicId', 'editorial.reviewersRole.submissions');
$templateMgr->display('reviewer/index.tpl');
}
示例9: index
/**
* Display reviewer index page.
*/
function index($args)
{
ReviewerHandler::validate();
ReviewerHandler::setupTemplate();
$journal =& Request::getJournal();
$user =& Request::getUser();
$reviewerSubmissionDao =& DAORegistry::getDAO('ReviewerSubmissionDAO');
$rangeInfo = Handler::getRangeInfo('submissions');
$page = isset($args[0]) ? $args[0] : '';
switch ($page) {
case 'completed':
$active = false;
break;
default:
$page = 'active';
$active = true;
}
$submissions = $reviewerSubmissionDao->getReviewerSubmissionsByReviewerId($user->getUserId(), $journal->getJournalId(), $active, $rangeInfo);
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
$templateMgr->assign('pageToDisplay', $page);
$templateMgr->assign_by_ref('submissions', $submissions);
import('submission.reviewAssignment.ReviewAssignment');
$templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
import('issue.IssueAction');
$issueAction =& new IssueAction();
$templateMgr->register_function('print_issue_id', array($issueAction, 'smartyPrintIssueId'));
$templateMgr->assign('helpTopicId', 'editorial.reviewersRole.submissions');
$templateMgr->display('reviewer/index.tpl');
}
示例10: isValid
function isValid()
{
$filePathId = $this->getFieldValue();
import('lib.pkp.classes.file.TemporaryFileDAO');
$tempFileDAO = new TemporaryFileDAO();
$finfo = new finfo(FILEINFO_MIME);
foreach ($filePathId as $fId) {
if (is_numeric($fId)) {
$user =& Request::getUser();
$tempFile = $tempFileDAO->getTemporaryFile($fId, $user->getId());
$file_path = $tempFile->getFilePath();
$fType = $finfo->file($file_path);
$pattern = "/application\\/zip/";
$patternPDF = "/application\\/pdf/";
if (preg_match($pattern, $fType)) {
return true;
}
if (preg_match($patternPDF, $fType)) {
return true;
}
return false;
}
return true;
}
}
示例11: handle
/**
* Handle incoming requests/notifications
*/
function handle($args)
{
$conference =& Request::getConference();
$schedConf =& Request::getSchedConf();
$templateMgr =& TemplateManager::getManager();
$user =& Request::getUser();
$op = isset($args[0]) ? $args[0] : null;
$queuedPaymentId = isset($args[1]) ? (int) $args[1] : 0;
import('payment.ocs.OCSPaymentManager');
$ocsPaymentManager =& OCSPaymentManager::getManager();
$queuedPayment =& $ocsPaymentManager->getQueuedPayment($queuedPaymentId);
// if the queued payment doesn't exist, redirect away from payments
if (!$queuedPayment) {
Request::redirect(null, null, null, 'index');
}
switch ($op) {
case 'notify':
import('mail.MailTemplate');
Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON));
$contactName = $schedConf->getSetting('registrationName');
$contactEmail = $schedConf->getSetting('registrationEmail');
$mail = new MailTemplate('MANUAL_PAYMENT_NOTIFICATION');
$mail->setFrom($contactEmail, $contactName);
$mail->addRecipient($contactEmail, $contactName);
$mail->assignParams(array('schedConfName' => $schedConf->getFullTitle(), 'userFullName' => $user ? $user->getFullName() : '(' . Locale::translate('common.none') . ')', 'userName' => $user ? $user->getUsername() : '(' . Locale::translate('common.none') . ')', 'itemName' => $queuedPayment->getName(), 'itemCost' => $queuedPayment->getAmount(), 'itemCurrencyCode' => $queuedPayment->getCurrencyCode()));
$mail->send();
$templateMgr->assign(array('currentUrl' => Request::url(null, null, null, 'payment', 'plugin', array('notify', $queuedPaymentId)), 'pageTitle' => 'plugins.paymethod.manual.paymentNotification', 'message' => 'plugins.paymethod.manual.notificationSent', 'backLink' => $queuedPayment->getRequestUrl(), 'backLinkLabel' => 'common.continue'));
$templateMgr->display('common/message.tpl');
exit;
break;
}
parent::handle($args);
// Don't know what to do with it
}
示例12: index
/**
* Display section editor index page.
*/
function index($args)
{
SectionEditorHandler::validate();
SectionEditorHandler::setupTemplate();
$journal =& Request::getJournal();
$user =& Request::getUser();
$rangeInfo = Handler::getRangeInfo('submissions');
// Get the user's search conditions, if any
$searchField = Request::getUserVar('searchField');
$dateSearchField = Request::getUserVar('dateSearchField');
$searchMatch = Request::getUserVar('searchMatch');
$search = Request::getUserVar('search');
$fromDate = Request::getUserDateVar('dateFrom', 1, 1);
if ($fromDate !== null) {
$fromDate = date('Y-m-d H:i:s', $fromDate);
}
$toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
if ($toDate !== null) {
$toDate = date('Y-m-d H:i:s', $toDate);
}
$sectionDao =& DAORegistry::getDAO('SectionDAO');
$sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
$page = isset($args[0]) ? $args[0] : '';
$sections =& $sectionDao->getSectionTitles($journal->getJournalId());
switch ($page) {
case 'submissionsInEditing':
$functionName = 'getSectionEditorSubmissionsInEditing';
$helpTopicId = 'editorial.sectionEditorsRole.submissions.inEditing';
break;
case 'submissionsArchives':
$functionName = 'getSectionEditorSubmissionsArchives';
$helpTopicId = 'editorial.sectionEditorsRole.submissions.archives';
break;
default:
$page = 'submissionsInReview';
$functionName = 'getSectionEditorSubmissionsInReview';
$helpTopicId = 'editorial.sectionEditorsRole.submissions.inReview';
}
$submissions =& $sectionEditorSubmissionDao->{$functionName}($user->getUserId(), $journal->getJournalId(), Request::getUserVar('section'), $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $rangeInfo);
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('helpTopicId', $helpTopicId);
$templateMgr->assign('sectionOptions', array(0 => Locale::Translate('editor.allSections')) + $sections);
$templateMgr->assign_by_ref('submissions', $submissions);
$templateMgr->assign('section', Request::getUserVar('section'));
$templateMgr->assign('pageToDisplay', $page);
$templateMgr->assign('sectionEditor', $user->getFullName());
// Set search parameters
$duplicateParameters = array('searchField', 'searchMatch', 'search', 'dateFromMonth', 'dateFromDay', 'dateFromYear', 'dateToMonth', 'dateToDay', 'dateToYear', 'dateSearchField');
foreach ($duplicateParameters as $param) {
$templateMgr->assign($param, Request::getUserVar($param));
}
$templateMgr->assign('dateFrom', $fromDate);
$templateMgr->assign('dateTo', $toDate);
$templateMgr->assign('fieldOptions', array(SUBMISSION_FIELD_TITLE => 'article.title', SUBMISSION_FIELD_AUTHOR => 'user.role.author', SUBMISSION_FIELD_EDITOR => 'user.role.editor'));
$templateMgr->assign('dateFieldOptions', array(SUBMISSION_FIELD_DATE_SUBMITTED => 'submissions.submitted', SUBMISSION_FIELD_DATE_COPYEDIT_COMPLETE => 'submissions.copyeditComplete', SUBMISSION_FIELD_DATE_LAYOUT_COMPLETE => 'submissions.layoutComplete', SUBMISSION_FIELD_DATE_PROOFREADING_COMPLETE => 'submissions.proofreadingComplete'));
import('issue.IssueAction');
$issueAction =& new IssueAction();
$templateMgr->register_function('print_issue_id', array($issueAction, 'smartyPrintIssueId'));
$templateMgr->display('sectionEditor/index.tpl');
}
示例13: createRepresentationNode
/**
* Create and return a representation node. Extend the parent class
* with publication format specific data.
* @param $doc DOMDocument
* @param $representation Representation
* @return DOMElement
*/
function createRepresentationNode($doc, $representation)
{
$representationNode = parent::createRepresentationNode($doc, $representation);
$representationNode->setAttribute('approved', $representation->getIsApproved() ? 'true' : 'false');
$representationNode->setAttribute('available', $representation->getIsAvailable() ? 'true' : 'false');
$representationNode->setAttribute('physical_format', $representation->getPhysicalFormat() ? 'true' : 'false');
// If all nexessary press settings exist, export ONIX metadata
$context = $this->getDeployment()->getContext();
if ($context->getSetting('publisher') && $context->getSetting('location') && $context->getSetting('codeType') && $context->getSetting('codeValue')) {
$submission = $this->getDeployment()->getSubmission();
$filterDao = DAORegistry::getDAO('FilterDAO');
$nativeExportFilters = $filterDao->getObjectsByGroup('monograph=>onix30-xml');
assert(count($nativeExportFilters) == 1);
// Assert only a single serialization filter
$exportFilter = array_shift($nativeExportFilters);
$exportFilter->setDeployment(new Onix30ExportDeployment(Request::getContext(), Request::getUser()));
$onixDoc = $exportFilter->execute($submission);
if ($onixDoc) {
// we do this to ensure validation.
// assemble just the Product node we want.
$publicationFormatDOMElement = $exportFilter->createProductNode($doc, $submission, $representation);
if ($publicationFormatDOMElement instanceof DOMElement) {
import('lib.pkp.classes.xslt.XSLTransformer');
$xslTransformer = new XSLTransformer();
$xslFile = 'plugins/importexport/native/onixProduct2NativeXml.xsl';
$productXml = $publicationFormatDOMElement->ownerDocument->saveXML($publicationFormatDOMElement);
$filteredXml = $xslTransformer->transform($productXml, XSL_TRANSFORMER_DOCTYPE_STRING, $xslFile, XSL_TRANSFORMER_DOCTYPE_FILE, XSL_TRANSFORMER_DOCTYPE_STRING);
$representationFragment = $doc->createDocumentFragment();
$representationFragment->appendXML($filteredXml);
$representationNode->appendChild($representationFragment);
}
}
}
return $representationNode;
}
示例14: displayPaymentForm
function displayPaymentForm($queuedPaymentId, &$queuedPayment)
{
if (!$this->isConfigured()) {
return false;
}
$journal =& Request::getJournal();
$templateMgr =& TemplateManager::getManager();
$user =& Request::getUser();
$templateMgr->assign('itemName', $queuedPayment->getName());
$templateMgr->assign('itemDescription', $queuedPayment->getDescription());
if ($queuedPayment->getAmount() > 0) {
$templateMgr->assign('itemAmount', $queuedPayment->getAmount());
$templateMgr->assign('itemCurrencyCode', $queuedPayment->getCurrencyCode());
}
$templateMgr->assign('manualInstructions', $this->getSetting($journal->getJournalId(), 'manualInstructions'));
$templateMgr->display($this->getTemplatePath() . 'paymentForm.tpl');
if ($queuedPayment->getAmount() > 0) {
import('mail.MailTemplate');
$contactName = $journal->getSetting('contactName');
$contactEmail = $journal->getSetting('contactEmail');
$mail =& new MailTemplate('MANUAL_PAYMENT_NOTIFICATION');
$mail->setFrom($contactEmail, $contactName);
$mail->addRecipient($contactEmail, $contactName);
$mail->assignParams(array('journalName' => $journal->getJournalTitle(), 'userFullName' => $user ? $user->getFullName() : '(' . Locale::translate('common.none') . ')', 'userName' => $user ? $user->getUsername() : '(' . Locale::translate('common.none') . ')', 'itemName' => $queuedPayment->getName(), 'itemCost' => $queuedPayment->getAmount(), 'itemCurrencyCode' => $queuedPayment->getCurrencyCode()));
$mail->send();
}
}
示例15: 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');
}
}