function _moduleContent(&$smarty, $module_name) { //include module files include_once "modules/{$module_name}/configs/default.conf.php"; require_once "modules/{$module_name}/libs/PaloSantoThemes.class.php"; load_language_module($module_name); //global variables global $arrConf; global $arrConfModule; $arrConf = array_merge($arrConf, $arrConfModule); //folder path for custom templates $base_dir = dirname($_SERVER['SCRIPT_FILENAME']); $templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes'; $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme']; // se conecta a la base $pDB = new paloDB($arrConf['elastix_dsn']['settings']); if (!empty($pDB->errMsg)) { $smarty->assign("mb_message", _tr("Error when connecting to database") . "<br/>" . $pDB->errMsg); } // Definición del formulario de nueva campaña $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("CHANGE", _tr("Save")); $smarty->assign("icon", "modules/{$module_name}/images/system_preferences_themes.png"); $oThemes = new PaloSantoThemes($pDB); $arr_themes = $oThemes->getThemes("{$base_dir}/themes/"); $formCampos = array('themes' => array("LABEL" => _tr("Themes"), "REQUIRED" => "yes", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arr_themes, "VALIDATION_TYPE" => "", "VALIDATION_EXTRA_PARAM" => "")); $oForm = new paloForm($smarty, $formCampos); if (isset($_POST['changeTheme'])) { $contenidoModulo = updateTheme($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm); } else { $contenidoModulo = changeTheme($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm); } return $contenidoModulo; }
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); }