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


PHP paloSantoGrid::getLimit方法代码示例

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


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

示例1: listarUsuarios

function listarUsuarios($pDB, $smarty, $module_name, $local_templates_dir)
{
    global $arrLang;
    $oUsuarios = new UsuariosECCP($pDB);
    $smarty->assign(array('MODULE_NAME' => $module_name, 'LABEL_CREATE_USER' => _tr('New ECCP User')));
    // Manejar posible borrado de agentes
    if (isset($_POST['delete']) && isset($_POST['id']) && ctype_digit($_POST['id'])) {
        $bExito = $oUsuarios->borrarUsuario($_POST['id']);
        if (!$bExito) {
            $smarty->assign(array('mb_title' => _tr('Error when deleting user'), 'mb_message' => $oUsuarios->errMsg));
        }
    }
    // Listar todos los agentes
    $oGrid = new paloSantoGrid($smarty);
    $oGrid->setLimit(50);
    $oGrid->setTotal($oUsuarios->contarUsuarios());
    $offset = $oGrid->calculateOffset();
    $listaAgentes = $oUsuarios->listarUsuarios(NULL, $offset, $oGrid->getLimit());
    $arrData = array();
    foreach ($listaAgentes as $t) {
        $arrData[] = array('<input type="radio" name="id" value="' . $t['id'] . '" />', htmlentities($t['username'], ENT_COMPAT, 'UTF-8'), '<a href="?menu=' . $module_name . '&amp;action=edit_user&amp;id=' . $t['id'] . '">[' . _tr('Edit') . ']</a>');
    }
    $url = construirURL(array('menu' => $module_name), array('nav', 'start'));
    $arrGrid = array("title" => _tr('ECCP User List'), "url" => $url, "icon" => 'images/user.png', "width" => "99%", "columns" => array(0 => array("name" => '<input type="submit" class="button" name="delete" value="' . htmlentities(_tr('Delete'), ENT_COMPAT, 'UTF-8') . '" onclick="return confirmSubmit(' . "'" . htmlentities(_tr('Are you sure to delete this user?'), ENT_COMPAT, 'UTF-8') . "'" . ')" />'), 1 => array("name" => _tr('Name')), 2 => array("name" => _tr('Options'))));
    $oGrid->showFilter($smarty->fetch("{$local_templates_dir}/filter-list-users.tpl"));
    $sContenido = $oGrid->fetchGrid($arrGrid, $arrData, $arrLang);
    if (strpos($sContenido, '<form') === FALSE) {
        $sContenido = "<form  method=\"POST\" style=\"margin-bottom:0;\" action=\"{$url}\">{$sContenido}</form>";
    }
    return $sContenido;
}
开发者ID:hardikk,项目名称:HNH,代码行数:31,代码来源:index.php

示例2: listURL

function listURL($pDB, $smarty, $module_name, $local_templates_dir)
{
    $urls = new externalUrl($pDB);
    $grid = new paloSantoGrid($smarty);
    $dtypes = descOpenType();
    // para el pagineo
    $grid->setLimit(15);
    $grid->setTotal($urls->countURLs());
    $offset = $grid->calculateOffset();
    $listaUrls = $urls->getURLs($grid->getLimit(), $grid->getOffsetValue());
    $data = array();
    foreach ($listaUrls as $tuplaUrl) {
        $data[] = array($tuplaUrl['active'] ? _tr('Yes') : _tr('No'), $dtypes[$tuplaUrl['opentype']], htmlentities($tuplaUrl['urltemplate'], ENT_COMPAT, 'UTF-8'), htmlentities($tuplaUrl['description'], ENT_COMPAT, 'UTF-8'), "<a href='?menu={$module_name}&amp;action=edit_url&amp;id_url=" . $tuplaUrl['id'] . "'>[" . _tr('Edit') . "]</a>");
    }
    //$grid->addNew("?menu=$module_name&action=new_url", _tr('New URL'), true);
    $grid->showFilter("<div align=\"right\"><a href=\"?menu={$module_name}&action=new_url\"><b>" . _tr('New URL') . "&raquo;</b></a></div>");
    $grid->setTitle(_tr('External URLs'));
    $grid->setColumns(array(_tr('Active'), _tr('Opens in'), _tr('URL Template'), _tr('Description'), _tr('Options')));
    $grid->setData($data);
    return $grid->fetchGrid();
}
开发者ID:hardikk,项目名称:HNH,代码行数:21,代码来源:index.php

