当前位置: 首页>>代码示例>>PHP>>正文


PHP paloSantoGrid::calculatePagination方法代码示例

本文整理汇总了PHP中paloSantoGrid::calculatePagination方法的典型用法代码示例。如果您正苦于以下问题:PHP paloSantoGrid::calculatePagination方法的具体用法?PHP paloSantoGrid::calculatePagination怎么用?PHP paloSantoGrid::calculatePagination使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在paloSantoGrid的用法示例。


在下文中一共展示了paloSantoGrid::calculatePagination方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: reportDhcpClientlist

function reportDhcpClientlist($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf)
{
    $pDhcpClientlist = new paloSantoDhcpClienList($pDB);
    $filter_field = "";
    $filter_value = "";
    $action = getParameter("nav");
    $start = getParameter("start");
    //begin grid parameters
    $oGrid = new paloSantoGrid($smarty);
    $limit = 20;
    $arrResult = $pDhcpClientlist->getDhcpClientList();
    $total = count($arrResult);
    $oGrid->setLimit($limit);
    $oGrid->setTotal($total);
    $oGrid->calculatePagination($action, $start);
    $offset = $oGrid->getOffsetValue();
    $end = $oGrid->getEnd();
    $url = "?menu={$module_name}";
    $arrData = null;
    if (is_array($arrResult) && count($arrResult) > 0) {
        for ($i = 1; $i <= $total; $i++) {
            //$arrTmp[0]  = "<input type='checkbox' name='DhcpListID_$i'  />";
            //          $arrTmp[1] = "<a href='?menu=$module_name&action=show&id=".$id."'>".$arrResult[$id]['iphost']."</a>";
            $arrTmp[0] = "" . $arrResult[$i]['iphost'];
            $arrTmp[1] = "" . $arrResult[$i]['macaddress'];
            $arrTmp[2] = "<a href='?menu={$module_name}&action=see_dhcpclient&id=" . $i . "'>" . _tr("View Details") . "</a>";
            $arrData[] = $arrTmp;
        }
    }
    $buttonDelete = "<input type='submit' name='delete_dhcpclient' value='" . _tr("Delete") . "' class='button' onclick=\" return confirmSubmit('" . _tr("Are you sure you wish to delete the Ip.") . "');\" />";
    $arrGrid = array("title" => _tr("DHCP Client List"), "icon" => "web/apps/{$module_name}/images/system_network_dhcp_client_list.png", "width" => "99%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total, "url" => $url, "columns" => array(0 => array("name" => _tr("IP Address"), "property1" => ""), 1 => array("name" => _tr("MAC Address"), "property1" => ""), 2 => array("name" => _tr("Action"), "property1" => "")));
    //begin section filter
    // $arrFormFilterDhcplist = createFieldFilter();
    // $oFilterForm = new paloForm($smarty, $arrFormFilterDhcplist);
    //     $smarty->assign("SHOW", _tr("Show"));
    $smarty->assign("NEW_DHCPCLIENT", _tr("New Dhcp client"));
    //  $htmlFilter = $oFilterForm->fetchForm("$local_templates_dir/filter.tpl","",$_POST);
    //end section filter
    //  $oGrid->showFilter(trim($htmlFilter));
    $contenidoModulo = $oGrid->fetchGrid($arrGrid, $arrData);
    if (strpos($contenidoModulo, '<form') === FALSE) {
        $contenidoModulo = "<form  method='POST' style='margin-bottom:0;' action={$url}>{$contenidoModulo}</form>";
    }
    //end grid parameters
    return $contenidoModulo;
}
开发者ID:netconstructor,项目名称:elastix-mt-gui,代码行数:46,代码来源:index.php

示例2: reportReportCall

function reportReportCall($smarty, $module_name, $local_templates_dir, &$pDB_cdr, &$pDB_billing, $arrConf, $arrLang)
{
    $pReportCall = new paloSantoReportCall($pDB_cdr, $pDB_billing);
    //PARAMETERS
    $type = getParameter("option_fil");
    $value_tmp = getParameter("value_fil");
    $date_ini_tmp = getParameter("date_from");
    $date_end_tmp = getParameter("date_to");
    $order_by_tmp = getParameter("order_by");
    $order_type_tmp = getParameter("order_type");
    $action = getParameter("nav");
    $start = getParameter("start");
    $value = isset($value_tmp) ? $value_tmp : "";
    $order_by = isset($order_by_tmp) ? $order_by_tmp : 1;
    $order_type = isset($order_type_tmp) ? $order_type_tmp : "asc";
    $date_from = isset($date_ini_tmp) ? $date_ini_tmp : date("d M Y");
    $date_to = isset($date_end_tmp) ? $date_end_tmp : date("d M Y");
    $date_ini = translateDate($date_from) . " 00:00:00";
    $date_end = translateDate($date_to) . " 23:59:59";
    //**********************************
    //begin grid parameters
    $oGrid = new paloSantoGrid($smarty);
    $limit = 40;
    $total = $pReportCall->ObtainNumberDevices($type, $value);
    $oGrid->setLimit($limit);
    $oGrid->setTotal($total);
    $oGrid->calculatePagination($action, $start);
    $offset = $oGrid->getOffsetValue();
    $end = $oGrid->getEnd();
    $urlFields = array('menu' => $module_name, 'option_fil' => $type, 'value_fil' => $value, 'date_from' => $date_from, 'date_to' => $date_to);
    $url = construirUrl($urlFields, array('nav', 'start'));
    $urlFields['order_by'] = $order_by;
    $urlFields['order_type'] = $order_type;
    $smarty->assign("order_by", $order_by);
    $smarty->assign("order_type", $order_type);
    $arrData = null;
    $arrResult = $pReportCall->ObtainReportCall($limit, $offset, $date_ini, $date_end, $type, $value, $order_by, $order_type);
    $order_type = $order_type == "desc" ? "asc" : "desc";
    if (is_array($arrResult) && $total > 0) {
        foreach ($arrResult as $key => $val) {
            $ext = $val['extension'];
            $arrTmp[0] = $ext;
            $arrTmp[1] = $val['user_name'];
            $arrTmp[2] = $val['num_incoming_call'];
            $arrTmp[3] = $val['num_outgoing_call'];
            $arrTmp[4] = "<label style='color: green;' title='{$val['duration_incoming_call']} {$arrLang['seconds']}'>" . $pReportCall->Sec2HHMMSS($val['duration_incoming_call']) . "</label>";
            $arrTmp[5] = "<label style='color: green;' title='{$val['duration_outgoing_call']} {$arrLang['seconds']}'>" . $pReportCall->Sec2HHMMSS($val['duration_outgoing_call']) . "</label>";
            $arrTmp[6] = "<a href='javascript: popup_ventana(\"?menu={$module_name}&action=graph&rawmode=yes&ext={$ext}&dini={$date_ini}&dfin={$date_end}\");'>" . "" . $arrLang['Call Details'] . "</a>";
            $arrData[] = $arrTmp;
        }
    }
    $img = "<img src='images/flecha_{$order_type}.png' border='0' align='absmiddle'>";
    $leyend_1 = "<a class='link_summary_off' href='{$url}&amp;order_by=1&amp;order_type=asc'>{$arrLang["Extension"]}</a>";
    $leyend_2 = "<a class='link_summary_off' href='{$url}&amp;order_by=2&amp;order_type=asc'>{$arrLang["User name"]}</a>";
    $leyend_3 = "<a class='link_summary_off' href='{$url}&amp;order_by=3&amp;order_type=asc'>{$arrLang["Num. Incoming Calls"]}</a>";
    $leyend_4 = "<a class='link_summary_off' href='{$url}&amp;order_by=4&amp;order_type=asc'>{$arrLang["Num. Outgoing Calls"]}</a>";
    $leyend_5 = "<a class='link_summary_off' href='{$url}&amp;order_by=5&amp;order_type=asc'>{$arrLang["Sec. Incoming Calls"]}</a>";
    $leyend_6 = "<a class='link_summary_off' href='{$url}&amp;order_by=6&amp;order_type=asc'>{$arrLang["Sec. Outgoing Calls"]}</a>";
    if ($order_by == 1) {
        $leyend_1 = "<a class='link_summary_on' href='{$url}&amp;order_by=1&amp;order_type={$order_type}'>{$arrLang["Extension"]}&nbsp;{$img}</a>";
    } else {
        if ($order_by == 2) {
            $leyend_2 = "<a class='link_summary_on' href='{$url}&amp;order_by=2&amp;order_type={$order_type}'>{$arrLang["User name"]}&nbsp;{$img}</a>";
        } else {
            if ($order_by == 3) {
                $leyend_3 = "<a class='link_summary_on' href='{$url}&amp;order_by=3&amp;order_type={$order_type}'>{$arrLang["Num. Incoming Calls"]}&nbsp;{$img}</a>";
            } else {
                if ($order_by == 4) {
                    $leyend_4 = "<a class='link_summary_on' href='{$url}&amp;order_by=4&amp;order_type={$order_type}'>{$arrLang["Num. Outgoing Calls"]}&nbsp;{$img}</a>";
                } else {
                    if ($order_by == 5) {
                        $leyend_5 = "<a class='link_summary_on' href='{$url}&amp;order_by=5&amp;order_type={$order_type}'>{$arrLang["Sec. Incoming Calls"]}&nbsp;{$img}</a>";
                    } else {
                        if ($order_by == 6) {
                            $leyend_6 = "<a class='link_summary_on' href='{$url}&amp;order_by=6&amp;order_type={$order_type}'>{$arrLang["Sec. Outgoing Calls"]}&nbsp;{$img}</a>";
                        }
                    }
                }
            }
        }
    }
    $arrGrid = array("title" => $arrLang["Summary by Extension"], "icon" => "images/list.png", "width" => "100%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total, "url" => $urlFields, "columns" => array(0 => array("name" => $leyend_1, "property1" => ""), 1 => array("name" => $leyend_2, "property1" => ""), 2 => array("name" => $leyend_3, "property1" => ""), 3 => array("name" => $leyend_4, "property1" => ""), 4 => array("name" => $leyend_5, "property1" => ""), 5 => array("name" => $leyend_6, "property1" => ""), 6 => array("name" => $arrLang["Details"], "property1" => "")));
    //begin section filter
    $arrFormFilterReportCall = createFieldForm($arrLang);
    $oFilterForm = new paloForm($smarty, $arrFormFilterReportCall);
    $_POST['option_fil'] = $type;
    $_POST['value_fil'] = $value;
    $_POST['date_from'] = $date_from;
    $_POST['date_to'] = $date_to;
    $smarty->assign("SHOW", $arrLang["Show"]);
    if ($_POST["date_from"] === "") {
        $_POST["date_from"] = " ";
    }
    if ($_POST['date_to'] === "") {
        $_POST['date_to'] = " ";
    }
    $oGrid->addFilterControl(_tr("Filter applied: ") . _tr("Start Date") . " = " . $date_from . ", " . _tr("End Date") . " = " . $date_to, $_POST, array("date_from" => date("d M Y"), "date_to" => date("d M Y")), true);
    $valueType = "";
    if (!is_null($type)) {
        if ($type == "Ext") {
//.........这里部分代码省略.........
开发者ID:hardikk,项目名称:HNH,代码行数:101,代码来源:index.php

示例3: reportDHCP_Configuration

function reportDHCP_Configuration($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf)
{
    $pDHCP_Configuration = new paloSantoDHCP_Configuration($pDB);
    $filter_field = getParameter("filter_field");
    $filter_value = getParameter("filter_value");
    $action = getParameter("nav");
    $start = getParameter("start");
    //begin grid parameters
    $oGrid = new paloSantoGrid($smarty);
    $nameOpt = array("hostname" => _tr('Host Name'), "ipaddress" => _tr('IP Address'), "macaddress" => _tr('MAC Address'));
    if (isset($nameOpt[$filter_field])) {
        $valorFiltro = $nameOpt[$filter_field];
    } else {
        $valorFiltro = "";
    }
    $oGrid->addFilterControl(_tr("Filter applied ") . " " . $valorFiltro . " = {$filter_value}", $_POST, array("filter_field" => "hostname", "filter_value" => ""));
    $totalDHCP_Configuration = $pDHCP_Configuration->contarIpFijas($filter_field, $filter_value);
    $oGrid->addNew("new_dhcpconft", _tr("Assign IP Address"));
    $oGrid->deleteList("Are you sure you wish to delete the DHCP configuration.", "delete_dhcpConf", _tr("Delete"));
    $limit = 20;
    $total = $totalDHCP_Configuration;
    $oGrid->setLimit($limit);
    $oGrid->setTotal($total);
    $oGrid->calculatePagination($action, $start);
    $offset = $oGrid->getOffsetValue();
    $end = $oGrid->getEnd();
    $arrData = null;
    $arrResult = $pDHCP_Configuration->leerIPsFijas($limit, $offset, $filter_field, $filter_value);
    if (is_array($arrResult) && $total > 0) {
        foreach ($arrResult as $key => $value) {
            $arrTmp[0] = "<input type='checkbox' name='DhcpConfID_{$value['id']}' />";
            $arrTmp[1] = "<a href='?menu={$module_name}&action=view_dhcpconf&id=" . $value['id'] . "'>" . $value['hostname'] . "</a>";
            $arrTmp[2] = $value['ipaddress'];
            $arrTmp[3] = $value['macaddress'];
            $arrData[] = $arrTmp;
        }
    }
    $buttonDelete = "";
    $arrGrid = array("title" => _tr('Assign IP Address to Host'), "icon" => "modules/{$module_name}/images/system_network_assign_ip_address.png", "width" => "99%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total, "url" => array('menu' => $module_name, 'filter_field' => $filter_field, 'filter_value' => $filter_value), "columns" => array(0 => array("name" => $buttonDelete, "property1" => ""), 1 => array("name" => _tr('Host Name'), "property1" => ""), 2 => array("name" => _tr('IP Address'), "property1" => ""), 3 => array("name" => _tr('MAC Address'), "property1" => "")));
    //begin section filter
    $arrFormFilterDHCP_Configuration = createFieldFilter();
    $oFilterForm = new paloForm($smarty, $arrFormFilterDHCP_Configuration);
    $smarty->assign("SHOW", _tr('Show'));
    $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
    //end section filter
    $oGrid->showFilter(trim($htmlFilter));
    $contenidoModulo = $oGrid->fetchGrid($arrGrid, $arrData);
    //end grid parameters
    return $contenidoModulo;
}
开发者ID:hardikk,项目名称:HNH,代码行数:50,代码来源:index.php

示例4: reportGroupPermission

function reportGroupPermission($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $wasSaved = false, $value_action = "", $value_start = 0)
{
    global $arrLang;
    $pGroupPermission = new paloSantoGroupPermission();
    $filter_group = getParameter("filter_group");
    $id_administrador = 1;
    $filter_group = isset($filter_group) ? $filter_group : $id_administrador;
    $filter_resource = getParameter("filter_resource");
    $action = getParameter("nav");
    $start = getParameter("start");
    if ($wasSaved) {
        $action = $value_action;
        $start = $value_start;
    }
    //begin grid parameters
    $oGrid = new paloSantoGrid($smarty);
    $parameter_to_find = array();
    $lang = get_language();
    if ($lang != "en") {
        foreach ($arrLang as $key => $value) {
            $langValue = strtolower(trim($value));
            $filter_value = strtolower(trim($filter_resource));
            if ($filter_value != "") {
                if (preg_match("/^[[:alnum:]| ]*\$/", $filter_value)) {
                    if (strpos($langValue, $filter_value) !== FALSE) {
                        $parameter_to_find[] = $key;
                    }
                }
            }
        }
    }
    $parameter_to_find[] = $filter_resource;
    if (empty($parameter_to_find)) {
        $totalGroupPermission = $pGroupPermission->ObtainNumResouces($filter_resource);
    } else {
        $totalGroupPermission = $pGroupPermission->ObtainNumResouces($parameter_to_find);
    }
    $limit = 25;
    $total = $totalGroupPermission;
    $oGrid->setLimit($limit);
    $oGrid->setTotal($total);
    $oGrid->calculatePagination($action, $start);
    $offset = $oGrid->getOffsetValue();
    $end = $oGrid->getEnd();
    $arrData = null;
    if (empty($parameter_to_find)) {
        $arrResult = $pGroupPermission->ObtainResources($limit, $offset, $filter_resource);
    } else {
        $arrResult = $pGroupPermission->ObtainResources($limit, $offset, $parameter_to_find);
    }
    $url = array('menu' => $module_name, 'filter_group' => $filter_group, 'filter_resource' => $filter_resource);
    $idGroup = $filter_group;
    $arrPermisos = $pGroupPermission->loadGroupPermissionsACL($idGroup);
    $arrPermisos = OrderGroupPermissions($arrPermisos);
    $isAdministrator = $idGroup == 1 ? true : false;
    if (is_array($arrResult) && $total > 0) {
        foreach ($arrResult as $key => $resource) {
            $disabled = "";
            if (($resource["name"] == 'usermgr' || $resource["name"] == 'grouplist' || $resource["name"] == 'userlist' || $resource["name"] == 'group_permission') & $isAdministrator) {
                $disabled = "disabled='disabled'";
            }
            $checked0 = "";
            $checked1 = "";
            $checked2 = "";
            $checked3 = "";
            $checked4 = "";
            if (isset($arrPermisos[$resource["name"]])) {
                $T = $arrPermisos[$resource["name"]];
                $T = $T["actions"];
                foreach ($T as $num => $key) {
                    if ($key == "access") {
                        $checked0 = "checked";
                    }
                    if ($key == "view") {
                        $checked1 = "checked";
                    }
                    if ($key == "create") {
                        $checked2 = "checked";
                    }
                    if ($key == "delete") {
                        $checked3 = "checked";
                    }
                    if ($key == "update") {
                        $checked4 = "checked";
                    }
                }
            }
            $arrTmp[0] = "<input type='checkbox' {$disabled} name='groupPermission[" . $resource["name"] . "][" . $resource["id"] . "]' {$checked0}>";
            $arrTmp[1] = _tr($resource["description"]);
            $arrTmp[2] = "<input type='checkbox' {$disabled} name='viewPermission[" . $resource["name"] . "][" . $resource["id"] . "]' {$checked1}>";
            $arrTmp[3] = "<input type='checkbox' {$disabled} name='createPermission[" . $resource["name"] . "][" . $resource["id"] . "]' {$checked2}>";
            $arrTmp[4] = "<input type='checkbox' {$disabled} name='deletePermission[" . $resource["name"] . "][" . $resource["id"] . "]' {$checked3}>";
            $arrTmp[5] = "<input type='checkbox' {$disabled} name='updatePermission[" . $resource["name"] . "][" . $resource["id"] . "]' {$checked4}>";
            $arrData[] = $arrTmp;
        }
    }
    $arrGrid = array("title" => _tr("Group Permission"), "icon" => "images/list.png", "width" => "99%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total, "url" => $url, "columns" => array(0 => array("name" => "<input class='button' type='submit' name='apply' value='" . _tr('Apply') . "' />", "property1" => ""), 1 => array("name" => _tr("Resource"), "property1" => "")));
    //begin section filter
    $arrFormFilterGroupPermission = createFieldFilter($pGroupPermission);
    $oFilterForm = new paloForm($smarty, $arrFormFilterGroupPermission);
//.........这里部分代码省略.........
开发者ID:hardikk,项目名称:HNH,代码行数:101,代码来源:index.php

示例5: reportIncomingcallsmonitoring

function reportIncomingcallsmonitoring($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $arrLang)
{
    $pIncomingcallsmonitoring = new paloSantoIncomingcallsmonitoring($pDB);
    $filter_field = getParameter("filter_field");
    $filter_value = getParameter("filter_value");
    $action = getParameter("nav");
    $start = getParameter("start");
    //begin grid parameters
    $oGrid = new paloSantoGrid($smarty);
    $totalIncomingcallsmonitoring = $pIncomingcallsmonitoring->ObtainNumIncomingcallsmonitoring($filter_field, $filter_value);
    $limit = 20;
    $total = $totalIncomingcallsmonitoring;
    $oGrid->setLimit($limit);
    $oGrid->setTotal($total);
    $oGrid->calculatePagination($action, $start);
    $offset = $oGrid->getOffsetValue();
    $end = $oGrid->getEnd();
    $url = "?menu={$module_name}&filter_field={$filter_field}&filter_value={$filter_value}";
    $arrData = null;
    $arrResult = $pIncomingcallsmonitoring->ObtainIncomingcallsmonitoring($limit, $offset, $arrLang, $filter_field, $filter_value);
    if (is_array($arrResult)) {
        foreach ($arrResult as $key => $value) {
            $arrTmp[0] = $value['queue'];
            $arrTmp[1] = isset($value['entered']) ? $value['entered'] : "0";
            $arrTmp[2] = isset($value['answered']) ? $value['answered'] : "0";
            $arrTmp[3] = isset($value['abandoned']) ? $value['abandoned'] : "0";
            $arrTmp[4] = isset($value['waiting_calls']) ? $value['waiting_calls'] : "0";
            $arrTmp[5] = isset($value['without_monitoring']) ? $value['without_monitoring'] : "0";
            $arrData[] = $arrTmp;
        }
    }
    $arrGrid = array("title" => $arrLang["Incoming calls monitoring"], "icon" => "images/list.png", "width" => "99%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total, "url" => $url, "columns" => array(0 => array("name" => $arrLang["Queue"], "property1" => ""), 1 => array("name" => $arrLang["Entered"], "property1" => ""), 2 => array("name" => $arrLang["Answered"], "property1" => ""), 3 => array("name" => $arrLang["Abandoned"], "property1" => ""), 4 => array("name" => $arrLang["Waiting calls"], "property1" => ""), 5 => array("name" => $arrLang["Without monitoring"], "property1" => "")));
    //begin section filter
    $arrFormFilterIncomingcallsmonitoring = createFieldFilter($arrLang);
    $oFilterForm = new paloForm($smarty, $arrFormFilterIncomingcallsmonitoring);
    //     $smarty->assign("SHOW", $arrLang["Show"]);
    //     $htmlFilter = $oFilterForm->fetchForm("$local_templates_dir/filter.tpl","",$_POST);
    //end section filter
    //     $oGrid->showFilter(trim($htmlFilter));
    $content = $oGrid->fetchGrid($arrGrid, $arrData, $arrLang);
    if (strpos($content, '<form') === FALSE) {
        $content = "<form  method=\"POST\" style=\"margin-bottom:0;\" action=\"{$url}\">{$sContenido}</form>";
    }
    $sReloadScript = <<<SCRIPT_RELOAD
<script>
function reload() {
    xajax_create_report();
    setTimeout("reload()",5000);
}
reload();
</script>
SCRIPT_RELOAD;
    $content = $sReloadScript . $content;
    return $content;
}
开发者ID:hardikk,项目名称:HNH,代码行数:55,代码来源:index.php

示例6: reportReportedeTroncalesusadasporHoraeneldia

function reportReportedeTroncalesusadasporHoraeneldia($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, &$pDB_asterisk)
{
    $pReportedeTroncalesusadasporHoraeneldia = new paloSantoReportedeTroncalesusadasporHoraeneldia($pDB);
    // PS se obtiene el arreglo con las trunks para mostrarlas en el filtro
    //$arrTrunk1 = getTrunk($pDB, $pDB_asterisk);//Trunks
    //diana
    //llamamos  funcion nueva
    $arrTrunk = obtener_nuevas_trunks($pDB, $pDB_asterisk);
    // valores del filtro
    $filter_field = getParameter("filter_field");
    $filter_value = getParameter("filter_value");
    $date_from = getParameter("date_from");
    $date_to = getParameter("date_to");
    // si la fecha no está seteada en el filtro
    $_POST["date_from"] = isset($date_from) ? $date_from : date("d M Y");
    $_POST["date_to"] = isset($date_to) ? $date_to : date("d M Y");
    $date_from = isset($date_from) ? date('Y-m-d', strtotime($date_from)) : date("Y-m-d");
    $date_to = isset($date_to) ? date('Y-m-d', strtotime($date_to)) : date("Y-m-d");
    // para setear la trunk la primera vez
    $filter_value = getParameter("filter_value");
    if (!isset($filter_value)) {
        $trunk = array_shift(array_keys($arrTrunk));
        //Trunks
        $_POST["filter_value"] = $trunk;
        $filter_value = $trunk;
    }
    //validacion para que los filtros se queden seteados con el valor correcto, correccion de bug que se estaba dando en caso de pagineo
    $_POST["filter_value"] = $filter_value;
    $bElastixNuevo = method_exists('paloSantoGrid', 'setURL');
    // begin grid parameters
    $oGrid = new paloSantoGrid($smarty);
    $oGrid->enableExport();
    $bExportando = $bElastixNuevo ? $oGrid->isExportAction() : isset($_GET['exportcsv']) && $_GET['exportcsv'] == 'yes';
    $limit = 50;
    $offset = 0;
    // se obtienen los datos que se van a mostrar
    $arrData = null;
    $filter_value = trim($filter_value);
    $recordset = $pReportedeTroncalesusadasporHoraeneldia->listarTraficoLlamadasHora($date_from, $date_to, empty($filter_value) ? NULL : $filter_value);
    if (!is_array($recordset)) {
        $smarty->assign(array('mb_title' => _tr('Query Error'), 'mb_message' => $oCalls->errMsg));
        $recordset = array();
    }
    $total = count($recordset);
    $oGrid->setLimit($limit);
    $oGrid->setTotal($total);
    if ($bElastixNuevo) {
        $offset = $oGrid->calculateOffset();
    } else {
        $action = getParameter("nav");
        $start = getParameter("start");
        $oGrid->calculatePagination($action, $start);
        $end = $oGrid->getEnd();
    }
    $url = array("menu" => $module_name, "filter_field" => $filter_field, "filter_value" => $filter_value, "date_from" => $date_from, "date_to" => $date_to);
    // se guarda la data en un arreglo que luego es enviado como parámetro para crear el reporte
    if (is_array($recordset)) {
        $arrData = array();
        $total = array('entered' => 0, 'terminada' => 0, 'abandonada' => 0, 'en-cola' => 0, 'fin-monitoreo' => 0);
        foreach ($recordset as $iHora => $tupla) {
            $arrData[] = array(sprintf('%02d:00:00 - %02d:00:00', $iHora, $iHora + 1), $tupla['entered'], $tupla['terminada'], $tupla['abandonada'], $tupla['en-cola'], $tupla['fin-monitoreo']);
            foreach (array_keys($total) as $k) {
                $total[$k] += $tupla[$k];
            }
        }
        $sTagInicio = !$bExportando ? '<b>' : '';
        $sTagFinal = $sTagInicio != '' ? '</b>' : '';
        $arrData[] = array($sTagInicio . _tr('TOTAL') . $sTagFinal, $sTagInicio . $total['entered'] . $sTagFinal, $sTagInicio . $total['terminada'] . $sTagFinal, $sTagInicio . $total['abandonada'] . $sTagFinal, $sTagInicio . $total['en-cola'] . $sTagFinal, $sTagInicio . $total['fin-monitoreo'] . $sTagFinal);
    }
    //begin section filter
    $arrFormFilterReportedeTroncalesusadasporHoraeneldia = createFieldFilter($arrTrunk);
    $smarty->assign("SHOW", _tr("Show"));
    $oFilterForm = new paloForm($smarty, $arrFormFilterReportedeTroncalesusadasporHoraeneldia);
    $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST, $_GET);
    //end section filter
    $oGrid->showFilter($htmlFilter);
    if ($bElastixNuevo) {
        $oGrid->setURL($url);
        $oGrid->setData($arrData);
        $arrColumnas = array(_tr("Time Period "), _tr("Entered"), _tr("Answered"), _tr("Abandoned"), _tr("In queue"), _tr("Without monitoring "));
        $oGrid->setColumns($arrColumnas);
        $oGrid->setTitle(_tr("Reporte de Troncales usadas por Hora en el dia"));
        $oGrid->pagingShow(true);
        $oGrid->setNameFile_Export(_tr("Reporte de Troncales usadas por Hora en el dia"));
        return $oGrid->fetchGrid();
    } else {
        global $arrLang;
        $url = construirURL($url, array('nav', 'start'));
        $offset = 0;
        $limit = $total + 1;
        // se crea el grid
        $arrGrid = array("title" => _tr("Reporte de Troncales usadas por Hora en el dia"), "url" => $url, "icon" => "images/list.png", "width" => "99%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total, "columns" => array(0 => array("name" => _tr("Time Period "), "property1" => ""), 1 => array("name" => _tr("Entered"), "property1" => ""), 2 => array("name" => _tr("Answered"), "property1" => ""), 3 => array("name" => _tr("Abandoned"), "property1" => ""), 4 => array("name" => _tr("In queue"), "property1" => ""), 5 => array("name" => _tr("Without monitoring "), "property1" => "")));
        if ($bExportando) {
            $fechaActual = date("d M Y");
            header("Cache-Control: private");
            header("Pragma: cache");
            header('Content-Type: application/octec-stream');
            $title = "\"" . $fechaActual . ".csv\"";
            header("Content-disposition: inline; filename={$title}");
            header('Content-Type: application/force-download');
//.........这里部分代码省略.........
开发者ID:hardikk,项目名称:HNH,代码行数:101,代码来源:index.php


注:本文中的paloSantoGrid::calculatePagination方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。