/** * Fetch the form. */ function fetch($request) { $templateMgr = TemplateManager::getManager($request); $journal = $request->getJournal(); // set up the accessibility options pulldown $templateMgr->assign('enableDelayedOpenAccess', $journal->getSetting('enableDelayedOpenAccess')); $templateMgr->assign('accessOptions', array(ISSUE_ACCESS_OPEN => AppLocale::Translate('editor.issues.openAccess'), ISSUE_ACCESS_SUBSCRIPTION => AppLocale::Translate('editor.issues.subscription'))); if ($this->issue) { $templateMgr->assign('issue', $this->issue); $templateMgr->assign('issueId', $this->issue->getId()); } // Cover image preview $coverImage = null; if ($this->issue) { $coverImage = $this->issue->getCoverImage(); } // Cover image delete link action if ($coverImage) { import('lib.pkp.classes.linkAction.LinkAction'); import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal'); $router = $request->getRouter(); $deleteCoverImageLinkAction = new LinkAction('deleteCoverImage', new RemoteActionConfirmationModal($request->getSession(), __('common.confirmDelete'), null, $router->url($request, null, null, 'deleteCoverImage', null, array('coverImage' => $coverImage, 'issueId' => $this->issue->getId())), 'modal_delete'), __('common.delete'), null); $templateMgr->assign('deleteCoverImageLinkAction', $deleteCoverImageLinkAction); } return parent::fetch($request); }
function sendReminder($subscription, $journal, $emailKey) { $userDao = DAORegistry::getDAO('UserDAO'); $subscriptionTypeDao = DAORegistry::getDAO('SubscriptionTypeDAO'); $journalName = $journal->getLocalizedName(); $user = $userDao->getById($subscription->getUserId()); if (!isset($user)) { return false; } $subscriptionType = $subscriptionTypeDao->getSubscriptionType($subscription->getTypeId()); $subscriptionName = $journal->getSetting('subscriptionName'); $subscriptionEmail = $journal->getSetting('subscriptionEmail'); $subscriptionPhone = $journal->getSetting('subscriptionPhone'); $subscriptionMailingAddress = $journal->getSetting('subscriptionMailingAddress'); $subscriptionContactSignature = $subscriptionName; AppLocale::requireComponents(LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_APP_COMMON); if ($subscriptionMailingAddress != '') { $subscriptionContactSignature .= "\n" . $subscriptionMailingAddress; } if ($subscriptionPhone != '') { $subscriptionContactSignature .= "\n" . AppLocale::Translate('user.phone') . ': ' . $subscriptionPhone; } $subscriptionContactSignature .= "\n" . AppLocale::Translate('user.email') . ': ' . $subscriptionEmail; $paramArray = array('subscriberName' => $user->getFullName(), 'journalName' => $journalName, 'subscriptionType' => $subscriptionType->getSummaryString(), 'expiryDate' => $subscription->getDateEnd(), 'username' => $user->getUsername(), 'subscriptionContactSignature' => $subscriptionContactSignature); import('lib.pkp.classes.mail.MailTemplate'); $mail = new MailTemplate($emailKey, $journal->getPrimaryLocale(), $journal, false); $mail->setReplyTo($subscriptionEmail, $subscriptionName); $mail->addRecipient($user->getEmail(), $user->getFullName()); $mail->setSubject($mail->getSubject($journal->getPrimaryLocale())); $mail->setBody($mail->getBody($journal->getPrimaryLocale())); $mail->assignParams($paramArray); $mail->send(); }
/** * Display the form. */ function display() { $templateMgr =& TemplateManager::getManager(); $journal =& Request::getJournal(); // set up the accessibility options pulldown $templateMgr->assign('enableDelayedOpenAccess', $journal->getSetting('enableDelayedOpenAccess')); $templateMgr->assign('accessOptions', array(ISSUE_ACCESS_OPEN => AppLocale::Translate('editor.issues.openAccess'), ISSUE_ACCESS_SUBSCRIPTION => AppLocale::Translate('editor.issues.subscription'))); $templateMgr->assign('enablePublicIssueId', $journal->getSetting('enablePublicIssueId')); parent::display(); }
/** * Display the form. */ function display() { $templateMgr =& TemplateManager::getManager(); $journal =& Request::getJournal(); // set up the accessibility options pulldown $templateMgr->assign('enableDelayedOpenAccess', $journal->getSetting('enableDelayedOpenAccess')); $templateMgr->assign('accessOptions', array(ISSUE_ACCESS_OPEN => AppLocale::Translate('editor.issues.openAccess'), ISSUE_ACCESS_SUBSCRIPTION => AppLocale::Translate('editor.issues.subscription'))); $templateMgr->assign('enablePublicIssueId', $journal->getSetting('enablePublicIssueId')); // consider public identifiers $pubIdPlugins =& PluginRegistry::loadCategory('pubIds', true); $templateMgr->assign('pubIdPlugins', $pubIdPlugins); parent::display(); }
/** * Fetch the form. */ function fetch($request) { $templateMgr = TemplateManager::getManager($request); $journal = $request->getJournal(); // set up the accessibility options pulldown $templateMgr->assign('enableDelayedOpenAccess', $journal->getSetting('enableDelayedOpenAccess')); $templateMgr->assign('accessOptions', array(ISSUE_ACCESS_OPEN => AppLocale::Translate('editor.issues.openAccess'), ISSUE_ACCESS_SUBSCRIPTION => AppLocale::Translate('editor.issues.subscription'))); if ($this->issue) { $templateMgr->assign('issue', $this->issue); $templateMgr->assign('issueId', $this->issue->getId()); } return parent::fetch($request); }
/** * Fetch the form. */ function fetch($request) { $templateMgr = TemplateManager::getManager($request); $journal = $request->getJournal(); // set up the accessibility options pulldown $templateMgr->assign('enableDelayedOpenAccess', $journal->getSetting('enableDelayedOpenAccess')); $templateMgr->assign('accessOptions', array(ISSUE_ACCESS_OPEN => AppLocale::Translate('editor.issues.openAccess'), ISSUE_ACCESS_SUBSCRIPTION => AppLocale::Translate('editor.issues.subscription'))); $templateMgr->assign('enablePublicIssueId', $journal->getSetting('enablePublicIssueId')); if ($this->issue) { $templateMgr->assign('issue', $this->issue); $templateMgr->assign('issueId', $this->issue->getId()); } // consider public identifiers $templateMgr->assign('pubIdPlugins', PluginRegistry::loadCategory('pubIds', true)); return parent::fetch($request); }
/** * Show advanced search form. */ function advanced() { parent::validate(); SearchHandler::setupTemplate(false); $templateMgr =& TemplateManager::getManager(); $publishedPaperDao =& DAORegistry::getDAO('PublishedPaperDAO'); if (Request::getConference() == null) { $conferenceDao =& DAORegistry::getDAO('ConferenceDAO'); $conferences =& $conferenceDao->getEnabledConferenceTitles(); //Enabled added $templateMgr->assign('siteSearch', true); $templateMgr->assign('conferenceOptions', array('' => AppLocale::Translate('search.allConferences')) + $conferences); $yearRange = $publishedPaperDao->getPaperYearRange(null); } else { $conference =& Request::getConference(); $yearRange = $publishedPaperDao->getPaperYearRange($conference->getId()); } SearchHandler::assignAdvancedSearchParameters($templateMgr, $yearRange); $templateMgr->display('search/advancedSearch.tpl'); }
/** * Show advanced search form. * @param $args array * @param $request PKPRequest */ function advanced($args, &$request) { parent::validate(); $this->setupTemplate($request, false); $templateMgr =& TemplateManager::getManager($request); $publishedPaperDao = DAORegistry::getDAO('PublishedPaperDAO'); if ($request->getConference() == null) { $conferenceDao = DAORegistry::getDAO('ConferenceDAO'); $conferences =& $conferenceDao->getNames(true); // Enabled added $templateMgr->assign('siteSearch', true); $templateMgr->assign('conferenceOptions', array('' => AppLocale::Translate('search.allConferences')) + $conferences); $yearRange = $publishedPaperDao->getPaperYearRange(null); } else { $conference =& $request->getConference(); $yearRange = $publishedPaperDao->getPaperYearRange($conference->getId()); } $this->_assignAdvancedSearchParameters($request, $templateMgr, $yearRange); $templateMgr->display('search/advancedSearch.tpl'); }
/** * Show advanced search form. * @param $args array * @param $request PKPRequest */ function advanced($args, &$request) { $this->validate(); $this->setupTemplate($request, false); $templateMgr =& TemplateManager::getManager(); $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $journal =& $request->getJournal(); if (!$journal) { $journalDao =& DAORegistry::getDAO('JournalDAO'); $journals =& $journalDao->getJournalTitles(true); $templateMgr->assign('siteSearch', true); $templateMgr->assign('journalOptions', array('' => AppLocale::Translate('search.allJournals')) + $journals); $journalPath = $request->getRequestedJournalPath(); $yearRange = $publishedArticleDao->getArticleYearRange(null); } else { $yearRange = $publishedArticleDao->getArticleYearRange($journal->getId()); } $this->_assignAdvancedSearchParameters($request, $templateMgr, $yearRange); $templateMgr->display('search/advancedSearch.tpl'); }
function sendReminder($registration, $conference, $schedConf, $emailKey) { $userDao =& DAORegistry::getDAO('UserDAO'); $registrationTypeDao =& DAORegistry::getDAO('RegistrationTypeDAO'); $schedConfName = $schedConf->getSchedConfTitle(); $schedConfId = $schedConf->getId(); $user =& $userDao->getUser($registration->getUserId()); if (!isset($user)) { return false; } $registrationType =& $registrationTypeDao->getRegistrationType($registration->getTypeId()); $registrationName = $schedConf->getSetting('registrationName'); $registrationEmail = $schedConf->getSetting('registrationEmail'); $registrationPhone = $schedConf->getSetting('registrationPhone'); $registrationFax = $schedConf->getSetting('registrationFax'); $registrationMailingAddress = $schedConf->getSetting('registrationMailingAddress'); $registrationContactSignature = $registrationName; if ($registrationMailingAddress != '') { $registrationContactSignature .= "\n" . $registrationMailingAddress; } if ($registrationPhone != '') { $registrationContactSignature .= "\n" . AppLocale::Translate('user.phone') . ': ' . $registrationPhone; } if ($registrationFax != '') { $registrationContactSignature .= "\n" . AppLocale::Translate('user.fax') . ': ' . $registrationFax; } $registrationContactSignature .= "\n" . AppLocale::Translate('user.email') . ': ' . $registrationEmail; $paramArray = array('registrantName' => $user->getFullName(), 'conferenceName' => $conferenceName, 'schedConfName' => $schedConfName, 'registrationType' => $registrationType->getSummaryString(), 'expiryDate' => $registration->getDateEnd(), 'username' => $user->getUsername(), 'registrationContactSignature' => $registrationContactSignature); import('mail.MailTemplate'); $mail = new MailTemplate($emailKey, $conference->getPrimaryLocale()); $mail->setFrom($registrationEmail, $registrationName); $mail->addRecipient($user->getEmail(), $user->getFullName()); $mail->setSubject($mail->getSubject($conference->getPrimaryLocale())); $mail->setBody($mail->getBody($conference->getPrimaryLocale())); $mail->assignParams($paramArray); $mail->send(); }
/** * Setup common template variables. * @param $subclass boolean set to true if caller is below this handler in the hierarchy */ function setupTemplate($subclass = false) { $templateMgr =& TemplateManager::getManager(); $pageCrumbs = array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, 'editor'), 'user.role.editor')); if ($subclass) { $returnPage = Request::getUserVar('returnPage'); if ($returnPage != null) { $validPages =& $this->getValidReturnPages(); if (!in_array($returnPage, $validPages)) { $returnPage = null; } } $pageCrumbs[] = array(Request::url(null, 'editor', 'booksForReview', $returnPage), AppLocale::Translate('plugins.generic.booksForReview.displayName'), true); } $templateMgr->assign('pageHierarchy', $pageCrumbs); $bfrPlugin =& PluginRegistry::getPlugin('generic', BOOKS_FOR_REVIEW_PLUGIN_NAME); $templateMgr->addStyleSheet(Request::getBaseUrl() . '/' . $bfrPlugin->getStyleSheet()); }
/** * Get registration type duration in years and months. * @return string */ function getDurationYearsMonths() { $years = (int) floor($this->getData('duration') / 12); $months = (int) fmod($this->getData('duration'), 12); $yearsMonths = ''; if ($years == 1) { $yearsMonths = '1 ' . AppLocale::Translate('manager.registrationTypes.year'); } elseif ($years > 1) { $yearsMonths = $years . ' ' . AppLocale::Translate('manager.registrationTypes.years'); } if ($months == 1) { $yearsMonths .= $yearsMonths == '' ? '1 ' : ' 1 '; $yearsMonths .= AppLocale::Translate('manager.registrationTypes.month'); } elseif ($months > 1) { $yearsMonths .= $yearsMonths == '' ? $months . ' ' : ' ' . $months . ' '; $yearsMonths .= AppLocale::Translate('manager.registrationTypes.months'); } return $yearsMonths; }
/** * Display the form. */ function display() { $journal =& Request::getJournal(); $settingsDao =& DAORegistry::getDAO('JournalSettingsDAO'); $roleDao =& DAORegistry::getDAO('RoleDAO'); $sectionDao =& DAORegistry::getDAO('SectionDAO'); AppLocale::requireComponents(LOCALE_COMPONENT_OJS_EDITOR); // editor.cover.xxx locale keys; FIXME? $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('articleId', isset($this->article) ? $this->article->getId() : null); $templateMgr->assign('journalSettings', $settingsDao->getJournalSettings($journal->getId())); $templateMgr->assign('rolePath', Request::getRequestedPage()); $templateMgr->assign('canViewAuthors', $this->canViewAuthors); $countryDao =& DAORegistry::getDAO('CountryDAO'); $templateMgr->assign('countries', $countryDao->getCountries()); $templateMgr->assign('helpTopicId', 'submission.indexingAndMetadata'); if ($this->article) { $templateMgr->assign_by_ref('section', $sectionDao->getSection($this->article->getSectionId())); } if ($this->isEditor) { import('classes.article.Article'); $hideAuthorOptions = array(AUTHOR_TOC_DEFAULT => AppLocale::Translate('editor.article.hideTocAuthorDefault'), AUTHOR_TOC_HIDE => AppLocale::Translate('editor.article.hideTocAuthorHide'), AUTHOR_TOC_SHOW => AppLocale::Translate('editor.article.hideTocAuthorShow')); $templateMgr->assign('hideAuthorOptions', $hideAuthorOptions); $templateMgr->assign('isEditor', true); } // consider public identifiers $pubIdPlugins =& PluginRegistry::loadCategory('pubIds', true); $templateMgr->assign('pubIdPlugins', $pubIdPlugins); $templateMgr->assign_by_ref('article', $this->article); parent::display(); }
/** * Display the table of contents */ function issueToc($args, $request) { $issueId = (int) array_shift($args); $this->validate($issueId, true); $issue =& $this->issue; $this->setupTemplate(EDITOR_SECTION_ISSUES); $templateMgr =& TemplateManager::getManager(); $journal =& $request->getJournal(); $journalId = $journal->getId(); $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO'); $sectionDao =& DAORegistry::getDAO('SectionDAO'); $enablePublicArticleId = $journalSettingsDao->getSetting($journalId, 'enablePublicArticleId'); $templateMgr->assign('enablePublicArticleId', $enablePublicArticleId); $enablePageNumber = $journalSettingsDao->getSetting($journalId, 'enablePageNumber'); $templateMgr->assign('enablePageNumber', $enablePageNumber); $templateMgr->assign('customSectionOrderingExists', $customSectionOrderingExists = $sectionDao->customSectionOrderingExists($issueId)); $templateMgr->assign('issueId', $issueId); $templateMgr->assign_by_ref('issue', $issue); $templateMgr->assign('unpublished', !$issue->getPublished()); $templateMgr->assign('issueAccess', $issue->getAccessStatus()); // get issue sections and articles $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $publishedArticles = $publishedArticleDao->getPublishedArticles($issueId); $layoutEditorSubmissionDao =& DAORegistry::getDAO('LayoutEditorSubmissionDAO'); $proofedArticleIds = $layoutEditorSubmissionDao->getProofedArticlesByIssueId($issueId); $templateMgr->assign('proofedArticleIds', $proofedArticleIds); $currSection = 0; $counter = 0; $sections = array(); $sectionCount = 0; $sectionDao =& DAORegistry::getDAO('SectionDAO'); foreach ($publishedArticles as $article) { $sectionId = $article->getSectionId(); if ($currSection != $sectionId) { $lastSectionId = $currSection; $sectionCount++; if ($lastSectionId !== 0) { $sections[$lastSectionId][5] = $customSectionOrderingExists ? $sectionDao->getCustomSectionOrder($issueId, $sectionId) : $sectionCount; } // Store next custom order $currSection = $sectionId; $counter++; $sections[$sectionId] = array($sectionId, $article->getSectionTitle(), array($article), $counter, $customSectionOrderingExists ? $sectionDao->getCustomSectionOrder($issueId, $lastSectionId) : $sectionCount - 1, null); } else { $sections[$article->getSectionId()][2][] = $article; } } $templateMgr->assign_by_ref('sections', $sections); $templateMgr->assign('accessOptions', array(ARTICLE_ACCESS_ISSUE_DEFAULT => AppLocale::Translate('editor.issues.default'), ARTICLE_ACCESS_OPEN => AppLocale::Translate('editor.issues.open'))); import('classes.issue.IssueAction'); $templateMgr->assign('issueOptions', IssueAction::getIssueOptions()); $templateMgr->assign('helpTopicId', 'publishing.tableOfContents'); $templateMgr->addJavaScript('lib/pkp/js/lib/jquery/plugins/jquery.tablednd.js'); $templateMgr->addJavaScript('lib/pkp/js/functions/tablednd.js'); $templateMgr->display('editor/issues/issueToc.tpl'); }
/** * Display director submission queue pages. */ function submissions($args) { $this->validate(); $this->setupTemplate(DIRECTOR_TRACK_SUBMISSIONS); $schedConf =& Request::getSchedConf(); $schedConfId = $schedConf->getId(); $user =& Request::getUser(); $directorSubmissionDao =& DAORegistry::getDAO('DirectorSubmissionDAO'); $trackDao =& DAORegistry::getDAO('TrackDAO'); $page = isset($args[0]) ? $args[0] : ''; $tracks =& $trackDao->getTrackTitles($schedConfId); $filterDirectorOptions = array(FILTER_DIRECTOR_ALL => AppLocale::Translate('director.allDirectors'), FILTER_DIRECTOR_ME => AppLocale::Translate('director.me')); $filterTrackOptions = array(FILTER_TRACK_ALL => AppLocale::Translate('director.allTracks')) + $tracks; // Get the user's search conditions, if any $searchField = Request::getUserVar('searchField'); $searchMatch = Request::getUserVar('searchMatch'); $search = Request::getUserVar('search'); $sort = Request::getUserVar('sort'); $sortDirection = Request::getUserVar('sortDirection'); switch ($page) { case 'submissionsUnassigned': $functionName = 'getDirectorSubmissionsUnassigned'; $helpTopicId = 'editorial.directorsRole.submissions.unassigned'; $sort = isset($sort) ? $sort : 'id'; break; case 'submissionsAccepted': $functionName = 'getDirectorSubmissionsAccepted'; $helpTopicId = 'editorial.directorsRole.submissions.presentations'; $sort = isset($sort) ? $sort : 'seq'; break; case 'submissionsArchives': $functionName = 'getDirectorSubmissionsArchives'; $helpTopicId = 'editorial.directorsRole.submissions.archives'; $sort = isset($sort) ? $sort : 'id'; break; default: $page = 'submissionsInReview'; $functionName = 'getDirectorSubmissionsInReview'; $helpTopicId = 'editorial.directorsRole.submissions.inReview'; $sort = isset($sort) ? $sort : 'id'; } $filterDirector = Request::getUserVar('filterDirector'); if ($filterDirector != '' && array_key_exists($filterDirector, $filterDirectorOptions)) { $user->updateSetting('filterDirector', $filterDirector, 'int', $schedConfId); } else { $filterDirector = $user->getSetting('filterDirector', $schedConfId); if ($filterDirector == null) { $filterDirector = FILTER_DIRECTOR_ALL; $user->updateSetting('filterDirector', $filterDirector, 'int', $schedConfId); } } if ($filterDirector == FILTER_DIRECTOR_ME) { $directorId = $user->getId(); } else { $directorId = FILTER_DIRECTOR_ALL; } $filterTrack = Request::getUserVar('filterTrack'); if ($filterTrack != '' && array_key_exists($filterTrack, $filterTrackOptions)) { $user->updateSetting('filterTrack', $filterTrack, 'int', $schedConfId); } else { $filterTrack = $user->getSetting('filterTrack', $schedConfId); if ($filterTrack == null) { $filterTrack = FILTER_TRACK_ALL; $user->updateSetting('filterTrack', $filterTrack, 'int', $schedConfId); } } $rangeInfo =& Handler::getRangeInfo('submissions', array($functionName, (string) $searchField, (string) $searchMatch, (string) $search)); while (true) { $submissions =& $directorSubmissionDao->{$functionName}($schedConfId, $filterTrack, $directorId, $searchField, $searchMatch, $search, null, null, null, $rangeInfo, $sort, $sortDirection); if ($submissions->isInBounds()) { break; } unset($rangeInfo); $rangeInfo =& $submissions->getLastPageRangeInfo(); unset($submissions); } if ($sort == 'status') { // 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->getSubmissionStatus(), $s2->getSubmissionStatus());'); usort($submissionsArray, $compare); if ($sortDirection == 'DESC') { $submissionsArray = array_reverse($submissionsArray); } // Convert submission array back to an ItemIterator class import('core.ArrayItemIterator'); $submissions =& ArrayItemIterator::fromRangeInfo($submissionsArray, $rangeInfo); } $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('pageToDisplay', $page); $templateMgr->assign('director', $user->getFullName()); $templateMgr->assign('directorOptions', $filterDirectorOptions); $templateMgr->assign('trackOptions', $filterTrackOptions); $templateMgr->assign_by_ref('submissions', $submissions); $templateMgr->assign('filterDirector', $filterDirector); $templateMgr->assign('filterTrack', $filterTrack); $templateMgr->assign('yearOffsetFuture', SCHED_CONF_DATE_YEAR_OFFSET_FUTURE); $templateMgr->assign('durationOptions', TrackDirectorHandler::getDurationOptions()); // Set search parameters $duplicateParameters = array('searchField', 'searchMatch', 'search'); foreach ($duplicateParameters as $param) { $templateMgr->assign($param, Request::getUserVar($param)); } $templateMgr->assign('reviewType', array(REVIEW_STAGE_ABSTRACT => __('submission.abstract'), REVIEW_STAGE_PRESENTATION => __('submission.paper'))); $templateMgr->assign('fieldOptions', array(SUBMISSION_FIELD_TITLE => 'paper.title', SUBMISSION_FIELD_AUTHOR => 'user.role.author', SUBMISSION_FIELD_DIRECTOR => 'user.role.director', SUBMISSION_FIELD_REVIEWER => 'user.role.reviewer')); $templateMgr->assign('helpTopicId', $helpTopicId); $templateMgr->assign('sort', $sort); $templateMgr->assign('sortDirection', $sortDirection); $templateMgr->display('director/submissions.tpl'); }
/** * Setup common template variables. * @param $request PKPRequest * @param $subclass boolean (optional) set to true if caller is below this handler in the hierarchy * @param $objectId int (optional) */ function setupTemplate(&$request, $subclass = false, $objectId = null) { $templateMgr =& TemplateManager::getManager($request); $pageCrumbs = array(array($request->url(null, 'user'), 'navigation.user'), array($request->url(null, 'editor'), 'user.role.editor')); if ($subclass) { $returnPage = $request->getUserVar('returnPage'); if ($returnPage != null) { $validPages =& $this->getValidReturnPages(); if (!in_array($returnPage, $validPages)) { $returnPage = null; } } $pageCrumbs[] = array($request->url(null, 'editor', 'objectsForReview', $returnPage), AppLocale::Translate('plugins.generic.objectsForReview.displayName'), true); } if ($objectId) { $pageCrumbs[] = array($request->url(null, 'editor', 'objectsForReview', $objectId), $reviewObjectType->getLocalizedName(), true); } $templateMgr->assign('pageHierarchy', $pageCrumbs); $ofrPlugin =& $this->_getObjectsForReviewPlugin(); $templateMgr->addStyleSheet(Request::getBaseUrl() . '/' . $ofrPlugin->getStyleSheet()); }
/** * Display section editor index page. * @param $args array * @param $request PKPRequest */ function index($args, &$request) { $this->validate(); $this->setupTemplate(); $journal =& $request->getJournal(); $journalId = $journal->getId(); $user =& $request->getUser(); $rangeInfo = $this->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->getId()); $sort = $request->getUserVar('sort'); $sort = isset($sort) ? $sort : 'id'; $sortDirection = $request->getUserVar('sortDirection'); $filterSectionOptions = array(FILTER_SECTION_ALL => AppLocale::Translate('editor.allSections')) + $sections; 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'; } $filterSection = $request->getUserVar('filterSection'); if ($filterSection != '' && array_key_exists($filterSection, $filterSectionOptions)) { $user->updateSetting('filterSection', $filterSection, 'int', $journalId); } else { $filterSection = $user->getSetting('filterSection', $journalId); if ($filterSection == null) { $filterSection = FILTER_SECTION_ALL; $user->updateSetting('filterSection', $filterSection, 'int', $journalId); } } $submissions =& $sectionEditorSubmissionDao->{$functionName}($user->getId(), $journal->getId(), $filterSection, $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $rangeInfo, $sort, $sortDirection); // If only result is returned from a search, fast-forward to it if ($search && $submissions && $submissions->getCount() == 1) { $submission =& $submissions->next(); $request->redirect(null, null, 'submission', array($submission->getId())); } $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('helpTopicId', $helpTopicId); $templateMgr->assign('sectionOptions', $filterSectionOptions); $templateMgr->assign_by_ref('submissions', $submissions); $templateMgr->assign('filterSection', $filterSection); $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_ID => 'article.submissionId', 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('classes.issue.IssueAction'); $issueAction = new IssueAction(); $templateMgr->register_function('print_issue_id', array($issueAction, 'smartyPrintIssueId')); $templateMgr->assign('sort', $sort); $templateMgr->assign('sortDirection', $sortDirection); $templateMgr->display('sectionEditor/index.tpl'); }
/** * Display editor submission queue pages. */ function submissions($args, $request) { $this->validate(); $this->setupTemplate(EDITOR_SECTION_SUBMISSIONS); $journal =& $request->getJournal(); $journalId = $journal->getId(); $user =& $request->getUser(); $editorSubmissionDao =& DAORegistry::getDAO('EditorSubmissionDAO'); $sectionDao =& DAORegistry::getDAO('SectionDAO'); $page = isset($args[0]) ? $args[0] : ''; $sections =& $sectionDao->getSectionTitles($journalId); $sort = $request->getUserVar('sort'); $sort = isset($sort) ? $sort : 'id'; $sortDirection = $request->getUserVar('sortDirection'); $sortDirection = isset($sortDirection) && ($sortDirection == 'ASC' || $sortDirection == 'DESC') ? $sortDirection : 'ASC'; $filterEditorOptions = array(FILTER_EDITOR_ALL => AppLocale::Translate('editor.allEditors'), FILTER_EDITOR_ME => AppLocale::Translate('editor.me')); $filterSectionOptions = array(FILTER_SECTION_ALL => AppLocale::Translate('editor.allSections')) + $sections; // 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 = $this->getRangeInfo('submissions'); switch ($page) { case 'submissionsUnassigned': $functionName = 'getEditorSubmissionsUnassigned'; $helpTopicId = 'editorial.editorsRole.submissions.unassigned'; break; case 'submissionsInEditing': $functionName = 'getEditorSubmissionsInEditing'; $helpTopicId = 'editorial.editorsRole.submissions.inEditing'; break; case 'submissionsArchives': $functionName = 'getEditorSubmissionsArchives'; $helpTopicId = 'editorial.editorsRole.submissions.archives'; break; default: $page = 'submissionsInReview'; $functionName = 'getEditorSubmissionsInReview'; $helpTopicId = 'editorial.editorsRole.submissions.inReview'; } $filterEditor = $request->getUserVar('filterEditor'); if ($filterEditor != '' && array_key_exists($filterEditor, $filterEditorOptions)) { $user->updateSetting('filterEditor', $filterEditor, 'int', $journalId); } else { $filterEditor = $user->getSetting('filterEditor', $journalId); if ($filterEditor == null) { $filterEditor = FILTER_EDITOR_ALL; $user->updateSetting('filterEditor', $filterEditor, 'int', $journalId); } } if ($filterEditor == FILTER_EDITOR_ME) { $editorId = $user->getId(); } else { $editorId = FILTER_EDITOR_ALL; } $filterSection = $request->getUserVar('filterSection'); if ($filterSection != '' && array_key_exists($filterSection, $filterSectionOptions)) { $user->updateSetting('filterSection', $filterSection, 'int', $journalId); } else { $filterSection = $user->getSetting('filterSection', $journalId); if ($filterSection == null) { $filterSection = FILTER_SECTION_ALL; $user->updateSetting('filterSection', $filterSection, 'int', $journalId); } } $submissions =& $editorSubmissionDao->{$functionName}($journalId, $filterSection, $editorId, $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $rangeInfo, $sort, $sortDirection); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('pageToDisplay', $page); $templateMgr->assign('editor', $user->getFullName()); $templateMgr->assign('editorOptions', $filterEditorOptions); $templateMgr->assign('sectionOptions', $filterSectionOptions); $templateMgr->assign_by_ref('submissions', $submissions); $templateMgr->assign('filterEditor', $filterEditor); $templateMgr->assign('filterSection', $filterSection); // Set search parameters foreach ($this->_getSearchFormDuplicateParameters() as $param) { $templateMgr->assign($param, $request->getUserVar($param)); } $templateMgr->assign('dateFrom', $fromDate); $templateMgr->assign('dateTo', $toDate); $templateMgr->assign('fieldOptions', $this->_getSearchFieldOptions()); $templateMgr->assign('dateFieldOptions', $this->_getDateFieldOptions()); import('classes.issue.IssueAction'); $issueAction = new IssueAction(); $templateMgr->register_function('print_issue_id', array($issueAction, 'smartyPrintIssueId')); $templateMgr->assign('helpTopicId', $helpTopicId); $templateMgr->assign('sort', $sort); $templateMgr->assign('sortDirection', $sortDirection); $templateMgr->display('editor/submissions.tpl'); }
/** * Setup common template variables. * @param $request PKPRequest * @param $subclass boolean (optional) set to true if caller is below this handler in the hierarchy * @param $reviewObjectType ReviewObjectType (optional) */ function setupTemplate(&$request, $subclass = false, $reviewObjectType = null) { $templateMgr =& TemplateManager::getManager($request); $pageCrumbs = array(array($request->url(null, 'user'), 'navigation.user'), array($request->url(null, 'editor'), 'user.role.editor')); if ($subclass) { $pageCrumbs[] = array($request->url(null, 'editor', 'reviewObjectTypes'), AppLocale::Translate('plugins.generic.objectsForReview.editor.objectTypes'), true); } if ($reviewObjectType) { $pageCrumbs[] = array($request->url(null, 'editor', 'editReviewObjectType', $reviewObjectType->getId()), $reviewObjectType->getLocalizedName(), true); } $templateMgr->assign('pageHierarchy', $pageCrumbs); $plugin =& $this->_getObjectsForReviewPlugin(); $templateMgr->addStyleSheet($request->getBaseUrl() . '/' . $plugin->getStyleSheet()); }
/** * Display books for review listing pages. */ function booksForReview($args, $request) { $this->setupTemplate($request); $journal = $request->getJournal(); $journalId = $journal->getId(); $bfrPlugin = PluginRegistry::getPlugin('generic', BOOKS_FOR_REVIEW_PLUGIN_NAME); $mode = $bfrPlugin->getSetting($journalId, 'mode'); $bfrPlugin->import('classes.BookForReview'); $searchField = null; $searchMatch = null; $search = $request->getUserVar('search'); if (!empty($search)) { $searchField = $request->getUserVar('searchField'); $searchMatch = $request->getUserVar('searchMatch'); } $path = !isset($args) || empty($args) ? null : $args[0]; switch ($path) { case 'available': $status = BFR_STATUS_AVAILABLE; $template = 'booksForReviewAvailable.tpl'; break; case 'requested': $status = BFR_STATUS_REQUESTED; $template = 'booksForReviewRequested.tpl'; break; case 'assigned': $status = BFR_STATUS_ASSIGNED; $template = 'booksForReviewAssigned.tpl'; break; case 'mailed': $status = BFR_STATUS_MAILED; $template = 'booksForReviewMailed.tpl'; break; case 'submitted': $status = BFR_STATUS_SUBMITTED; $template = 'booksForReviewSubmitted.tpl'; break; default: $path = ''; $status = null; $template = 'booksForReviewAll.tpl'; } import('pages.editor.EditorHandler'); $user = $request->getUser(); $filterEditorOptions = array(FILTER_EDITOR_ALL => AppLocale::Translate('editor.allEditors'), FILTER_EDITOR_ME => AppLocale::Translate('editor.me')); $filterEditor = $request->getUserVar('filterEditor'); if ($filterEditor != '' && array_key_exists($filterEditor, $filterEditorOptions)) { $user->updateSetting('filterEditor', $filterEditor, 'int', $journalId); } else { $filterEditor = $user->getSetting('filterEditor', $journalId); if ($filterEditor == null) { $filterEditor = FILTER_EDITOR_ALL; $user->updateSetting('filterEditor', $filterEditor, 'int', $journalId); } } if ($filterEditor == FILTER_EDITOR_ME) { $editorId = $user->getId(); } else { $editorId = null; } $rangeInfo = $this->getRangeInfo($request, 'booksForReview'); $bfrDao = DAORegistry::getDAO('BookForReviewDAO'); $booksForReview =& $bfrDao->getBooksForReviewByJournalId($journalId, $searchField, $search, $searchMatch, $status, null, $editorId, $rangeInfo); $templateMgr = TemplateManager::getManager($request); $templateMgr->assign('mode', $mode); $templateMgr->assign('booksForReview', $booksForReview); $templateMgr->assign('filterEditor', $filterEditor); $templateMgr->assign('returnPage', $path); // Set search parameters $duplicateParameters = array('searchField', 'searchMatch', 'search'); foreach ($duplicateParameters as $param) { $templateMgr->assign($param, $request->getUserVar($param)); } $fieldOptions = array(BFR_FIELD_TITLE => 'plugins.generic.booksForReview.field.title', BFR_FIELD_PUBLISHER => 'plugins.generic.booksForReview.field.publisher', BFR_FIELD_YEAR => 'plugins.generic.booksForReview.field.year', BFR_FIELD_ISBN => 'plugins.generic.booksForReview.field.isbn', BFR_FIELD_DESCRIPTION => 'plugins.generic.booksForReview.field.description'); $templateMgr->assign('fieldOptions', $fieldOptions); $templateMgr->assign('editorOptions', $filterEditorOptions); $templateMgr->assign('counts', $bfrDao->getStatusCounts($journalId)); $templateMgr->display($bfrPlugin->getTemplatePath() . 'editor' . '/' . $template); }
/** * Save thesis. */ function execute() { $thesisPlugin =& PluginRegistry::getPlugin('generic', $this->parentPluginName); $thesisPlugin->import('Thesis'); $thesisDao =& DAORegistry::getDAO('ThesisDAO'); $journal =& Request::getJournal(); $journalId = $journal->getId(); $thesis = new Thesis(); $thesis->setJournalId($journalId); $thesis->setStatus(THESIS_STATUS_INACTIVE); $thesis->setDegree($this->getData('degree')); $thesis->setDegreeName($this->getData('degreeName')); $thesis->setDepartment($this->getData('department')); $thesis->setUniversity($this->getData('university')); $thesis->setTitle($this->getData('title')); $thesis->setDateApproved($this->getData('dateApprovedYear') . '-' . $this->getData('dateApprovedMonth') . '-' . $this->getData('dateApprovedDay')); $thesis->setUrl($this->getData('url')); $thesis->setAbstract($this->getData('abstract')); $thesis->setComment($this->getData('comment')); $thesis->setStudentFirstName($this->getData('studentFirstName')); $thesis->setStudentMiddleName($this->getData('studentMiddleName')); $thesis->setStudentLastName($this->getData('studentLastName')); $thesis->setStudentEmail($this->getData('studentEmail')); $thesis->setStudentEmailPublish($this->getData('studentEmailPublish') == null ? 0 : 1); $thesis->setStudentBio($this->getData('studentBio')); $thesis->setSupervisorFirstName($this->getData('supervisorFirstName')); $thesis->setSupervisorMiddleName($this->getData('supervisorMiddleName')); $thesis->setSupervisorLastName($this->getData('supervisorLastName')); $thesis->setSupervisorEmail($this->getData('supervisorEmail')); $thesis->setDiscipline($this->getData('discipline')); $thesis->setSubjectClass($this->getData('subjectClass')); $thesis->setSubject($this->getData('keyword')); $thesis->setCoverageGeo($this->getData('coverageGeo')); $thesis->setCoverageChron($this->getData('coverageChron')); $thesis->setCoverageSample($this->getData('coverageSample')); $thesis->setMethod($this->getData('method')); $thesis->setLanguage($this->getData('language')); $thesis->setDateSubmitted(Core::getCurrentDate()); $thesisDao->insertThesis($thesis); // Send supervisor confirmation email if (!empty($this->uploadCodeEnabled)) { $uploadCode = $thesisPlugin->getSetting($journalId, 'uploadCode'); $submittedUploadCode = $this->getData('uploadCode'); } if (empty($uploadCode) || $uploadCode != $submittedUploadCode) { $journalName = $journal->getLocalizedTitle(); $thesisName = $thesisPlugin->getSetting($journalId, 'thesisName'); $thesisEmail = $thesisPlugin->getSetting($journalId, 'thesisEmail'); $thesisPhone = $thesisPlugin->getSetting($journalId, 'thesisPhone'); $thesisFax = $thesisPlugin->getSetting($journalId, 'thesisFax'); $thesisMailingAddress = $thesisPlugin->getSetting($journalId, 'thesisMailingAddress'); $thesisContactSignature = $thesisName; if (!empty($thesisMailingAddress)) { $thesisContactSignature .= "\n" . $thesisMailingAddress; } if (!empty($thesisPhone)) { $thesisContactSignature .= "\n" . AppLocale::Translate('user.phone') . ': ' . $thesisPhone; } if (!empty($thesisFax)) { $thesisContactSignature .= "\n" . AppLocale::Translate('user.fax') . ': ' . $thesisFax; } $thesisContactSignature .= "\n" . AppLocale::Translate('user.email') . ': ' . $thesisEmail; $studentName = $thesis->getStudentFirstName() . ' ' . $thesis->getStudentLastName(); $supervisorName = $thesis->getSupervisorFirstName() . ' ' . $thesis->getSupervisorLastName(); $paramArray = array('journalName' => $journalName, 'thesisName' => $thesisName, 'thesisEmail' => $thesisEmail, 'title' => $thesis->getTitle(), 'studentName' => $studentName, 'degree' => AppLocale::Translate($thesis->getDegreeString()), 'degreeName' => $thesis->getDegreeName(), 'department' => $thesis->getDepartment(), 'university' => $thesis->getUniversity(), 'dateApproved' => $thesis->getDateApproved(), 'supervisorName' => $supervisorName, 'abstract' => $thesis->getAbstract(), 'thesisContactSignature' => $thesisContactSignature); import('classes.mail.MailTemplate'); $mail = new MailTemplate('THESIS_ABSTRACT_CONFIRM'); $mail->setReplyTo($thesisEmail, $thesisName); $mail->assignParams($paramArray); $mail->addRecipient($thesis->getSupervisorEmail(), $supervisorName); $mail->addCc($thesis->getStudentEmail(), $studentName); $mail->send(); } }
/** * Setup common template variables. * @param $request PKPRequest * @param $subclass boolean set to true if caller is below this handler in the hierarchy */ function setupTemplate(&$request, $subclass = false) { $templateMgr =& TemplateManager::getManager($request); if ($subclass) { $templateMgr->append('pageHierarchy', array($request->url(null, 'objectsForReview'), AppLocale::Translate('plugins.generic.objectsForReview.displayName'), true)); } $ofrPlugin =& $this->_getObjectsForReviewPlugin(); $templateMgr->addStyleSheet($request->getBaseUrl() . '/' . $ofrPlugin->getStyleSheet()); }
/** * Display external feed content on journal homepage. * @param $hookName string * @param $args array */ function displayHomepage($hookName, $args) { $request = $this->getRequest(); $journal = $request->getJournal(); $journalId = $journal ? $journal->getId() : 0; if ($this->getEnabled()) { $requestedPage = $request->getRequestedPage(); if (empty($requestedPage) || $requestedPage == 'index') { $externalFeedDao = DAORegistry::getDAO('ExternalFeedDAO'); $this->import('simplepie.SimplePie'); $feeds =& $externalFeedDao->getExternalFeedsByJournalId($journal->getId()); $output = '<div id="externalFeedsHome">'; while ($currentFeed = $feeds->next()) { if (!$currentFeed->getDisplayHomepage()) { continue; } $feed = new SimplePie(); $feed->set_feed_url($currentFeed->getUrl()); $feed->enable_order_by_date(false); $feed->set_cache_location(CacheManager::getFileCachePath()); $feed->init(); if ($currentFeed->getLimitItems()) { $recentItems = $currentFeed->getRecentItems(); } else { $recentItems = 0; } $output .= '<h3>' . $currentFeed->getLocalizedTitle() . '</h3>'; $output .= '<table class="externalFeeds">'; $output .= '<tr>'; $output .= '<td colspan="2" class="headseparator"> </td>'; $output .= '</tr>'; $separator = ''; foreach ($feed->get_items(0, $recentItems) as $item) { $output .= $separator; $output .= '<tr class="title">'; $output .= '<td colspan="2" class="title">'; $output .= '<h4>' . $item->get_title() . '</h4>'; $output .= '</td>'; $output .= '</tr>'; $output .= '<tr class="description">'; $output .= '<td colspan="2" class="description">'; $output .= $item->get_description(); $output .= '</td>'; $output .= '</tr>'; $output .= '<tr class="details">'; $output .= '<td class="posted">'; $output .= AppLocale::Translate('plugins.generic.externalFeed.posted') . ': ' . date('Y-m-d', strtotime($item->get_date())); $output .= '</td>'; $output .= '<td class="more">'; $output .= '<a href="' . $item->get_permalink() . '" target="_blank">' . AppLocale::Translate('plugins.generic.externalFeed.more') . '</a>'; $output .= '</td>'; $output .= '</tr>'; $separator = '<tr><td colspan="2" class="separator"> </td></tr>'; } $output .= '<tr><td colspan="2" class="endseparator"> </td></tr>'; $output .= '</table>'; } $output .= '</div>'; $templateManager =& $args[0]; $additionalHomeContent = $templateManager->get_template_vars('additionalHomeContent'); $templateManager->assign('additionalHomeContent', $additionalHomeContent . "\n\n" . $output); } } }
/** * Get the scheduled conference's contact information * @param $schedConfId int * @return array */ function getRegistrationContactInformation($schedConfId) { $schedConfSettingsDao =& DAORegistry::getDAO('SchedConfSettingsDAO'); $registrationName = $schedConfSettingsDao->getSetting($schedConfId, 'registrationName'); $registrationEmail = $schedConfSettingsDao->getSetting($schedConfId, 'registrationEmail'); $registrationPhone = $schedConfSettingsDao->getSetting($schedConfId, 'registrationPhone'); $registrationFax = $schedConfSettingsDao->getSetting($schedConfId, 'registrationFax'); $registrationMailingAddress = $schedConfSettingsDao->getSetting($schedConfId, 'registrationMailingAddress'); $registrationContactSignature = $registrationName; if ($registrationMailingAddress != '') { $registrationContactSignature .= "\n" . $registrationMailingAddress; } if ($registrationPhone != '') { $registrationContactSignature .= "\n" . AppLocale::Translate('user.phone') . ': ' . $registrationPhone; } if ($registrationFax != '') { $registrationContactSignature .= "\n" . AppLocale::Translate('user.fax') . ': ' . $registrationFax; } $registrationContactSignature .= "\n" . AppLocale::Translate('user.email') . ': ' . $registrationEmail; return array($registrationEmail, $registrationName, $registrationContactSignature); }
/** * Setup common template variables. * @param $subclass boolean set to true if caller is below this handler in the hierarchy */ function setupTemplate($subclass = false) { $templateMgr =& TemplateManager::getManager(); if ($subclass) { $templateMgr->append('pageHierarchy', array(Request::url(null, 'booksForReview'), AppLocale::Translate('plugins.generic.booksForReview.displayName'), true)); } $bfrPlugin =& PluginRegistry::getPlugin('generic', BOOKS_FOR_REVIEW_PLUGIN_NAME); $templateMgr->addStyleSheet(Request::getBaseUrl() . '/' . $bfrPlugin->getStyleSheet()); }
/** * Private function to transmit current filter values * to the template. * @param $request PKPRequest * @param $templateMgr TemplateManager * @param $searchFilters array */ function _assignSearchFilters($request, &$templateMgr, $searchFilters) { // Get the journal id (if any). $journal =& $searchFilters['searchJournal']; $journalId = $journal ? $journal->getId() : null; $searchFilters['searchJournal'] = $journalId; // Assign all filters except for dates which need special treatment. $templateSearchFilters = array(); foreach ($searchFilters as $filterName => $filterValue) { if (in_array($filterName, array('fromDate', 'toDate'))) { continue; } $templateSearchFilters[$filterName] = $filterValue; } // Find out whether we have active/empty filters. $hasActiveFilters = false; $hasEmptyFilters = false; foreach ($templateSearchFilters as $filterName => $filterValue) { // The main query and journal selector will always be displayed // apart from other filters. if (in_array($filterName, array('query', 'searchJournal', 'siteSearch'))) { continue; } if (empty($filterValue)) { $hasEmptyFilters = true; } else { $hasActiveFilters = true; } } // Assign the filters to the template. $templateMgr->assign($templateSearchFilters); // Special case: publication date filters. foreach (array('From', 'To') as $fromTo) { $month = $request->getUserVar("date{$fromTo}Month"); $day = $request->getUserVar("date{$fromTo}Day"); $year = $request->getUserVar("date{$fromTo}Year"); if (empty($year)) { $date = '--'; $hasEmptyFilters = true; } else { $defaultMonth = $fromTo == 'From' ? 1 : 12; $defaultDay = $fromTo == 'From' ? 1 : 31; $date = date('Y-m-d H:i:s', mktime(0, 0, 0, empty($month) ? $defaultMonth : $month, empty($day) ? $defaultDay : $day, $year)); $hasActiveFilters = true; } $templateMgr->assign(array("date{$fromTo}Month" => $month, "date{$fromTo}Day" => $day, "date{$fromTo}Year" => $year, "date{$fromTo}" => $date)); } // Assign filter flags to the template. $templateMgr->assign(compact('hasEmptyFilters', 'hasActiveFilters')); // Assign the year range. $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO'); $yearRange = $publishedArticleDao->getArticleYearRange($journalId); $startYear = '-' . (date('Y') - substr($yearRange[1], 0, 4)); if (substr($yearRange[0], 0, 4) >= date('Y')) { $endYear = '+' . (substr($yearRange[0], 0, 4) - date('Y')); } else { $endYear = substr($yearRange[0], 0, 4) - date('Y'); } $templateMgr->assign(compact('startYear', 'endYear')); // Assign journal options. if ($searchFilters['siteSearch']) { $journalDao = DAORegistry::getDAO('JournalDAO'); $journals =& $journalDao->getTitles(true); $templateMgr->assign('journalOptions', array('' => AppLocale::Translate('search.allJournals')) + $journals); } }
/** * Display the presentations */ function presentations() { $this->validate(); $conference =& Request::getConference(); $schedConf =& Request::getSchedConf(); import('schedConf.SchedConfAction'); $mayViewProceedings = SchedConfAction::mayViewProceedings($schedConf); $mayViewPapers = SchedConfAction::mayViewPapers($schedConf, $conference); $templateMgr =& TemplateManager::getManager(); SchedConfHandler::setupTemplate($conference, $schedConf); AppLocale::requireComponents(array(LOCALE_COMPONENT_OCS_DIRECTOR)); // FIXME: director.allTracks $templateMgr->assign('pageHierarchy', array(array(Request::url(null, 'index', 'index'), $conference->getConferenceTitle(), true), array(Request::url(null, null, 'index'), $schedConf->getSchedConfTitle(), true))); $templateMgr->assign('helpTopicId', 'editorial.trackDirectorsRole.presentations'); $templateMgr->assign_by_ref('schedConf', $schedConf); $templateMgr->assign('mayViewProceedings', $mayViewProceedings); $templateMgr->assign('mayViewPapers', $mayViewPapers); if ($mayViewProceedings) { $publishedPaperDao =& DAORegistry::getDAO('PublishedPaperDAO'); $trackDao =& DAORegistry::getDAO('TrackDAO'); $tracks =& $trackDao->getTrackTitles($schedConf->getId()); // Get the user's search conditions, if any $searchField = Request::getUserVar('searchField'); $searchMatch = Request::getUserVar('searchMatch'); $search = Request::getUserVar('search'); $searchInitial = Request::getUserVar('searchInitial'); if (!empty($searchInitial)) { $searchField = SUBMISSION_FIELD_AUTHOR; $searchMatch = 'initial'; $search = $searchInitial; } $templateMgr->assign('fieldOptions', array(SUBMISSION_FIELD_TITLE => 'paper.title', SUBMISSION_FIELD_AUTHOR => 'user.role.author')); $previewAbstracts = $schedConf->getSetting('reviewMode') == REVIEW_MODE_BOTH_SEQUENTIAL && $schedConf->getSetting('previewAbstracts'); $publishedPapers =& $publishedPaperDao->getPublishedPapersInTracks($schedConf->getId(), Request::getUserVar('track'), $searchField, $searchMatch, $search, $previewAbstracts); // Set search parameters $duplicateParameters = array('searchField', 'searchMatch', 'search', 'searchInitial', 'track'); foreach ($duplicateParameters as $param) { $templateMgr->assign($param, Request::getUserVar($param)); } $templateMgr->assign('alphaList', explode(' ', __('common.alphaList'))); $templateMgr->assign('trackOptions', array(0 => AppLocale::Translate('director.allTracks')) + $tracks); $templateMgr->assign_by_ref('publishedPapers', $publishedPapers); } $templateMgr->display('schedConf/papers.tpl'); }
/** * Handle incoming requests/notifications */ function handle($args) { $templateMgr =& TemplateManager::getManager(); $schedConf =& Request::getSchedConf(); if (!$schedConf) { return parent::handle($args); } // Just in case we need to contact someone import('mail.MailTemplate'); $contactName = $schedConf->getSetting('contactName'); $contactEmail = $schedConf->getSetting('contactEmail'); $mail = new MailTemplate('PAYPAL_INVESTIGATE_PAYMENT'); $mail->setFrom($contactEmail, $contactName); $mail->addRecipient($contactEmail, $contactName); $paymentStatus = Request::getUserVar('payment_status'); switch (array_shift($args)) { case 'ipn': // Build a confirmation transaction. $req = 'cmd=_notify-validate'; if (get_magic_quotes_gpc()) { foreach ($_POST as $key => $value) { $req .= '&' . urlencode(stripslashes($key)) . '=' . urlencode(stripslashes($value)); } } else { foreach ($_POST as $key => $value) { $req .= '&' . urlencode($key) . '=' . urlencode($value); } } // Create POST response $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->getSetting($schedConf->getConferenceId(), $schedConf->getId(), 'paypalurl')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded', 'Content-Length: ' . strlen($req))); curl_setopt($ch, CURLOPT_POSTFIELDS, $req); $ret = curl_exec($ch); $curlError = curl_error($ch); curl_close($ch); // Check the confirmation response and handle as necessary. if (strcmp($ret, 'VERIFIED') == 0) { switch ($paymentStatus) { case 'Completed': $payPalDao =& DAORegistry::getDAO('PayPalDAO'); $transactionId = Request::getUserVar('txn_id'); if ($payPalDao->transactionExists($transactionId)) { // A duplicate transaction was received; notify someone. $mail->assignParams(array('schedConfName' => $schedConf->getFullTitle(), 'postInfo' => print_r($_POST, true), 'additionalInfo' => "Duplicate transaction ID: {$transactionId}", 'serverVars' => print_r($_SERVER, true))); $mail->send(); exit; } else { // New transaction succeeded. Record it. $payPalDao->insertTransaction($transactionId, Request::getUserVar('txn_type'), Request::getUserVar('payer_email'), Request::getUserVar('receiver_email'), Request::getUserVar('item_number'), Request::getUserVar('payment_date'), Request::getUserVar('payer_id'), Request::getUserVar('receiver_id')); $queuedPaymentId = Request::getUserVar('custom'); import('payment.ocs.OCSPaymentManager'); $ocsPaymentManager =& OCSPaymentManager::getManager(); // Verify the cost and user details as per PayPal spec. $queuedPayment =& $ocsPaymentManager->getQueuedPayment($queuedPaymentId); if (!$queuedPayment) { // The queued payment entry is missing. Complain. $mail->assignParams(array('schedConfName' => $schedConf->getFullTitle(), 'postInfo' => print_r($_POST, true), 'additionalInfo' => "Missing queued payment ID: {$queuedPaymentId}", 'serverVars' => print_r($_SERVER, true))); $mail->send(); exit; } if (($queuedAmount = $queuedPayment->getAmount()) != ($grantedAmount = Request::getUserVar('mc_gross')) || ($queuedCurrency = $queuedPayment->getCurrencyCode()) != ($grantedCurrency = Request::getUserVar('mc_currency')) || ($grantedEmail = Request::getUserVar('receiver_email')) != ($queuedEmail = $this->getSetting($schedConf->getConferenceId(), $schedConf->getId(), 'selleraccount'))) { // The integrity checks for the transaction failed. Complain. $mail->assignParams(array('schedConfName' => $schedConf->getFullTitle(), 'postInfo' => print_r($_POST, true), 'additionalInfo' => "Granted amount: {$grantedAmount}\n" . "Queued amount: {$queuedAmount}\n" . "Granted currency: {$grantedCurrency}\n" . "Queued currency: {$queuedCurrency}\n" . "Granted to PayPal account: {$grantedEmail}\n" . "Configured PayPal account: {$queuedEmail}", 'serverVars' => print_r($_SERVER, true))); $mail->send(); exit; } // Fulfill the queued payment. if ($ocsPaymentManager->fulfillQueuedPayment($queuedPaymentId, $queuedPayment)) { // Send the registrant a notification that their payment was received $schedConfSettingsDao =& DAORegistry::getDAO('SchedConfSettingsDAO'); // Get registrant name and email $userDao =& DAORegistry::getDAO('UserDAO'); $user =& $userDao->getUser($queuedPayment->getuserId()); $registrantName = $user->getFullName(); $registrantEmail = $user->getEmail(); // Get conference contact details $schedConfId = $schedConf->getId(); $registrationName = $schedConfSettingsDao->getSetting($schedConfId, 'registrationName'); $registrationEmail = $schedConfSettingsDao->getSetting($schedConfId, 'registrationEmail'); $registrationPhone = $schedConfSettingsDao->getSetting($schedConfId, 'registrationPhone'); $registrationFax = $schedConfSettingsDao->getSetting($schedConfId, 'registrationFax'); $registrationMailingAddress = $schedConfSettingsDao->getSetting($schedConfId, 'registrationMailingAddress'); $registrationContactSignature = $registrationName; if ($registrationMailingAddress != '') { $registrationContactSignature .= "\n" . $registrationMailingAddress; } if ($registrationPhone != '') { $registrationContactSignature .= "\n" . AppLocale::Translate('user.phone') . ': ' . $registrationPhone; } if ($registrationFax != '') { $registrationContactSignature .= "\n" . AppLocale::Translate('user.fax') . ': ' . $registrationFax; } $registrationContactSignature .= "\n" . AppLocale::Translate('user.email') . ': ' . $registrationEmail; $paramArray = array('registrantName' => $registrantName, 'conferenceName' => $schedConf->getFullTitle(), 'registrationContactSignature' => $registrationContactSignature); import('mail.MailTemplate'); $mail = new MailTemplate('MANUAL_PAYMENT_RECEIVED'); $mail->setFrom($registrationEmail, $registrationName); $mail->assignParams($paramArray); $mail->addRecipient($registrantEmail, $registrantName); $mail->send(); exit; } // If we're still here, it means the payment couldn't be fulfilled. $mail->assignParams(array('schedConfName' => $schedConf->getFullTitle(), 'postInfo' => print_r($_POST, true), 'additionalInfo' => "Queued payment ID {$queuedPaymentId} could not be fulfilled.", 'serverVars' => print_r($_SERVER, true))); $mail->send(); } exit; case 'Pending': // Ignore. exit; default: // An unhandled payment status was received; notify someone. $mail->assignParams(array('schedConfName' => $schedConf->getFullTitle(), 'postInfo' => print_r($_POST, true), 'additionalInfo' => "Payment status: {$paymentStatus}", 'serverVars' => print_r($_SERVER, true))); $mail->send(); exit; } } else { // An unknown confirmation response was received; notify someone. $mail->assignParams(array('schedConfName' => $schedConf->getFullTitle(), 'postInfo' => print_r($_POST, true), 'additionalInfo' => "Confirmation return: {$ret}\nCURL error: {$curlError}", 'serverVars' => print_r($_SERVER, true))); $mail->send(); exit; } break; case 'cancel': Handler::setupTemplate(); $templateMgr->assign(array('currentUrl' => Request::url(null, null, 'index'), 'pageTitle' => 'plugins.paymethod.paypal.purchase.cancelled.title', 'message' => 'plugins.paymethod.paypal.purchase.cancelled')); $templateMgr->display('common/message.tpl'); exit; break; } parent::handle($args); // Don't know what to do with it }