예제 #1
0
 /**
  * Turn a non-multiLang field into multiLang.
  * 
  * @global string $currentCourseLanguage
  * @global string $webDir
  * @global string $siteName
  * @global string $Institution
  * @global string $InstitutionUrl
  * @param  CourseXMLElement $ele
  * @return array
  */
 private static function makeMultiLang($ele) {
     global $currentCourseLanguage, $language, $webDir;
     global $siteName, $Institution, $InstitutionUrl; // required for proper including commons and langs, ignore unused scope warning
     if (empty($currentCourseLanguage)) {
         $clang = $language;
     } else {
         $clang = $currentCourseLanguage;
     }
     $arr = array();
     $key = (string) $ele;
     if (!isset($GLOBALS['langCMeta'][$key])) {
         if ($ele->getName() === 'institution') {
             $key = 'otherinst';
         }
         if ($ele->getName() === 'thematic') {
             $key = 'othersubj';
         }
         if ($ele->getName() === 'subthematic') {
             $key = 'othersubsubj';
         }
     }
     $arr[$clang] = $GLOBALS['langCMeta'][$key];
     $revert = false;
     if ($clang != 'en') {
         require("${webDir}/lang/en/common.inc.php");
         require("${webDir}/lang/en/messages.inc.php");
         $arr['en'] = $langCMeta[$key]; // do not use GLOBALS here as it will not work
         $revert = true;
     }
     if ($clang != 'el') {
         require("${webDir}/lang/el/common.inc.php");
         require("${webDir}/lang/el/messages.inc.php");
         $arr['el'] = $langCMeta[$key]; // do not use GLOBALS here as it will not work
         $revert = true;
     }
     if ($revert) { // revert messages back to current language
         require("${webDir}/lang/" . $clang . "/common.inc.php");
         require("${webDir}/lang/" . $clang . "/messages.inc.php");
     }
     return base64_encode(serialize($arr));
 }
예제 #2
0
 /**
  * Turn a non-multiLang field into multiLang.
  * 
  * @global string $currentCourseLanguage
  * @global string $webDir
  * @global string $siteName
  * @global string $Institution
  * @global string $InstitutionUrl
  * @param  CourseXMLElement $ele
  * @return array
  */
 private static function makeMultiLang($ele)
 {
     global $currentCourseLanguage, $webDir, $siteName, $Institution, $InstitutionUrl;
     if (empty($currentCourseLanguage)) {
         $currentCourseLanguage = 'greek';
     }
     $clang = langname_to_code($currentCourseLanguage);
     $arr = array();
     $key = (string) $ele;
     if (!isset($GLOBALS['langCMeta'][$key])) {
         if ($ele->getName() === 'institution') {
             $key = 'otherinst';
         }
         if ($ele->getName() === 'thematic') {
             $key = 'othersubj';
         }
         if ($ele->getName() === 'subthematic') {
             $key = 'othersubsubj';
         }
     }
     $arr[$clang] = $GLOBALS['langCMeta'][$key];
     $revert = false;
     if ($clang != 'en') {
         include "{$webDir}/lang/en/common.inc.php";
         include "{$webDir}/lang/en/messages.inc.php";
         $arr['en'] = $langCMeta[$key];
         $revert = true;
     }
     if ($clang != 'el') {
         include "{$webDir}/lang/el/common.inc.php";
         include "{$webDir}/lang/el/messages.inc.php";
         $arr['en'] = $langCMeta[$key];
         $revert = true;
     }
     if ($revert) {
         // revert messages back to current language
         include "{$webDir}/lang/" . $currentCourseLanguage . "/common.inc.php";
         include "{$webDir}/lang/" . $currentCourseLanguage . "/messages.inc.php";
     }
     return base64_encode(serialize($arr));
 }