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'); }
/** * 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)); }
/** * 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); }
/** * 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); }
/** * 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(); }
/** * 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'); }
/** * 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'); } }
/** * 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'); }
/** * 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'); }
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; } }
/** * 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 }
/** * 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'); }
/** * 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; }
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(); } }
/** * 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'); } }
/** * 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(); }
/** * Check if field value is valid. * Value is valid if it is empty and optional or validated by user-supplied function. * @return boolean */ function isValid() { // Get conference ID from request $conference =& Request::getConference(); $conferenceId = $conference ? $conference->getId() : 0; // Get scheduled conference ID from request $schedConf =& Request::getSchedConf(); $schedConfId = $schedConf ? $schedConf->getId() : 0; $user = Request::getUser(); if (!$user) { return false; } $roleDao =& DAORegistry::getDAO('RoleDAO'); $returner = true; foreach ($this->roles as $roleId) { if ($roleId == ROLE_ID_SITE_ADMIN) { $exists = $roleDao->roleExists(0, 0, $user->getId(), $roleId); } elseif ($roleId == ROLE_ID_CONFERENCE_MANAGER) { $exists = $roleDao->roleExists($conferenceId, 0, $user->getId(), $roleId); } else { $exists = $roleDao->roleExists($conferenceId, $schedConfId, $user->getId(), $roleId); } if (!$this->all && $exists) { return true; } $returner = $returner && $exists; } return $returner; }
/** * Get the LRS details based on Auth credentials * **/ public function getLrs() { //get the lrs $key = \Request::getUser(); $secret = \Request::getPassword(); $lrs = \Lrs::where('api.basic_key', $key)->where('api.basic_secret', $secret)->first(); $this->lrs = $lrs; }
/** * Initialize form data. */ function initData() { $PagSeguroPlugin =& $this->PagSeguroPlugin; $user =& Request::getUser(); $userId = $user ? $user->getUserId() : null; $queuedPayment =& $this->queuedPayment; $this->_data = array('email_cobranca' => '*****@*****.**', 'item_name' => $queuedPayment->getDescription(), 'a3' => $queuedPayment->getAmount($args), 'quantity' => 1, 'no_note' => 1, 'no_shipping' => 1, 'currency_code' => $queuedPayment->getCurrencyCode(), 'lc' => String::substr(Locale::getLocale(), 3), 'custom' => $this->key, 'notify_url' => Request::url(null, null, 'payment', 'ipn', array($queuedPayment->getQueuedPaymentId())), 'return' => Request::url(null, null, 'payment', 'return', array($queuedPayment->getQueuedPaymentId())), 'cancel_return' => Request::url(null, null, 'payment', 'cancel', array($queuedPayment->getQueuedPaymentId())), 'first_name' => $user ? $user->getFirstName() : '', 'last_name' => $user ? $user->getLastname() : '', 'city' => '', 'zip' => '', 'item_number' => 1); }
/** * Display reviewer index page. */ function index($args) { $this->validate(); $this->setupTemplate(); $journal =& Request::getJournal(); //%CBP% redirect or set var as appropriate $CBPPlatformDao =& DAORegistry::getDAO('CBPPlatformDAO'); $workshop = $CBPPlatformDao->getWorkshop($journal->getJournalId()); if ($workshop != "structured") { $workshop = 1; } if ($workshop == 1) { Request::redirect(Request::getRequestedJournalPath(), 'user'); } $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; } $sort = Request::getUserVar('sort'); $sort = isset($sort) ? $sort : 'title'; $sortDirection = Request::getUserVar('sortDirection'); if ($sort == 'decision') { $submissions = $reviewerSubmissionDao->getReviewerSubmissionsByReviewerId($user->getId(), $journal->getId(), $active, $rangeInfo); // Sort all submissions by status, which is too complex to do in the DB $submissionsArray = $submissions->toArray(); $compare = create_function('$s1, $s2', 'return strcmp($s1->getMostRecentDecision(), $s2->getMostRecentDecision());'); usort($submissionsArray, $compare); if ($sortDirection == SORT_DIRECTION_DESC) { $submissionsArray = array_reverse($submissionsArray); } // Convert submission array back to an ItemIterator class import('lib.pkp.classes.core.ArrayItemIterator'); $submissions =& ArrayItemIterator::fromRangeInfo($submissionsArray, $rangeInfo); } else { $submissions = $reviewerSubmissionDao->getReviewerSubmissionsByReviewerId($user->getId(), $journal->getId(), $active, $rangeInfo, $sort, $sortDirection); } $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions()); $templateMgr->assign('pageToDisplay', $page); $templateMgr->assign_by_ref('submissions', $submissions); import('classes.submission.reviewAssignment.ReviewAssignment'); $templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions()); import('classes.issue.IssueAction'); $issueAction = new IssueAction(); $templateMgr->register_function('print_issue_id', array($issueAction, 'smartyPrintIssueId')); $templateMgr->assign('helpTopicId', 'editorial.reviewersRole.submissions'); $templateMgr->assign('sort', $sort); $templateMgr->assign('sortDirection', $sortDirection); $templateMgr->display('reviewer/index.tpl'); }
/** * Constructor. * @param $article object * @param $comment object */ function EditCommentForm(&$article, &$comment) { parent::Form('submission/comment/editComment.tpl'); $this->addCheck(new FormValidatorPost($this)); $this->comment = $comment; $this->roleId = $comment->getRoleId(); $this->article = $article; $this->user =& Request::getUser(); }
/** * Constructor. * @param $handler Handler the associated form * @param $roles array of role id's * @param $all bool flag for whether all roles must exist or just 1 */ function HandlerValidatorSubmissionComment(&$handler, $commentId, &$user = null) { parent::HandlerValidator($handler); $this->commentId = $commentId; if ($user) { $this->user =& $user; } else { $this->user =& Request::getUser(); } }
/** * Register a new user. * @return userId int * @see Form::execute() */ function execute() { $user =& Request::getUser(); $noteDao =& DAORegistry::getDAO('NoteDAO'); $note = $noteDao->newDataObject(); $note->setUserId($user->getId()); $note->setContents($this->getData('newNote')); $note->setAssocType($this->getAssocType()); $note->setAssocId($this->getAssocId()); return $noteDao->insertObject($note); }
function getContents(&$templateMgr) { $user =& Request::getUser(); $journal =& Request::getJournal(); if ($user && $journal) { $userId = $user->getId(); $notificationDao =& DAORegistry::getDAO('NotificationDAO'); $templateMgr->assign('unreadNotifications', $notificationDao->getUnreadNotificationCount($userId)); } return parent::getContents($templateMgr); }
/** * Constructor. */ function MetadataForm($article, $journal) { $roleDao =& DAORegistry::getDAO('RoleDAO'); $signoffDao =& DAORegistry::getDAO('SignoffDAO'); $user =& Request::getUser(); $roleId = $roleDao->getRoleIdFromPath(Request::getRequestedPage()); // If the user is an editor of this article, make the entire form editable. $this->canEdit = false; $this->isEditor = false; if ($roleId != null && ($roleId == ROLE_ID_EDITOR || $roleId == ROLE_ID_SECTION_EDITOR)) { $this->canEdit = true; $this->isEditor = true; } $copyeditInitialSignoff = $signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $article->getId()); // If the user is an author and the article hasn't passed the Copyediting stage, make the form editable. if ($roleId == ROLE_ID_AUTHOR) { if ($article->getStatus() != STATUS_PUBLISHED && ($copyeditInitialSignoff == null || $copyeditInitialSignoff->getDateCompleted() == null)) { $this->canEdit = true; } } // Copy editors are also allowed to edit metadata, but only if they have // a current assignment to the article. if ($roleId != null && $roleId == ROLE_ID_COPYEDITOR) { $copyeditFinalSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $article->getId()); if ($copyeditFinalSignoff != null && $article->getStatus() != STATUS_PUBLISHED) { if ($copyeditInitialSignoff->getDateNotified() != null && $copyeditFinalSignoff->getDateCompleted() == null) { $this->canEdit = true; } } } if ($this->canEdit) { $supportedSubmissionLocales = $journal->getSetting('supportedSubmissionLocales'); if (empty($supportedSubmissionLocales)) { $supportedSubmissionLocales = array($journal->getPrimaryLocale()); } parent::Form('submission/metadata/metadataEdit.tpl', true, $article->getLocale(), array_flip(array_intersect(array_flip(AppLocale::getAllLocales()), $supportedSubmissionLocales))); $this->addCheck(new FormValidatorLocale($this, 'title', 'required', 'author.submit.form.titleRequired', $this->getRequiredLocale())); $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'))); // Add ORCiD validation import('lib.pkp.classes.validation.ValidatorORCID'); $this->addCheck(new FormValidatorArrayCustom($this, 'authors', 'required', 'user.profile.form.orcidInvalid', create_function('$orcid', '$validator = new ValidatorORCID(); return empty($orcid) ? true : $validator->isValid($orcid);'), array(), false, array('orcid'))); } else { parent::Form('submission/metadata/metadataView.tpl'); } // If the user is a reviewer of this article, do not show authors. $this->canViewAuthors = true; if ($roleId != null && $roleId == ROLE_ID_REVIEWER) { $this->canViewAuthors = false; } $this->article = $article; $this->addCheck(new FormValidatorPost($this)); }
/** * View peer review comments. */ function viewPeerReviewComments($args) { $paperId = $args[0]; $reviewId = $args[1]; $submissionReviewHandler = new SubmissionReviewHandler(); $submissionReviewHandler->validate($reviewId); $paperDao =& DAORegistry::getDAO('PaperDAO'); $submission =& $paperDao->getPaper($paperId); $user =& Request::getUser(); $this->setupTemplate(true); ReviewerAction::viewPeerReviewComments($user, $submission, $reviewId); }
function index($args) { import('classes.payment.ojs.OJSPaymentManager'); $paymentManager =& OJSPaymentManager::getManager(); $journal =& Request::getJournal(); if (!Validation::isLoggedIn()) { Validation::redirectLogin("payment.loginRequired.forDonation"); } $user =& Request::getUser(); $queuedPayment =& $paymentManager->createQueuedPayment($journal->getId(), PAYMENT_TYPE_DONATION, $user->getId(), 0, 0); $queuedPaymentId = $paymentManager->queuePayment($queuedPayment); $paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment); }
function displayPaymentForm($queuedPaymentId, &$queuedPayment) { if (!$this->isConfigured()) { return false; } $schedConf =& Request::getSchedConf(); $user =& Request::getUser(); $params = array('charset' => Config::getVar('i18n', 'client_charset'), '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(AppLocale::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(); $templateMgr->assign('params', $params); $templateMgr->assign('paypalFormUrl', $this->getSetting($schedConf->getConferenceId(), $schedConf->getId(), 'paypalurl')); $templateMgr->display($this->getTemplatePath() . 'paymentForm.tpl'); }
/** * Hook callback function */ function redirectRequest($hookName, $args) { $templateManager =& $args[0]; $template =& $args[1]; $page = Request::getRequestedPage(); $user = Request::getUser(); if (!$user || $user->getUsername() != 'administrator') { if ($page == 'user' || $page == 'about') { Request::redirectUrl('http://www.lltjournal.ca/index.php/llt'); } } return false; }
function displayPaymentForm($queuedPaymentId, &$queuedPayment) { if (!$this->isConfigured()) { return false; } $schedConf =& Request::getSchedConf(); $user =& Request::getUser(); $params = array('email_cobranca' => $schedConf->getSetting('contactEmail'), 'tipo' => 'CP', 'moeda' => $queuedPayment->getCurrencyCode(), 'item_id_1' => 'OCS-' . $schedConf->_data['path'], 'item_descr_1' => $queuedPayment->getDescription(), 'item_quant_1' => '1', 'item_valor_1' => $queuedPayment->getAmount() . '00', 'item_frete_1' => '000', 'valor' => $queuedPayment->getAmount()); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('params', $params); $templateMgr->assign('CreditFormUrl', $this->getSetting($schedConf->getConferenceId(), $schedConf->getSchedConfId(), 'crediturl')); $templateMgr->display($this->getTemplatePath() . 'paymentForm.tpl'); }