示例3: listCampaign

function listCampaign($pDB, $smarty, $module_name, $local_templates_dir)
{
    global $arrLang;
    $arrData = '';
    $oCampaign = new paloSantoCampaignCC($pDB);
    // Recoger ID de campaña para operación
    $id_campaign = NULL;
    if (isset($_POST['id_campaign']) && ereg('^[[:digit:]]+$', $_POST['id_campaign'])) {
        $id_campaign = $_POST['id_campaign'];
    }
    // Revisar si se debe de borrar una campaña elegida
    if (isset($_POST['delete']) && !is_null($id_campaign)) {
        if ($oCampaign->delete_campaign($id_campaign)) {
            if ($oCampaign->errMsg != "") {
                $smarty->assign("mb_title", _tr('Validation Error'));
                $smarty->assign("mb_message", $oCampaign->errMsg);
            } else {
            }
        } else {
            $msg_error = $oCampaign->errMsg != "" ? "<br/>" . $oCampaign->errMsg : "";
            $smarty->assign("mb_title", _tr('Delete Error'));
            $smarty->assign("mb_message", _tr('Error when deleting the Campaign') . $msg_error);
        }
    }
    // Revisar si se debe activar una campaña elegida
    if (isset($_POST['activate']) && !is_null($id_campaign)) {
        if (!$oCampaign->activar_campaign($id_campaign, 'A')) {
            $smarty->assign("mb_title", _tr('Activate Error'));
            $smarty->assign("mb_message", _tr('Error when Activating the Campaign'));
        }
    }
    // Revisar si se debe desactivar una campaña elegida
    if (isset($_POST['deactivate']) && !is_null($id_campaign)) {
        if (!$oCampaign->activar_campaign($id_campaign, 'I')) {
            $smarty->assign("mb_title", _tr("Desactivate Error"));
            $smarty->assign("mb_message", _tr("Error when desactivating the Campaign"));
        }
    }
    // Validar el filtro por estado de actividad de la campaña
    $estados = array("all" => _tr("All"), "A" => _tr("Active"), "T" => _tr("Finish"), "I" => _tr("Inactive"));
    $sEstado = 'A';
    if (isset($_GET['cbo_estado']) && isset($estados[$_GET['cbo_estado']])) {
        $sEstado = $_GET['cbo_estado'];
    }
    if (isset($_POST['cbo_estado']) && isset($estados[$_POST['cbo_estado']])) {
        $sEstado = $_POST['cbo_estado'];
    }
    // para el pagineo
    $arrCampaign = $oCampaign->getCampaigns(NULL, NULL, NULL, $sEstado);
    $oGrid = new paloSantoGrid($smarty);
    $oGrid->setLimit(50);
    $oGrid->setTotal(count($arrCampaign));
    $offset = $oGrid->calculateOffset();
    $arrCampaign = array_slice($arrCampaign, $offset, $oGrid->getLimit());
    $url = construirURL(array('menu' => $module_name, 'cbo_estado' => $sEstado), array('nav', 'start'));
    if (is_array($arrCampaign)) {
        foreach ($arrCampaign as $campaign) {
            $arrTmp = array();
            $arrTmp[0] = "<input class=\"button\" type=\"radio\" name=\"id_campaign\" value=\"{$campaign['id']}\" />";
            $arrTmp[1] = $campaign['name'];
            $arrTmp[2] = $campaign['datetime_init'] . ' - ' . $campaign['datetime_end'];
            $arrTmp[3] = $campaign['daytime_init'] . ' - ' . $campaign['daytime_end'];
            $arrTmp[4] = $campaign['retries'] != "" ? $campaign['retries'] : "&nbsp;";
            $arrTmp[5] = is_null($campaign['trunk']) ? '(Dialplan)' : $campaign['trunk'];
            $arrTmp[6] = $campaign['queue'];
            $arrTmp[7] = $campaign['num_completadas'] != "" ? $campaign['num_completadas'] : "N/A";
            $arrTmp[8] = $campaign['promedio'] != "" ? number_format($campaign['promedio'], 0) : "N/A";
            $csv_data = "&nbsp;<a href='?menu={$module_name}&amp;action=csv_data&amp;id_campaign=" . $campaign['id'] . "&amp;rawmode=yes'>[" . _tr('CSV Data') . "]</a>";
            $ver_campania = "&nbsp;<a href='?menu={$module_name}&amp;action=edit_campaign&amp;id_campaign=" . $campaign['id'] . "'>[" . _tr('Edit') . "]</a>";
            if ($campaign['estatus'] == 'I') {
                $arrTmp[9] = _tr('Inactive');
                $arrTmp[10] = $ver_campania . $csv_data;
            } elseif ($campaign['estatus'] == 'A') {
                $arrTmp[9] = _tr('Active');
                $arrTmp[10] = $ver_campania . $csv_data;
            } elseif ($campaign['estatus'] == 'T') {
                $arrTmp[9] = _tr('Finish');
                $arrTmp[10] = $ver_campania . $csv_data;
            }
            $arrData[] = $arrTmp;
        }
    }
    // Definición de la tabla de las campañas
    $arrGrid = array("title" => _tr("Campaigns List"), "url" => $url, "icon" => "images/list.png", "width" => "99%", "columns" => array(0 => array("name" => ''), 1 => array("name" => _tr("Name Campaign")), 2 => array("name" => _tr("Range Date")), 3 => array("name" => _tr("Schedule per Day")), 4 => array("name" => _tr("Retries")), 5 => array("name" => _tr("Trunk")), 6 => array("name" => _tr("Queue")), 7 => array("name" => _tr("Completed Calls")), 8 => array("name" => _tr("Average Time")), 9 => array("name" => _tr("Status")), 10 => array("name" => _tr("Options"))));
    // Construir el HTML del filtro
    $smarty->assign(array('MODULE_NAME' => $module_name, 'LABEL_CAMPAIGN_STATE' => _tr('Campaign state'), 'estados' => $estados, 'estado_sel' => $sEstado, 'LABEL_CREATE_CAMPAIGN' => _tr('Create New Campaign'), 'LABEL_WITH_SELECTION' => _tr('With selection'), 'LABEL_ACTIVATE' => _tr('Activate'), 'LABEL_DEACTIVATE' => _tr('Desactivate'), 'LABEL_DELETE' => _tr('Delete'), 'MESSAGE_CONTINUE_DEACTIVATE' => _tr("Are you sure you wish to continue?"), 'MESSAGE_CONTINUE_DELETE' => _tr("Are you sure you wish to delete campaign?")));
    $oGrid->showFilter($smarty->fetch("{$local_templates_dir}/filter-list-campaign.tpl"));
    $sContenido = $oGrid->fetchGrid($arrGrid, $arrData, $arrLang);
    if (strpos($sContenido, '<form') === FALSE) {
        $sContenido = "<form  method=\"POST\" style=\"margin-bottom:0;\" action=\"{$url}\">{$sContenido}</form>";
    }
    return $sContenido;
}
开发者ID:hardikk,项目名称:HNH,代码行数:93,代码来源:index.php

