\n"; printJsIncludes('../..'); printConfigurationPageHeaderBar($conf); // print error messages foreach ($errorsToDisplay as $errorToDisplay) { call_user_func_array(StatusMessage(...), $errorToDisplay); } echo "
\n"; printConfigurationPageTabs(ConfigurationPageTab::MODULE_SETTINGS); ?> getConfiguredTypes(); // get the list of module scopes $scopes = []; foreach ($types as $type) { $moduleNames = $conf->get_AccountModules($type->getId()); foreach ($moduleNames as $moduleName) { $scopes[$moduleName][] = $type->getId(); } } // get module options $options = getConfigOptions($scopes); // get current setting $old_options = $conf->get_moduleSettings(); // display module boxes $moduleNames = array_keys($options); $_SESSION['conf_types'] = []; foreach ($moduleNames as $moduleName) { if (empty($options[$moduleName])) { continue; } $module = moduleCache::getModule($moduleName, null); if ($module === null) { continue; } $iconImage = $module->getIcon(); if (($iconImage != null) && !(str_starts_with($iconImage, 'http')) && !(str_starts_with($iconImage, '/'))) { $iconImage = '../../graphics/' . $iconImage; } $row = new htmlResponsiveRow(); $row->add(new htmlSubTitle($module->get_alias(), $iconImage, null, true)); if (is_array($options[$moduleName])) { foreach ($options[$moduleName] as $option) { $row->add($option); } } else { $row->add($options[$moduleName]); } $configTypes = parseHtml($moduleName, $row, $old_options, false, null); $_SESSION['conf_types'] = array_merge($configTypes, $_SESSION['conf_types']); echo "
"; } echo "\n"; echo ""; $buttonContainer = new htmlTable(); $buttonContainer->addElement(new htmlSpacer(null, '10px'), true); $saveButton = new htmlButton('saveSettings', _('Save')); $saveButton->setCSSClasses(['lam-primary']); $buttonContainer->addElement($saveButton); $cancelButton = new htmlButton('cancelSettings', _('Cancel')); $buttonContainer->addElement($cancelButton, true); $buttonContainer->addElement(new htmlSpacer(null, '10px'), true); if (empty($errorsToDisplay) && isset($_POST['scrollPositionTop']) && get_preg($_POST['scrollPositionTop'], 'digit') && isset($_POST['scrollPositionLeft']) && get_preg($_POST['scrollPositionLeft'], 'digit')) { // scroll to last position $buttonContainer->addElement(new htmlJavaScript('window.lam.utility.restoreScrollPosition(' . $_POST['scrollPositionTop'] . ', ' . $_POST['scrollPositionLeft'] . ')')); } parseHtml(null, $buttonContainer, [], false, null); echo "
\n"; echo "\n"; echo "\n"; /** * Checks user input and saves the entered settings. * * @return array list of errors */ function checkInput(): array { if (!isset($_POST['postAvailable'])) { return []; } $conf = &$_SESSION['conf_config']; if (!($conf instanceof LAMConfig)) { return []; } $typeManager = new TypeManager($conf); $types = $typeManager->getConfiguredTypes(); // check module options // create the option array to check and save $options = extractConfigOptionsFromPOST($_SESSION['conf_types']); // get the list of the modules' scopes $scopes = []; foreach ($types as $type) { $moduleNames = $conf->get_AccountModules($type->getId()); foreach ($moduleNames as $moduleName) { $scopes[$moduleName][] = $type->getId(); } } // check options $errors = checkConfigOptions($scopes, $options); $conf->set_moduleSettings($options); return $errors; }