/** * 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'); }
/** * See implementation of retrieveResults for a description of this * function. * Note that this function is also called externally to fetch * results for the title index, and possibly elsewhere. */ function &formatResults(&$results) { $paperDao =& DAORegistry::getDAO('PaperDAO'); $publishedPaperDao =& DAORegistry::getDAO('PublishedPaperDAO'); $schedConfDao =& DAORegistry::getDAO('SchedConfDAO'); $conferenceDao =& DAORegistry::getDAO('ConferenceDAO'); $trackDao =& DAORegistry::getDAO('TrackDAO'); $publishedPaperCache = array(); $paperCache = array(); $schedConfCache = array(); $schedConfAvailabilityCache = array(); $conferenceCache = array(); $trackCache = array(); $returner = array(); foreach ($results as $paperId) { // Get the paper, storing in cache if necessary. if (!isset($paperCache[$paperId])) { $publishedPaperCache[$paperId] =& $publishedPaperDao->getPublishedPaperByPaperId($paperId); $paperCache[$paperId] =& $paperDao->getPaper($paperId); } unset($paper, $publishedPaper); $paper =& $paperCache[$paperId]; $publishedPaper =& $publishedPaperCache[$paperId]; if ($publishedPaper && $paper) { $trackId = $paper->getTrackId(); if (!isset($trackCache[$trackId])) { $trackCache[$trackId] =& $trackDao->getTrack($trackId); } // Get the conference, storing in cache if necessary. $schedConfId = $publishedPaper->getSchedConfId(); $schedConf =& $schedConfDao->getSchedConf($schedConfId); $conferenceId = $schedConf->getConferenceId(); if (!isset($conferenceCache[$conferenceId])) { $conferenceCache[$conferenceId] = $conferenceDao->getConference($conferenceId); } // Get the scheduled conference, storing in cache if necessary. if (!isset($schedConfCache[$schedConfId])) { $schedConfCache[$schedConfId] =& $schedConf; import('schedConf.SchedConfAction'); $schedConfAvailabilityCache[$schedConfId] = SchedConfAction::mayViewProceedings($schedConf); } // Store the retrieved objects in the result array. if ($schedConfAvailabilityCache[$schedConfId]) { $returner[] = array('paper' => &$paper, 'publishedPaper' => &$publishedPaperCache[$paperId], 'schedConf' => &$schedConfCache[$schedConfId], 'conference' => &$conferenceCache[$conferenceId], 'schedConfAvailable' => $schedConfAvailabilityCache[$schedConfId], 'track' => &$trackCache[$trackId]); } } } return $returner; }
/** * Show index of published papers by title. * @param $args array * @param $request PKPRequest */ function titles($args, &$request) { parent::validate(); $this->setupTemplate($request, true); $conference =& $request->getConference(); $schedConf =& $request->getSchedConf(); import('classes.schedConf.SchedConfAction'); $publishedPaperDao = DAORegistry::getDAO('PublishedPaperDAO'); $schedConfDao = DAORegistry::getDAO('SchedConfDAO'); $rangeInfo = $this->getRangeInfo($request, 'search'); $allPaperIds =& $publishedPaperDao->getPublishedPaperIdsAlphabetizedByTitle($conference ? $conference->getId() : null, $schedConf ? $schedConf->getId() : null, $rangeInfo); // FIXME: this is horribly inefficient. $paperIds = array(); $schedConfAbstractPermissions = array(); $schedConfPaperPermissions = array(); foreach ($allPaperIds as $paperId) { $publishedPaper =& $publishedPaperDao->getPublishedPaperByPaperId($paperId); if (!$publishedPaper) { continue; } // Bonehead check (e.g. cached IDs) $schedConfId = $publishedPaper->getSchedConfId(); if (!isset($schedConfAbstractPermissions[$schedConfId])) { unset($schedConf); $schedConf = $schedConfDao->getById($schedConfId); $schedConfAbstractPermissions[$schedConfId] = SchedConfAction::mayViewProceedings($schedConf); $schedConfPaperPermissions[$schedConfId] = SchedConfAction::mayViewPapers($schedConf, $conference); } if ($schedConfAbstractPermissions[$schedConfId]) { $paperIds[] = $paperId; } } $totalResults = count($paperIds); $paperIds = array_slice($paperIds, $rangeInfo->getCount() * ($rangeInfo->getPage() - 1), $rangeInfo->getCount()); import('lib.pkp.classes.core.VirtualArrayIterator'); $results = new VirtualArrayIterator(PaperSearch::formatResults($paperIds), $totalResults, $rangeInfo->getPage(), $rangeInfo->getCount()); $templateMgr =& TemplateManager::getManager($request); $templateMgr->assign_by_ref('results', $results); $templateMgr->display('search/titleIndex.tpl'); }
/** * Validation * @see lib/pkp/classes/handler/PKPHandler#validate() * @param $request Request * @param $paperId integer * @param $galleyId integer */ function validate(&$request, $paperId, $galleyId = null) { $router =& $request->getRouter(); parent::validate(null, $request); $conference =& $router->getContext($request, CONTEXT_CONFERENCE); $schedConf =& $router->getContext($request, CONTEXT_SCHED_CONF); $conferenceId = $conference->getId(); $publishedPaperDao = DAORegistry::getDAO('PublishedPaperDAO'); if ($schedConf->getSetting('enablePublicPaperId')) { $paper =& $publishedPaperDao->getPublishedPaperByBestPaperId($schedConf->getId(), $paperId, $schedConf->getSetting('previewAbstracts') ? true : false); } else { $paper =& $publishedPaperDao->getPublishedPaperByPaperId((int) $paperId, $schedConf->getId(), $schedConf->getSetting('previewAbstracts') ? true : false); } // if paper does not exist, is not published, or is not part of // the right conference & sched conf, redirect to index. if (isset($schedConf) && isset($paper) && isset($conference) && $paper->getSchedConfId() == $schedConf->getId() && $schedConf->getConferenceId() == $conference->getId()) { // Check if login is required for viewing. if (!Validation::isLoggedIn() && $schedConf->getSetting('restrictPaperAccess')) { Validation::redirectLogin(); } import('classes.schedConf.SchedConfAction'); $mayViewPaper = SchedConfAction::mayViewPapers($schedConf, $conference); if (isset($galleyId) && $galleyId != 0 && !$mayViewPaper || (!isset($galleyId) || $galleyId == 0) && !SchedConfAction::mayViewProceedings($schedConf)) { $this->setupTemplate($request); $templateMgr =& TemplateManager::getManager($request); $templateMgr->assign_by_ref('paper', $paper); $templateMgr->assign_by_ref('schedConf', $schedConf); $templateMgr->assign_by_ref('conference', $conference); $templateMgr->display('paper/accessDenied.tpl'); exit; } } else { $request->redirect(null, null, 'index'); } $this->paper =& $paper; return true; }
/** * @see OAIMetadataFormat#toXml */ function toXml(&$record, $format = null) { $conference =& $record->getData('conference'); $schedConf =& $record->getData('schedConf'); $paper =& $record->getData('paper'); $track =& $record->getData('track'); $galleys =& $record->getData('galleys'); $paperId = $paper->getId(); $primaryLocale = $conference->getPrimaryLocale(); // If possible, use the paper presentation date for the paper date fields. // Otherwise, use the date published (i.e. the date it was marked "completed" // in the workflow). if ($datePublished = $paper->getStartTime()) { $datePublished = strtotime($datePublished); } else { $datePublished = strtotime($paper->getDatePublished()); } $response = "<article\n" . "\txmlns=\"http://dtd.nlm.nih.gov/publishing/2.3\"\n" . "\txmlns:xlink=\"http://www.w3.org/1999/xlink\"\n" . "\txmlns:mml=\"http://www.w3.org/1998/Math/MathML\"\n" . "\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" . "\txsi:schemaLocation=\"http://dtd.nlm.nih.gov/publishing/2.3\n" . "\thttp://dtd.nlm.nih.gov/publishing/2.3/xsd/journalpublishing.xsd\"\n" . (($s = $track->getLocalizedIdentifyType()) != '' ? "\tarticle-type=\"" . htmlspecialchars(Core::cleanVar($s)) . "\"" : '') . "\txml:lang=\"" . strtoupper(substr($primaryLocale, 0, 2)) . "\">\n" . "\t<front>\n" . "\t\t<journal-meta>\n" . "\t\t\t<journal-id journal-id-type=\"other\">" . htmlspecialchars(Core::cleanVar(($s = Config::getVar('oai', 'nlm_journal_id')) != '' ? $s : $conference->getPath() . '-' . $schedConf->getPath())) . "</journal-id>\n" . "\t\t\t<journal-title>" . htmlspecialchars(Core::cleanVar($schedConf->getLocalizedName())) . "</journal-title>\n"; // Include translated scheduled conference titles foreach ($schedConf->getTitle(null) as $locale => $title) { if ($locale == $primaryLocale) { continue; } $response .= "\t\t\t<trans-title xml:lang=\"" . strtoupper(substr($locale, 0, 2)) . "\">" . htmlspecialchars(Core::cleanVar($title)) . "</trans-title>\n"; } $response .= "\t\t</journal-meta>\n" . "\t\t<article-meta>\n" . "\t\t\t<article-id pub-id-type=\"other\">" . htmlspecialchars(Core::cleanVar($paper->getId())) . "</article-id>\n" . "\t\t\t<article-categories><subj-group subj-group-type=\"heading\"><subject>" . htmlspecialchars(Core::cleanVar($track->getLocalizedTitle())) . "</subject></subj-group></article-categories>\n" . "\t\t\t<title-group>\n" . "\t\t\t\t<article-title>" . htmlspecialchars(Core::cleanVar(strip_tags($paper->getLocalizedTitle()))) . "</article-title>\n"; // Include translated journal titles foreach ($paper->getTitle(null) as $locale => $title) { if ($locale == $primaryLocale) { continue; } $response .= "\t\t\t\t<trans-title xml:lang=\"" . strtoupper(substr($locale, 0, 2)) . "\">" . htmlspecialchars(Core::cleanVar(strip_tags($title))) . "</trans-title>\n"; } $response .= "\t\t\t</title-group>\n" . "\t\t\t<contrib-group>\n"; // Include authors foreach ($paper->getAuthors() as $author) { $response .= "\t\t\t\t<contrib " . ($author->getPrimaryContact() ? 'corresp="yes" ' : '') . "contrib-type=\"author\">\n" . "\t\t\t\t\t<name name-style=\"western\">\n" . "\t\t\t\t\t\t<surname>" . htmlspecialchars(Core::cleanVar($author->getLastName())) . "</surname>\n" . "\t\t\t\t\t\t<given-names>" . htmlspecialchars(Core::cleanVar($author->getFirstName()) . (($s = $author->getMiddleName()) != '' ? " {$s}" : '')) . "</given-names>\n" . "\t\t\t\t\t</name>\n" . (($s = $author->getLocalizedAffiliation()) != '' ? "\t\t\t\t\t<aff>" . htmlspecialchars(Core::cleanVar($s)) . "</aff>\n" : '') . "\t\t\t\t\t<email>" . htmlspecialchars(Core::cleanVar($author->getEmail())) . "</email>\n" . (($s = $author->getUrl()) != '' ? "\t\t\t\t\t<uri>" . htmlspecialchars(Core::cleanVar($s)) . "</uri>\n" : '') . "\t\t\t\t</contrib>\n"; } // Include editorships (optimized) $response .= $this->getEditorialInfo($conference->getId()); $response .= "\t\t\t</contrib-group>\n" . "\t\t\t<pub-date pub-type=\"epub\">\n" . "\t\t\t\t<day>" . strftime('%d', $datePublished) . "</day>\n" . "\t\t\t\t<month>" . strftime('%m', $datePublished) . "</month>\n" . "\t\t\t\t<year>" . strftime('%Y', $datePublished) . "</year>\n" . "\t\t\t</pub-date>\n"; $response .= "\t\t\t<permissions>\n" . (($s = $conference->getLocalizedSetting('copyrightNotice')) != '' ? "\t\t\t\t<copyright-statement>" . htmlspecialchars(Core::cleanVar($s)) . "</copyright-statement>\n" : '') . "\t\t\t\t<copyright-year>" . strftime('%Y', $datePublished) . "</copyright-year>\n" . "\t\t\t</permissions>\n" . "\t\t\t<self-uri xlink:href=\"" . htmlspecialchars(Core::cleanVar(Request::url($conference->getPath(), $schedConf->getPath(), 'paper', 'view', $paper->getId()))) . "\" />\n"; // Include galley links foreach ($paper->getGalleys() as $galley) { $response .= "\t\t\t<self-uri content-type=\"" . htmlspecialchars(Core::cleanVar($galley->getFileType())) . "\" xlink:href=\"" . htmlspecialchars(Core::cleanVar(Request::url($conference->getPath(), $schedConf->getPath(), 'paper', 'view', array($paper->getId(), $galley->getId())))) . "\" />\n"; } // Include abstract(s) $abstract = htmlspecialchars(Core::cleanVar(strip_tags($paper->getLocalizedAbstract()))); if (!empty($abstract)) { $abstract = "<p>{$abstract}</p>"; $response .= "\t\t\t<abstract xml:lang=\"" . strtoupper(substr($primaryLocale, 0, 2)) . "\">{$abstract}</abstract>\n"; } if (is_array($paper->getAbstract(null))) { foreach ($paper->getAbstract(null) as $locale => $abstract) { if ($locale == $primaryLocale || empty($abstract)) { continue; } $abstract = htmlspecialchars(Core::cleanVar(strip_tags($abstract))); if (empty($abstract)) { continue; } $abstract = "<p>{$abstract}</p>"; $response .= "\t\t\t<abstract-trans xml:lang=\"" . strtoupper(substr($locale, 0, 2)) . "\">{$abstract}</abstract-trans>\n"; } } $subjects = array(); if (is_array($paper->getSubject(null))) { foreach ($paper->getSubject(null) as $locale => $subject) { $s = array_map('trim', explode(';', Core::cleanVar($subject))); if (!empty($s)) { $subjects[$locale] = $s; } } } if (!empty($subjects)) { foreach ($subjects as $locale => $s) { $response .= "\t\t\t<kwd-group xml:lang=\"" . strtoupper(substr($locale, 0, 2)) . "\">\n"; foreach ($s as $subject) { $response .= "\t\t\t\t<kwd>" . htmlspecialchars($subject) . "</kwd>\n"; } $response .= "\t\t\t</kwd-group>\n"; } } $locationCity = $schedConf->getSetting('locationCity'); $locationCountry = $schedConf->getSetting('locationCountry'); if (empty($locationCity) && empty($locationCountry)) { $confLoc = ''; } elseif (empty($locationCity) && !empty($locationCountry)) { $confLoc = $locationCountry; } elseif (empty($locationCountry)) { $confLoc = $locationCity; } else { $confLoc = "{$locationCity}, {$locationCountry}"; } $response .= "\t\t\t<conference>\n" . "\t\t\t\t<conf-date>" . strftime('%Y-%m-%d', $schedConf->getSetting('startDate')) . "</conf-date>\n" . "\t\t\t\t<conf-name>" . htmlspecialchars(Core::cleanVar($schedConf->getLocalizedName())) . "</conf-name>\n" . "\t\t\t\t<conf-acronym>" . htmlspecialchars(Core::cleanVar($schedConf->getLocalizedAcronym())) . "</conf-acronym>\n" . (!empty($confLoc) ? "\t\t\t\t<conf-loc>" . htmlspecialchars(Core::cleanVar($confLoc)) . "</conf-loc>\n" : '') . "\t\t\t</conference>\n" . "\t\t</article-meta>\n" . "\t</front>\n"; // Include body text (for search indexing only) import('classes.search.PaperSearchIndex'); $text = ''; // $galleys = $paper->getGalleys(); // Give precedence to HTML galleys, as they're quickest to parse usort($galleys, create_function('$a, $b', 'return $a->isHtmlGalley()?-1:1;')); // Determine any access limitations. If there are, do not // provide the full-text. import('classes.schedConf.SchedConfAction'); $mayViewProceedings = SchedConfAction::mayViewProceedings($schedConf); if ($mayViewProceedings) { foreach ($galleys as $galley) { $parser =& SearchFileParser::fromFile($galley); if ($parser && $parser->open()) { while (($s = $parser->read()) !== false) { $text .= $s; } $parser->close(); } if ($galley->isHtmlGalley()) { $text = strip_tags($text); } unset($galley); // Use the first parseable galley. if (!empty($text)) { break; } } } if (!empty($text)) { $response .= "\t<body><p>" . htmlspecialchars(Core::cleanVar(Core::cleanVar($text))) . "</p></body>\n"; } $response .= "</article>"; return $response; }