function sharingSettings() { $this->validate(); $journal = Request::getJournal(); if ($journal) { $this->setupTemplate(true); $templateMgr =& TemplateManager::getManager(); $rtDao =& DAORegistry::getDAO('RTDAO'); $rt = $rtDao->getJournalRTByJournal($journal); $templateMgr->assign('sharingEnabled', $rt->getSharingEnabled()); $templateMgr->assign('sharingUserName', $rt->getSharingUserName()); $templateMgr->assign('sharingButtonStyle', $rt->getSharingButtonStyle()); $templateMgr->assign('sharingButtonStyleOptions', array_keys(SharingRT::getBtnStyles())); $templateMgr->assign('sharingDropDownMenu', $rt->getSharingDropDownMenu()); $templateMgr->assign('sharingBrand', $rt->getSharingBrand()); $templateMgr->assign('sharingDropDown', $rt->getSharingDropDown()); $templateMgr->assign('sharingLanguage', $rt->getSharingLanguage()); $templateMgr->assign('sharingLanguageOptions', SharingRT::getLanguages()); $templateMgr->assign('sharingLogo', $rt->getSharingLogo()); $templateMgr->assign('sharingLogoBackground', $rt->getSharingLogoBackground()); $templateMgr->assign('sharingLogoColor', $rt->getSharingLogoColor()); $templateMgr->assign('helpTopicId', 'journal.managementPages.readingTools.addthisSettings'); $templateMgr->display('rtadmin/addthis.tpl'); } else { Request::redirect(null, Request::getRequestedPage()); } }
function sharingSettings($args, $request) { $this->validate(); $journal = $request->getJournal(); if ($journal) { $this->setupTemplate($request, true); $templateMgr = TemplateManager::getManager($request); $rtDao = DAORegistry::getDAO('RTDAO'); $rt = $rtDao->getJournalRTByJournal($journal); $templateMgr->assign('sharingEnabled', $rt->getSharingEnabled()); $templateMgr->assign('sharingUserName', $rt->getSharingUserName()); $templateMgr->assign('sharingButtonStyle', $rt->getSharingButtonStyle()); $templateMgr->assign('sharingButtonStyleOptions', array_keys(SharingRT::getBtnStyles())); $templateMgr->assign('sharingDropDownMenu', $rt->getSharingDropDownMenu()); $templateMgr->assign('sharingBrand', $rt->getSharingBrand()); $templateMgr->assign('sharingDropDown', $rt->getSharingDropDown()); $templateMgr->assign('sharingLanguage', $rt->getSharingLanguage()); $templateMgr->assign('sharingLanguageOptions', SharingRT::getLanguages()); $templateMgr->assign('sharingLogo', $rt->getSharingLogo()); $templateMgr->assign('sharingLogoBackground', $rt->getSharingLogoBackground()); $templateMgr->assign('sharingLogoColor', $rt->getSharingLogoColor()); $templateMgr->display('rtadmin/addthis.tpl'); } else { $request->redirect(null, $request->getRequestedPage()); } }
/** * determine the correct language for the sharing button. Attempt to use the user's local * setting if it is one that AddThis supports. If not, use the language the administrator * has chosen. * * @return string * @param $default string */ function sharingLocale($default) { //getLocal() returns a string like 'en_US' $locale = Locale::getLocale(); $lang = substr($locale, 0, 2); $languages = SharingRT::getLanguages(); if (isset($languages[$lang])) { return $lang; } return $default; }