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