示例4: listAgent


//.........这里部分代码省略.........
    }
    if (!in_array($sEstadoAgente, array_keys($listaEstados))) {
        $sEstadoAgente = 'All';
    }
    // Leer los agentes activos y comparar contra la lista de Asterisk
    $listaAgentesCallCenter = $oAgentes->getAgents();
    function get_agente_num($t)
    {
        return $t['number'];
    }
    $listaNumAgentesCallCenter = array_map('get_agente_num', $listaAgentesCallCenter);
    $listaNumAgentesAsterisk = $oAgentes->getAgentsFile();
    $listaNumSobrantes = array_diff($listaNumAgentesAsterisk, $listaNumAgentesCallCenter);
    $listaNumFaltantes = array_diff($listaNumAgentesCallCenter, $listaNumAgentesAsterisk);
    /* La variable $listaNumSobrantes tiene ahora todos los IDs de agente que 
          constan en Asterisk y no en la tabla call_center.agent como activos.
          La variable $listaNumFaltantes tiene los agentes que constan en 
          call_center.agent y no en Asterisk. El código posterior asume que el 
          archivo de agentes de Asterisk debería cambiarse para que refleje la
          tabla call_center.agent .
       */
    // Campo sync debe ser OK, o ASTERISK si consta en Asterisk pero no en
    // CallCenter, o CC si consta en CallCenter pero no en Asterisk.
    foreach (array_keys($listaAgentesCallCenter) as $k) {
        $listaAgentesCallCenter[$k]['sync'] = in_array($listaAgentesCallCenter[$k]['number'], $listaNumFaltantes) ? 'CC' : 'OK';
    }
    // Lista de todos los agentes conocidos, incluyendo los sobrantes.
    $listaAgentes = $listaAgentesCallCenter;
    foreach ($listaNumSobrantes as $idSobrante) {
        $listaAgentes[] = array('id' => NULL, 'number' => $oAgentes->arrAgents[$idSobrante][0], 'name' => $oAgentes->arrAgents[$idSobrante][2], 'password' => $oAgentes->arrAgents[$idSobrante][1], 'estatus' => NULL, 'sync' => 'ASTERISK');
    }
    // Listar todos los agentes que están conectados
    $listaOnline = $oAgentes->getOnlineAgents();
    if (is_array($listaOnline)) {
        foreach (array_keys($listaAgentes) as $k) {
            $listaAgentes[$k]['online'] = in_array($listaAgentes[$k]['number'], $listaOnline);
        }
    } else {
        $smarty->assign("mb_title", 'Unable to read agent');
        $smarty->assign("mb_message", 'Cannot read agent - ' . $oAgentes->errMsg);
        foreach (array_keys($listaAgentes) as $k) {
            $listaAgentes[$k]['online'] = NULL;
        }
    }
    // Filtrar los agentes conocidos según el estado que se requiera
    function estado_Online($t)
    {
        return $t['sync'] == 'OK' && $t['online'];
    }
    function estado_Offline($t)
    {
        return $t['sync'] == 'OK' && !$t['online'];
    }
    function estado_Repair($t)
    {
        return $t['sync'] != 'OK';
    }
    if ($sEstadoAgente != 'All') {
        $listaAgentes = array_filter($listaAgentes, "estado_{$sEstadoAgente}");
    }
    $arrData = array();
    $sImgVisto = "<img src='modules/{$module_name}/themes/images/visto.gif' border='0' />";
    $sImgErrorCC = "<img src='modules/{$module_name}/themes/images/error_small.png' border='0' title=\"" . _tr("Agent doesn't exist in configuration file") . "\" />";
    $sImgErrorAst = "<img src='modules/{$module_name}/themes/images/error_small.png' border='0' title=\"" . _tr("Agent doesn't exist in database") . "\" />";
    $smarty->assign(array('PREGUNTA_BORRAR_AGENTE_CONF' => _tr("To rapair is necesary delete agent from configuration file. Do you want to continue?"), 'PREGUNTA_AGREGAR_AGENTE_CONF' => _tr("To rapair is necesary add an agent in configuration file. Do you want to continue?")));
    foreach ($listaAgentes as $tuplaAgente) {
        $tuplaData = array("<input class=\"button\" type=\"radio\" name=\"agent_number\" value=\"{$tuplaAgente["number"]}\" />", NULL, htmlentities($tuplaAgente['number'], ENT_COMPAT, 'UTF-8'), htmlentities($tuplaAgente['name'], ENT_COMPAT, 'UTF-8'), $tuplaAgente['sync'] != 'CC' ? $tuplaAgente['online'] ? _tr("Online") : _tr("Offline") : '&nbsp;', "<a href='?menu=agents&amp;action=edit_agent&amp;id_agent=" . $tuplaAgente["number"] . "'>[" . _tr("Edit") . "]</a>");
        switch ($tuplaAgente['sync']) {
            case 'OK':
                $tuplaData[1] = $sImgVisto;
                break;
            case 'ASTERISK':
                $tuplaData[1] = $sImgErrorAst . "&nbsp;<a href='javascript:preguntar_por_reparacion(\"" . $tuplaAgente['number'] . "\",\"reparar_file\", pregunta_borrar_agente_conf)'>" . _tr('Repair') . "</a>";
                $tuplaData[5] = '&nbsp;';
                // No mostrar opción de editar agente que no está en DB
                break;
            case 'CC':
                $tuplaData[1] = $sImgErrorCC . "&nbsp;<a href='javascript:preguntar_por_reparacion(\"" . $tuplaAgente['number'] . "\",\"reparar_db\", pregunta_agregar_agente_conf)'>" . _tr('Repair') . "</a>";
                break;
        }
        $arrData[] = $tuplaData;
    }
    $url = construirURL(array('menu' => $module_name, 'cbo_estado' => $sEstadoAgente), array('nav', 'start'));
    $oGrid = new paloSantoGrid($smarty);
    $oGrid->setLimit(50);
    if (is_array($arrData)) {
        $oGrid->setTotal(count($arrData));
        $offset = $oGrid->calculateOffset();
        $arrData = array_slice($arrData, $offset, $oGrid->getLimit());
    }
    // Construir el reporte de los agentes activos
    $arrGrid = array("title" => "Số máy nhánh", "url" => $url, "icon" => "images/user.png", "width" => "99%", "columns" => array(0 => array("name" => '&nbsp;', "property1" => ""), 1 => array("name" => _tr("Configure"), "property1" => ""), 2 => array("name" => _tr("Number"), "property1" => ""), 3 => array("name" => _tr("Name"), "property1" => ""), 4 => array("name" => _tr("Status"), "property1" => ""), 5 => array("name" => _tr("Options"), "property1" => "")));
    $smarty->assign(array('LABEL_STATE' => _tr('Status'), 'LABEL_CREATE_AGENT' => _tr("New agent"), 'estados' => $listaEstados, 'estado_sel' => $sEstadoAgente, 'MODULE_NAME' => $module_name, 'LABEL_WITH_SELECTION' => _tr('With selection'), 'LABEL_DISCONNECT' => _tr('Disconnect'), 'LABEL_DELETE' => _tr('Delete'), 'MESSAGE_CONTINUE_DELETE' => _tr("Are you sure you wish to continue?")));
    $oGrid->showFilter($smarty->fetch("{$local_templates_dir}/filter-list-agents.tpl"));
    $sContenido = $oGrid->fetchGrid($arrGrid, $arrData, $arrLang);
    if (strpos($sContenido, '<form') === FALSE) {
        $sContenido = "<form  method=\"POST\" style=\"margin-bottom:0;\" action=\"{$url}\">{$sContenido}</form>";
    }
    return $sContenido;
}
开发者ID:hardikk,项目名称:HNH,代码行数:101,代码来源:index.php


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