ILIAS  release_8 Revision v8.24
class.ilObjSystemFolderGUI.php
Go to the documentation of this file.
1<?php
2
24
34{
39
43 protected $tabs;
44
48 protected $rbacsystem;
49
54
59
63 protected $db;
64
69
73 protected $help;
74
78 protected $client_ini;
79
83 protected $bench;
84
85 public string $type;
86 protected \ILIAS\HTTP\Wrapper\WrapperFactory $wrapper;
87 protected \ILIAS\Refinery\Factory $refinery;
88
93 public function __construct($a_data, $a_id, $a_call_by_reference)
94 {
95 global $DIC;
96
97 $this->tabs = $DIC->tabs();
98 $this->access = $DIC->access();
99 $this->ctrl = $DIC->ctrl();
100 $this->rbacsystem = $DIC->rbac()->system();
101 $this->user = $DIC->user();
102 $this->obj_definition = $DIC["objDefinition"];
103 $this->settings = $DIC->settings();
104 $this->error = $DIC["ilErr"];
105 $this->db = $DIC->database();
106 $this->style_definition = $DIC["styleDefinition"];
107 $this->lng = $DIC->language();
108 $this->tpl = $DIC["tpl"];
109 $this->help = $DIC["ilHelp"];
110 $this->toolbar = $DIC->toolbar();
111 $this->client_ini = $DIC["ilClientIniFile"];
112 $this->type = "adm";
113 $this->bench = $DIC["ilBench"];
114 $this->wrapper = $DIC->http()->wrapper();
115 $this->refinery = $DIC->refinery();
116 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
117
118 $this->lng->loadLanguageModule("administration");
119 $this->lng->loadLanguageModule("adm");
120 $this->content_style_domain = $DIC->contentStyle()
121 ->domain()
122 ->styleForRefId($this->object->getRefId());
123 }
124
125 public function executeCommand(): void
126 {
127 $ilTabs = $this->tabs;
128
129 $next_class = $this->ctrl->getNextClass($this);
130 $this->prepareOutput();
131
132 switch ($next_class) {
133 case 'ilpermissiongui':
134 $perm_gui = new ilPermissionGUI($this);
135 $this->ctrl->forwardCommand($perm_gui);
136 break;
137
138 case 'ilimprintgui':
139 // page editor will set its own tabs
140 $ilTabs->clearTargets();
141 $ilTabs->setBackTarget(
142 $this->lng->txt("back"),
143 $this->ctrl->getLinkTarget($this, "")
144 );
145
146 $igui = new ilImprintGUI();
147
148 // needed for editor
149 $igui->setStyleId(
150 $this->content_style_domain->getEffectiveStyleId()
151 );
152
153 if (!$this->checkPermissionBool("write")) {
154 $igui->setEnableEditing(false);
155 }
156
157 $ret = $this->ctrl->forwardCommand($igui);
158 if ($ret != "") {
159 $this->tpl->setContent($ret);
160 }
161 break;
162
163 case "ilobjectownershipmanagementgui":
164 $this->setSystemCheckSubTabs("no_owner");
165 $gui = new ilObjectOwnershipManagementGUI(0);
166 $this->ctrl->forwardCommand($gui);
167 break;
168
169 case "ilcronmanagergui":
170 $ilTabs->activateTab("cron_jobs");
171 $gui = new ilCronManagerGUI();
172 $this->ctrl->forwardCommand($gui);
173 break;
174
175 default:
176//var_dump($_POST);
177 $cmd = $this->ctrl->getCmd("view");
178
179 $cmd .= "Object";
180 $this->$cmd();
181
182 break;
183 }
184 }
185
191 public function viewObject(): void
192 {
193 $ilAccess = $this->access;
194
195 if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
197 return;
198 }
199 $this->showServerInfoObject();
200 }
201
202 public function viewScanLogObject(): void
203 {
204 $this->viewScanLog();
205 }
206
210 public function setSystemCheckSubTabs($a_activate): void
211 {
212 $ilTabs = $this->tabs;
213 $ilCtrl = $this->ctrl;
214
215 $ilTabs->addSubTab(
216 "system_check_sub",
217 $this->lng->txt("system_check"),
218 $ilCtrl->getLinkTarget($this, "check")
219 );
220 $ilTabs->addSubTab(
221 "no_owner",
222 $this->lng->txt("system_check_no_owner"),
223 $ilCtrl->getLinkTargetByClass("ilObjectOwnershipManagementGUI")
224 );
225
226 $ilTabs->setSubTabActive($a_activate);
227 $ilTabs->setTabActive("system_check");
228 }
229
235 public function checkObject(): void
236 {
239 $objDefinition = $this->obj_definition;
242
243 $this->setSystemCheckSubTabs("system_check_sub");
244
245 if (!$rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
246 $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
247 }
248
249 if ($_POST['count_limit'] !== null || $_POST['age_limit'] !== null || $_POST['type_limit'] !== null) {
250 $ilUser->writePref(
251 'systemcheck_count_limit',
252 (is_numeric($_POST['count_limit']) && $_POST['count_limit'] > 0) ? $_POST['count_limit'] : ''
253 );
254 $ilUser->writePref(
255 'systemcheck_age_limit',
256 (is_numeric($_POST['age_limit']) && $_POST['age_limit'] > 0) ? $_POST['age_limit'] : ''
257 );
258 $ilUser->writePref('systemcheck_type_limit', trim($_POST['type_limit']));
259 }
260
261 if ($_POST["mode"]) {
262 $this->writeCheckParams();
263 $this->startValidator($_POST["mode"], $_POST["log_scan"]);
264 } else {
265 $validator = new ilValidator();
266 $hasScanLog = $validator->hasScanLog();
267
268 $this->tpl->addBlockFile(
269 "ADM_CONTENT",
270 "adm_content",
271 "tpl.adm_check.html",
272 "Modules/SystemFolder"
273 );
274
275 if ($hasScanLog) {
276 $this->tpl->setVariable("TXT_VIEW_LOG", $this->lng->txt("view_last_log"));
277 }
278
279 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
280 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("systemcheck"));
281 $this->tpl->setVariable("COLSPAN", 3);
282 $this->tpl->setVariable("TXT_ANALYZE_TITLE", $this->lng->txt("analyze_data"));
283 $this->tpl->setVariable("TXT_ANALYSIS_OPTIONS", $this->lng->txt("analysis_options"));
284 $this->tpl->setVariable("TXT_REPAIR_OPTIONS", $this->lng->txt("repair_options"));
285 $this->tpl->setVariable("TXT_OUTPUT_OPTIONS", $this->lng->txt("output_options"));
286 $this->tpl->setVariable("TXT_SCAN", $this->lng->txt("scan"));
287 $this->tpl->setVariable("TXT_SCAN_DESC", $this->lng->txt("scan_desc"));
288 $this->tpl->setVariable("TXT_DUMP_TREE", $this->lng->txt("dump_tree"));
289 $this->tpl->setVariable("TXT_DUMP_TREE_DESC", $this->lng->txt("dump_tree_desc"));
290 $this->tpl->setVariable("TXT_CLEAN", $this->lng->txt("clean"));
291 $this->tpl->setVariable("TXT_CLEAN_DESC", $this->lng->txt("clean_desc"));
292 $this->tpl->setVariable("TXT_RESTORE", $this->lng->txt("restore_missing"));
293 $this->tpl->setVariable("TXT_RESTORE_DESC", $this->lng->txt("restore_missing_desc"));
294 $this->tpl->setVariable("TXT_PURGE", $this->lng->txt("purge_missing"));
295 $this->tpl->setVariable("TXT_PURGE_DESC", $this->lng->txt("purge_missing_desc"));
296 $this->tpl->setVariable("TXT_RESTORE_TRASH", $this->lng->txt("restore_trash"));
297 $this->tpl->setVariable("TXT_RESTORE_TRASH_DESC", $this->lng->txt("restore_trash_desc"));
298 $this->tpl->setVariable("TXT_PURGE_TRASH", $this->lng->txt("purge_trash"));
299 $this->tpl->setVariable("TXT_PURGE_TRASH_DESC", $this->lng->txt("purge_trash_desc"));
300 $this->tpl->setVariable("TXT_COUNT_LIMIT", $this->lng->txt("purge_count_limit"));
301 $this->tpl->setVariable("TXT_COUNT_LIMIT_DESC", $this->lng->txt("purge_count_limit_desc"));
302 $this->tpl->setVariable("COUNT_LIMIT_VALUE", $ilUser->getPref("systemcheck_count_limit"));
303 $this->tpl->setVariable("TXT_AGE_LIMIT", $this->lng->txt("purge_age_limit"));
304 $this->tpl->setVariable("TXT_AGE_LIMIT_DESC", $this->lng->txt("purge_age_limit_desc"));
305 $this->tpl->setVariable("AGE_LIMIT_VALUE", $ilUser->getPref("systemcheck_age_limit"));
306 $this->tpl->setVariable("TXT_TYPE_LIMIT", $this->lng->txt("purge_type_limit"));
307 $this->tpl->setVariable("TXT_TYPE_LIMIT_DESC", $this->lng->txt("purge_type_limit_desc"));
308
309 if ($ilUser->getPref('systemcheck_mode_scan')) {
310 $this->tpl->touchBlock('mode_scan_checked');
311 }
312 if ($ilUser->getPref('systemcheck_mode_dump_tree')) {
313 $this->tpl->touchBlock('mode_dump_tree_checked');
314 }
315 if ($ilUser->getPref('systemcheck_mode_clean')) {
316 $this->tpl->touchBlock('mode_clean_checked');
317 }
318 if ($ilUser->getPref('systemcheck_mode_restore')) {
319 $this->tpl->touchBlock('mode_restore_checked');
320 $this->tpl->touchBlock('mode_purge_disabled');
321 } elseif ($ilUser->getPref('systemcheck_mode_purge')) {
322 $this->tpl->touchBlock('mode_purge_checked');
323 $this->tpl->touchBlock('mode_restore_disabled');
324 }
325 if ($ilUser->getPref('systemcheck_mode_restore_trash')) {
326 $this->tpl->touchBlock('mode_restore_trash_checked');
327 $this->tpl->touchBlock('mode_purge_trash_disabled');
328 } elseif ($ilUser->getPref('systemcheck_mode_purge_trash')) {
329 $this->tpl->touchBlock('mode_purge_trash_checked');
330 $this->tpl->touchBlock('mode_restore_trash_disabled');
331 }
332 if ($ilUser->getPref('systemcheck_log_scan')) {
333 $this->tpl->touchBlock('log_scan_checked');
334 }
335
336
337 // #9520 - restrict to types which can be found in tree
338
339 $obj_types_in_tree = [];
340
342 $set = $ilDB->query('SELECT type FROM object_data od' .
343 ' JOIN object_reference ref ON (od.obj_id = ref.obj_id)' .
344 ' JOIN tree ON (tree.child = ref.ref_id)' .
345 ' WHERE tree.tree < 1' .
346 ' GROUP BY type');
347 while ($row = $ilDB->fetchAssoc($set)) {
348 $obj_types_in_tree[] = $row['type'];
349 }
350
351 $types = $objDefinition->getAllObjects();
352 $ts = ["" => ""];
353 foreach ($types as $t) {
354 if ($t != "" && !$objDefinition->isSystemObject($t) && $t != "root" &&
355 in_array($t, $obj_types_in_tree)) {
356 if ($objDefinition->isPlugin($t)) {
358 $ts[$t] = $pl->txt("obj_" . $t);
359 } else {
360 $ts[$t] = $this->lng->txt("obj_" . $t);
361 }
362 }
363 }
364 asort($ts);
365 $this->tpl->setVariable(
366 "TYPE_LIMIT_CHOICE",
368 $ilUser->getPref("systemcheck_type_limit"),
369 'type_limit',
370 $ts,
371 false,
372 true
373 )
374 );
375 $this->tpl->setVariable("TXT_LOG_SCAN", $this->lng->txt("log_scan"));
376 $this->tpl->setVariable("TXT_LOG_SCAN_DESC", $this->lng->txt("log_scan_desc"));
377 $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("start_scan"));
378
379 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save_params_for_cron"));
380
381 $cron_form = new ilPropertyFormGUI();
382 $cron_form->setFormAction($this->ctrl->getFormAction($this));
383 $cron_form->setTitle($this->lng->txt('systemcheck_cronform'));
384
385 $radio_group = new ilRadioGroupInputGUI($this->lng->txt('systemcheck_cron'), 'cronjob');
386 $radio_group->setValue($ilSetting->get('systemcheck_cron'));
387
388 $radio_opt = new ilRadioOption($this->lng->txt('disabled'), 0);
389 $radio_group->addOption($radio_opt);
390
391 $radio_opt = new ilRadioOption($this->lng->txt('enabled'), 1);
392 $radio_group->addOption($radio_opt);
393
394 $cron_form->addItem($radio_group);
395
396 $cron_form->addCommandButton('saveCheckCron', $this->lng->txt('save'));
397
398 $this->tpl->setVariable('CRON_FORM', $cron_form->getHTML());
399 }
400 }
401
402 private function saveCheckParamsObject()
403 {
404 $this->writeCheckParams();
405 unset($_POST['mode']);
406 return $this->checkObject();
407 }
408
409 private function writeCheckParams(): void
410 {
411 $validator = new ilValidator();
412 $modes = $validator->getPossibleModes();
413
414 $prefs = array();
415 foreach ($modes as $mode) {
416 if (isset($_POST['mode'][$mode])) {
417 $value = (int) $_POST['mode'][$mode];
418 } else {
419 $value = 0;
420 }
421 $prefs[ 'systemcheck_mode_' . $mode ] = $value;
422 }
423
424 if (isset($_POST['log_scan'])) {
425 $value = (int) $_POST['log_scan'];
426 } else {
427 $value = 0;
428 }
429 $prefs['systemcheck_log_scan'] = $value;
430
432 foreach ($prefs as $key => $val) {
433 $ilUser->writePref($key, $val);
434 }
435 }
436
437 private function saveCheckCronObject()
438 {
440
441 $systemcheck_cron = ($_POST['cronjob'] ? 1 : 0);
442 $ilSetting->set('systemcheck_cron', $systemcheck_cron);
443
444 unset($_POST['mode']);
445 return $this->checkObject();
446 }
447
453 public function changeHeaderTitleObject(): void
454 {
456 $styleDefinition = $this->style_definition;
457
458 $this->tpl->addBlockFile(
459 "ADM_CONTENT",
460 "adm_content",
461 "tpl.header_title_edit.html",
462 "Modules/SystemFolder"
463 );
464
465 $array_push = true;
466
467 if ($_SESSION["error_post_vars"]) {
468 $_SESSION["translation_post"] = $_SESSION["error_post_vars"];
469 $_GET["mode"] = "session";
470 $array_push = false;
471 }
472
473 // load from db if edit category is called the first time
474 if (($_GET["mode"] != "session")) {
475 $data = $this->object->getHeaderTitleTranslations();
476 $_SESSION["translation_post"] = $data;
477 $array_push = false;
478 } // remove a translation from session
479 elseif ($_GET["entry"] != 0) {
480 array_splice($_SESSION["translation_post"]["Fobject"], $_GET["entry"], 1, array());
481
482 if ($_GET["entry"] == $_SESSION["translation_post"]["default_language"]) {
483 $_SESSION["translation_post"]["default_language"] = "";
484 }
485 }
486
487 $data = $_SESSION["translation_post"];
488
489 // add additional translation form
490 if (!$_GET["entry"] and $array_push) {
491 $count = array_push($data["Fobject"], array("title" => "","desc" => ""));
492 } else {
493 $count = count($data["Fobject"]);
494 }
495
496 // stripslashes in form?
497 $strip = isset($_SESSION["translation_post"]) ? true : false;
498
499 foreach ($data["Fobject"] as $key => $val) {
500 // add translation button
501 if ($key == $count - 1) {
502 $this->tpl->setCurrentBlock("addTranslation");
503 $this->tpl->setVariable("TXT_ADD_TRANSLATION", $this->lng->txt("add_translation") . " >>");
504 $this->tpl->parseCurrentBlock();
505 }
506
507 // remove translation button
508 if ($key != 0) {
509 $this->tpl->setCurrentBlock("removeTranslation");
510 $this->tpl->setVariable("TXT_REMOVE_TRANSLATION", $this->lng->txt("remove_translation"));
511 $this->ctrl->setParameter($this, "entry", $key);
512 $this->ctrl->setParameter($this, "mode", "edit");
513 $this->tpl->setVariable(
514 "LINK_REMOVE_TRANSLATION",
515 $this->ctrl->getLinkTarget($this, "removeTranslation")
516 );
517 $this->tpl->parseCurrentBlock();
518 }
519
520 // lang selection
521 $this->tpl->addBlockFile(
522 "SEL_LANGUAGE",
523 "sel_language",
524 "tpl.lang_selection.html",
525 "Services/MetaData"
526 );
527 $this->tpl->setVariable("SEL_NAME", "Fobject[" . $key . "][lang]");
528
529 $languages = ilMDLanguageItem::_getLanguages();
530
531 foreach ($languages as $code => $language) {
532 $this->tpl->setCurrentBlock("lg_option");
533 $this->tpl->setVariable("VAL_LG", $code);
534 $this->tpl->setVariable("TXT_LG", $language);
535
536 if ($code == $val["lang"]) {
537 $this->tpl->setVariable("SELECTED", "selected=\"selected\"");
538 }
539
540 $this->tpl->parseCurrentBlock();
541 }
542
543 // object data
544 $this->tpl->setCurrentBlock("obj_form");
545
546 if ($key == 0) {
547 $this->tpl->setVariable("TXT_HEADER", $this->lng->txt("change_header_title"));
548 } else {
549 $this->tpl->setVariable("TXT_HEADER", $this->lng->txt("translation") . " " . $key);
550 }
551
552 if ($key == $data["default_language"]) {
553 $this->tpl->setVariable("CHECKED", "checked=\"checked\"");
554 }
555
556 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("title"));
557 $this->tpl->setVariable("TXT_DESC", $this->lng->txt("desc"));
558 $this->tpl->setVariable("TXT_DEFAULT", $this->lng->txt("default"));
559 $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("language"));
560 $this->tpl->setVariable("TITLE", ilLegacyFormElementsUtil::prepareFormOutput($val["title"], $strip));
561 $this->tpl->setVariable("DESC", ilUtil::stripSlashes($val["desc"]));
562 $this->tpl->setVariable("NUM", $key);
563 $this->tpl->parseCurrentBlock();
564 }
565
566 // global
567 $this->tpl->setCurrentBlock("adm_content");
568
569 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
570 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
571 $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("save"));
572 $this->tpl->setVariable("CMD_SUBMIT", "saveHeaderTitle");
573 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
574 }
575
579 public function saveHeaderTitleObject(): void
580 {
581 $langs = [];
583
584 $data = $_POST;
585
586 // default language set?
587 if (!isset($data["default_language"])) {
588 $ilErr->raiseError($this->lng->txt("msg_no_default_language"), $ilErr->MESSAGE);
589 }
590
591 // prepare array fro further checks
592 foreach ($data["Fobject"] as $key => $val) {
593 $langs[$key] = $val["lang"];
594 }
595
596 $langs = array_count_values($langs);
597
598 // all languages set?
599 if (array_key_exists("", $langs)) {
600 $ilErr->raiseError($this->lng->txt("msg_no_language_selected"), $ilErr->MESSAGE);
601 }
602
603 // no single language is selected more than once?
604 if (array_sum($langs) > count($langs)) {
605 $ilErr->raiseError($this->lng->txt("msg_multi_language_selected"), $ilErr->MESSAGE);
606 }
607
608 // copy default translation to variable for object data entry
609 $_POST["Fobject"]["title"] = $_POST["Fobject"][$_POST["default_language"]]["title"];
610 $_POST["Fobject"]["desc"] = $_POST["Fobject"][$_POST["default_language"]]["desc"];
611
612 // first delete all translation entries...
613 $this->object->removeHeaderTitleTranslations();
614
615 // ...and write new translations to object_translation
616 foreach ($data["Fobject"] as $key => $val) {
617 if ($key == $data["default_language"]) {
618 $default = 1;
619 } else {
620 $default = 0;
621 }
622
623 $this->object->addHeaderTitleTranslation(ilUtil::stripSlashes($val["title"]), ilUtil::stripSlashes($val["desc"]), $val["lang"], $default);
624 }
625
626 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
627
628 $this->ctrl->redirect($this);
629 }
630
631 public function cancelObject(): void
632 {
633 $this->ctrl->redirect($this, "view");
634 }
635
641 public function addHeaderTitleTranslationObject(): void
642 {
643 $_SESSION["translation_post"] = $_POST;
644
645 $this->ctrl->setParameter($this, "mode", "session");
646 $this->ctrl->setParameter($this, "entry", "0");
647 $this->ctrl->redirect($this, "changeHeaderTitle");
648 }
649
655 public function removeTranslationObject(): void
656 {
657 $this->ctrl->setParameter($this, "entry", $_GET["entry"]);
658 $this->ctrl->setParameter($this, "mode", "session");
659 $this->ctrl->redirect($this, "changeHeaderTitle");
660 }
661
662
663 public function startValidator($a_mode, $a_log): void
664 {
667
668 if (!$rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
669 $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
670 }
671
672 $logging = ($a_log) ? true : false;
673 $validator = new ilValidator($logging);
674 $validator->setMode("all", false);
675
676 $modes = array();
677 foreach ($a_mode as $mode => $value) {
678 $validator->setMode($mode, (bool) $value);
679 $modes[] = $mode . '=' . $value;
680 }
681
682 $scan_log = $validator->validate();
683
684 $mode = $this->lng->txt("scan_modes") . ": " . implode(', ', $modes);
685
686 // output
687 $this->tpl->addBlockFile(
688 "ADM_CONTENT",
689 "adm_content",
690 "tpl.adm_scan.html",
691 "Modules/SystemFolder"
692 );
693
694 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
695 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("scanning_system"));
696 $this->tpl->setVariable("COLSPAN", 3);
697 $this->tpl->setVariable("TXT_SCAN_LOG", $scan_log);
698 $this->tpl->setVariable("TXT_MODE", $mode);
699
700 if ($logging === true) {
701 $this->tpl->setVariable("TXT_VIEW_LOG", $this->lng->txt("view_log"));
702 }
703
704 $this->tpl->setVariable("TXT_DONE", $this->lng->txt("done"));
705
706 $validator->writeScanLogLine($mode);
707 }
708
709 public function viewScanLog(): void
710 {
711 $validator = new IlValidator();
712 $scan_log = $validator->readScanLog();
713
714 if (is_array($scan_log)) {
715 $scan_log = '<pre>' . implode("", $scan_log) . '</pre>';
716 $this->tpl->setVariable("ADM_CONTENT", $scan_log);
717 } else {
718 $scan_log = "no scanlog found.";
719 }
720
721 // output
722 $this->tpl->addBlockFile(
723 "ADM_CONTENT",
724 "adm_content",
725 "tpl.adm_scan.html",
726 "Modules/SystemFolder"
727 );
728 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("scan_details"));
729 $this->tpl->setVariable("COLSPAN", 3);
730 $this->tpl->setVariable("TXT_SCAN_LOG", $scan_log);
731 $this->tpl->setVariable("TXT_DONE", $this->lng->txt("done"));
732 }
733
734
738 public function benchmarkObject(): void
739 {
742 $ilCtrl = $this->ctrl;
746
747 if (!$rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
748 $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
749 }
750
751 $this->benchmarkSubTabs("settings");
752
753 $this->form = new ilPropertyFormGUI();
754
755 // Activate DB Benchmark
756 $cb = new ilCheckboxInputGUI($lng->txt("adm_activate_db_benchmark"), ilBenchmark::ENABLE_DB_BENCH);
757 $cb->setChecked((bool) $ilSetting->get(ilBenchmark::ENABLE_DB_BENCH));
758 $cb->setInfo($lng->txt("adm_activate_db_benchmark_desc"));
759 $this->form->addItem($cb);
760
761 // DB Benchmark User
762 $ti = new ilTextInputGUI($lng->txt("adm_db_benchmark_user"), ilBenchmark::DB_BENCH_USER);
763 $user_id = ((int) $ilSetting->get(ilBenchmark::DB_BENCH_USER)) ?? null;
764 if ($user_id !== null && ilObjUser::_lookupLogin((int) $user_id) !== '') {
765 $ti->setValue(ilObjUser::_lookupLogin($user_id));
766 }
767 $ti->setInfo($lng->txt("adm_db_benchmark_user_desc"));
768 $this->form->addItem($ti);
769
770 $this->form->addCommandButton("saveBenchSettings", $lng->txt("save"));
771
772 $this->form->setTitle($lng->txt("adm_db_benchmark"));
773 $this->form->setFormAction($ilCtrl->getFormAction($this));
774
775 $tpl->setContent($this->form->getHTML());
776 }
777
781 public function showDbBenchChronologicalObject(): void
782 {
783 $this->benchmarkSubTabs("chronological");
784 $this->showDbBenchResults("chronological");
785 }
786
790 public function showDbBenchSlowestFirstObject(): void
791 {
792 $this->benchmarkSubTabs("slowest_first");
793 $this->showDbBenchResults("slowest_first");
794 }
795
799 public function showDbBenchSortedBySqlObject(): void
800 {
801 $this->benchmarkSubTabs("sorted_by_sql");
802 $this->showDbBenchResults("sorted_by_sql");
803 }
804
808 public function showDbBenchByFirstTableObject(): void
809 {
810 $this->benchmarkSubTabs("by_first_table");
811 $this->showDbBenchResults("by_first_table");
812 }
813
819 public function showDbBenchResults($a_mode): void
820 {
822
823 $ilBench = $this->bench;
824 $rec = $ilBench->getDbBenchRecords();
825
826 $table = new ilBenchmarkTableGUI($this, "benchmark", $rec, $a_mode);
827 $tpl->setContent($table->getHTML());
828 }
829
836 public function benchmarkSubTabs($a_current): void
837 {
838 $ilTabs = $this->tabs;
840 $ilCtrl = $this->ctrl;
841
842 $ilBench = $this->bench;
843 $ilTabs->activateTab("benchmarks"); // #18083
844
845 $ilTabs->addSubtab(
846 "settings",
847 $lng->txt("settings"),
848 $ilCtrl->getLinkTarget($this, "benchmark")
849 );
850
851 $rec = $ilBench->getDbBenchRecords();
852 if ($rec !== []) {
853 $ilTabs->addSubtab(
854 "chronological",
855 $lng->txt("adm_db_bench_chronological"),
856 $ilCtrl->getLinkTarget($this, "showDbBenchChronological")
857 );
858 $ilTabs->addSubtab(
859 "slowest_first",
860 $lng->txt("adm_db_bench_slowest_first"),
861 $ilCtrl->getLinkTarget($this, "showDbBenchSlowestFirst")
862 );
863 $ilTabs->addSubtab(
864 "sorted_by_sql",
865 $lng->txt("adm_db_bench_sorted_by_sql"),
866 $ilCtrl->getLinkTarget($this, "showDbBenchSortedBySql")
867 );
868 $ilTabs->addSubtab(
869 "by_first_table",
870 $lng->txt("adm_db_bench_by_first_table"),
871 $ilCtrl->getLinkTarget($this, "showDbBenchByFirstTable")
872 );
873 }
874
875 $ilTabs->activateSubTab($a_current);
876 }
877
878
882 public function saveBenchSettingsObject(): void
883 {
884 if ($this->wrapper->post()->has(ilBenchmark::ENABLE_DB_BENCH)
885 && $this->wrapper->post()->has(ilBenchmark::DB_BENCH_USER)) {
886 $activate = $this->wrapper->post()->retrieve(ilBenchmark::ENABLE_DB_BENCH, $this->refinery->kindlyTo()->bool());
887 if ($activate) {
888 $user_name = $this->wrapper->post()->retrieve(ilBenchmark::DB_BENCH_USER, $this->refinery->kindlyTo()->string());
889 $this->bench->enableDbBenchmarkForUserName($user_name);
890 }
891 } else {
892 $this->bench->disableDbBenchmark();
893 }
894
895 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
896
897 $this->ctrl->redirect($this, "benchmark");
898 }
899
900
904 public function switchBenchModuleObject(): void
905 {
906 $this->ctrl->setParameter($this, 'cur_mod', $_POST['module']);
907 $this->ctrl->redirect($this, "benchmark");
908 }
909
910
914 public function clearBenchObject(): void
915 {
916 $ilBench = $this->bench;
917 $ilBench->clearData();
919 }
920
921 // get tabs
922 public function getAdminTabs(): void
923 {
925 $ilHelp = $this->help;
926
927 // $ilHelp->setScreenIdComponent($this->object->getType());
928
929 $this->ctrl->setParameter($this, "ref_id", $this->object->getRefId());
930
931 // general settings
932 if ($rbacsystem->checkAccess("write", $this->object->getRefId())) {
933 $this->tabs_gui->addTarget(
934 "general_settings",
935 $this->ctrl->getLinkTarget($this, "showBasicSettings"),
936 ["showBasicSettings", "saveBasicSettings"],
937 get_class($this)
938 );
939 }
940
941 // server info
942 if ($rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
943 $this->tabs_gui->addTarget(
944 "server",
945 $this->ctrl->getLinkTarget($this, "showServerInfo"),
946 ["showServerInfo", "view"],
947 get_class($this)
948 );
949 }
950
951 if ($rbacsystem->checkAccess("write", $this->object->getRefId())) {
952 $this->tabs_gui->addTarget(
953 "cron_jobs",
954 $this->ctrl->getLinkTargetByClass("ilCronManagerGUI", ""),
955 "",
956 get_class($this)
957 );
958
959 // $tabs_gui->addTarget("system_check",
960 // $this->ctrl->getLinkTarget($this, "check"), array("check","viewScanLog","saveCheckParams","saveCheckCron"), get_class($this));
961
962 $this->tabs_gui->addTarget(
963 "benchmarks",
964 $this->ctrl->getLinkTarget($this, "benchmark"),
965 "benchmark",
966 get_class($this)
967 );
968 }
969
970 if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
971 $this->tabs_gui->addTarget(
972 "perm_settings",
973 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
974 array("perm","info","owner"),
975 'ilpermissiongui'
976 );
977 }
978 }
979
984 public function showPHPInfoObject(): void
985 {
986 phpinfo();
987 exit;
988 }
989
990 //
991 //
992 // Server Info
993 //
994 //
995
996 // TODO: remove this subtabs
1000 public function setServerInfoSubTabs($a_activate): void
1001 {
1002 $ilTabs = $this->tabs;
1003 $ilCtrl = $this->ctrl;
1005
1006 $ilTabs->addSubTabTarget("installation_status", $ilCtrl->getLinkTarget($this, "showServerInstallationStatus"));
1007
1008 $ilTabs->addSubTabTarget("server_data", $ilCtrl->getLinkTarget($this, "showServerInfo"));
1009
1010 if ($rbacsystem->checkAccess("write", $this->object->getRefId())) {
1011 $ilTabs->addSubTabTarget("java_server", $ilCtrl->getLinkTarget($this, "showJavaServer"));
1012 }
1013
1014 $ilTabs->setSubTabActive($a_activate);
1015 $ilTabs->setTabActive("server");
1016 }
1017
1021 public function showServerInfoObject(): void
1022 {
1029 $tpl = $this->tpl;
1030 $ilCtrl = $this->ctrl;
1031 $ilToolbar = $this->toolbar;
1032
1033 $button = ilLinkButton::getInstance();
1034 $button->setCaption('vc_information');
1035 $button->setUrl($this->ctrl->getLinkTarget($this, 'showVcsInformation'));
1036 $ilToolbar->addButtonInstance($button);
1037
1038 $this->initServerInfoForm();
1039 // TODO: remove sub tabs
1040// $this->tabs->setTabActive("server");
1041 $this->setServerInfoSubTabs("server_data");
1042
1043 $btpl = new ilTemplate("tpl.server_data.html", true, true, "Modules/SystemFolder");
1044 $btpl->setVariable("FORM", $this->form->getHTML());
1045 $btpl->setVariable("PHP_INFO_TARGET", $ilCtrl->getLinkTarget($this, "showPHPInfo"));
1046 $tpl->setContent($btpl->get());
1047 }
1048
1054 public function initServerInfoForm(): void
1055 {
1056 $lng = $this->lng;
1057 $ilClientIniFile = $this->client_ini;
1059
1060 $this->form = new ilPropertyFormGUI();
1061
1062 // installation name
1063 $ne = new ilNonEditableValueGUI($lng->txt("inst_name"), "");
1064 $ne->setValue($ilClientIniFile->readVariable("client", "name"));
1065 $ne->setInfo($ilClientIniFile->readVariable("client", "description"));
1066 $this->form->addItem($ne);
1067
1068 // client id
1069 $ne = new ilNonEditableValueGUI($lng->txt("client_id"), "");
1070 $ne->setValue(CLIENT_ID);
1071 $this->form->addItem($ne);
1072
1073 // installation id
1074 $ne = new ilNonEditableValueGUI($lng->txt("inst_id"), "");
1075 $ne->setValue($ilSetting->get("inst_id"));
1076 $this->form->addItem($ne);
1077
1078 // database version
1079 $ne = new ilNonEditableValueGUI($lng->txt("db_version"), "");
1080 $ne->setValue($ilSetting->get("db_version"));
1081
1082 $this->form->addItem($ne);
1083
1084 // ilias version
1085 $ne = new ilNonEditableValueGUI($lng->txt("ilias_version"), "");
1086 $ne->setValue(ILIAS_VERSION);
1087 $this->form->addItem($ne);
1088
1089 // host
1090 $ne = new ilNonEditableValueGUI($lng->txt("host"), "");
1091 $ne->setValue($_SERVER["SERVER_NAME"]);
1092 $this->form->addItem($ne);
1093
1094 // ip & port
1095 $ne = new ilNonEditableValueGUI($lng->txt("ip_address") . " & " . $this->lng->txt("port"), "");
1096 $ne->setValue($_SERVER["SERVER_ADDR"] . ":" . $_SERVER["SERVER_PORT"]);
1097 $this->form->addItem($ne);
1098
1099 // server
1100 $ne = new ilNonEditableValueGUI($lng->txt("server_software"), "");
1101 $ne->setValue($_SERVER["SERVER_SOFTWARE"]);
1102 $this->form->addItem($ne);
1103
1104 // http path
1105 $ne = new ilNonEditableValueGUI($lng->txt("http_path"), "");
1106 $ne->setValue(ILIAS_HTTP_PATH);
1107 $this->form->addItem($ne);
1108
1109 // absolute path
1110 $ne = new ilNonEditableValueGUI($lng->txt("absolute_path"), "");
1111 $ne->setValue(ILIAS_ABSOLUTE_PATH);
1112 $this->form->addItem($ne);
1113
1114 $not_set = $lng->txt("path_not_set");
1115
1116 // convert
1117 $ne = new ilNonEditableValueGUI($lng->txt("path_to_convert"), "");
1118 $ne->setValue(PATH_TO_CONVERT ?: $not_set);
1119 $this->form->addItem($ne);
1120
1121 // zip
1122 $ne = new ilNonEditableValueGUI($lng->txt("path_to_zip"), "");
1123 $ne->setValue(PATH_TO_ZIP ?: $not_set);
1124 $this->form->addItem($ne);
1125
1126 // unzip
1127 $ne = new ilNonEditableValueGUI($lng->txt("path_to_unzip"), "");
1128 $ne->setValue(PATH_TO_UNZIP ?: $not_set);
1129 $this->form->addItem($ne);
1130
1131 // java
1132 $ne = new ilNonEditableValueGUI($lng->txt("path_to_java"), "");
1133 $ne->setValue(PATH_TO_JAVA ?: $not_set);
1134 $this->form->addItem($ne);
1135
1136 // mkisofs
1137 $ne = new ilNonEditableValueGUI($lng->txt("path_to_mkisofs"), "");
1138 $ne->setValue(PATH_TO_MKISOFS ?: $not_set);
1139 $this->form->addItem($ne);
1140
1141 // latex
1142 $ne = new ilNonEditableValueGUI($lng->txt("url_to_latex"), "");
1143 $ne->setValue(URL_TO_LATEX ?: $not_set);
1144 $this->form->addItem($ne);
1145
1146
1147 $this->form->setTitle($lng->txt("server_data"));
1148 $this->form->setFormAction($this->ctrl->getFormAction($this));
1149 }
1150
1151 protected function showServerInstallationStatusObject(): void
1152 {
1153 $this->setServerInfoSubTabs("installation_status");
1154 $this->renderServerStatus();
1155 }
1156
1157 protected function renderServerStatus(): void
1158 {
1159 global $DIC;
1160 $f = $DIC->ui()->factory();
1161 $r = $DIC->ui()->renderer();
1162 $refinery = $DIC->refinery();
1163
1164 $metric = $this->getServerStatusInfo($refinery);
1165 $report = $metric->toUIReport($f, $this->lng->txt("installation_status"));
1166
1167 $this->tpl->setContent($r->render($report));
1168 }
1169
1170 protected function getServerStatusInfo(ILIAS\Refinery\Factory $refinery): ILIAS\Setup\Metrics\Metric
1171 {
1172 $data = new Factory();
1173 $lng = new ilSetupLanguage('en');
1174 $interface_finder = new ImplementationOfInterfaceFinder();
1175
1176 $agent_finder = new ImplementationOfAgentFinder(
1177 $refinery,
1178 $data,
1179 $lng,
1180 $interface_finder,
1181 []
1182 );
1183
1184 $st = new StatusCommand($agent_finder);
1185
1186 return $st->getMetrics($agent_finder->getAgents());
1187 }
1188
1189 //
1190 //
1191 // General Settings
1192 //
1193 //
1194
1198 public function setGeneralSettingsSubTabs($a_activate): void
1199 {
1200 $ilTabs = $this->tabs;
1201 $ilCtrl = $this->ctrl;
1202
1203 $ilTabs->addSubTabTarget("basic_settings", $ilCtrl->getLinkTarget($this, "showBasicSettings"));
1204 $ilTabs->addSubTabTarget("header_title", $ilCtrl->getLinkTarget($this, "showHeaderTitle"));
1205 $ilTabs->addSubTabTarget("contact_data", $ilCtrl->getLinkTarget($this, "showContactInformation"));
1206 $ilTabs->addSubTabTarget("adm_imprint", $ilCtrl->getLinkTargetByClass("ilimprintgui", "preview"));
1207
1208 $ilTabs->setSubTabActive($a_activate);
1209 $ilTabs->setTabActive("general_settings");
1210 }
1211
1212 //
1213 //
1214 // Basic Settings
1215 //
1216 //
1217
1221 public function showBasicSettingsObject(): void
1222 {
1223 $tpl = $this->tpl;
1224
1225 $this->initBasicSettingsForm();
1226 $this->setGeneralSettingsSubTabs("basic_settings");
1227
1228 $tpl->setContent($this->form->getHTML());
1229 }
1230
1231
1235 public function initBasicSettingsForm(): void
1236 {
1241 $lng = $this->lng;
1243
1244 $this->form = new ilPropertyFormGUI();
1245 $lng->loadLanguageModule("pd");
1246
1247 // installation short title
1248 $ti = new ilTextInputGUI($this->lng->txt("short_inst_name"), "short_inst_name");
1249 $ti->setMaxLength(200);
1250 $ti->setSize(40);
1251 $ti->setValue($ilSetting->get("short_inst_name"));
1252 $ti->setInfo($this->lng->txt("short_inst_name_info"));
1253 $this->form->addItem($ti);
1254
1255
1256 $cb = new ilCheckboxInputGUI($this->lng->txt("pub_section"), "pub_section");
1257 $cb->setInfo($lng->txt("pub_section_info"));
1258 if (ilPublicSectionSettings::getInstance()->isEnabled()) {
1259 $cb->setChecked(true);
1260 }
1261 $this->form->addItem($cb);
1262
1263 $this->lng->loadLanguageModule('administration');
1264 $domains = new ilTextInputGUI($this->lng->txt('adm_pub_section_domain_filter'), 'public_section_domains');
1265 $domains->setInfo($this->lng->txt('adm_pub_section_domain_filter_info'));
1266 $domains->setMulti(true);
1267 $domains->setValue(current(ilPublicSectionSettings::getInstance()->getDomains()));
1268 $domains->setMultiValues(ilPublicSectionSettings::getInstance()->getDomains());
1269
1270 $cb->addSubItem($domains);
1271
1272
1273 // Enable Global Profiles
1274 $cb_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_user_publish'), 'enable_global_profiles');
1275 $cb_prop->setInfo($lng->txt('pd_enable_user_publish_info'));
1276 $cb_prop->setChecked((bool) $ilSetting->get('enable_global_profiles'));
1277 $cb->addSubItem($cb_prop);
1278
1279 // search engine
1280 $robot_settings = ilRobotSettings::getInstance();
1281 $cb2 = new ilCheckboxInputGUI($this->lng->txt("search_engine"), "open_google");
1282 $cb2->setInfo($this->lng->txt("enable_search_engine"));
1283 $this->form->addItem($cb2);
1284
1285 if (!$robot_settings->checkRewrite()) {
1286 $cb2->setAlert($lng->txt("allow_override_alert"));
1287 $cb2->setChecked(false);
1288 $cb2->setDisabled(true);
1289 } elseif ($ilSetting->get("open_google")) {
1290 $cb2->setChecked(true);
1291 }
1292
1293 // locale
1294 $ti = new ilTextInputGUI($this->lng->txt("adm_locale"), "locale");
1295 $ti->setMaxLength(80);
1296 $ti->setSize(40);
1297 $ti->setInfo($this->lng->txt("adm_locale_info"));
1298 $ti->setValue($ilSetting->get("locale"));
1299 $this->form->addItem($ti);
1300
1301 // save and cancel commands
1302 $this->form->addCommandButton("saveBasicSettings", $lng->txt("save"));
1303
1304 $this->form->setTitle($lng->txt("basic_settings"));
1305 $this->form->setFormAction($this->ctrl->getFormAction($this));
1306 }
1307
1312 public function saveBasicSettingsObject(): void
1313 {
1314 $tpl = $this->tpl;
1315 $lng = $this->lng;
1316 $ilCtrl = $this->ctrl;
1320
1321 if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
1322 $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
1323 }
1324
1325 $this->initBasicSettingsForm();
1326 if ($this->form->checkInput()) {
1327 $ilSetting->set("short_inst_name", $this->form->getInput("short_inst_name"));
1328
1329 $public_section = ilPublicSectionSettings::getInstance();
1330 $public_section->setEnabled($this->form->getInput('pub_section'));
1331
1332 $domains = [];
1333 foreach ((array) $this->form->getInput('public_section_domains') as $domain) {
1334 if (strlen(trim($domain)) !== 0) {
1335 $domains[] = $domain;
1336 }
1337 }
1338 $public_section->setDomains($domains);
1339 $public_section->save();
1340
1341 $global_profiles = ($this->form->getInput("pub_section"))
1342 ? (int) $this->form->getInput('enable_global_profiles')
1343 : 0;
1344 $ilSetting->set('enable_global_profiles', $global_profiles);
1345
1346 $ilSetting->set("open_google", $this->form->getInput("open_google"));
1347 $ilSetting->set("locale", $this->form->getInput("locale"));
1348
1349 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1350 $ilCtrl->redirect($this, "showBasicSettings");
1351 }
1352 $this->setGeneralSettingsSubTabs("basic_settings");
1353 $this->form->setValuesByPost();
1354 $tpl->setContent($this->form->getHtml());
1355 }
1356
1357 //
1358 //
1359 // Header title
1360 //
1361 //
1362
1366 public function showHeaderTitleObject($a_get_post_values = false,
1367 bool $add_entry = false): void
1368 {
1369 $tpl = $this->tpl;
1370
1371 $this->setGeneralSettingsSubTabs("header_title");
1372 $table = new ilObjectTranslationTableGUI($this, "showHeaderTitle", false);
1373 if ($a_get_post_values) {
1374 $vals = array();
1375 foreach (($_POST["title"] ?? []) as $k => $v) {
1376 $def = $_POST["default"] ?? "";
1377 $vals[] = array("title" => $v,
1378 "desc" => ($_POST["desc"][$k] ?? ""),
1379 "lang" => ($_POST["lang"][$k] ?? ""),
1380 "default" => ($def == $k));
1381 }
1382 if ($add_entry) {
1383 $vals[] = array("title" => "",
1384 "desc" => "",
1385 "lang" => "",
1386 "default" => false);
1387 }
1388 $table->setData($vals);
1389 } else {
1390 $data = $this->object->getHeaderTitleTranslations();
1391 if (isset($data["Fobject"]) && is_array($data["Fobject"])) {
1392 foreach ($data["Fobject"] as $k => $v) {
1393 if ($k == $data["default_language"]) {
1394 $data["Fobject"][$k]["default"] = true;
1395 } else {
1396 $data["Fobject"][$k]["default"] = false;
1397 }
1398 }
1399 } else {
1400 $data["Fobject"] = array();
1401 }
1402 $table->setData($data["Fobject"]);
1403 }
1404 $tpl->setContent($table->getHTML());
1405 }
1406
1410 public function saveHeaderTitlesObject($delete = false)
1411 {
1412 global $DIC;
1413
1414 $ilCtrl = $this->ctrl;
1415 $lng = $this->lng;
1418
1419 if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
1420 $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
1421 }
1422
1423 // var_dump($_POST);
1424
1425 $post = $DIC->http()->request()->getParsedBody();
1426 foreach ($post["title"] as $k => $v) {
1427 if ($delete && ($post["check"][$k] ?? false)) {
1428 unset($post["title"][$k]);
1429 unset($post["desc"][$k]);
1430 unset($post["lang"][$k]);
1431 if ($k == $post["default"]) {
1432 unset($post["default"]);
1433 }
1434 }
1435 }
1436
1437
1438
1439 // default language set?
1440 if (!isset($post["default"]) && count($post["lang"]) > 0) {
1441 $this->tpl->setOnScreenMessage('failure', $lng->txt("msg_no_default_language"));
1442 return $this->showHeaderTitleObject(true);
1443 }
1444
1445 // all languages set?
1446 if (array_key_exists("", $post["lang"])) {
1447 $this->tpl->setOnScreenMessage('failure', $lng->txt("msg_no_language_selected"));
1448 return $this->showHeaderTitleObject(true);
1449 }
1450
1451 // no single language is selected more than once?
1452 if (count(array_unique($post["lang"])) < count($post["lang"])) {
1453 $this->tpl->setOnScreenMessage('failure', $lng->txt("msg_multi_language_selected"));
1454 return $this->showHeaderTitleObject(true);
1455 }
1456
1457 // save the stuff
1458 $this->object->removeHeaderTitleTranslations();
1459 foreach ($post["title"] as $k => $v) {
1460 $desc = $post["desc"][$k] ?? "";
1461 $this->object->addHeaderTitleTranslation(
1463 ilUtil::stripSlashes($desc),
1464 ilUtil::stripSlashes($post["lang"][$k]),
1465 ($post["default"] == $k)
1466 );
1467 }
1468
1469 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1470 $ilCtrl->redirect($this, "showHeaderTitle");
1471 }
1472
1476 public function addHeaderTitleObject(): void
1477 {
1478 $k = 1;
1479 $this->showHeaderTitleObject(true, true);
1480 }
1481
1485 public function deleteHeaderTitlesObject(): void
1486 {
1487 $ilCtrl = $this->ctrl;
1488 $lng = $this->lng;
1489 $this->saveHeaderTitlesObject(true);
1490 }
1491
1492
1493 //
1494 //
1495 // Cron Jobs
1496 //
1497 //
1498
1499 /*
1500 * OLD GLOBAL CRON JOB SWITCHES (ilSetting)
1501 *
1502 * cron_user_check => obsolete
1503 * cron_inactive_user_delete => obsolete
1504 * cron_inactivated_user_delete => obsolete
1505 * cron_link_check => obsolete
1506 * cron_web_resource_check => migrated
1507 * cron_lucene_index => obsolete
1508 * forum_notification => migrated
1509 * mail_notification => migrated
1510 * crsgrp_ntf => migrated
1511 * cron_upd_adrbook => migrated
1512 */
1513
1514 public function jumpToCronJobsObject(): void
1515 {
1516 // #13010 - this is used for external settings
1517 $this->ctrl->redirectByClass("ilCronManagerGUI", "render");
1518 }
1519
1520
1521 //
1522 //
1523 // Contact Information
1524 //
1525 //
1526
1530 public function showContactInformationObject(): void
1531 {
1532 $tpl = $this->tpl;
1533
1535 $this->setGeneralSettingsSubTabs("contact_data");
1536 $tpl->setContent($this->form->getHTML());
1537 }
1538
1542 public function initContactInformationForm(): void
1543 {
1544 $lng = $this->lng;
1546
1547 $this->form = new ilPropertyFormGUI();
1548
1549 // first name
1550 $ti = new ilTextInputGUI($this->lng->txt("firstname"), "admin_firstname");
1551 $ti->setMaxLength(64);
1552 $ti->setSize(40);
1553 $ti->setRequired(true);
1554 $ti->setValue($ilSetting->get("admin_firstname"));
1555 $this->form->addItem($ti);
1556
1557 // last name
1558 $ti = new ilTextInputGUI($this->lng->txt("lastname"), "admin_lastname");
1559 $ti->setMaxLength(64);
1560 $ti->setSize(40);
1561 $ti->setRequired(true);
1562 $ti->setValue($ilSetting->get("admin_lastname"));
1563 $this->form->addItem($ti);
1564
1565 // title
1566 $ti = new ilTextInputGUI($this->lng->txt("title"), "admin_title");
1567 $ti->setMaxLength(64);
1568 $ti->setSize(40);
1569 $ti->setValue($ilSetting->get("admin_title"));
1570 $this->form->addItem($ti);
1571
1572 // position
1573 $ti = new ilTextInputGUI($this->lng->txt("position"), "admin_position");
1574 $ti->setMaxLength(64);
1575 $ti->setSize(40);
1576 $ti->setValue($ilSetting->get("admin_position"));
1577 $this->form->addItem($ti);
1578
1579 // institution
1580 $ti = new ilTextInputGUI($this->lng->txt("institution"), "admin_institution");
1581 $ti->setMaxLength(200);
1582 $ti->setSize(40);
1583 $ti->setValue($ilSetting->get("admin_institution"));
1584 $this->form->addItem($ti);
1585
1586 // street
1587 $ti = new ilTextInputGUI($this->lng->txt("street"), "admin_street");
1588 $ti->setMaxLength(64);
1589 $ti->setSize(40);
1590 //$ti->setRequired(true);
1591 $ti->setValue($ilSetting->get("admin_street"));
1592 $this->form->addItem($ti);
1593
1594 // zip code
1595 $ti = new ilTextInputGUI($this->lng->txt("zipcode"), "admin_zipcode");
1596 $ti->setMaxLength(10);
1597 $ti->setSize(5);
1598 //$ti->setRequired(true);
1599 $ti->setValue($ilSetting->get("admin_zipcode"));
1600 $this->form->addItem($ti);
1601
1602 // city
1603 $ti = new ilTextInputGUI($this->lng->txt("city"), "admin_city");
1604 $ti->setMaxLength(64);
1605 $ti->setSize(40);
1606 //$ti->setRequired(true);
1607 $ti->setValue($ilSetting->get("admin_city"));
1608 $this->form->addItem($ti);
1609
1610 // country
1611 $ti = new ilTextInputGUI($this->lng->txt("country"), "admin_country");
1612 $ti->setMaxLength(64);
1613 $ti->setSize(40);
1614 //$ti->setRequired(true);
1615 $ti->setValue($ilSetting->get("admin_country"));
1616 $this->form->addItem($ti);
1617
1618 // phone
1619 $ti = new ilTextInputGUI($this->lng->txt("phone"), "admin_phone");
1620 $ti->setMaxLength(64);
1621 $ti->setSize(40);
1622 //$ti->setRequired(true);
1623 $ti->setValue($ilSetting->get("admin_phone"));
1624 $this->form->addItem($ti);
1625
1626 // email
1627 $ti = new ilEMailInputGUI($this->lng->txt("email"), "admin_email");
1628 $ti->setMaxLength(64);
1629 $ti->setSize(40);
1630 $ti->setRequired(true);
1631 $ti->allowRFC822(true);
1632 $ti->setValue($ilSetting->get("admin_email"));
1633 $this->form->addItem($ti);
1634
1635 // System support contacts
1636 $ti = new ilTextInputGUI($this->lng->txt("adm_support_contacts"), "adm_support_contacts");
1637 $ti->setMaxLength(500);
1638 $ti->setValue(ilSystemSupportContacts::getList());
1639 //$ti->setSize();
1640 $ti->setInfo($this->lng->txt("adm_support_contacts_info"));
1641 $this->form->addItem($ti);
1642
1643 // Accessibility support contacts
1644 $ti = new ilTextInputGUI($this->lng->txt("adm_accessibility_contacts"), "accessibility_support_contacts");
1645 $ti->setMaxLength(500);
1647 //$ti->setSize();
1648 $ti->setInfo($this->lng->txt("adm_accessibility_contacts_info"));
1649 $this->form->addItem($ti);
1650
1651 $this->form->addCommandButton("saveContactInformation", $lng->txt("save"));
1652
1653 $this->form->setTitle($lng->txt("contact_data"));
1654 $this->form->setFormAction($this->ctrl->getFormAction($this));
1655 }
1656
1661 public function saveContactInformationObject(): void
1662 {
1663 $tpl = $this->tpl;
1664 $lng = $this->lng;
1665 $ilCtrl = $this->ctrl;
1669
1670 if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
1671 $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
1672 }
1673
1675 if ($this->form->checkInput()) {
1676 $fs = array("admin_firstname", "admin_lastname", "admin_title", "admin_position",
1677 "admin_institution", "admin_street", "admin_zipcode", "admin_city",
1678 "admin_country", "admin_phone", "admin_email");
1679 foreach ($fs as $f) {
1680 $ilSetting->set($f, $_POST[$f]);
1681 }
1682
1683 // System support contacts
1684 ilSystemSupportContacts::setList($_POST["adm_support_contacts"]);
1685
1686 // Accessibility support contacts
1687 ilAccessibilitySupportContacts::setList($_POST["accessibility_support_contacts"]);
1688
1689 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1690 $ilCtrl->redirect($this, "showContactInformation");
1691 } else {
1692 $this->setGeneralSettingsSubTabs("contact_data");
1693 $this->form->setValuesByPost();
1694 $tpl->setContent($this->form->getHtml());
1695 }
1696 }
1697
1698 //
1699 //
1700 // Java Server
1701 //
1702 //
1703
1707 public function showJavaServerObject(): void
1708 {
1709 $tpl = $this->tpl;
1710
1711 $tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.java_settings.html', 'Modules/SystemFolder');
1712
1713 $GLOBALS['lng']->loadLanguageModule('search');
1714
1715 $this->initJavaServerForm();
1716 $this->setServerInfoSubTabs("java_server");
1717 $tpl->setVariable('SETTINGS_TABLE', $this->form->getHTML());
1718 }
1719
1724 public function createJavaServerIniObject(): void
1725 {
1726 $this->setGeneralSettingsSubTabs('java_server');
1727 $this->tpl->setContent($this->form->getHTML());
1728 }
1729
1733 public function initJavaServerForm(): void
1734 {
1735 $lng = $this->lng;
1737
1738 $this->form = new ilPropertyFormGUI();
1739 $this->form->setFormAction($this->ctrl->getFormAction($this, 'saveJavaServer'));
1740
1741 // pdf fonts
1742 $pdf = new ilFormSectionHeaderGUI();
1743 $pdf->setTitle($this->lng->txt('rpc_pdf_generation'));
1744 $this->form->addItem($pdf);
1745
1746 $pdf_font = new ilTextInputGUI($this->lng->txt('rpc_pdf_font'), 'rpc_pdf_font');
1747 $pdf_font->setInfo($this->lng->txt('rpc_pdf_font_info'));
1748 $pdf_font->setSize(64);
1749 $pdf_font->setMaxLength(1024);
1750 $pdf_font->setRequired(true);
1751 $pdf_font->setValue(
1752 $ilSetting->get('rpc_pdf_font', 'Helvetica, unifont')
1753 );
1754 $this->form->addItem($pdf_font);
1755
1756 // save and cancel commands
1757 $this->form->addCommandButton("saveJavaServer", $lng->txt("save"));
1758 }
1759
1764 public function saveJavaServerObject(): void
1765 {
1766 $tpl = $this->tpl;
1767 $lng = $this->lng;
1768 $ilCtrl = $this->ctrl;
1772
1773 if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
1774 $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
1775 }
1776
1777 $this->initJavaServerForm();
1778 if ($this->form->checkInput()) {
1779 $ilSetting->set('rpc_pdf_font', ilUtil::stripSlashes($_POST['rpc_pdf_font']));
1780 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1781 $ilCtrl->redirect($this, "showJavaServer");
1782
1783 // TODO check settings, ping server
1784 } else {
1785 $this->setGeneralSettingsSubTabs("java_server");
1786 $this->form->setValuesByPost();
1787 $tpl->setContent($this->form->getHtml());
1788 }
1789 }
1790
1794 public static function _goto(): void
1795 {
1796 global $DIC;
1797 $main_tpl = $DIC->ui()->mainTemplate();
1798
1799 $ilAccess = $DIC->access();
1800 $ilErr = $DIC["ilErr"];
1801 $lng = $DIC->language();
1802
1803 $a_target = SYSTEM_FOLDER_ID;
1804
1805 if ($ilAccess->checkAccess("read", "", $a_target)) {
1806 ilUtil::redirect("ilias.php?baseClass=ilAdministrationGUI");
1807 exit;
1808 } else {
1809 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1810 $main_tpl->setOnScreenMessage('failure', sprintf(
1811 $lng->txt("msg_no_perm_read_item"),
1813 ), true);
1815 }
1816 }
1817 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1818 }
1819
1823 protected function showVcsInformationObject(): void
1824 {
1825 $vcInfo = [];
1826
1827 foreach ([new ilGitInformation()] as $vc) {
1828 $html = $vc->getInformationAsHtml();
1829 if ($html) {
1830 $vcInfo[] = $html;
1831 }
1832 }
1833
1834 if ($vcInfo !== []) {
1835 $this->tpl->setOnScreenMessage('info', implode("<br />", $vcInfo));
1836 } else {
1837 $this->tpl->setOnScreenMessage('info', $this->lng->txt('vc_information_not_determined'));
1838 }
1839
1840 $this->showServerInfoObject();
1841 }
1842}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
Builds data types.
Definition: Factory.php:21
Command to output status information about the installation.
A metric is something we can measure about the system.
Definition: Metric.php:34
error(string $a_errmsg)
return true
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a checkbox property in a property form.
Class ilCronManagerGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Error Handling & global info handling uses PEAR error class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilImprintGUI.
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static prepareFormOutput($a_str, bool $a_strip=false)
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObjSystemFolderGUI.
setServerInfoSubTabs($a_activate)
Set sub tabs for server info.
showHeaderTitleObject($a_get_post_values=false, bool $add_entry=false)
Show header title.
setSystemCheckSubTabs($a_activate)
Set sub tabs for general settings.
showContactInformationObject()
Show contact information.
initContactInformationForm()
Init contact information form.
ilObjectDefinition $obj_definition
static _goto()
goto target group
__construct($a_data, $a_id, $a_call_by_reference)
Constructor @access public.
benchmarkSubTabs($a_current)
Benchmark sub tabs.
showDbBenchResults($a_mode)
Show Db Benchmark Results.
showJavaServerObject()
Show Java Server Settings.
saveJavaServerObject()
Save java server form.
switchBenchModuleObject()
save benchmark settings
createJavaServerIniObject()
Create a server ini file.
benchmarkObject()
Benchmark settings.
deleteHeaderTitlesObject()
Remove header titles.
ILIAS Refinery Factory $refinery
showPHPInfoObject()
Show PHP Information.
showDbBenchSortedBySqlObject()
Show db benchmark results.
showDbBenchSlowestFirstObject()
Show db benchmark results.
addHeaderTitleTranslationObject()
adds a translation form & save post vars to session
saveBenchSettingsObject()
Save benchmark settings.
addHeaderTitleObject()
Add a header title.
showDbBenchChronologicalObject()
Show db benchmark results.
checkObject()
displays system check menu
cancelObject()
cancel action and go back to previous page
changeHeaderTitleObject()
edit header title form
saveContactInformationObject()
Save contact information form.
saveBasicSettingsObject()
Save basic settings form.
removeTranslationObject()
removes a translation form & save post vars to session
getServerStatusInfo(ILIAS\Refinery\Factory $refinery)
clearBenchObject()
delete all benchmark records
viewObject()
show admin subpanels and basic settings form
showBasicSettingsObject()
Show basic settings.
saveHeaderTitlesObject($delete=false)
Save header titles.
saveHeaderTitleObject()
save header title
ILIAS HTTP Wrapper WrapperFactory $wrapper
showDbBenchByFirstTableObject()
Show db benchmark results.
setGeneralSettingsSubTabs($a_activate)
Set sub tabs for general settings.
initJavaServerForm()
Init java server form.
initServerInfoForm()
Init server info form.
getAdminTabs()
administration tabs show only permissions and trash folder
static _lookupLogin(int $a_user_id)
parses the objects.xml it handles the xml-description of all ilias objects
Class ilObjectGUI Basic methods of all Output classes.
ilAccessHandler $access
ilGlobalTemplateInterface $tpl
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
ilSetting $settings
ilToolbarGUI $toolbar
prepareOutput(bool $show_sub_objects=true)
ilLanguage $lng
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getPluginObjectByType(string $type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance()
get singleton instance
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static redirect(string $a_script)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const CLIENT_ID
Definition: constants.php:41
const SYSTEM_FOLDER_ID
Definition: constants.php:35
const ROOT_FOLDER_ID
Definition: constants.php:32
global $DIC
Definition: feed.php:28
$ilUser
Definition: imgupload.php:34
const ILIAS_VERSION
setContent(string $a_html)
Sets content for standard template.
addBlockFile(string $var, string $block, string $template_name, string $in_module=null)
overwrites ITX::addBlockFile
setVariable(string $variable, $value='')
Sets the given variable to the given value.
exit
Definition: login.php:28
$post
Definition: ltitoken.php:49
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
string $key
Consumer key/client ID value.
Definition: System.php:193
form( $class_path, string $cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.
global $ilSetting
Definition: privfeed.php:17
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
$ilErr
Definition: raiseError.php:17
$_GET['client_id']
Definition: saml1-acs.php:21