本文整理汇总了PHP中paloSantoGrid::calculateOffset方法的典型用法代码示例。如果您正苦于以下问题:PHP paloSantoGrid::calculateOffset方法的具体用法?PHP paloSantoGrid::calculateOffset怎么用?PHP paloSantoGrid::calculateOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paloSantoGrid
的用法示例。
在下文中一共展示了paloSantoGrid::calculateOffset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listFax
function listFax($smarty, $module_name, $local_templates_dir)
{
$limit = 30;
$oFax = new paloFax();
$total = $oFax->getTotalFax();
$oGrid = new paloSantoGrid($smarty);
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$oGrid->pagingShow(true);
$oGrid->setURL("?menu=faxlist");
$oGrid->setTitle(_tr("Virtual Fax List"));
$oGrid->setIcon("/modules/{$module_name}/images/fax_virtual_fax_list.png");
$arrColumns = array(_tr("Virtual Fax Name"), _tr("Fax Extension"), _tr("Secret"), _tr("Destination Email"), _tr("Caller ID Name"), _tr("Caller ID Number"), _tr("Status"));
$oGrid->setColumns($arrColumns);
$offset = $oGrid->calculateOffset();
$arrFax = $oFax->getFaxList($offset, $limit);
$arrFaxStatus = $oFax->getFaxStatus();
$arrData = array();
foreach ($arrFax as $fax) {
$arrTmp = array();
$arrTmp[0] = " <a href='?menu=faxnew&action=view&id=" . $fax['id'] . "'>" . $fax['name'] . "</a>";
$arrTmp[1] = $fax['extension'];
$arrTmp[2] = $fax['secret'];
$arrTmp[3] = $fax['email'];
$arrTmp[4] = $fax['clid_name'] . " ";
$arrTmp[5] = $fax['clid_number'] . " ";
$arrTmp[6] = $arrFaxStatus['modems']['ttyIAX' . $fax['dev_id']] . ' on ttyIAX' . $fax['dev_id'];
$arrData[] = $arrTmp;
}
$session = getSession();
$session['faxlist']['faxListStatus'] = $arrData;
putSession($session);
$oGrid->setData($arrData);
return $oGrid->fetchGrid();
}
示例2: listarUsuarios
function listarUsuarios($pDB, $smarty, $module_name, $local_templates_dir)
{
global $arrLang;
$oUsuarios = new UsuariosECCP($pDB);
$smarty->assign(array('MODULE_NAME' => $module_name, 'LABEL_CREATE_USER' => _tr('New ECCP User')));
// Manejar posible borrado de agentes
if (isset($_POST['delete']) && isset($_POST['id']) && ctype_digit($_POST['id'])) {
$bExito = $oUsuarios->borrarUsuario($_POST['id']);
if (!$bExito) {
$smarty->assign(array('mb_title' => _tr('Error when deleting user'), 'mb_message' => $oUsuarios->errMsg));
}
}
// Listar todos los agentes
$oGrid = new paloSantoGrid($smarty);
$oGrid->setLimit(50);
$oGrid->setTotal($oUsuarios->contarUsuarios());
$offset = $oGrid->calculateOffset();
$listaAgentes = $oUsuarios->listarUsuarios(NULL, $offset, $oGrid->getLimit());
$arrData = array();
foreach ($listaAgentes as $t) {
$arrData[] = array('<input type="radio" name="id" value="' . $t['id'] . '" />', htmlentities($t['username'], ENT_COMPAT, 'UTF-8'), '<a href="?menu=' . $module_name . '&action=edit_user&id=' . $t['id'] . '">[' . _tr('Edit') . ']</a>');
}
$url = construirURL(array('menu' => $module_name), array('nav', 'start'));
$arrGrid = array("title" => _tr('ECCP User List'), "url" => $url, "icon" => 'images/user.png', "width" => "99%", "columns" => array(0 => array("name" => '<input type="submit" class="button" name="delete" value="' . htmlentities(_tr('Delete'), ENT_COMPAT, 'UTF-8') . '" onclick="return confirmSubmit(' . "'" . htmlentities(_tr('Are you sure to delete this user?'), ENT_COMPAT, 'UTF-8') . "'" . ')" />'), 1 => array("name" => _tr('Name')), 2 => array("name" => _tr('Options'))));
$oGrid->showFilter($smarty->fetch("{$local_templates_dir}/filter-list-users.tpl"));
$sContenido = $oGrid->fetchGrid($arrGrid, $arrData, $arrLang);
if (strpos($sContenido, '<form') === FALSE) {
$sContenido = "<form method=\"POST\" style=\"margin-bottom:0;\" action=\"{$url}\">{$sContenido}</form>";
}
return $sContenido;
}
示例3: listRepositories
function listRepositories($smarty, $module_name, $local_templates_dir, $arrConf)
{
$oRepositories = new PaloSantoRepositories();
$arrReposActivos = array();
$typeRepository = getParameter("typeRepository");
if (isset($_POST['submit_aceptar'])) {
foreach ($_POST as $key => $value) {
if (substr($key, 0, 5) == 'repo-') {
$arrReposActivos[] = substr($key, 5);
}
}
$oRepositories->setRepositorios($arrConf['ruta_repos'], $arrReposActivos, $typeRepository, $arrConf["main_repos"]);
}
$option["main"] = "";
$option["others"] = "";
$option["all"] = "";
$arrRepositorios = $oRepositories->getRepositorios($arrConf['ruta_repos'], $typeRepository, $arrConf["main_repos"]);
$limit = 40;
$total = count($arrRepositorios);
$oGrid = new paloSantoGrid($smarty);
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
$end = $oGrid->getEnd();
$arrData = array();
$version = $oRepositories->obtenerVersionDistro();
$arch = $oRepositories->obtenerArquitectura();
if (is_array($arrRepositorios)) {
for ($i = $offset; $i < $end; $i++) {
$activo = "";
if ($arrRepositorios[$i]['activo']) {
$activo = "checked='checked'";
}
$arrData[] = array("<input {$activo} name='repo-" . $arrRepositorios[$i]['id'] . "' type='checkbox' id='repo-{$i}' />", $valor = str_replace(array("\$releasever", "\$basearch"), array($version, $arch), $arrRepositorios[$i]['name']));
}
}
if (isset($typeRepository)) {
$oGrid->setURL("?menu={$module_name}&typeRepository={$typeRepository}");
$_POST["typeRepository"] = $typeRepository;
} else {
$oGrid->setURL("?menu={$module_name}");
$_POST["typeRepository"] = "main";
}
$arrGrid = array("title" => _tr("Repositories"), "icon" => "web/apps/{$module_name}/images/system_updates_repositories.png", "width" => "99%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total, "columns" => array(0 => array("name" => _tr("Active"), "property1" => ""), 1 => array("name" => _tr("Name"), "property1" => "")));
$oGrid->customAction('submit_aceptar', _tr('Save/Update'));
$oGrid->addButtonAction("default", _tr('Default'), null, "defaultValues({$total},'{$version}','{$arch}')");
$FilterForm = new paloForm($smarty, createFilter());
$arrOpt = array("main" => _tr('Main'), "others" => _tr('Others'), "all" => _tr('All'));
if (isset($arrOpt[$typeRepository])) {
$valorfiltro = $arrOpt[$typeRepository];
} else {
$valorfiltro = _tr('Main');
}
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Repo") . " = " . $valorfiltro, $_POST, array("typeRepository" => "main"), true);
$htmlFilter = $FilterForm->fetchForm("{$local_templates_dir}/new.tpl", "", $_POST);
$oGrid->showFilter($htmlFilter);
$contenidoModulo = $oGrid->fetchGrid($arrGrid, $arrData);
return $contenidoModulo;
}
示例4: listPackages
function listPackages($smarty, $module_name, $local_templates_dir, $arrConf)
{
$oPackages = new PaloSantoPackages($arrConf['ruta_yum']);
$submitInstalado = getParameter('submitInstalado');
$nombre_paquete = getParameter('nombre_paquete');
$smarty->assign(array('module_name' => $module_name, 'RepositoriesUpdate' => _tr('Repositories Update'), 'Search' => _tr('Search'), 'UpdatingRepositories' => _tr('Updating Repositories'), 'InstallPackage' => _tr('Installing Package'), 'UpdatePackage' => _tr('Updating Package'), 'accionEnProceso' => _tr('There is an action in process'), 'msgConfirmDelete' => _tr('You will uninstall package along with everything what it depends on it. System can lose important functionalities or become unstable! Are you sure want to Uninstall?'), 'msgConfirmInstall' => _tr('Are you sure want to Install this package?'), 'UninstallPackage' => _tr('Uninstalling Package'), 'msgConfirmUpdate' => _tr('Are you sure want to Update this package?')));
$arrPaquetes = $oPackages->listarPaquetes($submitInstalado == 'all' ? 'all' : 'installed', $nombre_paquete);
if ($oPackages->bActualizar) {
$smarty->assign("mb_title", _tr("Message"));
$smarty->assign("mb_message", _tr("The repositories are not up to date. Click on the") . " <b>\"" . _tr('Repositories Update') . "\"</b> " . _tr("button to list all available packages."));
}
// Pagination
$limit = 20;
$total = count($arrPaquetes);
$oGrid = new paloSantoGrid($smarty);
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
$end = $oGrid->getEnd();
$arrPaquetes = array_slice($arrPaquetes, $offset, $limit);
$arrData = array();
foreach ($arrPaquetes as $paquete) {
$packageActions = array();
$tmpPaquete = $paquete['name'] . '.' . $paquete['arch'];
if ($paquete['canupdate']) {
$packageActions[] = "<a href='#' onclick=" . "confirmUpdate('{$tmpPaquete}')" . ">[" . _tr('Update') . "]</a>";
}
if (is_null($paquete['version'])) {
$packageActions[] = "<a href='#' onclick=" . "installaPackage('{$tmpPaquete}',0)" . ">[" . _tr('Install') . "]</a>";
} else {
$packageActions[] = "<a href='#' onclick=" . "confirmDelete('{$tmpPaquete}')" . ">[" . _tr('Uninstall') . "]</a>";
}
$rowData = array($paquete['name'], $paquete['arch'], $paquete['summary'], is_null($paquete['version']) ? _tr('(not installed)') : $paquete['version'] . '-' . $paquete['release'], is_null($paquete['latestversion']) ? _tr('(not available)') : $paquete['latestversion'] . '-' . $paquete['latestrelease'], $paquete['repo'], implode(' ', $packageActions));
if ($paquete['canupdate']) {
$rowData[0] = '<b>' . $rowData[0] . '</b>';
$rowData[4] = '<b>' . $rowData[4] . '</b>';
}
$arrData[] = $rowData;
}
$url = array('menu' => $module_name, 'submitInstalado' => $submitInstalado, 'nombre_paquete' => $nombre_paquete);
$arrGrid = array("title" => _tr('Packages'), "icon" => "web/apps/{$module_name}/images/system_updates_packages.png", "width" => "99%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total, "url" => $url, "columns" => array(array("name" => _tr("Package Name")), array("name" => _tr("Architecture")), array("name" => _tr("Package Info")), array('name' => _tr('Current Version')), array('name' => _tr('Available Version')), array("name" => _tr("Repositor Place")), array("name" => _tr("Status"))));
/*Inicio Parte del Filtro*/
$arrFilter = filterField();
$oFilterForm = new paloForm($smarty, $arrFilter);
if (getParameter('submitInstalado') == 'all') {
$arrFilter["submitInstalado"] = 'all';
$tipoPaquete = _tr('All Package');
} else {
$arrFilter["submitInstalado"] = 'installed';
$tipoPaquete = _tr('Package Installed');
}
$arrFilter["nombre_paquete"] = $nombre_paquete;
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Status") . " = {$tipoPaquete}", $arrFilter, array("submitInstalado" => "installed"), true);
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Name") . " = {$nombre_paquete}", $arrFilter, array("nombre_paquete" => ""));
$oGrid->addButtonAction('update_repositorios', _tr('Repositories Update'), null, 'mostrarReloj()');
$oGrid->showFilter($oFilterForm->fetchForm("{$local_templates_dir}/new.tpl", '', $arrFilter));
return $oGrid->fetchGrid($arrGrid, $arrData);
}
示例5: listURL
function listURL($pDB, $smarty, $module_name, $local_templates_dir)
{
$urls = new externalUrl($pDB);
$grid = new paloSantoGrid($smarty);
$dtypes = descOpenType();
// para el pagineo
$grid->setLimit(15);
$grid->setTotal($urls->countURLs());
$offset = $grid->calculateOffset();
$listaUrls = $urls->getURLs($grid->getLimit(), $grid->getOffsetValue());
$data = array();
foreach ($listaUrls as $tuplaUrl) {
$data[] = array($tuplaUrl['active'] ? _tr('Yes') : _tr('No'), $dtypes[$tuplaUrl['opentype']], htmlentities($tuplaUrl['urltemplate'], ENT_COMPAT, 'UTF-8'), htmlentities($tuplaUrl['description'], ENT_COMPAT, 'UTF-8'), "<a href='?menu={$module_name}&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();
}
示例6: reportGroup
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;
}
示例7: reportListadodeCallTypes
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;
}
示例8: reportWeakKeys
function reportWeakKeys($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf)
{
$pWeakKeys = new paloSantoWeakKeys($pDB);
$filter_field = getParameter("filter_field");
$filter_value = getParameter("filter_value");
//begin grid parameters
$oGrid = new paloSantoGrid($smarty);
$total = $pWeakKeys->getNumWeakKeys($filter_field, $filter_value);
$pDB2 = new paloDB($arrConf['elastix_dsn']['acl']);
$pACL = new paloACL($pDB2);
$oGrid->enableExport();
// enable csv export.
$oGrid->pagingShow(true);
// show paging section.
$oGrid->setTitle(_tr("Weak Secrets"));
$oGrid->setIcon("modules/{$module_name}/images/security_weak_keys.png");
$oGrid->setNameFile_Export(_tr("Weak Secrets"));
if ($oGrid->isExportAction()) {
$limit = $total;
$offset = 0;
$bExportation = true;
} else {
$limit = 30;
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
$bExportation = false;
}
$url = array('menu' => $module_name, 'filter_field' => $filter_field, 'filter_value' => $filter_value);
$oGrid->setURL($url);
$arrResult = $pWeakKeys->getWeakKeys($limit, $offset, $filter_field, $filter_value);
$arrData = null;
//$arrResult =$pWeakKeys->getWeakKeysChecker();
$arrColumns = array(_tr("Extension"), _tr("Description"), _tr("Status"));
$oGrid->setColumns($arrColumns);
if (is_array($arrResult) && $total > 0) {
foreach ($arrResult as $tech) {
foreach ($tech as $key => $value) {
$arrTmp[0] = $value['id'];
$arrTmp[1] = $value['description'];
$mensaje = getMensaje($value['id'], $value['data']);
if ($mensaje != "OK" && !$bExportation) {
if ($pACL->isUserAdministratorGroup($_SESSION['elastix_user']) || $pACL->getUserExtension($_SESSION['elastix_user']) == $value['id']) {
$mensaje = _tr("Weak Key") . ": {$mensaje} <a href='?menu={$module_name}&action=change&id={$value['id']}'>" . _tr("Change Secret") . "</a>";
}
}
$arrTmp[2] = $mensaje;
$arrData[] = $arrTmp;
}
}
}
$oGrid->setData($arrData);
//begin section filter
$arrFormFilterWeakKeys = createFieldFilter();
$oFilterForm = new paloForm($smarty, $arrFormFilterWeakKeys);
$smarty->assign("SHOW", _tr("Show"));
$_POST["filter_field"] = $filter_field;
$_POST["filter_value"] = $filter_value;
$oGrid->addFilterControl(_tr("Filter applied: ") . _tr("Extension") . " = " . $filter_value, $_POST, array("filter_field" => "extension", "filter_value" => ""));
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
//end section filter
$oGrid->showFilter(trim($htmlFilter));
$content = $oGrid->fetchGrid();
//end grid parameters
return $content;
}
示例9: reportRules
function reportRules($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf)
{
$pRules = new paloSantoRules($pDB);
$action = getParameter("action");
$id = getParameter("id");
$smarty->assign("ID", $id);
$oFilterForm = new paloForm($smarty, array());
//begin grid parameters
$oGrid = new paloSantoGrid($smarty);
$first_time = $pRules->isFirstTime();
//$oGrid->setTplFile("$local_templates_dir/_list.tpl");
$totalRules = $pRules->ObtainNumRules();
$error = "";
if ($action == 'edit') {
$arrtmp = $pRules->getRule($id);
$arripsource = explode("/", $arrtmp['ip_source']);
$arripdst = explode("/", $arrtmp['ip_destiny']);
$arrValues['id_traffic'] = $arrtmp['traffic'];
$arrValues['interface_in'] = $arrtmp['eth_in'];
$arrValues['interface_out'] = $arrtmp['eth_out'];
$arrValues['ip_source'] = $arripsource[0];
$arrValues['mask_source'] = $arripsource[1];
$arrValues['port_in'] = $arrtmp['sport'];
$arrValues['ip_destin'] = $arripdst[0];
$arrValues['mask_destin'] = $arripdst[1];
$arrValues['port_out'] = $arrtmp['dport'];
$arrValues['type_icmp'] = $arrtmp['icmp_type'];
$arrValues['id_ip'] = $arrtmp['number_ip'];
$arrValues['id_protocol'] = $arrtmp['protocol'];
$arrValues['target'] = $arrtmp['target'];
$arrValues['orden'] = $arrtmp['rule_order'];
$arrValues['state'] = $arrtmp['state'];
$arrValues['id'] = $id;
$content = newRules($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrValues, $action);
return $content;
} elseif ($action == 'Activate') {
$pRules->setActivated($id);
} elseif ($action == 'Desactivate') {
$pRules->setDesactivated($id);
}
$limit = 30;
$total = $totalRules;
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$oGrid->setTitle(_tr("FireWall Rules"));
$oGrid->setIcon("/modules/{$module_name}/images/security_firewall_rules.png");
$oGrid->pagingShow(true);
$offset = $oGrid->calculateOffset();
$url = "?menu={$module_name}";
$oGrid->setURL($url);
$arrData = null;
$arrResult = $pRules->ObtainRules($limit, $offset);
$start = getParameter("start");
$accion = getParameter("nav");
if ($accion == "end") {
if ($total % $limit == 0) {
$start = $total - 2 * $limit + 1;
} else {
$start = $total - $total % $limit - $limit + 1;
}
} elseif ($accion == "previous") {
$start = $start - 2 * $limit;
}
if ($first_time) {
$arrColumns = array("", _tr("Order"), _tr("Traffic"), _tr("Target"), _tr("Interface"), _tr("IP Source"), _tr("IP Destiny"), _tr("Protocol"), _tr("Details"));
} else {
$oGrid->deleteList("Are you sure you wish to delete the Rule?", "delete", _tr("Delete"));
$arrColumns = array("", _tr("Order"), _tr("Traffic"), _tr("Target"), _tr("Interface"), _tr("IP Source"), _tr("IP Destiny"), _tr("Protocol"), _tr("Details"), "", "");
}
$oGrid->setColumns($arrColumns);
if (is_array($arrResult) && $total > 0) {
foreach ($arrResult as $key => $value) {
if (!$first_time) {
$arrTmp[0] = "<input type='checkbox' name='id_" . $value['id'] . "' />";
$arrTmp[1] = "<div id='div_{$value['id']}' style='width: 22px; font-size: 14pt;color:#E35332;float:left;text-align:right'>{$value['rule_order']} </div>";
}
if (!$first_time) {
//if($offset!=0)
$arrTmp[1] .= "<a href='javascript:void(0);' class='up' id='rulerup_{$value['id']}_{$value['rule_order']}'>" . "<img src='modules/{$module_name}/images/up.gif' border=0 title='" . _tr('Up') . "' /></a>" . "<a href='javascript:void(0);' class='down' id='rulerdown_{$value['id']}_{$value['rule_order']}'>" . "<img src='modules/{$module_name}/images/down.gif' border=0 title='" . _tr('Down') . "' /></a>";
/*else
$arrTmp[1].="<a href='?menu=$module_name&action=$changeOrder&id=$value[id]&order=$value[rule_order]&direction=up;' class='up' id='rulerup_$value[id]_$value[rule_order]'>"."<img src='modules/$module_name/images/up.gif' border=0 title='"._tr('Up')."' /></a>"."<a href='javascript:void(0);' class='down' id='rulerdown_$value[id]_$value[rule_order]'>"."<img src='modules/$module_name/images/down.gif' border=0 title='"._tr('Down')."' /></a>";*/
}
if ($value['traffic'] == "INPUT") {
$image = "modules/{$module_name}/images/fw_input.gif";
$title = _tr("INPUT");
$arrTmp[4] = _tr("IN") . ": {$value['eth_in']}";
} elseif ($value['traffic'] == "OUTPUT") {
$image = "modules/{$module_name}/images/fw_output.gif";
$title = _tr("OUTPUT");
$arrTmp[4] = _tr("OUT") . ": {$value['eth_out']}";
} else {
$image = "modules/{$module_name}/images/fw_forward.gif";
$title = _tr("FORWARD");
$arrTmp[4] = _tr("IN") . ": {$value['eth_in']}<br />" . _tr("OUT") . ": {$value['eth_out']}";
}
$arrTmp[2] = "<a><img src='{$image}' border=0 title='" . _tr($title) . "'</a>";
if ($value['target'] == "ACCEPT") {
$image = "modules/{$module_name}/images/target_accept.gif";
$title = _tr("ACCEPT");
} elseif ($value['target'] == "DROP") {
//.........这里部分代码省略.........
示例10: reportMemberList
function reportMemberList($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials)
{
global $arrPermission;
$pEmailList = new paloSantoEmailList($pDB);
$id_list = getParameter("id");
if ($credentials['userlevel'] == 'superadmin') {
$emailList = $pEmailList->getEmailList($id_list);
} else {
$emailList = $pEmailList->getEmailList($id_list, $credentials['domain']);
}
if ($emailList == false) {
$smarty->assign("mb_title", _tr("Error"));
$error = $emailList === false ? _tr("Couldn't be retrieved Email List data") : _tr("Email List does not exist");
$smarty->assign("mb_message", $error);
return reportEmailList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
}
$field_type = getParameter("filter_type");
$field_pattern = getParameter("filter_txt");
$smarty->assign("IDEMAILLIST", $id_list);
$smarty->assign("ACTION", 'view_memberlist');
$smarty->assign("SHOW", _tr("Show"));
$smarty->assign("RETURN", _tr("Return"));
$smarty->assign("LINK", "?menu={$module_name}&action=export&id={$id_list}&rawmode=yes");
$smarty->assign("EXPORT", _tr("Export Members"));
$edit_permission = in_array('edit_list', $arrPermission);
$totalMembers = $pEmailList->getTotalMembers($id_list);
$oGrid = new paloSantoGrid($smarty);
$limit = 20;
$oGrid->setLimit($limit);
$oGrid->setTotal($totalMembers);
$oGrid->setTitle(_tr("List Members of") . " " . $pEmailList->getListName($id_list));
$oGrid->setIcon("web/apps/{$module_name}/images/email.png");
$oGrid->pagingShow(true);
$offset = $oGrid->calculateOffset();
$url['menu'] = $module_name;
$url['action'] = 'view_memberlist';
$url['id'] = $id_list;
$url['filter_type'] = $field_type;
$url['filter_txt'] = $field_pattern;
$oGrid->setURL($url);
if ($edit_permission) {
$arrColumns[] = '';
}
$arrColumns[] = _tr("Member name");
$arrColumns[] = _tr("Member email");
$oGrid->setColumns($arrColumns);
$arrResult = $pEmailList->getMembers($limit, $offset, $id_list, $field_type, $field_pattern);
$arrData = null;
//print_r($arrResult);
if (is_array($arrResult) && $totalMembers > 0) {
foreach ($arrResult as $list) {
$arrTmp = array();
if ($edit_permission) {
$arrTmp[] = "<input type='checkbox' name='del_emailmembers[{$list["mailmember"]}]'>";
}
$arrTmp[] = $list["namemember"];
$arrTmp[] = $list["mailmember"];
$arrData[] = $arrTmp;
}
}
$arrFormFilterMembers = createFieldFilterViewMembers();
$oFilterForm = new paloForm($smarty, $arrFormFilterMembers);
$arrType = array("name" => _tr("Name"), "email" => _tr("Email"));
if (!is_null($field_type)) {
$nameField = $arrType[$field_type];
} else {
$nameField = "";
}
$oGrid->customAction("return", _tr("Return"));
if ($edit_permission) {
$oGrid->addNew("new_memberlist", _tr("Add Member(s) to List"));
$oGrid->deleteList(_tr("Are you sure you wish to delete the Email List(s)."), "remove_memberlist", _tr("Delete"));
}
$oGrid->customAction("?menu={$module_name}&action=export&id={$id_list}&rawmode=yes", _tr("Export Members"), null, true);
$oGrid->addFilterControl(_tr("Filter applied: ") . $nameField . " = " . $field_pattern, $_POST, array("filter_type" => "name", "filter_txt" => ""));
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/view_members.tpl", "", $_POST);
$oGrid->showFilter(trim($htmlFilter));
$content = $oGrid->fetchGrid(array(), $arrData);
return $content;
}
示例11: report_adress_book
function report_adress_book($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk)
{
$padress_book = new paloAdressBook($pDB);
$arrBooker = $padress_book->getBookerList();
$arrPayment_type = array(0 => 'Khách lẻ không thường xuyên', 1 => 'Khách lẻ thường xuyên', 2 => 'Khách hàng công ty', 3 => 'Khách hàng đại lý');
$arrComboElements = array("customer_code" => "Mã khách hàng", "firstname" => "Tên khách hàng", "phone" => "Số điện thoại", "email" => "Email", "agent_id" => "Booker", "sale" => "Kinh Doanh", "booker" => "Kế Toán", "type" => "Loại khách hàng");
$arrFormElements = array("field" => array("LABEL" => "Tìm theo", "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrComboElements, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "pattern" => array("LABEL" => "", "REQUIRED" => "no", "INPUT_TYPE" => "TEXT", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "INPUT_EXTRA_PARAM" => array('id' => 'filter_value')), "booker" => array("LABEL" => "", "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrBooker, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "payment" => array("LABEL" => "", "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrPayment_type, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""));
$oFilterForm = new paloForm($smarty, $arrFormElements);
$smarty->assign("SHOW", "Tìm");
$smarty->assign("module_name", $module_name);
$field = NULL;
$pattern = NULL;
$namePattern = NULL;
if (isset($_POST['field']) and isset($_POST['pattern']) and $_POST['pattern'] != "") {
$field = $_POST['field'];
$pattern = "%" . trim($_POST['pattern']) . "%";
$namePattern = trim($_POST['pattern']);
//$nameField=$arrComboElements[$field];
//$agent_id = $_POST['booker'];
//$payment_type = $_POST['booker'];
}
$arrFilter = array("field" => $field, "pattern" => $namePattern);
$startDate = $endDate = date("Y-m-d H:i:s");
$oGrid = new paloSantoGrid($smarty);
$oGrid->enableExport();
// enable export.
$oGrid->setNameFile_Export("HNH_KhachHang");
$oGrid->addFilterControl(_tr("Filter applied ") . $field . " = {$namePattern}", $arrFilter, array("field" => "name", "pattern" => ""));
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter_adress_book.tpl", "", $arrFilter);
$total = $padress_book->getAddressBook(NULL, NULL, $field, $pattern, TRUE);
$total_datos = $total[0]["total"];
//Paginacion
if ($oGrid->isExportAction()) {
$total = $total_datos;
$limit = $total;
$arr_cols = array(0 => array("name" => "Mã KH", "property1" => ""), 1 => array("name" => "Tên khách hàng", "property1" => ""), 2 => array("name" => "Họ/Hình thức", "property1" => ""), 3 => array("name" => "Điện thoại/Liên hệ", "property1" => ""), 4 => array("name" => "Email/Liên hệ", "property1" => ""), 5 => array("name" => "Booker", "property1" => ""), 6 => array("name" => "Kinh doanh", "property1" => ""), 7 => array("name" => "Kế toán", "property1" => ""), 8 => array("name" => "Phân loại", "property1" => ""), 9 => array("name" => "Thẻ thành viên", "property1" => ""), 10 => array("name" => "Cách thanh toán", "property1" => ""));
} else {
$limit = 20;
$total = $total_datos;
$arr_cols = array(0 => array("name" => "", "property1" => ""), 1 => array("name" => "Mã KH", "property1" => ""), 2 => array("name" => "Tên khách hàng", "property1" => ""), 3 => array("name" => "Họ/Hình thức", "property1" => ""), 4 => array("name" => "Điện thoại/Liên hệ", "property1" => ""), 5 => array("name" => "Email/Liên hệ", "property1" => ""), 6 => array("name" => "Booker", "property1" => ""), 7 => array("name" => "Kinh doanh", "property1" => ""), 8 => array("name" => "Kế toán", "property1" => ""), 9 => array("name" => "Phân loại", "property1" => ""), 10 => array("name" => "Thẻ thành viên", "property1" => ""), 11 => array("name" => "Cách thanh toán", "property1" => ""), 12 => array("name" => "Lựa chọn", "property1" => ""));
}
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
$inicio = $total == 0 ? 0 : $offset + 1;
$end = $offset + $limit <= $total ? $offset + $limit : $total;
//Fin Paginacion
$arrResult = $padress_book->getAddressBook($limit, $offset, $field, $pattern, FALSE);
//var_dump($arrResult);die;
$arrData = null;
//echo print_r($arrResult,true);
if (is_array($arrResult) && $total > 0) {
if ($oGrid->isExportAction()) {
foreach ($arrResult as $key => $adress_book) {
$typeContact = "";
switch ($adress_book['type']) {
case '0':
$typeContact = "Khách hàng lẽ";
break;
case '1':
$typeContact = "Khách lẽ thường xuyên";
break;
case '2':
$typeContact = 'Khách hàng công ty';
break;
case '3':
$typeContact = "Khách hàng đại lý";
break;
default:
break;
}
$phone_list = '';
if (isset($adress_book['number']) && count($adress_book['number']) > 0) {
foreach ($adress_book['number'] as $phone) {
$phone_list .= is_null($phone) || trim($phone) == '' ? '' : $phone . '\\n';
}
}
//SDT column
$email_list = '';
if (count($adress_book['email']) > 0) {
foreach ($adress_book['email'] as $email) {
$email_list .= is_null($email) || trim($email) == '' ? '' : $email . '\\n';
}
}
$arrTmp[] = $adress_book['customer_code'];
//Ten column
$arrTmp[] = $adress_book['firstname'];
//Ten column
$arrTmp[] = $adress_book['lastname'];
//Ten column
$arrTmp[] = $phone_list;
$arrTmp[] = $email_list;
$arrTmp[] = $adress_book['booker'];
$arrTmp[] = $adress_book['sale'];
$arrTmp[] = $adress_book['accountant'];
$arrTmp[] = $typeContact;
$arrTmp[] = $adress_book['membership'];
$arrTmp[] = $adress_book['payment'];
$arrData[] = $arrTmp;
}
//.........这里部分代码省略.........
示例12: _moduleContent
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();
//.........这里部分代码省略.........
示例13: report_backup_restore
function report_backup_restore($smarty, $module_name, $local_templates_dir, $dir_backup, &$pDB)
{
$total_archivos = array_reverse(array_map('basename', glob("{$dir_backup}/*.tar")));
// Paginacion
$limit = 10;
$total = count($total_archivos);
$oGrid = new paloSantoGrid($smarty);
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
$end = $oGrid->getEnd();
$nombre_archivos = array_slice($total_archivos, $offset, $limit);
//Fin Paginacion
// obtencion de parametros desde la base
$pFTPBackup = new paloSantoFTPBackup($pDB);
$_DATA = $pFTPBackup->getStatusAutomaticBackupById(1);
if (!(is_array($_DATA) & count($_DATA) > 0)) {
$_DATA['status'] = "DISABLED";
}
$arrData = null;
if (is_array($nombre_archivos) && $total > 0) {
foreach ($nombre_archivos as $key => $nombre_archivo) {
$arrTmp[0] = "<input type='checkbox' name='chk[" . $nombre_archivo . "]' id='chk[" . $nombre_archivo . "]'/>";
$arrTmp[1] = "<a href='?menu={$module_name}&action=download_file&file_name={$nombre_archivo}&rawmode=yes'>{$nombre_archivo}</a>";
$fecha = "";
// se parsea el archivo para obtener la fecha
if (preg_match("/\\w*-\\d{4}\\d{2}\\d{2}\\d{2}\\d{2}\\d{2}-\\w{2}\\.\\w*/", $nombre_archivo)) {
//elastixbackup-20110720122759-p7.tar
$arrMatchFile = preg_split("/-/", $nombre_archivo);
$data = $arrMatchFile[1];
$fecha = substr($data, -8, 2) . "/" . substr($data, -10, 2) . "/" . substr($data, 0, 4) . " " . substr($data, -6, 2) . ":" . substr($data, -4, 2) . ":" . substr($data, -2, 2);
$id = $arrMatchFile[1] . "-" . $arrMatchFile[2];
}
$arrTmp[2] = $fecha;
$arrTmp[3] = "<input type='submit' name='submit_restore[" . $nombre_archivo . "]' value='" . _tr('Restore') . "' class='button' />";
$arrData[] = $arrTmp;
}
}
$arrGrid = array("title" => _tr('Backup List'), "url" => array('menu' => $module_name), "icon" => "/modules/{$module_name}/images/system_backup_restore.png", "width" => "99%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total, "columns" => array(0 => array("name" => ""), 1 => array("name" => _tr('Name Backup')), 2 => array("name" => _tr('Date')), 3 => array("name" => _tr('Action'))));
$time = $_DATA['status'];
$smarty->assign("FILE_UPLOAD", _tr('File Upload'));
$smarty->assign("AUTOMATIC", _tr('AUTOMATIC'));
$smarty->assign("UPLOAD", _tr('Upload'));
$smarty->assign("FTP_BACKUP", _tr('FTP Backup'));
$oGrid->addNew("backup", _tr("Backup"));
$oGrid->deleteList(_tr("Are you sure you wish to delete backup (s)?"), 'delete_backup', _tr("Delete"));
$oGrid->customAction("view_form_FTP", _tr("FTP Backup"));
$backupIntervals = array('DISABLED' => _tr('DISABLED'), 'DAILY' => _tr('DAILY'), 'MONTHLY' => _tr('MONTHLY'), 'WEEKLY' => _tr('WEEKLY'));
$oGrid->addComboAction("time", _tr("AUTOMATIC"), $backupIntervals, $time, 'automatic');
$contenidoModulo = $oGrid->fetchGrid($arrGrid, $arrData);
return $contenidoModulo;
}
示例14: reportMoH
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;
//.........这里部分代码省略.........
示例15: reportReportedeCalltypes
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=" . $_SESSION["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);
}
}
//.........这里部分代码省略.........