Exemplo n.º 1
0
 /**
  * Refresh all installed languages
  */
 static function refreshAll()
 {
     global $ilPluginAdmin;
     $languages = ilObject::_getObjectsByType("lng");
     foreach ($languages as $lang) {
         $langObj = new ilObjLanguage($lang["obj_id"], false);
         if ($langObj->isInstalled() == true) {
             if ($langObj->check()) {
                 $langObj->flush('keep_local');
                 $langObj->insert();
                 $langObj->setTitle($langObj->getKey());
                 $langObj->setDescription($langObj->getStatus());
                 $langObj->update();
                 $langObj->optimizeData();
                 if ($langObj->isLocal() == true) {
                     if ($langObj->check('local')) {
                         $langObj->insert('local');
                         $langObj->setTitle($langObj->getKey());
                         $langObj->setDescription($langObj->getStatus());
                         $langObj->update();
                         $langObj->optimizeData();
                     }
                 }
             }
         }
         unset($langObj);
     }
     // refresh languages of activated plugins
     include_once "./Services/Component/classes/class.ilPluginSlot.php";
     $slots = ilPluginSlot::getAllSlots();
     foreach ($slots as $slot) {
         $act_plugins = $ilPluginAdmin->getActivePluginsForSlot($slot["component_type"], $slot["component_name"], $slot["slot_id"]);
         foreach ($act_plugins as $plugin) {
             include_once "./Services/Component/classes/class.ilPlugin.php";
             $pl = ilPlugin::getPluginObject($slot["component_type"], $slot["component_name"], $slot["slot_id"], $plugin);
             if (is_object($pl)) {
                 $pl->updateLanguages();
             }
         }
     }
 }
 /**
  * update selected languages
  */
 function refreshSelectedObject()
 {
     global $lng;
     $this->data = $this->lng->txt("selected_languages_updated");
     $lng->loadLanguageModule("meta");
     foreach ($_POST["id"] as $id) {
         $langObj = new ilObjLanguage($id, false);
         if ($langObj->isInstalled() == true) {
             if ($langObj->check()) {
                 $langObj->flush('keep_local');
                 $langObj->insert();
                 $langObj->setTitle($langObj->getKey());
                 $langObj->setDescription($langObj->getStatus());
                 $langObj->update();
                 $langObj->optimizeData();
                 if ($langObj->isLocal() == true) {
                     if ($langObj->check('local')) {
                         $langObj->insert('local');
                         $langObj->setTitle($langObj->getKey());
                         $langObj->setDescription($langObj->getStatus());
                         $langObj->update();
                         $langObj->optimizeData();
                     }
                 }
             }
             $this->data .= "<br />" . $lng->txt("meta_l_" . $langObj->getKey());
         }
         unset($langObj);
     }
     $this->out();
 }