Ejemplo n.º 1
0
function reportListadodebases($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf)
{
    $pListadodebases = new paloSantoClientesManuales($pDB);
    $filter_field = getParameter("filter_field");
    $filter_value = getParameter("filter_value");
    //begin grid parameters
    $oGrid = new paloSantoGrid($smarty);
    $oGrid->setTitle(_tr("Clientes manuales"));
    $oGrid->pagingShow(true);
    // show paging section.
    $oGrid->enableExport();
    // enable export.
    $oGrid->setNameFile_Export(_tr("Clientes manuales"));
    $url = array("menu" => $module_name, "filter_field" => $filter_field, "filter_value" => $filter_value);
    $oGrid->setURL($url);
    $arrColumns = array(_tr("CI"), _tr("Nombre"), _tr("Apellido"), _tr("Provincia"), _tr("Ciudad"), _tr("Nacimiento"), _tr("Correo personal"), _tr("Correo trabajo"), _tr("Estado civil"), _tr("Origen"), _tr("Acción"));
    $oGrid->setColumns($arrColumns);
    $total = $pListadodebases->getNumListadodebases($filter_field, $filter_value);
    $arrData = null;
    if ($oGrid->isExportAction()) {
        $limit = $total;
        // max number of rows.
        $offset = 0;
        // since the start.
    } else {
        //$limit  = 20;
        $limit = 200;
        $oGrid->setLimit($limit);
        $oGrid->setTotal($total);
        $offset = $oGrid->calculateOffset();
    }
    $arrResult = $pListadodebases->getListadodebases($limit, $offset, $filter_field, $filter_value);
    if (is_array($arrResult) && $total > 0) {
        foreach ($arrResult as $key => $value) {
            $arrTmp[0] = $value['ci'];
            $arrTmp[1] = $value['nombre'];
            $arrTmp[2] = $value['apellido'];
            $arrTmp[3] = $value['provincia'];
            $arrTmp[4] = $value['ciudad'];
            $arrTmp[5] = $value['nacimiento'];
            $arrTmp[6] = $value['correo_personal'];
            $arrTmp[7] = $value['correo_trabajo'];
            $arrTmp[8] = $value['estado_civil'];
            $arrTmp[9] = $value['origen'];
            $arrTmp[10] = "<a href=index.php?menu={$module_name}&action=agregar&ci={$value['ci']}>Agregar a campaña</a><br><a href='?menu=hispana_clientes_datosbasicos&ci=" . $value['ci'] . "'>Editar</a>";
            $arrData[] = $arrTmp;
        }
    }
    $oGrid->setData($arrData);
    //begin section filter
    $oFilterForm = new paloForm($smarty, createFieldFilter());
    $smarty->assign("SHOW", _tr("Show"));
    $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
    //end section filter
    $oGrid->showFilter(trim($htmlFilter));
    $content = $oGrid->fetchGrid();
    //end grid parameters
    return $content;
}
Ejemplo n.º 2
0
<?php

include_once "/var/www/html/libs/paloSantoDB.class.php";
include_once "/var/www/html/modules/hispana_clientes_manuales/configs/default.conf.php";
include_once "/var/www/html/modules/hispana_clientes_manuales/libs/paloSantoClientesManuales.class.php";
/* Just for test
$_POST['action'] = 'mostrarAgentes';
$_POST['clase'] = 1;*/
if (isset($_POST['action'])) {
    $pDB = new paloDB($arrConfModule['dsn_conn_database']);
    $pClientes = new paloSantoClientesManuales($pDB);
    switch ($_POST['action']) {
        case 'mostrarAgentes':
            if (!isset($_POST['clase']) || empty($_POST['clase'])) {
                $content = "<option value=0>Seleccione una campaña</option>";
                break;
            }
            $arrOptions = $pClientes->getAgentesCampania($_POST['clase']);
            if (sizeof($arrOptions) > 0) {
                $content = crearOption($arrOptions);
            } else {
                $content = "";
            }
            break;
        default:
            $content = 'vacio';
            break;
    }
    echo $content;
    return $content;
}