Exemple #1
0
function transferCALL($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk)
{
    $padress_book = new paloAdressBook($pDB);
    $pACL = new paloACL($pDB_2);
    $id_user = $pACL->getIdUser($_SESSION["elastix_user"]);
    if ($id_user != FALSE) {
        $user = $pACL->getUsers($id_user);
        if ($user != FALSE) {
            $extension = $user[0][3];
            if ($extension != "") {
                $id = isset($_GET['id']) ? $_GET['id'] : (isset($_POST['id']) ? $_POST['id'] : "");
                $phone2tranfer = '';
                if (isset($_GET['type']) && $_GET['type'] == 'external') {
                    $contactData = $padress_book->contactData($id, $id_user, "external", false, null);
                    $phone2tranfer = $contactData['telefono'];
                } else {
                    $phone2tranfer = $id;
                }
                $result = $padress_book->Obtain_Protocol_from_Ext($dsnAsterisk, $extension);
                if ($result != FALSE) {
                    $result = $padress_book->TranferCall($dsn_agi_manager, $extension, $phone2tranfer, $result['dial'], $result['description']);
                    if (!$result) {
                        $smarty->assign("mb_title", $arrLang['ERROR'] . ":");
                        $smarty->assign("mb_message", $arrLang["The transfer couldn't be realized, maybe you don't have any conversation now."]);
                    }
                } else {
                    $smarty->assign("mb_title", $arrLang["Validation Error"]);
                    $smarty->assign("mb_message", $padress_book->errMsg);
                }
            }
        } else {
            $smarty->assign("mb_title", $arrLang["Validation Error"]);
            $smarty->assign("mb_message", $padress_book->errMsg);
        }
    } else {
        $smarty->assign("mb_title", $arrLang["Validation Error"]);
        $smarty->assign("mb_message", $padress_book->errMsg);
    }
    $content = report_adress_book($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk);
    return $content;
}
Exemple #2
0
function call2phone($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk)
{
    $padress_book = new paloAdressBook($pDB);
    //echo '<pre>'.print_r($_SESSION,1).'</pre>';die;
    $extension = $_SESSION['callcenter']['agente'];
    $name = $_SESSION['callcenter']['agente_nombre'];
    if ($extension != "") {
        $id = isset($_GET['id']) ? $_GET['id'] : (isset($_POST['id']) ? $_POST['id'] : "");
        $prefix = prefixNumber($id);
        $phone2call = $prefix . $id;
        $result = $padress_book->Call2Phone($dsn_agi_manager, $extension, $phone2call, $extension, $name);
        if (!$result) {
            $smarty->assign("mb_title", "Lỗi: ");
            $smarty->assign("mb_message", "Không nhận diện được số điện thoại!");
        } else {
            $smarty->assign("mb_title", "Gọi thành công: ");
            $smarty->assign("mb_message", "Số điện thoại " . $id);
        }
    } else {
        $smarty->assign("mb_title", "Lỗi: ");
        $smarty->assign("mb_message", "Phải đăng nhập màn hình chính để lấy thông tin máy nhánh!");
    }
    $content = report_adress_book($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk);
    return $content;
}
Exemple #3
0
function show_html_phonebook($sDirLocalPlantillas)
{
    return report_adress_book($sDirLocalPlantillas);
}
function _moduleContent(&$smarty, $module_name)
{
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    include_once "modules/{$module_name}/libs/paloSantoCalendar.class.php";
    //    include_once "modules/$module_name/libs/JSON.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 "save_new":
            $content = saveEvent($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang);
            break;
        case "edit":
            $content = viewForm_NewEvent($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang);
            break;
        case "delete":
            $content = deleteEvent($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang);
            break;
        case "save_edit":
            $content = saveEvent($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang);
            break;
        case "get_lang":
            $content = getLanguages($arrLangModule, $arrConf);
            break;
        case "get_data":
            $content = getDataCalendar($arrLang, $pDB, $module_name, $arrConf);
            break;
        case "get_num_ext":
            $content = getNumExtesion($arrConf, $pDB, $arrLang);
            break;
        case "setData":
            $content = setDataCalendar($arrLang, $pDB, $arrConf);
            break;
        case "view_box":
            $content = viewBoxCalendar($arrConf, $arrLang, $pDB, $local_templates_dir, $smarty, $module_name);
            break;
        case "new_box":
            $content = newBoxCalendar($arrConf, $arrLang, $pDB, $local_templates_dir, $smarty, $module_name);
            break;
        case "delete_box":
            $content = deleteBoxCalendar($arrConf, $arrLang, $pDB, $module_name);
            break;
        case "download_icals":
            $content = download_icals($arrLang, $pDB, $module_name, $arrConf);
            break;
        case "get_contacts2":
            $content = getContactEmails2($arrConf);
            break;
        case "getTextToSpeach":
            $content = getTextToSpeach($arrLang, $pDB);
            break;
        case "display":
            $content = viewCalendarById($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang);
            break;
        case "phone_numbers":
            // Include language file for EN, then for local, and merge the two.
            $arrLangModule = NULL;
            include_once "modules/address_book/lang/en.lang";
            $lang_file = "modules/address_book/lang/{$lang}.lang";
            if (file_exists("{$base_dir}/{$lang_file}")) {
                $arrLanEN = $arrLangModule;
                include_once $lang_file;
                $arrLangModule = array_merge($arrLanEN, $arrLangModule);
            }
            $arrLang = array_merge($arrLang, $arrLangModule);
            //solo para obtener los devices (extensiones) creadas.
            $dsnAsterisk = generarDSNSistema('asteriskuser', 'asterisk');
            $pDB_addressbook = new paloDB($arrConf['dsn_conn_database3']);
            $pDB_acl = new paloDB($arrConf['dsn_conn_database1']);
            $html = report_adress_book($smarty, $module_name, $local_templates_dir, $pDB_addressbook, $pDB_acl, $arrLang, $dsnAsterisk);
            $smarty->assign("CONTENT", $html);
            $smarty->assign("THEMENAME", $arrConf['mainTheme']);
            $smarty->assign("path", "");
            $content = $smarty->display("{$local_templates_dir}/address_book_list.tpl");
            break;
        default:
            // view_form
            $content = viewCalendar($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang);
            break;
    }
    return $content;
}