function saveThemes($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $uid) { $oThemes = new PaloSantoThemes($pDB); $arr_themes = $oThemes->getThemes("/var/www/html/admin/web/themes/"); $formThemes = createFieldForm($arr_themes); $oForm = new paloForm($smarty, $formThemes); $exito = $oThemes->updateTheme($_POST['themes'], $uid); if ($exito) { if ($oThemes->smartyRefresh($_SERVER['DOCUMENT_ROOT'])) { header("Location: index.php?menu=themes_system"); die; } else { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("The smarty cache could not be deleted")); } } else { $smarty->assign("mb_title", _tr("Validation Error")); $smarty->assign("mb_message", $oThemes->errMsg); } return formThemes($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $uid); }
function updateTheme($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm) { if (!$oForm->validateForm($_POST)) { $smarty->assign("mb_title", _tr("Validation Error")); $arrErrores = $oForm->arrErroresValidacion; $strErrorMsg = "<b>" . _tr('The following fields contain errors') . ":</b><br/>"; if (is_array($arrErrores) && count($arrErrores) > 0) { foreach ($arrErrores as $k => $v) { $strErrorMsg .= "{$k}, "; } } $strErrorMsg .= ""; $smarty->assign("mb_message", $strErrorMsg); } else { $oThemes = new PaloSantoThemes($pDB); $exito = $oThemes->updateTheme($_POST['themes']); if ($exito) { if ($oThemes->smartyRefresh($_SERVER['DOCUMENT_ROOT'])) { header("Location: ?menu={$module_name}"); die; } else { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("The smarty cache could not be deleted")); } } else { $smarty->assign("mb_title", _tr("Validation Error")); $smarty->assign("mb_message", $oThemes->errMsg); } } $smarty->assign("icon", "modules/{$module_name}/images/system_preferences_themes.png"); $contenidoModulo = $oForm->fetchForm("{$local_templates_dir}/new.tpl", _tr("Change Theme"), $_POST); return $contenidoModulo; }