17 require_once
"./Services/Language/classes/class.ilObjLanguage.php";
18 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
30 parent::__construct($a_data,$a_id,$a_call_by_reference,
false);
31 $_GET[
"sort_by"] =
"language";
32 $this->lng->loadLanguageModule(
'lng');
44 if (!$rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
46 $this->
ilias->raiseError($this->lng->txt(
"permission_denied"),$this->
ilias->error_obj->MESSAGE);
50 $ilToolbar->addButton($lng->txt(
"refresh_languages"),
51 $this->ctrl->getLinkTarget($this,
"confirmRefresh"));
54 $ilToolbar->addButton($lng->txt(
"check_languages"),
55 $this->ctrl->getLinkTarget($this,
"checkLanguage"));
58 if ($rbacsystem->checkAccess(
"write",$this->object->getRefId()))
60 if(!$ilSetting->get(
'lang_detection'))
62 $ilToolbar->addButton($lng->txt(
'lng_enable_language_detection'), $this->ctrl->getLinkTarget($this,
'enableLanguageDetection'));
66 $ilToolbar->addButton($lng->txt(
'lng_disable_language_detection'), $this->ctrl->getLinkTarget($this,
'disableLanguageDetection'));
70 if($ilClientIniFile->variableExists(
'system',
'LANGUAGE_LOG'))
72 $ilToolbar->addButton($lng->txt(
'lng_download_deprecated'), $this->ctrl->getLinkTarget($this,
'listDeprecated'));
75 include_once(
"./Services/Language/classes/class.ilLanguageTableGUI.php");
77 $tpl->setContent($ltab->getHTML());
85 $this->lng->loadLanguageModule(
"meta");
89 $this->
ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->
ilias->error_obj->MESSAGE);
95 $key = $langObj->install();
99 $lang_installed[] = $key;
105 if (isset($lang_installed))
107 if (count($lang_installed) == 1)
109 $this->
data = $this->lng->txt(
"meta_l_" . $lang_installed[0]) .
" " . strtolower($this->lng->txt(
"installed")) .
".";
113 foreach ($lang_installed as $lang_key)
115 $langnames[] = $this->lng->txt(
"meta_l_" . $lang_key);
117 $this->
data = implode(
", ",$langnames) .
" " . strtolower($this->lng->txt(
"installed")) .
".";
122 $this->
data = $this->lng->txt(
"languages_already_installed");
134 $this->lng->loadLanguageModule(
"meta");
138 $this->
ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->
ilias->error_obj->MESSAGE);
144 $key = $langObj->install();
148 $lang_installed[] = $key;
154 $key = $langObj->install(
'local');
158 $local_installed[] = $key;
164 if (isset($lang_installed))
166 if (count($lang_installed) == 1)
168 $this->
data = $this->lng->txt(
"meta_l_" . $lang_installed[0]) .
" " . strtolower($this->lng->txt(
"installed")) .
".";
172 foreach ($lang_installed as $lang_key)
174 $langnames[] = $this->lng->txt(
"meta_l_" . $lang_key);
176 $this->
data = implode(
", ",$langnames) .
" " . strtolower($this->lng->txt(
"installed")) .
".";
180 if (isset($local_installed))
182 if (count($local_installed) == 1)
184 $this->
data .=
" " . $this->lng->txt(
"meta_l_" . $local_installed[0]) .
" " . $this->lng->txt(
"local_language_file") .
" " . strtolower($this->lng->txt(
"installed")) .
".";
188 foreach ($local_installed as $lang_key)
190 $langnames[] = $this->lng->txt(
"meta_l_" . $lang_key);
192 $this->
data .=
" " . implode(
", ",$langnames) .
" " . $this->lng->txt(
"local_language_files") .
" " . strtolower($this->lng->txt(
"installed")) .
".";
197 $this->
data .=
" " . $this->lng->txt(
"local_languages_already_installed");
209 $this->lng->loadLanguageModule(
"meta");
213 $this->
ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->
ilias->error_obj->MESSAGE);
220 if (!($sys_lang = $langObj->isSystemLanguage()))
221 if (!($usr_lang = $langObj->isUserLanguage()))
223 $key = $langObj->uninstall();
225 $lang_uninstalled[] = $key;
231 if (isset($lang_uninstalled))
233 if (count($lang_uninstalled) == 1)
235 $this->
data = $this->lng->txt(
"meta_l_".$lang_uninstalled[0]).
" ".$this->lng->txt(
"uninstalled");
239 foreach ($lang_uninstalled as $lang_key)
241 $langnames[] = $this->lng->txt(
"meta_l_".$lang_key);
244 $this->
data = implode(
", ",$langnames).
" ".$this->lng->txt(
"uninstalled");
249 $this->
data = $this->lng->txt(
"cannot_uninstall_systemlanguage");
253 $this->
data = $this->lng->txt(
"cannot_uninstall_language_in_use");
257 $this->
data = $this->lng->txt(
"languages_already_uninstalled");
271 $this->
data = $this->lng->txt(
"selected_languages_updated");
272 $lng->loadLanguageModule(
"meta");
278 if ($langObj->isInstalled() ==
true)
280 if ($langObj->check())
282 $langObj->flush(
'all');
284 $langObj->setTitle($langObj->getKey());
285 $langObj->setDescription(
'installed');
288 $this->
data .=
"<br />". $lng->txt(
"meta_l_".$langObj->getKey());
304 $this->
data = $this->lng->txt(
"languages_updated");
316 $this->
data = $this->lng->txt(
"selected_languages_updated");
317 $lng->loadLanguageModule(
"meta");
319 $refreshed =
array();
323 if ($langObj->refresh())
325 $refreshed[] = $langObj->getKey();
326 $this->
data .=
"<br />". $lng->txt(
"meta_l_".$langObj->getKey());
341 $this->lng->loadLanguageModule(
"meta");
343 require_once
'./Services/User/classes/class.ilObjUser.php';
347 $this->
ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->
ilias->error_obj->MESSAGE);
350 if (count(
$_POST[
"id"]) != 1)
352 $this->
ilias->raiseError($this->lng->txt(
"choose_only_one_language").
"<br/>".$this->lng->txt(
"action_aborted"),$this->
ilias->error_obj->MESSAGE);
359 if ($newUserLangObj->isUserLanguage())
361 $this->
ilias->raiseError($this->lng->txt(
"meta_l_".$newUserLangObj->getKey()).
" ".$this->lng->txt(
"is_already_your").
" ".$this->lng->txt(
"user_language").
"<br/>".$this->lng->txt(
"action_aborted"),$this->
ilias->error_obj->MESSAGE);
364 if ($newUserLangObj->isInstalled() ==
false)
366 $this->
ilias->raiseError($this->lng->txt(
"meta_l_".$newUserLangObj->getKey()).
" ".$this->lng->txt(
"language_not_installed").
"<br/>".$this->lng->txt(
"action_aborted"),$this->
ilias->error_obj->MESSAGE);
370 $curUser->setLanguage($newUserLangObj->getKey());
374 $this->
data = $this->lng->txt(
"user_language").
" ".$this->lng->txt(
"changed_to").
" ".$this->lng->txt(
"meta_l_".$newUserLangObj->getKey()).
".";
385 $this->lng->loadLanguageModule(
"meta");
389 $this->
ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->
ilias->error_obj->MESSAGE);
392 if (count(
$_POST[
"id"]) != 1)
394 $this->
ilias->raiseError($this->lng->txt(
"choose_only_one_language").
"<br/>".$this->lng->txt(
"action_aborted"),$this->
ilias->error_obj->MESSAGE);
401 if ($newSysLangObj->isSystemLanguage())
403 $this->
ilias->raiseError($this->lng->txt(
"meta_l_".$newSysLangObj->getKey()).
" is already the system language!<br>Action aborted!",$this->
ilias->error_obj->MESSAGE);
406 if ($newSysLangObj->isInstalled() ==
false)
408 $this->
ilias->raiseError($this->lng->txt(
"meta_l_".$newSysLangObj->getKey()).
" is not installed. Please install that language first.<br>Action aborted!",$this->
ilias->error_obj->MESSAGE);
411 $this->
ilias->setSetting(
"language", $newSysLangObj->getKey());
414 $this->
ilias->ini->setVariable(
"language",
"default",$newSysLangObj->getKey());
415 $this->
ilias->ini->write();
417 $this->
data = $this->lng->txt(
"system_language").
" ".$this->lng->txt(
"changed_to").
" ".$this->lng->txt(
"meta_l_".$newSysLangObj->getKey()).
".";
430 $this->
data = $this->
object->checkAllLanguages();
438 $this->ctrl->redirect($this,
"view");
455 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
457 $this->tabs_gui->addTarget(
"settings",
458 $this->ctrl->getLinkTarget($this,
"view"),
array(
"view",
""),
"",
"");
461 if ($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
463 $this->tabs_gui->addTarget(
"perm_settings",
464 $this->ctrl->getLinkTargetByClass(
array(get_class($this),
'ilpermissiongui'),
"perm"),
array(
"perm",
"info",
"owner"),
'ilpermissiongui');
470 $next_class = $this->ctrl->getNextClass($this);
471 $cmd = $this->ctrl->getCmd();
476 case 'ilpermissiongui':
477 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
479 $ret =& $this->ctrl->forwardCommand($perm_gui);
503 if ($langObj->isInstalled() ==
true)
505 $ids[] = $lang[
"obj_id"];
518 $header = $lng->txt(
"lang_refresh_confirm");
520 elseif (!empty(
$_POST[
"id"]))
523 $header = $lng->txt(
"lang_refresh_confirm_selected");
527 $this->
ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->
ilias->error_obj->MESSAGE);
530 $lng->loadLanguageModule(
"meta");
531 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
534 $some_changed =
false;
535 foreach ($ids as
$id)
538 $lang_title = $lng->txt(
'meta_l_'.$lang_key);
540 if (!empty($last_change))
542 $some_changed =
true;
543 $lang_title .=
' ('. $this->lng->txt(
"last_change").
' ' 546 $conf_screen->addItem(
"id[]", $id, $lang_title);
549 $conf_screen->setFormAction($ilCtrl->getFormAction($this));
552 $header .=
'<br />' . $lng->txt(
"lang_refresh_confirm_info");
554 $conf_screen->setHeaderText(
$header);
555 $conf_screen->setCancel($lng->txt(
"cancel"),
"view");
556 $conf_screen->setConfirm($lng->txt(
"ok"),
"refreshSelected");
557 $this->tpl->setContent($conf_screen->getHTML());
566 $this->
ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->
ilias->error_obj->MESSAGE);
569 $lng->loadLanguageModule(
"meta");
570 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
572 $conf_screen->setFormAction($ilCtrl->getFormAction($this));
573 $conf_screen->setHeaderText($lng->txt(
"lang_uninstall_confirm"));
577 $conf_screen->addItem(
"id[]", $id, $lng->txt(
"meta_l_".$lang_title));
579 $conf_screen->setCancel($lng->txt(
"cancel"),
"view");
580 $conf_screen->setConfirm($lng->txt(
"ok"),
"uninstall");
581 $this->tpl->setContent($conf_screen->getHTML());
591 $this->
ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->
ilias->error_obj->MESSAGE);
594 $lng->loadLanguageModule(
"meta");
595 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
597 $conf_screen->setFormAction($ilCtrl->getFormAction($this));
598 $conf_screen->setHeaderText($lng->txt(
"lang_uninstall_changes_confirm"));
602 $conf_screen->addItem(
"id[]", $id, $lng->txt(
"meta_l_".$lang_title));
604 $conf_screen->setCancel($lng->txt(
"cancel"),
"view");
605 $conf_screen->setConfirm($lng->txt(
"ok"),
"uninstallChanges");
606 $this->tpl->setContent($conf_screen->getHTML());
618 "install" =>
array(
"name" =>
"install",
"lng" =>
"install"),
619 "installLocal" =>
array(
"name" =>
"installLocal",
"lng" =>
"install_local"),
620 "uninstall" =>
array(
"name" =>
"uninstall",
"lng" =>
"uninstall"),
621 "refresh" =>
array(
"name" =>
"confirmRefreshSelected",
"lng" =>
"refresh"),
622 "setSystemLanguage" =>
array(
"name" =>
"setSystemLanguage",
"lng" =>
"setSystemLanguage"),
623 "setUserLanguage" =>
array(
"name" =>
"setUserLanguage",
"lng" =>
"setUserLanguage")
630 protected function disableLanguageDetectionObject()
637 $ilSetting->set(
'lang_detection', 0);
645 protected function enableLanguageDetectionObject()
652 $ilSetting->set(
'lang_detection', 1);
664 $rbacsystem = $DIC->rbac()->system();
666 $ilToolbar = $DIC->toolbar();
667 $ctrl = $DIC->ctrl();
668 $lng = $DIC->language();
670 if (!$rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
672 $this->
ilias->raiseError($this->lng->txt(
"permission_denied"),$this->
ilias->error_obj->MESSAGE);
675 $ilToolbar->addButton(
$lng->txt(
"download"),
676 $ctrl->getLinkTarget($this,
"downloadDeprecated"));
678 include_once(
"./Services/Language/classes/class.ilLangDeprecated.php");
682 foreach (
$d->getDeprecatedLangVars() as $key => $mod)
684 $res.= $mod.
",".$key.
"\n";
687 $tpl->setContent(
"<pre>".
$res.
"</pre>");
697 $rbacsystem = $DIC->rbac()->system();
699 if (!$rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
701 $this->
ilias->raiseError($this->lng->txt(
"permission_denied"),$this->
ilias->error_obj->MESSAGE);
704 include_once(
"./Services/Language/classes/class.ilLangDeprecated.php");
707 foreach (
$d->getDeprecatedLangVars() as $key => $mod)
709 $res.= $mod.
",".$key.
"\n";
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
refreshSelectedObject()
update selected languages
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
installObject()
install languages
__construct($a_data, $a_id, $a_call_by_reference)
Constructor.
refreshObject()
update all installed languages
setSystemLanguageObject()
set the system language
setUserLanguageObject()
set user language
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
listDeprecatedObject()
Download deprecated lang entries.
static _lookupTitle($a_id)
lookup object title
static _getObjectsByType($a_obj_type="", $a_owner="")
Get objects by type.
for($col=0; $col< 50; $col++) $d
installLocalObject()
Install local language modifications.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Search for deprecated lang vars.
prepareOutput($a_show_subobjects=true)
prepare output
uninstallChangesObject()
Uninstall local changes in the database.
getId()
get object id public
Class ilObjectGUI Basic methods of all Output classes.
static formatDate(ilDateTime $date)
Format a date public.
redirection script todo: (a better solution should control the processing via a xml file) ...
downloadDeprecatedObject()
Download deprecated lang entries.
Create styles array
The data for the language used.
viewObject()
show installed languages
confirmUninstallChangesObject()
uninstallObject()
uninstall language
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
static refreshAll()
Refresh all installed languages.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static _getLastLocalChange($a_key)
get the date of the last local change
static refreshPlugins($a_lang_keys=null)
checkLanguageObject()
check all languages
Class ilObjLanguageFolderGUI.
Confirmation screen class.
confirmRefreshSelectedObject($a_ids=array())