コード例 #1
0
 /**
  * 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');
 }
コード例 #2
0
ファイル: InstallForm.inc.php プロジェクト: ramonsodoma/ocs
 /**
  * Constructor.
  */
 function InstallForm()
 {
     parent::Form('install/install.tpl');
     // FIXME Move the below options to an external configuration file?
     $this->supportedLocales = Locale::getAllLocales();
     $this->localesComplete = array();
     foreach ($this->supportedLocales as $key => $name) {
         $this->localesComplete[$key] = Locale::isLocaleComplete($key);
     }
     $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'));
     $this->addCheck(new FormValidatorAlphaNum($this, 'adminUsername', 'required', 'installer.form.usernameAlphaNumeric'));
     $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 FormValidatorEmail($this, 'adminEmail', 'required', 'installer.form.emailRequired'));
     $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));
 }
コード例 #3
0
 /**
  * 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');
 }
コード例 #4
0
 /**
  * @covers PKPLocale
  */
 public function testIsLocaleComplete()
 {
     self::assertTrue(Locale::isLocaleComplete('en_US'));
     self::assertFalse(Locale::isLocaleComplete('pt_BR'));
     self::assertFalse(Locale::isLocaleComplete('xx_XX'));
 }