Exemplo n.º 1
0
function _moduleContent(&$smarty, $module_name)
{
    load_language_module($module_name);
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    include_once "modules/agent_console/configs/default.conf.php";
    // For asterisk AMI credentials
    global $arrConf;
    global $arrConfig;
    //folder path for custom templates
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    $templates_dir = isset($arrConfig['templates_dir']) ? $arrConfig['templates_dir'] : 'themes';
    $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
    $relative_dir_rich_text = "modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
    $smarty->assign("relative_dir_rich_text", $relative_dir_rich_text);
    // Conexión a la base de datos CallCenter y Asterisk (se utiliza root para pruebas)
    $pDB = new paloDB($cadena_dsn);
    // $cadena_dsn está ubicado en configs/default.conf.php
    if ($pDB->connStatus) {
        return "ERR: failed to connect to database: " . $pDB->errMsg;
    }
    // Mostrar pantalla correspondiente
    $contenidoModulo = '';
    $sAction = 'list_agents';
    if (isset($_REQUEST['action'])) {
        $sAction = $_REQUEST['action'];
    }
    switch ($sAction) {
        case 'new_agent':
            $contenidoModulo = newAgent($pDB, $smarty, $module_name, $local_templates_dir);
            break;
        case 'edit_agent':
            $contenidoModulo = editAgent($pDB, $smarty, $module_name, $local_templates_dir);
            break;
        case 'isAdministrator':
            $contenidoModulo = isAdministrator();
            break;
        case 'existingQueue':
            $contenidoModulo = existingQueue($pDB);
            break;
        case 'list_agents':
        default:
            $contenidoModulo = listAgent($pDB, $smarty, $module_name, $local_templates_dir);
            break;
    }
    return $contenidoModulo;
}
Exemplo n.º 2
0
function _moduleContent(&$smarty, $module_name)
{
    load_language_module($module_name);
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    include_once "modules/agent_console/configs/default.conf.php";
    // For asterisk AMI credentials
    global $arrConf;
    global $arrConfig;
    //folder path for custom templates
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    $templates_dir = isset($arrConfig['templates_dir']) ? $arrConfig['templates_dir'] : 'themes';
    $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
    $relative_dir_rich_text = "modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
    $smarty->assign("relative_dir_rich_text", $relative_dir_rich_text);
    // Conexión a la base de datos CallCenter
    $pDB = new paloDB($arrConf['cadena_dsn']);
    // Mostrar pantalla correspondiente
    $contenidoModulo = '';
    $sAction = 'list_agents';
    if (isset($_GET['action'])) {
        $sAction = $_GET['action'];
    }
    switch ($sAction) {
        case 'new_agent':
            $contenidoModulo = newAgent($pDB, $smarty, $module_name, $local_templates_dir);
            break;
        case 'edit_agent':
            $contenidoModulo = editAgent($pDB, $smarty, $module_name, $local_templates_dir);
            break;
        case 'list_agents':
        default:
            $contenidoModulo = listAgent($pDB, $smarty, $module_name, $local_templates_dir);
            break;
    }
    return $contenidoModulo;
}
Exemplo n.º 3
0
function createAgent()
{
    $result = "";
    $am = new AgentManager();
    if ($am->isAgentEditor()) {
        $toSave = new Agent();
        if ($toSave != null) {
            $result = editAgent($toSave);
        } else {
            $result = "Error in creating agent record.";
        }
    } else {
        $result = "You aren't authorized to edit agent records.";
    }
    return $result;
}
Exemplo n.º 4
0
 function updateDisplayName($agent)
 {
     if (!RequestContext::value('display_name')) {
         print "If you want to update the display name you'll need to enter a new one!";
         editAgent($agent);
         return false;
     }
     if ($agent->updateDisplayName(RequestContext::value('display_name'))) {
         print "Display name changed to " . $agent->getDisplayName();
     } else {
         print "Failed to change display name.";
     }
     editAgent($agent);
     return;
 }