/** * Retrieve an RT configuration. * @param $journalId int * @return RT */ function &getJournalRTByJournal(&$journal) { $rt = new JournalRT($journal->getId()); $rt->setEnabled($journal->getSetting('rtEnabled') ? true : false); $rt->setVersion((int) $journal->getSetting('rtVersionId')); $rt->setAbstract($journal->getSetting('rtAbstract') ? true : false); $rt->setCaptureCite($journal->getSetting('rtCaptureCite') ? true : false); $rt->setViewMetadata($journal->getSetting('rtViewMetadata') ? true : false); $rt->setSupplementaryFiles($journal->getSetting('rtSupplementaryFiles') ? true : false); $rt->setPrinterFriendly($journal->getSetting('rtPrinterFriendly') ? true : false); $rt->setDefineTerms($journal->getSetting('rtDefineTerms') ? true : false); $rt->setEmailAuthor($journal->getSetting('rtEmailAuthor') ? true : false); $rt->setEmailOthers($journal->getSetting('rtEmailOthers') ? true : false); $rt->setFindingReferences($journal->getSetting('rtFindingReferences') ? true : false); $rt->setViewReviewPolicy($journal->getSetting('rtViewReviewPolicy') ? true : false); $rt->setSharingEnabled($journal->getSetting("rtSharingEnabled") ? $journal->getSetting("rtSharingEnabled") : ""); $rt->setSharingUserName($journal->getSetting("rtSharingUserName") ? $journal->getSetting("rtSharingUserName") : ""); $rt->setSharingButtonStyle($journal->getSetting("rtSharingButtonStyle") ? $journal->getSetting("rtSharingButtonStyle") : ""); $rt->setSharingDropDownMenu($journal->getSetting("rtSharingDropDownMenu") ? $journal->getSetting("rtSharingDropDownMenu") : ""); $rt->setSharingBrand($journal->getSetting("rtSharingBrand") ? $journal->getSetting("rtSharingBrand") : ""); $rt->setSharingDropDown($journal->getSetting("rtSharingDropDown") ? $journal->getSetting("rtSharingDropDown") : ""); $rt->setSharingLanguage($journal->getSetting("rtSharingLanguage") ? $journal->getSetting("rtSharingLanguage") : ""); $rt->setSharingLogo($journal->getSetting("rtSharingLogo") ? $journal->getSetting("rtSharingLogo") : ""); $rt->setSharingLogoBackground($journal->getSetting("rtSharingLogoBackground") ? $journal->getSetting("rtSharingLogoBackground") : ""); $rt->setSharingLogoColor($journal->getSetting("rtSharingLogoColor") ? $journal->getSetting("rtSharingLogoColor") : ""); return $rt; }
/** * For upgrade to 2.1.1: Migrate the RT settings from the rt_settings * table to journal settings and drop the rt_settings table. * @return boolean */ function migrateRtSettings() { $rtDao =& DAORegistry::getDAO('RTDAO'); $journalDao =& DAORegistry::getDAO('JournalDAO'); // Bring in the comments constants. $commentDao =& DAORegistry::getDao('CommentDAO'); $result =& $rtDao->retrieve('SELECT * FROM rt_settings'); while (!$result->EOF) { $row = $result->GetRowAssoc(false); $journalId = $row['journal_id']; $journal =& $journalDao->getById($journalId); $rt = new JournalRT($journalId); $rt->setEnabled(true); // No toggle in prior OJS; assume true $rt->setVersion($row['version_id']); $rt->setAbstract(true); // No toggle in prior OJS; assume true $rt->setCaptureCite($row['capture_cite']); $rt->setViewMetadata($row['view_metadata']); $rt->setSupplementaryFiles($row['supplementary_files']); $rt->setPrinterFriendly($row['printer_friendly']); $rt->setDefineTerms($row['define_terms']); $journal->updateSetting('enableComments', $row['add_comment'] ? COMMENTS_AUTHENTICATED : COMMENTS_DISABLED); $rt->setEmailAuthor($row['email_author']); $rt->setEmailOthers($row['email_others']); $rtDao->updateJournalRT($rt); unset($rt); unset($journal); $result->MoveNext(); } $result->Close(); unset($result); // Drop the table once all settings are migrated. $rtDao->update('DROP TABLE rt_settings'); return true; }