ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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;
47  protected ilBenchmark $bench;
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())) {
135  $this->showBasicSettingsObject();
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  {
257  $tpl = $this->tpl;
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;
275  $lng = $this->lng;
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();
360  $this->saveBenchSettingsObject();
361  }
362 
363  // get tabs
364  public function getAdminTabs(): void
365  {
366  $rbacsystem = $this->rbacsystem;
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  {
425  $rbacsystem = $this->rbacsystem;
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;
446  $rbacsystem = $this->rbacsystem;
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  {
474  $tpl = $this->tpl;
475  $ilCtrl = $this->ctrl;
476  $ilToolbar = $this->toolbar;
477 
478  $rbacsystem = $this->rbacsystem;
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  {
505  $lng = $this->lng;
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  // latex
591  $ne = new ilNonEditableValueGUI($lng->txt("url_to_latex"), "");
592  $ne->setValue(URL_TO_LATEX ?: $not_set);
593  $this->form->addItem($ne);
594 
595 
596  $this->form->setTitle($lng->txt("server_data"));
597  $this->form->setFormAction($this->ctrl->getFormAction($this));
598  }
599 
600  protected function showServerInstallationStatusObject(): void
601  {
602  $rbacsystem = $this->rbacsystem;
603  if ($rbacsystem->checkAccess("read", $this->object->getRefId())) {
604  $this->setServerInfoSubTabs("installation_status");
605  $this->renderServerStatus();
606  }
607  }
608 
609  protected function renderServerStatus(): void
610  {
611  $f = $this->dic->ui()->factory();
612  $r = $this->dic->ui()->renderer();
613  $metric = $this->getServerStatusInfo();
614  $report = $metric->toUIReport($f, $this->lng->txt("installation_status"));
615 
616  $this->tpl->setContent($r->render($report));
617  }
618 
619  protected function getServerStatusInfo(): ILIAS\Setup\Metrics\Metric
620  {
621  $agent_finder = $this->dic['setup.agentfinder'];
622  $st = new StatusCommand($agent_finder);
623  return $st->getMetrics($agent_finder->getAgents());
624  }
625 
626  //
627  //
628  // General Settings
629  //
630  //
631 
635  public function setGeneralSettingsSubTabs($a_activate): void
636  {
637  $ilTabs = $this->tabs;
638  $ilCtrl = $this->ctrl;
639 
640  $ilTabs->addSubTabTarget("basic_settings", $ilCtrl->getLinkTarget($this, "showBasicSettings"));
641  $ilTabs->addSubTabTarget("header_title", $ilCtrl->getLinkTarget($this, "showHeaderTitle"));
642  $ilTabs->addSubTabTarget("contact_data", $ilCtrl->getLinkTarget($this, "showContactInformation"));
643 
644  $ilTabs->setSubTabActive($a_activate);
645  $ilTabs->setTabActive("general_settings");
646  }
647 
648  //
649  //
650  // Basic Settings
651  //
652  //
653 
657  public function showBasicSettingsObject(): void
658  {
659  $tpl = $this->tpl;
660 
661  $this->initBasicSettingsForm();
662  $this->setGeneralSettingsSubTabs("basic_settings");
663 
664  $tpl->setContent($this->form->getHTML());
665  }
666 
667 
671  public function initBasicSettingsForm(): void
672  {
677  $lng = $this->lng;
679 
680  $this->form = new ilPropertyFormGUI();
681  $lng->loadLanguageModule("pd");
682 
683  // installation short title
684  $ti = new ilTextInputGUI($this->lng->txt("short_inst_name"), "short_inst_name");
685  $ti->setMaxLength(200);
686  $ti->setSize(40);
687  $ti->setValue($ilSetting->get("short_inst_name"));
688  $ti->setInfo($this->lng->txt("short_inst_name_info"));
689  $this->form->addItem($ti);
690 
691 
692  $cb = new ilCheckboxInputGUI($this->lng->txt("pub_section"), "pub_section");
693  $cb->setInfo($lng->txt("pub_section_info"));
694  if (ilPublicSectionSettings::getInstance()->isEnabled()) {
695  $cb->setChecked(true);
696  }
697  $this->form->addItem($cb);
698 
699  $this->lng->loadLanguageModule('administration');
700  $domains = new ilTextInputGUI($this->lng->txt('adm_pub_section_domain_filter'), 'public_section_domains');
701  $domains->setInfo($this->lng->txt('adm_pub_section_domain_filter_info'));
702  $domains->setMulti(true);
703  $domains->setValue(current(ilPublicSectionSettings::getInstance()->getDomains()));
704  $domains->setMultiValues(ilPublicSectionSettings::getInstance()->getDomains());
705 
706  $cb->addSubItem($domains);
707 
708 
709  // Enable Global Profiles
710  $cb_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_user_publish'), 'enable_global_profiles');
711  $cb_prop->setInfo($lng->txt('pd_enable_user_publish_info'));
712  $cb_prop->setChecked((bool) $ilSetting->get('enable_global_profiles'));
713  $cb->addSubItem($cb_prop);
714 
715  // search engine
716  $robot_settings = ilRobotSettings::getInstance();
717  $cb2 = new ilCheckboxInputGUI($this->lng->txt("search_engine"), "open_google");
718  $cb2->setInfo($this->lng->txt("enable_search_engine"));
719  $this->form->addItem($cb2);
720 
721  if (!$robot_settings->checkRewrite()) {
722  $cb2->setAlert($lng->txt("allow_override_alert"));
723  $cb2->setChecked(false);
724  $cb2->setDisabled(true);
725  } elseif ($ilSetting->get("open_google")) {
726  $cb2->setChecked(true);
727  }
728 
729  // locale
730  $ti = new ilTextInputGUI($this->lng->txt("adm_locale"), "locale");
731  $ti->setMaxLength(80);
732  $ti->setSize(40);
733  $ti->setInfo($this->lng->txt("adm_locale_info"));
734  $ti->setValue($ilSetting->get("locale"));
735  $this->form->addItem($ti);
736 
737  // save and cancel commands
738  $this->form->addCommandButton("saveBasicSettings", $lng->txt("save"));
739 
740  $this->form->setTitle($lng->txt("basic_settings"));
741  $this->form->setFormAction($this->ctrl->getFormAction($this));
742  }
743 
748  public function saveBasicSettingsObject(): void
749  {
750  $tpl = $this->tpl;
751  $lng = $this->lng;
752  $ilCtrl = $this->ctrl;
754  $rbacsystem = $this->rbacsystem;
756 
757  if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
758  $this->tpl->setOnScreenMessage("failure", $this->lng->txt("permission_denied"), true);
759  $this->ctrl->redirectByClass(self::class);
760  //$ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
761  }
762 
763  $this->initBasicSettingsForm();
764  if ($this->form->checkInput()) {
765  $ilSetting->set("short_inst_name", $this->form->getInput("short_inst_name"));
766 
767  $public_section = ilPublicSectionSettings::getInstance();
768  $public_section->setEnabled($this->form->getInput('pub_section'));
769 
770  $domains = [];
771  foreach ((array) $this->form->getInput('public_section_domains') as $domain) {
772  if (strlen(trim($domain)) !== 0) {
773  $domains[] = $domain;
774  }
775  }
776  $public_section->setDomains($domains);
777  $public_section->save();
778 
779  $global_profiles = ($this->form->getInput("pub_section"))
780  ? (int) $this->form->getInput('enable_global_profiles')
781  : 0;
782  $ilSetting->set('enable_global_profiles', $global_profiles);
783 
784  $ilSetting->set("open_google", $this->form->getInput("open_google"));
785  $ilSetting->set("locale", $this->form->getInput("locale"));
786 
787  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
788  $ilCtrl->redirect($this, "showBasicSettings");
789  }
790  $this->setGeneralSettingsSubTabs("basic_settings");
791  $this->form->setValuesByPost();
792  $tpl->setContent($this->form->getHtml());
793  }
794 
795  //
796  //
797  // Header title
798  //
799  //
800 
804  public function showHeaderTitleObject(
805  $a_get_post_values = false,
806  bool $add_entry = false
807  ): void {
808  $tpl = $this->tpl;
809  $this->setGeneralSettingsSubTabs("header_title");
810  $table = new ilInstallationHeadingTableGUI($this, "showHeaderTitle", false);
811  $post = $this->gui->http()->request()->getParsedBody();
812  if ($a_get_post_values) {
813  $vals = array();
814  foreach (($post["title"] ?? []) as $k => $v) {
815  $def = $post["default"] ?? "";
816  $vals[] = array("title" => $v,
817  "desc" => ($post["desc"][$k] ?? ""),
818  "lang" => ($post["lang"][$k] ?? ""),
819  "default" => ($def == $k));
820  }
821  if ($add_entry) {
822  $vals[] = array("title" => "",
823  "desc" => "",
824  "lang" => "",
825  "default" => false);
826  }
827  $table->setData($vals);
828  } else {
829  $data = $this->object->getHeaderTitleTranslations();
830  if (isset($data["Fobject"]) && is_array($data["Fobject"])) {
831  foreach ($data["Fobject"] as $k => $v) {
832  if ($k == $data["default_language"]) {
833  $data["Fobject"][$k]["default"] = true;
834  } else {
835  $data["Fobject"][$k]["default"] = false;
836  }
837  }
838  } else {
839  $data["Fobject"] = array();
840  }
841  $table->setData($data["Fobject"]);
842  }
843  $tpl->setContent($table->getHTML());
844  }
845 
849  public function saveHeaderTitlesObject(bool $delete = false)
850  {
851  $ilCtrl = $this->ctrl;
852  $lng = $this->lng;
853  $rbacsystem = $this->rbacsystem;
855 
856  if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
857  $this->tpl->setOnScreenMessage("failure", $this->lng->txt("permission_denied"), true);
858  $this->ctrl->redirectByClass(self::class, "showHeaderTitle");
859  }
860 
861  $post = $this->dic->http()->request()->getParsedBody();
862  foreach ($post["title"] as $k => $v) {
863  if ($delete && ($post["check"][$k] ?? false)) {
864  unset($post["title"][$k]);
865  unset($post["desc"][$k]);
866  unset($post["lang"][$k]);
867  if ($k == $post["default"]) {
868  unset($post["default"]);
869  }
870  }
871  }
872 
873 
874 
875  // default language set?
876  if (!isset($post["default"]) && count($post["lang"]) > 0) {
877  $this->tpl->setOnScreenMessage('failure', $lng->txt("msg_no_default_language"));
878  $this->showHeaderTitleObject(true);
879  return;
880  }
881 
882  // all languages set?
883  if (array_key_exists("", $post["lang"])) {
884  $this->tpl->setOnScreenMessage('failure', $lng->txt("msg_no_language_selected"));
885  $this->showHeaderTitleObject(true);
886  return;
887  }
888 
889  // no single language is selected more than once?
890  if (count(array_unique($post["lang"])) < count($post["lang"])) {
891  $this->tpl->setOnScreenMessage('failure', $lng->txt("msg_multi_language_selected"));
892  $this->showHeaderTitleObject(true);
893  return;
894  }
895 
896  // save the stuff
897  $this->object->removeHeaderTitleTranslations();
898  foreach ($post["title"] as $k => $v) {
899  $desc = $post["desc"][$k] ?? "";
900  $this->object->addHeaderTitleTranslation(
902  ilUtil::stripSlashes($desc),
903  ilUtil::stripSlashes($post["lang"][$k]),
904  ($post["default"] == $k)
905  );
906  }
907 
908  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
909  $ilCtrl->redirect($this, "showHeaderTitle");
910  }
911 
915  public function addHeaderTitleObject(): void
916  {
917  $k = 1;
918  $this->showHeaderTitleObject(true, true);
919  }
920 
924  public function deleteHeaderTitlesObject(): void
925  {
926  $ilCtrl = $this->ctrl;
927  $lng = $this->lng;
928  $this->saveHeaderTitlesObject(true);
929  }
930 
931 
932  //
933  //
934  // Cron Jobs
935  //
936  //
937 
938  /*
939  * OLD GLOBAL CRON JOB SWITCHES (ilSetting)
940  *
941  * cron_user_check => obsolete
942  * cron_inactive_user_delete => obsolete
943  * cron_inactivated_user_delete => obsolete
944  * cron_link_check => obsolete
945  * cron_web_resource_check => migrated
946  * cron_lucene_index => obsolete
947  * forum_notification => migrated
948  * mail_notification => migrated
949  * crsgrp_ntf => migrated
950  * cron_upd_adrbook => migrated
951  */
952 
953  public function jumpToCronJobsObject(): void
954  {
955  // #13010 - this is used for external settings
956  $this->ctrl->redirectByClass("ilCronManagerGUI", "render");
957  }
958 
959 
960  //
961  //
962  // Contact Information
963  //
964  //
965 
969  public function showContactInformationObject(): void
970  {
971  $tpl = $this->tpl;
972 
974  $this->setGeneralSettingsSubTabs("contact_data");
975  $tpl->setContent($this->form->getHTML());
976  }
977 
981  public function initContactInformationForm(): void
982  {
983  $lng = $this->lng;
985 
986  $this->form = new ilPropertyFormGUI();
987 
988  // first name
989  $ti = new ilTextInputGUI($this->lng->txt("firstname"), "admin_firstname");
990  $ti->setMaxLength(64);
991  $ti->setSize(40);
992  $ti->setRequired(true);
993  $ti->setValue($ilSetting->get("admin_firstname"));
994  $this->form->addItem($ti);
995 
996  // last name
997  $ti = new ilTextInputGUI($this->lng->txt("lastname"), "admin_lastname");
998  $ti->setMaxLength(64);
999  $ti->setSize(40);
1000  $ti->setRequired(true);
1001  $ti->setValue($ilSetting->get("admin_lastname"));
1002  $this->form->addItem($ti);
1003 
1004  // title
1005  $ti = new ilTextInputGUI($this->lng->txt("title"), "admin_title");
1006  $ti->setMaxLength(64);
1007  $ti->setSize(40);
1008  $ti->setValue($ilSetting->get("admin_title"));
1009  $this->form->addItem($ti);
1010 
1011  // position
1012  $ti = new ilTextInputGUI($this->lng->txt("position"), "admin_position");
1013  $ti->setMaxLength(64);
1014  $ti->setSize(40);
1015  $ti->setValue($ilSetting->get("admin_position"));
1016  $this->form->addItem($ti);
1017 
1018  // institution
1019  $ti = new ilTextInputGUI($this->lng->txt("institution"), "admin_institution");
1020  $ti->setMaxLength(200);
1021  $ti->setSize(40);
1022  $ti->setValue($ilSetting->get("admin_institution"));
1023  $this->form->addItem($ti);
1024 
1025  // street
1026  $ti = new ilTextInputGUI($this->lng->txt("street"), "admin_street");
1027  $ti->setMaxLength(64);
1028  $ti->setSize(40);
1029  //$ti->setRequired(true);
1030  $ti->setValue($ilSetting->get("admin_street"));
1031  $this->form->addItem($ti);
1032 
1033  // zip code
1034  $ti = new ilTextInputGUI($this->lng->txt("zipcode"), "admin_zipcode");
1035  $ti->setMaxLength(10);
1036  $ti->setSize(5);
1037  //$ti->setRequired(true);
1038  $ti->setValue($ilSetting->get("admin_zipcode"));
1039  $this->form->addItem($ti);
1040 
1041  // city
1042  $ti = new ilTextInputGUI($this->lng->txt("city"), "admin_city");
1043  $ti->setMaxLength(64);
1044  $ti->setSize(40);
1045  //$ti->setRequired(true);
1046  $ti->setValue($ilSetting->get("admin_city"));
1047  $this->form->addItem($ti);
1048 
1049  // country
1050  $ti = new ilTextInputGUI($this->lng->txt("country"), "admin_country");
1051  $ti->setMaxLength(64);
1052  $ti->setSize(40);
1053  //$ti->setRequired(true);
1054  $ti->setValue($ilSetting->get("admin_country"));
1055  $this->form->addItem($ti);
1056 
1057  // phone
1058  $ti = new ilTextInputGUI($this->lng->txt("phone"), "admin_phone");
1059  $ti->setMaxLength(64);
1060  $ti->setSize(40);
1061  //$ti->setRequired(true);
1062  $ti->setValue($ilSetting->get("admin_phone"));
1063  $this->form->addItem($ti);
1064 
1065  // email
1066  $ti = new ilEMailInputGUI($this->lng->txt("email"), "admin_email");
1067  $ti->setMaxLength(64);
1068  $ti->setSize(40);
1069  $ti->setRequired(true);
1070  $ti->allowRFC822(true);
1071  $ti->setValue($ilSetting->get("admin_email"));
1072  $this->form->addItem($ti);
1073 
1074  // System support contacts
1075  $ti = new ilTextInputGUI($this->lng->txt("adm_support_contacts"), "adm_support_contacts");
1076  $ti->setMaxLength(500);
1077  $ti->setValue(ilSystemSupportContacts::getList());
1078  //$ti->setSize();
1079  $ti->setInfo($this->lng->txt("adm_support_contacts_info"));
1080  $this->form->addItem($ti);
1081 
1082  // Accessibility support contacts
1083  $ti = new ilTextInputGUI($this->lng->txt("adm_accessibility_contacts"), "accessibility_support_contacts");
1084  $ti->setMaxLength(500);
1085  $ti->setValue(ilAccessibilitySupportContacts::getList());
1086  //$ti->setSize();
1087  $ti->setInfo($this->lng->txt("adm_accessibility_contacts_info"));
1088  $this->form->addItem($ti);
1089 
1090  $this->form->addCommandButton("saveContactInformation", $lng->txt("save"));
1091 
1092  $this->form->setTitle($lng->txt("contact_data"));
1093  $this->form->setFormAction($this->ctrl->getFormAction($this));
1094  }
1095 
1100  public function saveContactInformationObject(): void
1101  {
1102  $tpl = $this->tpl;
1103  $lng = $this->lng;
1104  $ilCtrl = $this->ctrl;
1106  $rbacsystem = $this->rbacsystem;
1107  $ilErr = $this->error;
1108 
1109  if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
1110  $this->tpl->setOnScreenMessage("failure", $this->lng->txt("permission_denied"), true);
1111  $this->ctrl->redirectByClass(self::class, "showContactInformation");
1112  }
1113 
1114  $this->initContactInformationForm();
1115  if ($this->form->checkInput()) {
1116  $fs = array("admin_firstname", "admin_lastname", "admin_title", "admin_position",
1117  "admin_institution", "admin_street", "admin_zipcode", "admin_city",
1118  "admin_country", "admin_phone", "admin_email");
1119  foreach ($fs as $f) {
1120  $ilSetting->set($f, $_POST[$f]);
1121  }
1122 
1123  // System support contacts
1124  ilSystemSupportContacts::setList($_POST["adm_support_contacts"]);
1125 
1126  // Accessibility support contacts
1127  ilAccessibilitySupportContacts::setList($_POST["accessibility_support_contacts"]);
1128 
1129  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1130  $ilCtrl->redirect($this, "showContactInformation");
1131  } else {
1132  $this->setGeneralSettingsSubTabs("contact_data");
1133  $this->form->setValuesByPost();
1134  $tpl->setContent($this->form->getHtml());
1135  }
1136  }
1137 
1138  //
1139  //
1140  // Java Server
1141  //
1142  //
1143 
1147  public function showJavaServerObject(): void
1148  {
1149  $tpl = $this->tpl;
1150 
1151  $tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.java_settings.html', 'components/ILIAS/SystemFolder');
1152 
1153  $GLOBALS['lng']->loadLanguageModule('search');
1154 
1155  $this->initJavaServerForm();
1156  $this->setServerInfoSubTabs("java_server");
1157  $tpl->setVariable('SETTINGS_TABLE', $this->form->getHTML());
1158  }
1159 
1164  public function createJavaServerIniObject(): void
1165  {
1166  $this->setGeneralSettingsSubTabs('java_server');
1167  $this->tpl->setContent($this->form->getHTML());
1168  }
1169 
1173  public function initJavaServerForm(): void
1174  {
1175  $lng = $this->lng;
1177 
1178  $this->form = new ilPropertyFormGUI();
1179  $this->form->setFormAction($this->ctrl->getFormAction($this, 'saveJavaServer'));
1180 
1181  // pdf fonts
1182  $pdf = new ilFormSectionHeaderGUI();
1183  $pdf->setTitle($this->lng->txt('rpc_pdf_generation'));
1184  $this->form->addItem($pdf);
1185 
1186  $pdf_font = new ilTextInputGUI($this->lng->txt('rpc_pdf_font'), 'rpc_pdf_font');
1187  $pdf_font->setInfo($this->lng->txt('rpc_pdf_font_info'));
1188  $pdf_font->setSize(64);
1189  $pdf_font->setMaxLength(1024);
1190  $pdf_font->setRequired(true);
1191  $pdf_font->setValue(
1192  $ilSetting->get('rpc_pdf_font', 'Helvetica, unifont')
1193  );
1194  $this->form->addItem($pdf_font);
1195 
1196  // save and cancel commands
1197  $this->form->addCommandButton("saveJavaServer", $lng->txt("save"));
1198  }
1199 
1204  public function saveJavaServerObject(): void
1205  {
1206  $tpl = $this->tpl;
1207  $lng = $this->lng;
1208  $ilCtrl = $this->ctrl;
1210  $rbacsystem = $this->rbacsystem;
1211  $ilErr = $this->error;
1212 
1213  if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
1214  $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
1215  }
1216 
1217  $this->initJavaServerForm();
1218  if ($this->form->checkInput()) {
1219  $ilSetting->set('rpc_pdf_font', ilUtil::stripSlashes($_POST['rpc_pdf_font']));
1220  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1221  $ilCtrl->redirect($this, "showJavaServer");
1222 
1223  // TODO check settings, ping server
1224  } else {
1225  $this->setGeneralSettingsSubTabs("java_server");
1226  $this->form->setValuesByPost();
1227  $tpl->setContent($this->form->getHtml());
1228  }
1229  }
1230 
1234  public static function _goto(): void
1235  {
1236  global $DIC;
1237  $main_tpl = $DIC->ui()->mainTemplate();
1238 
1239  $ilAccess = $DIC->access();
1240  $ilErr = $DIC["ilErr"];
1241  $lng = $DIC->language();
1242 
1243  $a_target = SYSTEM_FOLDER_ID;
1244 
1245  if ($ilAccess->checkAccess("read", "", $a_target)) {
1246  ilUtil::redirect("ilias.php?baseClass=ilAdministrationGUI");
1247  exit;
1248  } else {
1249  if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1250  $main_tpl->setOnScreenMessage('failure', sprintf(
1251  $lng->txt("msg_no_perm_read_item"),
1253  ), true);
1255  }
1256  }
1257  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1258  }
1259 
1263  protected function showVcsInformationObject(): void
1264  {
1265  $vcInfo = [];
1266  $rbacsystem = $this->rbacsystem;
1267  if ($rbacsystem->checkAccess("read", $this->object->getRefId())) {
1268  foreach ([new ilGitInformation()] as $vc) {
1269  $html = $vc->getInformationAsHtml();
1270  if ($html) {
1271  $vcInfo[] = $html;
1272  }
1273  }
1274 
1275  if ($vcInfo !== []) {
1276  $this->tpl->setOnScreenMessage('info', implode("<br />", $vcInfo));
1277  } else {
1278  $this->tpl->setOnScreenMessage('info', $this->lng->txt('vc_information_not_determined'));
1279  }
1280 
1281  $this->showServerInfoObject();
1282  }
1283  }
1284 }
saveJavaServerObject()
Save java server form.
switchBenchModuleObject()
save benchmark settings
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...
Class ilGitInformation.
const ROOT_FOLDER_ID
Definition: constants.php:32
saveBasicSettingsObject()
Save basic settings form.
prepareOutput(bool $show_sub_objects=true)
addBlockFile(string $var, string $block, string $template_name, ?string $in_module=null)
overwrites ITX::addBlockFile
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.
setContent(string $a_html)
Sets content for standard template.
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.
This class represents a email property in a property form.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
saveContactInformationObject()
Save contact information form.
const SYSTEM_FOLDER_ID
Definition: constants.php:35
$ilErr
Definition: raiseError.php:33
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
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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)
$GLOBALS["DIC"]
Definition: wac.php:53
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:26
Class ilObjectGUI Basic methods of all Output classes.
const CLIENT_ID
Definition: constants.php:41
global $DIC
Definition: shib_login.php:26
ilToolbarGUI $toolbar
TableGUI class for title/description translations.
saveHeaderTitlesObject(bool $delete=false)
Save header titles.
clearData()
delete all measurement data
addHeaderTitleObject()
Add a header title.
exit
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="")
initContactInformationForm()
Init contact information form.
global $ilSetting
Definition: privfeed.php:31
__construct(Container $dic, ilPlugin $plugin)
initServerInfoForm()
Init server info form.
ilAccessHandler $access
ilStyleDefinition acts as a wrapper of style related actions.
Class ilBenchmark.
ilCronManagerGUI: ilPropertyFormGUI ilCronManagerGUI: ilAdministrationGUI
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.
ilObjectDefinition $obj_definition
$r
static _lookupLogin(int $a_user_id)