本文整理汇总了PHP中paloSantoGrid::addComboAction方法的典型用法代码示例。如果您正苦于以下问题:PHP paloSantoGrid::addComboAction方法的具体用法?PHP paloSantoGrid::addComboAction怎么用?PHP paloSantoGrid::addComboAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paloSantoGrid
的用法示例。
在下文中一共展示了paloSantoGrid::addComboAction方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: addRemovePortsUser
//.........这里部分代码省略.........
} else {
$id_user = $userlist[0][0];
}
$ps = new paloSantoPortService($pDB);
$pk = new paloSantoPortKnockUsers($pDB);
// Construir lista de puertos autorizados
$userauth = $pk->listAuthorizationsForUser($id_user);
$portauths = array();
if (is_array($userauth)) {
foreach ($userauth as $auth) {
$portauths[$auth['id_port']] = $auth['id'];
}
}
$portlist = $ps->ObtainPuertos($ps->ObtainNumPuertos('', ''), 0, '', '');
$listaIdPuertos = array();
foreach ($portlist as $portinfo) {
$listaIdPuertos[] = $portinfo['id'];
}
if (isset($_POST['apply']) && is_array($_POST['auth_port'])) {
// Se requiere aplicar lista de cambios
$listaNuevosPuertos = array_keys($_POST['auth_port']);
$bReglasBorradas = FALSE;
// Borrar la autorización de todos los puertos que ya no aparecen
$bExito = TRUE;
foreach ($portauths as $id_port => $id_auth) {
if (!in_array($id_port, $listaNuevosPuertos)) {
if (!$pk->deleteAuthorization($id_auth)) {
$smarty->assign("mb_title", _tr("ERROR"));
$smarty->assign("mb_message", $pk->errMsg);
$bExito = FALSE;
break;
} else {
unset($portauths[$id_port]);
$bReglasBorradas = TRUE;
}
}
}
if (!$bExito) {
break;
}
// Ingresar la autorización de los puertos nuevos
foreach ($listaNuevosPuertos as $id_port) {
if (in_array($id_port, $listaIdPuertos) && !isset($portauths[$id_port])) {
$id_nueva_auth = $pk->insertAuthorization($id_user, $id_port);
if (is_null($id_nueva_auth)) {
$smarty->assign("mb_title", _tr("ERROR"));
$smarty->assign("mb_message", $pk->errMsg);
$bExito = FALSE;
break;
} else {
$portauths[$id_port] = $id_nueva_auth;
}
}
}
if ($bExito) {
if ($bReglasBorradas) {
// Ejecutar iptables para revocar las reglas del usuario
require_once "modules/sec_rules/libs/paloSantoRules.class.php";
$pr = new paloSantoRules($pDB);
$pr->activateRules();
}
Header("Location: ?menu={$module_name}");
return NULL;
}
}
$data = array();
if (is_array($portlist)) {
foreach ($portlist as $portinfo) {
$id_port = $portinfo['id'];
$protocol_details = '';
switch ($portinfo['protocol']) {
case 'TCP':
case 'UDP':
$protocol_details = (stripos($portinfo['details'], ':') === false ? _tr('Port') : _tr('Ports')) . ' ' . $portinfo['details'];
break;
case 'ICMP':
$arr = explode(':', $portinfo['details']);
if (isset($arr[1])) {
$protocol_details = _tr('Type') . ": " . $arr[0] . " " . _tr('Code') . ": " . $arr[1];
}
break;
default:
$protocol_details = _tr('Protocol Number') . ': ' . $portinfo['details'];
break;
}
$data[] = array("<input type=\"checkbox\" name=\"auth_port[{$id_port}]\" " . (isset($portauths[$id_port]) ? 'checked="checked"' : '') . ' />', htmlentities($portinfo['name'], ENT_COMPAT, 'UTF-8'), htmlentities($portinfo['protocol'], ENT_COMPAT, 'UTF-8'), $protocol_details);
}
}
$oGrid = new paloSantoGrid($smarty);
$oGrid->setTitle(_tr('Add/remove ports for user'));
$oGrid->setColumns(array('', _tr('Port'), _tr('Protocol'), _tr('Details')));
$oGrid->addSubmitAction('apply', _tr('Apply changes'), "modules/{$module_name}/images/Check.png");
$oGrid->addComboAction('id_user', _tr('User'), $cbo_users, $id_user, 'refresh', 'submit();');
// Construcción de la vista de puertos autorizados
$oGrid->pagingShow(false);
$url = array("menu" => $module_name);
$oGrid->setURL($url);
$oGrid->setData($data);
return $oGrid->fetchGrid();
}
示例3: 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;
}
示例4: 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;
//.........这里部分代码省略.........
示例5: report_backup_restore
function report_backup_restore($smarty, $module_name, $local_templates_dir, $dir_backup, &$pDB)
{
$total_archivos = array_reverse(array_map('basename', glob("{$dir_backup}/*.tar")));
// Paginacion
$limit = 10;
$total = count($total_archivos);
$oGrid = new paloSantoGrid($smarty);
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
$end = $oGrid->getEnd();
$nombre_archivos = array_slice($total_archivos, $offset, $limit);
//Fin Paginacion
// obtencion de parametros desde la base
$pFTPBackup = new paloSantoFTPBackup($pDB);
$_DATA = $pFTPBackup->getStatusAutomaticBackupById(1);
if (!(is_array($_DATA) & count($_DATA) > 0)) {
$_DATA['status'] = "DISABLED";
}
$arrData = null;
if (is_array($nombre_archivos) && $total > 0) {
foreach ($nombre_archivos as $key => $nombre_archivo) {
$arrTmp[0] = "<input type='checkbox' name='chk[" . $nombre_archivo . "]' id='chk[" . $nombre_archivo . "]'/>";
$arrTmp[1] = "<a href='?menu={$module_name}&action=download_file&file_name={$nombre_archivo}&rawmode=yes'>{$nombre_archivo}</a>";
$fecha = "";
// se parsea el archivo para obtener la fecha
if (preg_match("/\\w*-\\d{4}\\d{2}\\d{2}\\d{2}\\d{2}\\d{2}-\\w{2}\\.\\w*/", $nombre_archivo)) {
//elastixbackup-20110720122759-p7.tar
$arrMatchFile = preg_split("/-/", $nombre_archivo);
$data = $arrMatchFile[1];
$fecha = substr($data, -8, 2) . "/" . substr($data, -10, 2) . "/" . substr($data, 0, 4) . " " . substr($data, -6, 2) . ":" . substr($data, -4, 2) . ":" . substr($data, -2, 2);
$id = $arrMatchFile[1] . "-" . $arrMatchFile[2];
}
$arrTmp[2] = $fecha;
$arrTmp[3] = "<input type='submit' name='submit_restore[" . $nombre_archivo . "]' value='" . _tr('Restore') . "' class='button' />";
$arrData[] = $arrTmp;
}
}
$arrGrid = array("title" => _tr('Backup List'), "url" => array('menu' => $module_name), "icon" => "/modules/{$module_name}/images/system_backup_restore.png", "width" => "99%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total, "columns" => array(0 => array("name" => ""), 1 => array("name" => _tr('Name Backup')), 2 => array("name" => _tr('Date')), 3 => array("name" => _tr('Action'))));
$time = $_DATA['status'];
$smarty->assign("FILE_UPLOAD", _tr('File Upload'));
$smarty->assign("AUTOMATIC", _tr('AUTOMATIC'));
$smarty->assign("UPLOAD", _tr('Upload'));
$smarty->assign("FTP_BACKUP", _tr('FTP Backup'));
$oGrid->addNew("backup", _tr("Backup"));
$oGrid->deleteList(_tr("Are you sure you wish to delete backup (s)?"), 'delete_backup', _tr("Delete"));
$oGrid->customAction("view_form_FTP", _tr("FTP Backup"));
$backupIntervals = array('DISABLED' => _tr('DISABLED'), 'DAILY' => _tr('DAILY'), 'MONTHLY' => _tr('MONTHLY'), 'WEEKLY' => _tr('WEEKLY'));
$oGrid->addComboAction("time", _tr("AUTOMATIC"), $backupIntervals, $time, 'automatic');
$contenidoModulo = $oGrid->fetchGrid($arrGrid, $arrData);
return $contenidoModulo;
}
示例6: reportGroupPermission
//.........这里部分代码省略.........
//los premisos que tiene el grupo
$arrPermisos = $pACL->loadGroupPermissions($idGroup, $listResource);
if ($arrPermisos === false) {
$smarty->assign("mb_title", _tr("ERROR"));
$smarty->assign("mb_message", _tr("An error has ocurred to retrieved Group Permissions"));
$error = true;
}
}
$max_actions = 0;
$isAdministrator = $pACL->getGroupNameByid($idGroup) == _tr("administrator") ? true : false;
if ($totalGroupPermission > 0 && !$error) {
foreach ($arrResourceActions as $resource => $actions) {
$arrTmp = array();
$arrTmp[] = _tr($listResDes[$resource]);
$disabled = "";
if ($isAdministrator && ($resource == 'grouplist' || $resource == 'userlist' || $resource == 'group_permission')) {
$disabled = "disabled='disabled'";
}
//dentro del modulo organizacion ahi acciones que unicamente las puede realizar el superadmin
//por lo tando no deben aparecer listadas
if ($resource == "organization") {
$actions = array_diff($actions, array('change_org_status', 'create_org', 'delete_org', 'edit_DID'));
} elseif ($resource == "dashboard") {
$actions = array('access');
} elseif ($resource == 'cdrreport') {
$actions = array('access', 'export');
}
if (count($actions) > $max_actions) {
$max_actions = count($actions);
}
$desactivar = false;
if (isset($arrPermisos[$resource])) {
//grupo no tiene nigun permiso
if (!in_array('access', $arrPermisos[$resource])) {
$desactivar = true;
}
} else {
$desactivar = true;
$arrPermisos[$resource] = array();
}
foreach ($actions as $action) {
$class = 'other_act';
if ($action == 'access') {
$class = 'access_act';
} elseif ($desactivar) {
$disabled = "disabled='disabled'";
}
$checked0 = '';
//chequeamos si la accion se encuentra en la lista de acciones permitidas en el recurso
if (in_array($action, $arrPermisos[$resource])) {
$checked0 = "checked";
}
$arrTmp[] = "<input type='checkbox' class='{$class}' {$disabled} name='groupPermission[" . $resource . "][{$action}]' {$checked0}> {$action}";
}
$arrData[] = $arrTmp;
}
}
$oGrid->setTitle(_tr("Group Permission"));
$oGrid->setURL($url);
$oGrid->setWidth("99%");
$oGrid->setStart($total == 0 ? 0 : $offset + 1);
$oGrid->setEnd($end);
$oGrid->setTotal($total);
$arrColumn[] = _tr("Resource");
for ($i = 1; $i <= $max_actions; $i++) {
$act = _tr("Action");
$arrColumn[] = "{$act}" . " {$i}";
}
$oGrid->setColumns($arrColumn);
//begin section filter
$arrFormFilter = createFieldFilter($arrGroups);
$oFilterForm = new paloForm($smarty, $arrFormFilter);
$smarty->assign("SHOW", _tr("Show"));
$smarty->assign("limit_apply", htmlspecialchars($limit, ENT_COMPAT, 'UTF-8'));
$smarty->assign("offset_apply", htmlspecialchars($offset, ENT_COMPAT, 'UTF-8'));
$smarty->assign("resource_apply", htmlentities($filter_resource));
$_POST["filter_group"] = htmlspecialchars($filter_group, ENT_COMPAT, 'UTF-8');
$_POST["filter_resource"] = htmlspecialchars($filter_resource, ENT_COMPAT, 'UTF-8');
$_POST["idOrganization"] = $idOrgFil;
if (count($arrOrgz) > 0) {
global $arrPermission;
if (in_array('edit_permission', $arrPermission)) {
$oGrid->addSubmitAction("apply", _tr("Save"));
}
if ($credentials['userlevel'] == "superadmin") {
$oGrid->addComboAction("idOrganization", _tr("Organization"), $arrOrgz, $idOrgFil, "report");
}
$nameGroup = isset($arrGroups[$filter_group]) ? $arrGroups[$filter_group] : "";
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Group") . " = {$nameGroup}", $_POST, array("filter_group" => $groupTmp[0][0]), true);
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Resource") . " = {$filter_resource}", $_POST, array("filter_resource" => ""));
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
$oGrid->showFilter(trim($htmlFilter));
} else {
$smarty->assign("mb_title", _tr("MESSAGE"));
$smarty->assign("mb_message", _tr("You haven't created any organization"));
}
$contenidoModulo = $oGrid->fetchGrid(array(), $arrData);
//end grid parameters
return $contenidoModulo;
}
示例7: reportOrgPermission
//.........这里部分代码省略.........
}
}
$filter_resource = htmlentities($filter_resource);
//buscamos en el arreglo del lenguaje la traduccion del recurso en caso de que exista
$lang = get_language();
//lenguage que esta siendo usado
$parameter_to_find = null;
if (isset($filter_resource)) {
if (trim($filter_resource) != "") {
if ($lang != "en") {
global $arrLang;
$filter_value = strtolower(trim($filter_resource));
$parameter_to_find[] = $filter_value;
//parametro de busqueda sin traduccion
foreach ($arrLang as $key => $value) {
$langValue = strtolower(trim($value));
if (preg_match("/^[[:alnum:]| ]*\$/", $filter_value)) {
if (strpos($langValue, $filter_value) !== FALSE) {
$parameter_to_find[] = $key;
}
}
}
} else {
$parameter_to_find[] = $filter_resource;
}
}
}
//obtenemos el numero de recursos disponibles del sistema
$total = 0;
if (count($arrOrgz) > 0) {
$total = $pACL->getNumResources($parameter_to_find, 'yes');
}
if ($total == false && $pACL->errMsg != "") {
$total = 0;
$smarty->assign("mb_title", _tr("ERROR"));
$smarty->assign("mb_message", _tr("An error has ocurred to retrieved resources data"));
}
$limit = 25;
$oGrid = new paloSantoGrid($smarty);
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
$end = $offset + $limit <= $total ? $offset + $limit : $total;
$url["menu"] = $module_name;
$url["filter_resource"] = $filter_resource;
$url["idOrganization"] = $idOrgFil;
$oGrid->setTitle(_tr("Organization Permission"));
$oGrid->setURL($url);
$oGrid->setWidth("99%");
$oGrid->setStart($total == 0 ? 0 : $offset + 1);
$oGrid->setEnd($end);
$oGrid->setTotal($total);
$arrColumn = array(_tr("Resource"), "<input type='checkbox' name='selectAll' id='selectAll' />" . _tr('Permit Access'));
$oGrid->setColumns($arrColumn);
$arrData = array();
if (count($arrOrgz) > 0 && $total > 0) {
//obtengo una lista con todos los recursos a los que una organizacion puede tener acceso
$arrResource = $pACL->getListResources($limit, $offset, $parameter_to_find, 'yes');
//lista de los recursos permitidos a la organizacion seleccionada organizacion
$arrResourceOrg = $pACL->getResourcesByOrg($idOrgFil, $parameter_to_find);
if ($arrResourceOrg === false || $arrResource === false) {
$smarty->assign("mb_title", _tr("ERROR"));
$smarty->assign("mb_message", _tr("An error has ocurred to retrieve resource list.") . " " . _tr($pACL->errMsg));
} else {
$temp = array();
foreach ($arrResourceOrg as $value) {
$temp[] = $value["id"];
}
if (is_array($arrResource) && count($arrResource) > 0) {
foreach ($arrResource as $resource) {
$disabled = "";
if ($resource["id"] == 'usermgr' || $resource["id"] == 'grouplist' || $resource["id"] == 'userlist' || $resource["id"] == 'group_permission' || $resource["id"] == 'organization') {
$disabled = "disabled='disabled'";
}
$checked0 = "";
if (in_array($resource["id"], $temp)) {
$checked0 = "checked";
}
$arrTmp[0] = _tr($resource["description"]);
$arrTmp[1] = "<input type='checkbox' {$disabled} name='resource[" . $resource["id"] . "]' id='" . $resource["id"] . "' class='resource' {$checked0}>" . " " . _tr("Permit");
$arrData[] = $arrTmp;
}
}
}
}
$smarty->assign("SHOW", _tr("Show"));
$smarty->assign("resource_apply", $filter_resource);
if (count($arrOrgz) > 0) {
$oGrid->addSubmitAction("apply", _tr("Save"));
$oGrid->addComboAction("idOrganization", _tr("Organization"), $arrOrgz, $idOrgFil, "report");
$arrFormFilter = createFieldFilter();
$oFilterForm = new paloForm($smarty, $arrFormFilter);
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Resource") . " = {$filter_resource}", $_POST, array("filter_resource" => ""));
$oGrid->showFilter(trim($htmlFilter));
}
$contenidoModulo = $oGrid->fetchGrid(array(), $arrData);
//end grid parameters
return $contenidoModulo;
}
示例8: 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;
}
示例9: 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);
//.........这里部分代码省略.........
示例10: 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"));
//.........这里部分代码省略.........
示例11: reportTrunks
function reportTrunks($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials)
{
global $arrPermission;
$pTrunk = new paloSantoTrunk($pDB);
$pORGZ = new paloSantoOrganization($pDB);
$error = "";
$domain = getParameter("organization");
$technology = getParameter("technology");
$status = getParameter("status");
$url['menu'] = $module_name;
$url['organization'] = $domain;
$url['technology'] = $technology;
$url['status'] = $status;
$total = $pTrunk->getNumTrunks($domain, $technology, $status);
if ($total === false) {
$error = $pTrunk->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('Trunks List'));
$oGrid->setWidth("99%");
$oGrid->setStart($total == 0 ? 0 : $offset + 1);
$oGrid->setEnd($end);
$oGrid->setTotal($total);
$oGrid->setURL($url);
$arrColum[] = _tr("Name");
$arrColum[] = _tr("Technology");
$arrColum[] = _tr("Channel / Peer|[User]");
$arrColum[] = _tr("Max. Channels");
$arrColum[] = _tr("Current # of calls by period");
$arrColum[] = _tr("Status");
$oGrid->setColumns($arrColum);
$edit = in_array('edit', $arrPermission);
$arrData = array();
if ($total != 0) {
$arrTrunks = $pTrunk->getTrunks($domain, $technology, $status, $limit, $offset);
if ($arrTrunks === false) {
$error = _tr("Error to obtain trunks") . $pTrunk->errMsg;
$arrTrunks = array();
}
foreach ($arrTrunks as $trunk) {
$arrTmp[0] = " <a href='?menu=trunks&action=view&id_trunk=" . $trunk['trunkid'] . "&tech_trunk=" . $trunk["tech"] . "'>" . $trunk['name'] . "</a>";
$arrTmp[1] = strtoupper($trunk['tech']);
$arrTmp[2] = $trunk['channelid'];
$arrTmp[3] = $trunk['maxchans'];
$state = "";
if ($trunk['sec_call_time'] == "yes") {
$arrTmp[4] = createDivToolTip($trunk['trunkid'], $pTrunk, $state);
} else {
$arrTmp[4] = _tr("Feature don't Set");
}
if ($trunk['disabled'] == "on" || $state == "YES") {
$disabled = "on";
} else {
$disabled = "off";
}
if ($edit) {
$arrTmp[5] = createSelect($trunk['trunkid'], $disabled);
} else {
$arrTmp[5] = $disabled == 'on' ? _tr('Disabled') : _tr('Enabled');
}
$arrData[] = $arrTmp;
}
}
if (in_array('create', $arrPermission)) {
$arrTech = array("sip" => _tr("SIP"), "dahdi" => _tr("DAHDI"), "iax2" => _tr("IAX2"), "custom" => _tr("CUSTOM"));
$oGrid->addComboAction($name_select = "tech_trunk", _tr("Create New Trunk"), $arrTech, $selected = null, $task = "create_trunk", $onchange_select = null);
}
$arrOrgz = array("" => _tr("all"));
foreach ($pORGZ->getOrganization(array()) as $value) {
$arrOrgz[$value["domain"]] = $value["name"];
}
$_POST["organization"] = $domain;
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization Allow") . " = " . $arrOrgz[$domain], $_POST, array("organization" => ""), true);
//organization allow
$techFilter = array('' => _tr('All'), "sip" => _tr("SIP"), "dahdi" => _tr("DAHDI"), "iax2" => _tr("IAX2"), "custom" => _tr("CUSTOM"));
$_POST["technology"] = $technology;
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Type") . " = " . $techFilter[$technology], $_POST, array("technology" => ""), true);
//technology
$arrStatus = array('' => '', 'off' => _tr('Enabled'), 'on' => _tr('Disabled'));
$_POST["status"] = $status;
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Status") . " = " . $arrStatus[$status], $_POST, array("status" => ""), true);
//status
$smarty->assign("SEARCH", "<input type='submit' class='button' value='" . _tr('Search') . "' name='search'>");
$arrFormElements = createFieldFilter($arrOrgz, $techFilter, $arrStatus);
$oFilterForm = new paloForm($smarty, $arrFormElements);
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
$oGrid->showFilter(trim($htmlFilter));
if ($error != "") {
$smarty->assign("mb_title", _tr("MESSAGE"));
$smarty->assign("mb_message", $error);
}
$contenidoModulo = $oGrid->fetchGrid(array(), $arrData);
$contenidoModulo .= "<input type='hidden' name='grid_limit' id='grid_limit' value='{$limit}'>";
$contenidoModulo .= "<input type='hidden' name='grid_offset' id='grid_offset' value='{$offset}'>";
//.........这里部分代码省略.........
示例12: viewFormAccount
function viewFormAccount($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $arrLang)
{
$pEmail = new paloEmail($pDB);
$oGrid = new paloSantoGrid($smarty);
$id_domain = 0;
/*if (isset($_POST['domain'])) $id_domain=$_POST['domain'];
if (isset($_GET['id_domain'])) $id_domain=$_GET['id_domain'];*/
if (isset($_POST['domain']) || isset($_GET['domain'])) {
$id_domain = getParameter('domain');
if ($id_domain == null) {
$id_domain = 0;
}
}
$_POST['domain'] = $id_domain;
$arrDominios = array("0" => '-- ' . $arrLang["Select a domain"] . ' --');
$arrDomains = $pEmail->getDomains();
foreach ($arrDomains as $domain) {
$arrDominios[$domain[0]] = $domain[1];
}
$arrFormElements = createFieldFormAccount($arrLang, $arrDominios);
$oFilterForm = new paloForm($smarty, $arrFormElements);
$smarty->assign("SHOW", $arrLang["Show"]);
$smarty->assign("CREATE_ACCOUNT", $arrLang["Create Account"]);
// $oGrid->pagingShow(true);
$url = array("menu" => $module_name);
if ($id_domain == 0) {
$url = array("menu" => $module_name);
} else {
$url = array("menu" => $module_name, "domain" => $id_domain);
}
$oGrid->setURL($url);
$oGrid->setTitle(_tr("Email Account List"));
////////////////////////////////////////////////////////////////////////////////////////////////////////
$arrData = array();
$pACL = new paloACL(new paloDB($arrConf['elastix_dsn']['acl']));
$userAccount = isset($_SESSION['elastix_user']) ? $_SESSION['elastix_user'] : "";
$isAdministrator = $pACL->isUserAdministratorGroup($userAccount);
$reconstruir = _tr("Reconstruct");
if ($id_domain > 0) {
$arrAccounts = $pEmail->getAccountsByDomain($id_domain);
} else {
$arrAccounts = $pEmail->getAccountsByDomain();
}
if (is_array($arrAccounts)) {
//username, password, id_domain, quota
$end = count($arrAccounts);
//$configPostfix2 = isPostfixToElastix2();// in misc.lib.php
foreach ($arrAccounts as $account) {
$arrTmp = array();
$username = $account[0];
$arrTmp[0] = " <a href='?menu={$module_name}&action=view&username={$username}'>{$username}</a>";
$arrTmp[1] = obtener_quota_usuario($pEmail, $username, $module_name, $arrLang, $id_domain);
if ($isAdministrator) {
$arrTmp[2] = " <a href='?menu={$module_name}&action=reconstruir&username={$username}&domain={$id_domain}'>{$reconstruir}</a>";
}
$link_agregar_direccion = "<a href='?action=add_address&id_domain={$id_domain}&username={$username}'>Add Address</a>";
$link_modificar_direccion = "<a href='?action=edit_addresses&id_domain={$id_domain}&username={$username}'>Addresses</a>";
//$arrTmp[3]=$link_agregar_direccion." ".$link_modificar_direccion;
$arrData[] = $arrTmp;
}
} else {
$smarty->assign("mb_title", _tr("Error"));
$smarty->assign("mb_message", $pEmail->errMsg);
}
$total = count($arrData);
$limit = 20;
$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);
if ($isAdministrator) {
$oGrid->setColumns(array(_tr("Account Name"), _tr("Used Space"), _tr("Reconstruct MailBox")));
} else {
$oGrid->setColumns(array(_tr("Account Name"), _tr("Used Space")));
}
$arrGrid = array("width" => "99%", "start" => $inicio, "end" => $fin, "total" => $total);
$oGrid->addComboAction("domain", _tr("Create Account"), $arrDominios, $id_domain, "submit_create_account", "this.form.submit();");
if ($id_domain != 0) {
$oGrid->addLinkAction("?menu={$module_name}&action=export&domain={$id_domain}&rawmode=yes", _tr("Export Accounts"));
$smarty->assign("id_domain", $id_domain);
}
$content = $oGrid->fetchGrid($arrGrid, $arrDatosGrid, $arrLang);
return $content;
}
示例13: showCallers
//.........这里部分代码省略.........
$date = time();
if ($date >= strtotime($conference["startTime"]) && $date <= strtotime($conference["endtime"]) || $conference["startTime"] == "1900-01-01 12:00:00") {
$room = $conference["confno"];
$total = $conference["members"];
} else {
$smarty->assign("mb_title", _tr("ERROR"));
$smarty->assign("mb_message", _tr("Conference out of Time"));
return reportConference($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
}
}
$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('Conference') . ": {$conference['name']} ({$conference['ext_conf']})");
//$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 = "?menu={$module_name}&action=current_conf&id_conf={$id_conf}");
//permission
$invite_part = in_array("admin_conference_participant", $arrPermission);
$arrColum = array();
$arrColum[] = _tr("Orden Join");
$arrColum[] = _tr("CallerId");
$arrColum[] = _tr("Time in Conference");
$arrColum[] = _tr("Mode");
if ($invite_part) {
$arrColum[] = "<input type='button' name='mute_caller' value=" . _tr("Mute") . " class='button' onclick='javascript:muteCaller()'/>";
$msgKill = _tr("Are you sure you wish to Kick all caller (s)?");
$arrColum[] = "<input type='button' name='kick_caller' value=" . _tr("Kick") . " class='button' onclick=\"javascript:kickCaller('{$msgKill}');\"/>";
}
$oGrid->setColumns($arrColum);
$arrData = array();
$arrMemb = array();
if ($total != 0) {
$arrMemb = $pConf->ObtainCallers($room);
}
$session = getSession();
if ($arrMemb === false) {
$error = _tr("Error getting conference data.") . $pConf->errMsg;
} else {
$membPagg = array_slice($arrMemb, $offset, $limit);
foreach ($membPagg as $memb) {
$arrTmp = array();
$arrTmp[0] = $memb['userId'];
$arrTmp[1] = trim($memb['callerId']);
$arrTmp[2] = $memb['duration'];
$arrTmp[3] = empty($memb['mode']) ? "user" : "admin";
if ($invite_part) {
$status = strstr($memb['status'], "Muted");
//falso si no encuentra la palabra en el arreglo
$checked = empty($status) ? "" : "checked";
$arrTmp[4] = "<input type='checkbox' name=mute_{$memb['userId']} class='conf_mute' {$checked}>";
$arrTmp[5] = "<input type='checkbox' name=kick_{$memb['userId']} class='conf_kick'>";
}
$arrData[] = $arrTmp;
//se usa para comprobar si ha habido cambios en el estado de las conferencias
$session['conference']["current_conf"][$memb['userId']] = $memb['callerId'];
}
}
//se escribe en session el estado actual de las conferencias
if (!isset($session['conference']["current_conf"])) {
$session['conference']["current_conf"] = array();
}
putSession($session);
//filters
$extens = $pConf->getAllDevice($domain);
$arrExten = array("" => "--unselected--");
if ($extens != false) {
$astMang = AsteriskManagerConnect($errorM);
$result = $pConf->getCodeByDomain($domain);
foreach ($extens as $value) {
$cidname = "";
if ($astMang != false && $result != false) {
$cidname = $astMang->database_get("EXTUSER/" . $result["code"] . "/" . $value["exten"], "cidname");
}
$arrExten[$value["dial"]] = isset($cidname) ? $cidname . " <{$value["exten"]}>" : $value["exten"] . " ({$value["dial"]})";
}
}
if ($invite_part) {
$oGrid->addComboAction("invite_caller", _tr("Invite Caller"), $arrExten, "Invite Caller to Conference", "invite_caller", "javascript:inviteCaller()");
$oGrid->addButtonAction("kick_all", $alt = "Kick All Callers", "../web/_common/images/delete5.png", "javascript:kickAll('{$msgKill}')");
$oGrid->addButtonAction("mute_all", $alt = "Mute All Callers", null, "javascript:muteAll()");
}
if ($error != "") {
$smarty->assign("mb_title", _tr("MESSAGE"));
$smarty->assign("mb_message", $error);
}
$contenidoModulo = $oGrid->fetchGrid(array(), $arrData);
$contenidoModulo .= "<input type='hidden' name='id_conf' id='id_conf' value='{$id_conf}'>";
$contenidoModulo .= "<input type='hidden' name='organization' id='organization' value='{$domain}'>";
$contenidoModulo .= "<input type='hidden' name='grid_limit' id='grid_limit' value='{$limit}'>";
$contenidoModulo .= "<input type='hidden' name='grid_offset' id='grid_offset' value='{$offset}'>";
$contenidoModulo .= "<input type='hidden' name='conf_action' id='conf_action' value='showCallers'>";
return $contenidoModulo;
}
示例14: reportRG
function reportRG($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'];
}
$rg_name = getParameter("rg_name");
$pRG = new paloSantoRG($pDB, $domain);
$rg_number = getParameter("rg_number");
if (isset($rg_number) && $rg_number != '') {
$expression = $pRG->getRegexPatternFromAsteriskPattern($rg_number);
if ($expression === false) {
$rg_number = '';
}
}
$url['menu'] = $module_name;
$url['organization'] = $domain;
$url['rg_number'] = $rg_number;
//ring group number
$url['rg_name'] = $rg_name;
//ring group number
$total = $pRG->getNumRG($domain, $rg_number, $rg_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 = $pRG->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('RG 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("Number");
$arrColum[] = _tr("Name");
$arrColum[] = _tr("Strategy");
$arrColum[] = _tr("Ring Time");
$arrColum[] = _tr("Ignore CF");
$arrColum[] = _tr("Skip Busy Extensions");
$arrColum[] = _tr("Default Destination");
$oGrid->setColumns($arrColum);
$arrRG = array();
$arrData = array();
if ($total != 0) {
$arrRG = $pRG->getRGs($domain, $rg_number, $rg_name, $limit, $offset);
}
if ($arrRG === false) {
$error = _tr("Error to obtain Ring Groups") . $pRG->errMsg;
$arrRG = array();
}
foreach ($arrRG as $rg) {
$arrTmp = array();
if ($credentials['userlevel'] == "superadmin") {
$arrTmp[] = $arrOrgz[$rg["organization_domain"]];
}
$arrTmp[] = " <a href='?menu=ring_group&action=view&id_rg=" . $rg['id'] . "&organization={$rg['organization_domain']}'>" . $rg['rg_number'] . "</a>";
$arrTmp[] = htmlentities($rg["rg_name"], ENT_QUOTES, "UTF-8");
$arrTmp[] = $rg["rg_strategy"];
$arrTmp[] = $rg["rg_time"];
$arrTmp[] = $rg["rg_cf_ignore"];
$arrTmp[] = $rg["rg_skipbusy"];
$arrTmp[] = $rg["destination"];
$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 Ring Group"), array_slice($arrOrgz, 1), $selected = null, "create_rg", $onchange_select = null);
} else {
$oGrid->addNew("create_rg", _tr("ADD Ring Group"));
}
}
if ($credentials['userlevel'] == 'superadmin') {
$_POST["organization"] = $domain;
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization") . " = " . $arrOrgz[$domain], $_POST, array("organization" => "all"), true);
}
$_POST["rg_number"] = $rg_number;
//.........这里部分代码省略.........