예제 #1
0
function reportListadodecampañas($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf)
{
    $pListadodecampañas = new paloSantoListadodecampañas($pDB);
    $filter_field = getParameter("filter_field");
    $filter_value = getParameter("filter_value");
    //begin grid parameters
    $oGrid = new paloSantoGrid($smarty);
    $oGrid->setTitle(_tr("Listado de campañas"));
    $oGrid->pagingShow(true);
    // show paging section.
    $oGrid->enableExport();
    // enable export.
    $oGrid->setNameFile_Export(_tr("Listado de campañas"));
    $url = array("menu" => $module_name, "filter_field" => $filter_field, "filter_value" => $filter_value);
    $oGrid->setURL($url);
    $arrColumns = array(_tr("Nombre"), _tr("Fecha Inicial"), _tr("Fecha Final"), _tr("Form"), _tr("# de Bases"), _tr("# de Agentes"), _tr("Tipo"), _tr("Acción"));
    $oGrid->setColumns($arrColumns);
    $total = $pListadodecampañas->getNumListadodecampañas($filter_field, $filter_value);
    $arrData = null;
    if ($oGrid->isExportAction()) {
        $limit = $total;
        // max number of rows.
        $offset = 0;
        // since the start.
    } else {
        $limit = 20;
        $oGrid->setLimit($limit);
        $oGrid->setTotal($total);
        $offset = $oGrid->calculateOffset();
    }
    $arrResult = $pListadodecampañas->getListadodecampañas($limit, $offset, $filter_field, $filter_value);
    if (is_array($arrResult) && $total > 0) {
        foreach ($arrResult as $key => $value) {
            $arrBasesAgentes = $pListadodecampañas->getBasesAgentes($value['id']);
            $arrTmp[0] = $value['nombre'];
            $arrTmp[1] = $value['fecha_inicio'];
            $arrTmp[2] = $value['fecha_fin'];
            $arrTmp[3] = $value['form'];
            $arrTmp[4] = $arrBasesAgentes['bases'];
            $arrTmp[5] = $arrBasesAgentes['agentes'];
            $arrTmp[6] = $value['tipo'];
            if ($value['tipo'] == "RECARGABLE") {
                $arrTmp[7] = "<a href=index.php?menu=hispana_campania_recargable&action=view_edit&id=" . $value['id'] . ">Editar</a>";
            } else {
                $arrTmp[7] = "<a href=index.php?menu=hispana_crear_campania&action=view_edit&id=" . $value['id'] . ">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;
}
예제 #2
0
function activarInactivar($id, $action, $pDB)
{
    $pListadodecampañas = new paloSantoListadodecampañas($pDB);
    return $pListadodecampañas->activarInactivarRecarga($id, $action);
}