예제 #1
0
 function generateHeader()
 {
     $this->content .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
     <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . LanguageManager::getLanguage() . '" >
        <head>
            <title>' . _("Perroquet — Listening comprehension tutor — ") . $this->title . '</title>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
         <link rel="stylesheet" media="screen" type="text/css" title="Design" href="/style/default.css" />
         <link rel="icon" type="image/png" href="/ressources/style/favicon.png" />
        </head>
        <body>';
 }
예제 #2
0
 function generateContent()
 {
     $content = '
     <h1>' . _('Select language') . '</h1>';
     $langs = Config::getLanguagelist();
     $content .= '<form action="' . RessourceManager::getInnerUrl('special/language/select') . '" method="GET">';
     $content .= '
             <label for="language">' . _('Choose the new language : ') . '</label>
             <select name="language" id="language">';
     foreach ($langs as $lang) {
         if ($lang['choosable']) {
             $content .= '
             <option value="' . $lang['code'] . '" ' . ($lang['code'] == LanguageManager::getLanguage() ? 'selected="selected"' : '') . '>' . $lang['label'] . '</option>';
         }
     }
     $content .= '</select><br /><input type="submit" value="' . _("Select") . '"></form>';
     return $content;
 }
예제 #3
0
 /**
  * get the language parameters
  *
  * @param string $lang
  * @return array|bool
  */
 public function lang($lang = '')
 {
     return $this->languageManager->getLanguage($lang);
 }
예제 #4
0
// loading 'sticky' attributes values from session for this fuseaction
getStickyAttributes($oFuseaction->getName(), $oFuseaction->getStickyAttributes());
// these attributes are not needed to identify current page
$exceptAttributes = array_merge($ogFuseaction->getStickyAttributes(), $oFuseaction->getStickyAttributes());
$exceptAttributes[] = "fusebox.password";
$exceptAttributes[] = "fuseaction";
$exceptAttributes[] = "messages";
// variable to identify current page
$here = $self . "?" . serializeAttributes($exceptAttributes);
// LanguageManager initialization
$oLanguageManager = new LanguageManager($oDB, $fusebox['tableLanguages']);
if (!$oLanguageManager->initialize()) {
    _throw("FNoLanguagesTable", "There is no languages table called \"{$fusebox['tableLanguages']}\" present in DB");
}
// trying to get default language, adding it if not exists
if (!($oLanguage = $oLanguageManager->getLanguage($fusebox['defaultLanguage'], true))) {
    _throw("FCannotSetDefaultLanguage", "Cannot set default language \"{$fusebox['defaultLanguage']}\"");
}
// setting language of the site content
if (isset($attributes['language'])) {
    // trying to get given language, but not adding it automatically
    if ($otmpLanguage = $oLanguageManager->getLanguage($attributes['language'])) {
        $oLanguage = $otmpLanguage;
    } else {
        _bye("ERROR [FCannotSetGivenLanguage] " . "Cannot set given language \"{$attributes['language']}\"");
    }
    unset($otmpLanguage);
}
$oContentManager = new ContentManager($oDB, $oFuseaction, $oLanguage, $fusebox['tableContentTokens'], $fusebox['tableContent'], $fusebox['tableContentComments'], false);
$ogContentManager = new ContentManager($oDB, $ogFuseaction, $oLanguage, $fusebox['tableContentTokens'], $fusebox['tableContent'], $fusebox['tableContentComments'], false);
if (!$oContentManager->initialize() || !$ogContentManager->initialize()) {
예제 #5
0
 static function getExternUrl($key)
 {
     return 'http://' . $_SERVER["SERVER_NAME"] . '/' . LanguageManager::getLanguage() . '/' . $key;
 }
예제 #6
0
 /**
  * Affiche les langues parlées par un utilisateur et son niveau.
  * @param User $user
  *
  **/
 public function displayLanguages($userId)
 {
     // On récupère les langues parlées par un utilisateur dans un array.
     $language_manager = new LanguageManager($db);
     $languages = self::getUsersLanguages($userId);
     foreach ($languages as $language) {
         var_dump($language);
         $level = $language->levelId();
         echo '<h1>' . $language_manager->getLanguage($language->languageId()) . '<h1>';
         Form::level_form($level);
     }
 }