Exemple #1
0
function _moduleContent(&$smarty, $module_name)
{
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    include_once "modules/{$module_name}/libs/paloSantoEmaillist.class.php";
    //include file language agree to elastix configuration
    //if file language not exists, then include language by default (en)
    $lang = get_language();
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    $lang_file = "modules/{$module_name}/lang/{$lang}.lang";
    if (file_exists("{$base_dir}/{$lang_file}")) {
        include_once "{$lang_file}";
    } else {
        include_once "modules/{$module_name}/lang/en.lang";
    }
    //global variables
    global $arrConf;
    global $arrConfModule;
    global $arrLang;
    global $arrLangModule;
    $arrConf = array_merge($arrConf, $arrConfModule);
    $arrLang = array_merge($arrLang, $arrLangModule);
    //folder path for custom templates
    $templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes';
    $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
    //conexion resource
    $pDB = new paloDB($arrConf['dsn_conn_database']);
    //actions
    $action = getAction();
    $content = "";
    switch ($action) {
        case "new_emaillist":
            $content = viewFormEmaillist($smarty, $module_name, $local_templates_dir, $pDB, $arrConf);
            break;
        case "save_newList":
            $content = saveNewList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf);
            break;
        case "new_memberlist":
        case "remove_memberlist":
            $content = viewFormMemberList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf);
            break;
        case "save_newMember":
        case "save_removeMember":
            $content = saveNewMember($smarty, $module_name, $local_templates_dir, $pDB, $arrConf);
            break;
        case "delete":
            $content = deleteEmailList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf);
            break;
        case "view_memberlist":
            $content = viewMemberList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf);
            break;
        case "export":
            $content = exportMembers($smarty, $module_name, $local_templates_dir, $pDB, $arrConf);
            break;
        default:
            $content = reportEmailList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf);
            break;
    }
    return $content;
}
function _moduleContent(&$smarty, $module_name)
{
    global $arrConf;
    //folder path for custom templates
    $local_templates_dir = getWebDirModule($module_name);
    //conexion resource
    $pDB = new paloDB($arrConf['elastix_dsn']["elastix"]);
    //user credentials
    global $arrCredentials;
    //actions
    $action = getAction();
    $content = "";
    switch ($action) {
        case "view_list":
            $content = viewFormEmaillist($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "new_emaillist":
            $content = viewFormEmaillist($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "save_newList":
            $content = saveNewList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "mailman_settings":
            $content = viewFormEmaillist($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "saveMailmanSettings":
            $content = saveMailmanSettings($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "delete":
            $content = deleteEmailList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "export":
            $content = exportMembers($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "view_memberlist":
            $content = reportMemberList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "new_memberlist":
            $content = viewFormMemberList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "save_newMember":
            $content = saveNewMember($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "remove_memberlist":
            $content = removeMemberList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        default:
            $content = reportEmailList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
    }
    return $content;
}