ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjSystemFolderGUI.php
Go to the documentation of this file.
1<?php
2
24
34{
35 protected \Pimple\Container $dic;
36 protected \ILIAS\Repository\InternalGUIService $gui;
38 protected \ILIAS\Style\Content\Object\ObjectFacade $content_style_domain;
39 protected ilTabsGUI $tabs;
43 protected ilDBInterface $db;
45 protected ilHelpGUI $help;
48 public string $type;
49 protected \ILIAS\HTTP\Wrapper\WrapperFactory $wrapper;
50 protected \ILIAS\Refinery\Factory $refinery;
51
56 public function __construct($a_data, $a_id, $a_call_by_reference)
57 {
58 global $DIC;
59
60 $this->dic = $DIC;
61 $this->tabs = $DIC->tabs();
62 $this->access = $DIC->access();
63 $this->ctrl = $DIC->ctrl();
64 $this->rbacsystem = $DIC->rbac()->system();
65 $this->user = $DIC->user();
66 $this->obj_definition = $DIC["objDefinition"];
67 $this->settings = $DIC->settings();
68 $this->error = $DIC["ilErr"];
69 $this->db = $DIC->database();
70 $this->style_definition = $DIC["styleDefinition"];
71 $this->lng = $DIC->language();
72 $this->tpl = $DIC["tpl"];
73 $this->help = $DIC["ilHelp"];
74 $this->toolbar = $DIC->toolbar();
75 $this->client_ini = $DIC["ilClientIniFile"];
76 $this->type = "adm";
77 $this->bench = $DIC["ilBench"];
78 $this->wrapper = $DIC->http()->wrapper();
79 $this->refinery = $DIC->refinery();
80 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
81
82 $this->lng->loadLanguageModule("administration");
83 $this->lng->loadLanguageModule("adm");
84 $this->content_style_domain = $DIC->contentStyle()
85 ->domain()
86 ->styleForRefId($this->object->getRefId());
87 $this->gui = $DIC->repository()->internal()->gui();
88 }
89
90 public function executeCommand(): void
91 {
92 $ilTabs = $this->tabs;
93
94 $next_class = $this->ctrl->getNextClass($this);
95 $this->prepareOutput();
96
97 switch ($next_class) {
98 case 'ilpermissiongui':
99 $perm_gui = new ilPermissionGUI($this);
100 $this->ctrl->forwardCommand($perm_gui);
101 break;
102
103 case "ilobjectownershipmanagementgui":
104 $this->setSystemCheckSubTabs("no_owner");
105 $gui = $this->gui->ownership()->ownershipManagementGUI(0);
106 $this->ctrl->forwardCommand($gui);
107 break;
108
109 case "ilcronmanagergui":
110 $ilTabs->activateTab("cron_jobs");
111 $gui = new ilCronManagerGUI();
112 $this->ctrl->forwardCommand($gui);
113 break;
114
115 default:
116 $cmd = $this->ctrl->getCmd("view");
117
118 $cmd .= "Object";
119 $this->$cmd();
120
121 break;
122 }
123 }
124
130 public function viewObject(): void
131 {
132 $ilAccess = $this->access;
133
134 if ($ilAccess->checkAccess("read", "", $this->object->getRefId())) {
136 return;
137 }
138 $this->showServerInfoObject();
139 }
140
144 public function setSystemCheckSubTabs($a_activate): void
145 {
146 $ilTabs = $this->tabs;
147 $ilCtrl = $this->ctrl;
148
149 $ilTabs->addSubTab(
150 "system_check_sub",
151 $this->lng->txt("system_check"),
152 $ilCtrl->getLinkTarget($this, "check")
153 );
154 $ilTabs->addSubTab(
155 "no_owner",
156 $this->lng->txt("system_check_no_owner"),
157 $ilCtrl->getLinkTargetByClass("ilObjectOwnershipManagementGUI")
158 );
159
160 $ilTabs->setSubTabActive($a_activate);
161 $ilTabs->setTabActive("system_check");
162 }
163
164 public function cancelObject(): void
165 {
166 $this->ctrl->redirect($this, "view");
167 }
168
169
173 public function benchmarkObject(): void
174 {
175 if (!$this->rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
176 $this->error->raiseError($this->lng->txt("permission_denied"), $this->error->MESSAGE);
177 }
178
179 $write_access = $this->rbacsystem->checkAccess("write", $this->object->getRefId());
180
181 $this->benchmarkSubTabs("settings");
182
183 $this->form = new ilPropertyFormGUI();
184
185 // Activate DB Benchmark
186 $cb = new ilCheckboxInputGUI($this->lng->txt("adm_activate_db_benchmark"), ilBenchmark::ENABLE_DB_BENCH);
187 $cb->setChecked((bool) $this->settings->get(ilBenchmark::ENABLE_DB_BENCH));
188 $cb->setInfo($this->lng->txt("adm_activate_db_benchmark_desc"));
189 $cb->setDisabled(!$write_access);
190 $this->form->addItem($cb);
191
192 // DB Benchmark User
193 $ti = new ilTextInputGUI($this->lng->txt("adm_db_benchmark_user"), ilBenchmark::DB_BENCH_USER);
194 $user_id = ($this->settings->get(ilBenchmark::DB_BENCH_USER)) ?? null;
195 if ($user_id !== null && ilObjUser::_lookupLogin((int) $user_id) !== '') {
196 $ti->setValue(ilObjUser::_lookupLogin($user_id));
197 } else {
198 $ti->setValue('');
199 }
200 $ti->setInfo($this->lng->txt("adm_db_benchmark_user_desc"));
201 $ti->setDisabled(!$write_access);
202 $this->form->addItem($ti);
203
204 if ($write_access) {
205 $this->form->addCommandButton("saveBenchSettings", $this->lng->txt("save"));
206 }
207
208 $this->form->setTitle($this->lng->txt("adm_db_benchmark"));
209 $this->form->setFormAction($this->ctrl->getFormAction($this));
210
211 $this->tpl->setContent($this->form->getHTML());
212 }
213
217 public function showDbBenchChronologicalObject(): void
218 {
219 $this->benchmarkSubTabs("chronological");
220 $this->showDbBenchResults("chronological");
221 }
222
226 public function showDbBenchSlowestFirstObject(): void
227 {
228 $this->benchmarkSubTabs("slowest_first");
229 $this->showDbBenchResults("slowest_first");
230 }
231
235 public function showDbBenchSortedBySqlObject(): void
236 {
237 $this->benchmarkSubTabs("sorted_by_sql");
238 $this->showDbBenchResults("sorted_by_sql");
239 }
240
244 public function showDbBenchByFirstTableObject(): void
245 {
246 $this->benchmarkSubTabs("by_first_table");
247 $this->showDbBenchResults("by_first_table");
248 }
249
255 public function showDbBenchResults($a_mode): void
256 {
258
259 $ilBench = $this->bench;
260 $rec = $ilBench->getDbBenchRecords();
261
262 $table = new ilBenchmarkTableGUI($this, "benchmark", $rec, $a_mode);
263 $tpl->setContent($table->getHTML());
264 }
265
272 public function benchmarkSubTabs($a_current): void
273 {
274 $ilTabs = $this->tabs;
276 $ilCtrl = $this->ctrl;
277
278 $ilBench = $this->bench;
279 $ilTabs->activateTab("benchmarks"); // #18083
280
281 $ilTabs->addSubtab(
282 "settings",
283 $lng->txt("settings"),
284 $ilCtrl->getLinkTarget($this, "benchmark")
285 );
286
287 $rec = $ilBench->getDbBenchRecords();
288 if ($rec !== []) {
289 $ilTabs->addSubtab(
290 "chronological",
291 $lng->txt("adm_db_bench_chronological"),
292 $ilCtrl->getLinkTarget($this, "showDbBenchChronological")
293 );
294 $ilTabs->addSubtab(
295 "slowest_first",
296 $lng->txt("adm_db_bench_slowest_first"),
297 $ilCtrl->getLinkTarget($this, "showDbBenchSlowestFirst")
298 );
299 $ilTabs->addSubtab(
300 "sorted_by_sql",
301 $lng->txt("adm_db_bench_sorted_by_sql"),
302 $ilCtrl->getLinkTarget($this, "showDbBenchSortedBySql")
303 );
304 $ilTabs->addSubtab(
305 "by_first_table",
306 $lng->txt("adm_db_bench_by_first_table"),
307 $ilCtrl->getLinkTarget($this, "showDbBenchByFirstTable")
308 );
309 }
310
311 $ilTabs->activateSubTab($a_current);
312 }
313
314
318 public function saveBenchSettingsObject(): void
319 {
320 $write_access = $this->rbacsystem->checkAccess("write", $this->object->getRefId());
321 if (!$write_access) {
322 $this->error->raiseError($this->lng->txt("permission_denied"), $this->error->MESSAGE);
323 return;
324 }
325
326 if ($this->wrapper->post()->has(ilBenchmark::ENABLE_DB_BENCH)
327 && $this->wrapper->post()->has(ilBenchmark::DB_BENCH_USER)) {
328 $activate = $this->wrapper->post()->retrieve(ilBenchmark::ENABLE_DB_BENCH, $this->refinery->kindlyTo()->bool());
329 if ($activate) {
330 $user_name = $this->wrapper->post()->retrieve(ilBenchmark::DB_BENCH_USER, $this->refinery->kindlyTo()->string());
331 $this->bench->enableDbBenchmarkForUserName($user_name);
332 }
333 } else {
334 $this->bench->disableDbBenchmark();
335 }
336
337 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
338
339 $this->ctrl->redirect($this, "benchmark");
340 }
341
342
346 public function switchBenchModuleObject(): void
347 {
348 $this->ctrl->setParameter($this, 'cur_mod', $_POST['module']);
349 $this->ctrl->redirect($this, "benchmark");
350 }
351
352
356 public function clearBenchObject(): void
357 {
358 $ilBench = $this->bench;
359 $ilBench->clearData();
361 }
362
363 // get tabs
364 public function getAdminTabs(): void
365 {
367 $ilHelp = $this->help;
368
369 // $ilHelp->setScreenIdComponent($this->object->getType());
370
371 $this->ctrl->setParameter($this, "ref_id", $this->object->getRefId());
372
373 // general settings
374 if ($rbacsystem->checkAccess("read", $this->object->getRefId())) {
375 $this->tabs_gui->addTarget(
376 "general_settings",
377 $this->ctrl->getLinkTarget($this, "showBasicSettings"),
378 ["showBasicSettings", "saveBasicSettings"],
379 get_class($this)
380 );
381 }
382
383 // server info
384 if ($rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
385 $this->tabs_gui->addTarget(
386 "server",
387 $this->ctrl->getLinkTarget($this, "showServerInfo"),
388 ["showServerInfo", "view"],
389 get_class($this)
390 );
391 }
392
393 if ($rbacsystem->checkAccess('visible,read', $this->object->getRefId())) {
394 $this->tabs_gui->addTarget(
395 'cron_jobs',
396 $this->ctrl->getLinkTargetByClass('ilCronManagerGUI', ''),
397 '',
398 get_class($this)
399 );
400
401 $this->tabs_gui->addTarget(
402 'benchmarks',
403 $this->ctrl->getLinkTarget($this, 'benchmark'),
404 'benchmark',
405 get_class($this)
406 );
407 }
408
409 if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
410 $this->tabs_gui->addTarget(
411 "perm_settings",
412 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
413 array("perm","info","owner"),
414 'ilpermissiongui'
415 );
416 }
417 }
418
423 public function showPHPInfoObject(): void
424 {
426 if ($rbacsystem->checkAccess("read", $this->object->getRefId())) {
427 phpinfo();
428 exit;
429 }
430 }
431
432 //
433 //
434 // Server Info
435 //
436 //
437
438 // TODO: remove this subtabs
442 public function setServerInfoSubTabs($a_activate): void
443 {
444 $ilTabs = $this->tabs;
445 $ilCtrl = $this->ctrl;
447
448 if ($rbacsystem->checkAccess("read", $this->object->getRefId())) {
449 $ilTabs->addSubTabTarget("installation_status", $ilCtrl->getLinkTarget($this, "showServerInstallationStatus"));
450
451 $ilTabs->addSubTabTarget("server_data", $ilCtrl->getLinkTarget($this, "showServerInfo"));
452 }
453
454
455 if ($rbacsystem->checkAccess("write", $this->object->getRefId())) {
456 $ilTabs->addSubTabTarget("java_server", $ilCtrl->getLinkTarget($this, "showJavaServer"));
457 }
458
459 $ilTabs->setSubTabActive($a_activate);
460 $ilTabs->setTabActive("server");
461 }
462
466 public function showServerInfoObject(): void
467 {
475 $ilCtrl = $this->ctrl;
476 $ilToolbar = $this->toolbar;
477
479 if ($rbacsystem->checkAccess("read", $this->object->getRefId())) {
480
481 $this->gui->link(
482 $this->lng->txt("vc_information"),
483 $this->ctrl->getLinkTarget($this, 'showVcsInformation')
484 )->toToolbar();
485
486 $this->initServerInfoForm();
487 // TODO: remove sub tabs
488 // $this->tabs->setTabActive("server");
489 $this->setServerInfoSubTabs("server_data");
490
491 $btpl = new ilTemplate("tpl.server_data.html", true, true, "components/ILIAS/SystemFolder");
492 $btpl->setVariable("FORM", $this->form->getHTML());
493 $btpl->setVariable("PHP_INFO_TARGET", $ilCtrl->getLinkTarget($this, "showPHPInfo"));
494 $tpl->setContent($btpl->get());
495 }
496 }
497
503 public function initServerInfoForm(): void
504 {
506 $ilClientIniFile = $this->client_ini;
508
509 $this->form = new ilPropertyFormGUI();
510
511 // installation name
512 $ne = new ilNonEditableValueGUI($lng->txt("inst_name"), "");
513 $ne->setValue($ilClientIniFile->readVariable("client", "name"));
514 $ne->setInfo($ilClientIniFile->readVariable("client", "description"));
515 $this->form->addItem($ne);
516
517 // client id
518 $ne = new ilNonEditableValueGUI($lng->txt("client_id"), "");
519 $ne->setValue(CLIENT_ID);
520 $this->form->addItem($ne);
521
522 // installation id
523 $ne = new ilNonEditableValueGUI($lng->txt("inst_id"), "");
524 $ne->setValue($ilSetting->get("inst_id"));
525 $this->form->addItem($ne);
526
527 // database version
528 $ne = new ilNonEditableValueGUI($lng->txt("db_version"), "");
529 $ne->setValue($ilSetting->get("db_version"));
530
531 $this->form->addItem($ne);
532
533 // ilias version
534 $ne = new ilNonEditableValueGUI($lng->txt("ilias_version"), "");
535 $ne->setValue(ILIAS_VERSION);
536 $this->form->addItem($ne);
537
538 // host
539 $ne = new ilNonEditableValueGUI($lng->txt("host"), "");
540 $ne->setValue($_SERVER["SERVER_NAME"]);
541 $this->form->addItem($ne);
542
543 // ip & port
544 $ne = new ilNonEditableValueGUI($lng->txt("ip_address") . " & " . $this->lng->txt("port"), "");
545 $ne->setValue($_SERVER["SERVER_ADDR"] . ":" . $_SERVER["SERVER_PORT"]);
546 $this->form->addItem($ne);
547
548 // server
549 $ne = new ilNonEditableValueGUI($lng->txt("server_software"), "");
550 $ne->setValue($_SERVER["SERVER_SOFTWARE"]);
551 $this->form->addItem($ne);
552
553 // http path
554 $ne = new ilNonEditableValueGUI($lng->txt("http_path"), "");
555 $ne->setValue(ILIAS_HTTP_PATH);
556 $this->form->addItem($ne);
557
558 // absolute path
559 $ne = new ilNonEditableValueGUI($lng->txt("absolute_path"), "");
560 $ne->setValue(ILIAS_ABSOLUTE_PATH);
561 $this->form->addItem($ne);
562
563 $not_set = $lng->txt("path_not_set");
564
565 // convert
566 $ne = new ilNonEditableValueGUI($lng->txt("path_to_convert"), "");
567 $ne->setValue(PATH_TO_CONVERT ?: $not_set);
568 $this->form->addItem($ne);
569
570 // zip
571 $ne = new ilNonEditableValueGUI($lng->txt("path_to_zip"), "");
572 $ne->setValue(PATH_TO_ZIP ?: $not_set);
573 $this->form->addItem($ne);
574
575 // unzip
576 $ne = new ilNonEditableValueGUI($lng->txt("path_to_unzip"), "");
577 $ne->setValue(PATH_TO_UNZIP ?: $not_set);
578 $this->form->addItem($ne);
579
580 // java
581 $ne = new ilNonEditableValueGUI($lng->txt("path_to_java"), "");
582 $ne->setValue(PATH_TO_JAVA ?: $not_set);
583 $this->form->addItem($ne);
584
585 // mkisofs
586 $ne = new ilNonEditableValueGUI($lng->txt("path_to_mkisofs"), "");
587 $ne->setValue(PATH_TO_MKISOFS ?: $not_set);
588 $this->form->addItem($ne);
589
590 $this->form->setTitle($lng->txt("server_data"));
591 $this->form->setFormAction($this->ctrl->getFormAction($this));
592 }
593
594 protected function showServerInstallationStatusObject(): void
595 {
597 if ($rbacsystem->checkAccess("read", $this->object->getRefId())) {
598 $this->setServerInfoSubTabs("installation_status");
599 $this->renderServerStatus();
600 }
601 }
602
603 protected function renderServerStatus(): void
604 {
605 $f = $this->dic->ui()->factory();
606 $r = $this->dic->ui()->renderer();
607 $metric = $this->getServerStatusInfo();
608 $report = $metric->toUIReport($f, $this->lng->txt("installation_status"));
609
610 $this->tpl->setContent($r->render($report));
611 }
612
613 protected function getServerStatusInfo(): ILIAS\Setup\Metrics\Metric
614 {
615 $agent_finder = $this->dic['setup.agentfinder'];
616 $st = new StatusCommand($agent_finder);
617 return $st->getMetrics($agent_finder->getAgents());
618 }
619
620 //
621 //
622 // General Settings
623 //
624 //
625
629 public function setGeneralSettingsSubTabs($a_activate): void
630 {
631 $ilTabs = $this->tabs;
632 $ilCtrl = $this->ctrl;
633
634 $ilTabs->addSubTabTarget("basic_settings", $ilCtrl->getLinkTarget($this, "showBasicSettings"));
635 $ilTabs->addSubTabTarget("header_title", $ilCtrl->getLinkTarget($this, "showHeaderTitle"));
636 $ilTabs->addSubTabTarget("contact_data", $ilCtrl->getLinkTarget($this, "showContactInformation"));
637
638 $ilTabs->setSubTabActive($a_activate);
639 $ilTabs->setTabActive("general_settings");
640 }
641
642 //
643 //
644 // Basic Settings
645 //
646 //
647
651 public function showBasicSettingsObject(): void
652 {
654
655 $this->initBasicSettingsForm();
656 $this->setGeneralSettingsSubTabs("basic_settings");
657
658 $tpl->setContent($this->form->getHTML());
659 }
660
661
665 public function initBasicSettingsForm(): void
666 {
673
674 $this->form = new ilPropertyFormGUI();
676
677 // installation short title
678 $ti = new ilTextInputGUI($this->lng->txt("short_inst_name"), "short_inst_name");
679 $ti->setMaxLength(200);
680 $ti->setSize(40);
681 $ti->setValue($ilSetting->get("short_inst_name"));
682 $ti->setInfo($this->lng->txt("short_inst_name_info"));
683 $this->form->addItem($ti);
684
685
686 $cb = new ilCheckboxInputGUI($this->lng->txt("pub_section"), "pub_section");
687 $cb->setInfo($lng->txt("pub_section_info"));
688 if (ilPublicSectionSettings::getInstance()->isEnabled()) {
689 $cb->setChecked(true);
690 }
691 $this->form->addItem($cb);
692
693 $this->lng->loadLanguageModule('administration');
694 $domains = new ilTextInputGUI($this->lng->txt('adm_pub_section_domain_filter'), 'public_section_domains');
695 $domains->setInfo($this->lng->txt('adm_pub_section_domain_filter_info'));
696 $domains->setMulti(true);
697 $domains->setValue(current(ilPublicSectionSettings::getInstance()->getDomains()));
698 $domains->setMultiValues(ilPublicSectionSettings::getInstance()->getDomains());
699
700 $cb->addSubItem($domains);
701
702
703 // Enable Global Profiles
704 $cb_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_user_publish'), 'enable_global_profiles');
705 $cb_prop->setInfo($lng->txt('pd_enable_user_publish_info'));
706 $cb_prop->setChecked((bool) $ilSetting->get('enable_global_profiles'));
707 $cb->addSubItem($cb_prop);
708
709 // search engine
710 $robot_settings = ilRobotSettings::getInstance();
711 $cb2 = new ilCheckboxInputGUI($this->lng->txt("search_engine"), "open_google");
712 $cb2->setInfo($this->lng->txt("enable_search_engine"));
713 $this->form->addItem($cb2);
714
715 if (!$robot_settings->checkRewrite()) {
716 $cb2->setAlert($lng->txt("allow_override_alert"));
717 $cb2->setChecked(false);
718 $cb2->setDisabled(true);
719 } elseif ($ilSetting->get("open_google")) {
720 $cb2->setChecked(true);
721 }
722
723 // locale
724 $ti = new ilTextInputGUI($this->lng->txt("adm_locale"), "locale");
725 $ti->setMaxLength(80);
726 $ti->setSize(40);
727 $ti->setInfo($this->lng->txt("adm_locale_info"));
728 $ti->setValue($ilSetting->get("locale"));
729 $this->form->addItem($ti);
730
731 // save and cancel commands
732 $this->form->addCommandButton("saveBasicSettings", $lng->txt("save"));
733
734 $this->form->setTitle($lng->txt("basic_settings"));
735 $this->form->setFormAction($this->ctrl->getFormAction($this));
736 }
737
742 public function saveBasicSettingsObject(): void
743 {
746 $ilCtrl = $this->ctrl;
750
751 if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
752 $this->tpl->setOnScreenMessage("failure", $this->lng->txt("permission_denied"), true);
753 $this->ctrl->redirectByClass(self::class);
754 //$ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
755 }
756
757 $this->initBasicSettingsForm();
758 if ($this->form->checkInput()) {
759 $ilSetting->set("short_inst_name", $this->form->getInput("short_inst_name"));
760
761 $public_section = ilPublicSectionSettings::getInstance();
762 $public_section->setEnabled($this->form->getInput('pub_section'));
763
764 $domains = [];
765 foreach ((array) $this->form->getInput('public_section_domains') as $domain) {
766 if (strlen(trim($domain)) !== 0) {
767 $domains[] = $domain;
768 }
769 }
770 $public_section->setDomains($domains);
771 $public_section->save();
772
773 $global_profiles = ($this->form->getInput("pub_section"))
774 ? (int) $this->form->getInput('enable_global_profiles')
775 : 0;
776 $ilSetting->set('enable_global_profiles', $global_profiles);
777
778 $ilSetting->set("open_google", $this->form->getInput("open_google"));
779 $ilSetting->set("locale", $this->form->getInput("locale"));
780
781 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
782 $ilCtrl->redirect($this, "showBasicSettings");
783 }
784 $this->setGeneralSettingsSubTabs("basic_settings");
785 $this->form->setValuesByPost();
786 $tpl->setContent($this->form->getHtml());
787 }
788
789 //
790 //
791 // Header title
792 //
793 //
794
798 public function showHeaderTitleObject(
799 $a_get_post_values = false,
800 bool $add_entry = false
801 ): void {
802 $tpl = $this->tpl;
803 $this->setGeneralSettingsSubTabs("header_title");
804 $table = new ilInstallationHeadingTableGUI($this, "showHeaderTitle", false);
805 $post = $this->gui->http()->request()->getParsedBody();
806 if ($a_get_post_values) {
807 $vals = array();
808 foreach (($post["title"] ?? []) as $k => $v) {
809 $def = $post["default"] ?? "";
810 $vals[] = array("title" => $v,
811 "desc" => ($post["desc"][$k] ?? ""),
812 "lang" => ($post["lang"][$k] ?? ""),
813 "default" => ($def == $k));
814 }
815 if ($add_entry) {
816 $vals[] = array("title" => "",
817 "desc" => "",
818 "lang" => "",
819 "default" => false);
820 }
821 $table->setData($vals);
822 } else {
823 $data = $this->object->getHeaderTitleTranslations();
824 if (isset($data["Fobject"]) && is_array($data["Fobject"])) {
825 foreach ($data["Fobject"] as $k => $v) {
826 if ($k == $data["default_language"]) {
827 $data["Fobject"][$k]["default"] = true;
828 } else {
829 $data["Fobject"][$k]["default"] = false;
830 }
831 }
832 } else {
833 $data["Fobject"] = array();
834 }
835 $table->setData($data["Fobject"]);
836 }
837 $tpl->setContent($table->getHTML());
838 }
839
843 public function saveHeaderTitlesObject(bool $delete = false)
844 {
845 $ilCtrl = $this->ctrl;
847 $rbacsystem = $this->rbacsystem;
848 $ilErr = $this->error;
849
850 if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
851 $this->tpl->setOnScreenMessage("failure", $this->lng->txt("permission_denied"), true);
852 $this->ctrl->redirectByClass(self::class, "showHeaderTitle");
853 }
854
855 $post = $this->dic->http()->request()->getParsedBody();
856 foreach ($post["title"] as $k => $v) {
857 if ($delete && ($post["check"][$k] ?? false)) {
858 unset($post["title"][$k]);
859 unset($post["desc"][$k]);
860 unset($post["lang"][$k]);
861 if ($k == $post["default"]) {
862 unset($post["default"]);
863 }
864 }
865 }
866
867
868
869 // default language set?
870 if (!isset($post["default"]) && count($post["lang"]) > 0) {
871 $this->tpl->setOnScreenMessage('failure', $lng->txt("msg_no_default_language"));
872 $this->showHeaderTitleObject(true);
873 return;
874 }
875
876 // all languages set?
877 if (array_key_exists("", $post["lang"])) {
878 $this->tpl->setOnScreenMessage('failure', $lng->txt("msg_no_language_selected"));
879 $this->showHeaderTitleObject(true);
880 return;
881 }
882
883 // no single language is selected more than once?
884 if (count(array_unique($post["lang"])) < count($post["lang"])) {
885 $this->tpl->setOnScreenMessage('failure', $lng->txt("msg_multi_language_selected"));
886 $this->showHeaderTitleObject(true);
887 return;
888 }
889
890 // save the stuff
891 $this->object->removeHeaderTitleTranslations();
892 foreach ($post["title"] as $k => $v) {
893 $desc = $post["desc"][$k] ?? "";
894 $this->object->addHeaderTitleTranslation(
897 ilUtil::stripSlashes($post["lang"][$k]),
898 ($post["default"] == $k)
899 );
900 }
901
902 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
903 $ilCtrl->redirect($this, "showHeaderTitle");
904 }
905
909 public function addHeaderTitleObject(): void
910 {
911 $k = 1;
912 $this->showHeaderTitleObject(true, true);
913 }
914
918 public function deleteHeaderTitlesObject(): void
919 {
920 $ilCtrl = $this->ctrl;
922 $this->saveHeaderTitlesObject(true);
923 }
924
925
926 //
927 //
928 // Cron Jobs
929 //
930 //
931
932 /*
933 * OLD GLOBAL CRON JOB SWITCHES (ilSetting)
934 *
935 * cron_user_check => obsolete
936 * cron_inactive_user_delete => obsolete
937 * cron_inactivated_user_delete => obsolete
938 * cron_link_check => obsolete
939 * cron_web_resource_check => migrated
940 * cron_lucene_index => obsolete
941 * forum_notification => migrated
942 * mail_notification => migrated
943 * crsgrp_ntf => migrated
944 * cron_upd_adrbook => migrated
945 */
946
947 public function jumpToCronJobsObject(): void
948 {
949 // #13010 - this is used for external settings
950 $this->ctrl->redirectByClass("ilCronManagerGUI", "render");
951 }
952
953
954 //
955 //
956 // Contact Information
957 //
958 //
959
963 public function showContactInformationObject(): void
964 {
965 $tpl = $this->tpl;
966
967 $this->initContactInformationForm();
968 $this->setGeneralSettingsSubTabs("contact_data");
969 $tpl->setContent($this->form->getHTML());
970 }
971
975 public function initContactInformationForm(): void
976 {
978 $ilSetting = $this->settings;
979
980 $this->form = new ilPropertyFormGUI();
981
982 // first name
983 $ti = new ilTextInputGUI($this->lng->txt("firstname"), "admin_firstname");
984 $ti->setMaxLength(64);
985 $ti->setSize(40);
986 $ti->setRequired(true);
987 $ti->setValue($ilSetting->get("admin_firstname"));
988 $this->form->addItem($ti);
989
990 // last name
991 $ti = new ilTextInputGUI($this->lng->txt("lastname"), "admin_lastname");
992 $ti->setMaxLength(64);
993 $ti->setSize(40);
994 $ti->setRequired(true);
995 $ti->setValue($ilSetting->get("admin_lastname"));
996 $this->form->addItem($ti);
997
998 // title
999 $ti = new ilTextInputGUI($this->lng->txt("title"), "admin_title");
1000 $ti->setMaxLength(64);
1001 $ti->setSize(40);
1002 $ti->setValue($ilSetting->get("admin_title"));
1003 $this->form->addItem($ti);
1004
1005 // position
1006 $ti = new ilTextInputGUI($this->lng->txt("position"), "admin_position");
1007 $ti->setMaxLength(64);
1008 $ti->setSize(40);
1009 $ti->setValue($ilSetting->get("admin_position"));
1010 $this->form->addItem($ti);
1011
1012 // institution
1013 $ti = new ilTextInputGUI($this->lng->txt("institution"), "admin_institution");
1014 $ti->setMaxLength(200);
1015 $ti->setSize(40);
1016 $ti->setValue($ilSetting->get("admin_institution"));
1017 $this->form->addItem($ti);
1018
1019 // street
1020 $ti = new ilTextInputGUI($this->lng->txt("street"), "admin_street");
1021 $ti->setMaxLength(64);
1022 $ti->setSize(40);
1023 //$ti->setRequired(true);
1024 $ti->setValue($ilSetting->get("admin_street"));
1025 $this->form->addItem($ti);
1026
1027 // zip code
1028 $ti = new ilTextInputGUI($this->lng->txt("zipcode"), "admin_zipcode");
1029 $ti->setMaxLength(10);
1030 $ti->setSize(5);
1031 //$ti->setRequired(true);
1032 $ti->setValue($ilSetting->get("admin_zipcode"));
1033 $this->form->addItem($ti);
1034
1035 // city
1036 $ti = new ilTextInputGUI($this->lng->txt("city"), "admin_city");
1037 $ti->setMaxLength(64);
1038 $ti->setSize(40);
1039 //$ti->setRequired(true);
1040 $ti->setValue($ilSetting->get("admin_city"));
1041 $this->form->addItem($ti);
1042
1043 // country
1044 $ti = new ilTextInputGUI($this->lng->txt("country"), "admin_country");
1045 $ti->setMaxLength(64);
1046 $ti->setSize(40);
1047 //$ti->setRequired(true);
1048 $ti->setValue($ilSetting->get("admin_country"));
1049 $this->form->addItem($ti);
1050
1051 // phone
1052 $ti = new ilTextInputGUI($this->lng->txt("phone"), "admin_phone");
1053 $ti->setMaxLength(64);
1054 $ti->setSize(40);
1055 //$ti->setRequired(true);
1056 $ti->setValue($ilSetting->get("admin_phone"));
1057 $this->form->addItem($ti);
1058
1059 // email
1060 $ti = new ilEMailInputGUI($this->lng->txt("email"), "admin_email");
1061 $ti->setMaxLength(64);
1062 $ti->setSize(40);
1063 $ti->setRequired(true);
1064 $ti->allowRFC822(true);
1065 $ti->setValue($ilSetting->get("admin_email"));
1066 $this->form->addItem($ti);
1067
1068 // System support contacts
1069 $ti = new ilTextInputGUI($this->lng->txt("adm_support_contacts"), "adm_support_contacts");
1070 $ti->setMaxLength(500);
1071 $ti->setValue(ilSystemSupportContacts::getList());
1072 //$ti->setSize();
1073 $ti->setInfo($this->lng->txt("adm_support_contacts_info"));
1074 $this->form->addItem($ti);
1075
1076 // Accessibility support contacts
1077 $ti = new ilTextInputGUI($this->lng->txt("adm_accessibility_contacts"), "accessibility_support_contacts");
1078 $ti->setMaxLength(500);
1080 //$ti->setSize();
1081 $ti->setInfo($this->lng->txt("adm_accessibility_contacts_info"));
1082 $this->form->addItem($ti);
1083
1084 $this->form->addCommandButton("saveContactInformation", $lng->txt("save"));
1085
1086 $this->form->setTitle($lng->txt("contact_data"));
1087 $this->form->setFormAction($this->ctrl->getFormAction($this));
1088 }
1089
1094 public function saveContactInformationObject(): void
1095 {
1096 $tpl = $this->tpl;
1097 $lng = $this->lng;
1098 $ilCtrl = $this->ctrl;
1099 $ilSetting = $this->settings;
1100 $rbacsystem = $this->rbacsystem;
1101 $ilErr = $this->error;
1102
1103 if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
1104 $this->tpl->setOnScreenMessage("failure", $this->lng->txt("permission_denied"), true);
1105 $this->ctrl->redirectByClass(self::class, "showContactInformation");
1106 }
1107
1108 $this->initContactInformationForm();
1109 if ($this->form->checkInput()) {
1110 $fs = array("admin_firstname", "admin_lastname", "admin_title", "admin_position",
1111 "admin_institution", "admin_street", "admin_zipcode", "admin_city",
1112 "admin_country", "admin_phone", "admin_email");
1113 foreach ($fs as $f) {
1114 $ilSetting->set($f, $_POST[$f]);
1115 }
1116
1117 // System support contacts
1118 ilSystemSupportContacts::setList($_POST["adm_support_contacts"]);
1119
1120 // Accessibility support contacts
1121 ilAccessibilitySupportContacts::setList($_POST["accessibility_support_contacts"]);
1122
1123 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1124 $ilCtrl->redirect($this, "showContactInformation");
1125 } else {
1126 $this->setGeneralSettingsSubTabs("contact_data");
1127 $this->form->setValuesByPost();
1128 $tpl->setContent($this->form->getHtml());
1129 }
1130 }
1131
1132 //
1133 //
1134 // Java Server
1135 //
1136 //
1137
1141 public function showJavaServerObject(): void
1142 {
1143 $tpl = $this->tpl;
1144
1145 $tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.java_settings.html', 'components/ILIAS/SystemFolder');
1146
1147 $GLOBALS['lng']->loadLanguageModule('search');
1148
1149 $this->initJavaServerForm();
1150 $this->setServerInfoSubTabs("java_server");
1151 $tpl->setVariable('SETTINGS_TABLE', $this->form->getHTML());
1152 }
1153
1158 public function createJavaServerIniObject(): void
1159 {
1160 $this->setGeneralSettingsSubTabs('java_server');
1161 $this->tpl->setContent($this->form->getHTML());
1162 }
1163
1167 public function initJavaServerForm(): void
1168 {
1169 $lng = $this->lng;
1170 $ilSetting = $this->settings;
1171
1172 $this->form = new ilPropertyFormGUI();
1173 $this->form->setFormAction($this->ctrl->getFormAction($this, 'saveJavaServer'));
1174
1175 // pdf fonts
1176 $pdf = new ilFormSectionHeaderGUI();
1177 $pdf->setTitle($this->lng->txt('rpc_pdf_generation'));
1178 $this->form->addItem($pdf);
1179
1180 $pdf_font = new ilTextInputGUI($this->lng->txt('rpc_pdf_font'), 'rpc_pdf_font');
1181 $pdf_font->setInfo($this->lng->txt('rpc_pdf_font_info'));
1182 $pdf_font->setSize(64);
1183 $pdf_font->setMaxLength(1024);
1184 $pdf_font->setRequired(true);
1185 $pdf_font->setValue(
1186 $ilSetting->get('rpc_pdf_font', 'Helvetica, unifont')
1187 );
1188 $this->form->addItem($pdf_font);
1189
1190 // save and cancel commands
1191 $this->form->addCommandButton("saveJavaServer", $lng->txt("save"));
1192 }
1193
1198 public function saveJavaServerObject(): void
1199 {
1200 $tpl = $this->tpl;
1201 $lng = $this->lng;
1202 $ilCtrl = $this->ctrl;
1203 $ilSetting = $this->settings;
1204 $rbacsystem = $this->rbacsystem;
1205 $ilErr = $this->error;
1206
1207 if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
1208 $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
1209 }
1210
1211 $this->initJavaServerForm();
1212 if ($this->form->checkInput()) {
1213 $ilSetting->set('rpc_pdf_font', ilUtil::stripSlashes($_POST['rpc_pdf_font']));
1214 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1215 $ilCtrl->redirect($this, "showJavaServer");
1216
1217 // TODO check settings, ping server
1218 } else {
1219 $this->setGeneralSettingsSubTabs("java_server");
1220 $this->form->setValuesByPost();
1221 $tpl->setContent($this->form->getHtml());
1222 }
1223 }
1224
1228 public static function _goto(): void
1229 {
1230 global $DIC;
1231 $main_tpl = $DIC->ui()->mainTemplate();
1232
1233 $ilAccess = $DIC->access();
1234 $ilErr = $DIC["ilErr"];
1235 $lng = $DIC->language();
1236
1237 $a_target = SYSTEM_FOLDER_ID;
1238
1239 if ($ilAccess->checkAccess("read", "", $a_target)) {
1240 ilUtil::redirect("ilias.php?baseClass=ilAdministrationGUI");
1241 exit;
1242 } else {
1243 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1244 $main_tpl->setOnScreenMessage('failure', sprintf(
1245 $lng->txt("msg_no_perm_read_item"),
1247 ), true);
1249 }
1250 }
1251 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1252 }
1253
1257 protected function showVcsInformationObject(): void
1258 {
1259 $vcInfo = [];
1260 $rbacsystem = $this->rbacsystem;
1261 if ($rbacsystem->checkAccess("read", $this->object->getRefId())) {
1262 foreach ([new ilGitInformation()] as $vc) {
1263 $html = $vc->getInformationAsHtml();
1264 if ($html) {
1265 $vcInfo[] = $html;
1266 }
1267 }
1268
1269 if ($vcInfo !== []) {
1270 $this->tpl->setOnScreenMessage('info', implode("<br />", $vcInfo));
1271 } else {
1272 $this->tpl->setOnScreenMessage('info', $this->lng->txt('vc_information_not_determined'));
1273 }
1274
1275 $this->showServerInfoObject();
1276 }
1277 }
1278}
Builds data types.
Definition: Factory.php:36
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilBenchmark.
clearData()
delete all measurement data
This class represents a checkbox property in a property form.
@ilCtrl_Calls ilCronManagerGUI: ilPropertyFormGUI @ilCtrl_isCalledBy ilCronManagerGUI: ilAdministrati...
This class represents a email property in a property form.
Error Handling & global info handling.
This class represents a section header in a property form.
Class ilGitInformation.
Help GUI class.
INIFile Parser Early access in init proceess! Avoid further dependencies like logging or other servic...
TableGUI class for title/description translations.
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...
This class represents a non editable value in a property form.
Class ilObjSystemFolderGUI.
setServerInfoSubTabs($a_activate)
Set sub tabs for server info.
setSystemCheckSubTabs($a_activate)
Set sub tabs for general settings.
showContactInformationObject()
Show contact information.
initContactInformationForm()
Init contact information form.
ilObjectDefinition $obj_definition
showHeaderTitleObject( $a_get_post_values=false, bool $add_entry=false)
Show header title.
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.
ILIAS Style Content Object ObjectFacade $content_style_domain
saveBenchSettingsObject()
Save benchmark settings.
addHeaderTitleObject()
Add a header title.
showDbBenchChronologicalObject()
Show db benchmark results.
cancelObject()
cancel action and go back to previous page
saveContactInformationObject()
Save contact information form.
saveBasicSettingsObject()
Save basic settings form.
clearBenchObject()
delete all benchmark records
viewObject()
show admin subpanels and basic settings form
showBasicSettingsObject()
Show basic settings.
saveHeaderTitlesObject(bool $delete=false)
Save header titles.
ILIAS Repository InternalGUIService $gui
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.
ilSetting $settings
ilToolbarGUI $toolbar
prepareOutput(bool $show_sub_objects=true)
ilLanguage $lng
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This class represents a property form user interface.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
static getInstance()
get singleton instance
ilStyleDefinition acts as a wrapper of style related actions.
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)
const CLIENT_ID
Definition: constants.php:41
const SYSTEM_FOLDER_ID
Definition: constants.php:35
const ROOT_FOLDER_ID
Definition: constants.php:32
exit
const ILIAS_VERSION
setContent(string $a_html)
Sets content for standard template.
Interface ilDBInterface.
$_POST['cmd']
Definition: lti.php:27
$post
Definition: ltitoken.php:46
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
form( $class_path, string $cmd, string $submit_caption="")
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $lng
Definition: privfeed.php:31
global $ilSetting
Definition: privfeed.php:31
$_SERVER['HTTP_HOST']
Definition: raiseError.php:26
$ilErr
Definition: raiseError.php:33
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54