本文整理汇总了PHP中paloSantoGrid::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP paloSantoGrid::setData方法的具体用法?PHP paloSantoGrid::setData怎么用?PHP paloSantoGrid::setData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paloSantoGrid
的用法示例。
在下文中一共展示了paloSantoGrid::setData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: report_CashCollection
function report_CashCollection($smarty, $module_name, $local_templates_dir, &$pDB, $pDB_2)
{
$pCashCollection = new Cash_Collection($pDB);
$pACL = new paloACL($pDB_2);
// get filter parameters
$filter = array('date_start' => trim($_POST['date_start']) == '' ? '' : date("Y-m-d", strtotime($_POST['date_start'])), 'date_end' => trim($_POST['date_end']) == '' ? '' : date("Y-m-d", strtotime($_POST['date_end'])), 'customer_name' => trim($_POST['customer_name']), 'customer_phone' => trim($_POST['customer_number']), 'ticket_code' => trim($_POST['ticket_code']), 'status' => trim($_POST['status']));
//begin grid parameters
$oGrid = new paloSantoGrid($smarty);
$oGrid->setTitle("Thu tiền giao vé");
$oGrid->pagingShow(true);
// show paging section.
$oGrid->enableExport();
// enable export.
$oGrid->setNameFile_Export("Cash_Collection");
$url = array("menu" => $module_name);
$oGrid->setURL($url);
$arrColumns = array("ID", "Tên Khách Hàng", "Số điện thoại", "Ngày mua vé", "Booker", "Địa chỉ", "Tiền trả", "Mã số vé", "Tình trạng", "Nhân viên giao", "Ngày phân công", "Nhân viên nhận tiền", "Ngày nhận tiền", " ");
$oGrid->setColumns($arrColumns);
$total = $pCashCollection->getNumCash_Collection($filter);
$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 = $pCashCollection->getCash_Collection($limit, $offset, $filter);
if (is_array($arrResult) && $total > 0) {
foreach ($arrResult as $key => $value) {
$ticket = '';
$name = $pACL->getUsers($value['accounting_id']);
$elastix_user = is_null($value['accounting_id']) ? '(Chưa nhận)' : $name[0][1];
foreach ($value['ticket_code'] as $row) {
$ticket .= $row . '<br>';
}
$arrTmp[0] = $value['id'];
$arrTmp[1] = $value['customer_name'];
$arrTmp[2] = $value['customer_phone'];
$arrTmp[3] = is_null($value['purchase_date']) ? '' : date("d-m-Y H:m:s", strtotime($value['purchase_date']));
$arrTmp[4] = $value['agent_name'];
$arrTmp[5] = '<a href="javascript:void(1)" onclick="alert(\'' . $value['deliver_address'] . '\')">Xem</a>';
$arrTmp[6] = $value['pay_amount'];
$arrTmp[7] = $ticket;
$arrTmp[8] = showStatus($value['status']);
$arrTmp[9] = $value['delivery_name'];
$arrTmp[10] = is_null($value['delivery_date']) ? '' : date("d-m-Y H:m:s", strtotime($value['delivery_date']));
$arrTmp[11] = $elastix_user;
$arrTmp[12] = is_null($value['collection_date']) ? '' : date("d-m-Y H:m:s", strtotime($value['collection_date']));
$arrTmp[13] = $value['status'] == 'Đang giao' ? '<a href="javascript:void(1)" onclick="collect_form(\'' . $value['id'] . '\')">Nhận tiền</a>' : '';
$arrData[] = $arrTmp;
}
}
$oGrid->setData($arrData);
//begin section filter
$oFilterForm = new paloForm($smarty, createFieldFilter());
// get delivery man list
$delivery_man_list = $pCashCollection->getDeliveryMan();
$smarty->assign("DELIVERY_MAN_LIST", $delivery_man_list);
$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: reportWeakKeys
function reportWeakKeys($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf)
{
$pWeakKeys = new paloSantoWeakKeys($pDB);
$filter_field = getParameter("filter_field");
$filter_value = getParameter("filter_value");
//begin grid parameters
$oGrid = new paloSantoGrid($smarty);
$total = $pWeakKeys->getNumWeakKeys($filter_field, $filter_value);
$pDB2 = new paloDB($arrConf['elastix_dsn']['acl']);
$pACL = new paloACL($pDB2);
$oGrid->enableExport();
// enable csv export.
$oGrid->pagingShow(true);
// show paging section.
$oGrid->setTitle(_tr("Weak Secrets"));
$oGrid->setIcon("modules/{$module_name}/images/security_weak_keys.png");
$oGrid->setNameFile_Export(_tr("Weak Secrets"));
if ($oGrid->isExportAction()) {
$limit = $total;
$offset = 0;
$bExportation = true;
} else {
$limit = 30;
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
$bExportation = false;
}
$url = array('menu' => $module_name, 'filter_field' => $filter_field, 'filter_value' => $filter_value);
$oGrid->setURL($url);
$arrResult = $pWeakKeys->getWeakKeys($limit, $offset, $filter_field, $filter_value);
$arrData = null;
//$arrResult =$pWeakKeys->getWeakKeysChecker();
$arrColumns = array(_tr("Extension"), _tr("Description"), _tr("Status"));
$oGrid->setColumns($arrColumns);
if (is_array($arrResult) && $total > 0) {
foreach ($arrResult as $tech) {
foreach ($tech as $key => $value) {
$arrTmp[0] = $value['id'];
$arrTmp[1] = $value['description'];
$mensaje = getMensaje($value['id'], $value['data']);
if ($mensaje != "OK" && !$bExportation) {
if ($pACL->isUserAdministratorGroup($_SESSION['elastix_user']) || $pACL->getUserExtension($_SESSION['elastix_user']) == $value['id']) {
$mensaje = _tr("Weak Key") . ": {$mensaje} <a href='?menu={$module_name}&action=change&id={$value['id']}'>" . _tr("Change Secret") . "</a>";
}
}
$arrTmp[2] = $mensaje;
$arrData[] = $arrTmp;
}
}
}
$oGrid->setData($arrData);
//begin section filter
$arrFormFilterWeakKeys = createFieldFilter();
$oFilterForm = new paloForm($smarty, $arrFormFilterWeakKeys);
$smarty->assign("SHOW", _tr("Show"));
$_POST["filter_field"] = $filter_field;
$_POST["filter_value"] = $filter_value;
$oGrid->addFilterControl(_tr("Filter applied: ") . _tr("Extension") . " = " . $filter_value, $_POST, array("filter_field" => "extension", "filter_value" => ""));
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
//end section filter
$oGrid->showFilter(trim($htmlFilter));
$content = $oGrid->fetchGrid();
//end grid parameters
return $content;
}
示例3: _moduleContent
//.........这里部分代码省略.........
$oGrid->showFilter($htmlFilter);
$bExportando = $bElastixNuevo ? $oGrid->isExportAction() : isset($_GET['exportcsv']) && $_GET['exportcsv'] == 'yes' || isset($_GET['exportspreadsheet']) && $_GET['exportspreadsheet'] == 'yes' || isset($_GET['exportpdf']) && $_GET['exportpdf'] == 'yes';
// Ejecutar la consulta con las variables ya validadas
$arrData = array();
$total = 0;
if (is_array($paramLista)) {
$total = $oCallsDetail->contarDetalleLlamadas($paramLista);
if (is_null($total)) {
$smarty->assign("mb_title", _tr("Error when connecting to database"));
$smarty->assign("mb_message", $oCallsDetail->errMsg);
$total = 0;
} else {
// Habilitar la exportación de todo el contenido consultado
if ($bExportando) {
$limit = $total;
}
// Calcular el offset de la petición de registros
if ($bElastixNuevo) {
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
} else {
// Si se quiere avanzar a la sgte. pagina
if (isset($_GET['nav']) && $_GET['nav'] == "end") {
// Mejorar el sgte. bloque.
if ($total % $limit == 0) {
$offset = $total - $limit;
} else {
$offset = $total - $total % $limit;
}
}
// Si se quiere avanzar a la sgte. pagina
if (isset($_GET['nav']) && $_GET['nav'] == "next") {
$offset = $_GET['start'] + $limit - 1;
}
// Si se quiere retroceder
if (isset($_GET['nav']) && $_GET['nav'] == "previous") {
$offset = $_GET['start'] - $limit - 1;
}
}
// Ejecutar la consulta de los datos en el offset indicado
$recordset = $oCallsDetail->leerDetalleLlamadas($paramLista, $limit, $offset);
// add STT
for ($i = 0; $i < count($recordset); $i++) {
$recordset[$i]['stt'] = $i + 1;
}
if (!is_array($recordset)) {
$smarty->assign("mb_title", _tr("Error when connecting to database"));
$smarty->assign("mb_message", $oCallsDetail->errMsg);
$total = 0;
} else {
function _calls_detail_map_recordset($cdr)
{
$mapaEstados = array('abandonada' => 'Bỏ nhỡ', 'Abandoned' => 'Bỏ nhỡ', 'terminada' => 'Đã nghe', 'Success' => 'Đã nghe', 'fin-monitoreo' => _tr('End Monitor'), 'Failure' => _tr('Failure'), 'NoAnswer' => _tr('NoAnswer'), 'OnQueue' => _tr('OnQueue'), 'Placing' => _tr('Placing'), 'Ringing' => _tr('Ringing'), 'ShortCall' => _tr('ShortCall'), 'activa' => 'Đang gọi');
return array($cdr['stt'], $cdr[0], htmlentities($cdr[1], ENT_COMPAT, "UTF-8"), substr($cdr[2], 0, 10), substr($cdr[2], 11, 8), substr($cdr[3], 0, 10), substr($cdr[3], 11, 8), is_null($cdr[4]) ? '-' : formatoSegundos($cdr[4]), is_null($cdr[5]) ? '-' : formatoSegundos($cdr[5]), $cdr[6], $cdr[8], $cdr[9], isset($mapaEstados[$cdr[10]]) ? $mapaEstados[$cdr[10]] : _tr($cdr[10]), is_null($cdr[12]) || trim($cdr[12] == '') ? '' : '<a href="javascript:void(0)" onclick="view_note(\'' . $cdr[11] . '\')">Xem</a>');
}
$arrData = array_map('_calls_detail_map_recordset', $recordset);
}
}
}
$arrColumnas = array('STT', 'Số Agent', 'Nhân viên', _tr("Start Date"), _tr("Start Time"), _tr("End Date"), _tr("End Time"), "Thời lượng", _tr("Thời gian chờ"), _tr("Queue"), _tr("Số điện thoại"), _tr("Chuyển máy"), _tr("Status"), 'Nội dung');
if ($bElastixNuevo) {
$oGrid->setURL(construirURL($urlVars, array("nav", "start")));
$oGrid->setData($arrData);
$oGrid->setColumns($arrColumnas);
$oGrid->setTitle('Chi tiết cuộc gọi Call Center');
$oGrid->pagingShow(true);
$oGrid->setNameFile_Export(_tr("Calls Detail"));
return $oGrid->fetchGrid();
} else {
global $arrLang;
$url = construirURL($urlVars, array("nav", "start"));
function _map_name($s)
{
return array('name' => $s);
}
$arrGrid = array("title" => _tr("Calls Detail"), "url" => $url, "icon" => "images/user.png", "width" => "99%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $offset + $limit <= $total ? $offset + $limit : $total, "total" => $total, "columns" => array_map('_map_name', $arrColumnas));
if (isset($_GET['exportpdf']) && $_GET['exportpdf'] == 'yes' && method_exists($oGrid, 'fetchGridPDF')) {
return $oGrid->fetchGridPDF($arrGrid, $arrData);
}
if (isset($_GET['exportspreadsheet']) && $_GET['exportspreadsheet'] == 'yes' && method_exists($oGrid, 'fetchGridXLS')) {
return $oGrid->fetchGridXLS($arrGrid, $arrData);
}
if ($bExportando) {
header("Cache-Control: private");
header("Pragma: cache");
// Se requiere para HTTPS bajo IE6
header('Content-disposition: inline; filename="calls_detail.csv"');
header("Content-Type: text/csv; charset=UTF-8");
}
if ($bExportando) {
return $oGrid->fetchGridCSV($arrGrid, $arrData);
}
$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;
}
}
示例4: listarFaxes
function listarFaxes(&$smarty, $module_name, $local_templates_dir)
{
$smarty->assign(array('SEARCH' => _tr('Search')));
$oFax = new paloFaxVisor();
// Generación del filtro
$oFilterForm = new paloForm($smarty, getFormElements());
// Parámetros base y validación de parámetros
$url = array('menu' => $module_name);
$paramFiltroBase = $paramFiltro = array('name_company' => '', 'fax_company' => '', 'date_fax' => NULL, 'filter' => 'All');
foreach (array_keys($paramFiltro) as $k) {
if (!is_null(getParameter($k))) {
$paramFiltro[$k] = getParameter($k);
}
}
$oGrid = new paloSantoGrid($smarty);
$arrType = array("All" => _tr('All'), "In" => _tr('in'), "Out" => _tr('out'));
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Company Name") . " = " . $paramFiltro['name_company'], $paramFiltro, array("name_company" => ""));
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Company Fax") . " = " . $paramFiltro['fax_company'], $paramFiltro, array("fax_company" => ""));
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Fax Date") . " = " . $paramFiltro['date_fax'], $paramFiltro, array("date_fax" => NULL));
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Type Fax") . " = " . $arrType[$paramFiltro['filter']], $paramFiltro, array("filter" => "All"), true);
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $paramFiltro);
if (!$oFilterForm->validateForm($paramFiltro)) {
$smarty->assign(array('mb_title' => _tr('Validation Error'), 'mb_message' => '<b>' . _tr('The following fields contain errors') . ':</b><br/>' . implode(', ', array_keys($oFilterForm->arrErroresValidacion))));
$paramFiltro = $paramFiltroBase;
unset($_POST['faxes_delete']);
// Se aborta el intento de borrar faxes, si había uno.
}
$url = array_merge($url, $paramFiltro);
// Ejecutar el borrado, si se ha validado.
if (isset($_POST['faxes_delete']) && isset($_POST['faxes']) && is_array($_POST['faxes']) && count($_POST['faxes']) > 0) {
$msgError = NULL;
foreach ($_POST['faxes'] as $idFax) {
if (!$oFax->deleteInfoFax($idFax)) {
if ($oFax->errMsg = '') {
$msgError = _tr('Unable to eliminate pdf file from the path.');
} else {
$msgError = _tr('Unable to eliminate pdf file from the database.') . ' - ' . $oFax->errMsg;
}
}
}
if (!is_null($msgError)) {
$smarty->assign(array('mb_title' => _tr('ERROR'), 'mb_message' => $oFax->errMsg));
}
}
$oGrid->setTitle(_tr("Fax Viewer"));
$oGrid->setIcon("modules/{$module_name}/images/kfaxview.png");
$oGrid->pagingShow(true);
// show paging section.
$oGrid->setURL($url);
$arrData = NULL;
$total = $oFax->obtener_cantidad_faxes($paramFiltro['name_company'], $paramFiltro['fax_company'], $paramFiltro['date_fax'], $paramFiltro['filter']);
$limit = 20;
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
$arrResult = $oFax->obtener_faxes($paramFiltro['name_company'], $paramFiltro['fax_company'], $paramFiltro['date_fax'], $offset, $limit, $paramFiltro['filter']);
$oGrid->setColumns(array("", _tr('Type'), _tr('File'), _tr('Company Name'), _tr('Company Fax'), _tr('Fax Destiny'), _tr('Fax Date'), _tr('Status'), _tr('Options')));
if (is_array($arrResult) && $total > 0) {
foreach ($arrResult as $fax) {
foreach (array('pdf_file', 'company_name', 'company_fax', 'destiny_name', 'destiny_fax', 'errormsg') as $k) {
$fax[$k] = htmlentities($fax[$k], ENT_COMPAT, 'UTF-8');
}
if (empty($fax['status']) && !empty($fax['errormsg'])) {
$fax['status'] = 'failed';
}
$arrData[] = array('<input type="checkbox" name="faxes[]" value="' . $fax['id'] . '" />', _tr($fax['type']), strtolower($fax['type']) == 'in' || strpos($fax['pdf_file'], '.pdf') !== FALSE ? "<a href='?menu={$module_name}&action=download&id=" . $fax['id'] . "&rawmode=yes'>" . $fax['pdf_file'] . "</a>" : $fax['pdf_file'], $fax['company_name'], $fax['company_fax'], $fax['destiny_name'] . " - " . $fax['destiny_fax'], $fax['date'], _tr($fax['status']) . (empty($fax['errormsg']) ? '' : ': ' . $fax['errormsg']), "<a href='?menu={$module_name}&action=edit&id=" . $fax['id'] . "'>" . _tr('Edit') . "</a>");
}
}
if (!is_array($arrResult)) {
$smarty->assign(array('mb_title' => _tr('ERROR'), 'mb_message' => $oFax->errMsg));
}
$oGrid->setData($arrData);
$oGrid->deleteList(_tr('Are you sure you wish to delete fax (es)?'), "faxes_delete", _tr("Delete"));
$oGrid->showFilter($htmlFilter);
return $oGrid->fetchGrid();
}
示例5: viewFormDomain
function viewFormDomain($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $arrLang)
{
$pEmail = new paloEmail($pDB);
$oGrid = new paloSantoGrid($smarty);
$arrDomains = $pEmail->getDomains();
$end = count($arrDomains);
$arrData = array();
$oGrid->pagingShow(true);
$url = array("menu" => $module_name);
$oGrid->setURL($url);
$oGrid->setTitle(_tr("Domain List"));
$oGrid->setIcon("modules/{$module_name}/images/email_domains.png");
$arrColumns = array(_tr("Domain"), _tr("Number of Accounts"));
$oGrid->setColumns($arrColumns);
$total = 0;
$limit = 20;
$limitInferior = "";
$limitSuperior = "";
$oGrid->setLimit($limit);
$oGrid->addNew("submit_create_domain", _tr('Create Domain'));
if (is_array($arrDomains) && $end > 0) {
$oGrid->setTotal($end);
$offset = $oGrid->calculateOffset();
$cont = 0;
$limitInferior = $offset;
$limitSuperior = $offset + $limit - 1;
foreach ($arrDomains as $domain) {
$arrTmp = array();
if ($cont > $limitSuperior) {
break;
}
if ($cont >= $limitInferior & $cont <= $limitSuperior) {
$arrTmp[0] = " <a href='?menu=email_domains&action=view&id=" . $domain[0] . "'>{$domain['1']}</a>";
//obtener el numero de cuentas que posee ese email
$arrTmp[1] = $pEmail->getNumberOfAccounts($domain[0]);
$arrData[] = $arrTmp;
}
$cont++;
}
} else {
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
}
$oGrid->setData($arrData);
$content = $oGrid->fetchGrid();
return $content;
}
示例6: getParameter
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;
}
示例7: reportPuertos
function reportPuertos($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf)
{
$pPuertos = new paloSantoPortService($pDB);
$field_type = getParameter("filter_type");
$field_pattern = getParameter("filter_txt");
//begin grid parameters
$oGrid = new paloSantoGrid($smarty);
$oGrid->addNew("new", _tr("Define Port"));
$oGrid->deleteList("Are you sure you wish to delete the port(s).?", "delete", _tr("Delete"));
$totalPuertos = $pPuertos->ObtainNumPuertos($field_type, $field_pattern);
$limit = 20;
$total = $totalPuertos;
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$oGrid->setTitle(_tr("Define Ports"));
$oGrid->setIcon("modules/{$module_name}/images/security_define_ports.png");
$oGrid->pagingShow(true);
$offset = $oGrid->calculateOffset();
$url = array("menu" => $module_name, "filter_type" => $field_type, "filter_txt" => $field_pattern);
$oGrid->setURL($url);
$arrData = null;
$arrResult = $pPuertos->ObtainPuertos($limit, $offset, $field_type, $field_pattern);
$button_eliminar = "";
$arrColumns = array($button_eliminar, _tr("Name"), _tr("Protocol"), _tr("Details"), _tr("Option"));
$oGrid->setColumns($arrColumns);
if (is_array($arrResult) && $total > 0) {
foreach ($arrResult as $key => $value) {
$arrTmp[0] = "<input type='checkbox' name='" . $value['id'] . "' id='" . $value['id'] . "'>";
$arrTmp[1] = $value['name'];
$arrTmp[2] = $value['protocol'];
if ($value['protocol'] == "TCP" || $value['protocol'] == "UDP") {
$port = $value['details'];
$arrTmp[3] = stripos($port, ":") === false ? _tr('Port') . " " . $value['details'] : _tr('Ports') . " " . $value['details'];
} elseif ($value['protocol'] == "ICMP") {
$arr = explode(":", $value['details']);
if (isset($arr[1])) {
$arrTmp[3] = "Type: " . $arr[0] . " Code: " . $arr[1];
}
} else {
$arrTmp[3] = "Protocol Number: " . $value['details'];
}
$arrTmp[4] = " <a href='?menu={$module_name}&action=view&id=" . $value['id'] . "'>" . _tr('View') . "</a>";
$arrData[] = $arrTmp;
}
}
$oGrid->setData($arrData);
//begin section filter
$arrFormFilterPuertos = createFieldForm();
$oFilterForm = new paloForm($smarty, $arrFormFilterPuertos);
$smarty->assign("SHOW", _tr("Show"));
$_POST["filter_type"] = $field_type;
$_POST["filter_txt"] = $field_pattern;
if (is_null($field_type) || $field_type == "") {
$nameFieldType = "";
} else {
$nameFieldType = $arrFormFilterPuertos["filter_type"]["INPUT_EXTRA_PARAM"][$field_type];
}
$oGrid->addFilterControl(_tr("Filter applied: ") . $nameFieldType . " = " . $field_pattern, $_POST, array("filter_type" => "name", "filter_txt" => "x"));
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
//end section filter
$oGrid->showFilter(trim($htmlFilter));
$contenidoModulo = $oGrid->fetchGrid();
if (strpos($contenidoModulo, '<form') === FALSE) {
$contenidoModulo = "<form method='POST' style='margin-bottom:0;' action={$url}>{$contenidoModulo}</form>";
}
//end grid parameters
return $contenidoModulo;
}
示例8: showLanguages
function showLanguages($smarty, $module_name, $local_templates_dir, $arrLang, $arrLangModule)
{
//$oPaloSanto = new paloSantoLanguageAdmin();
$pLanguages = new paloSantoLanguageAdmin();
$arrFormElements = array("module" => array("LABEL" => $arrLangModule["Select Module"], "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $pLanguages->leer_directorio_modulos(), "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "language" => array("LABEL" => $arrLangModule["Select Language"], "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $pLanguages->leer_directorio_lenguajes(), "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""));
$oFilterForm = new paloForm($smarty, $arrFormElements);
$smarty->assign("SHOW", $arrLang["Show"]);
$smarty->assign("SAVE_ALL", "Save All");
$module = getParameter("module");
$language = getParameter("language");
$action = getParameter('nav');
$start = getParameter('start');
$smarty->assign("start_value", $start);
$smarty->assign("nav_value", $action);
$_POST["module"] = $module;
$_POST["language"] = $language;
$oGrid = new paloSantoGrid($smarty);
if (!is_null($module) && !is_null($language)) {
$nameModule = $arrFormElements["module"]["INPUT_EXTRA_PARAM"][$module];
$valueLanguage = $arrFormElements["language"]["INPUT_EXTRA_PARAM"][$language];
} else {
$nameModule = "";
$valueLanguage = "";
}
$oGrid->addFilterControl(_tr("Filter applied: ") . $nameModule . " = " . $valueLanguage, $_POST, array("module" => null, "language" => null));
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
//Paginacion
$limit = 20;
$total_datos = $pLanguages->ObtainNumLanguages($module, $language);
$total = $total_datos;
$oGrid->addNew("new", _tr("Add"));
$oGrid->customAction("save_all", _tr("Save All"));
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$oGrid->setTitle(_tr("Language Admin"));
$oGrid->setIcon("images/list.png");
$oGrid->pagingShow(true);
$offset = $oGrid->calculateOffset();
$url = "?menu={$module_name}&module={$module}&language={$language}";
$oGrid->setURL($url);
$arrColumns = array(_tr("Key"), _tr("Value"));
$oGrid->setColumns($arrColumns);
$arrLangMod = $pLanguages->obtainLanguages($limit, $offset, $module, $language);
$arrData = array();
$counter = 1;
if (is_array($arrLangMod) && count($arrLangMod) > 0) {
foreach ($arrLangMod as $key => $value) {
$tmpKey = htmlspecialchars($key);
$tmpValue = htmlspecialchars($value);
$arrTmp[0] = $tmpKey;
$arrTmp[1] = "<input class='table_data' style='width:450px' type='text' name=\"langvalue_{$counter}\" id=\"langvalue_{$counter}\" value=\"{$tmpValue}\" /><input type='hidden' name='langkey_{$counter}' id='langkey_{$counter}' value='{$tmpKey}'>";
$counter++;
$arrData[] = $arrTmp;
}
}
$oGrid->setData($arrData);
$oGrid->showFilter(trim($htmlFilter));
$moduleContent = $oGrid->fetchGrid();
if (strpos($moduleContent, '<form') === FALSE) {
$moduleContent = "<form method='POST' style='margin-bottom:0;' action={$url}>{$moduleContent}</form>";
}
return $moduleContent;
}
示例9: report_AccessAudit
//.........这里部分代码省略.........
$offset = $iOffsetPrevio;
break;
case 'bypage':
$numPage = $limit == 0 ? 0 : ceil($total / $limit);
$page = getParameter("page");
if (preg_match("/[0-9]+/", $page) == 0) {
// no es un número
$page = 1;
}
if ($page > $numPage) {
// se está solicitando una pagina mayor a las que existen
$page = $numPage;
}
$start = ($page - 1) * $limit + 1 - $limit;
//$accion = "next";
if ($start + $limit <= 1) {
break;
}
/*$inicioRango = $page * $iEstimadoBytesPagina;
$arrResult =$pAccessLogs->ObtainAccessLogs(10 * $iEstimadoBytesPagina, $inicioRango, $field_pattern, NULL, $isExport);
$offset = $arrResult[0]['offset'];
$oGrid->setOffsetValue($offset);
$oGrid->setEnd(((int)($offset / 128) + $iNumLineasPorPagina) <= $oGrid->getTotal() ? (int)($offset / 128) + $iNumLineasPorPagina : $oGrid->getTotal());
$oGrid->setStart(($oGrid->getTotal()==0) ? 0 : (1 + (int)($offset / 128)));*/
$inicioBusqueda = $page * $iEstimadoBytesPagina - $iEstimadoBytesPagina;
$arrResult = $pAccessLogs->ObtainAccessLogs(10 * $iEstimadoBytesPagina, $inicioBusqueda, $field_pattern, NULL, $isExport);
$offset = $arrResult[0]['offset'];
$oGrid->setOffsetValue($offset);
break;
}
}
// Buscar la cadena de texto indicada, y modificar offset si se encuentra
$smarty->assign("SEARCHNEXT", _tr('Search'));
if (isset($_POST['searchnext']) && $busqueda != '') {
$pAccessLogs->astLog->posicionarMensaje($field_pattern, $offset);
$posBusqueda = $pAccessLogs->astLog->buscarTextoMensaje($busqueda);
if (!is_null($posBusqueda)) {
$offset = $posBusqueda[1];
$smarty->assign('SEARCHNEXT', _tr('Search next'));
$_POST['ultima_busqueda'] = $busqueda;
$_POST['ultimo_offset'] = $offset;
// Si el offset anterior indicado es idéntico al offset recién encontrado
// y la cadena de búsqueda es también idéntica, se asume que se ha
// pedido una búsqueda de la siguiente ocurrencia.
if (!is_null($sUltimaBusqueda) && !is_null($iUltimoOffset) && $offset == $iUltimoOffset && $sUltimaBusqueda == $busqueda) {
$pAccessLogs->astLog->posicionarMensaje($field_pattern, $offset);
$pAccessLogs->astLog->siguienteMensaje();
// Sólo para ignorar primera ocurrencia
$posBusqueda = $pAccessLogs->astLog->buscarTextoMensaje($busqueda);
if (!is_null($posBusqueda)) {
$offset = $posBusqueda[1];
$_POST['ultimo_offset'] = $offset;
}
}
} else {
}
}
$url = array('menu' => $module_name, 'filter' => $field_pattern, 'offset' => $offset, 'busqueda' => $busqueda, 'ultima_busqueda' => isset($_POST['ultima_busqueda']) ? $_POST['ultima_busqueda'] : '', 'ultimo_offset' => isset($_POST['ultimo_offset']) ? $_POST['ultimo_offset'] : '');
$oGrid->setURL($url);
//Fin Paginacion
if ($isExport) {
$arrResult = $pAccessLogs->ObtainAccessLogs($totalBytes, 0, $field_pattern, $busqueda != '' ? $busqueda : NULL, $isExport);
} else {
$arrResult = $pAccessLogs->ObtainAccessLogs(10 * $iEstimadoBytesPagina, $offset, $field_pattern, $busqueda != '' ? $busqueda : NULL, $isExport);
}
if (!$isExport) {
$arrResult = array_slice($arrResult, 0, $iNumLineasPorPagina);
}
$arrData = null;
if (is_array($arrResult) && $totalBytes > 0) {
foreach ($arrResult as $key => $value) {
$arrTmp[0] = $value['fecha'];
$arrTmp[1] = $value['tipo'];
$arrTmp[2] = $value['origen'];
$arrTmp[3] = $value['linea'];
$arrData[] = $arrTmp;
}
}
$arrColumns = array(_tr("Date"), _tr("Type"), _tr("User"), _tr("Message"));
$oGrid->setColumns($arrColumns);
$oGrid->setData($arrData);
$oGrid->setStart($totalBytes == 0 ? 0 : 1 + (int) ($offset / 128));
$t = (int) ($totalBytes / 128);
$e = (int) ($offset / 128) + $iNumLineasPorPagina;
$e = $t <= $e ? $t : $e;
$oGrid->setEnd($e + 1);
$oGrid->setTotal($t + 1);
$oGrid->setLimit(30);
$_POST['offset'] = $offset;
$smarty->assign("SHOW", _tr("Show"));
$oGrid->addFilterControl(_tr("Filter applied: ") . _tr("Date") . " = " . $_POST['filter'], $_POST, array('filter' => $listaFechas[count($listaFechas) - 1]), true);
$oGrid->addFilterControl(_tr("Filter applied: ") . _tr('Search string') . " = " . $busqueda, $_POST, array('busqueda' => ""));
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
$oGrid->showFilter(trim($htmlFilter));
return $oGrid->fetchGrid();
}
示例10: listarColaFax_raw
function listarColaFax_raw($smarty, $module_name, $local_templates_dir, $listaColaFax)
{
$oGrid = new paloSantoGrid($smarty);
$oGrid->pagingShow(FALSE);
$oGrid->setURL('?menu=faxqueue');
$oGrid->setTitle(_tr('Fax Queue'));
$oGrid->deleteList('Are you sure to cancel selected jobs?', 'remove', _tr('Cancel job'));
$arrColumns = array('', _tr('Job ID'), _tr('Priority'), _tr('Destination'), _tr('Pages'), _tr('Retries'), _tr('Status'));
$oGrid->setColumns($arrColumns);
function listarColaFax_toHTML($t)
{
return array('<input type="radio" name="jobid" value="' . $t['jobid'] . '"/>', $t['jobid'], $t['priority'], $t['outnum'], sprintf(_tr('Sent %d pages of %d'), $t['sentpages'], $t['totalpages']), sprintf(_tr('Try %d of %d'), $t['retries'], $t['totalretries']), '[' . $t['state'] . '] ' . _tr($t['status']));
}
$oGrid->setData(array_map('listarColaFax_toHTML', $listaColaFax));
return $oGrid->fetchGrid();
}
示例11: reportClientesCampania
function reportClientesCampania($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf)
{
$pClientesagendados = new paloSantoClientesCampania($pDB);
$filter_field = getParameter("filter_field");
$filter_value = getParameter("filter_value");
//begin grid parameters
$oGrid = new paloSantoGrid($smarty);
$oGrid->setTplFile("/var/www/html/modules/{$module_name}/themes/default/_list.tpl");
$oGrid->setTitle(_tr("Clientes por campaña"));
$oGrid->pagingShow(true);
// show paging section.
$oGrid->enableExport();
// enable export.
$oGrid->setNameFile_Export(_tr("Clientes por campaña"));
$url = array("menu" => $module_name, "filter_field" => $filter_field, "filter_value" => $filter_value);
$oGrid->setURL($url);
$arrColumns = array(_tr("CI"), _tr("Cliente"), _tr("Campaña"), _tr("Agendamiento"), _tr("Agendado a"), _tr("Acción"));
$oGrid->setColumns($arrColumns);
$total = $pClientesagendados->getNumClientesCampania($filter_field, $filter_value);
$arrData = null;
if ($oGrid->isExportAction()) {
$limit = $total;
// max number of rows.
$offset = 0;
// since the start.
} else {
$limit = 100;
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
}
$arrResult = $pClientesagendados->getClientesCampania($limit, $offset, $filter_field, $filter_value);
if (is_array($arrResult) && $total > 0) {
foreach ($arrResult as $key => $value) {
$arrTmp[0] = $value['ci'];
$arrTmp[1] = $value['cliente'];
$arrTmp[2] = $value['campania'];
$arrTmp[3] = $value['fecha_agendamiento'];
$arrTmp[4] = $value['agente_agendado'];
//$arrTmp[3] = getFormSelectAgentesCampania($pClientesagendados,$value['id_campania'],$value['id_campania_cliente'],$value['agente_agendado']);
$arrTmp[5] = "<a href='index.php?menu={$module_name}&id_campania_cliente={$value['id_campania_cliente']}&action=agendar'>Agendar</a>" . " / <a href='index.php?menu=hispana_clientes_datosbasicos&id_cliente=" . $value['id_cliente'] . "'>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;
}
示例12: reportBillingRates
function reportBillingRates($smarty, $module_name, $local_templates_dir, &$pDB, &$pDB2, &$pDB3, $arrConf, $arrLang)
{
$pBillingRates = new paloSantoBillingRates($pDB);
$action = getParameter("nav");
$start = getParameter("start");
$as_csv = getParameter("exportcsv");
$arrResult = "";
$arrColumns = "";
//obtain parameters from new rates
$prefix_new = getParameter("Prefix");
$name_new = getParameter("Name");
$rate_new = getParameter("Rate");
$rate_offset_new = getParameter("Rate_offset");
$trunk_new = getParameter("Trunk");
$hidden_digits = getParameter("Hidden_Digits");
$id = getParameter("id");
//exists Default rate in rate.db // actualizar los rates por defecto en settings
$cant = $pBillingRates->contRates();
if (isset($cant['cant']) & $cant['cant'] < 1) {
$pBillingRates->existsDefaultRate($pDB3);
}
$action = getAction();
//begin grid parameters
$oGrid = new paloSantoGrid($smarty);
$totalBillingRates = $pBillingRates->getNumBillingRates();
$url = array('menu' => $module_name);
//$oGrid->enableExport(); // enable csv export.
$oGrid->pagingShow(true);
// show paging section.
$oGrid->setTitle(_tr("Billing Rates"));
$oGrid->setIcon("modules/{$module_name}/images/reports_billing_rates.png");
$oGrid->setNameFile_Export("Billing_Rates");
$oGrid->setURL($url);
$oGrid->addNew("new_rate", _tr("create_rate"));
$smarty->assign("module_name", $module_name);
$arrData = null;
if ($oGrid->isExportAction()) {
$limit = $totalBillingRates;
$offset = 0;
$arrResult = $pBillingRates->getBillingRates($limit, $offset);
if (is_array($arrResult) && $totalBillingRates > 0) {
foreach ($arrResult as $key => $value) {
$arrTmp[0] = isset($value['prefix']) & $value['prefix'] != "" ? $value['prefix'] : "*";
$arrTmp[1] = isset($value['name']) & $value['name'] != "" ? $value['name'] : "-";
$arrTmp[2] = isset($value['rate']) & $value['rate'] != "" ? $value['rate'] : "-";
$arrTmp[3] = isset($value['rate_offset']) & $value['rate_offset'] != "" ? $value['rate_offset'] : "-";
$arrTmp[4] = isset($value['hided_digits']) & $value['hided_digits'] != "" ? $value['hided_digits'] : "-";
$arrTmp[5] = isset($value['trunk']) & $value['trunk'] != "" ? $value['trunk'] : "*";
$arrTmp[6] = isset($value['fecha_creacion']) & $value['fecha_creacion'] != "" ? $value['fecha_creacion'] : "-";
$arrData[] = $arrTmp;
}
}
$arrColumns = array(_tr("Prefix"), _tr("Name"), _tr("Rate"), _tr("Rate Offset"), _tr("Hidden_Digits"), _tr("Trunk"), _tr("Creation Date"));
} else {
$limit = 20;
$oGrid->setLimit($limit);
$oGrid->setTotal($totalBillingRates);
$offset = $oGrid->calculateOffset();
$arrResult = $pBillingRates->getBillingRates($limit, $offset);
if (is_array($arrResult) && $totalBillingRates > 0) {
foreach ($arrResult as $key => $value) {
if ($value['name'] == "Default") {
$default = $arrLang['Default'];
$arrTmp[0] = "<font color='green'>*</font>";
$arrTmp[1] = "<font color='green'>" . $default . "</font>";
$arrTmp[2] = "<font color='green'>" . $value['rate'] . "</font>";
$arrTmp[3] = "<font color='green'>" . $value['rate_offset'] . "</font>";
$arrTmp[4] = "<font color='green'>" . $value['hided_digits'] . "</font>";
$arrTmp[5] = "<font color='green'>*</font>";
$arrTmp[6] = "<font color='green'>" . $value['fecha_creacion'] . "</font>";
$arrTmp[7] = "<a href='?menu={$module_name}&action=view&id=" . $value['id'] . "'>" . _tr("View") . "</a>";
} else {
$arrTmp[0] = $value['prefix'];
$arrTmp[1] = $value['name'];
$arrTmp[2] = $value['rate'];
$arrTmp[3] = $value['rate_offset'];
$arrTmp[4] = $value['hided_digits'];
$arrTmp[5] = $value['trunk'];
$arrTmp[6] = $value['fecha_creacion'];
$arrTmp[7] = "<a href='?menu={$module_name}&action=view&id=" . $value['id'] . "'>" . _tr("View") . "</a>";
}
$arrData[] = $arrTmp;
}
}
// arreglo de columnas
$arrColumns = array(_tr("Prefix"), _tr("Name"), _tr("Rate"), _tr("Rate Offset"), _tr("Hidden_Digits"), _tr("Trunk"), _tr("Creation Date"), _tr("View"));
}
$oGrid->setColumns($arrColumns);
$oGrid->setData($arrData);
//begin section filter
$arrFormFilterBillingRates = createFieldFilter($arrLang);
$oFilterForm = new paloForm($smarty, $arrFormFilterBillingRates);
$smarty->assign("import_rate", _tr("import_rate"));
$smarty->assign("by_min", _tr("by_min"));
$smarty->assign("Date_close", _tr("Date close"));
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
//end section filter
$oGrid->customAction("import_rate", _tr("import_rate"));
$content = $oGrid->fetchGrid();
return $content;
//.........这里部分代码省略.........
示例13: listadoLoginLogout
function listadoLoginLogout($pDB, $smarty, $module_name, $local_templates_dir)
{
$oCalls = new paloSantoLoginLogout($pDB);
$smarty->assign(array('SHOW' => _tr('Show'), 'Filter' => _tr('Find')));
$arrFormElements = array('date_start' => array('LABEL' => _tr('Date Init'), 'REQUIRED' => 'yes', 'INPUT_TYPE' => 'DATE', 'INPUT_EXTRA_PARAM' => '', 'VALIDATION_TYPE' => 'ereg', 'VALIDATION_EXTRA_PARAM' => '^[[:digit:]]{1,2}[[:space:]]+[[:alnum:]]{3}[[:space:]]+[[:digit:]]{4}$'), 'date_end' => array('LABEL' => _tr('Date End'), 'REQUIRED' => 'yes', 'INPUT_TYPE' => 'DATE', 'INPUT_EXTRA_PARAM' => '', 'VALIDATION_TYPE' => 'ereg', 'VALIDATION_EXTRA_PARAM' => '^[[:digit:]]{1,2}[[:space:]]+[[:alnum:]]{3}[[:space:]]+[[:digit:]]{4}$'), 'detailtype' => array('LABEL' => _tr('Tipo'), 'REQUIRED' => 'no', 'INPUT_TYPE' => 'SELECT', 'INPUT_EXTRA_PARAM' => array('D' => _tr('Detallado'), 'G' => _tr('General')), 'VALIDATION_TYPE' => 'text', 'VALIDATION_EXTRA_PARAM' => ''), 'queue' => array('LABEL' => _tr('Incoming Queue'), 'REQUIRED' => 'no', 'INPUT_TYPE' => 'SELECT', 'INPUT_EXTRA_PARAM' => generarComboColasEntrantes($oCalls), 'VALIDATION_TYPE' => 'text', 'VALIDATION_EXTRA_PARAM' => '^\\d+$'));
$oFilterForm = new paloForm($smarty, $arrFormElements);
// Parámetros base y validación de parámetros
$url = array('menu' => $module_name);
$paramFiltroBase = $paramFiltro = array('date_start' => date('d M Y'), 'date_end' => date('d M Y'), 'detailtype' => 'D', 'queue' => '');
foreach (array_keys($paramFiltro) as $k) {
if (!is_null(getParameter($k))) {
$paramFiltro[$k] = getParameter($k);
}
}
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $paramFiltro);
if (!$oFilterForm->validateForm($paramFiltro)) {
$smarty->assign(array('mb_title' => _tr('Validation Error'), 'mb_message' => '<b>' . _tr('The following fields contain errors') . ':</b><br/>' . implode(', ', array_keys($oFilterForm->arrErroresValidacion))));
$paramFiltro = $paramFiltroBase;
}
// Tradudir fechas a formato ISO para comparación y para API de CDRs.
$url = array_merge($url, $paramFiltro);
$paramFiltro['date_start'] = translateDate($paramFiltro['date_start']) . ' 00:00:00';
$paramFiltro['date_end'] = translateDate($paramFiltro['date_end']) . ' 23:59:59';
// Consulta y recorte de registros
$recordset = $oCalls->leerRegistrosLoginLogout($paramFiltro['detailtype'], $paramFiltro['date_start'], $paramFiltro['date_end'], trim($paramFiltro['queue']) == '' ? NULL : $paramFiltro['queue']);
if (!is_array($recordset)) {
$smarty->assign(array('mb_title' => _tr('Query Error'), 'mb_message' => $oCalls->errMsg));
$recordset = array();
}
$oGrid = new paloSantoGrid($smarty);
$bExportando = $oGrid->isExportAction();
$oGrid->setLimit(LIMITE_PAGINA);
$oGrid->setTotal(count($recordset));
$offset = $oGrid->calculateOffset();
// Formato del arreglo de datos a mostrar
$arrData = array();
$sTagInicio = !$bExportando ? '<b>' : '';
$sTagFinal = $sTagInicio != '' ? '</b>' : '';
$recordSlice = $bExportando ? $recordset : array_slice($recordset, $offset, LIMITE_PAGINA);
foreach ($recordSlice as $tupla) {
$arrData[] = array($tupla['number'], $tupla['name'], $tupla['datetime_init'], $tupla['estado'] == 'ONLINE' ? $sTagInicio . $tupla['datetime_end'] . $sTagFinal : $tupla['datetime_end'], format_time($tupla['duration']), format_time($tupla['total_incoming']), format_time($tupla['total_outgoing']), format_time($tupla['total_incoming'] + $tupla['total_outgoing']), number_format(100.0 * ($tupla['duration'] <= 0 ? 0 : ($tupla['total_incoming'] + $tupla['total_outgoing']) / $tupla['duration']), 2), _tr($tupla['estado']));
}
// Calcular totales de pie de página
$ktotales = array('duration', 'total_incoming', 'total_outgoing');
$totales = array_combine($ktotales, array_fill(0, count($ktotales), 0));
foreach ($recordset as $tupla) {
foreach ($ktotales as $k) {
$totales[$k] += $tupla[$k];
}
}
$arrData[] = array($sTagInicio . _tr('Total') . $sTagFinal, '', '', '', $sTagInicio . format_time($totales['duration']) . $sTagFinal, $sTagInicio . format_time($totales['total_incoming']) . $sTagFinal, $sTagInicio . format_time($totales['total_outgoing']) . $sTagFinal, $sTagInicio . format_time($totales['total_incoming'] + $totales['total_outgoing']) . $sTagFinal, '', '');
$oGrid->enableExport();
$oGrid->setURL($url);
$oGrid->setData($arrData);
$arrColumnas = array(_tr('Agente'), _tr('Nombre'), _tr('Date Init'), _tr('Date End'), _tr('Total Login'), _tr('Llamadas entrantes'), _tr('Llamadas salientes'), _tr('Tiempo en Llamadas'), _tr('Service(%)'), _tr('Estado'));
$oGrid->setColumns($arrColumnas);
$oGrid->setTitle(_tr('Login Logout'));
$oGrid->pagingShow(true);
$oGrid->setNameFile_Export(_tr('Login Logout'));
$oGrid->showFilter($htmlFilter);
return $oGrid->fetchGrid();
}
示例14: reportMissedCalls
function reportMissedCalls($smarty, $module_name, $local_templates_dir, &$pDB, &$pDBACL, $pACL, $arrConf)
{
ini_set('max_execution_time', 3600);
$pCallingReport = new paloSantoMissedCalls($pDB);
$oFilterForm = new paloForm($smarty, createFieldFilter());
$filter_field = getParameter("filter_field");
$filter_value = getParameter("filter_value");
$date_start = getParameter("date_start");
$date_end = getParameter("date_end");
//begin grid parameters
$oGrid = new paloSantoGrid($smarty);
$oGrid->setTitle(_tr("Missed Calls"));
$oGrid->pagingShow(true);
// show paging section.
$oGrid->enableExport();
// enable export.
$oGrid->setNameFile_Export(_tr("Missed Calls"));
$url = array("menu" => $module_name, "filter_field" => $filter_field, "filter_value" => $filter_value);
$date_start = isset($date_start) ? $date_start : date("d M Y") . ' 00:00';
$date_end = isset($date_end) ? $date_end : date("d M Y") . ' 23:59';
$_POST['date_start'] = $date_start;
$_POST['date_end'] = $date_end;
$parmFilter = array("date_start" => $date_start, "date_end" => $date_end);
if (!$oFilterForm->validateForm($parmFilter)) {
$smarty->assign(array('mb_title' => _tr('Validation Error'), 'mb_message' => '<b>' . _tr('The following fields contain errors') . ':</b><br/>' . implode(', ', array_keys($oFilterForm->arrErroresValidacion))));
$date_start = date("d M Y") . ' 00:00';
$date_end = date("d M Y") . ' 23:59';
}
$url = array_merge($url, array('date_start' => $date_start, 'date_end' => $date_end));
$oGrid->setURL($url);
$arrColumns = array(_tr("Date"), _tr("Source"), _tr("Destination"), _tr("Time since last call"), _tr("Number of attempts"), _tr("Status"));
$oGrid->setColumns($arrColumns);
$arrData = null;
$date_start_format = date('Y-m-d H:i:s', strtotime($date_start . ":00"));
$date_end_format = date('Y-m-d H:i:s', strtotime($date_end . ":59"));
// Para usuarios que no son administradores, se restringe a los CDR de la
// propia extensión
$sExtension = $pACL->isUserAdministratorGroup($_SESSION['elastix_user']) ? '' : $pACL->getUserExtension($_SESSION['elastix_user']);
$total = $pCallingReport->getNumCallingReport($date_start_format, $date_end_format, $filter_field, $filter_value, $sExtension);
if ($oGrid->isExportAction()) {
$limit = $total;
// max number of rows.
$offset = 0;
// since the start.
$arrResult = $pCallingReport->getCallingReport($date_start_format, $date_end_format, $filter_field, $filter_value, $sExtension);
$arrData = $pCallingReport->showDataReport($arrResult, $total);
$size = count($arrData);
$oGrid->setData($arrData);
} else {
$limit = 20;
$oGrid->setLimit($limit);
$arrResult = $pCallingReport->getCallingReport($date_start_format, $date_end_format, $filter_field, $filter_value, $sExtension);
$arrData = $pCallingReport->showDataReport($arrResult, $total);
if ($pCallingReport->errMsg != '') {
$smarty->assign('mb_message', $pCallingReport->errMsg);
}
//recalculando el total para la paginación
$size = count($arrData);
$oGrid->setTotal($size);
$offset = $oGrid->calculateOffset();
//echo $size." : ".$offset;
$arrResult = $pCallingReport->getDataByPagination($arrData, $limit, $offset);
$oGrid->setData($arrResult);
}
//begin section filter
$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;
}
示例15: reportClientesagendados
function reportClientesagendados($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf)
{
$pClientesagendados = new paloSantoClientesagendados($pDB);
$filter_field = getParameter("filter_field");
$filter_value = getParameter("filter_value");
//begin grid parameters
$oGrid = new paloSantoGrid($smarty);
$oGrid->setTplFile("/var/www/html/modules/{$module_name}/themes/default/_list.tpl");
$oGrid->setTitle(_tr("Clientes agendados"));
$oGrid->pagingShow(true);
// show paging section.
$oGrid->enableExport();
// enable export.
$oGrid->setNameFile_Export(_tr("Clientes agendados"));
$url = array("menu" => $module_name, "filter_field" => $filter_field, "filter_value" => $filter_value);
$oGrid->setURL($url);
$arrColumns = array(_tr("Apellido"), _tr("Nombre"), _tr("CI"), _tr("Campaña"), _tr("Fecha de agendamiento"), _tr("Call type"), _tr("Agente agendado"), "<input class=\"button\" type=\"submit\" name=\"action\" value=\"Reasignar\">");
$oGrid->setColumns($arrColumns);
$total = $pClientesagendados->getNumClientesagendados($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 = $pClientesagendados->getClientesagendados($limit, $offset, $filter_field, $filter_value);
if (is_array($arrResult) && $total > 0) {
foreach ($arrResult as $key => $value) {
$arrTmp[0] = $value['apellido'];
$arrTmp[1] = $value['nombre'];
$arrTmp[2] = $value['ci'];
$arrTmp[3] = $value['nombre_campania'];
$arrTmp[4] = $value['fecha_agendamiento'];
$arrTmp[5] = $value['ultimo_calltype'];
$arrTmp[6] = $value['agente_agendado'];
if (empty($value['id_campania_cliente'])) {
$arrTmp[7] = getFormSelectAgentesCampaniaRecargable($pClientesagendados, $value['id_campania'], $value['id_campania_recargable_cliente'], $value['agente_agendado']);
} else {
$arrTmp[7] = getFormSelectAgentesCampania($pClientesagendados, $value['id_campania'], $value['id_campania_cliente'], $value['agente_agendado']);
}
$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;
}