function assignRoleContent($templateMgr, $request) { // Need the count in order to determine whether to display // extras-on-demand for role selection in other contexts. $contextDao = Application::getContextDAO(); $contexts = $contextDao->getAll(true)->toArray(); $templateMgr->assign(array('showOtherContexts' => !$request->getContext() || count($contexts) > 1)); // Expose potential self-registration user groups to template $authorUserGroups = $reviewerUserGroups = $readerUserGroups = array(); $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); foreach ($contexts as $context) { $reviewerUserGroups[$context->getId()] = $userGroupDao->getByRoleId($context->getId(), ROLE_ID_REVIEWER)->toArray(); $authorUserGroups[$context->getId()] = $userGroupDao->getByRoleId($context->getId(), ROLE_ID_AUTHOR)->toArray(); $readerUserGroups[$context->getId()] = $userGroupDao->getByRoleId($context->getId(), ROLE_ID_READER)->toArray(); } $templateMgr->assign(array('reviewerUserGroups' => $reviewerUserGroups, 'authorUserGroups' => $authorUserGroups, 'readerUserGroups' => $readerUserGroups)); }
/** * @copydoc Form::fetch() */ function fetch($request, $template = null, $display = false) { $templateMgr = TemplateManager::getManager($request); $site = $request->getSite(); $context = $request->getContext(); if ($this->captchaEnabled) { import('lib.pkp.lib.recaptcha.recaptchalib'); $publicKey = Config::getVar('captcha', 'recaptcha_public_key'); $useSSL = Config::getVar('security', 'force_ssl') ? true : false; $reCaptchaHtml = recaptcha_get_html($publicKey, null, $useSSL); $templateMgr->assign(array('reCaptchaHtml' => $reCaptchaHtml, 'captchaEnabled' => true)); } $countryDao = DAORegistry::getDAO('CountryDAO'); $countries = $countryDao->getCountries(); $templateMgr->assign('countries', $countries); $userDao = DAORegistry::getDAO('UserDAO'); $templateMgr->assign('genderOptions', $userDao->getGenderOptions()); $site = $request->getSite(); $templateMgr->assign('availableLocales', $site->getSupportedLocaleNames()); import('lib.pkp.classes.user.form.UserFormHelper'); $userFormHelper = new UserFormHelper(); $userFormHelper->assignRoleContent($templateMgr, $request); $templateMgr->assign(array('source' => $request->getUserVar('source'), 'minPasswordLength' => $site->getMinPasswordLength(), 'privacyStatement' => $context->getLocalizedSetting('privacyStatement'), 'includeEntirePage' => $display)); return parent::fetch($request, $template, $display); }