本文整理汇总了PHP中paloSantoGrid::setTotal方法的典型用法代码示例。如果您正苦于以下问题:PHP paloSantoGrid::setTotal方法的具体用法?PHP paloSantoGrid::setTotal怎么用?PHP paloSantoGrid::setTotal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paloSantoGrid
的用法示例。
在下文中一共展示了paloSantoGrid::setTotal方法的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: reportDhcpClientlist
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;
}
示例6: 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();
}
示例7: reportOtherDestinations
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;
}
示例8: 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;
}
示例9: 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);
$pACL = new paloACL($pDB_2);
$user = $_SESSION["elastix_user"];
$id_user = $pACL->getIdUser($user);
$extension = $pACL->getUserExtension($user);
if (is_null($extension) || $extension == "") {
if ($pACL->isUserAdministratorGroup($user)) {
$smarty->assign("mb_title", _tr("MESSAGE"));
$smarty->assign("mb_message", "<b>" . $arrLang["You don't have extension number associated with user"] . "</b>");
} else {
$smarty->assign("mb_message", "<b>" . $arrLang["contact_admin"] . "</b>");
}
}
if (getParameter('select_directory_type') != null && getParameter('select_directory_type') == 'external') {
$smarty->assign("external_sel", 'selected=selected');
$directory_type = 'external';
} else {
$smarty->assign("internal_sel", 'selected=selected');
$directory_type = 'internal';
}
$_POST['select_directory_type'] = $directory_type;
$arrComboElements = array("name" => $arrLang["Name"], "telefono" => $arrLang["Phone Number"]);
if ($directory_type == 'external') {
$arrComboElements["last_name"] = $arrLang["Last Name"];
}
$arrFormElements = array("field" => array("LABEL" => $arrLang["Filter"], "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrComboElements, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "pattern" => array("LABEL" => "", "REQUIRED" => "no", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "INPUT_EXTRA_PARAM" => array('id' => 'filter_value')));
$oFilterForm = new paloForm($smarty, $arrFormElements);
$smarty->assign("SHOW", $arrLang["Show"]);
$smarty->assign("NEW_adress_book", $arrLang["New Contact"]);
$smarty->assign("CSV", $arrLang["CSV"]);
$smarty->assign("module_name", $module_name);
$smarty->assign("Phone_Directory", $arrLang["Phone Directory"]);
$smarty->assign("Internal", $arrLang["Internal"]);
$smarty->assign("External", $arrLang["External"]);
$field = NULL;
$pattern = NULL;
$namePattern = NULL;
$allowSelection = array("name", "telefono", "last_name");
if (isset($_POST['field']) and isset($_POST['pattern']) and $_POST['pattern'] != "") {
$field = $_POST['field'];
if (!in_array($field, $allowSelection)) {
$field = "name";
}
$pattern = "%{$_POST['pattern']}%";
$namePattern = $_POST['pattern'];
$nameField = $arrComboElements[$field];
}
$arrFilter = array("select_directory_type" => $directory_type, "field" => $field, "pattern" => $namePattern);
$startDate = $endDate = date("Y-m-d H:i:s");
$oGrid = new paloSantoGrid($smarty);
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Phone Directory") . " = {$directory_type} ", $arrFilter, array("select_directory_type" => "internal"), true);
$oGrid->addFilterControl(_tr("Filter applied ") . $field . " = {$namePattern}", $arrFilter, array("field" => "name", "pattern" => ""));
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter_adress_book.tpl", "", $arrFilter);
if ($directory_type == 'external') {
$total = $padress_book->getAddressBook(NULL, NULL, $field, $pattern, TRUE, $id_user);
} else {
$total = $padress_book->getDeviceFreePBX($dsnAsterisk, NULL, NULL, $field, $pattern, TRUE);
}
$total_datos = $total[0]["total"];
//Paginacion
$limit = 20;
$total = $total_datos;
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
$inicio = $total == 0 ? 0 : $offset + 1;
$end = $offset + $limit <= $total ? $offset + $limit : $total;
//Fin Paginacion
if ($directory_type == 'external') {
$arrResult = $padress_book->getAddressBook($limit, $offset, $field, $pattern, FALSE, $id_user);
} else {
$arrResult = $padress_book->getDeviceFreePBX($dsnAsterisk, $limit, $offset, $field, $pattern);
}
$arrData = null;
//echo print_r($arrResult,true);
if (is_array($arrResult) && $total > 0) {
$arrMails = array();
$typeContact = "";
if ($directory_type == 'internal') {
$arrMails = $padress_book->getMailsFromVoicemail();
}
foreach ($arrResult as $key => $adress_book) {
if ($directory_type == 'external') {
$exten = explode(".", $adress_book["picture"]);
if (isset($exten[count($exten) - 1])) {
$exten = $exten[count($exten) - 1];
}
$picture = "/var/www/address_book_images/{$adress_book['id']}_Thumbnail.{$exten}";
if (file_exists($picture)) {
$arrTmp[1] = "<a href='?menu={$module_name}&action=show&id=" . $adress_book['id'] . "'><img alt='image' border='0' src='index.php?menu={$module_name}&action=getImage&idPhoto={$adress_book['id']}&thumbnail=yes&rawmode=yes'/></a>";
} else {
$defaultPicture = "modules/{$module_name}/images/Icon-user_Thumbnail.png";
$arrTmp[1] = "<a href='?menu={$module_name}&action=show&id=" . $adress_book['id'] . "'><img border='0' alt='image' src='{$defaultPicture}'/></a>";
}
}
$arrTmp[0] = $directory_type == 'external' ? "<input type='checkbox' name='contact_{$adress_book['id']}' />" : '';
if ($directory_type == 'external') {
$email = $adress_book['email'];
//.........这里部分代码省略.........
示例10: 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;
}
示例11: 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;
}
示例12: 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;
}
//.........这里部分代码省略.........
示例13: reportQueue
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;
//.........这里部分代码省略.........
示例14: reportANI
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);
}
示例15: listarArchivos
function listarArchivos($module_name, $smarty, $local_templates_dir, $sDirectorio)
{
global $arrLang;
// Función que rechaza los directorios punto y doble punto
function _reject_dotdirs($s)
{
return !($s == '.' || $s == '..');
}
$listaArchivos = file_exists($sDirectorio) && is_dir($sDirectorio) ? array_filter(scandir($sDirectorio), '_reject_dotdirs') : NULL;
if (!is_array($listaArchivos)) {
$smarty->assign("msj_err", _tr('This is not a valid directory'));
}
// Filtrar por la cadena indicada en el filtro
$sSubStrArchivo = getParameter('file');
if ($sSubStrArchivo != '') {
$t = array();
foreach ($listaArchivos as $sArchivo) {
if (strpos($sArchivo, $sSubStrArchivo) !== FALSE) {
$t[] = $sArchivo;
}
}
$listaArchivos = $t;
}
// Mapear de la lista de archivos al listado completo con URLs
$arrData = array();
foreach ($listaArchivos as $sArchivo) {
$arrData[] = array(sprintf('<a href="%s">%s</a>', construirURL(array('menu' => $module_name, 'action' => 'edit', 'file' => $sArchivo, 'search' => $sSubStrArchivo, 'nav' => getParameter('nav'), 'page' => getParameter('page'))), htmlentities($sArchivo, ENT_COMPAT, 'UTF-8')), filesize($sDirectorio . $sArchivo));
}
////PARA EL PAGINEO
$total = count($arrData);
$limit = 25;
$offset = 0;
$oForm = new paloForm($smarty, array("file" => array("LABEL" => _tr("File"), "REQUIRED" => "no", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "")));
$smarty->assign("Filter", _tr('Filter'));
$smarty->assign("NEW_FILE", _tr("New File"));
$smarty->assign('url_new', construirURL(array('menu' => $module_name, 'action' => 'new')));
$oGrid = new paloSantoGrid($smarty);
$arr = array("file" => getParameter("file"), "filter" => "Filter");
if (empty($_POST)) {
$_POST = $arr;
}
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("File") . " = " . $sSubStrArchivo, $_POST, array("file" => ""));
$htmlFilter = $oForm->fetchForm("{$local_templates_dir}/new.tpl", _tr("File Editor"), $_POST);
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
$inicio = $total == 0 ? 0 : $offset + 1;
$fin = $offset + $limit <= $total ? $offset + $limit : $total;
$leng = $fin - $inicio;
$arrDatosGrid = array_slice($arrData, $inicio - 1, $leng + 1);
$arrGrid = array("title" => _tr("File Editor"), "url" => array('menu' => $module_name, 'file' => $sSubStrArchivo), "icon" => "/modules/{$module_name}/images/pbx_tools_asterisk_file_editor.png", "width" => "99%", "start" => $inicio, "end" => $fin, "total" => $total, "columns" => array(0 => array("name" => _tr("File List"), "property1" => ""), 1 => array("name" => _tr("File Size"), "property1" => "")));
$oGrid->addNew("?menu={$module_name}&action=new", _tr("New File"), true);
$oGrid->showFilter($htmlFilter);
return $oGrid->fetchGrid($arrGrid, $arrDatosGrid, $arrLang);
}