/** * Retrieve subscription type name by ID. * @param $typeId int * @return string */ function getSubscriptionTypeName($typeId) { $result = $this->retrieve('SELECT COALESCE(l.setting_value, p.setting_value) FROM subscription_type_settings l LEFT JOIN subscription_type_settings p ON (p.type_id = ? AND p.setting_name = ? AND p.locale = ?) WHERE l.type_id = ? AND l.setting_name = ? AND l.locale = ?', array($typeId, 'name', AppLocale::getLocale(), $typeId, 'name', AppLocale::getPrimaryLocale())); $returner = isset($result->fields[0]) ? $result->fields[0] : false; $result->Close(); return $returner; }
/** * Constructor. * @param $template string the path to the form template file */ function Form($template = null, $callHooks = true, $requiredLocale = null, $supportedLocales = null) { if ($requiredLocale === null) { $requiredLocale = AppLocale::getPrimaryLocale(); } $this->requiredLocale = $requiredLocale; if ($supportedLocales === null) { $supportedLocales = AppLocale::getSupportedFormLocales(); } $this->supportedLocales = $supportedLocales; $this->_template = $template; $this->_data = array(); $this->_checks = array(); $this->_errors = array(); $this->errorsArray = array(); $this->errorFields = array(); $this->formSectionErrors = array(); $this->fbvStyles = array('size' => array('SMALL' => 'SMALL', 'MEDIUM' => 'MEDIUM', 'LARGE' => 'LARGE'), 'float' => array('RIGHT' => 'RIGHT', 'LEFT' => 'LEFT'), 'align' => array('RIGHT' => 'RIGHT', 'LEFT' => 'LEFT'), 'measure' => array('1OF1' => '1OF1', '1OF2' => '1OF2', '1OF3' => '1OF3', '2OF3' => '2OF3', '1OF4' => '1OF4', '3OF4' => '3OF4', '1OF5' => '1OF5', '2OF5' => '2OF5', '3OF5' => '3OF5', '4OF5' => '4OF5', '1OF10' => '1OF10', '8OF10' => '8OF10'), 'layout' => array('THREE_COLUMNS' => 'THREE_COLUMNS', 'TWO_COLUMNS' => 'TWO_COLUMNS', 'ONE_COLUMN' => 'ONE_COLUMN')); if ($callHooks === true) { // Call hooks based on the calling entity, assuming // this method is only called by a subclass. Results // in hook calls named e.g. "papergalleyform::Constructor" // Note that class names are always lower case. HookRegistry::call(strtolower(get_class($this)) . '::Constructor', array(&$this, &$template)); } }
/** * Constructor. * @param $template string the path to the form template file */ function __construct($template = null, $callHooks = true, $requiredLocale = null, $supportedLocales = null) { if ($requiredLocale === null) { $requiredLocale = AppLocale::getPrimaryLocale(); } $this->requiredLocale = $requiredLocale; if ($supportedLocales === null) { $supportedLocales = AppLocale::getSupportedFormLocales(); } $this->supportedLocales = $supportedLocales; $this->_template = $template; $this->_data = array(); $this->_checks = array(); $this->_errors = array(); $this->errorsArray = array(); $this->errorFields = array(); $this->formSectionErrors = array(); if ($callHooks === true) { // Call hooks based on the calling entity, assuming // this method is only called by a subclass. Results // in hook calls named e.g. "papergalleyform::Constructor" // Note that class names are always lower case. HookRegistry::call(strtolower_codesafe(get_class($this)) . '::Constructor', array($this, &$template)); } }
/** * Insert a new submission file. * @param $submissionFile SubmissionFile * @param $sourceFile string The place where the physical file * resides right now or the file name in the case of an upload. * The file will be copied to its canonical target location. * @param $isUpload boolean set to true if the file has just been * uploaded. * @return SubmissionFile the inserted file */ function insertObject($submissionFile, $sourceFile, $isUpload = false) { $fileId = $submissionFile->getFileId(); if (!is_numeric($submissionFile->getRevision())) { // Set the initial revision. $submissionFile->setRevision(1); } if (!is_bool($submissionFile->getViewable())) { // Set the viewable default. $submissionFile->setViewable(false); } $params = array((int) $submissionFile->getRevision(), (int) $submissionFile->getSubmissionId(), is_null($submissionFile->getSourceFileId()) ? null : (int) $submissionFile->getSourceFileId(), is_null($submissionFile->getSourceRevision()) ? null : (int) $submissionFile->getSourceRevision(), $submissionFile->getFileType(), (int) $submissionFile->getFileSize(), $submissionFile->getOriginalFileName(), (int) $submissionFile->getFileStage(), (bool) $submissionFile->getViewable() ? 1 : 0, is_null($submissionFile->getUploaderUserId()) ? null : (int) $submissionFile->getUploaderUserId(), is_null($submissionFile->getUserGroupId()) ? null : (int) $submissionFile->getUserGroupId(), is_null($submissionFile->getAssocType()) ? null : (int) $submissionFile->getAssocType(), is_null($submissionFile->getAssocId()) ? null : (int) $submissionFile->getAssocId(), is_null($submissionFile->getGenreId()) ? null : (int) $submissionFile->getGenreId(), $submissionFile->getDirectSalesPrice(), $submissionFile->getSalesType()); if ($fileId) { array_unshift($params, (int) $fileId); } $this->update(sprintf('INSERT INTO submission_files (' . ($fileId ? 'file_id, ' : '') . 'revision, submission_id, source_file_id, source_revision, file_type, file_size, original_file_name, file_stage, date_uploaded, date_modified, viewable, uploader_user_id, user_group_id, assoc_type, assoc_id, genre_id, direct_sales_price, sales_type) VALUES (' . ($fileId ? '?, ' : '') . '?, ?, ?, ?, ?, ?, ?, ?, %s, %s, ?, ?, ?, ?, ?, ?, ?, ?)', $this->datetimeToDB($submissionFile->getDateUploaded()), $this->datetimeToDB($submissionFile->getDateModified())), $params); if (!$fileId) { $submissionFile->setFileId($this->_getInsertId('submission_files', 'file_id')); } $reviewStage = in_array($submissionFile->getFileStage(), array(SUBMISSION_FILE_REVIEW_FILE, SUBMISSION_FILE_REVIEW_ATTACHMENT, SUBMISSION_FILE_REVIEW_REVISION)); if (!$submissionFile->getName(AppLocale::getPrimaryLocale())) { if ($reviewStage) { $submissionFile->setName($submissionFile->_generateName(true), AppLocale::getPrimaryLocale()); } else { $submissionFile->setName($submissionFile->_generateName(), AppLocale::getPrimaryLocale()); } } else { if ($reviewStage && $submissionFile->getName(AppLocale::getPrimaryLocale()) == $submissionFile->_generateName()) { $submissionFile->setName($submissionFile->_generateName(true), AppLocale::getPrimaryLocale()); } } $this->updateLocaleFields($submissionFile); // Determine the final destination of the file (requires // the file id we just generated). $targetFilePath = $submissionFile->getFilePath(); // Only copy the file if it is not yet in the target position. if ($isUpload || $sourceFile != $targetFilePath) { // Copy the file from its current location to the target destination. import('lib.pkp.classes.file.FileManager'); $fileManager = new FileManager(); if ($isUpload) { $success = $fileManager->uploadFile($sourceFile, $targetFilePath); } else { assert(is_readable($sourceFile)); $success = $fileManager->copyFile($sourceFile, $targetFilePath); } if (!$success) { // If the copy/upload operation fails then remove // the already inserted meta-data. $this->deleteObject($submissionFile); $nullVar = null; return $nullVar; } } assert(is_readable($targetFilePath)); return $submissionFile; }
/** * Retrieve announcement type name by ID. * @param $typeId int * @return string */ function getAnnouncementTypeName($typeId) { $result = $this->retrieve('SELECT COALESCE(l.setting_value, p.setting_value) FROM announcement_type_settings p LEFT JOIN announcement_type_settings l ON (l.type_id = ? AND l.setting_name = ? AND l.locale = ?) WHERE p.type_id = ? AND p.setting_name = ? AND p.locale = ?', array((int) $typeId, 'name', AppLocale::getLocale(), (int) $typeId, 'name', AppLocale::getPrimaryLocale())); $returner = isset($result->fields[0]) ? $result->fields[0] : false; $result->Close(); return $returner; }
/** * Iterate through the localized params for a notification's locale key. * For each parameter, return (in preferred order) a value for the user's current locale, * a param for the journal's default locale, or the first value (in case the value * is not localized) * @param $params array * @return array */ public function getParamsForCurrentLocale($params) { $locale = AppLocale::getLocale(); $primaryLocale = AppLocale::getPrimaryLocale(); $localizedParams = array(); foreach ($params as $name => $value) { if (!is_array($value)) { // Non-localized text $localizedParams[$name] = $value; } elseif (isset($value[$locale])) { // Check if the parameter is in the user's current locale $localizedParams[$name] = $value[$locale]; } elseif (isset($value[$primaryLocale])) { // Check if the parameter is in the default site locale $localizedParams[$name] = $value[$primaryLocale]; } else { // Otherwise, iterate over all supported locales and return the first match $locales = AppLocale::getSupportedLocales(); foreach ($locales as $localeKey) { if (isset($value[$localeKey])) { $localizedParams[$name] = $value[$localeKey]; } } } } return $localizedParams; }
/** * Check to make sure form conditions are met */ function validate() { // Ensure all submission types have names in the primary locale // as well as numeric word limits (optional) $primaryLocale = AppLocale::getPrimaryLocale(); if (isset($this->_data['paperTypes'])) { $paperTypes =& $this->_data['paperTypes']; if (!is_array($paperTypes)) { return false; } foreach ($paperTypes as $paperTypeId => $paperType) { if (!isset($paperType['name'][$primaryLocale]) || empty($paperType['name'][$primaryLocale])) { $fieldName = 'paperTypeName-' . $paperTypeId; $this->addError($fieldName, __('manager.schedConfSetup.submissions.typeOfSubmission.nameMissing', array('primaryLocale' => $primaryLocale))); $this->addErrorField($fieldName); } if (isset($paperType['abstractLength']) && !empty($paperType['abstractLength']) && (!is_numeric($paperType['abstractLength']) || $paperType['abstractLength'] <= 0)) { $fieldName = 'paperTypeAbstractLength-' . $paperTypeId; $this->addError($fieldName, __('manager.schedConfSetup.submissions.typeOfSubmission.abstractLengthInvalid')); $this->addErrorField($fieldName); } } } return parent::validate(); }
/** * Constructor. * @param $form Form the associated form * @param $field string the name of the associated field * @param $type string the type of check, either "required" or "optional" * @param $message string the error message for validation failures (i18n key) * @param $validator Validator the validator used to validate this form field (optional) * @param $requiredLocale The name of the required locale, i.e. en_US */ function __construct(&$form, $field, $type, $message, $requiredLocale = null, $validator = null) { parent::__construct($form, $field, $type, $message, $validator); if ($requiredLocale === null) { $requiredLocale = AppLocale::getPrimaryLocale(); } $this->_requiredLocale = $requiredLocale; }
/** * Retrieve registration option name by ID. * @param $optionId int * @return string */ function getRegistrationOptionName($optionId) { $result =& $this->retrieve('SELECT COALESCE(l.setting_value, p.setting_value) FROM registration_option_settings l LEFT JOIN registration_option_settings p ON (p.option_id = ? AND p.setting_name = ? AND p.locale = ?) WHERE l.option_id = ? AND l.setting_name = ? AND l.locale = ?', array($optionId, 'name', AppLocale::getLocale(), $optionId, 'name', AppLocale::getPrimaryLocale())); $returner = isset($result->fields[0]) ? $result->fields[0] : false; $result->Close(); unset($result); return $returner; }
function lockss($args, $request) { $this->validate(); $this->setupTemplate(); $journal =& $request->getJournal(); $templateMgr =& TemplateManager::getManager(); if ($journal != null) { if (!$journal->getSetting('enableLockss')) { $request->redirect(null, 'index'); } $year = $request->getUserVar('year'); $issueDao =& DAORegistry::getDAO('IssueDAO'); // FIXME Should probably go in IssueDAO or a subclass if (isset($year)) { $year = (int) $year; $result =& $issueDao->retrieve('SELECT * FROM issues WHERE journal_id = ? AND year = ? AND published = 1 ORDER BY current DESC, year ASC, volume ASC, number ASC', array($journal->getId(), $year)); if ($result->RecordCount() == 0) { unset($year); } } if (!isset($year)) { $showInfo = true; $result =& $issueDao->retrieve('SELECT MAX(year) FROM issues WHERE journal_id = ? AND published = 1', $journal->getId()); list($year) = $result->fields; $result =& $issueDao->retrieve('SELECT * FROM issues WHERE journal_id = ? AND year = ? AND published = 1 ORDER BY current DESC, year ASC, volume ASC, number ASC', array($journal->getId(), $year)); } else { $showInfo = false; } $issues = new DAOResultFactory($result, $issueDao, '_returnIssueFromRow'); $prevYear = null; $nextYear = null; if (isset($year)) { $result =& $issueDao->retrieve('SELECT MAX(year) FROM issues WHERE journal_id = ? AND published = 1 AND year < ?', array($journal->getId(), $year)); list($prevYear) = $result->fields; $result =& $issueDao->retrieve('SELECT MIN(year) FROM issues WHERE journal_id = ? AND published = 1 AND year > ?', array($journal->getId(), $year)); list($nextYear) = $result->fields; } $templateMgr->assign_by_ref('journal', $journal); $templateMgr->assign_by_ref('issues', $issues); $templateMgr->assign('year', $year); $templateMgr->assign('prevYear', $prevYear); $templateMgr->assign('nextYear', $nextYear); $templateMgr->assign('showInfo', $showInfo); $locales =& $journal->getSupportedLocaleNames(); if (!isset($locales) || empty($locales)) { $localeNames =& AppLocale::getAllLocales(); $primaryLocale = AppLocale::getPrimaryLocale(); $locales = array($primaryLocale => $localeNames[$primaryLocale]); } $templateMgr->assign_by_ref('locales', $locales); } else { $journalDao =& DAORegistry::getDAO('JournalDAO'); $journals =& $journalDao->getJournals(true); $templateMgr->assign_by_ref('journals', $journals); } $templateMgr->display('gateway/lockss.tpl'); }
/** * Get localized favicon * @return string */ function getLocalizedFavicon() { $faviconArray = $this->getSetting('journalFavicon'); foreach (array(AppLocale::getLocale(), AppLocale::getPrimaryLocale()) as $locale) { if (isset($faviconArray[$locale])) { return $faviconArray[$locale]; } } return null; }
/** * Get "localized" press page logo (if applicable). * @return string */ function getPageHeaderLogo() { $logoArray = $this->getSetting('pageHeaderLogoImage'); foreach (array(AppLocale::getLocale(), AppLocale::getPrimaryLocale()) as $locale) { if (isset($logoArray[$locale])) { return $logoArray[$locale]; } } return null; }
/** * Get the localized location for citations in this journal * @param $journal Journal * @return string */ function getLocalizedLocation($journal) { $settings = $this->getSetting($journal->getId(), 'location'); if ($settings === null) { return null; } $location = $settings[AppLocale::getLocale()]; if (empty($location)) { $location = $settings[AppLocale::getPrimaryLocale()]; } return $location; }
/** * Get the registrant report data. * @param $conferenceId int * @param $schedConfId int * @return array */ function getRegistrantReport($conferenceId, $schedConfId) { $primaryLocale = AppLocale::getPrimaryLocale(); $locale = AppLocale::getLocale(); $result =& $this->retrieve('SELECT r.registration_id AS registration_id, r.user_id AS userid, u.username AS uname, u.first_name AS fname, u.middle_name AS mname, u.last_name AS lname, u.affiliation AS affiliation, u.url AS url, u.email AS email, u.phone AS phone, u.fax AS fax, u.mailing_address AS address, u.country AS country, COALESCE(rtsl.setting_value, rtspl.setting_value) AS type, r.date_registered AS regdate, r.date_paid AS paiddate, r.special_requests AS specialreq FROM registrations r LEFT JOIN users u ON r.user_id=u.user_id LEFT JOIN registration_type_settings rtsl ON (r.type_id=rtsl.type_id AND rtsl.locale=? AND rtsl.setting_name=?) LEFT JOIN registration_type_settings rtspl ON (r.type_id=rtspl.type_id AND rtsl.locale=? AND rtspl.setting_name=?) WHERE r.sched_conf_id = ? ORDER BY lname', array($locale, 'name', $primaryLocale, 'name', (int) $schedConfId)); // prepare an iterator of all the registration information $registrationReturner = new DBRowIterator($result); $result =& $this->retrieve('SELECT r.registration_id as registration_id, roa.option_id as option_id FROM registrations r LEFT JOIN registration_option_assoc roa ON (r.registration_id = roa.registration_id) WHERE r.sched_conf_id = ?', (int) $schedConfId); // Prepare an array of registration Options by registration Id $registrationOptionDAO =& DAORegistry::getDAO('RegistrationOptionDAO'); $iterator = new DBRowIterator($result); $registrationOptionReturner = array(); while ($row =& $iterator->next()) { $registrationId = $row['registration_id']; $registrationOptionReturner[$registrationId] =& $registrationOptionDAO->getRegistrationOptions($registrationId); } return array($registrationReturner, $registrationOptionReturner); }
/** * @see FormValidator::getFieldValue() * @return mixed */ function getFieldValue() { $form =& $this->getForm(); $data = $form->getData($this->getField()); $primaryLocale = AppLocale::getPrimaryLocale(); $fieldValue = ''; if (is_array($data) && isset($data[$primaryLocale])) { $fieldValue = $data[$primaryLocale]; if (is_scalar($fieldValue)) { $fieldValue = trim((string) $fieldValue); } } return $fieldValue; }
/** * Display aboutThisPublishingSystem page. * @param $args array * @param $request PKPRequest */ function aboutThisPublishingSystem($args, $request) { $versionDao = DAORegistry::getDAO('VersionDAO'); $version = $versionDao->getCurrentVersion(); $templateMgr = TemplateManager::getManager($request); $templateMgr->assign('appVersion', $version->getVersionString(false)); foreach (array(AppLocale::getLocale(), $primaryLocale = AppLocale::getPrimaryLocale(), 'en_US') as $locale) { $pubProcessFile = 'locale/' . $locale . '/pubprocesslarge.png'; if (file_exists($pubProcessFile)) { break; } } $templateMgr->assign('pubProcessFile', $pubProcessFile); $templateMgr->display('frontend/pages/aboutThisPublishingSystem.tpl'); }
/** * Constructor. * @param $form Form the associated form * @param $field string the name of the associated field * @param $type string the type of check, either "required" or "optional" * @param $message string the error message for validation failures (i18n key) * @param $validator Validator the validator used to validate this form field (optional) * @param $requiredLocale The name of the required locale, i.e. en_US */ function FormValidatorLocale(&$form, $field, $type, $message, $requiredLocale = null, $validator = null) { $this->_form =& $form; $this->_field = $field; $this->_type = $type; $this->_message = $message; $this->_validator =& $validator; if ($requiredLocale === null) { $requiredLocale = AppLocale::getPrimaryLocale(); } $this->_requiredLocale = $requiredLocale; $form->cssValidation[$field] = array(); if ($type == FORM_VALIDATOR_REQUIRED_VALUE) { array_push($form->cssValidation[$field], 'required'); } }
/** * Retrieve all published authors for a journal in an associative array by * the first letter of the last name, for example: * $returnedArray['S'] gives array($misterSmithObject, $misterSmytheObject, ...) * Keys will appear in sorted order. Note that if journalId is null, * alphabetized authors for all enabled journals are returned. * @param $journalId int Optional journal ID to restrict results to * @param $initial An initial the last names must begin with * @param $rangeInfo Range information * @param $includeEmail Whether or not to include the email in the select distinct * @param $disallowRepeatedEmail Whether or not to include duplicated emails in the array * @return array Authors ordered by sequence */ function &getAuthorsAlphabetizedByJournal($journalId = null, $initial = null, $rangeInfo = null, $includeEmail = false, $disallowRepeatedEmail = false) { $authors = array(); $params = array('affiliation', AppLocale::getPrimaryLocale(), 'affiliation', AppLocale::getLocale()); if (isset($journalId)) { $params[] = $journalId; } $params[] = AUTHOR_TOC_DEFAULT; $params[] = AUTHOR_TOC_SHOW; if (isset($initial)) { $params[] = String::strtolower($initial) . '%'; $initialSql = ' AND LOWER(aa.last_name) LIKE LOWER(?)'; } else { $initialSql = ''; } $result =& $this->retrieveRange('SELECT DISTINCT CAST(\'\' AS CHAR) AS url, 0 AS author_id, 0 AS submission_id, ' . ($includeEmail ? 'aa.email AS email,' : 'CAST(\'\' AS CHAR) AS email,') . ' 0 AS primary_contact, 0 AS seq, aa.first_name, aa.middle_name, aa.last_name, CASE WHEN asl.setting_value = \'\' THEN NULL ELSE SUBSTRING(asl.setting_value FROM 1 FOR 255) END AS affiliation_l, CASE WHEN asl.setting_value = \'\' THEN NULL ELSE asl.locale END AS locale, CASE WHEN aspl.setting_value = \'\' THEN NULL ELSE SUBSTRING(aspl.setting_value FROM 1 FOR 255) END AS affiliation_pl, CASE WHEN aspl.setting_value = \'\' THEN NULL ELSE aspl.locale END AS primary_locale, CASE WHEN aa.country = \'\' THEN NULL ELSE aa.country END AS country FROM authors aa LEFT JOIN author_settings aspl ON (aa.author_id = aspl.author_id AND aspl.setting_name = ? AND aspl.locale = ?) LEFT JOIN author_settings asl ON (aa.author_id = asl.author_id AND asl.setting_name = ? AND asl.locale = ?) ' . ($disallowRepeatedEmail ? " LEFT JOIN authors aa2 ON (aa.email=aa2.email AND aa.author_id < aa2.author_id) " : "") . ' JOIN articles a ON (a.article_id = aa.submission_id AND a.status = ' . STATUS_PUBLISHED . ') JOIN published_articles pa ON (pa.article_id = a.article_id) JOIN issues i ON (pa.issue_id = i.issue_id AND i.published = 1) JOIN sections s ON (a.section_id = s.section_id) JOIN journals j ON (a.journal_id = j.journal_id) WHERE ' . (isset($journalId) ? 'a.journal_id = ?' : 'j.enabled = 1') . ' AND (aa.last_name IS NOT NULL AND aa.last_name <> \'\') AND ((s.hide_author = 0 AND a.hide_author = ?) OR a.hide_author = ?) ' . ($disallowRepeatedEmail ? ' AND aa2.email IS NULL ' : '') . $initialSql . ' ORDER BY aa.last_name, aa.first_name', $params, $rangeInfo); $returner = new DAOResultFactory($result, $this, '_returnSimpleAuthorFromRow'); return $returner; }
/** * Retrieve all published authors for a journal in an associative array by * the first letter of the last name, for example: * $returnedArray['S'] gives array($misterSmithObject, $misterSmytheObject, ...) * Keys will appear in sorted order. Note that if journalId is null, * alphabetized authors for all journals are returned. * @param $journalId int * @param $initial An initial the last names must begin with * @param $rangeInfo Range information * @param $includeEmail Whether or not to include the email in the select distinct * @return array Authors ordered by sequence */ function &getAuthorsAlphabetizedByJournal($journalId = null, $initial = null, $rangeInfo = null, $includeEmail = false) { $authors = array(); $params = array('affiliation', AppLocale::getPrimaryLocale(), 'affiliation', AppLocale::getLocale()); if (isset($journalId)) { $params[] = $journalId; } if (isset($initial)) { $params[] = String::strtolower($initial) . '%'; $initialSql = ' AND LOWER(aa.last_name) LIKE LOWER(?)'; } else { $initialSql = ''; } $result =& $this->retrieveRange('SELECT DISTINCT CAST(\'\' AS CHAR) AS url, 0 AS author_id, 0 AS submission_id, ' . ($includeEmail ? 'aa.email AS email,' : 'CAST(\'\' AS CHAR) AS email,') . ' 0 AS primary_contact, 0 AS seq, aa.first_name, aa.middle_name, aa.last_name, SUBSTRING(asl.setting_value FROM 1 FOR 255) AS affiliation_l, asl.locale, SUBSTRING(aspl.setting_value FROM 1 FOR 255) AS affiliation_pl, aspl.locale AS primary_locale, aa.country FROM authors aa LEFT JOIN author_settings aspl ON (aa.author_id = aspl.author_id AND aspl.setting_name = ? AND aspl.locale = ?) LEFT JOIN author_settings asl ON (aa.author_id = asl.author_id AND asl.setting_name = ? AND asl.locale = ?) LEFT JOIN articles a ON (a.article_id = aa.submission_id) LEFT JOIN published_articles pa ON (pa.article_id = a.article_id) LEFT JOIN issues i ON (pa.issue_id = i.issue_id) WHERE i.published = 1 AND aa.submission_id = a.article_id AND ' . (isset($journalId) ? 'a.journal_id = ? AND ' : '') . ' pa.article_id = a.article_id AND a.status = ' . STATUS_PUBLISHED . ' AND (aa.last_name IS NOT NULL AND aa.last_name <> \'\')' . $initialSql . ' ORDER BY aa.last_name, aa.first_name', $params, $rangeInfo); $returner = new DAOResultFactory($result, $this, '_returnSimpleAuthorFromRow'); return $returner; }
/** * Retrieve all published authors for a press in an associative array by * the first letter of the last name, for example: * $returnedArray['S'] gives array($misterSmithObject, $misterSmytheObject, ...) * Keys will appear in sorted order. Note that if pressId is null, * alphabetized authors for all presses are returned. * @param $pressId int * @param $initial An initial the last names must begin with * @return array Authors ordered by sequence */ function getAuthorsAlphabetizedByPress($pressId = null, $initial = null, $rangeInfo = null) { $params = array('affiliation', AppLocale::getPrimaryLocale(), 'affiliation', AppLocale::getLocale()); if (isset($pressId)) { $params[] = $pressId; } if (isset($initial)) { $params[] = PKPString::strtolower($initial) . '%'; $initialSql = ' AND LOWER(a.last_name) LIKE LOWER(?)'; } else { $initialSql = ''; } $result = $this->retrieveRange('SELECT DISTINCT CAST(\'\' AS CHAR) AS url, a.author_id AS author_id, a.submission_id AS submission_id, CAST(\'\' AS CHAR) AS email, 0 AS primary_contact, 0 AS seq, a.first_name AS first_name, a.middle_name AS middle_name, a.last_name AS last_name, asl.setting_value AS affiliation_l, asl.locale, aspl.setting_value AS affiliation_pl, aspl.locale AS primary_locale, a.suffix AS suffix, a.user_group_id AS user_group_id, a.include_in_browse AS include_in_browse, 0 AS show_title, a.country FROM authors a LEFT JOIN author_settings aspl ON (a.author_id = aspl.author_id AND aspl.setting_name = ? AND aspl.locale = ?) LEFT JOIN author_settings asl ON (a.author_id = asl.author_id AND asl.setting_name = ? AND asl.locale = ?) JOIN submissions s ON (a.submission_id = s.submission_id) WHERE s.status = ' . STATUS_PUBLISHED . ' ' . (isset($pressId) ? 'AND s.context_id = ? ' : '') . ' AND (a.last_name IS NOT NULL AND a.last_name <> \'\')' . $initialSql . ' ORDER BY a.last_name, a.first_name', $params, $rangeInfo); return new DAOResultFactory($result, $this, '_fromRow'); }
/** * Get all authors for a given chapter. * @param $chapterId int * @param $monographId int * @return DAOResultFactory */ function getAuthors($monographId = null, $chapterId = null) { $params = array('affiliation', AppLocale::getPrimaryLocale(), 'affiliation', AppLocale::getLocale()); if (isset($monographId)) { $params[] = (int) $monographId; } if (isset($chapterId)) { $params[] = (int) $chapterId; } // get all the monograph_author fields, // but replace the primary_contact and seq with submission_chapter_authors.primary_contact $sql = 'SELECT a.author_id, a.submission_id, sca.chapter_id, sca.primary_contact, sca.seq, a.first_name, a.middle_name, a.last_name, a.suffix, a.include_in_browse, ug.show_title, asl.setting_value AS affiliation_l, asl.locale, aspl.setting_value AS affiliation_pl, aspl.locale AS primary_locale, a.country, a.email, a.url, a.user_group_id FROM authors a JOIN submission_chapter_authors sca ON (a.author_id = sca.author_id) JOIN user_groups ug ON (a.user_group_id = ug.user_group_id) LEFT JOIN author_settings aspl ON (sca.author_id = aspl.author_id AND aspl.setting_name = ? AND aspl.locale = ?) LEFT JOIN author_settings asl ON (sca.author_id = asl.author_id AND asl.setting_name = ? AND asl.locale = ?)' . (count($params) > 0 ? ' WHERE' : '') . (isset($monographId) ? ' a.submission_id = ?' : '') . (isset($monographId) && isset($chapterId) ? ' AND' : '') . (isset($chapterId) ? ' sca.chapter_id = ?' : '') . ' ORDER BY sca.chapter_id, sca.seq'; $result = $this->retrieve($sql, $params); return new DAOResultFactory($result, $this, '_returnFromRow', array('id')); }
/** * Get the review report data. * @param $journalId int * @return array */ function getReviewReport($journalId) { $primaryLocale = AppLocale::getPrimaryLocale(); $locale = AppLocale::getLocale(); $result =& $this->retrieve('SELECT article_id, comments, author_id FROM article_comments WHERE comment_type = ?', array(COMMENT_TYPE_PEER_REVIEW)); import('lib.pkp.classes.db.DBRowIterator'); $commentsReturner = new DBRowIterator($result); $result =& $this->retrieve('SELECT r.round AS round, COALESCE(asl.setting_value, aspl.setting_value) AS article, a.article_id AS articleId, u.user_id AS reviewerId, u.username AS reviewer, u.first_name AS firstName, u.middle_name AS middleName, u.last_name AS lastName, r.date_assigned AS dateAssigned, r.date_notified AS dateNotified, r.date_confirmed AS dateConfirmed, r.date_completed AS dateCompleted, r.date_reminded AS dateReminded, (r.declined=1) AS declined, (r.cancelled=1) AS cancelled, r.recommendation AS recommendation FROM review_assignments r LEFT JOIN articles a ON r.submission_id = a.article_id LEFT JOIN article_settings asl ON (a.article_id=asl.article_id AND asl.locale=? AND asl.setting_name=?) LEFT JOIN article_settings aspl ON (a.article_id=aspl.article_id AND aspl.locale=a.locale AND aspl.setting_name=?), users u WHERE u.user_id=r.reviewer_id AND a.journal_id= ? ORDER BY article', array($locale, 'title', 'title', $journalId)); $reviewsReturner = new DBRowIterator($result); return array($commentsReturner, $reviewsReturner); }
/** * Get the review report data. * @param $conferenceId int * @param $schedConfId int * @return array */ function getReviewReport($schedConfId) { $primaryLocale = AppLocale::getPrimaryLocale(); $locale = AppLocale::getLocale(); $result =& $this->retrieve('SELECT paper_id, comments, author_id FROM paper_comments WHERE comment_type = ?', array(COMMENT_TYPE_PEER_REVIEW)); import('db.DBRowIterator'); $commentsReturner = new DBRowIterator($result); $result =& $this->retrieve('SELECT r.stage AS reviewStage, COALESCE(psl.setting_value, pspl.setting_value) AS paper, p.paper_id AS paperId, u.user_id AS reviewerId, u.username AS reviewer, u.first_name AS firstName, u.middle_name AS middleName, u.last_name AS lastName, r.date_assigned AS dateAssigned, r.date_notified AS dateNotified, r.date_confirmed AS dateConfirmed, r.date_completed AS dateCompleted, r.date_reminded AS dateReminded, (r.declined=1) AS declined, (r.cancelled=1) AS cancelled, r.recommendation AS recommendation FROM review_assignments r LEFT JOIN papers p ON r.paper_id=p.paper_id LEFT JOIN paper_settings psl ON (p.paper_id=psl.paper_id AND psl.locale=? AND psl.setting_name=?) LEFT JOIN paper_settings pspl ON (p.paper_id=pspl.paper_id AND pspl.locale=? AND pspl.setting_name=?), users u WHERE u.user_id=r.reviewer_id AND p.sched_conf_id= ? ORDER BY paper', array($locale, 'title', $primaryLocale, 'title', $schedConfId)); $reviewsReturner = new DBRowIterator($result); return array($commentsReturner, $reviewsReturner); }
/** * Retrieve a section editor submission by article ID. * @param $articleId int * @return SectionEditorSubmission */ function getSectionEditorSubmission($articleId) { $primaryLocale = AppLocale::getPrimaryLocale(); $locale = AppLocale::getLocale(); $result = $this->retrieve('SELECT a.*, pa.date_published, COALESCE(stl.setting_value, stpl.setting_value) AS section_title, COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev, r2.review_revision FROM submissions a LEFT JOIN published_submissions pa ON (a.submission_id = pa.submission_id) LEFT JOIN sections s ON (s.section_id = a.section_id) LEFT JOIN review_rounds r2 ON (a.submission_id = r2.submission_id AND a.current_round = r2.round) LEFT JOIN section_settings stpl ON (s.section_id = stpl.section_id AND stpl.setting_name = ? AND stpl.locale = ?) LEFT JOIN section_settings stl ON (s.section_id = stl.section_id AND stl.setting_name = ? AND stl.locale = ?) LEFT JOIN section_settings sapl ON (s.section_id = sapl.section_id AND sapl.setting_name = ? AND sapl.locale = ?) LEFT JOIN section_settings sal ON (s.section_id = sal.section_id AND sal.setting_name = ? AND sal.locale = ?) WHERE a.submission_id = ?', array('title', $primaryLocale, 'title', $locale, 'abbrev', $primaryLocale, 'abbrev', $locale, $articleId)); $returner = null; if ($result->RecordCount() != 0) { $returner = $this->_returnSectionEditorSubmissionFromRow($result->GetRowAssoc(false)); } $result->Close(); return $returner; }
/** * Get all unfiltered submissions for a journal. * @param $journalId int * @param $sectionId int * @param $editorId int * @param $searchField int Symbolic SUBMISSION_FIELD_... identifier * @param $searchMatch string "is" or "contains" or "startsWith" * @param $search String to look in $searchField for * @param $dateField int Symbolic SUBMISSION_FIELD_DATE_... identifier * @param $dateFrom String date to search from * @param $dateTo String date to search to * @param $additionalWhereSql String additional SQL "where" clause info * @param $rangeInfo object * @return array result */ function &_getUnfilteredEditorSubmissions($journalId, $sectionId = 0, $editorId = 0, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $additionalWhereSql, $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) { $primaryLocale = AppLocale::getPrimaryLocale(); $locale = AppLocale::getLocale(); $params = array(ASSOC_TYPE_ARTICLE, 'SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, 'SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, 'SIGNOFF_LAYOUT', 'title', $primaryLocale, 'title', $locale, 'abbrev', $primaryLocale, 'abbrev', $locale, 'cleanTitle', 'cleanTitle', $locale, 'title', 'title', $locale, $journalId); $searchSql = ''; if (!empty($search)) { switch ($searchField) { case SUBMISSION_FIELD_ID: switch ($searchMatch) { case 'is': $params[] = (int) $search; $searchSql = ' AND a.article_id = ?'; break; case 'contains': $search = '%' . $search . '%'; $params[] = $search; $searchSql = ' AND CONCAT(a.article_id) LIKE ?'; break; case 'startsWith': $search = $search . '%'; $params[] = $search; $searchSql = 'AND CONCAT(a.article_id) LIKE ?'; break; } break; case SUBMISSION_FIELD_TITLE: if ($searchMatch === 'is') { $searchSql = ' AND LOWER(COALESCE(atl.setting_value, atpl.setting_value)) = LOWER(?)'; } elseif ($searchMatch === 'contains') { $searchSql = ' AND LOWER(COALESCE(atl.setting_value, atpl.setting_value)) LIKE LOWER(?)'; $search = '%' . $search . '%'; } else { // $searchMatch === 'startsWith' $searchSql = ' AND LOWER(COALESCE(atl.setting_value, atpl.setting_value)) LIKE LOWER(?)'; $search = $search . '%'; } $params[] = $search; break; case SUBMISSION_FIELD_AUTHOR: $searchSql = $this->_generateUserNameSearchSQL($search, $searchMatch, 'aa.', $params); break; case SUBMISSION_FIELD_EDITOR: $searchSql = $this->_generateUserNameSearchSQL($search, $searchMatch, 'ed.', $params); break; case SUBMISSION_FIELD_REVIEWER: $searchSql = $this->_generateUserNameSearchSQL($search, $searchMatch, 're.', $params); break; case SUBMISSION_FIELD_COPYEDITOR: $searchSql = $this->_generateUserNameSearchSQL($search, $searchMatch, 'ce.', $params); break; case SUBMISSION_FIELD_LAYOUTEDITOR: $searchSql = $this->_generateUserNameSearchSQL($search, $searchMatch, 'le.', $params); break; case SUBMISSION_FIELD_PROOFREADER: $searchSql = $this->_generateUserNameSearchSQL($search, $searchMatch, 'pe.', $params); break; } } if (!empty($dateFrom) || !empty($dateTo)) { switch ($dateField) { case SUBMISSION_FIELD_DATE_SUBMITTED: if (!empty($dateFrom)) { $searchSql .= ' AND a.date_submitted >= ' . $this->datetimeToDB($dateFrom); } if (!empty($dateTo)) { $searchSql .= ' AND a.date_submitted <= ' . $this->datetimeToDB($dateTo); } break; case SUBMISSION_FIELD_DATE_COPYEDIT_COMPLETE: if (!empty($dateFrom)) { $searchSql .= ' AND sfc.date_completed >= ' . $this->datetimeToDB($dateFrom); } if (!empty($dateTo)) { $searchSql .= ' AND scf.date_completed <= ' . $this->datetimeToDB($dateTo); } break; case SUBMISSION_FIELD_DATE_LAYOUT_COMPLETE: if (!empty($dateFrom)) { $searchSql .= ' AND sle.date_completed >= ' . $this->datetimeToDB($dateFrom); } if (!empty($dateTo)) { $searchSql .= ' AND sle.date_completed <= ' . $this->datetimeToDB($dateTo); } break; case SUBMISSION_FIELD_DATE_PROOFREADING_COMPLETE: if (!empty($dateFrom)) { $searchSql .= ' AND spr.date_completed >= ' . $this->datetimeToDB($dateFrom); } if (!empty($dateTo)) { $searchSql .= ' AND spr.date_completed <= ' . $this->datetimeToDB($dateTo); } break; } } $sql = 'SELECT DISTINCT a.*, scf.date_completed as copyedit_completed, spr.date_completed as proofread_completed, sle.date_completed as layout_completed, SUBSTRING(COALESCE(actl.setting_value, actpl.setting_value) FROM 1 FOR 255) AS submission_clean_title, aap.last_name AS author_name, SUBSTRING(COALESCE(stl.setting_value, stpl.setting_value) FROM 1 FOR 255) AS section_title, COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev FROM articles a LEFT JOIN authors aa ON (aa.submission_id = a.article_id) LEFT JOIN authors aap ON (aap.submission_id = a.article_id AND aap.primary_contact = 1) LEFT JOIN sections s ON (s.section_id = a.section_id) LEFT JOIN edit_assignments e ON (e.article_id = a.article_id) LEFT JOIN users ed ON (e.editor_id = ed.user_id) LEFT JOIN signoffs scf ON (a.article_id = scf.assoc_id AND scf.assoc_type = ? AND scf.symbolic = ?) LEFT JOIN users ce ON (scf.user_id = ce.user_id) LEFT JOIN signoffs spr ON (a.article_id = spr.assoc_id AND spr.assoc_type = ? AND spr.symbolic = ?) LEFT JOIN users pe ON (pe.user_id = spr.user_id) LEFT JOIN signoffs sle ON (a.article_id = sle.assoc_id AND sle.assoc_type = ? AND sle.symbolic = ?) LEFT JOIN users le ON (le.user_id = sle.user_id) LEFT JOIN review_assignments r ON (r.submission_id = a.article_id) LEFT JOIN users re ON (re.user_id = r.reviewer_id AND cancelled = 0) LEFT JOIN section_settings stpl ON (s.section_id = stpl.section_id AND stpl.setting_name = ? AND stpl.locale = ?) LEFT JOIN section_settings stl ON (s.section_id = stl.section_id AND stl.setting_name = ? AND stl.locale = ?) LEFT JOIN section_settings sapl ON (s.section_id = sapl.section_id AND sapl.setting_name = ? AND sapl.locale = ?) LEFT JOIN section_settings sal ON (s.section_id = sal.section_id AND sal.setting_name = ? AND sal.locale = ?) LEFT JOIN article_settings actpl ON (a.article_id = actpl.article_id AND actpl.setting_name = ? AND actpl.locale = a.locale) LEFT JOIN article_settings actl ON (a.article_id = actl.article_id AND actl.setting_name = ? AND actl.locale = ?) LEFT JOIN article_settings atpl ON (a.article_id = atpl.article_id AND atpl.setting_name = ? AND atpl.locale = a.locale) LEFT JOIN article_settings atl ON (a.article_id = atl.article_id AND atl.setting_name = ? AND atl.locale = ?) LEFT JOIN edit_assignments ea ON (a.article_id = ea.article_id) LEFT JOIN edit_assignments ea2 ON (a.article_id = ea2.article_id AND ea.edit_id < ea2.edit_id) LEFT JOIN edit_decisions edec ON (a.article_id = edec.article_id) LEFT JOIN edit_decisions edec2 ON (a.article_id = edec2.article_id AND edec.edit_decision_id < edec2.edit_decision_id) WHERE edec2.edit_decision_id IS NULL AND ea2.edit_id IS NULL AND a.journal_id = ? AND a.submission_progress = 0' . (!empty($additionalWhereSql) ? " AND ({$additionalWhereSql})" : ''); if ($sectionId) { $searchSql .= ' AND a.section_id = ?'; $params[] = $sectionId; } if ($editorId) { $searchSql .= ' AND e.editor_id = ?'; $params[] = $editorId; } $result =& $this->retrieveRange($sql . ' ' . $searchSql . ($sortBy ? ' ORDER BY ' . $this->getSortMapping($sortBy) . ' ' . $this->getDirectionMapping($sortDirection) : ''), count($params) === 1 ? array_shift($params) : $params, $rangeInfo); return $result; }
/** * Get a localized context setting by name. * @param $name string * @return mixed */ function &getLocalizedSetting($name) { $returner = $this->getSetting($name, AppLocale::getLocale()); if ($returner === null) { $returner = $this->getSetting($name, AppLocale::getPrimaryLocale()); } return $returner; }
/** * Parse an XML users file into a set of users to import. * @param $file string path to the XML file to parse * @return array ImportedUsers the collection of users read from the file */ function &parseData($file) { $roleDao =& DAORegistry::getDAO('RoleDAO'); $success = true; $this->usersToImport = array(); $tree = $this->parser->parse($file); $journalDao =& DAORegistry::getDAO('JournalDAO'); $journal =& $journalDao->getById($this->journalId); $journalPrimaryLocale = AppLocale::getPrimaryLocale(); $site =& Request::getSite(); $siteSupportedLocales = $site->getSupportedLocales(); if ($tree !== false) { foreach ($tree->getChildren() as $user) { if ($user->getName() == 'user') { // Match user element $newUser = new ImportedUser(); foreach ($user->getChildren() as $attrib) { switch ($attrib->getName()) { case 'username': // Usernames must be lowercase $newUser->setUsername(strtolower_codesafe($attrib->getValue())); break; case 'password': $newUser->setMustChangePassword($attrib->getAttribute('change') == 'true' ? 1 : 0); $encrypted = $attrib->getAttribute('encrypted'); if (isset($encrypted) && $encrypted !== 'plaintext') { $ojsEncryptionScheme = Config::getVar('security', 'encryption'); if ($encrypted != $ojsEncryptionScheme) { $this->errors[] = __('plugins.importexport.users.import.encryptionMismatch', array('importHash' => $encrypted, 'ojsHash' => $ojsEncryptionScheme)); } $newUser->setPassword($attrib->getValue()); } else { $newUser->setUnencryptedPassword($attrib->getValue()); } break; case 'salutation': $newUser->setSalutation($attrib->getValue()); break; case 'first_name': $newUser->setFirstName($attrib->getValue()); break; case 'middle_name': $newUser->setMiddleName($attrib->getValue()); break; case 'last_name': $newUser->setLastName($attrib->getValue()); break; case 'initials': $newUser->setInitials($attrib->getValue()); break; case 'gender': $newUser->setGender($attrib->getValue()); break; case 'affiliation': $locale = $attrib->getAttribute('locale'); if (empty($locale)) { $locale = $journalPrimaryLocale; } $newUser->setAffiliation($attrib->getValue(), $locale); break; case 'email': $newUser->setEmail($attrib->getValue()); break; case 'url': $newUser->setUrl($attrib->getValue()); break; case 'phone': $newUser->setPhone($attrib->getValue()); break; case 'fax': $newUser->setFax($attrib->getValue()); break; case 'mailing_address': $newUser->setMailingAddress($attrib->getValue()); break; case 'country': $newUser->setCountry($attrib->getValue()); break; case 'signature': $locale = $attrib->getAttribute('locale'); if (empty($locale)) { $locale = $journalPrimaryLocale; } $newUser->setSignature($attrib->getValue(), $locale); break; case 'interests': $newUser->setTemporaryInterests($attrib->getValue()); break; case 'gossip': $locale = $attrib->getAttribute('locale'); if (empty($locale)) { $locale = $journalPrimaryLocale; } $newUser->setGossip($attrib->getValue(), $locale); break; case 'biography': $locale = $attrib->getAttribute('locale'); if (empty($locale)) { $locale = $journalPrimaryLocale; } $newUser->setBiography($attrib->getValue(), $locale); break; case 'locales': $locales = array(); foreach (explode(':', $attrib->getValue()) as $locale) { if (AppLocale::isLocaleValid($locale) && in_array($locale, $siteSupportedLocales)) { array_push($locales, $locale); } } $newUser->setLocales($locales); break; case 'role': $roleType = $attrib->getAttribute('type'); if ($this->validRole($roleType)) { $role = new Role(); $role->setRoleId($roleDao->getRoleIdFromPath($roleType)); $newUser->addRole($role); } break; } } array_push($this->usersToImport, $newUser); } } } return $this->usersToImport; }
/** * Get all author submissions for an author. * @param $authorId int * @return DAOResultFactory continaing AuthorSubmissions */ function &getAuthorSubmissions($authorId, $journalId, $active = true, $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) { $primaryLocale = AppLocale::getPrimaryLocale(); $locale = AppLocale::getLocale(); $result =& $this->retrieveRange('SELECT a.*, COALESCE(atl.setting_value, atpl.setting_value) AS submission_title, aa.last_name AS author_name, (SELECT SUM(g.views) FROM article_galleys g WHERE (g.article_id = a.article_id AND g.locale = ?)) AS galley_views, COALESCE(stl.setting_value, stpl.setting_value) AS section_title, COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev FROM articles a LEFT JOIN authors aa ON (aa.submission_id = a.article_id AND aa.primary_contact = 1) LEFT JOIN article_settings atpl ON (atpl.article_id = a.article_id AND atpl.setting_name = ? AND atpl.locale = a.locale) LEFT JOIN article_settings atl ON (atl.article_id = a.article_id AND atl.setting_name = ? AND atl.locale = ?) LEFT JOIN sections s ON (s.section_id = a.section_id) LEFT JOIN section_settings stpl ON (s.section_id = stpl.section_id AND stpl.setting_name = ? AND stpl.locale = ?) LEFT JOIN section_settings stl ON (s.section_id = stl.section_id AND stl.setting_name = ? AND stl.locale = ?) LEFT JOIN section_settings sapl ON (s.section_id = sapl.section_id AND sapl.setting_name = ? AND sapl.locale = ?) LEFT JOIN section_settings sal ON (s.section_id = sal.section_id AND sal.setting_name = ? AND sal.locale = ?) WHERE a.user_id = ? AND a.journal_id = ? AND ' . ($active ? 'a.status = ' . STATUS_QUEUED : '(a.status <> ' . STATUS_QUEUED . ' AND a.submission_progress = 0)') . ($sortBy ? ' ORDER BY ' . $this->getSortMapping($sortBy) . ' ' . $this->getDirectionMapping($sortDirection) : ''), array($locale, 'cleanTitle', 'cleanTitle', $locale, 'title', $primaryLocale, 'title', $locale, 'abbrev', $primaryLocale, 'abbrev', $locale, $authorId, $journalId), $rangeInfo); $returner = new DAOResultFactory($result, $this, '_returnAuthorSubmissionFromRow'); return $returner; }
/** * Get all submissions for a reviewer of a press. * @param $reviewerId int * @param $pressId int * @param $rangeInfo object * @return array ReviewerSubmissions */ function getReviewerSubmissionsByReviewerId($reviewerId, $pressId = null, $active = true, $skipDeclined = true, $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) { $primaryLocale = AppLocale::getPrimaryLocale(); $locale = AppLocale::getLocale(); $sql = 'SELECT m.*, pm.date_published, r.*, u.first_name, u.last_name, atl.setting_value AS submission_title, COALESCE(stl.setting_value, stpl.setting_value) AS series_title, COALESCE(sal.setting_value, sapl.setting_value) AS series_abbrev FROM submissions m LEFT JOIN published_submissions pm ON (pm.submission_id = m.submission_id) LEFT JOIN review_assignments r ON (m.submission_id = r.submission_id) LEFT JOIN submission_settings atl ON (atl.submission_id = m.submission_id AND atl.setting_name = ? AND atl.locale = ?) LEFT JOIN series s ON (s.series_id = m.series_id) LEFT JOIN users u ON (r.reviewer_id = u.user_id) LEFT JOIN series_settings stpl ON (s.series_id = stpl.series_id AND stpl.setting_name = ? AND stpl.locale = ?) LEFT JOIN series_settings stl ON (s.series_id = stl.series_id AND stl.setting_name = ? AND stl.locale = ?) LEFT JOIN series_settings sapl ON (s.series_id = sapl.series_id AND sapl.setting_name = ? AND sapl.locale = ?) LEFT JOIN series_settings sal ON (s.series_id = sal.series_id AND sal.setting_name = ? AND sal.locale = ?) WHERE r.reviewer_id = ? ' . ($pressId ? ' AND m.context_id = ? ' : '') . 'AND r.date_notified IS NOT NULL'; if ($active) { $sql .= ' AND r.date_completed IS NULL AND r.declined <> 1 AND (r.cancelled = 0 OR r.cancelled IS NULL)'; } else { $sql .= ' AND (r.date_completed IS NOT NULL OR r.cancelled = 1 OR r.declined = 1)'; } if ($skipDeclined) { $sql .= ' AND m.status <> ' . STATUS_DECLINED; } if ($sortBy) { $sql .= " ORDER BY {$sortBy} " . $this->getDirectionMapping($sortDirection); } $params = array('title', $locale, 'title', $primaryLocale, 'title', $locale, 'abbrev', $primaryLocale, 'abbrev', $locale, (int) $reviewerId); if ($pressId) { $params[] = (int) $pressId; } $result = $this->retrieveRange($sql, $params, $rangeInfo); return new DAOResultFactory($result, $this, '_fromRow'); }
/** * Retrieve all authors from published papers * @param $schedConfId int * @return $authors array Author Objects */ function getPublishedPaperAuthors($schedConfId) { $primaryLocale = AppLocale::getPrimaryLocale(); $locale = AppLocale::getLocale(); $authors = array(); $result =& $this->retrieve('SELECT aa.*, aspl.setting_value AS affiliation_pl, asl.setting_value AS affiliation_l FROM authors aa LEFT JOIN published_papers pa ON (pa.paper_id = aa.submission_id) LEFT JOIN author_settings aspl ON (aspl.author_id = aa.author_id AND aspl.setting_name = ? AND aspl.locale = ?) LEFT JOIN author_settings asl ON (asl.author_id = aa.author_id AND asl.setting_name = ? AND asl.locale = ?) WHERE pa.sched_conf_id = ?', array('affiliation', $primaryLocale, 'affiliation', $locale, (int) $schedConfId)); while (!$result->EOF) { $row = $result->GetRowAssoc(false); $author = new Author(); $author->setId($row['author_id']); $author->setSubmissionId($row['paper_id']); $author->setFirstName($row['first_name']); $author->setMiddleName($row['middle_name']); $author->setLastName($row['last_name']); $author->setAffiliation($row['affiliation_pl'], $primaryLocale); $author->setAffiliation($row['affiliation_l'], $locale); $author->setEmail($row['email']); $author->setBiography($row['biography']); $author->setPrimaryContact($row['primary_contact']); $author->setSequence($row['seq']); $authors[] = $author; $result->moveNext(); } $result->Close(); unset($result); return $authors; }