/** * Display user index page. */ function index() { $this->validate(); $user =& Request::getUser(); $userId = $user->getId(); $setupIncomplete = array(); $submissionsCount = array(); $isValid = array(); $schedConfsToDisplay = array(); $conferencesToDisplay = array(); $roleDao =& DAORegistry::getDAO('RoleDAO'); $schedConfDao =& DAORegistry::getDAO('SchedConfDAO'); $this->setupTemplate(); $templateMgr =& TemplateManager::getManager(); $conference =& Request::getConference(); $templateMgr->assign('helpTopicId', 'user.userHome'); $allConferences = $allSchedConfs = array(); if ($conference == null) { // Curently at site level unset($conference); // Show roles for all conferences $conferenceDao =& DAORegistry::getDAO('ConferenceDAO'); $conferences =& $conferenceDao->getConferences(); // Fetch the user's roles for each conference while ($conference =& $conferences->next()) { $conferenceId = $conference->getId(); $schedConfId = 0; // First, the generic roles for this conference $roles =& $roleDao->getRolesByUserId($userId, $conferenceId, 0); if (!empty($roles)) { $conferencesToDisplay[$conferenceId] =& $conference; $rolesToDisplay[$conferenceId] =& $roles; } // Determine if conference setup is incomplete, to provide a message for JM $setupIncomplete[$conferenceId] = $this->checkIncompleteSetup($conference); $this->getRoleDataForConference($userId, $conferenceId, $schedConfId, $submissionsCount, $isValid); // Second, scheduled conference-specific roles // TODO: don't display scheduled conference roles if granted at conference level too? $schedConfs =& $schedConfDao->getSchedConfsByConferenceId($conferenceId); while ($schedConf =& $schedConfs->next()) { $schedConfId = $schedConf->getId(); $schedConfRoles =& $roleDao->getRolesByUserId($userId, $conferenceId, $schedConfId); if (!empty($schedConfRoles)) { $schedConfsToDisplay[$conferenceId][$schedConfId] =& $schedConf; $this->getRoleDataForConference($userId, $conferenceId, $schedConfId, $submissionsCount, $isValid); } $allSchedConfs[$conference->getId()][$schedConf->getId()] =& $schedConf; unset($schedConf); } // If the user has Sched. Conf. roles and no Conf. roles, push the conf. object // into the conference array so it gets shown if (empty($roles) && !empty($schedConfsToDisplay[$conferenceId])) { $conferencesToDisplay[$conferenceId] =& $conference; } $allConferences[$conference->getId()] =& $conference; unset($schedConfs); unset($conference); } $templateMgr->assign('showAllConferences', 1); $templateMgr->assign_by_ref('userConferences', $conferencesToDisplay); } else { // Currently within a conference's context $conferenceId = $conference->getId(); $userConferences = array($conference); $this->getRoleDataForConference($userId, $conferenceId, 0, $submissionsCount, $isValid); $schedConfs =& $schedConfDao->getSchedConfsByConferenceId($conferenceId); while ($schedConf =& $schedConfs->next()) { $schedConfId = $schedConf->getId(); $schedConfRoles =& $roleDao->getRolesByUserId($userId, $conferenceId, $schedConfId); if (!empty($schedConfRoles)) { $this->getRoleDataForConference($userId, $conferenceId, $schedConfId, $submissionsCount, $isValid); $schedConfsToDisplay[$conferenceId][$schedConfId] =& $schedConf; } unset($schedConf); } $schedConf =& Request::getSchedConf(); if ($schedConf) { import('schedConf.SchedConfAction'); $templateMgr->assign('allowRegAuthor', SchedConfAction::allowRegAuthor($schedConf)); $templateMgr->assign('allowRegReviewer', SchedConfAction::allowRegReviewer($schedConf)); $templateMgr->assign('submissionsOpen', SchedConfAction::submissionsOpen($schedConf)); } $templateMgr->assign_by_ref('userConferences', $userConferences); } $templateMgr->assign('isSiteAdmin', $roleDao->getRole(0, 0, $userId, ROLE_ID_SITE_ADMIN)); $templateMgr->assign('allConferences', $allConferences); $templateMgr->assign('allSchedConfs', $allSchedConfs); $templateMgr->assign('userSchedConfs', $schedConfsToDisplay); $templateMgr->assign('isValid', $isValid); $templateMgr->assign('submissionsCount', $submissionsCount); $templateMgr->assign('setupIncomplete', $setupIncomplete); $templateMgr->display('user/index.tpl'); }
function validate() { parent::validate(); $schedConf =& Request::getSchedConf(); if (!SchedConfAction::mayViewSchedConf($schedConf)) { Request::redirect(null, 'index'); } return true; }
/** * 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 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; }
/** * Validation check for submission. * Checks that paper ID is valid, if specified. * @param $request object * @param $paperId int * @param $step int */ function validate($request, $paperId = null, $step = false) { parent::validate(); $conference =& $request->getConference(); $schedConf =& $request->getSchedConf(); $paperDao =& DAORegistry::getDAO('PaperDAO'); $user =& $request->getUser(); if ($step !== false && ($step < 1 || $step > 5 || !isset($paperId) && $step != 1)) { $request->redirect(null, null, null, 'submit', array(1)); } $paper = null; if ($paperId) { // Check that paper exists for this conference and user and that submission is incomplete $paper =& $paperDao->getPaper((int) $paperId); if (!$paper || $paper->getUserId() !== $user->getId() || $paper->getSchedConfId() !== $schedConf->getId()) { $request->redirect(null, null, null, 'submit'); } if ($step !== false && $step > $paper->getSubmissionProgress()) { $request->redirect(null, null, null, 'submit'); } } else { // If the paper does not exist, require that the // submission window be open or that this user be a // director or track director. import('classes.schedConf.SchedConfAction'); $schedConf =& $request->getSchedConf(); if (!$schedConf || !SchedConfAction::submissionsOpen($schedConf) && !Validation::isDirector($schedConf->getConferenceId(), $schedConf->getId()) && !Validation::isTrackDirector($schedConf->getConferenceId())) { $request->redirect(null, null, 'author', 'index'); } } $this->paper =& $paper; return true; }
/** * 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'); }
/** * Register a new user. */ function execute() { $requireValidation = Config::getVar('email', 'require_validation'); if ($this->existingUser) { // Existing user in the system $userDao =& DAORegistry::getDAO('UserDAO'); $user =& $userDao->getUserByUsername($this->getData('username')); if ($user == null) { return false; } $userId = $user->getId(); } else { // New user $user = new User(); $user->setUsername($this->getData('username')); $user->setSalutation($this->getData('salutation')); $user->setFirstName($this->getData('firstName')); $user->setMiddleName($this->getData('middleName')); $user->setInitials($this->getData('initials')); $user->setLastName($this->getData('lastName')); $user->setGender($this->getData('gender')); $user->setAffiliation($this->getData('affiliation')); $user->setSignature($this->getData('signature'), null); // Localized $user->setEmail($this->getData('email')); $user->setUrl($this->getData('userUrl')); $user->setPhone($this->getData('phone')); $user->setFax($this->getData('fax')); $user->setMailingAddress($this->getData('mailingAddress')); $user->setBiography($this->getData('biography'), null); // Localized $user->setInterests($this->getData('interests'), null); // Localized $user->setDateRegistered(Core::getCurrentDate()); $user->setCountry($this->getData('country')); $site =& Request::getSite(); $availableLocales = $site->getSupportedLocales(); $locales = array(); foreach ($this->getData('userLocales') as $locale) { if (AppLocale::isLocaleValid($locale) && in_array($locale, $availableLocales)) { array_push($locales, $locale); } } $user->setLocales($locales); if (isset($this->defaultAuth)) { $user->setPassword($this->getData('password')); // FIXME Check result and handle failures $this->defaultAuth->doCreateUser($user); $user->setAuthId($this->defaultAuth->authId); } $user->setPassword(Validation::encryptCredentials($this->getData('username'), $this->getData('password'))); if ($requireValidation) { // The account should be created in a disabled // state. $user->setDisabled(true); $user->setDisabledReason(__('user.login.accountNotValidated')); } $userDao =& DAORegistry::getDAO('UserDAO'); $userDao->insertUser($user); $userId = $user->getId(); if (!$userId) { return false; } $sessionManager =& SessionManager::getManager(); $session =& $sessionManager->getUserSession(); $session->setSessionVar('username', $user->getUsername()); } $conference =& Request::getConference(); $schedConf =& Request::getSchedConf(); $roleDao =& DAORegistry::getDAO('RoleDAO'); // Roles users are allowed to register themselves in $allowedRoles = array('reader' => 'createAsReader', 'author' => 'createAsAuthor', 'reviewer' => 'createAsReviewer'); import('schedConf.SchedConfAction'); if (!SchedConfAction::allowRegReader($schedConf)) { unset($allowedRoles['reader']); } if (!SchedConfAction::allowRegAuthor($schedConf)) { unset($allowedRoles['author']); } if (!SchedConfAction::allowRegReviewer($schedConf)) { unset($allowedRoles['reviewer']); } foreach ($allowedRoles as $k => $v) { $roleId = $roleDao->getRoleIdFromPath($k); if ($this->getData($v) && !$roleDao->roleExists($conference->getId(), $schedConf->getId(), $userId, $roleId)) { $role = new Role(); $role->setConferenceId($conference->getId()); $role->setSchedConfId($schedConf->getId()); $role->setUserId($userId); $role->setRoleId($roleId); $roleDao->insertRole($role); } } if (!$this->existingUser) { $this->sendConfirmationEmail($user, $this->getData('password'), $this->getData('sendPassword')); } if (isset($allowedRoles['reader']) && $this->getData('openAccessNotification')) { $userSettingsDao =& DAORegistry::getDAO('UserSettingsDAO'); $userSettingsDao->updateSetting($userId, 'openAccessNotification', true, 'bool', $conference->getId()); } }
/** * Save profile settings. */ function execute() { $user =& Request::getUser(); $user->setSalutation($this->getData('salutation')); $user->setFirstName($this->getData('firstName')); $user->setMiddleName($this->getData('middleName')); $user->setLastName($this->getData('lastName')); $user->setGender($this->getData('gender')); $user->setInitials($this->getData('initials')); $user->setAffiliation($this->getData('affiliation')); $user->setSignature($this->getData('signature'), null); // Localized $user->setEmail($this->getData('email')); $user->setUrl($this->getData('userUrl')); $user->setPhone($this->getData('phone')); $user->setFax($this->getData('fax')); $user->setMailingAddress($this->getData('mailingAddress')); $user->setCountry($this->getData('country')); $user->setTimeZone($this->getData('timeZone')); $user->setBiography($this->getData('biography'), null); // Localized $user->setInterests($this->getData('interests'), null); // Localized $site =& Request::getSite(); $availableLocales = $site->getSupportedLocales(); $locales = array(); foreach ($this->getData('userLocales') as $locale) { if (Locale::isLocaleValid($locale) && in_array($locale, $availableLocales)) { array_push($locales, $locale); } } $user->setLocales($locales); $userDao =& DAORegistry::getDAO('UserDAO'); $userDao->updateObject($user); $roleDao =& DAORegistry::getDAO('RoleDAO'); $schedConfDao =& DAORegistry::getDAO('SchedConfDAO'); // Roles $schedConf =& Request::getSchedConf(); if ($schedConf) { import('schedConf.SchedConfAction'); $role = new Role(); $role->setUserId($user->getId()); $role->setConferenceId($schedConf->getConferenceId()); $role->setSchedConfId($schedConf->getId()); if (SchedConfAction::allowRegReviewer($schedConf)) { $role->setRoleId(ROLE_ID_REVIEWER); $hasRole = Validation::isReviewer(); $wantsRole = Request::getUserVar('reviewerRole'); if ($hasRole && !$wantsRole) { $roleDao->deleteRole($role); } if (!$hasRole && $wantsRole) { $roleDao->insertRole($role); } } if (SchedConfAction::allowRegAuthor($schedConf)) { $role->setRoleId(ROLE_ID_AUTHOR); $hasRole = Validation::isAuthor(); $wantsRole = Request::getUserVar('authorRole'); if ($hasRole && !$wantsRole) { $roleDao->deleteRole($role); } if (!$hasRole && $wantsRole) { $roleDao->insertRole($role); } } if (SchedConfAction::allowRegReader($schedConf)) { $role->setRoleId(ROLE_ID_READER); $hasRole = Validation::isReader(); $wantsRole = Request::getUserVar('readerRole'); if ($hasRole && !$wantsRole) { $roleDao->deleteRole($role); } if (!$hasRole && $wantsRole) { $roleDao->insertRole($role); } } } $openAccessNotify = Request::getUserVar('openAccessNotify'); $userSettingsDao =& DAORegistry::getDAO('UserSettingsDAO'); $schedConfs =& $schedConfDao->getSchedConfs(); $schedConfs =& $schedConfs->toArray(); foreach ($schedConfs as $thisSchedConf) { if ($thisSchedConf->getSetting('enableOpenAccessNotification') == true) { $currentlyReceives = $user->getSetting('openAccessNotification', $thisSchedConf->getId()); $shouldReceive = !empty($openAccessNotify) && in_array($thisSchedConf->getId(), $openAccessNotify); if ($currentlyReceives != $shouldReceive) { $userSettingsDao->updateSetting($user->getId(), 'openAccessNotification', $shouldReceive, 'bool', $thisSchedConf->getId()); } } } if ($user->getAuthId()) { $authDao =& DAORegistry::getDAO('AuthSourceDAO'); $auth =& $authDao->getPlugin($user->getAuthId()); } if (isset($auth)) { $auth->doSetUserInfo($user); } }
/** * Checks if user has registration * @return bool */ function registeredUser(&$schedConf) { $user =& Request::getUser(); $registrationDao = DAORegistry::getDAO('RegistrationDAO'); $result = false; if (isset($user) && isset($schedConf)) { if (SchedConfAction::entitledUser($schedConf)) { return true; } $result = $registrationDao->isValidRegistration(null, null, $user->getId(), $schedConf->getId()); } HookRegistry::call('SchedConfAction::registeredUser', array(&$schedConf, &$result)); return $result; }
/** * Save profile settings. */ function execute($request) { $user = $this->getUser(); $user->setTimeZone($this->getData('timeZone')); $roleDao = DAORegistry::getDAO('RoleDAO'); $schedConfDao = DAORegistry::getDAO('SchedConfDAO'); // Roles $schedConf = Request::getSchedConf(); if ($schedConf) { import('classes.schedConf.SchedConfAction'); $role = new Role(); $role->setUserId($user->getId()); $role->setConferenceId($schedConf->getConferenceId()); $role->setSchedConfId($schedConf->getId()); if (SchedConfAction::allowRegReviewer($schedConf)) { $role->setRoleId(ROLE_ID_REVIEWER); $hasRole = Validation::isReviewer(); $wantsRole = Request::getUserVar('reviewerRole'); if ($hasRole && !$wantsRole) { $roleDao->deleteRole($role); } if (!$hasRole && $wantsRole) { $roleDao->insertRole($role); } } if (SchedConfAction::allowRegAuthor($schedConf)) { $role->setRoleId(ROLE_ID_AUTHOR); $hasRole = Validation::isAuthor(); $wantsRole = Request::getUserVar('authorRole'); if ($hasRole && !$wantsRole) { $roleDao->deleteRole($role); } if (!$hasRole && $wantsRole) { $roleDao->insertRole($role); } } if (SchedConfAction::allowRegReader($schedConf)) { $role->setRoleId(ROLE_ID_READER); $hasRole = Validation::isReader(); $wantsRole = Request::getUserVar('readerRole'); if ($hasRole && !$wantsRole) { $roleDao->deleteRole($role); } if (!$hasRole && $wantsRole) { $roleDao->insertRole($role); } } } $openAccessNotify = Request::getUserVar('openAccessNotify'); $userSettingsDao = DAORegistry::getDAO('UserSettingsDAO'); $schedConfs = $schedConfDao->getAll(); $schedConfs = $schedConfs->toArray(); foreach ($schedConfs as $thisSchedConf) { if ($thisSchedConf->getSetting('enableOpenAccessNotification') == true) { $currentlyReceives = $user->getSetting('openAccessNotification', $thisSchedConf->getId()); $shouldReceive = !empty($openAccessNotify) && in_array($thisSchedConf->getId(), $openAccessNotify); if ($currentlyReceives != $shouldReceive) { $userSettingsDao->updateSetting($user->getId(), 'openAccessNotification', $shouldReceive, 'bool', $thisSchedConf->getId()); } } } parent::execute($request); }
/** * @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; }