/** * Display form to modify site language settings. * @param $args array * @param $request object */ function languages($args, &$request) { $this->validate(); $this->setupTemplate(true); $site =& $request->getSite(); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('localeNames', Locale::getAllLocales()); $templateMgr->assign('primaryLocale', $site->getPrimaryLocale()); $templateMgr->assign('supportedLocales', $site->getSupportedLocales()); $localesComplete = array(); foreach (Locale::getAllLocales() as $key => $name) { $localesComplete[$key] = Locale::isLocaleComplete($key); } $templateMgr->assign('localesComplete', $localesComplete); $templateMgr->assign('installedLocales', $site->getInstalledLocales()); $templateMgr->assign('uninstalledLocales', array_diff(array_keys(Locale::getAllLocales()), $site->getInstalledLocales())); $templateMgr->assign('helpTopicId', 'site.siteManagement'); import('classes.i18n.LanguageAction'); $languageAction = new LanguageAction(); if ($languageAction->isDownloadAvailable()) { $templateMgr->assign('downloadAvailable', true); $templateMgr->assign('downloadableLocales', $languageAction->getDownloadableLocales()); } $templateMgr->display('admin/languages.tpl'); }
function compileLocales() { $locales =& Locale::getAllLocales(); foreach ($locales as $key => $name) { Locale::loadLocale($key); } }
/** * Constructor. */ function InstallForm() { parent::Form('install/install.tpl'); // FIXME Move the below options to an external configuration file? $this->supportedLocales = Locale::getAllLocales(); $this->supportedClientCharsets = array('utf-8' => 'Unicode (UTF-8)', 'iso-8859-1' => 'Western (ISO-8859-1)'); $this->supportedConnectionCharsets = array('' => Locale::translate('common.notApplicable'), 'utf8' => 'Unicode (UTF-8)'); $this->supportedDatabaseCharsets = array('' => Locale::translate('common.notApplicable'), 'utf8' => 'Unicode (UTF-8)'); $this->supportedEncryptionAlgorithms = array('md5' => 'MD5'); if (function_exists('sha1')) { $this->supportedEncryptionAlgorithms['sha1'] = 'SHA1'; } $this->supportedDatabaseDrivers = array('mysql' => array('mysql', 'MySQL'), 'postgres' => array('pgsql', 'PostgreSQL'), 'oracle' => array('oci8', 'Oracle'), 'mssql' => array('mssql', 'MS SQL Server'), 'fbsql' => array('fbsql', 'FrontBase'), 'ibase' => array('ibase', 'Interbase'), 'firebird' => array('ibase', 'Firebird'), 'informix' => array('ifx', 'Informix'), 'sybase' => array('sybase', 'Sybase'), 'odbc' => array('odbc', 'ODBC')); // Validation checks for this form $this->addCheck(new FormValidatorInSet($this, 'locale', 'required', 'installer.form.localeRequired', array_keys($this->supportedLocales))); $this->addCheck(new FormValidatorCustom($this, 'locale', 'required', 'installer.form.localeRequired', array('Locale', 'isLocaleValid'))); $this->addCheck(new FormValidatorInSet($this, 'clientCharset', 'required', 'installer.form.clientCharsetRequired', array_keys($this->supportedClientCharsets))); $this->addCheck(new FormValidator($this, 'filesDir', 'required', 'installer.form.filesDirRequired')); $this->addCheck(new FormValidatorInSet($this, 'encryption', 'required', 'installer.form.encryptionRequired', array_keys($this->supportedEncryptionAlgorithms))); $this->addCheck(new FormValidator($this, 'adminUsername', 'required', 'installer.form.usernameRequired')); // Opatan Inc. : FormValidatorAlphaNum for username is removed // Opatan Inc. : Email Validator for admin username is added && email validator is removed $this->addCheck(new FormValidatorEmail($this, 'adminUsername', 'required', 'installer.form.adminEmailRequired')); $this->addCheck(new FormValidator($this, 'adminPassword', 'required', 'installer.form.passwordRequired')); $this->addCheck(new FormValidatorCustom($this, 'adminPassword', 'required', 'installer.form.passwordsDoNotMatch', create_function('$password,$form', 'return $password == $form->getData(\'adminPassword2\');'), array(&$this))); $this->addCheck(new FormValidatorInSet($this, 'databaseDriver', 'required', 'installer.form.databaseDriverRequired', array_keys($this->supportedDatabaseDrivers))); $this->addCheck(new FormValidator($this, 'databaseName', 'required', 'installer.form.databaseNameRequired')); $this->addCheck(new FormValidatorPost($this)); }
/** * Display the form. */ function display() { $conference =& Request::getConference(); $schedConf =& Request::getSchedConf(); $user =& Request::getUser(); $templateMgr =& TemplateManager::getManager(); // Get tracks for this conference $trackDao =& DAORegistry::getDAO('TrackDAO'); // If this user is a track director or a director, they are // allowed to submit to tracks flagged as "director-only" for // submissions. Otherwise, display only tracks they are allowed // to submit to. $roleDao =& DAORegistry::getDAO('RoleDAO'); $isDirector = $roleDao->userHasRole($conference->getId(), $schedConf->getId(), $user->getId(), ROLE_ID_DIRECTOR) || $roleDao->userHasRole($conference->getId(), $schedConf->getId(), $user->getId(), ROLE_ID_TRACK_DIRECTOR) || $roleDao->userHasRole($conference->getId(), 0, $user->getId(), ROLE_ID_DIRECTOR) || $roleDao->userHasRole($conference->getId(), 0, $user->getId(), ROLE_ID_TRACK_DIRECTOR); $templateMgr->assign('trackOptions', array('0' => Locale::translate('author.submit.selectTrack')) + $trackDao->getTrackTitles($schedConf->getId(), !$isDirector)); $paperTypeDao =& DAORegistry::getDAO('PaperTypeDAO'); $sessionTypes = $paperTypeDao->getPaperTypes($schedConf->getId()); $templateMgr->assign('sessionTypes', $sessionTypes->toArray()); // Provide available submission languages. (Convert the array // of locale symbolic names xx_XX into an associative array // of symbolic names => readable names.) $supportedSubmissionLocales = $conference->getSetting('supportedSubmissionLocales'); if (empty($supportedSubmissionLocales)) { $supportedSubmissionLocales = array($conference->getPrimaryLocale()); } $templateMgr->assign('supportedSubmissionLocaleNames', array_flip(array_intersect(array_flip(Locale::getAllLocales()), $supportedSubmissionLocales))); parent::display(); }
/** * Display the form. */ function display() { $press =& Request::getPress(); $user =& Request::getUser(); $templateMgr =& TemplateManager::getManager(); // Get series for this press $seriesDao =& DAORegistry::getDAO('SeriesDAO'); // FIXME: If this user is a series editor or an editor, they are // allowed to submit to series flagged as "editor-only" for // submissions. Otherwise, display only series they are allowed // to submit to. $roleDao =& DAORegistry::getDAO('RoleDAO'); $isEditor = $roleDao->userHasRole($press->getId(), $user->getId(), ROLE_ID_EDITOR) || $roleDao->userHasRole($press->getId(), $user->getId(), ROLE_ID_SERIES_EDITOR); $seriesOptions = array('0' => Locale::translate('submission.submit.selectSeries')) + $seriesDao->getTitlesByPressId($press->getId()); $templateMgr->assign('seriesOptions', $seriesOptions); // Provide available submission languages. (Convert the array // of locale symbolic names xx_XX into an associative array // of symbolic names => readable names.) $supportedSubmissionLocales = $press->getSetting('supportedSubmissionLocales'); if (empty($supportedSubmissionLocales)) { $supportedSubmissionLocales = array($press->getPrimaryLocale()); } $templateMgr->assign('supportedSubmissionLocaleNames', array_flip(array_intersect(array_flip(Locale::getAllLocales()), $supportedSubmissionLocales))); parent::display(); }
/** * Test locales. */ function execute() { // Flush the file cache just to be certain we're using // the most recent stuff import('cache.CacheManager'); $cacheManager =& CacheManager::getManager(); $cacheManager->flush('locale'); // Load plugins so that their locale data is included too $plugins = array(); foreach (PluginRegistry::getCategories() as $category) { echo "Loading plugin category \"{$category}\"...\n"; $morePlugins = PluginRegistry::loadCategory($category); if (is_array($morePlugins)) { $plugins += $morePlugins; } } foreach (Locale::getAllLocales() as $locale => $name) { if (!empty($this->locales) && !in_array($locale, $this->locales)) { continue; } if ($locale != MASTER_LOCALE) { echo "Testing locale \"{$name}\" ({$locale}) against reference locale " . MASTER_LOCALE . ".\n"; $this->testLocale($locale, MASTER_LOCALE, $plugins); $this->testEmails($locale, MASTER_LOCALE); } } }
/** * Get the error message associated with a failed validation check. * @see FormValidator::getMessage() * @return string */ function getMessage() { $primaryLocale = Locale::getPrimaryLocale(); $allLocales = Locale::getAllLocales(); //return parent::getMessage() . ' (' . $allLocales[$this->_requiredLocale] . ')'; return parent::getMessage(); //Edited by Anne Ivy Mirasol, April 27, 2011 }
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 =& Locale::getAllLocales(); $primaryLocale = Locale::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 the localized value of the galley label. * @return $string */ function getGalleyLabel() { $label = $this->getLabel(); if ($this->getLocale() != Locale::getLocale()) { $locales = Locale::getAllLocales(); $label .= ' (' . $locales[$this->getLocale()] . ')'; } return $label; }
function index() { list($plugin) = TranslatorHandler::validate(); TranslatorHandler::setupTemplate(false); $rangeInfo = Handler::getRangeInfo('locales'); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('locales', new ArrayItemIterator(Locale::getAllLocales(), $rangeInfo->getPage(), $rangeInfo->getCount())); $templateMgr->assign('masterLocale', MASTER_LOCALE); $templateMgr->display($plugin->getTemplatePath() . 'index.tpl'); }
/** * Constructor. * @param $article object */ function WithdrawForm($article, $journal) { $supportedSubmissionLocales = $journal->getSetting('supportedSubmissionLocales'); if (empty($supportedSubmissionLocales)) { $supportedSubmissionLocales = array($journal->getPrimaryLocale()); } parent::Form('submission/suppFile/withdraw.tpl', true, $article->getLocale(), array_flip(array_intersect(array_flip(Locale::getAllLocales()), $supportedSubmissionLocales))); $this->article = $article; $this->addCheck(new FormValidator($this, 'withdrawReason', 'required', 'author.submit.form.withdrawReasonRequired')); $this->addCheck(new FormValidator($this, 'otherReason', 'required', 'author.submit.form.otherReasonRequired')); }
/** * Get all supported locales for the current context. * @return array */ function getSupportedLocales() { static $supportedLocales; if (!isset($supportedLocales)) { if (defined('SESSION_DISABLE_INIT') || !Config::getVar('general', 'installed')) { $supportedLocales = Locale::getAllLocales(); } else { $site =& Request::getSite(); $supportedLocales = $site->getSupportedLocaleNames(); } } return $supportedLocales; }
/** * Constructor. */ function MetadataForm($article, $journal) { $roleDao =& DAORegistry::getDAO('RoleDAO'); $signoffDao =& DAORegistry::getDAO('SignoffDAO'); $user =& Request::getUser(); $roleId = $roleDao->getRoleIdFromPath(Request::getRequestedPage()); // If the user is an editor of this article, make the entire form editable. $this->canEdit = false; $this->isEditor = false; if ($roleId != null && ($roleId == ROLE_ID_EDITOR || $roleId == ROLE_ID_SECTION_EDITOR)) { $this->canEdit = true; $this->isEditor = true; } $copyeditInitialSignoff = $signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $article->getId()); // If the user is an author and the article hasn't passed the Copyediting stage, make the form editable. if ($roleId == ROLE_ID_AUTHOR) { if ($article->getStatus() != STATUS_PUBLISHED && ($copyeditInitialSignoff == null || $copyeditInitialSignoff->getDateCompleted() == null)) { $this->canEdit = true; } } // Copy editors are also allowed to edit metadata, but only if they have // a current assignment to the article. if ($roleId != null && $roleId == ROLE_ID_COPYEDITOR) { $copyeditFinalSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $article->getId()); if ($copyeditFinalSignoff != null && $article->getStatus() != STATUS_PUBLISHED) { if ($copyeditInitialSignoff->getDateNotified() != null && $copyeditFinalSignoff->getDateCompleted() == null) { $this->canEdit = true; } } } if ($this->canEdit) { $supportedSubmissionLocales = $journal->getSetting('supportedSubmissionLocales'); if (empty($supportedSubmissionLocales)) { $supportedSubmissionLocales = array($journal->getPrimaryLocale()); } parent::Form('submission/metadata/metadataEdit.tpl', true, $article->getLocale(), array_flip(array_intersect(array_flip(Locale::getAllLocales()), $supportedSubmissionLocales))); $this->addCheck(new FormValidatorLocale($this, 'title', 'required', 'author.submit.form.titleRequired', $this->getRequiredLocale())); $this->addCheck(new FormValidatorArray($this, 'authors', 'required', 'author.submit.form.authorRequiredFields', array('firstName', 'lastName'))); $this->addCheck(new FormValidatorArrayCustom($this, 'authors', 'required', 'author.submit.form.authorRequiredFields', create_function('$email, $regExp', 'return String::regexp_match($regExp, $email);'), array(ValidatorEmail::getRegexp()), false, array('email'))); $this->addCheck(new FormValidatorArrayCustom($this, 'authors', 'required', 'user.profile.form.urlInvalid', create_function('$url, $regExp', 'return empty($url) ? true : String::regexp_match($regExp, $url);'), array(ValidatorUrl::getRegexp()), false, array('url'))); } else { parent::Form('submission/metadata/metadataView.tpl'); } // If the user is a reviewer of this article, do not show authors. $this->canViewAuthors = true; if ($roleId != null && $roleId == ROLE_ID_REVIEWER) { $this->canViewAuthors = false; } $this->article = $article; $this->addCheck(new FormValidatorPost($this)); }
/** * Return associative array of all locales supported by the site. * These locales are used to provide a language toggle on the main site pages. * @return array */ function &getSupportedLocaleNames() { $supportedLocales =& Registry::get('siteSupportedLocales', true, null); if ($supportedLocales === null) { $supportedLocales = array(); $localeNames =& Locale::getAllLocales(); $locales = $this->getSupportedLocales(); foreach ($locales as $localeKey) { $supportedLocales[$localeKey] = $localeNames[$localeKey]; } asort($supportedLocales); } return $supportedLocales; }
/** * Return associative array of all locales supported by the site. * These locales are used to provide a language toggle on the main site pages. * @return array */ function &getSupportedLocaleNames() { static $supportedLocales; if (!isset($supportedLocales)) { $supportedLocales = array(); $localeNames =& Locale::getAllLocales(); $locales = $this->getSupportedLocales(); foreach ($locales as $localeKey) { $supportedLocales[$localeKey] = $localeNames[$localeKey]; } asort($supportedLocales); } return $supportedLocales; }
/** * Constructor. * @param $article object * @param $step int */ function AuthorSubmitForm(&$article, $step, &$journal) { // Provide available submission languages. (Convert the array // of locale symbolic names xx_XX into an associative array // of symbolic names => readable names.) $supportedSubmissionLocales = $journal->getSetting('supportedSubmissionLocales'); if (empty($supportedSubmissionLocales)) { $supportedSubmissionLocales = array($journal->getPrimaryLocale()); } parent::Form(sprintf('author/submit/step%d.tpl', $step), true, $article ? $article->getLocale() : Locale::getLocale(), array_flip(array_intersect(array_flip(Locale::getAllLocales()), $supportedSubmissionLocales))); $this->addCheck(new FormValidatorPost($this)); $this->step = (int) $step; $this->article = $article; $this->articleId = $article ? $article->getId() : null; }
function index() { $this->validate(); $plugin =& $this->plugin; $this->setupTemplate(false); $rangeInfo = Handler::getRangeInfo('locales'); $templateMgr =& TemplateManager::getManager(); import('lib.pkp.classes.core.ArrayItemIterator'); $templateMgr->assign('locales', new ArrayItemIterator(Locale::getAllLocales(), $rangeInfo->getPage(), $rangeInfo->getCount())); $templateMgr->assign('masterLocale', MASTER_LOCALE); // Test whether the tar binary is available for the export to work $tarBinary = Config::getVar('cli', 'tar'); $templateMgr->assign('tarAvailable', !empty($tarBinary) && file_exists($tarBinary)); $templateMgr->display($plugin->getTemplatePath() . 'index.tpl'); }
/** * Get the HTML contents for this block. */ function getContents(&$templateMgr) { $templateMgr->assign('isPostRequest', Request::isPost()); if (!defined('SESSION_DISABLE_INIT')) { $site =& Request::getSite(); $locales =& $site->getSupportedLocaleNames(); } else { $locales =& Locale::getAllLocales(); $templateMgr->assign('languageToggleNoUser', true); } if (isset($locales) && count($locales) > 1) { $templateMgr->assign('enableLanguageToggle', true); $templateMgr->assign('languageToggleLocales', $locales); } return parent::getContents($templateMgr); }
/** * Test locales. */ function execute() { $plugins = PluginRegistry::loadAllPlugins(); foreach (Locale::getAllLocales() as $locale => $name) { if (!empty($this->locales) && !in_array($locale, $this->locales)) { continue; } if ($locale != MASTER_LOCALE) { echo "Testing locale \"{$name}\" ({$locale}) against reference locale " . MASTER_LOCALE . ".\n"; $errors = Locale::testLocale($locale, MASTER_LOCALE); $this->displayLocaleErrors($locale, $errors); $emailErrors = Locale::testEmails($locale, MASTER_LOCALE); $this->displayEmailErrors($locale, $emailErrors); } } }
/** * Return associative array of all locales supported by forms on the site. * These locales are used to provide a language toggle on the main site pages. * @return array */ function &getSupportedFormLocaleNames() { $supportedLocales =& $this->getData('supportedFormLocales'); if (!isset($supportedLocales)) { $supportedLocales = array(); $localeNames =& Locale::getAllLocales(); $locales = $this->getSetting('supportedFormLocales'); if (!isset($locales) || !is_array($locales)) { $locales = array(); } foreach ($locales as $localeKey) { $supportedLocales[$localeKey] = $localeNames[$localeKey]; } } return $supportedLocales; }
/** * Display form to modify site language settings. */ function languages() { $this->validate(); $this->setupTemplate(true); $site =& Request::getSite(); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('localeNames', Locale::getAllLocales()); $templateMgr->assign('primaryLocale', $site->getPrimaryLocale()); $templateMgr->assign('supportedLocales', $site->getSupportedLocales()); $localesComplete = array(); foreach (Locale::getAllLocales() as $key => $name) { $localesComplete[$key] = Locale::isLocaleComplete($key); } $templateMgr->assign('localesComplete', $localesComplete); $templateMgr->assign('installedLocales', $site->getInstalledLocales()); $templateMgr->assign('uninstalledLocales', array_diff(array_keys(Locale::getAllLocales()), $site->getInstalledLocales())); $templateMgr->display('admin/languages.tpl'); }
/** * Display the form. */ function display() { $templateMgr =& TemplateManager::getManager(); $templateMgr->setCacheability(CACHEABILITY_NO_STORE); $templateMgr->register_function('fieldLabel', array(&$this, 'smartyFieldLabel')); $templateMgr->register_function('form_language_chooser', array(&$this, 'smartyFormLanguageChooser')); $templateMgr->assign($this->_data); $templateMgr->assign('isError', !$this->isValid()); $templateMgr->assign('errors', $this->getErrorsArray()); $templateMgr->assign('formLocales', Locale::getSupportedLocales()); // Determine the current locale to display fields with $formLocale = Request::getUserVar('formLocale'); if (empty($formLocale) || !in_array($formLocale, array_keys(Locale::getAllLocales()))) { $formLocale = Locale::getLocale(); } $templateMgr->assign('formLocale', $formLocale); $templateMgr->display($this->_template); }
/** * Constructor. * @param $article object * @param $journal object * @param $suppFileId int (optional) */ function AuthorSubmitSuppFileForm(&$article, &$journal, $suppFileId = null) { $supportedSubmissionLocales = $journal->getSetting('supportedSubmissionLocales'); if (empty($supportedSubmissionLocales)) { $supportedSubmissionLocales = array($journal->getPrimaryLocale()); } parent::Form('author/submit/suppFile.tpl', true, $article->getLocale(), array_flip(array_intersect(array_flip(Locale::getAllLocales()), $supportedSubmissionLocales))); $this->articleId = $article->getId(); if (isset($suppFileId) && !empty($suppFileId)) { $suppFileDao =& DAORegistry::getDAO('SuppFileDAO'); $this->suppFile =& $suppFileDao->getSuppFile($suppFileId, $article->getId()); if (isset($this->suppFile)) { $this->suppFileId = $suppFileId; } } // Validation checks for this form $this->addCheck(new FormValidatorLocale($this, 'title', 'required', 'author.submit.suppFile.form.titleRequired', $this->getRequiredLocale())); $this->addCheck(new FormValidatorPost($this)); }
/** * Display form to modify site language settings. */ function languages() { parent::validate(); parent::setupTemplate(true); $site =& Request::getSite(); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('localeNames', Locale::getAllLocales()); $templateMgr->assign('primaryLocale', $site->getPrimaryLocale()); $templateMgr->assign('supportedLocales', $site->getSupportedLocales()); $templateMgr->assign('installedLocales', $site->getInstalledLocales()); $templateMgr->assign('uninstalledLocales', array_diff(array_keys(Locale::getAllLocales()), $site->getInstalledLocales())); $templateMgr->assign('helpTopicId', 'site.siteManagement'); import('i18n.LanguageAction'); $languageAction =& new LanguageAction(); if ($languageAction->isDownloadAvailable()) { $templateMgr->assign('downloadAvailable', true); $templateMgr->assign('downloadableLocales', $languageAction->getDownloadableLocales()); } $templateMgr->display('admin/languages.tpl'); }
/** * Display the form. */ function display() { $journal =& Request::getJournal(); $user =& Request::getUser(); $templateMgr =& TemplateManager::getManager(); // Get sections for this journal $sectionDao =& DAORegistry::getDAO('SectionDAO'); // If this user is a section editor or an editor, they are // allowed to submit to sections flagged as "editor-only" for // submissions. Otherwise, display only sections they are // allowed to submit to. $roleDao =& DAORegistry::getDAO('RoleDAO'); $isEditor = $roleDao->roleExists($journal->getId(), $user->getId(), ROLE_ID_EDITOR) || $roleDao->roleExists($journal->getId(), $user->getId(), ROLE_ID_SECTION_EDITOR); $templateMgr->assign('sectionOptions', array('0' => Locale::translate('author.submit.selectSection')) + $sectionDao->getSectionTitles($journal->getId(), !$isEditor)); // Set up required Payment Related Information import('classes.payment.ojs.OJSPaymentManager'); $paymentManager =& OJSPaymentManager::getManager(); if ($paymentManager->submissionEnabled() || $paymentManager->fastTrackEnabled() || $paymentManager->publicationEnabled()) { $templateMgr->assign('authorFees', true); $completedPaymentDAO =& DAORegistry::getDAO('OJSCompletedPaymentDAO'); $articleId = $this->articleId; if ($paymentManager->submissionEnabled()) { $templateMgr->assign_by_ref('submissionPayment', $completedPaymentDAO->getSubmissionCompletedPayment($journal->getId(), $articleId)); } if ($paymentManager->fastTrackEnabled()) { $templateMgr->assign_by_ref('fastTrackPayment', $completedPaymentDAO->getFastTrackCompletedPayment($journal->getId(), $articleId)); } } // Provide available submission languages. (Convert the array // of locale symbolic names xx_XX into an associative array // of symbolic names => readable names.) $supportedSubmissionLocales = $journal->getSetting('supportedSubmissionLocales'); if (empty($supportedSubmissionLocales)) { $supportedSubmissionLocales = array($journal->getPrimaryLocale()); } $templateMgr->assign('supportedSubmissionLocaleNames', array_flip(array_intersect(array_flip(Locale::getAllLocales()), $supportedSubmissionLocales))); parent::display(); }
/** * Constructor. */ function MetadataForm($article, $journal) { $roleDao =& DAORegistry::getDAO('RoleDAO'); $signoffDao =& DAORegistry::getDAO('SignoffDAO'); $user =& Request::getUser(); $roleId = $roleDao->getRoleIdFromPath(Request::getRequestedPage()); if ($roleId == ROLE_ID_AUTHOR || $roleId == ROLE_ID_SECTION_EDITOR) { $this->canEdit = true; } else { $this->canEdit = false; } if ($this->canEdit) { $supportedSubmissionLocales = $journal->getSetting('supportedSubmissionLocales'); if (empty($supportedSubmissionLocales)) { $supportedSubmissionLocales = array($journal->getPrimaryLocale()); } parent::Form('submission/metadata/metadataEdit.tpl', true, $article->getLocale(), array_flip(array_intersect(array_flip(Locale::getAllLocales()), $supportedSubmissionLocales))); } else { parent::Form('submission/metadata/metadataView.tpl'); } $this->article = $article; $this->addCheck(new FormValidatorPost($this)); }
/** * Display a user's profile. * @param $args array first parameter is the ID or username of the user to display */ function userProfile($args) { $this->validate(); $this->setupTemplate(true); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('currentUrl', Request::url(null, null, null, 'people', 'all')); $templateMgr->assign('helpTopicId', 'conference.users.index'); $userDao =& DAORegistry::getDAO('UserDAO'); $userId = isset($args[0]) ? $args[0] : 0; if (is_numeric($userId)) { $userId = (int) $userId; $user = $userDao->getUser($userId); } else { $user = $userDao->getUserByUsername($userId); } if ($user == null) { // Non-existent user requested $templateMgr->assign('pageTitle', 'manager.people'); $templateMgr->assign('errorMsg', 'manager.people.invalidUser'); $templateMgr->assign('backLink', Request::url(null, null, null, 'people', 'all')); $templateMgr->assign('backLinkLabel', 'manager.people.allUsers'); $templateMgr->display('common/error.tpl'); } else { $site =& Request::getSite(); $conference =& Request::getConference(); $isSiteAdmin = Validation::isSiteAdmin(); $templateMgr->assign('isSiteAdmin', $isSiteAdmin); $roleDao =& DAORegistry::getDAO('RoleDAO'); $roles =& $roleDao->getRolesByUserId($user->getId(), $conference->getId()); if ($isSiteAdmin) { // We'll be displaying all roles, so get ready to display // conference names other than the current journal. $conferenceDao =& DAORegistry::getDAO('ConferenceDAO'); $schedConfDao =& DAORegistry::getDAO('SchedConfDAO'); $conferenceTitles =& $conferenceDao->getConferenceTitles(); $schedConfTitles =& $schedConfDao->getSchedConfTitles(); $templateMgr->assign_by_ref('conferenceTitles', $conferenceTitles); $templateMgr->assign_by_ref('schedConfTitles', $schedConfTitles); } $countryDao =& DAORegistry::getDAO('CountryDAO'); $country = null; if ($user->getCountry() != '') { $country = $countryDao->getCountry($user->getCountry()); } $templateMgr->assign('country', $country); $templateMgr->assign_by_ref('user', $user); $templateMgr->assign_by_ref('userRoles', $roles); $templateMgr->assign('localeNames', Locale::getAllLocales()); $templateMgr->display('manager/people/userProfile.tpl'); } }
/** * Constructor. */ function MetadataForm($article, $journal) { $roleDao =& DAORegistry::getDAO('RoleDAO'); $signoffDao =& DAORegistry::getDAO('SignoffDAO'); $user =& Request::getUser(); $roleId = $roleDao->getRoleIdFromPath(Request::getRequestedPage()); if ($roleId == ROLE_ID_AUTHOR || $roleId == ROLE_ID_SECTION_EDITOR) { $this->canEdit = true; } else { $this->canEdit = false; } if ($this->canEdit) { $supportedSubmissionLocales = $journal->getSetting('supportedSubmissionLocales'); if (empty($supportedSubmissionLocales)) { $supportedSubmissionLocales = array($journal->getPrimaryLocale()); } parent::Form('submission/metadata/metadataEdit.tpl', true, $article->getLocale(), array_flip(array_intersect(array_flip(Locale::getAllLocales()), $supportedSubmissionLocales))); $this->addCheck(new FormValidatorCustom($this, 'authors', 'required', 'author.submit.form.authorRequired', function ($authors) { return count($authors) > 0; })); $this->addCheck(new FormValidatorArray($this, 'authors', 'required', 'author.submit.form.authorRequiredFields', array('firstName', 'lastName', 'affiliation', 'phone'))); $this->addCheck(new FormValidatorArray($this, 'abstracts', 'required', 'author.submit.form.abstractRequiredFields', array('scientificTitle', 'publicTitle', 'background', 'objectives', 'studyMethods', 'expectedOutcomes', 'keywords'))); $this->addCheck(new FormValidatorArrayRadios($this, 'proposalDetails', 'required', 'author.submit.form.proposalDetails', array('studentInitiatedResearch', 'international', 'multiCountryResearch', 'nationwide', 'withHumanSubjects', 'reviewedByOtherErc'))); $this->addCheck(new FormValidatorCustom($this, 'proposalDetails', 'required', 'author.submit.form.KIINameAlreadyUsed', function ($proposalDetails) { $institutionDao = DAORegistry::getDAO("InstitutionDAO"); if ($institutionDao->institutionExistsByName($proposalDetails["otherInstitutionName"])) { return false; } else { return true; } })); $this->addCheck(new FormValidatorCustom($this, 'proposalDetails', 'required', 'author.submit.form.KIIAcronymAlreadyUsed', function ($proposalDetails) { $institutionDao = DAORegistry::getDAO("InstitutionDAO"); if ($institutionDao->institutionExistsByAcronym($proposalDetails["otherInstitutionAcronym"])) { return false; } else { return true; } })); $this->addCheck(new FormValidatorArray($this, 'studentResearch', 'required', 'author.submit.form.studentResearch')); $this->addCheck(new FormValidatorArray($this, 'sources', 'required', 'author.submit.form.sourceRequiredFields', array('institution', 'amount', 'otherInstitutionName', 'otherInstitutionAcronym', 'otherInstitutionType', 'locationCountry', 'locationInternational'))); $this->addCheck(new FormValidatorArrayCustom($this, 'sources', 'required', 'author.submit.form.sourceNameAlreadyUsed', function ($otherInstitutionName) { $institutionDao = DAORegistry::getDAO("InstitutionDAO"); if ($institutionDao->institutionExistsByName($otherInstitutionName)) { return false; } else { return true; } }, array(), false, array('otherInstitutionName'))); $this->addCheck(new FormValidatorArrayCustom($this, 'sources', 'required', 'author.submit.form.sourceAccronymAlreadyUsed', function ($otherInstitutionAcronym) { $institutionDao = DAORegistry::getDAO("InstitutionDAO"); if ($institutionDao->institutionExistsByAcronym($otherInstitutionAcronym)) { return false; } else { return true; } }, array(), false, array('otherInstitutionAcronym'))); $this->addCheck(new FormValidatorArrayCustom($this, 'sources', 'required', 'author.submit.form.nonNumericValue', function ($amount) { return ctype_digit($amount); }, array(), false, array('amount'))); $this->addCheck(new FormValidatorCustom($this, 'sources', 'required', 'author.submit.form.sameSource', function ($sources) { $institutionArray = array(); foreach ($sources as $source) { if ($source["institution"] != "OTHER" && $source["institution"] != "") { array_push($institutionArray, $source["institution"]); } } if (count($institutionArray) != count(array_unique($institutionArray))) { return false; } else { return true; } })); if (isset($_POST['proposalDetails'])) { $this->addCheck(new FormValidatorCustom($this, 'sources', 'required', 'author.submit.form.sameInstitutionEntries', function ($sources, $KIIOtherInstitutionName, $KIIOtherInstitutionAcronym) { $institutionNameArray = array(); $institutionAcronymArray = array(); foreach ($sources as $source) { if ($source["otherInstitutionName"] != "NA") { array_push($institutionNameArray, $source["otherInstitutionName"]); } if ($source["otherInstitutionAcronym"] != "NA") { array_push($institutionAcronymArray, $source["otherInstitutionAcronym"]); } } if ($KIIOtherInstitutionName != "NA") { array_push($institutionNameArray, $KIIOtherInstitutionName); } if ($KIIOtherInstitutionAcronym != "NA") { array_push($institutionAcronymArray, $KIIOtherInstitutionAcronym); } if (count($institutionNameArray) != count(array_intersect_key($institutionNameArray, array_unique(array_map('strtolower', $institutionNameArray))))) { return false; } elseif (count($institutionAcronymArray) != count(array_intersect_key($institutionAcronymArray, array_unique(array_map('strtolower', $institutionAcronymArray))))) { return false; } else { return true; } }, array($_POST["proposalDetails"]["otherInstitutionName"], $_POST["proposalDetails"]["otherInstitutionAcronym"]))); } $this->addCheck(new FormValidatorArrayRadios($this, "riskAssessment", 'required', 'author.submit.form.riskAssessment', array('identityRevealed', 'unableToConsent', 'under18', 'dependentRelationship', 'ethnicMinority', 'impairment', 'pregnant', 'newTreatment', 'bioSamples', 'exportHumanTissue', 'exportReason', 'radiation', 'distress', 'inducements', 'sensitiveInfo', 'reproTechnology', 'genetic', 'stemCell', 'biosafety', 'multiInstitutions', 'conflictOfInterest'))); } else { parent::Form('submission/metadata/metadataView.tpl'); } $this->article = $article; $this->addCheck(new FormValidatorPost($this)); }
/** * Display a user's profile. * @param $args array first parameter is the ID or username of the user to display */ function userProfile($args) { parent::validate(); parent::setupTemplate(true); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('currentUrl', Request::url(null, Request::getRequestedPage())); $userDao =& DAORegistry::getDAO('UserDAO'); $userId = isset($args[0]) ? $args[0] : 0; if (is_numeric($userId)) { $userId = (int) $userId; $user = $userDao->getUser($userId); } else { $user = $userDao->getUserByUsername($userId); } if ($user == null) { // Non-existent user requested $templateMgr->assign('pageTitle', 'manager.people'); $templateMgr->assign('errorMsg', 'manager.people.invalidUser'); $templateMgr->display('common/error.tpl'); } else { $site =& Request::getSite(); $journal =& Request::getJournal(); $countryDao =& DAORegistry::getDAO('CountryDAO'); $country = null; if ($user->getCountry() != '') { $country = $countryDao->getCountry($user->getCountry()); } $templateMgr->assign('country', $country); $templateMgr->assign_by_ref('user', $user); $templateMgr->assign('localeNames', Locale::getAllLocales()); $templateMgr->assign('helpTopicId', 'journal.roles.index'); $templateMgr->display('sectionEditor/userProfile.tpl'); } }
/** * Display a user's profile. * @param $args array first parameter is the ID or username of the user to display * @param $request PKPRequest */ function userProfile($args, &$request) { $this->setupTemplate(true); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('currentUrl', $request->url(null, null, 'people', 'all')); $templateMgr->assign('helpTopicId', 'press.users.index'); $userDao =& DAORegistry::getDAO('UserDAO'); $userId = isset($args[0]) ? $args[0] : 0; if (is_numeric($userId)) { $userId = (int) $userId; $user = $userDao->getUser($userId); } else { $user = $userDao->getUserByUsername($userId); } if ($user == null) { // Non-existent user requested $templateMgr->assign('pageTitle', 'manager.people'); $templateMgr->assign('errorMsg', 'manager.people.invalidUser'); $templateMgr->assign('backLink', $request->url(null, null, 'people', 'all')); $templateMgr->assign('backLinkLabel', 'manager.people.allUsers'); $templateMgr->display('common/error.tpl'); } else { $site =& $request->getSite(); $press =& $request->getPress(); $roleDao =& DAORegistry::getDAO('RoleDAO'); $roles =& $roleDao->getRolesByUserId($user->getId(), $press->getId()); $countryDao =& DAORegistry::getDAO('CountryDAO'); $country = null; if ($user->getCountry() != '') { $country = $countryDao->getCountry($user->getCountry()); } $templateMgr->assign('country', $country); $templateMgr->assign_by_ref('user', $user); $templateMgr->assign_by_ref('userRoles', $roles); $templateMgr->assign('localeNames', Locale::getAllLocales()); $templateMgr->display('manager/people/userProfile.tpl'); } }