本文整理汇总了PHP中paloSantoGrid::addFilterControl方法的典型用法代码示例。如果您正苦于以下问题:PHP paloSantoGrid::addFilterControl方法的具体用法?PHP paloSantoGrid::addFilterControl怎么用?PHP paloSantoGrid::addFilterControl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paloSantoGrid
的用法示例。
在下文中一共展示了paloSantoGrid::addFilterControl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reportDHCP_Configuration
function reportDHCP_Configuration($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf)
{
$pDHCP_Configuration = new paloSantoDHCP_Configuration($pDB);
$filter_field = getParameter("filter_field");
$filter_value = getParameter("filter_value");
$action = getParameter("nav");
$start = getParameter("start");
//begin grid parameters
$oGrid = new paloSantoGrid($smarty);
$nameOpt = array("hostname" => _tr('Host Name'), "ipaddress" => _tr('IP Address'), "macaddress" => _tr('MAC Address'));
if (isset($nameOpt[$filter_field])) {
$valorFiltro = $nameOpt[$filter_field];
} else {
$valorFiltro = "";
}
$oGrid->addFilterControl(_tr("Filter applied ") . " " . $valorFiltro . " = {$filter_value}", $_POST, array("filter_field" => "hostname", "filter_value" => ""));
$totalDHCP_Configuration = $pDHCP_Configuration->contarIpFijas($filter_field, $filter_value);
$oGrid->addNew("new_dhcpconft", _tr("Assign IP Address"));
$oGrid->deleteList("Are you sure you wish to delete the DHCP configuration.", "delete_dhcpConf", _tr("Delete"));
$limit = 20;
$total = $totalDHCP_Configuration;
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$oGrid->calculatePagination($action, $start);
$offset = $oGrid->getOffsetValue();
$end = $oGrid->getEnd();
$arrData = null;
$arrResult = $pDHCP_Configuration->leerIPsFijas($limit, $offset, $filter_field, $filter_value);
if (is_array($arrResult) && $total > 0) {
foreach ($arrResult as $key => $value) {
$arrTmp[0] = "<input type='checkbox' name='DhcpConfID_{$value['id']}' />";
$arrTmp[1] = "<a href='?menu={$module_name}&action=view_dhcpconf&id=" . $value['id'] . "'>" . $value['hostname'] . "</a>";
$arrTmp[2] = $value['ipaddress'];
$arrTmp[3] = $value['macaddress'];
$arrData[] = $arrTmp;
}
}
$buttonDelete = "";
$arrGrid = array("title" => _tr('Assign IP Address to Host'), "icon" => "web/apps/{$module_name}/images/system_network_assign_ip_address.png", "width" => "99%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total, "url" => array('menu' => $module_name, 'filter_field' => $filter_field, 'filter_value' => $filter_value), "columns" => array(0 => array("name" => $buttonDelete, "property1" => ""), 1 => array("name" => _tr('Host Name'), "property1" => ""), 2 => array("name" => _tr('IP Address'), "property1" => ""), 3 => array("name" => _tr('MAC Address'), "property1" => "")));
//begin section filter
$arrFormFilterDHCP_Configuration = createFieldFilter();
$oFilterForm = new paloForm($smarty, $arrFormFilterDHCP_Configuration);
$smarty->assign("SHOW", _tr('Show'));
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
//end section filter
$oGrid->showFilter(trim($htmlFilter));
$contenidoModulo = $oGrid->fetchGrid($arrGrid, $arrData);
//end grid parameters
return $contenidoModulo;
}
示例2: reportIVR
function reportIVR($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials)
{
global $arrPermission;
$error = "";
$pORGZ = new paloSantoOrganization($pDB);
$domain = getParameter("organization");
$name = getParameter("name");
$domain = empty($domain) ? 'all' : $domain;
if ($credentials['userlevel'] != 'superadmin') {
$domain = $credentials['domain'];
}
$url['menu'] = $module_name;
$url['organization'] = $domain;
$url['name'] = $name;
if ($credentials['userlevel'] == "superadmin") {
if (isset($domain) && $domain != "all") {
$pIVR = new paloIvrPBX($pDB, $domain);
} else {
$pIVR = new paloIvrPBX($pDB, "");
}
$total = $pIVR->getTotalIvr($domain, $name);
$arrOrgz = array("all" => _tr("all"));
foreach ($pORGZ->getOrganization(array()) as $value) {
$arrOrgz[$value["domain"]] = $value["name"];
}
} else {
$arrOrgz = array();
$pIVR = new paloIvrPBX($pDB, $domain);
$total = $pIVR->getTotalIvr($domain, $name);
}
if ($total === false) {
$error = $pIVR->errMsg;
$total = 0;
}
$limit = 20;
$oGrid = new paloSantoGrid($smarty);
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
$end = $offset + $limit <= $total ? $offset + $limit : $total;
$oGrid->setTitle(_tr('Ivrs List'));
$oGrid->setUrl($url);
$oGrid->setWidth("99%");
$oGrid->setStart($total == 0 ? 0 : $offset + 1);
$oGrid->setEnd($end);
if ($credentials['userlevel'] == "superadmin") {
$arrColumns[] = _tr("Organization");
}
$arrColumns[] = _tr("Ivr Name");
$arrColumns[] = _tr("Timeout");
$arrColumns[] = _tr("Enable Call Extensions");
$arrColumns[] = _tr("# Loops");
$oGrid->setColumns($arrColumns);
$arrData = array();
$arrIVR = array();
if ($total != 0) {
$arrIVR = $pIVR->getIvrs($domain, $name, $limit, $offset);
}
if ($arrIVR === false) {
$error = _tr("Error getting ivr data.") . $pIVR->errMsg;
} else {
foreach ($arrIVR as $ivr) {
$arrTmp = array();
if ($credentials['userlevel'] == "superadmin") {
$arrTmp[] = $arrOrgz[$ivr['organization_domain']];
}
$arrTmp[] = " <a href='?menu={$module_name}&action=view&id_ivr=" . $ivr['id'] . "&organization={$ivr["organization_domain"]}'>" . htmlentities($ivr["name"], ENT_QUOTES, "UTF-8") . "</a>";
$arrTmp[] = $ivr["timeout"];
$arrTmp[] = $ivr["directdial"];
$arrTmp[] = $ivr["loops"];
$arrData[] = $arrTmp;
}
}
$smarty->assign("USERLEVEL", $credentials['userlevel']);
$smarty->assign("SEARCH", "<input type='submit' class='button' value='" . _tr('Search') . "' name='report'>");
if ($pORGZ->getNumOrganization(array()) >= 1) {
if (in_array('create', $arrPermission)) {
if ($credentials['userlevel'] == 'superadmin') {
$oGrid->addComboAction("organization_add", _tr("Create New IVR"), array_slice($arrOrgz, 1), $selected = null, "create_ivr", $onchange_select = null);
} else {
$oGrid->addNew("create_ivr", _tr("Create New IVR"));
}
}
if ($credentials['userlevel'] == 'superadmin') {
$_POST["organization"] = $domain;
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization") . " = " . $arrOrgz[$domain], $_POST, array("organization" => _tr("all")), true);
}
$_POST["name"] = $name;
//ivr name
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Name") . " = " . $name, $_POST, array("name" => ""));
$arrFormElements = createFieldFilter($arrOrgz);
$oFilterForm = new paloForm($smarty, $arrFormElements);
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
$oGrid->showFilter(trim($htmlFilter));
} else {
$smarty->assign("mb_title", _tr("MESSAGE"));
$smarty->assign("mb_message", _tr("It's necesary you create at least one organization so you can use this module"));
}
if ($error != "") {
$smarty->assign("mb_title", _tr("MESSAGE"));
//.........这里部分代码省略.........
示例3: 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);
}
示例4: listRepositories
function listRepositories($smarty, $module_name, $local_templates_dir, $arrConf)
{
global $arrLang;
$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();
// print($arch);
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" => $arrLang["Repositories"], "icon" => "modules/repositories/images/system_updates_repositories.png", "width" => "99%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total, "columns" => array(0 => array("name" => $arrLang["Active"], "property1" => ""), 1 => array("name" => $arrLang["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, $arrLang);
return $contenidoModulo;
}
示例5: reportTG
function reportTG($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials)
{
global $arrPermission;
$error = "";
$pORGZ = new paloSantoOrganization($pDB);
$domain = getParameter("organization");
$domain = empty($domain) ? 'all' : $domain;
if ($credentials['userlevel'] != "superadmin") {
$domain = $credentials['domain'];
}
$name = getParameter('name');
$url['menu'] = $module_name;
$url['organization'] = $domain;
$url['name'] = $name;
//name
$pTG = new paloSantoTG($pDB, $domain);
$total = $pTG->getNumTG($domain, $name);
$arrOrgz = array();
if ($credentials['userlevel'] == "superadmin") {
$arrOrgz = array("all" => "all");
foreach ($pORGZ->getOrganization(array()) as $value) {
$arrOrgz[$value["domain"]] = $value["name"];
}
}
if ($total === false) {
$error = $pTG->errMsg;
$total = 0;
}
$limit = 20;
$oGrid = new paloSantoGrid($smarty);
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
$end = $offset + $limit <= $total ? $offset + $limit : $total;
$oGrid->setTitle(_tr('Time Groups List'));
//$oGrid->setIcon('url de la imagen');
$oGrid->setWidth("99%");
$oGrid->setStart($total == 0 ? 0 : $offset + 1);
$oGrid->setEnd($end);
$oGrid->setTotal($total);
$oGrid->setURL($url);
$arrColum = array();
if ($credentials['userlevel'] == "superadmin") {
$arrColum[] = _tr("Organization");
}
$arrColum[] = _tr("Name");
$oGrid->setColumns($arrColum);
$arrTG = array();
$arrData = array();
if ($total != 0) {
$arrTG = $pTG->getTGs($domain, $name, $limit, $offset);
}
if ($arrTG === false) {
$error = _tr("Error to obtain Time Groups") . $pTG->errMsg;
$arrTG = array();
}
$arrData = array();
foreach ($arrTG as $tg) {
$arrTmp = array();
if ($credentials['userlevel'] == "superadmin") {
$arrTmp[] = $arrOrgz[$tg["organization_domain"]];
}
$arrTmp[] = " <a href='?menu={$module_name}&action=edit&id_tg=" . $tg['id'] . "&organization={$tg['organization_domain']}'>" . $tg['name'] . "</a>";
$arrData[] = $arrTmp;
}
if ($pORGZ->getNumOrganization(array()) >= 1) {
if (in_array('create', $arrPermission)) {
if ($credentials['userlevel'] == 'superadmin') {
$oGrid->addComboAction("organization_add", _tr("ADD Time Group"), array_slice($arrOrgz, 1), $selected = null, "create_tg", $onchange_select = null);
} else {
$oGrid->addNew("create_tg", _tr("ADD Time Group"));
}
}
if ($credentials['userlevel'] == 'superadmin') {
$_POST["organization"] = $domain;
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization") . " = " . $arrOrgz[$domain], $_POST, array("organization" => "all"), true);
}
$_POST["name"] = $name;
// name
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Time Condition Group") . " = " . $name, $_POST, array("name" => ""));
$arrFormElements = createFieldFilter($arrOrgz);
$oFilterForm = new paloForm($smarty, $arrFormElements);
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
$oGrid->showFilter(trim($htmlFilter));
} else {
$smarty->assign("mb_title", _tr("MESSAGE"));
$smarty->assign("mb_message", _tr("It's necesary you create at least one organization so you can use this module"));
}
if ($error != "") {
$smarty->assign("mb_title", _tr("MESSAGE"));
$smarty->assign("mb_message", $error);
}
$contenidoModulo = $oGrid->fetchGrid(array(), $arrData);
$mensaje = showMessageReload($module_name, $pDB, $credentials);
$contenidoModulo = $mensaje . $contenidoModulo;
return $contenidoModulo;
}
示例6: 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'];
//.........这里部分代码省略.........
示例7: 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;
}
示例8: _moduleContent
function _moduleContent(&$smarty, $module_name)
{
require_once "modules/{$module_name}/libs/ringgroup.php";
//include module files
include_once "modules/{$module_name}/configs/default.conf.php";
load_language_module($module_name);
global $arrConf;
global $arrConfModule;
$arrConf = array_merge($arrConf, $arrConfModule);
//folder path for custom templates
$base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
$templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes';
$local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
// DSN para consulta de cdrs
$dsn = generarDSNSistema('asteriskuser', 'asteriskcdrdb');
$pDB = new paloDB($dsn);
$oCDR = new paloSantoCDR($pDB);
$pDBACL = new paloDB($arrConf['elastix_dsn']['acl']);
if (!empty($pDBACL->errMsg)) {
return "ERROR DE DB: {$pDBACL->errMsg}";
}
$pACL = new paloACL($pDBACL);
if (!empty($pACL->errMsg)) {
return "ERROR DE ACL: {$pACL->errMsg}";
}
$exten = '6868';
//$pACL->getUserExtension($_SESSION['elastix_user']);
$isAdministrator = true;
//$pACL->isUserAdministratorGroup($_SESSION['elastix_user']);
if (is_null($exten) || $exten == "") {
if (!$isAdministrator) {
$smarty->assign('mb_message', "<b>" . _tr("contact_admin") . "</b>");
return "";
} else {
$smarty->assign('mb_message', "<b>" . _tr("no_extension") . "</b>");
}
}
// Para usuarios que no son administradores, se restringe a los CDR de la
// propia extensión
$sExtension = $isAdministrator ? '' : $pACL->getUserExtension($_SESSION['elastix_user']);
// DSN para consulta de ringgroups
$dsn_asterisk = generarDSNSistema('asteriskuser', 'asterisk');
$pDB_asterisk = new paloDB($dsn_asterisk);
$oRG = new RingGroup($pDB_asterisk);
$dataRG = $oRG->getRingGroup();
$dataRG[''] = _tr('(Any ringgroup)');
// Cadenas estáticas en la plantilla
$smarty->assign(array("Filter" => _tr("Filter")));
$arrFormElements = array("date_start" => array("LABEL" => _tr("Start Date"), "REQUIRED" => "yes", "INPUT_TYPE" => "DATE", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "ereg", "VALIDATION_EXTRA_PARAM" => "^[[:digit:]]{1,2}[[:space:]]+[[:alnum:]]{3}[[:space:]]+[[:digit:]]{4}\$"), "date_end" => array("LABEL" => _tr("End Date"), "REQUIRED" => "yes", "INPUT_TYPE" => "DATE", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "ereg", "VALIDATION_EXTRA_PARAM" => "^[[:digit:]]{1,2}[[:space:]]+[[:alnum:]]{3}[[:space:]]+[[:digit:]]{4}\$"), "field_name" => array("LABEL" => _tr("Field Name"), "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => array("dst" => _tr("Destination"), "src" => _tr("Source"), "channel" => _tr("Src. Channel"), "accountcode" => _tr("Account Code"), "dstchannel" => _tr("Dst. Channel")), "VALIDATION_TYPE" => "ereg", "VALIDATION_EXTRA_PARAM" => "^(dst|src|channel|dstchannel|accountcode)\$"), "field_pattern" => array("LABEL" => _tr("Field"), "REQUIRED" => "no", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "ereg", "VALIDATION_EXTRA_PARAM" => "^[\\*|[:alnum:]@_\\.,/\\-]+\$"), "status" => array("LABEL" => _tr("Status"), "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => array("ALL" => _tr("ALL"), "ANSWERED" => _tr("ANSWERED"), "BUSY" => _tr("BUSY"), "FAILED" => _tr("FAILED"), "NO ANSWER " => _tr("NO ANSWER")), "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "ringgroup" => array("LABEL" => _tr("Ring Group"), "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $dataRG, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""));
$oFilterForm = new paloForm($smarty, $arrFormElements);
// Parámetros base y validación de parámetros
$url = array('menu' => $module_name);
$paramFiltroBase = $paramFiltro = array('date_start' => date("d M Y"), 'date_end' => date("d M Y"), 'field_name' => 'dst', 'field_pattern' => '', 'status' => 'ALL', 'ringgroup' => '');
foreach (array_keys($paramFiltro) as $k) {
if (!is_null(getParameter($k))) {
$paramFiltro[$k] = getParameter($k);
}
}
$oGrid = new paloSantoGrid($smarty);
if ($paramFiltro['date_start'] === "") {
$paramFiltro['date_start'] = " ";
}
if ($paramFiltro['date_end'] === "") {
$paramFiltro['date_end'] = " ";
}
$valueFieldName = $arrFormElements['field_name']["INPUT_EXTRA_PARAM"][$paramFiltro['field_name']];
$valueStatus = $arrFormElements['status']["INPUT_EXTRA_PARAM"][$paramFiltro['status']];
$valueRingGRoup = $arrFormElements['ringgroup']["INPUT_EXTRA_PARAM"][$paramFiltro['ringgroup']];
$oGrid->addFilterControl(_tr("Filter applied: ") . _tr("Start Date") . " = " . $paramFiltro['date_start'] . ", " . _tr("End Date") . " = " . $paramFiltro['date_end'], $paramFiltro, array('date_start' => date("d M Y"), 'date_end' => date("d M Y")), true);
$oGrid->addFilterControl(_tr("Filter applied: ") . $valueFieldName . " = " . $paramFiltro['field_pattern'], $paramFiltro, array('field_name' => "dst", 'field_pattern' => ""));
$oGrid->addFilterControl(_tr("Filter applied: ") . _tr("Status") . " = " . $valueStatus, $paramFiltro, array('status' => 'ALL'), true);
$oGrid->addFilterControl(_tr("Filter applied: ") . _tr("Ring Group") . " = " . $valueRingGRoup, $paramFiltro, array('ringgroup' => ''));
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $paramFiltro);
if (!$oFilterForm->validateForm($paramFiltro)) {
$smarty->assign(array('mb_title' => _tr('Validation Error'), 'mb_message' => '<b>' . _tr('The following fields contain errors') . ':</b><br/>' . implode(', ', array_keys($oFilterForm->arrErroresValidacion))));
$paramFiltro = $paramFiltroBase;
unset($_POST['delete']);
// Se aborta el intento de borrar CDRs, si había uno.
}
// Tradudir fechas a formato ISO para comparación y para API de CDRs.
$url = array_merge($url, $paramFiltro);
$paramFiltro['date_start'] = translateDate($paramFiltro['date_start']) . ' 00:00:00';
$paramFiltro['date_end'] = translateDate($paramFiltro['date_end']) . ' 23:59:59';
// Valores de filtrado que no se seleccionan mediante filtro
if ($sExtension != '') {
$paramFiltro['extension'] = $sExtension;
}
// Ejecutar el borrado, si se ha validado.
if (isset($_POST['delete'])) {
if ($isAdministrator) {
if ($paramFiltro['date_start'] <= $paramFiltro['date_end']) {
$r = $oCDR->borrarCDRs($paramFiltro);
if (!$r) {
$smarty->assign(array('mb_title' => _tr('ERROR'), 'mb_message' => $oCDR->errMsg));
}
} else {
$smarty->assign(array('mb_title' => _tr('ERROR'), 'mb_message' => _tr("Please End Date must be greater than Start Date")));
}
} else {
$smarty->assign(array('mb_title' => _tr('ERROR'), 'mb_message' => _tr("Only administrators can delete CDRs")));
//.........这里部分代码省略.........
示例9: reportMonitoring
//.........这里部分代码省略.........
if ($esAdministrador) {
$oGrid->deleteList(_tr("message_alert"), 'submit_eliminar', _tr("Delete"));
$buttonDelete = "";
} else {
$buttonDelete = "";
}
$arrColumns = array($buttonDelete, "Ngày", "Giờ", "Gọi từ", "Gọi đến", "Nhân viên/PSTN", "Thời gian gọi", "Loại", "Ghi âm", "Nội dung", "Giao vé");
$oGrid->setColumns($arrColumns);
if ($esAdministrador) {
$arrResult = $pMonitoring->getMonitoring($limit, $offset, $filter_field, $filter_value, null, $date_initial, $date_final);
} elseif (!($extension == "" || is_null($extension))) {
$arrResult = $pMonitoring->getMonitoring($limit, $offset, $filter_field, $filter_value, $extension, $date_initial, $date_final);
} else {
$arrResult = array();
}
if (is_array($arrResult) && $total > 0) {
$src = "";
$dst = "";
foreach ($arrResult as $key => $value) {
if ($esAdministrador) {
$arrTmp[0] = "<input type='checkbox' name='id_" . $value['uniqueid'] . "' />";
} else {
$arrTmp[0] = "";
}
$arrTmp[1] = date('d M Y', strtotime($value['calldate']));
$arrTmp[2] = date('H:i:s', strtotime($value['calldate']));
if (!isset($value['src']) || $value['src'] == "") {
$src = "<font color='gray'>" . _tr("unknown") . "</font>";
} else {
$src = $value['src'];
}
if (!isset($value['dst']) || $value['dst'] == "") {
$dst = "<font color='gray'>" . _tr("unknown") . "</font>";
} else {
$dst = $value['dst'];
}
$arrTmp[3] = $src;
$arrTmp[4] = $dst;
$arrTmp[5] = channel_lookup($pDB, $value['dstchannel']);
$arrTmp[6] = "<label title='" . $value['duration'] . " seconds' style='color:green'>" . SecToHHMMSS($value['duration']) . "</label>";
//$file = base64_encode($value['userfield']);
$file = $value['uniqueid'];
$namefile = basename($value['userfield']);
$namefile = str_replace("audio:", "", $namefile);
if ($namefile == 'deleted') {
$arrTmp[7] = _tr('Deleted');
} else {
switch ($namefile[0]) {
case "O":
$arrTmp[7] = _tr("Outgoing");
break;
case "g":
$arrTmp[7] = _tr("Group");
break;
case "q":
$arrTmp[7] = _tr("Queue");
break;
default:
$arrTmp[7] = _tr("Incoming");
break;
}
}
if ($namefile != 'deleted') {
$recordingLink = "<a href=\"javascript:popUp('index.php?menu={$module_name}&action=display_record&id={$file}&namefile={$namefile}&rawmode=yes',350,100);\">" . _tr("Listen") . "</a> ";
$recordingLink .= "<a href='?menu={$module_name}&action=download&id={$file}&namefile={$namefile}&rawmode=yes' >" . _tr("Download") . "</a>";
} else {
$recordingLink = '';
}
$arrTmp[8] = $recordingLink;
$arrTmp[9] = is_null($value['note_id']) ? '-' : '<a href="javascript:void(0)" onclick="view_note(\'' . $value['note_id'] . '\')">Xem</a>';
$arrTmp[10] = is_null($value['delivery_id']) ? '-' : '<a href="javascript:void(0)" onclick="view_delivery(\'' . $value['delivery_id'] . '\')">Xem</a>';
$arrData[] = $arrTmp;
}
}
}
$oGrid->setData($arrData);
//begin section filter
$arrFormFilterMonitoring = createFieldFilter();
$oFilterForm = new paloForm($smarty, $arrFormFilterMonitoring);
$smarty->assign("INCOMING", _tr("Incoming"));
$smarty->assign("OUTGOING", _tr("Outgoing"));
$smarty->assign("QUEUE", _tr("Queue"));
$smarty->assign("GROUP", _tr("Group"));
$smarty->assign("SHOW", _tr("Show"));
$_POST["filter_field"] = $filter_field;
$_POST["filter_value"] = $filter;
$_POST["filter_value_userfield"] = $filter_userfield;
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Start Date") . " = " . $paramFilter['date_start'] . ", " . _tr("End Date") . " = " . $paramFilter['date_end'], $paramFilter, array('date_start' => date("d M Y"), 'date_end' => date("d M Y")), true);
if ($filter_field == "userfield") {
$oGrid->addFilterControl(_tr("Filter applied ") . " {$nameFilterField} = {$nameFilterUserfield}", $_POST, array('filter_field' => "src", 'filter_value_userfield' => "incoming"));
} else {
$oGrid->addFilterControl(_tr("Filter applied ") . " {$nameFilterField} = {$filter}", $_POST, array('filter_field' => "src", "filter_value" => ""));
}
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
//end section filter
$oGrid->showFilter(trim($htmlFilter));
$content = $oGrid->fetchGrid();
//end grid parameters
return $content;
}
示例10: showLanguages
function showLanguages($smarty, $module_name, $local_templates_dir, $arrLang, $arrLangModule)
{
//$oPaloSanto = new paloSantoLanguageAdmin();
$pLanguages = new paloSantoLanguageAdmin();
$arrFormElements = array("module" => array("LABEL" => $arrLangModule["Select Module"], "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $pLanguages->leer_directorio_modulos(), "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "language" => array("LABEL" => $arrLangModule["Select Language"], "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $pLanguages->leer_directorio_lenguajes(), "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""));
$oFilterForm = new paloForm($smarty, $arrFormElements);
$smarty->assign("SHOW", $arrLang["Show"]);
$smarty->assign("SAVE_ALL", "Save All");
$module = getParameter("module");
$language = getParameter("language");
$action = getParameter('nav');
$start = getParameter('start');
$smarty->assign("start_value", $start);
$smarty->assign("nav_value", $action);
$_POST["module"] = $module;
$_POST["language"] = $language;
$oGrid = new paloSantoGrid($smarty);
if (!is_null($module) && !is_null($language)) {
$nameModule = $arrFormElements["module"]["INPUT_EXTRA_PARAM"][$module];
$valueLanguage = $arrFormElements["language"]["INPUT_EXTRA_PARAM"][$language];
} else {
$nameModule = "";
$valueLanguage = "";
}
$oGrid->addFilterControl(_tr("Filter applied: ") . $nameModule . " = " . $valueLanguage, $_POST, array("module" => null, "language" => null));
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
//Paginacion
$limit = 20;
$total_datos = $pLanguages->ObtainNumLanguages($module, $language);
$total = $total_datos;
$oGrid->addNew("new", _tr("Add"));
$oGrid->customAction("save_all", _tr("Save All"));
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$oGrid->setTitle(_tr("Language Admin"));
$oGrid->setIcon("images/list.png");
$oGrid->pagingShow(true);
$offset = $oGrid->calculateOffset();
$url = "?menu={$module_name}&module={$module}&language={$language}";
$oGrid->setURL($url);
$arrColumns = array(_tr("Key"), _tr("Value"));
$oGrid->setColumns($arrColumns);
$arrLangMod = $pLanguages->obtainLanguages($limit, $offset, $module, $language);
$arrData = array();
$counter = 1;
if (is_array($arrLangMod) && count($arrLangMod) > 0) {
foreach ($arrLangMod as $key => $value) {
$tmpKey = htmlspecialchars($key);
$tmpValue = htmlspecialchars($value);
$arrTmp[0] = $tmpKey;
$arrTmp[1] = "<input class='table_data' style='width:450px' type='text' name=\"langvalue_{$counter}\" id=\"langvalue_{$counter}\" value=\"{$tmpValue}\" /><input type='hidden' name='langkey_{$counter}' id='langkey_{$counter}' value='{$tmpKey}'>";
$counter++;
$arrData[] = $arrTmp;
}
}
$oGrid->setData($arrData);
$oGrid->showFilter(trim($htmlFilter));
$moduleContent = $oGrid->fetchGrid();
if (strpos($moduleContent, '<form') === FALSE) {
$moduleContent = "<form method='POST' style='margin-bottom:0;' action={$url}>{$moduleContent}</form>";
}
return $moduleContent;
}
示例11: reportOutbound
function reportOutbound($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials, $reorderRoute = false)
{
global $arrPermission;
$pORGZ = new paloSantoOrganization($pDB);
$error = "";
$arrOrgz = array();
$domain = getParameter("organization");
$name = getParameter("name");
// outbound name
$domain = empty($domain) ? 'all' : $domain;
if ($credentials['userlevel'] != "superadmin") {
$domain = $credentials['domain'];
}
$url['menu'] = $module_name;
$url['organization'] = $domain;
$url['name'] = $name;
if ($credentials['userlevel'] == "superadmin") {
if (isset($domain) && $domain != "all") {
$pOutbound = new paloSantoOutbound($pDB, $domain);
} else {
$pOutbound = new paloSantoOutbound($pDB, "");
}
$total = $pOutbound->getNumOutbound($domain, $name);
$arrOrgz = array("all" => _tr("all"));
foreach ($pORGZ->getOrganization(array()) as $value) {
$arrOrgz[$value["domain"]] = $value["name"];
}
} else {
$pOutbound = new paloSantoOutbound($pDB, $domain);
$total = $pOutbound->getNumOutbound($domain, $name);
}
if ($total === false) {
$error = $pOutbound->errMsg;
$total = 0;
}
$limit = 20;
$oGrid = new paloSantoGrid($smarty);
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
$end = $offset + $limit <= $total ? $offset + $limit : $total;
$arrGrid = array("title" => _tr('Outbound Routes List'), "url" => $url, "width" => "99%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total);
$arrColumns = array();
$arrColumns[] = _tr("Order");
$arrColumns[] = _tr("Route Name");
if ($credentials['userlevel'] == "superadmin") {
$arrColumns[] = _tr("Organization");
}
$arrColumns[] = _tr("Route CID");
$arrColumns[] = _tr("Route Password");
$arrColumns[] = _tr("Time Group");
$oGrid->setColumns($arrColumns);
$arrOutbound = array();
$arrData = array();
if ($total != 0) {
$arrOutbound = $pOutbound->getOutbounds($domain, $name, $limit, $offset);
}
if ($arrOutbound === false) {
$error = _tr("Error to obtain outbounds") . $pOutbound->errMsg;
$arrOutbound = array();
}
$create = in_array('create', $arrPermission);
$edit = in_array('edit', $arrPermission);
foreach ($arrOutbound as $outbound) {
$arrTmp = array();
if ($edit) {
$arrTmp[] = fieldOrden($arrOutbound, $outbound["seq"], $outbound["id"], $outbound["organization_domain"]);
} else {
$arrTmp[] = $outbound["seq"];
}
$arrTmp[] = " <a href='?menu=outbound_route&action=view&id_outbound=" . $outbound['id'] . "&organization={$outbound["organization_domain"]}'>" . htmlentities($outbound['routename'], ENT_QUOTES, "UTF-8") . "</a>";
if ($credentials['userlevel'] == "superadmin") {
$arrTmp[] = $arrOrgz[$outbound["organization_domain"]];
}
$arrTmp[] = $outbound["outcid"];
$arrTmp[] = $outbound["routepass"];
if (isset($outbound["time_group_id"])) {
$query = "SELECT name from time_group where id=?";
$result = $pDB->getFirstRowQuery($query, true, array($outbound["time_group_id"]));
if ($result != false) {
$arrTmp[] = $result["name"];
} else {
$arrTmp[] = "";
}
}
$arrData[] = $arrTmp;
}
$smarty->assign("USERLEVEL", $credentials['userlevel']);
$smarty->assign("SEARCH", "<input type='submit' class='button' value='" . _tr('Search') . "' name='report'>");
if ($pORGZ->getNumOrganization(array()) >= 1) {
if (in_array('create', $arrPermission)) {
if ($credentials['userlevel'] == 'superadmin') {
$oGrid->addComboAction("organization_add", _tr("ADD Outbound Route"), array_slice($arrOrgz, 1), $selected = null, "create_outbound", $onchange_select = null);
} else {
$oGrid->addNew("create_outbound", _tr("ADD Outbound Route"));
}
}
if ($credentials['userlevel'] == "superadmin") {
$_POST["organization"] = $domain;
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization") . " = " . $arrOrgz[$domain], $_POST, array("organization" => "all"), true);
//.........这里部分代码省略.........
示例12: reportPuertos
function reportPuertos($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf)
{
$pPuertos = new paloSantoPortService($pDB);
$field_type = getParameter("filter_type");
$field_pattern = getParameter("filter_txt");
//begin grid parameters
$oGrid = new paloSantoGrid($smarty);
$oGrid->addNew("new", _tr("Define Port"));
$oGrid->deleteList("Are you sure you wish to delete the port(s).?", "delete", _tr("Delete"));
$totalPuertos = $pPuertos->ObtainNumPuertos($field_type, $field_pattern);
$limit = 20;
$total = $totalPuertos;
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$oGrid->setTitle(_tr("Define Ports"));
$oGrid->setIcon("modules/{$module_name}/images/security_define_ports.png");
$oGrid->pagingShow(true);
$offset = $oGrid->calculateOffset();
$url = array("menu" => $module_name, "filter_type" => $field_type, "filter_txt" => $field_pattern);
$oGrid->setURL($url);
$arrData = null;
$arrResult = $pPuertos->ObtainPuertos($limit, $offset, $field_type, $field_pattern);
$button_eliminar = "";
$arrColumns = array($button_eliminar, _tr("Name"), _tr("Protocol"), _tr("Details"), _tr("Option"));
$oGrid->setColumns($arrColumns);
if (is_array($arrResult) && $total > 0) {
foreach ($arrResult as $key => $value) {
$arrTmp[0] = "<input type='checkbox' name='" . $value['id'] . "' id='" . $value['id'] . "'>";
$arrTmp[1] = $value['name'];
$arrTmp[2] = $value['protocol'];
if ($value['protocol'] == "TCP" || $value['protocol'] == "UDP") {
$port = $value['details'];
$arrTmp[3] = stripos($port, ":") === false ? _tr('Port') . " " . $value['details'] : _tr('Ports') . " " . $value['details'];
} elseif ($value['protocol'] == "ICMP") {
$arr = explode(":", $value['details']);
if (isset($arr[1])) {
$arrTmp[3] = "Type: " . $arr[0] . " Code: " . $arr[1];
}
} else {
$arrTmp[3] = "Protocol Number: " . $value['details'];
}
$arrTmp[4] = " <a href='?menu={$module_name}&action=view&id=" . $value['id'] . "'>" . _tr('View') . "</a>";
$arrData[] = $arrTmp;
}
}
$oGrid->setData($arrData);
//begin section filter
$arrFormFilterPuertos = createFieldForm();
$oFilterForm = new paloForm($smarty, $arrFormFilterPuertos);
$smarty->assign("SHOW", _tr("Show"));
$_POST["filter_type"] = $field_type;
$_POST["filter_txt"] = $field_pattern;
if (is_null($field_type) || $field_type == "") {
$nameFieldType = "";
} else {
$nameFieldType = $arrFormFilterPuertos["filter_type"]["INPUT_EXTRA_PARAM"][$field_type];
}
$oGrid->addFilterControl(_tr("Filter applied: ") . $nameFieldType . " = " . $field_pattern, $_POST, array("filter_type" => "name", "filter_txt" => "x"));
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
//end section filter
$oGrid->showFilter(trim($htmlFilter));
$contenidoModulo = $oGrid->fetchGrid();
if (strpos($contenidoModulo, '<form') === FALSE) {
$contenidoModulo = "<form method='POST' style='margin-bottom:0;' action={$url}>{$contenidoModulo}</form>";
}
//end grid parameters
return $contenidoModulo;
}
示例13: reportExten
//.........这里部分代码省略.........
$total = 0;
}
$limit = 20;
$oGrid = new paloSantoGrid($smarty);
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
$end = $offset + $limit <= $total ? $offset + $limit : $total;
$oGrid->setTitle(_tr('Extensions List'));
//$oGrid->setIcon('url de la imagen');
$oGrid->setWidth("99%");
$oGrid->setStart($total == 0 ? 0 : $offset + 1);
$oGrid->setEnd($end);
$oGrid->setTotal($total);
$oGrid->setURL($url);
if ($credentials['userlevel'] == "superadmin") {
$arrColum[] = _tr("Organization");
}
$arrColum[] = _tr("Extension");
$arrColum[] = _tr("Caller ID");
$arrColum[] = _tr("Technology");
$arrColum[] = _tr("Device");
$arrColum[] = _tr("Context");
$arrColum[] = _tr("User");
$arrColum[] = _tr("Voicemail");
$arrColum[] = _tr("Recording In") . " / " . _tr("Recording Out");
$oGrid->setColumns($arrColum);
$arrExtens = array();
$arrData = array();
if ($total != 0) {
$arrExtens = $pExten->getExtensions($domain, $extension, $limit, $offset);
}
if ($arrExtens === false) {
$error = _tr("Error to obtain extensions") . $pExten->errMsg;
$arrExtens = array();
} else {
foreach ($arrExtens as $exten) {
$arrTmp = array();
if ($credentials['userlevel'] == "superadmin") {
$arrTmp[] = $arrOrgz[$exten["organization_domain"]];
}
$arrTmp[] = " <a href='?menu=extensions&action=view&id_exten=" . $exten['id'] . "&organization={$exten['organization_domain']}'>" . $exten["exten"] . "</a>";
$arrTmp[] = $exten['clid_name'] . " <{$exten['clid_number']}>";
$arrTmp[] = strtoupper($exten['tech']);
$arrTmp[] = $exten['device'];
$arrTmp[] = $exten['context'];
$query = "Select username from acl_user where extension=? and id_group in (select g.id from acl_group g join organization o on g.id_organization=o.id where o.domain=?)";
$result = $pDB->getFirstRowQuery($query, false, array($exten["exten"], $exten["organization_domain"]));
if ($result != false) {
$arrTmp[] = $result[0];
} else {
$arrTmp[] = _tr("Nobody");
}
if (isset($exten["voicemail"])) {
if ($exten["voicemail"] != "novm") {
$arrTmp[] = "yes";
} else {
$arrTmp[] = "no";
}
} else {
$arrTmp[] = "no";
}
$arrTmp[] = _tr($exten["record_in"]) . " / " . _tr($exten["record_out"]);
$arrData[] = $arrTmp;
}
}
$smarty->assign("USERLEVEL", $credentials['userlevel']);
$smarty->assign("SEARCH", "<input type='submit' class='button' value='" . _tr('Search') . "' name='report'>");
if ($pORGZ->getNumOrganization(array()) >= 1) {
if (in_array('create', $arrPermission)) {
if ($credentials['userlevel'] == 'superadmin') {
$oGrid->addComboAction("organization_add", _tr("Create New Extension"), array_slice($arrOrgz, 1), $selected = null, "create_exten", $onchange_select = null);
} else {
$oGrid->addNew("create_exten", _tr("Create New Extension"));
}
}
if ($credentials['userlevel'] == 'superadmin') {
$_POST["organization"] = $domain;
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization") . " = " . $arrOrgz[$domain], $_POST, array("organization" => "all"), true);
}
$_POST["extension"] = $extension;
// patter to filter estension number
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Extension") . " = " . $extension, $_POST, array("extension" => ""));
$arrFormElements = createFieldFilter($arrOrgz);
$oFilterForm = new paloForm($smarty, $arrFormElements);
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
$oGrid->showFilter(trim($htmlFilter));
} else {
$smarty->assign("mb_title", _tr("MESSAGE"));
$smarty->assign("mb_message", _tr("It's necesary you create at least one organization so you can use this module"));
}
if ($error != "") {
$smarty->assign("mb_title", _tr("MESSAGE"));
$smarty->assign("mb_message", $error);
}
$contenidoModulo = $oGrid->fetchGrid(array(), $arrData);
$mensaje = showMessageReload($module_name, $pDB, $credentials);
$contenidoModulo = $mensaje . $contenidoModulo;
return $contenidoModulo;
}
示例14: report_AccessAudit
//.........这里部分代码省略.........
$offset = $iOffsetPrevio;
break;
case 'bypage':
$numPage = $limit == 0 ? 0 : ceil($total / $limit);
$page = getParameter("page");
if (preg_match("/[0-9]+/", $page) == 0) {
// no es un número
$page = 1;
}
if ($page > $numPage) {
// se está solicitando una pagina mayor a las que existen
$page = $numPage;
}
$start = ($page - 1) * $limit + 1 - $limit;
//$accion = "next";
if ($start + $limit <= 1) {
break;
}
/*$inicioRango = $page * $iEstimadoBytesPagina;
$arrResult =$pAccessLogs->ObtainAccessLogs(10 * $iEstimadoBytesPagina, $inicioRango, $field_pattern, NULL, $isExport);
$offset = $arrResult[0]['offset'];
$oGrid->setOffsetValue($offset);
$oGrid->setEnd(((int)($offset / 128) + $iNumLineasPorPagina) <= $oGrid->getTotal() ? (int)($offset / 128) + $iNumLineasPorPagina : $oGrid->getTotal());
$oGrid->setStart(($oGrid->getTotal()==0) ? 0 : (1 + (int)($offset / 128)));*/
$inicioBusqueda = $page * $iEstimadoBytesPagina - $iEstimadoBytesPagina;
$arrResult = $pAccessLogs->ObtainAccessLogs(10 * $iEstimadoBytesPagina, $inicioBusqueda, $field_pattern, NULL, $isExport);
$offset = $arrResult[0]['offset'];
$oGrid->setOffsetValue($offset);
break;
}
}
// Buscar la cadena de texto indicada, y modificar offset si se encuentra
$smarty->assign("SEARCHNEXT", _tr('Search'));
if (isset($_POST['searchnext']) && $busqueda != '') {
$pAccessLogs->astLog->posicionarMensaje($field_pattern, $offset);
$posBusqueda = $pAccessLogs->astLog->buscarTextoMensaje($busqueda);
if (!is_null($posBusqueda)) {
$offset = $posBusqueda[1];
$smarty->assign('SEARCHNEXT', _tr('Search next'));
$_POST['ultima_busqueda'] = $busqueda;
$_POST['ultimo_offset'] = $offset;
// Si el offset anterior indicado es idéntico al offset recién encontrado
// y la cadena de búsqueda es también idéntica, se asume que se ha
// pedido una búsqueda de la siguiente ocurrencia.
if (!is_null($sUltimaBusqueda) && !is_null($iUltimoOffset) && $offset == $iUltimoOffset && $sUltimaBusqueda == $busqueda) {
$pAccessLogs->astLog->posicionarMensaje($field_pattern, $offset);
$pAccessLogs->astLog->siguienteMensaje();
// Sólo para ignorar primera ocurrencia
$posBusqueda = $pAccessLogs->astLog->buscarTextoMensaje($busqueda);
if (!is_null($posBusqueda)) {
$offset = $posBusqueda[1];
$_POST['ultimo_offset'] = $offset;
}
}
} else {
}
}
$url = array('menu' => $module_name, 'filter' => $field_pattern, 'offset' => $offset, 'busqueda' => $busqueda, 'ultima_busqueda' => isset($_POST['ultima_busqueda']) ? $_POST['ultima_busqueda'] : '', 'ultimo_offset' => isset($_POST['ultimo_offset']) ? $_POST['ultimo_offset'] : '');
$oGrid->setURL($url);
//Fin Paginacion
if ($isExport) {
$arrResult = $pAccessLogs->ObtainAccessLogs($totalBytes, 0, $field_pattern, $busqueda != '' ? $busqueda : NULL, $isExport);
} else {
$arrResult = $pAccessLogs->ObtainAccessLogs(10 * $iEstimadoBytesPagina, $offset, $field_pattern, $busqueda != '' ? $busqueda : NULL, $isExport);
}
if (!$isExport) {
$arrResult = array_slice($arrResult, 0, $iNumLineasPorPagina);
}
$arrData = null;
if (is_array($arrResult) && $totalBytes > 0) {
foreach ($arrResult as $key => $value) {
$arrTmp[0] = $value['fecha'];
$arrTmp[1] = $value['tipo'];
$arrTmp[2] = $value['origen'];
$arrTmp[3] = $value['linea'];
$arrData[] = $arrTmp;
}
}
$arrColumns = array(_tr("Date"), _tr("Type"), _tr("User"), _tr("Message"));
$oGrid->setColumns($arrColumns);
$oGrid->setData($arrData);
$oGrid->setStart($totalBytes == 0 ? 0 : 1 + (int) ($offset / 128));
$t = (int) ($totalBytes / 128);
$e = (int) ($offset / 128) + $iNumLineasPorPagina;
$e = $t <= $e ? $t : $e;
$oGrid->setEnd($e + 1);
$oGrid->setTotal($t + 1);
$oGrid->setLimit(30);
$_POST['offset'] = $offset;
$smarty->assign("SHOW", _tr("Show"));
$oGrid->addFilterControl(_tr("Filter applied: ") . _tr("Date") . " = " . $_POST['filter'], $_POST, array('filter' => $listaFechas[count($listaFechas) - 1]), true);
$oGrid->addFilterControl(_tr("Filter applied: ") . _tr('Search string') . " = " . $busqueda, $_POST, array('busqueda' => ""));
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
$oGrid->showFilter(trim($htmlFilter));
return $oGrid->fetchGrid();
}
示例15: reportUser
//.........这里部分代码省略.........
$arrColumns = array();
if ($credentials["userlevel"] == "superadmin") {
$arrColumns[] = _tr("Organization");
//delete
}
$arrColumns[] = _tr("Username");
$arrColumns[] = _tr("Name");
$arrColumns[] = _tr("Group");
$arrColumns[] = _tr("Extension") . " / " . _tr("Fax Extension");
$arrColumns[] = _tr("Used Space") . " / " . _tr("Email Quota");
if (in_array('reconstruct_mailbox', $arrPermission)) {
$arrColumns[] = "";
}
//reconstruct mailbox
$oGrid->setColumns($arrColumns);
$arrData = array();
if ($credentials['userlevel'] == "superadmin") {
if ($idOrgFil != 0) {
$arrUsers = $pACL->getUsersPaging($limit, $offset, $idOrgFil, $username);
} else {
$arrUsers = $pACL->getUsersPaging($limit, $offset, null, $username);
}
} else {
$arrUsers = $pACL->getUsersPaging($limit, $offset, $idOrgFil, $username);
}
if ($arrUsers === false) {
$smarty->assign("mb_title", _tr("ERROR"));
$smarty->assign("mb_message", _tr($pACL->errMsg));
}
//si es un usuario solo se ve a si mismo
//si es un administrador ve a todo los usuarios de
foreach ($arrUsers as $user) {
$arrTmp = array();
if ($credentials["userlevel"] == "superadmin") {
$arrOgz = $pORGZ->getOrganizationById($user[4]);
$arrTmp[] = htmlentities($arrOgz["name"], ENT_COMPAT, 'UTF-8');
//organization
}
$arrTmp[] = " <a href='?menu=userlist&action=view&id={$user['0']}'>" . $user[1] . "</a>";
//username
$arrTmp[] = htmlentities($user[2], ENT_COMPAT, 'UTF-8');
//name
$gpTmp = $pACL->getGroupNameByid($user[7]);
$arrTmp[] = $gpTmp == "superadmin" ? _tr("NONE") : $gpTmp;
if (!isset($user[5]) || $user[5] == "") {
$ext = _tr("Not assigned");
} else {
$ext = $user[5];
}
if (!isset($user[6]) || $user[6] == "") {
$faxExt = _tr("Not assigned");
} else {
$faxExt = $user[6];
}
$arrTmp[] = $ext . " / " . $faxExt;
if ($user[4] != 1) {
//user that belong organization 1 do not have email account
$arrTmp[] = obtener_quota_usuario($user[1], $module_name);
//email quota
if (in_array('reconstruct_mailbox', $arrPermission)) {
$arrTmp[] = " <a href='#' onclick=mailbox_reconstruct('{$user[1]}')>" . _tr('Reconstruct Mailbox') . "</a>";
//reconstruct mailbox
}
} else {
$arrTmp[] = '';
$arrTmp[] = '';
}
$arrData[] = $arrTmp;
$end++;
}
$smarty->assign("USERLEVEL", $credentials['userlevel']);
$smarty->assign("SEARCH", "<input name='search_org' type='submit' class='button' value='" . _tr('Search') . "'>");
if ($pORGZ->getNumOrganization(array()) > 0) {
$arrOrgz = array(0 => _tr("all"));
if (in_array('create_user', $arrPermission)) {
$oGrid->addNew("create_user", _tr("Create New User"));
}
if ($credentials['userlevel'] == "superadmin") {
foreach ($pORGZ->getOrganization(array()) as $value) {
$arrOrgz[$value["id"]] = $value["name"];
}
$_POST["idOrganization"] = $idOrgFil;
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization") . " = " . $arrOrgz[$idOrgFil], $_POST, array("idOrganization" => 0), true);
//organization
}
$arrFormElements = createFieldFilter($arrOrgz);
$oFilterForm = new paloForm($smarty, $arrFormElements);
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Username") . " = " . $username, $_POST, array("username" => ""));
//username
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
$oGrid->showFilter(trim($htmlFilter));
} else {
$smarty->assign("mb_title", _tr("MESSAGE"));
$smarty->assign("mb_message", _tr("In order to use this module must exist at least 1 organization in the Elastix Server"));
}
$contenidoModulo = $oGrid->fetchGrid(array(), $arrData);
$mensaje = showMessageReload($module_name, $pDB, $credentials);
$contenidoModulo = $mensaje . $contenidoModulo;
return $contenidoModulo;
}