function reportDhcpClientlist($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf) { $pDhcpClientlist = new paloSantoDhcpClienList($pDB); $filter_field = ""; $filter_value = ""; $action = getParameter("nav"); $start = getParameter("start"); //begin grid parameters $oGrid = new paloSantoGrid($smarty); $limit = 20; $arrResult = $pDhcpClientlist->getDhcpClientList(); $total = count($arrResult); $oGrid->setLimit($limit); $oGrid->setTotal($total); $oGrid->calculatePagination($action, $start); $offset = $oGrid->getOffsetValue(); $end = $oGrid->getEnd(); $url = "?menu={$module_name}"; $arrData = null; if (is_array($arrResult) && count($arrResult) > 0) { for ($i = 1; $i <= $total; $i++) { //$arrTmp[0] = "<input type='checkbox' name='DhcpListID_$i' />"; // $arrTmp[1] = "<a href='?menu=$module_name&action=show&id=".$id."'>".$arrResult[$id]['iphost']."</a>"; $arrTmp[0] = "" . $arrResult[$i]['iphost']; $arrTmp[1] = "" . $arrResult[$i]['macaddress']; $arrTmp[2] = "<a href='?menu={$module_name}&action=see_dhcpclient&id=" . $i . "'>" . _tr("View Details") . "</a>"; $arrData[] = $arrTmp; } } $buttonDelete = "<input type='submit' name='delete_dhcpclient' value='" . _tr("Delete") . "' class='button' onclick=\" return confirmSubmit('" . _tr("Are you sure you wish to delete the Ip.") . "');\" />"; $arrGrid = array("title" => _tr("DHCP Client List"), "icon" => "web/apps/{$module_name}/images/system_network_dhcp_client_list.png", "width" => "99%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total, "url" => $url, "columns" => array(0 => array("name" => _tr("IP Address"), "property1" => ""), 1 => array("name" => _tr("MAC Address"), "property1" => ""), 2 => array("name" => _tr("Action"), "property1" => ""))); //begin section filter // $arrFormFilterDhcplist = createFieldFilter(); // $oFilterForm = new paloForm($smarty, $arrFormFilterDhcplist); // $smarty->assign("SHOW", _tr("Show")); $smarty->assign("NEW_DHCPCLIENT", _tr("New Dhcp client")); // $htmlFilter = $oFilterForm->fetchForm("$local_templates_dir/filter.tpl","",$_POST); //end section filter // $oGrid->showFilter(trim($htmlFilter)); $contenidoModulo = $oGrid->fetchGrid($arrGrid, $arrData); if (strpos($contenidoModulo, '<form') === FALSE) { $contenidoModulo = "<form method='POST' style='margin-bottom:0;' action={$url}>{$contenidoModulo}</form>"; } //end grid parameters return $contenidoModulo; }
function listURL($pDB, $smarty, $module_name, $local_templates_dir) { $urls = new externalUrl($pDB); $grid = new paloSantoGrid($smarty); $dtypes = descOpenType(); // para el pagineo $grid->setLimit(15); $grid->setTotal($urls->countURLs()); $offset = $grid->calculateOffset(); $listaUrls = $urls->getURLs($grid->getLimit(), $grid->getOffsetValue()); $data = array(); foreach ($listaUrls as $tuplaUrl) { $data[] = array($tuplaUrl['active'] ? _tr('Yes') : _tr('No'), $dtypes[$tuplaUrl['opentype']], htmlentities($tuplaUrl['urltemplate'], ENT_COMPAT, 'UTF-8'), htmlentities($tuplaUrl['description'], ENT_COMPAT, 'UTF-8'), "<a href='?menu={$module_name}&action=edit_url&id_url=" . $tuplaUrl['id'] . "'>[" . _tr('Edit') . "]</a>"); } //$grid->addNew("?menu=$module_name&action=new_url", _tr('New URL'), true); $grid->showFilter("<div align=\"right\"><a href=\"?menu={$module_name}&action=new_url\"><b>" . _tr('New URL') . "»</b></a></div>"); $grid->setTitle(_tr('External URLs')); $grid->setColumns(array(_tr('Active'), _tr('Opens in'), _tr('URL Template'), _tr('Description'), _tr('Options'))); $grid->setData($data); return $grid->fetchGrid(); }
function reportReportCall($smarty, $module_name, $local_templates_dir, &$pDB_cdr, &$pDB_billing, $arrConf, $arrLang) { $pReportCall = new paloSantoReportCall($pDB_cdr, $pDB_billing); //PARAMETERS $type = getParameter("option_fil"); $value_tmp = getParameter("value_fil"); $date_ini_tmp = getParameter("date_from"); $date_end_tmp = getParameter("date_to"); $order_by_tmp = getParameter("order_by"); $order_type_tmp = getParameter("order_type"); $action = getParameter("nav"); $start = getParameter("start"); $value = isset($value_tmp) ? $value_tmp : ""; $order_by = isset($order_by_tmp) ? $order_by_tmp : 1; $order_type = isset($order_type_tmp) ? $order_type_tmp : "asc"; $date_from = isset($date_ini_tmp) ? $date_ini_tmp : date("d M Y"); $date_to = isset($date_end_tmp) ? $date_end_tmp : date("d M Y"); $date_ini = translateDate($date_from) . " 00:00:00"; $date_end = translateDate($date_to) . " 23:59:59"; //********************************** //begin grid parameters $oGrid = new paloSantoGrid($smarty); $limit = 40; $total = $pReportCall->ObtainNumberDevices($type, $value); $oGrid->setLimit($limit); $oGrid->setTotal($total); $oGrid->calculatePagination($action, $start); $offset = $oGrid->getOffsetValue(); $end = $oGrid->getEnd(); $urlFields = array('menu' => $module_name, 'option_fil' => $type, 'value_fil' => $value, 'date_from' => $date_from, 'date_to' => $date_to); $url = construirUrl($urlFields, array('nav', 'start')); $urlFields['order_by'] = $order_by; $urlFields['order_type'] = $order_type; $smarty->assign("order_by", $order_by); $smarty->assign("order_type", $order_type); $arrData = null; $arrResult = $pReportCall->ObtainReportCall($limit, $offset, $date_ini, $date_end, $type, $value, $order_by, $order_type); $order_type = $order_type == "desc" ? "asc" : "desc"; if (is_array($arrResult) && $total > 0) { foreach ($arrResult as $key => $val) { $ext = $val['extension']; $arrTmp[0] = $ext; $arrTmp[1] = $val['user_name']; $arrTmp[2] = $val['num_incoming_call']; $arrTmp[3] = $val['num_outgoing_call']; $arrTmp[4] = "<label style='color: green;' title='{$val['duration_incoming_call']} {$arrLang['seconds']}'>" . $pReportCall->Sec2HHMMSS($val['duration_incoming_call']) . "</label>"; $arrTmp[5] = "<label style='color: green;' title='{$val['duration_outgoing_call']} {$arrLang['seconds']}'>" . $pReportCall->Sec2HHMMSS($val['duration_outgoing_call']) . "</label>"; $arrTmp[6] = "<a href='javascript: popup_ventana(\"?menu={$module_name}&action=graph&rawmode=yes&ext={$ext}&dini={$date_ini}&dfin={$date_end}\");'>" . "" . $arrLang['Call Details'] . "</a>"; $arrData[] = $arrTmp; } } $img = "<img src='images/flecha_{$order_type}.png' border='0' align='absmiddle'>"; $leyend_1 = "<a class='link_summary_off' href='{$url}&order_by=1&order_type=asc'>{$arrLang["Extension"]}</a>"; $leyend_2 = "<a class='link_summary_off' href='{$url}&order_by=2&order_type=asc'>{$arrLang["User name"]}</a>"; $leyend_3 = "<a class='link_summary_off' href='{$url}&order_by=3&order_type=asc'>{$arrLang["Num. Incoming Calls"]}</a>"; $leyend_4 = "<a class='link_summary_off' href='{$url}&order_by=4&order_type=asc'>{$arrLang["Num. Outgoing Calls"]}</a>"; $leyend_5 = "<a class='link_summary_off' href='{$url}&order_by=5&order_type=asc'>{$arrLang["Sec. Incoming Calls"]}</a>"; $leyend_6 = "<a class='link_summary_off' href='{$url}&order_by=6&order_type=asc'>{$arrLang["Sec. Outgoing Calls"]}</a>"; if ($order_by == 1) { $leyend_1 = "<a class='link_summary_on' href='{$url}&order_by=1&order_type={$order_type}'>{$arrLang["Extension"]} {$img}</a>"; } else { if ($order_by == 2) { $leyend_2 = "<a class='link_summary_on' href='{$url}&order_by=2&order_type={$order_type}'>{$arrLang["User name"]} {$img}</a>"; } else { if ($order_by == 3) { $leyend_3 = "<a class='link_summary_on' href='{$url}&order_by=3&order_type={$order_type}'>{$arrLang["Num. Incoming Calls"]} {$img}</a>"; } else { if ($order_by == 4) { $leyend_4 = "<a class='link_summary_on' href='{$url}&order_by=4&order_type={$order_type}'>{$arrLang["Num. Outgoing Calls"]} {$img}</a>"; } else { if ($order_by == 5) { $leyend_5 = "<a class='link_summary_on' href='{$url}&order_by=5&order_type={$order_type}'>{$arrLang["Sec. Incoming Calls"]} {$img}</a>"; } else { if ($order_by == 6) { $leyend_6 = "<a class='link_summary_on' href='{$url}&order_by=6&order_type={$order_type}'>{$arrLang["Sec. Outgoing Calls"]} {$img}</a>"; } } } } } } $arrGrid = array("title" => $arrLang["Summary by Extension"], "icon" => "images/list.png", "width" => "100%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total, "url" => $urlFields, "columns" => array(0 => array("name" => $leyend_1, "property1" => ""), 1 => array("name" => $leyend_2, "property1" => ""), 2 => array("name" => $leyend_3, "property1" => ""), 3 => array("name" => $leyend_4, "property1" => ""), 4 => array("name" => $leyend_5, "property1" => ""), 5 => array("name" => $leyend_6, "property1" => ""), 6 => array("name" => $arrLang["Details"], "property1" => ""))); //begin section filter $arrFormFilterReportCall = createFieldForm($arrLang); $oFilterForm = new paloForm($smarty, $arrFormFilterReportCall); $_POST['option_fil'] = $type; $_POST['value_fil'] = $value; $_POST['date_from'] = $date_from; $_POST['date_to'] = $date_to; $smarty->assign("SHOW", $arrLang["Show"]); if ($_POST["date_from"] === "") { $_POST["date_from"] = " "; } if ($_POST['date_to'] === "") { $_POST['date_to'] = " "; } $oGrid->addFilterControl(_tr("Filter applied: ") . _tr("Start Date") . " = " . $date_from . ", " . _tr("End Date") . " = " . $date_to, $_POST, array("date_from" => date("d M Y"), "date_to" => date("d M Y")), true); $valueType = ""; if (!is_null($type)) { if ($type == "Ext") { $valueType = _tr("Extension"); } else { $valueType = _tr("User"); } } $oGrid->addFilterControl(_tr("Filter applied: ") . $valueType . " = " . $value, $_POST, array("option_fil" => "Ext", "value_fil" => "")); $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST); //end section filter $oGrid->showFilter(trim($htmlFilter)); $contenidoModulo = $oGrid->fetchGrid($arrGrid, $arrData, $arrLang); return $contenidoModulo; }
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, $wasSaved = false, $value_action = "", $value_start = 0) { global $arrLang; $pGroupPermission = new paloSantoGroupPermission(); $filter_group = getParameter("filter_group"); $id_administrador = 1; $filter_group = isset($filter_group) ? $filter_group : $id_administrador; $filter_resource = getParameter("filter_resource"); $action = getParameter("nav"); $start = getParameter("start"); if ($wasSaved) { $action = $value_action; $start = $value_start; } //begin grid parameters $oGrid = new paloSantoGrid($smarty); $parameter_to_find = array(); $lang = get_language(); if ($lang != "en") { foreach ($arrLang as $key => $value) { $langValue = strtolower(trim($value)); $filter_value = strtolower(trim($filter_resource)); if ($filter_value != "") { if (preg_match("/^[[:alnum:]| ]*\$/", $filter_value)) { if (strpos($langValue, $filter_value) !== FALSE) { $parameter_to_find[] = $key; } } } } } $parameter_to_find[] = $filter_resource; if (empty($parameter_to_find)) { $totalGroupPermission = $pGroupPermission->ObtainNumResouces($filter_resource); } else { $totalGroupPermission = $pGroupPermission->ObtainNumResouces($parameter_to_find); } $limit = 25; $total = $totalGroupPermission; $oGrid->setLimit($limit); $oGrid->setTotal($total); $oGrid->calculatePagination($action, $start); $offset = $oGrid->getOffsetValue(); $end = $oGrid->getEnd(); $arrData = null; if (empty($parameter_to_find)) { $arrResult = $pGroupPermission->ObtainResources($limit, $offset, $filter_resource); } else { $arrResult = $pGroupPermission->ObtainResources($limit, $offset, $parameter_to_find); } $url = array('menu' => $module_name, 'filter_group' => $filter_group, 'filter_resource' => $filter_resource); $idGroup = $filter_group; $arrPermisos = $pGroupPermission->loadGroupPermissionsACL($idGroup); $arrPermisos = OrderGroupPermissions($arrPermisos); $isAdministrator = $idGroup == 1 ? true : false; if (is_array($arrResult) && $total > 0) { foreach ($arrResult as $key => $resource) { $disabled = ""; if (($resource["name"] == 'usermgr' || $resource["name"] == 'grouplist' || $resource["name"] == 'userlist' || $resource["name"] == 'group_permission') & $isAdministrator) { $disabled = "disabled='disabled'"; } $checked0 = ""; $checked1 = ""; $checked2 = ""; $checked3 = ""; $checked4 = ""; if (isset($arrPermisos[$resource["name"]])) { $T = $arrPermisos[$resource["name"]]; $T = $T["actions"]; foreach ($T as $num => $key) { if ($key == "access") { $checked0 = "checked"; } if ($key == "view") { $checked1 = "checked"; } if ($key == "create") { $checked2 = "checked"; } if ($key == "delete") { $checked3 = "checked"; } if ($key == "update") { $checked4 = "checked"; } } } $arrTmp[0] = "<input type='checkbox' {$disabled} name='groupPermission[" . $resource["name"] . "][" . $resource["id"] . "]' {$checked0}>"; $arrTmp[1] = _tr($resource["description"]); $arrTmp[2] = "<input type='checkbox' {$disabled} name='viewPermission[" . $resource["name"] . "][" . $resource["id"] . "]' {$checked1}>"; $arrTmp[3] = "<input type='checkbox' {$disabled} name='createPermission[" . $resource["name"] . "][" . $resource["id"] . "]' {$checked2}>"; $arrTmp[4] = "<input type='checkbox' {$disabled} name='deletePermission[" . $resource["name"] . "][" . $resource["id"] . "]' {$checked3}>"; $arrTmp[5] = "<input type='checkbox' {$disabled} name='updatePermission[" . $resource["name"] . "][" . $resource["id"] . "]' {$checked4}>"; $arrData[] = $arrTmp; } } $arrGrid = array("title" => _tr("Group Permission"), "icon" => "images/list.png", "width" => "99%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total, "url" => $url, "columns" => array(0 => array("name" => "<input class='button' type='submit' name='apply' value='" . _tr('Apply') . "' />", "property1" => ""), 1 => array("name" => _tr("Resource"), "property1" => ""))); //begin section filter $arrFormFilterGroupPermission = createFieldFilter($pGroupPermission); $oFilterForm = new paloForm($smarty, $arrFormFilterGroupPermission); $smarty->assign("SHOW", _tr("Show")); $_POST["filter_group"] = $filter_group; $_POST["filter_resource"] = $filter_resource; $nameGroup = $arrFormFilterGroupPermission["filter_group"]["INPUT_EXTRA_PARAM"][$filter_group]; $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Group") . " = {$nameGroup}", $_POST, array("filter_group" => 1), true); $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Resource") . " = {$filter_resource}", $_POST, array("filter_resource" => "")); //ayuda para el pagineo -> estod datos son tomados en la function applyGroupPermission($smarty, $module_name, ...... //ayuda a que despues de "aplicar" se quede en la misma pagina $smarty->assign("resource_apply", htmlspecialchars($filter_resource, ENT_COMPAT, 'UTF-8')); $smarty->assign("limit_apply", htmlspecialchars($limit, ENT_COMPAT, 'UTF-8')); $smarty->assign("offset_apply", htmlspecialchars($offset, ENT_COMPAT, 'UTF-8')); $smarty->assign("action_apply", htmlspecialchars($action, ENT_COMPAT, 'UTF-8')); $smarty->assign("start_apply", htmlspecialchars($start, ENT_COMPAT, 'UTF-8')); $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 reportIncomingcallsmonitoring($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $arrLang) { $pIncomingcallsmonitoring = new paloSantoIncomingcallsmonitoring($pDB); $filter_field = getParameter("filter_field"); $filter_value = getParameter("filter_value"); $action = getParameter("nav"); $start = getParameter("start"); //begin grid parameters $oGrid = new paloSantoGrid($smarty); $totalIncomingcallsmonitoring = $pIncomingcallsmonitoring->ObtainNumIncomingcallsmonitoring($filter_field, $filter_value); $limit = 20; $total = $totalIncomingcallsmonitoring; $oGrid->setLimit($limit); $oGrid->setTotal($total); $oGrid->calculatePagination($action, $start); $offset = $oGrid->getOffsetValue(); $end = $oGrid->getEnd(); $url = "?menu={$module_name}&filter_field={$filter_field}&filter_value={$filter_value}"; $arrData = null; $arrResult = $pIncomingcallsmonitoring->ObtainIncomingcallsmonitoring($limit, $offset, $arrLang, $filter_field, $filter_value); if (is_array($arrResult)) { foreach ($arrResult as $key => $value) { $arrTmp[0] = $value['queue']; $arrTmp[1] = isset($value['entered']) ? $value['entered'] : "0"; $arrTmp[2] = isset($value['answered']) ? $value['answered'] : "0"; $arrTmp[3] = isset($value['abandoned']) ? $value['abandoned'] : "0"; $arrTmp[4] = isset($value['waiting_calls']) ? $value['waiting_calls'] : "0"; $arrTmp[5] = isset($value['without_monitoring']) ? $value['without_monitoring'] : "0"; $arrData[] = $arrTmp; } } $arrGrid = array("title" => $arrLang["Incoming calls monitoring"], "icon" => "images/list.png", "width" => "99%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total, "url" => $url, "columns" => array(0 => array("name" => $arrLang["Queue"], "property1" => ""), 1 => array("name" => $arrLang["Entered"], "property1" => ""), 2 => array("name" => $arrLang["Answered"], "property1" => ""), 3 => array("name" => $arrLang["Abandoned"], "property1" => ""), 4 => array("name" => $arrLang["Waiting calls"], "property1" => ""), 5 => array("name" => $arrLang["Without monitoring"], "property1" => ""))); //begin section filter $arrFormFilterIncomingcallsmonitoring = createFieldFilter($arrLang); $oFilterForm = new paloForm($smarty, $arrFormFilterIncomingcallsmonitoring); // $smarty->assign("SHOW", $arrLang["Show"]); // $htmlFilter = $oFilterForm->fetchForm("$local_templates_dir/filter.tpl","",$_POST); //end section filter // $oGrid->showFilter(trim($htmlFilter)); $content = $oGrid->fetchGrid($arrGrid, $arrData, $arrLang); if (strpos($content, '<form') === FALSE) { $content = "<form method=\"POST\" style=\"margin-bottom:0;\" action=\"{$url}\">{$sContenido}</form>"; } $sReloadScript = <<<SCRIPT_RELOAD <script> function reload() { xajax_create_report(); setTimeout("reload()",5000); } reload(); </script> SCRIPT_RELOAD; $content = $sReloadScript . $content; return $content; }