37 require_once
"./Services/Language/classes/class.ilObjLanguage.php";
38 require_once
"./classes/class.ilObjectGUI.php";
50 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,
false);
51 $_GET[
"sort_by"] =
"language";
63 if (!$rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
65 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
69 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
71 if ($ilSetting->get(
"lang_ext_maintenance") ==
"1")
73 $this->tpl->setCurrentBlock(
"btn_cell");
74 $this->tpl->setVariable(
"BTN_LINK",
75 $this->ctrl->getLinkTarget($this,
"confirmRefresh"));
76 $this->tpl->setVariable(
"BTN_TXT",$this->lng->txt(
"refresh_languages"));
77 $this->tpl->parseCurrentBlock();
81 $this->tpl->setCurrentBlock(
"btn_cell");
82 $this->tpl->setVariable(
"BTN_LINK",
83 $this->ctrl->getLinkTarget($this,
"refresh"));
84 $this->tpl->setVariable(
"BTN_TXT",$this->lng->txt(
"refresh_languages"));
85 $this->tpl->parseCurrentBlock();
88 $this->tpl->setCurrentBlock(
"btn_cell");
89 $this->tpl->setVariable(
"BTN_LINK",
90 $this->ctrl->getLinkTarget($this,
"checkLanguage"));
91 $this->tpl->setVariable(
"BTN_TXT",$this->lng->txt(
"check_languages"));
92 $this->tpl->parseCurrentBlock();
95 if ($rbacsystem->checkAccess(
"write",$this->object->getRefId()))
97 if ($ilSetting->get(
"lang_ext_maintenance") ==
"1")
99 $this->tpl->setCurrentBlock(
"btn_cell");
100 $this->tpl->setVariable(
"BTN_LINK",
101 $this->ctrl->getLinkTarget($this,
"disableExtendedLanguageMaintenance"));
102 $this->tpl->setVariable(
"BTN_TXT",$this->lng->txt(
"disable_ext_lang_maint"));
103 $this->tpl->parseCurrentBlock();
107 $this->tpl->setCurrentBlock(
"btn_cell");
108 $this->tpl->setVariable(
"BTN_LINK",
109 $this->ctrl->getLinkTarget($this,
"enableExtendedLanguageMaintenance"));
110 $this->tpl->setVariable(
"BTN_TXT",$this->lng->txt(
"enable_ext_lang_maint"));
111 $this->tpl->parseCurrentBlock();
116 $this->data = array();
117 $this->data[
"data"] = array();
118 $this->data[
"ctrl"] = array();
119 $this->data[
"cols"] = array(
"",
"language",
"status",
"last_change",
"usr_agreement");
121 $languages = $this->
object->getLanguages();
123 foreach ($languages as $lang_key => $lang_data)
128 if ($lang_data[
"status"])
130 $status =
"<span class=\"small\"> (".$this->lng->txt($lang_data[
"status"]).
")</span>";
134 switch ($lang_data[
"info"])
136 case "file_not_found":
137 $remark =
"<span class=\"smallred\"> ".$this->lng->txt($lang_data[
"info"]).
"</span>";
140 $remark =
"<span class=\"smallgreen\"> ".$this->lng->txt($lang_data[
"info"]).
"</span>";
147 if (file_exists(
"./Customizing/clients/".CLIENT_ID.
"/agreement/".
148 "agreement_".$lang_key.
".html"))
150 $agreement_exists_str = $this->lng->txt(
"available").
" (".$this->lng->txt(
"client").
")";
152 else if (file_exists(
"./Customizing/global/agreement/".
153 "agreement_".$lang_key.
".html"))
155 $agreement_exists_str = $this->lng->txt(
"available");
159 if ($lang_data[
"status"] ==
"system_language")
161 $agreement_exists_str =
"<b>".$this->lng->txt(
"missing").
"</b>";
165 $agreement_exists_str = $this->lng->txt(
"missing");
170 if ($rbacsystem->checkAccess(
"write",$this->object->getRefId()))
172 if ($ilSetting->get(
"lang_ext_maintenance") ==
"1")
174 if (substr($lang_data[
"description"],0,9) ==
"installed")
176 $this->ctrl->setParameterByClass(
"ilobjlanguageextgui",
"obj_id",$lang_data[
"obj_id"]);
177 $url = $this->ctrl->getLinkTargetByClass(
"ilobjlanguageextgui",
"");
178 $lang_data[
"name"] =
'<a href="'.$url.
'">'.$lang_data[
"name"].
'</a>';
184 $this->data[
"data"][] = array(
185 "language" => $lang_data[
"name"].$status,
186 "status" => $this->lng->txt($lang_data[
"desc"]).
"<br/>".$remark,
187 "last_change" => $lang_data[
"last_update"],
188 "obj_id" => $lang_data[
"obj_id"],
189 "agreement" => $agreement_exists_str
194 $this->maxcount = count($this->data[
"data"]);
200 foreach ($this->data[
"data"] as $key => $val)
202 $this->data[
"ctrl"][$key] = array(
203 "obj_id" => $val[
"obj_id"],
204 "type" => $val[
"type"]
207 unset($this->data[
"data"][$key][
"obj_id"]);
222 global
$tree, $rbacsystem;
224 require_once
"./Services/Table/classes/class.ilTableGUI.php";
227 $this->tpl->addBlockfile(
"ADM_CONTENT",
"adm_content",
"tpl.table.html");
229 $this->tpl->addBlockfile(
"TBL_CONTENT",
"tbl_content",
"tpl.obj_tbl_rows.html");
233 $this->tpl->setVariable(
"FORMACTION",
234 $this->ctrl->getFormAction($this));
243 $tbl->disable(
"title");
245 foreach ($this->data[
"cols"] as $val)
247 $header_names[] = $this->lng->txt($val);
250 $tbl->setHeaderNames($header_names);
252 $header_params = array(
"ref_id" => $this->ref_id);
253 $tbl->setHeaderVars($this->data[
"cols"],$header_params);
256 $tbl->setOrderColumn(
$_GET[
"sort_by"]);
257 $tbl->setOrderDirection(
$_GET[
"sort_order"]);
260 $tbl->setMaxCount($this->maxcount);
261 $tbl->disable(
"sort");
264 $this->tpl->setVariable(
"COLUMN_COUNTS",count($this->data[
"cols"]));
268 $tbl->setFooter(
"tblfooter",$this->lng->txt(
"previous"),$this->lng->txt(
"next"));
274 if (is_array($this->data[
"data"][0]))
277 for ($i=0; $i < count($this->data[
"data"]); $i++)
279 $data = $this->data[
"data"][$i];
280 $ctrl = $this->data[
"ctrl"][$i];
285 $this->tpl->setCurrentBlock(
"checkbox");
286 $this->tpl->setVariable(
"CHECKBOX_ID",$ctrl[
"obj_id"]);
287 $this->tpl->setVariable(
"CSS_ROW",$css_row);
288 $this->tpl->parseCurrentBlock();
290 $this->tpl->setCurrentBlock(
"table_cell");
291 $this->tpl->setVariable(
"CELLSTYLE",
"tblrow1");
292 $this->tpl->parseCurrentBlock();
294 foreach (
$data as $key => $val)
297 $this->tpl->setCurrentBlock(
"text");
299 $this->tpl->setVariable(
"TEXT_CONTENT", $val);
300 $this->tpl->parseCurrentBlock();
302 $this->tpl->setCurrentBlock(
"table_cell");
303 $this->tpl->parseCurrentBlock();
307 $this->tpl->setCurrentBlock(
"tbl_content");
308 $this->tpl->setVariable(
"CSS_ROW", $css_row);
309 $this->tpl->parseCurrentBlock();
319 if (!isset($_POST[
"id"]))
321 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
324 foreach ($_POST[
"id"] as
$obj_id)
327 $key = $langObj->install();
331 $lang_installed[] = $key;
337 if (isset($lang_installed))
339 if (count($lang_installed) == 1)
341 $this->data = $this->lng->txt(
"lang_" . $lang_installed[0]) .
" " . strtolower($this->lng->txt(
"installed")) .
".";
345 foreach ($lang_installed as $lang_key)
347 $langnames[] = $this->lng->txt(
"lang_" . $lang_key);
349 $this->data = implode(
", ",$langnames) .
" " . strtolower($this->lng->txt(
"installed")) .
".";
354 $this->data = $this->lng->txt(
"languages_already_installed");
366 if (!isset($_POST[
"id"]))
368 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
371 foreach ($_POST[
"id"] as
$obj_id)
374 $key = $langObj->install();
378 $lang_installed[] = $key;
384 $key = $langObj->install(
'local');
388 $local_installed[] = $key;
394 if (isset($lang_installed))
396 if (count($lang_installed) == 1)
398 $this->data = $this->lng->txt(
"lang_" . $lang_installed[0]) .
" " . strtolower($this->lng->txt(
"installed")) .
".";
402 foreach ($lang_installed as $lang_key)
404 $langnames[] = $this->lng->txt(
"lang_" . $lang_key);
406 $this->data = implode(
", ",$langnames) .
" " . strtolower($this->lng->txt(
"installed")) .
".";
410 if (isset($local_installed))
412 if (count($local_installed) == 1)
414 $this->data .=
" " . $this->lng->txt(
"lang_" . $local_installed[0]) .
" " . $this->lng->txt(
"local_language_file") .
" " . strtolower($this->lng->txt(
"installed")) .
".";
418 foreach ($local_installed as $lang_key)
420 $langnames[] = $this->lng->txt(
"lang_" . $lang_key);
422 $this->data .=
" " . implode(
", ",$langnames) .
" " . $this->lng->txt(
"local_language_files") .
" " . strtolower($this->lng->txt(
"installed")) .
".";
427 $this->data .=
" " . $this->lng->txt(
"local_languages_already_installed");
439 if (!isset($_POST[
"id"]))
441 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
445 foreach ($_POST[
"id"] as
$obj_id)
448 if (!($sys_lang = $langObj->isSystemLanguage()))
449 if (!($usr_lang = $langObj->isUserLanguage()))
451 $key = $langObj->uninstall();
453 $lang_uninstalled[] = $key;
459 if (isset($lang_uninstalled))
461 if (count($lang_uninstalled) == 1)
463 $this->data = $this->lng->txt(
"lang_".$lang_uninstalled[0]).
" ".$this->lng->txt(
"uninstalled");
467 foreach ($lang_uninstalled as $lang_key)
469 $langnames[] = $this->lng->txt(
"lang_".$lang_key);
472 $this->data = implode(
", ",$langnames).
" ".$this->lng->txt(
"uninstalled");
477 $this->data = $this->lng->txt(
"cannot_uninstall_systemlanguage");
481 $this->data = $this->lng->txt(
"cannot_uninstall_language_in_use");
485 $this->data = $this->lng->txt(
"languages_already_uninstalled");
498 foreach ($languages as
$lang)
502 if ($langObj->isInstalled() ==
true)
504 if ($langObj->check())
506 $langObj->flush(
'keep_local');
508 $langObj->setTitle($langObj->getKey());
509 $langObj->setDescription($langObj->getStatus());
511 $langObj->optimizeData();
513 if ($langObj->isLocal() ==
true)
515 if ($langObj->check(
'local'))
517 $langObj->insert(
'local');
518 $langObj->setTitle($langObj->getKey());
519 $langObj->setDescription($langObj->getStatus());
521 $langObj->optimizeData();
530 $this->data = $this->lng->txt(
"languages_updated");
543 $this->data = $this->lng->txt(
"selected_languages_updated");
544 $lng->loadLanguageModule(
"meta");
546 foreach ($_POST[
"id"] as
$id)
550 if ($langObj->isInstalled() ==
true)
552 if ($langObj->check())
554 $langObj->flush(
'keep_local');
556 $langObj->setTitle($langObj->getKey());
557 $langObj->setDescription($langObj->getStatus());
559 $langObj->optimizeData();
561 if ($langObj->isLocal() ==
true)
563 if ($langObj->check(
'local'))
565 $langObj->insert(
'local');
566 $langObj->setTitle($langObj->getKey());
567 $langObj->setDescription($langObj->getStatus());
569 $langObj->optimizeData();
573 $this->data .=
"<br />". $lng->txt(
"meta_l_".$langObj->getKey());
588 require_once
'./Services/User/classes/class.ilObjUser.php';
590 if (!isset($_POST[
"id"]))
592 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
595 if (count($_POST[
"id"]) != 1)
597 $this->ilias->raiseError($this->lng->txt(
"choose_only_one_language").
"<br/>".$this->lng->txt(
"action_aborted"),$this->ilias->error_obj->MESSAGE);
604 if ($newUserLangObj->isUserLanguage())
606 $this->ilias->raiseError($this->lng->txt(
"lang_".$newUserLangObj->getKey()).
" ".$this->lng->txt(
"is_already_your").
" ".$this->lng->txt(
"user_language").
"<br/>".$this->lng->txt(
"action_aborted"),$this->ilias->error_obj->MESSAGE);
609 if ($newUserLangObj->isInstalled() ==
false)
611 $this->ilias->raiseError($this->lng->txt(
"lang_".$newUserLangObj->getKey()).
" ".$this->lng->txt(
"language_not_installed").
"<br/>".$this->lng->txt(
"action_aborted"),$this->ilias->error_obj->MESSAGE);
615 $curUser->setLanguage($newUserLangObj->getKey());
619 $this->data = $this->lng->txt(
"user_language").
" ".$this->lng->txt(
"changed_to").
" ".$this->lng->txt(
"lang_".$newUserLangObj->getKey()).
".";
630 if (!isset($_POST[
"id"]))
632 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
635 if (count($_POST[
"id"]) != 1)
637 $this->ilias->raiseError($this->lng->txt(
"choose_only_one_language").
"<br/>".$this->lng->txt(
"action_aborted"),$this->ilias->error_obj->MESSAGE);
644 if ($newSysLangObj->isSystemLanguage())
646 $this->ilias->raiseError($this->lng->txt(
"lang_".$newSysLangObj->getKey()).
" is already the system language!<br>Action aborted!",$this->ilias->error_obj->MESSAGE);
649 if ($newSysLangObj->isInstalled() ==
false)
651 $this->ilias->raiseError($this->lng->txt(
"lang_".$newSysLangObj->getKey()).
" is not installed. Please install that language first.<br>Action aborted!",$this->ilias->error_obj->MESSAGE);
654 $this->ilias->setSetting(
"language", $newSysLangObj->getKey());
657 $this->ilias->ini->setVariable(
"language",
"default",$newSysLangObj->getKey());
658 $this->ilias->ini->write();
660 $this->data = $this->lng->txt(
"system_language").
" ".$this->lng->txt(
"changed_to").
" ".$this->lng->txt(
"lang_".$newSysLangObj->getKey()).
".";
673 $this->data = $this->
object->checkAllLanguages();
681 $this->ctrl->redirect($this,
"view");
698 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
700 $tabs_gui->addTarget(
"settings",
701 $this->ctrl->getLinkTarget($this,
"view"), array(
"view",
""),
"",
"");
704 if ($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
706 $tabs_gui->addTarget(
"perm_settings",
707 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
713 $next_class = $this->ctrl->getNextClass($this);
714 $cmd = $this->ctrl->getCmd();
719 case 'ilpermissiongui':
720 include_once(
"./classes/class.ilPermissionGUI.php");
722 $ret =& $this->ctrl->forwardCommand($perm_gui);
745 $ilSetting->set(
"lang_ext_maintenance", 1);
746 $ilCtrl->redirect($this,
"view");
756 $ilSetting->set(
"lang_ext_maintenance", 0);
757 $ilCtrl->redirect($this,
"view");
764 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
766 $conf_screen->setFormAction($ilCtrl->getFormAction($this));
767 $conf_screen->setHeaderText($lng->txt(
"lang_refresh_confirm"));
768 $conf_screen->addItem(
"d",
"d", $lng->txt(
"lang_refresh_confirm_info"));
769 $conf_screen->setCancel($lng->txt(
"cancel"),
"view");
770 $conf_screen->setConfirm($lng->txt(
"ok"),
"refresh");
772 $this->tpl->setContent($conf_screen->getHTML());
779 if (!isset($_POST[
"id"]))
781 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
784 $lng->loadLanguageModule(
"meta");
785 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
787 $conf_screen->setFormAction($ilCtrl->getFormAction($this));
788 $conf_screen->setHeaderText($lng->txt(
"lang_refresh_confirm_selected"));
789 foreach ($_POST[
"id"] as
$id)
792 $conf_screen->addItem(
"id[]", $id, $lng->txt(
"meta_l_".$lang_title));
794 $conf_screen->addItem(
"d",
"d", $lng->txt(
"lang_refresh_confirm_info"));
795 $conf_screen->setCancel($lng->txt(
"cancel"),
"view");
796 $conf_screen->setConfirm($lng->txt(
"ok"),
"refreshSelected");
797 $this->tpl->setContent($conf_screen->getHTML());
809 "install" => array(
"name" =>
"install",
"lng" =>
"install"),
810 "installLocal" => array(
"name" =>
"installLocal",
"lng" =>
"install_local"),
811 "uninstall" => array(
"name" =>
"uninstall",
"lng" =>
"uninstall"),
812 "refresh" => $ilSetting->get(
"lang_ext_maintenance") ==
"1" ?
813 array(
"name" =>
"confirmRefreshSelected",
"lng" =>
"refresh") :
814 array(
"name" =>
"RefreshSelected",
"lng" =>
"refresh"),
815 "setSystemLanguage" => array(
"name" =>
"setSystemLanguage",
"lng" =>
"setSystemLanguage"),
816 "setUserLanguage" => array(
"name" =>
"setUserLanguage",
"lng" =>
"setUserLanguage")