function reportIVR($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials) { global $arrPermission; $error = ""; $pORGZ = new paloSantoOrganization($pDB); $domain = getParameter("organization"); $name = getParameter("name"); $domain = empty($domain) ? 'all' : $domain; if ($credentials['userlevel'] != 'superadmin') { $domain = $credentials['domain']; } $url['menu'] = $module_name; $url['organization'] = $domain; $url['name'] = $name; if ($credentials['userlevel'] == "superadmin") { if (isset($domain) && $domain != "all") { $pIVR = new paloIvrPBX($pDB, $domain); } else { $pIVR = new paloIvrPBX($pDB, ""); } $total = $pIVR->getTotalIvr($domain, $name); $arrOrgz = array("all" => _tr("all")); foreach ($pORGZ->getOrganization(array()) as $value) { $arrOrgz[$value["domain"]] = $value["name"]; } } else { $arrOrgz = array(); $pIVR = new paloIvrPBX($pDB, $domain); $total = $pIVR->getTotalIvr($domain, $name); } if ($total === false) { $error = $pIVR->errMsg; $total = 0; } $limit = 20; $oGrid = new paloSantoGrid($smarty); $oGrid->setLimit($limit); $oGrid->setTotal($total); $offset = $oGrid->calculateOffset(); $end = $offset + $limit <= $total ? $offset + $limit : $total; $oGrid->setTitle(_tr('Ivrs List')); $oGrid->setUrl($url); $oGrid->setWidth("99%"); $oGrid->setStart($total == 0 ? 0 : $offset + 1); $oGrid->setEnd($end); if ($credentials['userlevel'] == "superadmin") { $arrColumns[] = _tr("Organization"); } $arrColumns[] = _tr("Ivr Name"); $arrColumns[] = _tr("Timeout"); $arrColumns[] = _tr("Enable Call Extensions"); $arrColumns[] = _tr("# Loops"); $oGrid->setColumns($arrColumns); $arrData = array(); $arrIVR = array(); if ($total != 0) { $arrIVR = $pIVR->getIvrs($domain, $name, $limit, $offset); } if ($arrIVR === false) { $error = _tr("Error getting ivr data.") . $pIVR->errMsg; } else { foreach ($arrIVR as $ivr) { $arrTmp = array(); if ($credentials['userlevel'] == "superadmin") { $arrTmp[] = $arrOrgz[$ivr['organization_domain']]; } $arrTmp[] = " <a href='?menu={$module_name}&action=view&id_ivr=" . $ivr['id'] . "&organization={$ivr["organization_domain"]}'>" . htmlentities($ivr["name"], ENT_QUOTES, "UTF-8") . "</a>"; $arrTmp[] = $ivr["timeout"]; $arrTmp[] = $ivr["directdial"]; $arrTmp[] = $ivr["loops"]; $arrData[] = $arrTmp; } } $smarty->assign("USERLEVEL", $credentials['userlevel']); $smarty->assign("SEARCH", "<input type='submit' class='button' value='" . _tr('Search') . "' name='report'>"); if ($pORGZ->getNumOrganization(array()) >= 1) { if (in_array('create', $arrPermission)) { if ($credentials['userlevel'] == 'superadmin') { $oGrid->addComboAction("organization_add", _tr("Create New IVR"), array_slice($arrOrgz, 1), $selected = null, "create_ivr", $onchange_select = null); } else { $oGrid->addNew("create_ivr", _tr("Create New IVR")); } } if ($credentials['userlevel'] == 'superadmin') { $_POST["organization"] = $domain; $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization") . " = " . $arrOrgz[$domain], $_POST, array("organization" => _tr("all")), true); } $_POST["name"] = $name; //ivr name $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Name") . " = " . $name, $_POST, array("name" => "")); $arrFormElements = createFieldFilter($arrOrgz); $oFilterForm = new paloForm($smarty, $arrFormElements); $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST); $oGrid->showFilter(trim($htmlFilter)); } else { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", _tr("It's necesary you create at least one organization so you can use this module")); } if ($error != "") { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", $error); } $contenidoModulo = $oGrid->fetchGrid(array(), $arrData); $mensaje = showMessageReload($module_name, $pDB, $credentials); $contenidoModulo = $mensaje . $contenidoModulo; return $contenidoModulo; }
function _moduleContent(&$smarty, $module_name) { //include module files include_once "modules/{$module_name}/configs/default.conf.php"; include_once "modules/{$module_name}/libs/paloSantoCallsDetail.class.php"; include_once "modules/agent_console/getinfo.php"; global $arrConf; load_language_module($module_name); //folder path for custom templates $base_dir = dirname($_SERVER['SCRIPT_FILENAME']); $templates_dir = isset($arrConfig['templates_dir']) ? $arrConfig['templates_dir'] : 'themes'; $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme']; // added by Tri Do $sAction = getParameter('action'); switch ($sAction) { case 'viewNote': return viewNote(); break; case 'viewDelivery': return view_delivery(); break; default: break; } // Cadenas estáticas de Smarty $smarty->assign(array("Filter" => _tr('Filter'), "SHOW" => _tr("Show"))); $bElastixNuevo = method_exists('paloSantoGrid', 'setURL'); // Variables iniciales para posición de grid $offset = 0; $limit = 50; $total = 0; // Para poder consultar las colas activas $pConfig = new paloConfig("/etc", "amportal.conf", "=", "[[:space:]]*=[[:space:]]*"); $ampconfig = $pConfig->leer_configuracion(false); $ampdsn = $ampconfig['AMPDBENGINE']['valor'] . "://" . $ampconfig['AMPDBUSER']['valor'] . ":" . $ampconfig['AMPDBPASS']['valor'] . "@" . $ampconfig['AMPDBHOST']['valor'] . "/asterisk"; $oQueue = new paloQueue($ampdsn); $listaColas = $oQueue->getQueue(); if (!is_array($listaColas)) { $smarty->assign("mb_title", _tr("Error when connecting to database")); $smarty->assign("mb_message", $oQueue->errMsg); } // Para poder consultar los agentes de campañas $pDB = new paloDB($cadena_dsn); $oCallsDetail = new paloSantoCallsDetail($pDB); $listaAgentes = $oCallsDetail->getAgents(); // Para llenar el select de agentes $urlVars = array('menu' => $module_name); $arrFormElements = createFieldFilter($listaAgentes, $listaColas); $oFilterForm = new paloForm($smarty, $arrFormElements); // Validar y aplicar las variables de filtro $paramLista = NULL; $paramFiltro = array(); foreach (array('date_start', 'date_end', 'calltype', 'agent', 'queue', 'phone') as $k) { $paramFiltro[$k] = getParameter($k); } if (!isset($paramFiltro['date_start'])) { $paramFiltro['date_start'] = date("d M Y"); } if (!isset($paramFiltro['date_end'])) { $paramFiltro['date_end'] = date("d M Y"); } if (!$oFilterForm->validateForm($paramFiltro)) { // Hay un error al validar las variables del filtro $smarty->assign("mb_title", _tr("Validation Error")); $arrErrores = $oFilterForm->arrErroresValidacion; $strErrorMsg = "<b>" . _tr('The following fields contain errors') . ":</b><br>"; $strErrorMsg = implode(', ', array_keys($arrErrores)); $smarty->assign("mb_message", $strErrorMsg); } else { $urlVars = array_merge($urlVars, $paramFiltro); $paramLista = $paramFiltro; $paramLista['date_start'] = translateDate($paramFiltro['date_start']) . " 00:00:00"; $paramLista['date_end'] = translateDate($paramFiltro['date_end']) . " 23:59:59"; } $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $paramFiltro); // Inicio de objeto grilla y asignación de filtro $oGrid = new paloSantoGrid($smarty); $oGrid->enableExport(); // enable export. $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; } }
function report_TicketDelivery($smarty, $module_name, $local_templates_dir, &$pDB, $pDB_2) { $pTicket_Delivery = new Ticket_Delivery($pDB); $pACL = new paloACL($pDB_2); $img_dir = "modules/{$module_name}/images/"; // 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("Yêu cầu giao vé"); $oGrid->setTableName("delivery_grid"); $oGrid->pagingShow(true); // show paging section. $oGrid->enableExport(); // enable export. $oGrid->setNameFile_Export("ticket_delivery"); $url = array("menu" => $module_name); $oGrid->setURL($url); $arrColumns = array("ID", "Tên Khách Hàng", "Số điện thoại", "Booker", "Địa chỉ", "Tiền trả", "Mã số vé", "Tình trạng", "Nhân viên giao", "Ngày phân công", "Vé đính kèm", "Ngày nhận tiền", "Xử lý", "Chi tiết", " "); $oGrid->setColumns($arrColumns); $total = $pTicket_Delivery->getNumTicket_Delivery($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 = $pTicket_Delivery->getTicket_Delivery($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]; // show files $download = ''; foreach ($value['ticket_attachment'] as $row) { $url = "/modules/agent_console/ajax-attachments-handler.php?download=" . $row['filepath'] . "&name=" . $row['filename']; $filename = $row['filename']; $download .= "*<a href='{$url}' target='_blank' title='{$filename}'>" . shorten($filename) . "</a><br/>"; } $print = '<a href="javascript:void(0)" onclick="print(\'' . $value['id'] . '\')"><img src="' . $img_dir . 'print.png" title="In phiếu"></a>'; $enable = $value['isActive'] == '1' ? '<a href="javascript:void(0)" onclick="disable(\'' . $value['id'] . '\')"><img src="' . $img_dir . 'disable.png" title="Hủy yêu cầu giao vé"></a> ' : ' <a href="javascript:void(0)" onclick="enable(\'' . $value['id'] . '\')"><img src="' . $img_dir . 'enable.png" title="Tạo lại yêu cầu giao vé"></a>'; $print .= ' ' . $enable; // function show base on status if ($value['isActive'] == '0') { $value['status'] = 'Đã hủy'; } switch ($value['status']) { case 'Mới': $function = '<a href="javascript:void(1)" onclick="assign_form(\'' . $value['id'] . '\')"><img src="' . $img_dir . 'assign.png" title="Phân công"></a>'; break; case 'Đang giao': $function = '<a href="javascript:void(1)" onclick="assign_form(\'' . $value['id'] . '\')"><img src="' . $img_dir . 'assign.png" title="Đổi phân công"></a> <a href="javascript:void(1)" onclick="collect_form(\'' . $value['id'] . '\',\'' . $elastix_user . '\')"><img src="' . $img_dir . 'result.png" title="Kết quả"></a>'; break; case 'Đã nhận tiền': $function = '<a href="javascript:void(1)" onclick="uncollect_form(\'' . $value['id'] . '\',\'' . $elastix_user . '\')"><img src="' . $img_dir . 'unpaid.png" title="Hủy nhận tiền"></a>'; break; case 'Chờ xử lý': $function = '<a href="javascript:void(1)" onclick="assign_form(\'' . $value['id'] . '\')"><img src="' . $img_dir . 'assign.png" title="Phân công"></a>'; break; default: $function = ''; } // show ticket code 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] = '<span title="Chi nhánh: ' . $value['office'] . '">' . $value['agent_name'] . '</span>'; $arrTmp[4] = '<a href="javascript:void(1)" title="' . $value['deliver_address'] . '" onclick="view_address(\'' . $value['deliver_address'] . '\')">' . shorten($value['deliver_address']) . ' </a>'; $arrTmp[5] = $value['pay_amount']; $arrTmp[6] = $ticket; $arrTmp[7] = showStatus($value['status']); $arrTmp[8] = $value['delivery_name']; $arrTmp[9] = is_null($value['delivery_date']) ? '' : date("d-m-Y H:m:s", strtotime($value['delivery_date'])); $arrTmp[10] = $download; $arrTmp[11] = is_null($value['collection_date']) ? '' : date("d-m-Y H:m:s", strtotime($value['collection_date'])); $arrTmp[12] = $function; $arrTmp[13] = '<a href="javascript:void(1)" onclick="view_log(\'' . $value['id'] . '\')"> <img src="' . $img_dir . 'extra.png" title="Xem chi tiết"></a>'; $arrTmp[14] = $print; $arrData[] = $arrTmp; } } $oGrid->setData($arrData); //begin section filter $oFilterForm = new paloForm($smarty, createFieldFilter()); // get delivery man list $delivery_man_list = $pTicket_Delivery->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; }
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; }
function reportGroup($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $userLevel1, $userAccount, $idOrganization) { $pACL = new paloACL($pDB); $pORGZ = new paloSantoOrganization($pDB); $idOrgFil = getParameter("idOrganization"); if ($userLevel1 == "superadmin") { if (!empty($idOrgFil)) { $cntGroups = $pACL->getNumGroups($idOrgFil); } else { $idOrgFil = 0; //opcion default se muestran todos los grupos $cntGroupsMO = $pACL->getNumGroups(1); //obtenemos en numero de grupos que pertenecen a //la organizacion 1 y lo restamos del total de grupos $cntGroups = $pACL->getNumGroups() - $cntGroupsMO; } } else { $idOrgFil = $idOrganization; $cntGroups = $pACL->getNumGroups($idOrganization); } if ($cntGroups === false) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr($pACL->errMsg)); $total = 0; } else { $total = $cntGroups; } //url $url['menu'] = $module_name; $url['idOrganization'] = $idOrgFil; $total = $total == NULL ? 0 : $total; $limit = 20; $oGrid = new paloSantoGrid($smarty); $oGrid->setLimit($limit); $oGrid->setTotal($total); $offset = $oGrid->calculateOffset(); $end = $oGrid->getEnd(); $oGrid->setURL($url); $oGrid->setTitle(_tr('Group List')); $oGrid->setIcon("web/apps/{$module_name}/images/system_groups.png"); $oGrid->setURL($url); $oGrid->setWidth("99%"); $oGrid->setStart($total == 0 ? 0 : $offset + 1); $oGrid->setEnd($end); if ($userLevel1 == "superadmin") { $arrColumns[] = _tr("Organization"); } $arrColumns[] = _tr("Group Name"); $arrColumns[] = _tr("Group Description"); $oGrid->setColumns($arrColumns); if ($idOrgFil != 0) { $Groups = $pACL->getGroupsPaging($limit, $offset, $idOrgFil); } else { $Groups = $pACL->getGroupsPaging($limit, $offset); } $arrData = array(); foreach ($Groups as $group) { if ($group[3] != 1) { $arrTmp = array(); if ($userLevel1 == "superadmin") { $orgz = $pORGZ->getOrganizationById($group[3]); $arrTmp[] = htmlentities($orgz["name"], ENT_COMPAT, 'UTF-8'); //organization } $arrTmp[] = " <a href='?menu=grouplist&action=view&id=" . $group[0] . "'>" . $group[1] . "</a>"; //id,group name $arrTmp[] = _tr($group[2]); //description $arrData[] = $arrTmp; } } if ($pORGZ->getNumOrganization(array()) > 0) { global $arrPermission; if (in_array('create_group', $arrPermission)) { $oGrid->addNew("create_group", _tr("Create New Group")); } if ($userLevel1 == "superadmin") { $arrOrgz = array(0 => _tr("all")); foreach ($pORGZ->getOrganization(array()) as $value) { if ($value["id"] != 1) { $arrOrgz[$value["id"]] = $value["name"]; } } $arrFormElements = createFieldFilter($arrOrgz); $oFilterForm = new paloForm($smarty, $arrFormElements); $_POST["idOrganization"] = $idOrgFil; $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization") . " = " . $arrOrgz[$idOrgFil], $_POST, array("idOrganization" => 0), true); $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST); $oGrid->showFilter(trim($htmlFilter)); } } else { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("You need have created at least one organization before you can create a new group")); } $contenidoModulo = $oGrid->fetchGrid(array(), $arrData); return $contenidoModulo; }
function reportReportedeCalltypes($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf) { $pReportedeCalltypes = new paloSantoReportedeCalltypes($pDB); $filter_field = getParameter("filter_field"); $filter_value = getParameter("filter_value"); $id_campania = getParameter("id_campania"); $filter_field_adicional = getParameter("adicionales"); $filter_value_adicional = getParameter("filtro_adicional"); //begin grid parameters $oGrid = new paloSantoGrid($smarty); $oGrid->setTitle(_tr("Reporte Ultima Gestion Recargables")); $oGrid->pagingShow(true); // show paging section. $oGrid->enableExport(); // enable export. $oGrid->setNameFile_Export(_tr("Reporte Ultima Gestion Recargables")); $url = array("menu" => $module_name, "filter_field" => $filter_field, "filter_value" => $filter_value, "id_campania" => $id_campania, "adicionales" => $filter_field_adicional, "filtro_adicional" => $filter_value_adicional); $oGrid->setURL($url); // Columnas base $arrColumns = array(_tr("Fecha"), _tr("Hora"), _tr("Campaña"), _tr("Base"), _tr("Cliente"), _tr("CI"), _tr("Teléfono"), _tr("Agente"), _tr("Contactabilidad"), _tr("Calltype"), _tr("Provincia"), _tr("Ciudad"), _tr("Nacimiento"), _tr("Correo Personal"), _tr("Correo Trabajo"), _tr("Estado Civil"), _tr("Formulario")); // Otras columnas if ($id_campania != "") { // Columnas adicionales $arrColumnasAdicionales = $pReportedeCalltypes->getColumnasAdicionales($id_campania); $arrColumns = array_merge($arrColumns, $arrColumnasAdicionales); $smarty->assign("mostrarAdicional", "si"); $smarty->assign("filtro_adicionales", filter_adicionales($arrColumnasAdicionales, null)); // Columnas de gestión $arrTmp = $pReportedeCalltypes->getFormFields($id_campania); $i = 0; foreach ($arrTmp as $formField) { $arrOrden[] = $formField['id']; $arrColumnsAdicionales[$i] = $formField['etiqueta']; $i++; } $arrColumns = array_merge($arrColumns, $arrColumnsAdicionales); } $oGrid->setColumns($arrColumns); $total = $pReportedeCalltypes->getNumReportedeCalltypes($filter_field, $filter_value, $id_campania, $filter_field_adicional, $filter_value_adicional); $arrData = null; if ($oGrid->isExportAction()) { $limit = $total; // max number of rows. $offset = 0; // since the start. } else { $limit = 20; // default 20 $oGrid->setLimit($limit); $oGrid->setTotal($total); $offset = $oGrid->calculateOffset(); } $arrResult = $pReportedeCalltypes->getReportedeCalltypes($limit, $offset, $filter_field, $filter_value, $id_campania, $filter_field_adicional, $filter_value_adicional); if (is_array($arrResult) && $total > 0) { foreach ($arrResult as $key => $value) { $fecha = date("Y-m-d", strtotime($value['fecha'])); $hora = date("H:i:s", strtotime($value['fecha'])); $arrTmp[0] = $fecha; $arrTmp[1] = $hora; $arrTmp[2] = $value['campania']; $arrTmp[3] = $value['base']; $arrTmp[4] = $value['cliente']; $arrTmp[5] = $value['ci']; $arrTmp[6] = $value['telefono']; $arrTmp[7] = $value['agente']; $arrTmp[8] = $value['contactabilidad']; $arrTmp[9] = $value['calltype']; $arrTmp[10] = $value['provincia']; $arrTmp[11] = $value['ciudad']; $arrTmp[12] = $value['nacimiento']; $arrTmp[13] = $value['correo_personal']; $arrTmp[14] = $value['correo_trabajo']; $arrTmp[15] = $value['estado_civil']; // $arrTmp[8] = $value['formulario']; // Así lo requiere RUBENING $arrTmp[16] = "<a href=modules/{$module_name}/gestion_info.php?id_gestion={$value['id_gestion']} target=\"_blank\" onClick=\"window.open(this.href, this.target, 'width=600,height=400'); return false;\">Ver gestión</a>" . "<br>" . "<a href=modules/{$module_name}/gestion_edit.php?id_gestion={$value['id_gestion']}&user="******"elastix_user"] . " target=\"_blank\" onClick=\"window.open(this.href, this.target, 'width=600,height=400,scrollbars=1'); return false;\">Editar</a>"; // Datos adicionales $arrDatosAdicionales = $pReportedeCalltypes->getDatosAdicionales($value['id_cliente'], $value['id_base']); $i = 17; foreach ($arrColumnasAdicionales as $k => $columnaAdicional) { $arrTmp[$i] = $arrDatosAdicionales[$columnaAdicional]; $i++; } unset($arrDatosAdicionales); $numColumnasFijas = $i; // Datos de gestión $arrFormValues = $pReportedeCalltypes->getFormValues($value['id_gestion']); // array_search retorna el key dado el valor a buscar foreach ($arrFormValues as $formValue) { // echo $formValue['valor'] . " " . array_search($formValue['id_form_field'],$arrOrden) . "<br>"; $ubicacionReal = array_search($formValue['id_form_field'], $arrOrden) + $numColumnasFijas; if (is_array($formValue['valor'])) { $formValue['valor'] = print_r($formValue['valor'], true); } $arrTmp[$ubicacionReal] = $formValue['valor']; } $arrData[] = $arrTmp; unset($arrTmp); } } $oGrid->setData($arrData); /* Para colocar en $arrTmp */ //begin section filter $oFilterForm = new paloForm($smarty, createFieldFilter()); $smarty->assign("SHOW", _tr("Show")); $smarty->assign("filter_campaign", filter_campaign($pDB, $id_campania)); $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST); //end section filter $oGrid->showFilter(trim($htmlFilter)); $content = $oGrid->fetchGrid(); //end grid parameters return $content; }
function reportANI($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials) { global $arrPermission; $error = ""; $smarty->assign("SHOW_DIV_ERROR", "0"); //FIXED: can show div error message with javascript $smarty->assign("mb_message", "hide"); //FIXED: can show div error message with javascript $pORGZ = new paloSantoOrganization($pDB); $domain = getParameter("organization"); $domain = empty($domain) ? 'all' : $domain; if ($credentials['userlevel'] != "superadmin") { $domain = $credentials['domain']; } $ani_prefix = getParameter("ani_prefix"); $pANI = new paloSantoANI($pDB, $domain); $url['menu'] = $module_name; $url['organization'] = $domain; $url['ani_prefix'] = $ani_prefix; $total = $pANI->getNumANI($domain, $ani_prefix); $arrOrgz = array(); if ($credentials['userlevel'] == "superadmin") { $arrOrgz = array("all" => _tr("all")); foreach ($pORGZ->getOrganization(array()) as $value) { $arrOrgz[$value["domain"]] = $value["name"]; } } if ($total === false) { $error = $pANI->errMsg; $total = 0; } $limit = 20; $oGrid = new paloSantoGrid($smarty); $oGrid->setLimit($limit); $oGrid->setTotal($total); $offset = $oGrid->calculateOffset(); $end = $offset + $limit <= $total ? $offset + $limit : $total; $oGrid->setTitle(_tr('ANI List')); $oGrid->setWidth("99%"); $oGrid->setStart($total == 0 ? 0 : $offset + 1); $oGrid->setEnd($end); $oGrid->setTotal($total); $oGrid->setURL($url); $arrColum = array(); if ($credentials['userlevel'] == "superadmin") { $arrColum[] = _tr("Organization"); } $arrColum[] = _tr("Trunk Name"); $arrColum[] = _tr("Prefix ANI"); $oGrid->setColumns($arrColum); $arrANI = array(); $arrData = array(); if ($total != 0) { $arrANI = $pANI->getANI($domain, $ani_prefix, $limit, $offset); } if ($arrANI === false) { $error = _tr("Error to obtain ANI") . $pANI->errMsg; $arrANI = array(); } if ($error != "") { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", $error); $smarty->assign("SHOW_DIV_ERROR", "1"); } foreach ($arrANI as $row) { $arrTmp = array(); if ($credentials['userlevel'] == "superadmin") { $arrTmp[] = $arrOrgz[$row["organization_domain"]]; } $arrTmp[] = $row["name"]; $arrTmp[] = "<input type='text' style='width:60px; text-align:center;' id='text#{$row['organization_domain']}#{$row['trunkid']}' value='{$row['ani_prefix']}' /> \n <input type='button' id='button#{$row['organization_domain']}#{$row['trunkid']}' value='" . _tr("Save") . "' />"; $arrData[] = $arrTmp; } $smarty->assign("USERLEVEL", $credentials['userlevel']); $smarty->assign("SEARCH", "<input type='submit' class='button' value='" . _tr('Search') . "' name='report'>"); if ($pORGZ->getNumOrganization(array()) == 0) { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", _tr("It's necesary you create at least one organization so you can use this module")); $smarty->assign("SHOW_DIV_ERROR", "1"); } if ($credentials['userlevel'] == 'superadmin') { $_POST["organization"] = $domain; $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization") . " = " . $arrOrgz[$domain], $_POST, array("organization" => "all"), true); } $_POST["ani_prefix"] = $ani_prefix; $oGrid->addFilterControl(_tr("Filter applied ") . _tr("ANI Prefix") . " = " . $ani_prefix, $_POST, array("ani_prefix" => "")); $arrFormElements = createFieldFilter($arrOrgz); $oFilterForm = new paloForm($smarty, $arrFormElements); $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST); $oGrid->showFilter(trim($htmlFilter)); return $oGrid->fetchGrid(array(), $arrData); }
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; }
function reportMonitoring($smarty, $module_name, $local_templates_dir, &$pDB, $pACL, $arrConf, $user, $extension, $esAdministrador) { $pMonitoring = new paloSantoMonitoring($pDB); //var_dump($arrConfg); $pMonitoring->setConfig($arrConf); $filter_field = getParameter("filter_field"); switch ($filter_field) { case "dst": $filter_field = "dst"; $nameFilterField = _tr("Destination"); break; case "userfield": $filter_field = "userfield"; $nameFilterField = _tr("Type"); break; default: $filter_field = "src"; $nameFilterField = _tr("Source"); break; } if ($filter_field == "userfield") { $filter_value = getParameter("filter_value_userfield"); $filter = ""; $filter_userfield = $filter_value; } else { $filter_value = getParameter("filter_value"); $filter = $filter_value; $filter_userfield = ""; } switch ($filter_value) { case "outgoing": $smarty->assign("SELECTED_2", "Selected"); $nameFilterUserfield = _tr("Outgoing"); break; case "queue": $smarty->assign("SELECTED_3", "Selected"); $nameFilterUserfield = _tr("Queue"); break; case "group": $smarty->assign("SELECTED_4", "Selected"); $nameFilterUserfield = _tr("Group"); break; default: $smarty->assign("SELECTED_1", "Selected"); $nameFilterUserfield = _tr("Incoming"); break; } $date_ini = getParameter("date_start"); $date_end = getParameter("date_end"); $path_record = $arrConf['records_dir']; $_POST['date_start'] = isset($date_ini) ? $date_ini : date("d M Y"); $_POST['date_end'] = isset($date_end) ? $date_end : date("d M Y"); if ($date_ini === "") { $_POST['date_start'] = " "; } if ($date_end === "") { $_POST['date_end'] = " "; } if (!empty($pACL->errMsg)) { echo "ERROR DE ACL: {$pACL->errMsg} <br>"; } $date_initial = date('Y-m-d', strtotime($_POST['date_start'])) . " 00:00:00"; $date_final = date('Y-m-d', strtotime($_POST['date_end'])) . " 23:59:59"; $_DATA = $_POST; //begin grid parameters $oGrid = new paloSantoGrid($smarty); $oGrid->setTitle(_tr("Monitoring")); $oGrid->setIcon("modules/{$module_name}/images/pbx_monitoring.png"); $oGrid->pagingShow(true); // show paging section. $oGrid->enableExport(); // enable export. $oGrid->setNameFile_Export(_tr("Monitoring")); if ($esAdministrador) { $totalMonitoring = $pMonitoring->getNumMonitoring($filter_field, $filter_value, null, $date_initial, $date_final); } elseif (!($extension == "" || is_null($extension))) { $totalMonitoring = $pMonitoring->getNumMonitoring($filter_field, $filter_value, $extension, $date_initial, $date_final); } else { $totalMonitoring = 0; } $url = array('menu' => $module_name); $paramFilter = array('filter_field' => $filter_field, 'filter_value' => $filter, 'filter_value_userfield' => $filter_userfield, 'date_start' => $_POST['date_start'], 'date_end' => $_POST['date_end']); $url = array_merge($url, $paramFilter); $oGrid->setURL($url); $arrData = null; if ($oGrid->isExportAction()) { $limit = $totalMonitoring; $offset = 0; $arrColumns = array(_tr("Date"), _tr("Time"), _tr("Source"), _tr("Destination"), _tr("Duration"), _tr("Type"), _tr("File")); $oGrid->setColumns($arrColumns); if ($esAdministrador) { $arrResult = $pMonitoring->getMonitoring($limit, $offset, $filter_field, $filter_value, null, $date_initial, $date_final); } elseif (!($extension == "" || is_null($extension))) { $arrResult = $pMonitoring->getMonitoring($limit, $offset, $filter_field, $filter_value, $extension, $date_initial, $date_final); } else { $arrResult = array(); } if (is_array($arrResult) && $totalMonitoring > 0) { foreach ($arrResult as $key => $value) { $arrTmp[0] = date('d M Y', strtotime($value['calldate'])); $arrTmp[1] = date('H:i:s', strtotime($value['calldate'])); $arrTmp[2] = $value['src']; $arrTmp[3] = $value['dst']; $arrTmp[4] = $value['dstchannel']; $arrTmp[5] = SecToHHMMSS($value['duration']); $file = $value['uniqueid']; $namefile = basename($value['userfield']); $namefile = str_replace("audio:", "", $namefile); if ($namefile == 'deleted') { $arrTmp[6] = _tr('Deleted'); } else { switch ($namefile[0]) { case "O": $arrTmp[6] = _tr("Outgoing"); break; case "g": $arrTmp[6] = _tr("Group"); break; case "q": $arrTmp[6] = _tr("Queue"); break; default: $arrTmp[6] = _tr("Incoming"); break; } } $arrTmp[7] = $namefile; $arrTmp[8] = $value['note']; $arrTmp[9] = $value['delivery_id']; $arrData[] = $arrTmp; } } } else { $limit = 20; $total = $totalMonitoring; $oGrid->setLimit($limit); $oGrid->setTotal($total); $offset = $oGrid->calculateOffset(); if ($esAdministrador) { $oGrid->deleteList(_tr("message_alert"), 'submit_eliminar', _tr("Delete")); $buttonDelete = ""; } else { $buttonDelete = ""; } $arrColumns = array($buttonDelete, "Ngày", "Giờ", "Gọi từ", "Gọi đến", "Nhân viên/PSTN", "Thời gian gọi", "Loại", "Ghi âm", "Nội dung", "Giao vé"); $oGrid->setColumns($arrColumns); if ($esAdministrador) { $arrResult = $pMonitoring->getMonitoring($limit, $offset, $filter_field, $filter_value, null, $date_initial, $date_final); } elseif (!($extension == "" || is_null($extension))) { $arrResult = $pMonitoring->getMonitoring($limit, $offset, $filter_field, $filter_value, $extension, $date_initial, $date_final); } else { $arrResult = array(); } if (is_array($arrResult) && $total > 0) { $src = ""; $dst = ""; foreach ($arrResult as $key => $value) { if ($esAdministrador) { $arrTmp[0] = "<input type='checkbox' name='id_" . $value['uniqueid'] . "' />"; } else { $arrTmp[0] = ""; } $arrTmp[1] = date('d M Y', strtotime($value['calldate'])); $arrTmp[2] = date('H:i:s', strtotime($value['calldate'])); if (!isset($value['src']) || $value['src'] == "") { $src = "<font color='gray'>" . _tr("unknown") . "</font>"; } else { $src = $value['src']; } if (!isset($value['dst']) || $value['dst'] == "") { $dst = "<font color='gray'>" . _tr("unknown") . "</font>"; } else { $dst = $value['dst']; } $arrTmp[3] = $src; $arrTmp[4] = $dst; $arrTmp[5] = channel_lookup($pDB, $value['dstchannel']); $arrTmp[6] = "<label title='" . $value['duration'] . " seconds' style='color:green'>" . SecToHHMMSS($value['duration']) . "</label>"; //$file = base64_encode($value['userfield']); $file = $value['uniqueid']; $namefile = basename($value['userfield']); $namefile = str_replace("audio:", "", $namefile); if ($namefile == 'deleted') { $arrTmp[7] = _tr('Deleted'); } else { switch ($namefile[0]) { case "O": $arrTmp[7] = _tr("Outgoing"); break; case "g": $arrTmp[7] = _tr("Group"); break; case "q": $arrTmp[7] = _tr("Queue"); break; default: $arrTmp[7] = _tr("Incoming"); break; } } if ($namefile != 'deleted') { $recordingLink = "<a href=\"javascript:popUp('index.php?menu={$module_name}&action=display_record&id={$file}&namefile={$namefile}&rawmode=yes',350,100);\">" . _tr("Listen") . "</a> "; $recordingLink .= "<a href='?menu={$module_name}&action=download&id={$file}&namefile={$namefile}&rawmode=yes' >" . _tr("Download") . "</a>"; } else { $recordingLink = ''; } $arrTmp[8] = $recordingLink; $arrTmp[9] = is_null($value['note_id']) ? '-' : '<a href="javascript:void(0)" onclick="view_note(\'' . $value['note_id'] . '\')">Xem</a>'; $arrTmp[10] = is_null($value['delivery_id']) ? '-' : '<a href="javascript:void(0)" onclick="view_delivery(\'' . $value['delivery_id'] . '\')">Xem</a>'; $arrData[] = $arrTmp; } } } $oGrid->setData($arrData); //begin section filter $arrFormFilterMonitoring = createFieldFilter(); $oFilterForm = new paloForm($smarty, $arrFormFilterMonitoring); $smarty->assign("INCOMING", _tr("Incoming")); $smarty->assign("OUTGOING", _tr("Outgoing")); $smarty->assign("QUEUE", _tr("Queue")); $smarty->assign("GROUP", _tr("Group")); $smarty->assign("SHOW", _tr("Show")); $_POST["filter_field"] = $filter_field; $_POST["filter_value"] = $filter; $_POST["filter_value_userfield"] = $filter_userfield; $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Start Date") . " = " . $paramFilter['date_start'] . ", " . _tr("End Date") . " = " . $paramFilter['date_end'], $paramFilter, array('date_start' => date("d M Y"), 'date_end' => date("d M Y")), true); if ($filter_field == "userfield") { $oGrid->addFilterControl(_tr("Filter applied ") . " {$nameFilterField} = {$nameFilterUserfield}", $_POST, array('filter_field' => "src", 'filter_value_userfield' => "incoming")); } else { $oGrid->addFilterControl(_tr("Filter applied ") . " {$nameFilterField} = {$filter}", $_POST, array('filter_field' => "src", "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; }
function reportExten($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials) { global $arrPermission; $pExten = new paloSantoExtensions($pDB); $pORGZ = new paloSantoOrganization($pDB); $error = ''; $domain = getParameter("organization"); $domain = empty($domain) ? 'all' : $domain; if ($credentials['userlevel'] != "superadmin") { $domain = $credentials['domain']; } $extension = getParameter("extension"); if (isset($extension) && $extension != '') { $pPBX = new paloAsteriskDB($pDB); $expression = $pPBX->getRegexPatternFromAsteriskPattern($extension); if ($expression === false) { $extension = ''; } } $url['menu'] = $module_name; $url['organization'] = $domain; $url['extension'] = $extension; $total = $pExten->getNumExtensions($domain, $extension); $arrOrgz = array(); if ($credentials['userlevel'] == "superadmin") { $arrOrgz = array("all" => _tr("all")); foreach ($pORGZ->getOrganization(array()) as $value) { $arrOrgz[$value["domain"]] = $value["name"]; } } if ($total === false) { $error = $pExten->errMsg; $total = 0; } $limit = 20; $oGrid = new paloSantoGrid($smarty); $oGrid->setLimit($limit); $oGrid->setTotal($total); $offset = $oGrid->calculateOffset(); $end = $offset + $limit <= $total ? $offset + $limit : $total; $oGrid->setTitle(_tr('Extensions List')); //$oGrid->setIcon('url de la imagen'); $oGrid->setWidth("99%"); $oGrid->setStart($total == 0 ? 0 : $offset + 1); $oGrid->setEnd($end); $oGrid->setTotal($total); $oGrid->setURL($url); if ($credentials['userlevel'] == "superadmin") { $arrColum[] = _tr("Organization"); } $arrColum[] = _tr("Extension"); $arrColum[] = _tr("Caller ID"); $arrColum[] = _tr("Technology"); $arrColum[] = _tr("Device"); $arrColum[] = _tr("Context"); $arrColum[] = _tr("User"); $arrColum[] = _tr("Voicemail"); $arrColum[] = _tr("Recording In") . " / " . _tr("Recording Out"); $oGrid->setColumns($arrColum); $arrExtens = array(); $arrData = array(); if ($total != 0) { $arrExtens = $pExten->getExtensions($domain, $extension, $limit, $offset); } if ($arrExtens === false) { $error = _tr("Error to obtain extensions") . $pExten->errMsg; $arrExtens = array(); } else { foreach ($arrExtens as $exten) { $arrTmp = array(); if ($credentials['userlevel'] == "superadmin") { $arrTmp[] = $arrOrgz[$exten["organization_domain"]]; } $arrTmp[] = " <a href='?menu=extensions&action=view&id_exten=" . $exten['id'] . "&organization={$exten['organization_domain']}'>" . $exten["exten"] . "</a>"; $arrTmp[] = $exten['clid_name'] . " <{$exten['clid_number']}>"; $arrTmp[] = strtoupper($exten['tech']); $arrTmp[] = $exten['device']; $arrTmp[] = $exten['context']; $query = "Select username from acl_user where extension=? and id_group in (select g.id from acl_group g join organization o on g.id_organization=o.id where o.domain=?)"; $result = $pDB->getFirstRowQuery($query, false, array($exten["exten"], $exten["organization_domain"])); if ($result != false) { $arrTmp[] = $result[0]; } else { $arrTmp[] = _tr("Nobody"); } if (isset($exten["voicemail"])) { if ($exten["voicemail"] != "novm") { $arrTmp[] = "yes"; } else { $arrTmp[] = "no"; } } else { $arrTmp[] = "no"; } $arrTmp[] = _tr($exten["record_in"]) . " / " . _tr($exten["record_out"]); $arrData[] = $arrTmp; } } $smarty->assign("USERLEVEL", $credentials['userlevel']); $smarty->assign("SEARCH", "<input type='submit' class='button' value='" . _tr('Search') . "' name='report'>"); if ($pORGZ->getNumOrganization(array()) >= 1) { if (in_array('create', $arrPermission)) { if ($credentials['userlevel'] == 'superadmin') { $oGrid->addComboAction("organization_add", _tr("Create New Extension"), array_slice($arrOrgz, 1), $selected = null, "create_exten", $onchange_select = null); } else { $oGrid->addNew("create_exten", _tr("Create New Extension")); } } if ($credentials['userlevel'] == 'superadmin') { $_POST["organization"] = $domain; $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization") . " = " . $arrOrgz[$domain], $_POST, array("organization" => "all"), true); } $_POST["extension"] = $extension; // patter to filter estension number $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Extension") . " = " . $extension, $_POST, array("extension" => "")); $arrFormElements = createFieldFilter($arrOrgz); $oFilterForm = new paloForm($smarty, $arrFormElements); $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST); $oGrid->showFilter(trim($htmlFilter)); } else { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", _tr("It's necesary you create at least one organization so you can use this module")); } if ($error != "") { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", $error); } $contenidoModulo = $oGrid->fetchGrid(array(), $arrData); $mensaje = showMessageReload($module_name, $pDB, $credentials); $contenidoModulo = $mensaje . $contenidoModulo; return $contenidoModulo; }
function reportOutbound($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials, $reorderRoute = false) { global $arrPermission; $pORGZ = new paloSantoOrganization($pDB); $error = ""; $arrOrgz = array(); $domain = getParameter("organization"); $name = getParameter("name"); // outbound name $domain = empty($domain) ? 'all' : $domain; if ($credentials['userlevel'] != "superadmin") { $domain = $credentials['domain']; } $url['menu'] = $module_name; $url['organization'] = $domain; $url['name'] = $name; if ($credentials['userlevel'] == "superadmin") { if (isset($domain) && $domain != "all") { $pOutbound = new paloSantoOutbound($pDB, $domain); } else { $pOutbound = new paloSantoOutbound($pDB, ""); } $total = $pOutbound->getNumOutbound($domain, $name); $arrOrgz = array("all" => _tr("all")); foreach ($pORGZ->getOrganization(array()) as $value) { $arrOrgz[$value["domain"]] = $value["name"]; } } else { $pOutbound = new paloSantoOutbound($pDB, $domain); $total = $pOutbound->getNumOutbound($domain, $name); } if ($total === false) { $error = $pOutbound->errMsg; $total = 0; } $limit = 20; $oGrid = new paloSantoGrid($smarty); $oGrid->setLimit($limit); $oGrid->setTotal($total); $offset = $oGrid->calculateOffset(); $end = $offset + $limit <= $total ? $offset + $limit : $total; $arrGrid = array("title" => _tr('Outbound Routes List'), "url" => $url, "width" => "99%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total); $arrColumns = array(); $arrColumns[] = _tr("Order"); $arrColumns[] = _tr("Route Name"); if ($credentials['userlevel'] == "superadmin") { $arrColumns[] = _tr("Organization"); } $arrColumns[] = _tr("Route CID"); $arrColumns[] = _tr("Route Password"); $arrColumns[] = _tr("Time Group"); $oGrid->setColumns($arrColumns); $arrOutbound = array(); $arrData = array(); if ($total != 0) { $arrOutbound = $pOutbound->getOutbounds($domain, $name, $limit, $offset); } if ($arrOutbound === false) { $error = _tr("Error to obtain outbounds") . $pOutbound->errMsg; $arrOutbound = array(); } $create = in_array('create', $arrPermission); $edit = in_array('edit', $arrPermission); foreach ($arrOutbound as $outbound) { $arrTmp = array(); if ($edit) { $arrTmp[] = fieldOrden($arrOutbound, $outbound["seq"], $outbound["id"], $outbound["organization_domain"]); } else { $arrTmp[] = $outbound["seq"]; } $arrTmp[] = " <a href='?menu=outbound_route&action=view&id_outbound=" . $outbound['id'] . "&organization={$outbound["organization_domain"]}'>" . htmlentities($outbound['routename'], ENT_QUOTES, "UTF-8") . "</a>"; if ($credentials['userlevel'] == "superadmin") { $arrTmp[] = $arrOrgz[$outbound["organization_domain"]]; } $arrTmp[] = $outbound["outcid"]; $arrTmp[] = $outbound["routepass"]; if (isset($outbound["time_group_id"])) { $query = "SELECT name from time_group where id=?"; $result = $pDB->getFirstRowQuery($query, true, array($outbound["time_group_id"])); if ($result != false) { $arrTmp[] = $result["name"]; } else { $arrTmp[] = ""; } } $arrData[] = $arrTmp; } $smarty->assign("USERLEVEL", $credentials['userlevel']); $smarty->assign("SEARCH", "<input type='submit' class='button' value='" . _tr('Search') . "' name='report'>"); if ($pORGZ->getNumOrganization(array()) >= 1) { if (in_array('create', $arrPermission)) { if ($credentials['userlevel'] == 'superadmin') { $oGrid->addComboAction("organization_add", _tr("ADD Outbound Route"), array_slice($arrOrgz, 1), $selected = null, "create_outbound", $onchange_select = null); } else { $oGrid->addNew("create_outbound", _tr("ADD Outbound Route")); } } if ($credentials['userlevel'] == "superadmin") { $_POST["organization"] = $domain; $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization") . " = " . $arrOrgz[$domain], $_POST, array("organization" => "all"), true); } $_POST["name"] = $name; //outbound_route name $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Name") . " = " . $name, $_POST, array("name" => "")); $arrFormElements = createFieldFilter($arrOrgz); $oFilterForm = new paloForm($smarty, $arrFormElements); $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST); $oGrid->showFilter(trim($htmlFilter)); } else { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", _tr("It's necesary you create at least one organization so you can use this module")); } if ($error != "") { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", $error); } $contenidoModulo = $oGrid->fetchGrid($arrGrid, $arrData); $mensaje = showMessageReload($module_name, $pDB, $credentials); $contenidoModulo = $mensaje . $contenidoModulo; return $contenidoModulo; }
function report_AccessAudit($smarty, $module_name, $local_templates_dir) { global $arrPermission; $pAccessLogs = new paloSantoAccessaudit(); $listaFechas = $pAccessLogs->astLog->listarFechas(); $arrFormElements = createFieldFilter($listaFechas); $field_pattern = getParameter("filter"); $busqueda = getParameter('busqueda'); $sUltimaBusqueda = getParameter('ultima_busqueda'); $iUltimoOffset = getParameter('ultimo_offset'); if (is_null($busqueda) || trim($busqueda) == '') { $busqueda = ''; } if ($busqueda != '') { $_POST['busqueda'] = $busqueda; } /* Última búsqueda, si existe */ if (is_null($sUltimaBusqueda) || $sUltimaBusqueda == '' || is_null($iUltimoOffset) || !ereg('^[[:digit:]]+$', $iUltimoOffset)) { $sUltimaBusqueda = NULL; $iUltimoOffset = NULL; } if (!ereg($arrFormElements['filter']['VALIDATION_EXTRA_PARAM'], $field_pattern)) { $field_pattern = $listaFechas[count($listaFechas) - 1]; } $_POST['filter'] = $field_pattern; $oFilterForm = new paloForm($smarty, $arrFormElements); $oGrid = new paloSantoGrid($smarty); $oGrid->setTitle(_tr("Audit")); $oGrid->setIcon("web/apps/{$module_name}/images/security_audit.png"); $oGrid->pagingShow(true); // show paging section. if (in_array("export", $arrPermission)) { $oGrid->enableExport(); } // enable export. $oGrid->setNameFile_Export(_tr("Access audit")); if (in_array("export", $arrPermission)) { $isExport = $oGrid->isExportAction(); } else { $isExport = false; } $total_datos = $pAccessLogs->ObtainNumAccessLogs($field_pattern); $totalBytes = $total_datos[0]; $iNumLineasPorPagina = 30; $iEstimadoBytesPagina = $iNumLineasPorPagina * 128; $iOffsetVerdadero = getParameter('offset'); if (is_null($iOffsetVerdadero) || !ereg('^[[:digit:]]+$', $iOffsetVerdadero)) { $iOffsetVerdadero = 0; } if ($iOffsetVerdadero >= $totalBytes) { $iOffsetVerdadero = 0; } if (isset($_GET['filter']) && isset($_POST['filter']) && $_GET['filter'] != $_POST['filter']) { $iOffsetVerdadero = 0; } /* Para ubicarse en la página, se obtiene la región 5 páginas estimadas hacia delante y 5 páginas estimadas hacia atrás desde el offset indicado. */ $inicioRango = $iOffsetVerdadero - 5 * $iEstimadoBytesPagina; if ($inicioRango < 0) { $inicioRango = 0; } if ($isExport) { $arrResult = $pAccessLogs->ObtainAccessLogs($totalBytes, 0, $field_pattern, NULL, $isExport); } else { $arrResult = $pAccessLogs->ObtainAccessLogs(10 * $iEstimadoBytesPagina, $inicioRango, $field_pattern, NULL, $isExport); } /* Localizar la línea del offset verdadero, así como los offsets de las páginas previa y siguiente */ for ($iPos = 0; $iPos < count($arrResult); $iPos++) { if ($arrResult[$iPos]['offset'] >= $iOffsetVerdadero) { break; } } $iPosPrevio = $iPos - $iNumLineasPorPagina; $iPosSiguiente = $iPos + $iNumLineasPorPagina; if ($iPosPrevio < 0) { $iPosPrevio = 0; } if ($iPosSiguiente > count($arrResult) - 1) { $iPosSiguiente = count($arrResult) - 1; } $iOffsetPrevio = $arrResult[$iPosPrevio]['offset']; $iOffsetSiguiente = $arrResult[$iPosSiguiente]['offset']; $limit = 30; $total = (int) ($totalBytes / 128); $offset = $iOffsetVerdadero; $nav = getParameter('nav'); if ($nav) { switch ($nav) { case 'start': $offset = 0; break; case 'end': /* Caso especial: se debe tomar la última sección del log */ $inicioRango = $totalBytes - 5 * $iEstimadoBytesPagina; if ($inicioRango < 0) { $inicioRango = 0; } if ($isExport) { $arrResult = $pAccessLogs->ObtainAccessLogs($totalBytes, 0, $field_pattern, $busqueda != '' ? $busqueda : NULL, $isExport); } else { $arrResult = $pAccessLogs->ObtainAccessLogs(10 * $iEstimadoBytesPagina, $inicioRango, $field_pattern, NULL, $isExport); } if (count($arrResult) <= $iNumLineasPorPagina) { $offset = $arrResult[0]['offset']; } else { $offset = $arrResult[count($arrResult) - $iNumLineasPorPagina]['offset']; } break; case 'next': $offset = $iOffsetSiguiente; break; case 'previous': $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(); }
function reportUser($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials) { global $arrPermission; $pACL = new paloACL($pDB); $pORGZ = new paloSantoOrganization($pDB); $idOrgFil = getParameter("idOrganization"); $username = getParameter("username"); $total = 0; if ($credentials['userlevel'] == "superadmin") { if (!empty($idOrgFil)) { $total = $pACL->getNumUsers($idOrgFil, $username); } else { $idOrgFil = 0; //opcion default se muestran todos los usuarios $total = $pACL->getNumUsers(null, $username); } } else { $idOrgFil = $credentials['id_organization']; $total = $pACL->getNumUsers($idOrgFil, $username); } if ($total === false) { $total = 0; $smarty->assign("mb_title", _tr("Error")); $smarty->assign("mb_message", _tr("Couldn't be retrieved user data")); } //url $url['menu'] = $module_name; $url['idOrganization'] = $idOrgFil; $url['username'] = $module_name; $limit = 20; $oGrid = new paloSantoGrid($smarty); $oGrid->setLimit($limit); $oGrid->setTotal($total); $offset = $oGrid->calculateOffset(); $end = $offset + $limit <= $total ? $offset + $limit : $total; $oGrid->setTitle(_tr('User List')); $oGrid->setIcon("../web/_common/images/user.png"); $oGrid->setURL($url); $oGrid->setWidth("99%"); $oGrid->setStart($total == 0 ? 0 : $offset + 1); $oGrid->setEnd($end); $arrColumns = array(); if ($credentials["userlevel"] == "superadmin") { $arrColumns[] = _tr("Organization"); //delete } $arrColumns[] = _tr("Username"); $arrColumns[] = _tr("Name"); $arrColumns[] = _tr("Group"); $arrColumns[] = _tr("Extension") . " / " . _tr("Fax Extension"); $arrColumns[] = _tr("Used Space") . " / " . _tr("Email Quota"); if (in_array('reconstruct_mailbox', $arrPermission)) { $arrColumns[] = ""; } //reconstruct mailbox $oGrid->setColumns($arrColumns); $arrData = array(); if ($credentials['userlevel'] == "superadmin") { if ($idOrgFil != 0) { $arrUsers = $pACL->getUsersPaging($limit, $offset, $idOrgFil, $username); } else { $arrUsers = $pACL->getUsersPaging($limit, $offset, null, $username); } } else { $arrUsers = $pACL->getUsersPaging($limit, $offset, $idOrgFil, $username); } if ($arrUsers === false) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr($pACL->errMsg)); } //si es un usuario solo se ve a si mismo //si es un administrador ve a todo los usuarios de foreach ($arrUsers as $user) { $arrTmp = array(); if ($credentials["userlevel"] == "superadmin") { $arrOgz = $pORGZ->getOrganizationById($user[4]); $arrTmp[] = htmlentities($arrOgz["name"], ENT_COMPAT, 'UTF-8'); //organization } $arrTmp[] = " <a href='?menu=userlist&action=view&id={$user['0']}'>" . $user[1] . "</a>"; //username $arrTmp[] = htmlentities($user[2], ENT_COMPAT, 'UTF-8'); //name $gpTmp = $pACL->getGroupNameByid($user[7]); $arrTmp[] = $gpTmp == "superadmin" ? _tr("NONE") : $gpTmp; if (!isset($user[5]) || $user[5] == "") { $ext = _tr("Not assigned"); } else { $ext = $user[5]; } if (!isset($user[6]) || $user[6] == "") { $faxExt = _tr("Not assigned"); } else { $faxExt = $user[6]; } $arrTmp[] = $ext . " / " . $faxExt; if ($user[4] != 1) { //user that belong organization 1 do not have email account $arrTmp[] = obtener_quota_usuario($user[1], $module_name); //email quota if (in_array('reconstruct_mailbox', $arrPermission)) { $arrTmp[] = " <a href='#' onclick=mailbox_reconstruct('{$user[1]}')>" . _tr('Reconstruct Mailbox') . "</a>"; //reconstruct mailbox } } else { $arrTmp[] = ''; $arrTmp[] = ''; } $arrData[] = $arrTmp; $end++; } $smarty->assign("USERLEVEL", $credentials['userlevel']); $smarty->assign("SEARCH", "<input name='search_org' type='submit' class='button' value='" . _tr('Search') . "'>"); if ($pORGZ->getNumOrganization(array()) > 0) { $arrOrgz = array(0 => _tr("all")); if (in_array('create_user', $arrPermission)) { $oGrid->addNew("create_user", _tr("Create New User")); } if ($credentials['userlevel'] == "superadmin") { foreach ($pORGZ->getOrganization(array()) as $value) { $arrOrgz[$value["id"]] = $value["name"]; } $_POST["idOrganization"] = $idOrgFil; $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization") . " = " . $arrOrgz[$idOrgFil], $_POST, array("idOrganization" => 0), true); //organization } $arrFormElements = createFieldFilter($arrOrgz); $oFilterForm = new paloForm($smarty, $arrFormElements); $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Username") . " = " . $username, $_POST, array("username" => "")); //username $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST); $oGrid->showFilter(trim($htmlFilter)); } else { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", _tr("In order to use this module must exist at least 1 organization in the Elastix Server")); } $contenidoModulo = $oGrid->fetchGrid(array(), $arrData); $mensaje = showMessageReload($module_name, $pDB, $credentials); $contenidoModulo = $mensaje . $contenidoModulo; return $contenidoModulo; }
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; }
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; }
function reportGroupPermission($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials) { $pACL = new paloACL($pDB); $pORGZ = new paloSantoOrganization($pDB); $arrGroups = array(); $arrOrgz = array(); $idOrgFil = getParameter("idOrganization"); if ($credentials['userlevel'] == "superadmin") { $orgTmp = $pORGZ->getOrganization(array()); if ($orgTmp === false) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr($pORGZ->errMsg)); } elseif (count($orgTmp) == 0) { $smarty->assign("mb_title", _tr("MESSAGE")); $msg = _tr("You haven't created any organization"); $smarty->assign("mb_message", $msg); } else { //si el usuario a selecionado una organizacion comprobamos que esta exista //caso contrario procedemos a sellecionar la primera disponible $flag = false; foreach ($orgTmp as $value) { $arrOrgz[$value["id"]] = $value["name"]; if ($value["id"] == $idOrgFil) { $flag = true; } } if (!$flag) { $idOrgFil = $orgTmp[0]['id']; } } } else { $idOrgFil = $credentials['id_organization']; $orgTmp = $pORGZ->getOrganizationById($idOrgFil); if ($orgTmp == false) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("An error has ocurred to retrieved organization data")); } else { $arrOrgz = $orgTmp; } } if (count($arrOrgz) > 0) { //que se un arreglo y que tenga al menos una organizacion $groupTmp = $pACL->getGroupsPaging(null, null, $idOrgFil); if ($groupTmp === false) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr($pACL->errMsg)); } else { foreach ($groupTmp as $value) { $arrGroups[$value[0]] = $value[1]; } } } $filter_group = getParameter("filter_group"); if (count($arrGroups) > 0) { if (empty($filter_group)) { //seleccionamos el primer grupo de la lista de grupos $filter_group = $groupTmp[0][0]; } //valido que el grupo pertenzca a la organizacion if ($pACL->getGroups($filter_group, $idOrgFil) == false) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("Invalid Group")); $filter_group = $groupTmp[0][0]; } } $filter_resource = getParameter("filter_resource"); $lang = get_language(); if ($lang != "en") { if (isset($filter_resource)) { if (trim($filter_resource) != "") { global $arrLang; $filter_value = strtolower(trim($filter_resource)); $parameter_to_find[] = $filter_value; //parametro de busqueda sin traduccion foreach ($arrLang as $key => $value) { $langValue = strtolower(trim($value)); if (preg_match("/^[[:alnum:]| ]*\$/", $filter_value)) { if (strpos($langValue, $filter_value) !== FALSE) { $parameter_to_find[] = $key; } } } } } } if (isset($filter_resource)) { $parameter_to_find[] = $filter_resource; } else { $parameter_to_find = null; } $totalGroupPermission = 0; if (count($arrGroups) > 0) { $arrResourceOrg = $pACL->getResourcesByOrg($idOrgFil, $parameter_to_find); if ($arrResourceOrg === false) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("An error has ocurred to retrieved Resources")); } else { $totalGroupPermission = count($arrResourceOrg); } } //begin grid parameters $oGrid = new paloSantoGrid($smarty); $limit = 25; $total = $totalGroupPermission; $oGrid->setLimit($limit); $oGrid->setTotal($total); $offset = $oGrid->calculateOffset(); $end = $offset + $limit <= $total ? $offset + $limit : $total; $url['menu'] = $module_name; $url['idOrganization'] = $idOrgFil; $url['filter_group'] = $filter_group; $url['filter_resource'] = $filter_resource; $arrData = $arrResourceActions = $arrPermisos = array(); $error = false; if (count($arrGroups) > 0 && $totalGroupPermission > 0) { $arrResource = array_slice($arrResourceOrg, $offset, $limit); $idGroup = $filter_group; foreach ($arrResource as $resource) { $listResource[] = $resource['id']; //lista de id de los recursos que queremos consulta $listResDes[$resource['id']] = $resource['description']; } //las acciones que tiene cada drecurso $arrResourceActions = $pACL->getResourcesActions($listResource); if ($arrResourceActions === false) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("An error has ocurred to retrieved Resources Actions")); $error = true; } //los premisos que tiene el grupo $arrPermisos = $pACL->loadGroupPermissions($idGroup, $listResource); if ($arrPermisos === false) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("An error has ocurred to retrieved Group Permissions")); $error = true; } } $max_actions = 0; $isAdministrator = $pACL->getGroupNameByid($idGroup) == _tr("administrator") ? true : false; if ($totalGroupPermission > 0 && !$error) { foreach ($arrResourceActions as $resource => $actions) { $arrTmp = array(); $arrTmp[] = _tr($listResDes[$resource]); $disabled = ""; if ($isAdministrator && ($resource == 'grouplist' || $resource == 'userlist' || $resource == 'group_permission')) { $disabled = "disabled='disabled'"; } //dentro del modulo organizacion ahi acciones que unicamente las puede realizar el superadmin //por lo tando no deben aparecer listadas if ($resource == "organization") { $actions = array_diff($actions, array('change_org_status', 'create_org', 'delete_org', 'edit_DID')); } elseif ($resource == "dashboard") { $actions = array('access'); } elseif ($resource == 'cdrreport') { $actions = array('access', 'export'); } if (count($actions) > $max_actions) { $max_actions = count($actions); } $desactivar = false; if (isset($arrPermisos[$resource])) { //grupo no tiene nigun permiso if (!in_array('access', $arrPermisos[$resource])) { $desactivar = true; } } else { $desactivar = true; $arrPermisos[$resource] = array(); } foreach ($actions as $action) { $class = 'other_act'; if ($action == 'access') { $class = 'access_act'; } elseif ($desactivar) { $disabled = "disabled='disabled'"; } $checked0 = ''; //chequeamos si la accion se encuentra en la lista de acciones permitidas en el recurso if (in_array($action, $arrPermisos[$resource])) { $checked0 = "checked"; } $arrTmp[] = "<input type='checkbox' class='{$class}' {$disabled} name='groupPermission[" . $resource . "][{$action}]' {$checked0}> {$action}"; } $arrData[] = $arrTmp; } } $oGrid->setTitle(_tr("Group Permission")); $oGrid->setURL($url); $oGrid->setWidth("99%"); $oGrid->setStart($total == 0 ? 0 : $offset + 1); $oGrid->setEnd($end); $oGrid->setTotal($total); $arrColumn[] = _tr("Resource"); for ($i = 1; $i <= $max_actions; $i++) { $act = _tr("Action"); $arrColumn[] = "{$act}" . " {$i}"; } $oGrid->setColumns($arrColumn); //begin section filter $arrFormFilter = createFieldFilter($arrGroups); $oFilterForm = new paloForm($smarty, $arrFormFilter); $smarty->assign("SHOW", _tr("Show")); $smarty->assign("limit_apply", htmlspecialchars($limit, ENT_COMPAT, 'UTF-8')); $smarty->assign("offset_apply", htmlspecialchars($offset, ENT_COMPAT, 'UTF-8')); $smarty->assign("resource_apply", htmlentities($filter_resource)); $_POST["filter_group"] = htmlspecialchars($filter_group, ENT_COMPAT, 'UTF-8'); $_POST["filter_resource"] = htmlspecialchars($filter_resource, ENT_COMPAT, 'UTF-8'); $_POST["idOrganization"] = $idOrgFil; if (count($arrOrgz) > 0) { global $arrPermission; if (in_array('edit_permission', $arrPermission)) { $oGrid->addSubmitAction("apply", _tr("Save")); } if ($credentials['userlevel'] == "superadmin") { $oGrid->addComboAction("idOrganization", _tr("Organization"), $arrOrgz, $idOrgFil, "report"); } $nameGroup = isset($arrGroups[$filter_group]) ? $arrGroups[$filter_group] : ""; $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Group") . " = {$nameGroup}", $_POST, array("filter_group" => $groupTmp[0][0]), true); $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Resource") . " = {$filter_resource}", $_POST, array("filter_resource" => "")); $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST); $oGrid->showFilter(trim($htmlFilter)); } else { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", _tr("You haven't created any organization")); } $contenidoModulo = $oGrid->fetchGrid(array(), $arrData); //end grid parameters return $contenidoModulo; }
function reportQueue($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials) { global $arrPermission; $error = ""; $pORGZ = new paloSantoOrganization($pDB); $domain = getParameter("organization"); $domain = empty($domain) ? 'all' : $domain; if ($credentials['userlevel'] != "superadmin") { $domain = $credentials['domain']; } $queue_name = getParameter("queue_name"); $pQueue = new paloQueuePBX($pDB, $domain); $queue_number = getParameter("queue_number"); if (isset($queue_number) && $queue_number != '') { $expression = $pQueue->getRegexPatternFromAsteriskPattern($queue_number); if ($expression === false) { $queue_number = ''; } } $url['menu'] = $module_name; $url['organization'] = $domain; $url['queue_number'] = $queue_number; //queue_number $url['queue_name'] = $queue_name; //queue_name $total = $pQueue->getTotalQueues($domain, $queue_number, $queue_name); $arrOrgz = array(); if ($credentials['userlevel'] == "superadmin") { $arrOrgz = array("all" => _tr("all")); foreach ($pORGZ->getOrganization(array()) as $value) { $arrOrgz[$value["domain"]] = $value["name"]; } } if ($total === false) { $error = $pQueue->errMsg; $total = 0; } $limit = 20; $oGrid = new paloSantoGrid($smarty); $oGrid->setLimit($limit); $oGrid->setTotal($total); $offset = $oGrid->calculateOffset(); $end = $offset + $limit <= $total ? $offset + $limit : $total; $oGrid->setTitle(_tr('Queues List')); //$oGrid->setIcon('url de la imagen'); $oGrid->setWidth("99%"); $oGrid->setStart($total == 0 ? 0 : $offset + 1); $oGrid->setEnd($end); $oGrid->setTotal($total); $oGrid->setURL($url); if ($credentials['userlevel'] == 'superadmin') { $arrColumns[] = _tr("Organization"); } $arrColumns[] = _tr("Queue Number"); $arrColumns[] = _tr("Queue Name"); $arrColumns[] = _tr("Password"); $arrColumns[] = _tr("Record Call"); $arrColumns[] = _tr("Strategy"); $arrColumns[] = _tr("Timeout Queue"); $arrColumns[] = _tr("Timeout Agent"); $oGrid->setColumns($arrColumns); $arrData = array(); $arrQueues = array(); if ($total != 0) { $arrQueues = $pQueue->getQueues($domain, $queue_number, $queue_name, $limit, $offset); } if ($arrQueues === false) { $error = _tr("Error getting queue data. ") . $pQueue->errMsg; } else { foreach ($arrQueues as $queue) { $arrTmp = array(); if ($credentials['userlevel'] == 'superadmin') { $arrTmp[] = $arrOrgz[$queue['organization_domain']]; } $queunumber = $queue["queue_number"]; $arrTmp[] = " <a href='?menu=queues&action=view&qname=" . $queue['name'] . "&organization={$queue['organization_domain']}'>" . $queunumber . "</a>"; $arrTmp[] = htmlentities($queue["description"], ENT_QUOTES, "UTF-8"); $arrTmp[] = $queue["password_detail"]; $arrTmp[] = isset($queue["monitor_format"]) ? "yes" : "no"; $arrTmp[] = $queue["strategy"]; $arrTmp[] = $queue["timeout_detail"] == "0" ? "unlimited" : $queue["timeout_detail"]; $arrTmp[] = $queue["timeout"]; /*$result=getInfoQueue(); $arrTmp[6]=$result["logged"]; $arrTmp[6]=$result["free"];*/ $arrData[] = $arrTmp; } } $smarty->assign("USERLEVEL", $credentials['userlevel']); $smarty->assign("SEARCH", "<input type='submit' class='button' value='" . _tr('Search') . "' name='report'>"); if ($pORGZ->getNumOrganization(array()) >= 1) { if (in_array('create', $arrPermission)) { if ($credentials['userlevel'] == 'superadmin') { $oGrid->addComboAction("organization_add", _tr("Create New Queue"), array_slice($arrOrgz, 1), $selected = null, "create_queue", $onchange_select = null); } else { $oGrid->addNew("create_queue", _tr("Create New Queue")); } } if ($credentials['userlevel'] == 'superadmin') { $_POST["organization"] = $domain; $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization") . " = " . $arrOrgz[$domain], $_POST, array("organization" => "all"), true); } $_POST["queue_number"] = $queue_number; // patter to filter estension number $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Queue Number") . " = " . $queue_number, $_POST, array("queue_number" => "")); $_POST["queue_name"] = $queue_name; // patter to filter estension number $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Queue Name") . " = " . $queue_name, $_POST, array("queue_name" => "")); $arrFormElements = createFieldFilter($arrOrgz); $oFilterForm = new paloForm($smarty, $arrFormElements); $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST); $oGrid->showFilter(trim($htmlFilter)); } else { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", _tr("It's necesary you create at least one organization so you can use this module")); } if ($error != "") { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", $error); } $contenidoModulo = $oGrid->fetchGrid(array(), $arrData); $mensaje = showMessageReload($module_name, $pDB, $credentials); $contenidoModulo = $mensaje . $contenidoModulo; return $contenidoModulo; }
function reportReporteEfectividad($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf) { $pReporteEfectividad = new paloSantoReporteEfectividad($pDB); $filter_field = getParameter("filter_field"); $filter_value = getParameter("filter_value"); //begin grid parameters $oGrid = new paloSantoGrid($smarty); $oGrid->setTitle(_tr("Reporte de efectividad")); $oGrid->pagingShow(true); // show paging section. $oGrid->enableExport(); // enable export. $oGrid->setNameFile_Export(_tr("Reporte de efectividad")); $url = array("menu" => $module_name, "filter_field" => $filter_field, "filter_value" => $filter_value); $oGrid->setURL($url); $arrColumns = array(_tr("Campaña"), _tr("Acción")); $oGrid->setColumns($arrColumns); $total = $pReporteEfectividad->getNumReporteEfectividad($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 = $pReporteEfectividad->getReporteEfectividad($limit, $offset, $filter_field, $filter_value); if (is_array($arrResult) && $total > 0) { foreach ($arrResult as $key => $value) { $arrTmp[0] = $value['nombre']; $arrTmp[1] = "<a href=index.php?menu={$module_name}&id={$value['id']}&action=efectividad>Ver reporte de efectividad</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; }
function reportMoH($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials) { global $arrPermission; $error = ""; $pORGZ = new paloSantoOrganization($pDB); $name = getParameter("name"); if ($credentials['userlevel'] == "superadmin") { $domain = getParameter("organization"); $domain = empty($domain) ? 'all' : $domain; $arrOrgz = array("all" => _tr("all")); foreach ($pORGZ->getOrganization(array()) as $value) { $arrOrgz[$value["domain"]] = $value["name"]; } } else { $arrOrgz = array(); $domain = $credentials['domain']; } $url["menu"] = $module_name; $url["organization"] = $domain; $url["name"] = $name; $pMoH = new paloSantoMoH($pDB, $domain); $total = $pMoH->getNumMoH($domain, $name); if ($total === false) { $error = $pMoH->errMsg; $total = 0; } $limit = 20; $oGrid = new paloSantoGrid($smarty); $oGrid->setLimit($limit); $oGrid->setTotal($total); $offset = $oGrid->calculateOffset(); $end = $offset + $limit <= $total ? $offset + $limit : $total; $oGrid->setTitle(_tr('MoH Class List')); //$oGrid->setIcon('url de la imagen'); $oGrid->setWidth("99%"); $oGrid->setStart($total == 0 ? 0 : $offset + 1); $oGrid->setEnd($end); $oGrid->setTotal($total); $oGrid->setURL($url); $arrColum = array(); if ($credentials['userlevel'] == "superadmin") { $arrColum[] = _tr("Organization"); } $arrColum[] = _tr("Name"); $arrColum[] = _tr("Type"); $arrColum[] = _tr("Sort"); $arrColum[] = _tr("Directory"); $arrColum[] = _tr("Aplication"); $oGrid->setColumns($arrColum); $arrMoH = array(); $arrData = array(); if ($total != 0) { $arrMoH = $pMoH->getMoHs($domain, $name, $limit, $offset); } if ($arrMoH === false) { $error = _tr("Error to obtain MoH Class") . $pMoH->errMsg; $arrMoH = array(); } $arrData = array(); foreach ($arrMoH as $moh) { $arrTmp = array(); if ($credentials['userlevel'] == "superadmin") { if (empty($moh["organization_domain"])) { $arrTmp[] = ""; $arrTmp[] = " <a href='?menu={$module_name}&action=view&id_moh=" . $moh["name"] . "'>" . $moh["description"] . "</a>"; } else { $arrTmp[] = $arrOrgz[$moh["organization_domain"]]; $arrTmp[] = $moh["description"]; } } else { $arrTmp[] = " <a href='?menu={$module_name}&action=view&id_moh=" . $moh["name"] . "'>" . $moh["description"] . "</a>"; } $arrTmp[] = $moh["mode"]; $arrTmp[] = $moh["sort"]; $arrTmp[] = $moh["directory"]; $arrTmp[] = $moh["application"]; $arrData[] = $arrTmp; } $smarty->assign("USERLEVEL", $credentials['userlevel']); $smarty->assign("SEARCH", "<input type='submit' class='button' value='" . _tr('Search') . "' name='report'>"); if (in_array("create", $arrPermission)) { $oGrid->addNew("create_moh", _tr("Create New Class MoH")); } if ($credentials['userlevel'] == "superadmin") { $_POST["organization"] = $domain; $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization") . " = " . $arrOrgz[$domain], $_POST, array("organization" => "all"), true); } $_POST["name"] = $name; // name $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Name") . " = " . $name, $_POST, array("name" => "")); $arrFormElements = createFieldFilter($arrOrgz); $oFilterForm = new paloForm($smarty, $arrFormElements); $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST); $oGrid->showFilter(trim($htmlFilter)); if ($error != "") { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", $error); } $contenidoModulo = $oGrid->fetchGrid(array(), $arrData); return $contenidoModulo; }
function reportReportsBreak($smarty, $module_name, $local_templates_dir, &$pDB) { // Obtener rango de fechas de consulta. Si no existe, se asume día de hoy $sFechaInicio = date('d M Y'); if (isset($_GET['txt_fecha_init'])) { $sFechaInicio = $_GET['txt_fecha_init']; } if (isset($_POST['txt_fecha_init'])) { $sFechaInicio = $_POST['txt_fecha_init']; } $sFechaFinal = date('d M Y'); if (isset($_GET['txt_fecha_end'])) { $sFechaFinal = $_GET['txt_fecha_end']; } if (isset($_POST['txt_fecha_end'])) { $sFechaFinal = $_POST['txt_fecha_end']; } $arrFilterExtraVars = array("txt_fecha_init" => $sFechaInicio, "txt_fecha_end" => $sFechaFinal); $arrFormElements = createFieldFilter(); $oFilterForm = new paloForm($smarty, $arrFormElements); // Validación de las fechas recogidas if (!$oFilterForm->validateForm($arrFilterExtraVars)) { $smarty->assign("mb_title", _tr("Validation Error")); $arrErrores = $oFilterForm->arrErroresValidacion; $strErrorMsg = '<b>' . _tr('The following fields contain errors') . '</b><br/>'; foreach ($arrErrores as $k => $v) { $strErrorMsg .= "{$k}, "; } $smarty->assign("mb_message", $strErrorMsg); $arrFilterExtraVars = array("txt_fecha_init" => date('d M Y'), "txt_fecha_end" => date('d M Y')); } $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $arrFilterExtraVars); // Obtener fechas en formato yyyy-mm-dd $sFechaInicio = translateDate($arrFilterExtraVars['txt_fecha_init']); $sFechaFinal = translateDate($arrFilterExtraVars['txt_fecha_end']); $oReportsBreak = new paloSantoReportsBreak($pDB); //begin grid parameters $bElastixNuevo = method_exists('paloSantoGrid', 'setURL'); $oGrid = new paloSantoGrid($smarty); $oGrid->enableExport(); // enable export. $oGrid->showFilter($htmlFilter); $arrColumnas = array(_tr('Agent Number'), _tr('Agent Name')); $bExportando = $bElastixNuevo ? $oGrid->isExportAction() : isset($_GET['exportcsv']) && $_GET['exportcsv'] == 'yes' || isset($_GET['exportspreadsheet']) && $_GET['exportspreadsheet'] == 'yes' || isset($_GET['exportpdf']) && $_GET['exportpdf'] == 'yes'; $datosBreaks = $oReportsBreak->getReportesBreak($sFechaInicio, $sFechaFinal); $mapa = array(); // Columna del break dado su ID $sTagInicio = !$bExportando ? '<b>' : ''; $sTagFinal = $sTagInicio != '' ? '</b>' : ''; $filaTotales = array($sTagInicio . _tr('Total') . $sTagFinal, ''); foreach ($datosBreaks['breaks'] as $idBreak => $sNombreBreak) { $mapa[$idBreak] = count($arrColumnas); $arrColumnas[] = $sNombreBreak; $filaTotales[] = 0; // Total de segundos usado por todos los agentes en este break } $mapa['TOTAL'] = count($arrColumnas); $filaTotales[] = 0; // Total de segundos usado por todos los agentes en todos los breaks $arrColumnas[] = _tr('Total'); $arrData = array(); foreach ($datosBreaks['reporte'] as $infoAgente) { $filaAgente = array($infoAgente['numero_agente'], $infoAgente['nombre_agente']); $iTotalAgente = 0; // Total de segundos usados por agente en breaks // Valor inicial de todos los breaks es 0 segundos foreach (array_keys($datosBreaks['breaks']) as $idBreak) { $filaAgente[$mapa[$idBreak]] = '00:00:00'; } // Asignar duración del break para este agente y break foreach ($infoAgente['breaks'] as $tuplaBreak) { $sTagInicio = !$bExportando && $tuplaBreak['duracion'] > 0 ? '<font color="green">' : ''; $sTagFinal = $sTagInicio != '' ? '</font>' : ''; $filaAgente[$mapa[$tuplaBreak['id_break']]] = $sTagInicio . formatoSegundos($tuplaBreak['duracion']) . $sTagFinal; $iTotalAgente += $tuplaBreak['duracion']; $filaTotales[$mapa[$tuplaBreak['id_break']]] += $tuplaBreak['duracion']; $filaTotales[$mapa['TOTAL']] += $tuplaBreak['duracion']; } // Total para todos los breaks de este agente $filaAgente[$mapa['TOTAL']] = formatoSegundos($iTotalAgente); $arrData[] = $filaAgente; } $sTagInicio = !$bExportando ? '<b>' : ''; $sTagFinal = $sTagInicio != '' ? '</b>' : ''; foreach ($mapa as $iPos) { $filaTotales[$iPos] = $sTagInicio . formatoSegundos($filaTotales[$iPos]) . $sTagFinal; } $arrData[] = $filaTotales; if ($bElastixNuevo) { $oGrid->setURL(construirURL($arrFilterExtraVars)); $oGrid->setData($arrData); $oGrid->setColumns($arrColumnas); $oGrid->setTitle(_tr("Reports Break")); $oGrid->pagingShow(false); $oGrid->setNameFile_Export(_tr("Reports Break")); $smarty->assign("SHOW", _tr("Show")); return $oGrid->fetchGrid(); } else { $url = construirURL($arrFilterExtraVars); $offset = 0; $total = count($datosBreaks['reporte']) + 1; $limit = $total; function _map_name($s) { return array('name' => $s); } $arrGrid = array("title" => _tr('Reports Break'), "url" => $url, "icon" => "images/list.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) { $title = $sFechaInicio . "-" . $sFechaFinal; header("Cache-Control: private"); header("Pragma: cache"); header('Content-Type: text/csv; charset=utf-8; header=present'); header("Content-disposition: attachment; filename=\"" . $title . ".csv\""); } if ($bExportando) { return $oGrid->fetchGridCSV($arrGrid, $arrData); } $sContenido = $oGrid->fetchGrid($arrGrid, $arrData); if (strpos($sContenido, '<form') === FALSE) { $sContenido = "<form method=\"POST\" style=\"margin-bottom:0;\" action=\"{$url}\">{$sContenido}</form>"; } return $sContenido; } }
function reportRegestion($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf) { $pRegestion = new paloSantoRegestion($pDB); $filter_field = getParameter("filter_field"); $filter_value = getParameter("filter_value"); //begin grid parameters $oGrid = new paloSantoGrid($smarty); $oGrid->setTitle(_tr("Regestión de campañas")); $oGrid->pagingShow(true); // show paging section. $oGrid->enableExport(); // enable export. $oGrid->setNameFile_Export(_tr("Regestión de campañas")); $url = array("menu" => $module_name, "filter_field" => $filter_field, "filter_value" => $filter_value); $oGrid->setURL($url); $arrColumns = array(_tr("Campaña padre"), _tr("Clase de calltypes"), _tr("Acción")); $oGrid->setColumns($arrColumns); $total = $pRegestion->getNumRegestion($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 = $pRegestion->getRegestion($limit, $offset, $filter_field, $filter_value); if (is_array($arrResult) && $total > 0) { foreach ($arrResult as $key => $value) { $arrTmp[0] = $value['nombre']; $arrTmp[1] = "<form method='POST' action=\"index.php?menu={$module_name}\">"; $arrTmp[1] .= "<select name=\"clase_calltype\">\n\t\t\t <option value=\"Contactado\">Contactado</option>\n\t\t\t <option value=\"No contactado\">No contactado</option>\n\t\t\t <option value=\"Agendado\">Agendado</option>\n\t\t\t </select>"; $arrTmp[1] .= "<input type=hidden name=\"action\" value=\"view_edit\">"; $arrTmp[1] .= "<input type=hidden name=\"id\" value={$value['id']}>"; $arrTmp[2] = "<input type=submit value=\"Regestionar\">"; $arrTmp[2] .= "</form>"; $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; }
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; }
function reportListadodeCallTypes($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf) { $pListadodeCallTypes = new paloSantoListadodeCallTypes($pDB); $filter_field = getParameter("filter_field"); $filter_value = getParameter("filter_value"); //begin grid parameters $oGrid = new paloSantoGrid($smarty); $oGrid->setTitle(_tr("Listado de Call Types")); $oGrid->pagingShow(true); // show paging section. $oGrid->enableExport(); // enable export. $oGrid->setNameFile_Export(_tr("Listado de Call Types")); $url = array("menu" => $module_name, "filter_field" => $filter_field, "filter_value" => $filter_value); $oGrid->setURL($url); $arrColumns = array(_tr("Campaña"), _tr("Call Type"), _tr("Clase de Call Type"), _tr("Peso"), _tr("Status"), _tr("Acción")); $oGrid->setColumns($arrColumns); $total = $pListadodeCallTypes->getNumListadodeCallTypes($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 = $pListadodeCallTypes->getListadodeCallTypes($limit, $offset, $filter_field, $filter_value); if (is_array($arrResult) && $total > 0) { foreach ($arrResult as $key => $value) { $arrTmp[0] = $value['campania']; $arrTmp[1] = $value['call_type']; $arrTmp[2] = $value['clase']; $arrTmp[3] = $value['peso']; $arrTmp[4] = $value['status'] == "A" ? "Activo" : "Inactivo"; $arrTmp[5] = "<a href=index.php?menu={$module_name}&id={$value['id']}&id_campania={$value['id_campania']}&action=change_status&status="; if ($value['status'] == "A") { $arrTmp[5] .= "I"; $accion = "Desactivar"; } else { $arrTmp[5] .= "A"; $accion = "Activar"; } $arrTmp[5] .= ">{$accion}</a>"; $arrTmp[5] .= " <a href=index.php?menu=hispana_call_types&id={$value['id']}&id_campania={$value['id_campania']}&action=view_edit>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; }
function reportListadodebases($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf) { $pListadodebases = new paloSantoClientesManuales($pDB); $filter_field = getParameter("filter_field"); $filter_value = getParameter("filter_value"); //begin grid parameters $oGrid = new paloSantoGrid($smarty); $oGrid->setTitle(_tr("Clientes manuales")); $oGrid->pagingShow(true); // show paging section. $oGrid->enableExport(); // enable export. $oGrid->setNameFile_Export(_tr("Clientes manuales")); $url = array("menu" => $module_name, "filter_field" => $filter_field, "filter_value" => $filter_value); $oGrid->setURL($url); $arrColumns = array(_tr("CI"), _tr("Nombre"), _tr("Apellido"), _tr("Provincia"), _tr("Ciudad"), _tr("Nacimiento"), _tr("Correo personal"), _tr("Correo trabajo"), _tr("Estado civil"), _tr("Origen"), _tr("Acción")); $oGrid->setColumns($arrColumns); $total = $pListadodebases->getNumListadodebases($filter_field, $filter_value); $arrData = null; if ($oGrid->isExportAction()) { $limit = $total; // max number of rows. $offset = 0; // since the start. } else { //$limit = 20; $limit = 200; $oGrid->setLimit($limit); $oGrid->setTotal($total); $offset = $oGrid->calculateOffset(); } $arrResult = $pListadodebases->getListadodebases($limit, $offset, $filter_field, $filter_value); if (is_array($arrResult) && $total > 0) { foreach ($arrResult as $key => $value) { $arrTmp[0] = $value['ci']; $arrTmp[1] = $value['nombre']; $arrTmp[2] = $value['apellido']; $arrTmp[3] = $value['provincia']; $arrTmp[4] = $value['ciudad']; $arrTmp[5] = $value['nacimiento']; $arrTmp[6] = $value['correo_personal']; $arrTmp[7] = $value['correo_trabajo']; $arrTmp[8] = $value['estado_civil']; $arrTmp[9] = $value['origen']; $arrTmp[10] = "<a href=index.php?menu={$module_name}&action=agregar&ci={$value['ci']}>Agregar a campaña</a><br><a href='?menu=hispana_clientes_datosbasicos&ci=" . $value['ci'] . "'>Editar</a>"; $arrData[] = $arrTmp; } } $oGrid->setData($arrData); //begin section filter $oFilterForm = new paloForm($smarty, createFieldFilter()); $smarty->assign("SHOW", _tr("Show")); $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST); //end section filter $oGrid->showFilter(trim($htmlFilter)); $content = $oGrid->fetchGrid(); //end grid parameters return $content; }
function reportOtherDestinations($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials) { global $arrPermission; $error = ""; $pORGZ = new paloSantoOrganization($pDB); $domain = getParameter("organization"); $domain = empty($domain) ? 'all' : $domain; if ($credentials['userlevel'] != "superadmin") { $domain = $credentials['domain']; } $other_destination_name = getParameter("other_destination_name"); $pOtherDestinations = new paloSantoOtherDestinations($pDB, $domain); $url['menu'] = $module_name; $url['organization'] = $domain; $url['other_destination_name'] = $other_destination_name; $total = $pOtherDestinations->getNumOtherDestinations($domain, $other_destination_name); $arrOrgz = array(); if ($credentials['userlevel'] == "superadmin") { $arrOrgz = array("all" => _tr("all")); foreach ($pORGZ->getOrganization(array()) as $value) { $arrOrgz[$value["domain"]] = $value["name"]; } } if ($total === false) { $error = $pOtherDestinations->errMsg; $total = 0; } $limit = 20; $oGrid = new paloSantoGrid($smarty); $oGrid->setLimit($limit); $oGrid->setTotal($total); $offset = $oGrid->calculateOffset(); $end = $offset + $limit <= $total ? $offset + $limit : $total; $oGrid->setTitle(_tr('Other Destinations List')); //$oGrid->setIcon('url de la imagen'); $oGrid->setWidth("99%"); $oGrid->setStart($total == 0 ? 0 : $offset + 1); $oGrid->setEnd($end); $oGrid->setTotal($total); $oGrid->setURL($url); $arrColum = array(); if ($credentials['userlevel'] == "superadmin") { $arrColum[] = _tr("Organization"); } $arrColum[] = _tr("Other Destination Name"); $arrColum[] = _tr("Dial Destination"); $oGrid->setColumns($arrColum); $arrOtherDestinations = array(); $arrData = array(); if ($total != 0) { $arrOtherDestinations = $pOtherDestinations->getOtherDestinations($domain, $other_destination_name, $limit, $offset); } if ($arrOtherDestinations === false) { $error = _tr("Error to obtain Other Destinations") . $pOtherDestinations->errMsg; $arrOtherDestinations = array(); } foreach ($arrOtherDestinations as $row) { $arrTmp = array(); if ($credentials['userlevel'] == "superadmin") { $arrTmp[] = $arrOrgz[$row["organization_domain"]]; } $arrTmp[] = " <a href='?menu={$module_name}&action=view&id=" . $row['id'] . "&organization={$row['organization_domain']}'>" . htmlentities($row["description"], ENT_QUOTES, "UTF-8") . "</a>"; $arrTmp[] = $row["destdial"]; $arrData[] = $arrTmp; } $smarty->assign("USERLEVEL", $credentials['userlevel']); $smarty->assign("SEARCH", "<input type='submit' class='button' value='" . _tr('Search') . "' name='report'>"); if ($pORGZ->getNumOrganization(array()) >= 1) { if (in_array('create', $arrPermission)) { if ($credentials['userlevel'] == 'superadmin') { $oGrid->addComboAction("organization_add", _tr("ADD Other Destination"), array_slice($arrOrgz, 1), $selected = null, "create_other_destination", $onchange_select = null); } else { $oGrid->addNew("create_other_destination", _tr("ADD Other Destination")); } } if ($credentials['userlevel'] == 'superadmin') { $_POST["organization"] = $domain; $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization") . " = " . $arrOrgz[$domain], $_POST, array("organization" => "all"), true); } $_POST["other_destination_name"] = $other_destination_name; // name $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Other Destination Name") . " = " . $other_destination_name, $_POST, array("other_destination_name" => "")); $arrFormElements = createFieldFilter($arrOrgz); $oFilterForm = new paloForm($smarty, $arrFormElements); $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST); $oGrid->showFilter(trim($htmlFilter)); } else { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", _tr("It's necesary you create at least one organization so you can use this module")); } if ($error != "") { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", $error); } $contenidoModulo = $oGrid->fetchGrid(array(), $arrData); $mensaje = showMessageReload($module_name, $pDB, $credentials); $contenidoModulo = $mensaje . $contenidoModulo; return $contenidoModulo; }
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; }
function reportTG($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials) { global $arrPermission; $error = ""; $pORGZ = new paloSantoOrganization($pDB); $domain = getParameter("organization"); $domain = empty($domain) ? 'all' : $domain; if ($credentials['userlevel'] != "superadmin") { $domain = $credentials['domain']; } $name = getParameter('name'); $url['menu'] = $module_name; $url['organization'] = $domain; $url['name'] = $name; //name $pTG = new paloSantoTG($pDB, $domain); $total = $pTG->getNumTG($domain, $name); $arrOrgz = array(); if ($credentials['userlevel'] == "superadmin") { $arrOrgz = array("all" => "all"); foreach ($pORGZ->getOrganization(array()) as $value) { $arrOrgz[$value["domain"]] = $value["name"]; } } if ($total === false) { $error = $pTG->errMsg; $total = 0; } $limit = 20; $oGrid = new paloSantoGrid($smarty); $oGrid->setLimit($limit); $oGrid->setTotal($total); $offset = $oGrid->calculateOffset(); $end = $offset + $limit <= $total ? $offset + $limit : $total; $oGrid->setTitle(_tr('Time Groups List')); //$oGrid->setIcon('url de la imagen'); $oGrid->setWidth("99%"); $oGrid->setStart($total == 0 ? 0 : $offset + 1); $oGrid->setEnd($end); $oGrid->setTotal($total); $oGrid->setURL($url); $arrColum = array(); if ($credentials['userlevel'] == "superadmin") { $arrColum[] = _tr("Organization"); } $arrColum[] = _tr("Name"); $oGrid->setColumns($arrColum); $arrTG = array(); $arrData = array(); if ($total != 0) { $arrTG = $pTG->getTGs($domain, $name, $limit, $offset); } if ($arrTG === false) { $error = _tr("Error to obtain Time Groups") . $pTG->errMsg; $arrTG = array(); } $arrData = array(); foreach ($arrTG as $tg) { $arrTmp = array(); if ($credentials['userlevel'] == "superadmin") { $arrTmp[] = $arrOrgz[$tg["organization_domain"]]; } $arrTmp[] = " <a href='?menu={$module_name}&action=edit&id_tg=" . $tg['id'] . "&organization={$tg['organization_domain']}'>" . $tg['name'] . "</a>"; $arrData[] = $arrTmp; } if ($pORGZ->getNumOrganization(array()) >= 1) { if (in_array('create', $arrPermission)) { if ($credentials['userlevel'] == 'superadmin') { $oGrid->addComboAction("organization_add", _tr("ADD Time Group"), array_slice($arrOrgz, 1), $selected = null, "create_tg", $onchange_select = null); } else { $oGrid->addNew("create_tg", _tr("ADD Time Group")); } } if ($credentials['userlevel'] == 'superadmin') { $_POST["organization"] = $domain; $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization") . " = " . $arrOrgz[$domain], $_POST, array("organization" => "all"), true); } $_POST["name"] = $name; // name $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Time Condition Group") . " = " . $name, $_POST, array("name" => "")); $arrFormElements = createFieldFilter($arrOrgz); $oFilterForm = new paloForm($smarty, $arrFormElements); $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST); $oGrid->showFilter(trim($htmlFilter)); } else { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", _tr("It's necesary you create at least one organization so you can use this module")); } if ($error != "") { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", $error); } $contenidoModulo = $oGrid->fetchGrid(array(), $arrData); $mensaje = showMessageReload($module_name, $pDB, $credentials); $contenidoModulo = $mensaje . $contenidoModulo; return $contenidoModulo; }
function reportOrgPermission($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $arrCredentiasls) { $pACL = new paloACL($pDB); $pORGZ = new paloSantoOrganization($pDB); $arrGroups = array(); $arrOrgz = array(); $filter_resource = getParameter("filter_resource"); $idOrgFil = getParameter("idOrganization"); $orgTmp = $pORGZ->getOrganization(array()); if ($orgTmp === false) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr($pORGZ->errMsg)); } elseif (count($orgTmp) == 0) { $smarty->assign("mb_title", _tr("MESSAGE")); $msg = _tr("You haven't created any organization"); $smarty->assign("mb_message", $msg); } else { //si el usuario a selecionado una organizacion comprobamos que esta exista //caso contrario procedemos a sellecionar la primera disponible $flag = false; foreach ($orgTmp as $value) { $arrOrgz[$value["id"]] = $value["name"]; if ($value["id"] == $idOrgFil) { $flag = true; } } if (!$flag) { $idOrgFil = $orgTmp[0]['id']; } } $filter_resource = htmlentities($filter_resource); //buscamos en el arreglo del lenguaje la traduccion del recurso en caso de que exista $lang = get_language(); //lenguage que esta siendo usado $parameter_to_find = null; if (isset($filter_resource)) { if (trim($filter_resource) != "") { if ($lang != "en") { global $arrLang; $filter_value = strtolower(trim($filter_resource)); $parameter_to_find[] = $filter_value; //parametro de busqueda sin traduccion foreach ($arrLang as $key => $value) { $langValue = strtolower(trim($value)); if (preg_match("/^[[:alnum:]| ]*\$/", $filter_value)) { if (strpos($langValue, $filter_value) !== FALSE) { $parameter_to_find[] = $key; } } } } else { $parameter_to_find[] = $filter_resource; } } } //obtenemos el numero de recursos disponibles del sistema $total = 0; if (count($arrOrgz) > 0) { $total = $pACL->getNumResources($parameter_to_find, 'yes'); } if ($total == false && $pACL->errMsg != "") { $total = 0; $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("An error has ocurred to retrieved resources data")); } $limit = 25; $oGrid = new paloSantoGrid($smarty); $oGrid->setLimit($limit); $oGrid->setTotal($total); $offset = $oGrid->calculateOffset(); $end = $offset + $limit <= $total ? $offset + $limit : $total; $url["menu"] = $module_name; $url["filter_resource"] = $filter_resource; $url["idOrganization"] = $idOrgFil; $oGrid->setTitle(_tr("Organization Permission")); $oGrid->setURL($url); $oGrid->setWidth("99%"); $oGrid->setStart($total == 0 ? 0 : $offset + 1); $oGrid->setEnd($end); $oGrid->setTotal($total); $arrColumn = array(_tr("Resource"), "<input type='checkbox' name='selectAll' id='selectAll' />" . _tr('Permit Access')); $oGrid->setColumns($arrColumn); $arrData = array(); if (count($arrOrgz) > 0 && $total > 0) { //obtengo una lista con todos los recursos a los que una organizacion puede tener acceso $arrResource = $pACL->getListResources($limit, $offset, $parameter_to_find, 'yes'); //lista de los recursos permitidos a la organizacion seleccionada organizacion $arrResourceOrg = $pACL->getResourcesByOrg($idOrgFil, $parameter_to_find); if ($arrResourceOrg === false || $arrResource === false) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("An error has ocurred to retrieve resource list.") . " " . _tr($pACL->errMsg)); } else { $temp = array(); foreach ($arrResourceOrg as $value) { $temp[] = $value["id"]; } if (is_array($arrResource) && count($arrResource) > 0) { foreach ($arrResource as $resource) { $disabled = ""; if ($resource["id"] == 'usermgr' || $resource["id"] == 'grouplist' || $resource["id"] == 'userlist' || $resource["id"] == 'group_permission' || $resource["id"] == 'organization') { $disabled = "disabled='disabled'"; } $checked0 = ""; if (in_array($resource["id"], $temp)) { $checked0 = "checked"; } $arrTmp[0] = _tr($resource["description"]); $arrTmp[1] = "<input type='checkbox' {$disabled} name='resource[" . $resource["id"] . "]' id='" . $resource["id"] . "' class='resource' {$checked0}>" . " " . _tr("Permit"); $arrData[] = $arrTmp; } } } } $smarty->assign("SHOW", _tr("Show")); $smarty->assign("resource_apply", $filter_resource); if (count($arrOrgz) > 0) { $oGrid->addSubmitAction("apply", _tr("Save")); $oGrid->addComboAction("idOrganization", _tr("Organization"), $arrOrgz, $idOrgFil, "report"); $arrFormFilter = createFieldFilter(); $oFilterForm = new paloForm($smarty, $arrFormFilter); $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST); $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Resource") . " = {$filter_resource}", $_POST, array("filter_resource" => "")); $oGrid->showFilter(trim($htmlFilter)); } $contenidoModulo = $oGrid->fetchGrid(array(), $arrData); //end grid parameters return $contenidoModulo; }
function reportEmailList($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials) { global $arrPermission; $pORGZ = new paloSantoOrganization($pDB); $pEmailList = new paloSantoEmailList($pDB); $org_domain = getParameter("domain"); $name_list = getParameter("name_list"); $total = 0; if ($credentials['userlevel'] == "superadmin") { if (!empty($org_domain)) { $total = $pEmailList->getNumEmailList($name_list, $org_domain); } else { $org_domain = 0; //opcion default se muestran todas las listas $total = $pEmailList->getNumEmailList($name_list); } } else { $org_domain = $credentials['domain']; $total = $pEmailList->getNumEmailList($name_list, $org_domain); } if ($total === false) { $total = 0; $smarty->assign("mb_title", _tr("Error")); $smarty->assign("mb_message", _tr("Couldn't be retrieved Email List data")); } //url $url['menu'] = $module_name; $url['domain'] = $org_domain; $url['name_list'] = $name_list; $limit = 20; $oGrid = new paloSantoGrid($smarty); $oGrid->setLimit($limit); $oGrid->setTotal($total); $offset = $oGrid->calculateOffset(); $end = $offset + $limit <= $total ? $offset + $limit : $total; $oGrid->setStart($total == 0 ? 0 : $offset + 1); $oGrid->setEnd($end); $oGrid->setTitle(_tr("Email List")); $oGrid->setIcon("web/apps/{$module_name}/images/email.png"); $oGrid->setURL($url); $oGrid->setWidth("99%"); $del_permission = in_array('delete_list', $arrPermission); $edit_permission = in_array('edit_list', $arrPermission); $create_permission = in_array('create_list', $arrPermission); if ($del_permission) { $arrColumns[] = ""; } //checkbox to delete $arrColumns[] = _tr('List Name'); $arrColumns[] = _tr('Number of Members'); $arrColumns[] = _tr('Actions'); $oGrid->setColumns($arrColumns); $arrData = null; if ($total > 0) { $arrResult = $pEmailList->getEmailListPagging($name_list, $org_domain, $limit, $offset); if ($arrResult === false) { $smarty->assign("mb_title", _tr("Error")); $smarty->assign("mb_message", _tr("Couldn't be retrieved Email List data")); } else { foreach ($arrResult as $list) { $arrTmp = array(); if ($del_permission) { $arrTmp[] = "<input type='checkbox' name='del_list' id='{$list['id']}'>"; } $arrTmp[] = "<a href='?menu={$module_name}&action=view_list&id={$list['id']}'>" . htmlentities($list['listname'], ENT_QUOTES, "UTF-8") . "@" . $list['organization_domain'] . "</a>"; $arrTmp[] = $pEmailList->getTotalMembers($list['id']); $arrTmp[] = "<a href='?menu={$module_name}&action=view_memberlist&id=" . $list['id'] . "'>" . _tr("View members") . "</a>"; $arrData[] = $arrTmp; } } } //Verifico si en el archivo /etc/postfix/main.cf las variables alias_map y virtual_alias_map están apuntando a los archivos correctos, de no ser así se lo corrige $checkPostfixFile = $pEmailList->checkPostfixFile(); if (!$checkPostfixFile) { $smarty->assign("mb_title", _tr("Error")); $smarty->assign("mb_message", _tr("An error has ocurred to try config postfix file")); } //begin section filter $smarty->assign("USERLEVEL", $credentials['userlevel']); $smarty->assign("SEARCH", "<input name='search_org' type='submit' class='button' value='" . _tr('Search') . "'>"); //se comprueba que el mailman haya sido configurado por primera vez $MailmanListCreated = $pEmailList->isMailmanListCreated(); if (is_null($MailmanListCreated)) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", $pEmailList->getError()); } elseif (!$MailmanListCreated) { //sino ha sido configurado se muestra un mensaje if ($credentials['userlevel'] != 'superadmin') { //solo el superadmin puede hacer esta accion $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("A new List can not be added because some configurations are missed. Please contact with Elastix Admisnistrator")); } else { $smarty->assign("mb_title", _tr("Message")); $smarty->assign("mb_message", _tr("In order to use this module configure the Mailman Admin Settings. Click here >> ") . "<a href='?menu={$module_name}&action=mailman_settings'>" . _tr('Mailman Settings') . "</a>"); } } else { if ($pORGZ->getNumOrganization(array()) > 0) { if ($create_permission) { $oGrid->addNew("new_emaillist", _tr("New Email list")); } /*if($del_permission) $oGrid->deleteList(_tr("Are you sure you wish to delete the Email List(s)."),"delete",_tr("Delete"));*/ $arrOrgz = array(0 => "all"); if ($credentials['userlevel'] == "superadmin") { foreach ($pORGZ->getOrganization(array()) as $value) { $arrOrgz[$value["domain"]] = $value["domain"]; } $_POST["domain"] = $org_domain; $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization") . " = " . $arrOrgz[$org_domain], $_POST, array("domain" => 0), true); //organization } $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Name List") . " = " . $name_list, $_POST, array("name_list" => "")); //name_list $arrFormElements = createFieldFilter($arrOrgz); $oFilterForm = new paloForm($smarty, $arrFormElements); $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST); $oGrid->showFilter(trim($htmlFilter)); } else { $smarty->assign("mb_title", _tr("Error")); $smarty->assign("mb_message", _tr("In order to use this module must exist at least 1 organization in the Elastix Server")); } } $content = $oGrid->fetchGrid(array(), $arrData); return $content; }
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; }