Esempio n. 1
0
function _moduleContent(&$smarty, $module_name)
{
    //global variables
    global $arrConf;
    //conexion resource
    $pConfig = new paloConfig("/etc", "amportal.conf", "=", "[[:space:]]*=[[:space:]]*");
    $arrConfig = $pConfig->leer_configuracion(false);
    $dsnAsteriskCdr = $arrConfig['AMPDBENGINE']['valor'] . "://" . $arrConfig['AMPDBUSER']['valor'] . ":" . $arrConfig['AMPDBPASS']['valor'] . "@" . $arrConfig['AMPDBHOST']['valor'] . "/asteriskcdrdb";
    $pDB_cdr = new paloDB($dsnAsteriskCdr);
    //asteriskcdrdb -> CDR
    $pDB_billing = new paloDB("sqlite3:///{$arrConf['elastix_dbdir']}/rate.db");
    //sqlite3 -> rate.db
    //actions
    $accion = getAction();
    $content = "";
    switch ($accion) {
        case 'graph':
            $content = graphLinks($smarty, $module_name, $local_templates_dir);
            break;
        case 'imageTop10Salientes':
        case 'imageTop10Entrantes':
            // The following outputs image data directly and depends on rawmode=yes
            executeImage($module_name, $accion);
            $content = '';
            break;
        default:
            $content = reportReportCall($smarty, $module_name, $local_templates_dir, $pDB_cdr, $pDB_billing, $arrConf, $arrLang);
            break;
    }
    return $content;
}
Esempio n. 2
0
function _moduleContent(&$smarty, $module_name)
{
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    include_once "modules/{$module_name}/libs/paloSantoReportCall.class.php";
    include_once "libs/paloSantoConfig.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
    $pConfig = new paloConfig("/etc", "amportal.conf", "=", "[[:space:]]*=[[:space:]]*");
    $arrConfig = $pConfig->leer_configuracion(false);
    $dsnAsteriskCdr = $arrConfig['AMPDBENGINE']['valor'] . "://" . $arrConfig['AMPDBUSER']['valor'] . ":" . $arrConfig['AMPDBPASS']['valor'] . "@" . $arrConfig['AMPDBHOST']['valor'] . "/asteriskcdrdb";
    $pDB_cdr = new paloDB($dsnAsteriskCdr);
    //asteriskcdrdb -> CDR
    $pDB_billing = new paloDB("sqlite3:///{$arrConf['elastix_dbdir']}/rate.db");
    //sqlite3 -> rate.db
    //actions
    $accion = getAction();
    $content = "";
    switch ($accion) {
        case 'graph':
            $content = graphLinks($smarty, $module_name, $local_templates_dir);
            break;
        case 'imageTop10Salientes':
        case 'imageTop10Entrantes':
            // The following outputs image data directly and depends on rawmode=yes
            executeImage($module_name, $accion);
            $content = '';
            break;
        default:
            $content = reportReportCall($smarty, $module_name, $local_templates_dir, $pDB_cdr, $pDB_billing, $arrConf, $arrLang);
            break;
    }
    return $content;
}