本文整理汇总了PHP中paloSantoGrid::addNew方法的典型用法代码示例。如果您正苦于以下问题:PHP paloSantoGrid::addNew方法的具体用法?PHP paloSantoGrid::addNew怎么用?PHP paloSantoGrid::addNew使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paloSantoGrid
的用法示例。
在下文中一共展示了paloSantoGrid::addNew方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listPortKnockUsers
function listPortKnockUsers(&$smarty, $module_name, $local_templates_dir, &$pDB, $arrConf)
{
$pACL = new paloACL($arrConf['elastix_dsn']['acl']);
$pk = new paloSantoPortKnockUsers($pDB);
// Manejar la operación de borrar todas las autorizaciones de un usuario
if (isset($_POST['delete']) && isset($_POST['id_user'])) {
$r = $pk->deleteUserAuthorizations($_POST['id_user']);
if (!$r) {
$smarty->assign("mb_title", _tr("ERROR"));
$smarty->assign("mb_message", $pk->errMsg);
} else {
// Ejecutar iptables para revocar las reglas del usuario
require_once "modules/sec_rules/libs/paloSantoRules.class.php";
$pr = new paloSantoRules($pDB);
$pr->activateRules();
$smarty->assign("mb_title", _tr("Message"));
$smarty->assign("mb_message", _tr("Revocation successful"));
}
}
$oGrid = new paloSantoGrid($smarty);
$oGrid->setTitle(_tr('PortKnock Users'));
$oGrid->setColumns(array('', _tr('User'), _tr('Authorized ports'), _tr('Options')));
$oGrid->deleteList(_tr('Are you sure you wish to revoke the user authorizations?'), 'delete', _tr('Revoke authorizations'));
$oGrid->addNew("?menu={$module_name}&action=new", _tr('Authorize new user'), true);
// Construcción de la vista de usuarios autorizados
$data = array();
$recordset = $pk->listAuthorizedUsers();
if (is_array($recordset)) {
foreach ($recordset as $id_user => $auths) {
$userinfo = $pACL->getUsers($id_user);
$protocols = array();
foreach ($auths as $a) {
$protocols[] = $a['name'];
}
$data[] = array('<input type="radio" name="id_user" value="' . $id_user . '" />', $userinfo[0][1], implode(' ', $protocols), "<a href=\"?menu={$module_name}&action=edit&id_user={$id_user}\">[" . _tr('Add/Remove Ports') . "]</a>");
}
}
$oGrid->pagingShow(false);
$url = array("menu" => $module_name);
$oGrid->setURL($url);
$oGrid->setData($data);
return $oGrid->fetchGrid();
}
示例2: 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;
//.........这里部分代码省略.........
示例3: reportMemberList
function reportMemberList($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials)
{
global $arrPermission;
$pEmailList = new paloSantoEmailList($pDB);
$id_list = getParameter("id");
if ($credentials['userlevel'] == 'superadmin') {
$emailList = $pEmailList->getEmailList($id_list);
} else {
$emailList = $pEmailList->getEmailList($id_list, $credentials['domain']);
}
if ($emailList == false) {
$smarty->assign("mb_title", _tr("Error"));
$error = $emailList === false ? _tr("Couldn't be retrieved Email List data") : _tr("Email List does not exist");
$smarty->assign("mb_message", $error);
return reportEmailList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
}
$field_type = getParameter("filter_type");
$field_pattern = getParameter("filter_txt");
$smarty->assign("IDEMAILLIST", $id_list);
$smarty->assign("ACTION", 'view_memberlist');
$smarty->assign("SHOW", _tr("Show"));
$smarty->assign("RETURN", _tr("Return"));
$smarty->assign("LINK", "?menu={$module_name}&action=export&id={$id_list}&rawmode=yes");
$smarty->assign("EXPORT", _tr("Export Members"));
$edit_permission = in_array('edit_list', $arrPermission);
$totalMembers = $pEmailList->getTotalMembers($id_list);
$oGrid = new paloSantoGrid($smarty);
$limit = 20;
$oGrid->setLimit($limit);
$oGrid->setTotal($totalMembers);
$oGrid->setTitle(_tr("List Members of") . " " . $pEmailList->getListName($id_list));
$oGrid->setIcon("web/apps/{$module_name}/images/email.png");
$oGrid->pagingShow(true);
$offset = $oGrid->calculateOffset();
$url['menu'] = $module_name;
$url['action'] = 'view_memberlist';
$url['id'] = $id_list;
$url['filter_type'] = $field_type;
$url['filter_txt'] = $field_pattern;
$oGrid->setURL($url);
if ($edit_permission) {
$arrColumns[] = '';
}
$arrColumns[] = _tr("Member name");
$arrColumns[] = _tr("Member email");
$oGrid->setColumns($arrColumns);
$arrResult = $pEmailList->getMembers($limit, $offset, $id_list, $field_type, $field_pattern);
$arrData = null;
//print_r($arrResult);
if (is_array($arrResult) && $totalMembers > 0) {
foreach ($arrResult as $list) {
$arrTmp = array();
if ($edit_permission) {
$arrTmp[] = "<input type='checkbox' name='del_emailmembers[{$list["mailmember"]}]'>";
}
$arrTmp[] = $list["namemember"];
$arrTmp[] = $list["mailmember"];
$arrData[] = $arrTmp;
}
}
$arrFormFilterMembers = createFieldFilterViewMembers();
$oFilterForm = new paloForm($smarty, $arrFormFilterMembers);
$arrType = array("name" => _tr("Name"), "email" => _tr("Email"));
if (!is_null($field_type)) {
$nameField = $arrType[$field_type];
} else {
$nameField = "";
}
$oGrid->customAction("return", _tr("Return"));
if ($edit_permission) {
$oGrid->addNew("new_memberlist", _tr("Add Member(s) to List"));
$oGrid->deleteList(_tr("Are you sure you wish to delete the Email List(s)."), "remove_memberlist", _tr("Delete"));
}
$oGrid->customAction("?menu={$module_name}&action=export&id={$id_list}&rawmode=yes", _tr("Export Members"), null, true);
$oGrid->addFilterControl(_tr("Filter applied: ") . $nameField . " = " . $field_pattern, $_POST, array("filter_type" => "name", "filter_txt" => ""));
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/view_members.tpl", "", $_POST);
$oGrid->showFilter(trim($htmlFilter));
$content = $oGrid->fetchGrid(array(), $arrData);
return $content;
}
示例4: 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;
}
示例5: report_adress_book
//.........这里部分代码省略.........
$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'];
if ($adress_book['status'] == 'isPublic') {
if ($id_user == $adress_book['iduser']) {
$typeContact = "<div><div style='float: left;'><a href='?menu={$module_name}&action=show&id=" . $adress_book['id'] . "'><img alt='public' style='padding: 5px;' title='" . $arrLang['Public Contact'] . "' border='0' src='modules/{$module_name}/images/public_edit.png' /></a></div><div style='padding: 16px 0px 0px 5px; text-align:center;'><span style='visibility: hidden;'>" . $arrLang['Public editable'] . "</span></div></div>";
$arrTmp[0] = "<input type='checkbox' name='contact_{$adress_book['id']}' />";
} else {
$typeContact = "<div><div style='float: left;'><a href='?menu={$module_name}&action=show&id=" . $adress_book['id'] . "'><img alt='public' style='padding: 5px;' title='" . $arrLang['Public Contact'] . "' border='0' src='modules/{$module_name}/images/public.png' /></a></div><div style='padding: 16px 0px 0px 5px; text-align:center;'><span style='visibility: hidden;'>" . $arrLang['Public not editable'] . "</span></div></div>";
$arrTmp[0] = "";
}
} else {
$typeContact = "<div><div style='float: left;'><a href='?menu={$module_name}&action=show&id=" . $adress_book['id'] . "'><img alt='private' style='padding: 5px;' title='" . $arrLang['Private Contact'] . "' border='0' src='modules/{$module_name}/images/contact.png' /></a></div><div style='padding: 16px 0px 0px 5px; text-align:center;'><span style='visibility: hidden;'>" . $arrLang['Private'] . "</span></div></div>";
}
} else {
if (isset($arrMails[$adress_book['id']])) {
$email = $arrMails[$adress_book['id']];
$typeContact = "<div><div style='float: left;'><img alt='public' title='" . $arrLang['Public Contact'] . "' src='modules/{$module_name}/images/public.png' /></div><div style='padding: 16px 0px 0px 5px; text-align:center;'><span style='visibility: hidden;'>" . $arrLang['Public not editable'] . "</span></div></div>";
} else {
$email = '';
$typeContact = "<div><div style='float: left;'><img alt='public' title='" . $arrLang['Public Contact'] . "' src='modules/{$module_name}/images/public.png' /></div><div style='padding: 16px 0px 0px 5px; text-align:center;'><span style='visibility: hidden;'>" . $arrLang['Public not editable'] . "</span></div></div>";
}
}
$arrTmp[2] = $directory_type == 'external' ? "<a href='?menu={$module_name}&action=show&id=" . $adress_book['id'] . "'>" . htmlspecialchars($adress_book['last_name'], ENT_QUOTES, "UTF-8") . " " . htmlspecialchars($adress_book['name'], ENT_QUOTES, "UTF-8") . "</a>" : $adress_book['description'];
$arrTmp[3] = $directory_type == 'external' ? $adress_book['telefono'] : $adress_book['id'];
$arrTmp[4] = $email;
$arrTmp[5] = "<a href='?menu={$module_name}&action=call2phone&id=" . $adress_book['id'] . "&type=" . $directory_type . "'><img border=0 src='/modules/{$module_name}/images/call.png' /></a>";
$arrTmp[6] = "<a href='?menu={$module_name}&action=transfer_call&id=" . $adress_book['id'] . "&type=" . $directory_type . "'>{$arrLang["Transfer"]}</a>";
$arrTmp[7] = $typeContact;
$arrData[] = $arrTmp;
}
}
if ($directory_type == 'external') {
$name = "";
$picture = $arrLang["picture"];
$oGrid->deleteList(_tr("Are you sure you wish to delete the contact."), "delete", _tr("Delete"));
} else {
$name = "";
$picture = "";
}
$arrGrid = array("title" => $arrLang["Address Book"], "url" => array('menu' => $module_name, 'filter' => $pattern, 'select_directory_type' => $directory_type), "icon" => "modules/{$module_name}/images/address_book.png", "width" => "99%", "start" => $inicio, "end" => $end, "total" => $total, "columns" => array(0 => array("name" => $name, "property1" => ""), 1 => array("name" => $picture, "property1" => ""), 2 => array("name" => $arrLang["Name"], "property1" => ""), 3 => array("name" => $arrLang["Phone Number"], "property1" => ""), 4 => array("name" => $arrLang["Email"], "property1" => ""), 5 => array("name" => $arrLang["Call"], "property1" => ""), 6 => array("name" => $arrLang["Transfer"], "property1" => ""), 7 => array("name" => $arrLang["Type Contact"], "property1" => "")));
$oGrid->addNew("new", _tr("New Contact"));
$oGrid->showFilter(trim($htmlFilter));
$contenidoModulo = $oGrid->fetchGrid($arrGrid, $arrData, $arrLang);
return $contenidoModulo;
}
示例6: 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" => "modules/{$module_name}/images/system_network_assign_ip_address.png", "width" => "99%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total, "url" => array('menu' => $module_name, 'filter_field' => $filter_field, 'filter_value' => $filter_value), "columns" => array(0 => array("name" => $buttonDelete, "property1" => ""), 1 => array("name" => _tr('Host Name'), "property1" => ""), 2 => array("name" => _tr('IP Address'), "property1" => ""), 3 => array("name" => _tr('MAC Address'), "property1" => "")));
//begin section filter
$arrFormFilterDHCP_Configuration = createFieldFilter();
$oFilterForm = new paloForm($smarty, $arrFormFilterDHCP_Configuration);
$smarty->assign("SHOW", _tr('Show'));
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
//end section filter
$oGrid->showFilter(trim($htmlFilter));
$contenidoModulo = $oGrid->fetchGrid($arrGrid, $arrData);
//end grid parameters
return $contenidoModulo;
}
示例7: reportMoH
function reportMoH($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials)
{
global $arrPermission;
$error = "";
$pORGZ = new paloSantoOrganization($pDB);
$name = getParameter("name");
if ($credentials['userlevel'] == "superadmin") {
$domain = getParameter("organization");
$domain = empty($domain) ? 'all' : $domain;
$arrOrgz = array("all" => _tr("all"));
foreach ($pORGZ->getOrganization(array()) as $value) {
$arrOrgz[$value["domain"]] = $value["name"];
}
} else {
$arrOrgz = array();
$domain = $credentials['domain'];
}
$url["menu"] = $module_name;
$url["organization"] = $domain;
$url["name"] = $name;
$pMoH = new paloSantoMoH($pDB, $domain);
$total = $pMoH->getNumMoH($domain, $name);
if ($total === false) {
$error = $pMoH->errMsg;
$total = 0;
}
$limit = 20;
$oGrid = new paloSantoGrid($smarty);
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
$end = $offset + $limit <= $total ? $offset + $limit : $total;
$oGrid->setTitle(_tr('MoH Class List'));
//$oGrid->setIcon('url de la imagen');
$oGrid->setWidth("99%");
$oGrid->setStart($total == 0 ? 0 : $offset + 1);
$oGrid->setEnd($end);
$oGrid->setTotal($total);
$oGrid->setURL($url);
$arrColum = array();
if ($credentials['userlevel'] == "superadmin") {
$arrColum[] = _tr("Organization");
}
$arrColum[] = _tr("Name");
$arrColum[] = _tr("Type");
$arrColum[] = _tr("Sort");
$arrColum[] = _tr("Directory");
$arrColum[] = _tr("Aplication");
$oGrid->setColumns($arrColum);
$arrMoH = array();
$arrData = array();
if ($total != 0) {
$arrMoH = $pMoH->getMoHs($domain, $name, $limit, $offset);
}
if ($arrMoH === false) {
$error = _tr("Error to obtain MoH Class") . $pMoH->errMsg;
$arrMoH = array();
}
$arrData = array();
foreach ($arrMoH as $moh) {
$arrTmp = array();
if ($credentials['userlevel'] == "superadmin") {
if (empty($moh["organization_domain"])) {
$arrTmp[] = "";
$arrTmp[] = " <a href='?menu={$module_name}&action=view&id_moh=" . $moh["name"] . "'>" . $moh["description"] . "</a>";
} else {
$arrTmp[] = $arrOrgz[$moh["organization_domain"]];
$arrTmp[] = $moh["description"];
}
} else {
$arrTmp[] = " <a href='?menu={$module_name}&action=view&id_moh=" . $moh["name"] . "'>" . $moh["description"] . "</a>";
}
$arrTmp[] = $moh["mode"];
$arrTmp[] = $moh["sort"];
$arrTmp[] = $moh["directory"];
$arrTmp[] = $moh["application"];
$arrData[] = $arrTmp;
}
$smarty->assign("USERLEVEL", $credentials['userlevel']);
$smarty->assign("SEARCH", "<input type='submit' class='button' value='" . _tr('Search') . "' name='report'>");
if (in_array("create", $arrPermission)) {
$oGrid->addNew("create_moh", _tr("Create New Class MoH"));
}
if ($credentials['userlevel'] == "superadmin") {
$_POST["organization"] = $domain;
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization") . " = " . $arrOrgz[$domain], $_POST, array("organization" => "all"), true);
}
$_POST["name"] = $name;
// name
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Name") . " = " . $name, $_POST, array("name" => ""));
$arrFormElements = createFieldFilter($arrOrgz);
$oFilterForm = new paloForm($smarty, $arrFormElements);
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
$oGrid->showFilter(trim($htmlFilter));
if ($error != "") {
$smarty->assign("mb_title", _tr("MESSAGE"));
$smarty->assign("mb_message", $error);
}
$contenidoModulo = $oGrid->fetchGrid(array(), $arrData);
return $contenidoModulo;
//.........这里部分代码省略.........
示例8: reportDIDorganization
function reportDIDorganization($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials)
{
$pORGZ = new paloSantoOrganization($pDB);
$pDID = new paloDidPBX($pDB);
$domain = getParameter('domain');
if ($credentials['userlevel'] != "superadmin") {
$domain = $credentials['domain'];
}
if (!preg_match("/^(([[:alnum:]-]+)\\.)+([[:alnum:]])+\$/", $domain)) {
$smarty->assign("mb_title", _tr("ERROR"));
$smarty->assign("mb_message", _tr("Invalid domain format"));
return reportOrganization($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
}
$total = $pDID->getTotalDID($domain);
if ($total === false) {
$smarty->assign("mb_title", _tr("ERROR"));
$smarty->assign("mb_message", _tr("An error has ocurred to retrieve DID data"));
return reportOrganization($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;
$url['menu'] = $module_name;
$url['domain'] = $domain;
$oGrid->setTitle(_tr('DID Organization List'));
$oGrid->setURL($url);
$oGrid->setWidth("99%");
$oGrid->setStart($total == 0 ? 0 : $offset + 1);
$oGrid->setEnd($end);
$oGrid->setTotal($total);
if ($credentials['userlevel'] == "superadmin") {
$arrColumns[] = '';
$arrColumns[] = _tr("Organization Domain");
}
$arrColumns[] = _tr("DID");
$arrColumns[] = _tr("Type");
$arrColumns[] = _tr("Country");
$arrColumns[] = _tr("City");
$arrColumns[] = _tr("Country Code / Area Code");
$oGrid->setColumns($arrColumns);
$arrData = array();
$arrDID = $pDID->getDIDs($domain, null, null, null, $limit, $offset);
if ($arrDID === false) {
$smarty->assign("mb_title", _tr("ERROR"));
$smarty->assign("mb_message", _tr("An error has ocurred to retrieve DID data"));
return reportOrganization($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials);
} else {
//si es un usuario solo se ve su didsion
//si es un administrador ve todas las didsiones
foreach ($arrDID as $did) {
$arrTmp = array();
if ($credentials["userlevel"] == "superadmin") {
$arrTmp[] = "<input type='checkbox' name='dids[]' value='{$did['id']}' />";
$arrTmp[] = $did["organization_domain"];
}
$arrTmp[] = $did['did'];
$arrTmp[] = $did["type"];
$arrTmp[] = $did["country"];
$arrTmp[] = $did["city"];
$arrTmp[] = $did["country_code"] . " / " . $did["area_code"];
$arrData[] = $arrTmp;
}
}
if ($credentials['userlevel'] == "superadmin") {
$oGrid->addNew("assignDIDs", _tr("Add DID"));
$oGrid->deleteList(_tr('Are you sure you wish REMOVE this DID from organization'), 'removeDID', "Remove DID");
}
$content = $oGrid->fetchGrid(array(), $arrData);
return $content;
}
示例9: 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"));
//.........这里部分代码省略.........
示例10: reportDID
function reportDID($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials)
{
global $arrPermission;
$pDID = new paloDidPBX($pDB);
$pORGZ = new paloSantoOrganization($pDB);
$error = "";
$did_number = getParameter("did_number");
// did number
$status = getParameter("status");
// asignado o sin asignar
$country = getParameter("country");
// pais al que pertence el did
$domain = getParameter("organization");
// did que se encuentran asigandos a dicha organizacion
$url['menu'] = $module_name;
if (isset($did_number) && $did_number != '') {
$expression = $pDID->getRegexPatternFromAsteriskPattern($did_number);
if ($expression === false) {
$did_number = '';
}
}
$status = empty($status) ? 'all' : $status;
$domain = empty($domain) ? 'all' : $domain;
$url['did_number'] = $did_number;
$url['status'] = $status;
$url['country'] = $country;
$url['organization'] = $domain;
$total = 0;
$total = $pDID->getTotalDID($domain, $did_number, $country, $status);
if ($total === false) {
$error = $pDID->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;
$url = "?menu={$module_name}";
$arrGrid = array("title" => _tr('DID List'), "url" => $url, "width" => "99%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total, 'columns' => array(array("name" => _tr("DID")), array("name" => _tr("Organization Domain")), array("name" => _tr("Type")), array("name" => _tr("Country")), array("name" => _tr("Country Code / Area Code"))));
$arrData = array();
$arrDID = array();
if ($total != 0) {
$arrDID = $pDID->getDIDs($domain, $did_number, $country, $status, $limit, $offset);
}
if ($arrDID === false) {
$error = _tr("Error to obtain DID") . $pDID->errMsg;
$arrData = array();
} else {
//si es un usuario solo se ve su didsion
//si es un administrador ve todas las didsiones
foreach ($arrDID as $did) {
$arrTmp[0] = " <a href='?menu=did&action=view&id_did=" . $did['id'] . "'>" . $did['did'] . "</a>";
$arrTmp[1] = $did["organization_domain"];
$arrTmp[2] = $did["type"];
$arrTmp[3] = $did["country"];
$arrTmp[4] = $did["country_code"] . " / " . $did["area_code"];
$arrData[] = $arrTmp;
}
}
if (in_array('create', $arrPermission)) {
$oGrid->addNew("create_did", _tr("New DID"));
}
$_POST["did_number"] = $did_number;
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("DID Number") . " = " . $did_number, $_POST, array("did_number" => ""));
$arrStatus = array("all" => _tr('All'), "free" => _tr("No Assigned"), "busy" => _tr('Assigned'));
$_POST["status"] = $status;
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Status") . " = " . $arrStatus[$status], $_POST, array("status" => _tr("all")), true);
$_POST["country"] = $country;
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Country") . " = " . $country, $_POST, array("country" => ""));
$arrOrgz = array("all" => _tr("all"));
foreach ($pORGZ->getOrganization(array()) as $value) {
$arrOrgz[$value["domain"]] = $value["name"];
}
$_POST["organization"] = $domain;
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization") . " = " . $arrOrgz[$domain], $_POST, array("organization" => "all"), true);
//organization
$smarty->assign("SEARCH", "<input type='submit' class='button' value='" . _tr('Search') . "' name='search'>");
$arrFormElements = createFieldFilter($arrOrgz, $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);
}
$content = $oGrid->fetchGrid($arrGrid, $arrData);
return $content;
}
示例11: reportBillingRates
function reportBillingRates($smarty, $module_name, $local_templates_dir, &$pDB, &$pDB2, &$pDB3, $arrConf, $arrLang)
{
$pBillingRates = new paloSantoBillingRates($pDB);
$action = getParameter("nav");
$start = getParameter("start");
$as_csv = getParameter("exportcsv");
$arrResult = "";
$arrColumns = "";
//obtain parameters from new rates
$prefix_new = getParameter("Prefix");
$name_new = getParameter("Name");
$rate_new = getParameter("Rate");
$rate_offset_new = getParameter("Rate_offset");
$trunk_new = getParameter("Trunk");
$hidden_digits = getParameter("Hidden_Digits");
$id = getParameter("id");
//exists Default rate in rate.db // actualizar los rates por defecto en settings
$cant = $pBillingRates->contRates();
if (isset($cant['cant']) & $cant['cant'] < 1) {
$pBillingRates->existsDefaultRate($pDB3);
}
$action = getAction();
//begin grid parameters
$oGrid = new paloSantoGrid($smarty);
$totalBillingRates = $pBillingRates->getNumBillingRates();
$url = array('menu' => $module_name);
//$oGrid->enableExport(); // enable csv export.
$oGrid->pagingShow(true);
// show paging section.
$oGrid->setTitle(_tr("Billing Rates"));
$oGrid->setIcon("modules/{$module_name}/images/reports_billing_rates.png");
$oGrid->setNameFile_Export("Billing_Rates");
$oGrid->setURL($url);
$oGrid->addNew("new_rate", _tr("create_rate"));
$smarty->assign("module_name", $module_name);
$arrData = null;
if ($oGrid->isExportAction()) {
$limit = $totalBillingRates;
$offset = 0;
$arrResult = $pBillingRates->getBillingRates($limit, $offset);
if (is_array($arrResult) && $totalBillingRates > 0) {
foreach ($arrResult as $key => $value) {
$arrTmp[0] = isset($value['prefix']) & $value['prefix'] != "" ? $value['prefix'] : "*";
$arrTmp[1] = isset($value['name']) & $value['name'] != "" ? $value['name'] : "-";
$arrTmp[2] = isset($value['rate']) & $value['rate'] != "" ? $value['rate'] : "-";
$arrTmp[3] = isset($value['rate_offset']) & $value['rate_offset'] != "" ? $value['rate_offset'] : "-";
$arrTmp[4] = isset($value['hided_digits']) & $value['hided_digits'] != "" ? $value['hided_digits'] : "-";
$arrTmp[5] = isset($value['trunk']) & $value['trunk'] != "" ? $value['trunk'] : "*";
$arrTmp[6] = isset($value['fecha_creacion']) & $value['fecha_creacion'] != "" ? $value['fecha_creacion'] : "-";
$arrData[] = $arrTmp;
}
}
$arrColumns = array(_tr("Prefix"), _tr("Name"), _tr("Rate"), _tr("Rate Offset"), _tr("Hidden_Digits"), _tr("Trunk"), _tr("Creation Date"));
} else {
$limit = 20;
$oGrid->setLimit($limit);
$oGrid->setTotal($totalBillingRates);
$offset = $oGrid->calculateOffset();
$arrResult = $pBillingRates->getBillingRates($limit, $offset);
if (is_array($arrResult) && $totalBillingRates > 0) {
foreach ($arrResult as $key => $value) {
if ($value['name'] == "Default") {
$default = $arrLang['Default'];
$arrTmp[0] = "<font color='green'>*</font>";
$arrTmp[1] = "<font color='green'>" . $default . "</font>";
$arrTmp[2] = "<font color='green'>" . $value['rate'] . "</font>";
$arrTmp[3] = "<font color='green'>" . $value['rate_offset'] . "</font>";
$arrTmp[4] = "<font color='green'>" . $value['hided_digits'] . "</font>";
$arrTmp[5] = "<font color='green'>*</font>";
$arrTmp[6] = "<font color='green'>" . $value['fecha_creacion'] . "</font>";
$arrTmp[7] = "<a href='?menu={$module_name}&action=view&id=" . $value['id'] . "'>" . _tr("View") . "</a>";
} else {
$arrTmp[0] = $value['prefix'];
$arrTmp[1] = $value['name'];
$arrTmp[2] = $value['rate'];
$arrTmp[3] = $value['rate_offset'];
$arrTmp[4] = $value['hided_digits'];
$arrTmp[5] = $value['trunk'];
$arrTmp[6] = $value['fecha_creacion'];
$arrTmp[7] = "<a href='?menu={$module_name}&action=view&id=" . $value['id'] . "'>" . _tr("View") . "</a>";
}
$arrData[] = $arrTmp;
}
}
// arreglo de columnas
$arrColumns = array(_tr("Prefix"), _tr("Name"), _tr("Rate"), _tr("Rate Offset"), _tr("Hidden_Digits"), _tr("Trunk"), _tr("Creation Date"), _tr("View"));
}
$oGrid->setColumns($arrColumns);
$oGrid->setData($arrData);
//begin section filter
$arrFormFilterBillingRates = createFieldFilter($arrLang);
$oFilterForm = new paloForm($smarty, $arrFormFilterBillingRates);
$smarty->assign("import_rate", _tr("import_rate"));
$smarty->assign("by_min", _tr("by_min"));
$smarty->assign("Date_close", _tr("Date close"));
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
//end section filter
$oGrid->customAction("import_rate", _tr("import_rate"));
$content = $oGrid->fetchGrid();
return $content;
//.........这里部分代码省略.........
示例12: reportRecording
function reportRecording($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials)
{
global $arrPermission;
$error = "";
$pORGZ = new paloSantoOrganization($pDB);
$name = getParameter("name");
if ($credentials['userlevel'] == 'superadmin') {
$domain = getParameter('organization');
$domain = empty($domain) ? 'all' : $domain;
$arrOrgz = array("all" => _tr("all"));
foreach ($pORGZ->getOrganization(array()) as $value) {
$arrOrgz[$value["domain"]] = $value["name"];
}
} else {
$arrOrgz = array();
$domain = $credentials['domain'];
}
$url['menu'] = $module_name;
$url['organization'] = $domain;
$url['name'] = $name;
$pRecording = new paloSantoRecordings($pDB);
$total = $pRecording->getNumRecording($domain, $name);
if ($total === false) {
$error = $pRecording->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;
//permission
$create = in_array("create", $arrPermission);
$edit = in_array("edit", $arrPermission);
$delete = in_array("delete", $arrPermission);
if ($delete) {
$check = " <input type='checkbox' name='checkall' class='checkall' id='checkall' onclick='jqCheckAll(this.id);' />";
} else {
$check = "";
}
$oGrid->setTitle(_tr('Recordings 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);
$arrColumns[] = $check;
if ($credentials['userlevel'] == 'superadmin') {
$arrColumns[] = _tr("Organization");
}
$arrColumns[] = _tr("Name");
//$arrColumns[]=_tr("Source");
$arrColumns[] = _tr("");
$oGrid->setColumns($arrColumns);
$arrRecordings = array();
$arrData = array();
if ($total != 0) {
$arrRecordings = $pRecording->getRecordings($domain, $name, $limit, $offset);
}
if ($arrRecordings === false) {
$error = _tr("Error to obtain Recordings") . $pRecording->errMsg;
$arrRecordings = array();
}
$i = 0;
foreach ($arrRecordings as $recording) {
$arrTmp = array();
$ext = explode(".", $recording["name"]);
if ($delete) {
$arrTmp[] = " <input type ='checkbox' class='delete' name='record_delete[]' value='" . $recording['uniqueid'] . "' />";
}
if ($credentials['userlevel'] == 'superadmin') {
$arrTmp[] = $recording["organization_domain"] == '' ? '' : $arrOrgz[$recording["organization_domain"]];
}
//$arrTmp[] = $recording["source"];
$idfile = $recording['uniqueid'];
if ($ext[1] == "gsm") {
$div_display = '';
} else {
$div_display = "<div class='single' id='{$i}' style='display:inline;'><span data-src='index.php?menu={$module_name}&action=download&id={$idfile}&rawmode=yes'><img style='cursor:pointer;' width='13px' src='web/apps/recordings/images/sound.png'/> </span></div>";
}
$download = "<a href='index.php?menu={$module_name}&action=download&id={$idfile}&rawmode=yes'>" . $recording['name'] . "</a>";
$arrTmp[] = $div_display . $download;
$arrTmp[] = "<audio></audio>";
$i++;
$arrData[] = $arrTmp;
}
$smarty->assign("USERLEVEL", $credentials['userlevel']);
$smarty->assign("SEARCH", "<input type='submit' class='button' value='" . _tr('Search') . "' name='report'>");
if ($create) {
$oGrid->addNew("add_recording", _tr("Add Recording"));
}
if ($delete) {
$oGrid->deleteList(_tr("Are you sure you want to delete?"), "remove", _tr("Delete Selected"), false);
}
if ($error != "") {
$smarty->assign("mb_title", _tr("MESSAGE"));
$smarty->assign("mb_message", $error);
}
//.........这里部分代码省略.........
示例13: reportConference
//.........这里部分代码省略.........
$session = getSession();
if ($arrconference === false) {
$error = _tr("Error getting conference data.") . $pconference->errMsg;
} else {
foreach ($arrconference as $conf) {
$arrTmp = array();
if ($delete) {
$arrTmp[] = "<input type='checkbox' name='confdel[]' value='{$conf['bookid']}'/>";
//delete
}
if ($edit) {
$arrTmp[] = "<a href='?menu={$module_name}&action=view&id_conf={$conf['bookid']}&organization={$conf['organization_domain']}'>" . htmlentities($conf["name"], ENT_QUOTES, "UTF-8") . "</a>";
//name
} else {
$arrTmp[] = htmlentities($conf["name"], ENT_QUOTES, "UTF-8");
}
$arrTmp[] = $conf["ext_conf"];
//roomnumber
$perid = "No Set";
if (!empty($conf["startTime"]) && $conf["startTime"] != "1900-01-01 12:00:00") {
$perid = $conf["startTime"] . " - " . $conf["endtime"];
}
$arrTmp[] = $perid;
//period
$max = empty($conf["maxusers"]) ? "unlimited" : $conf["maxusers"];
$participants = "<spam class='conf_memb' id='{$conf['bookid']}'>" . $conf["members"] . " / {$max} </spam>";
$status = "<spam class='conf_status'></spam>";
if ($perid != "No Set") {
$date = time();
if ($date >= strtotime($conf["startTime"]) && $date <= strtotime($conf["endtime"])) {
if ($invite_part) {
$participants = "<a href='?menu={$module_name}&action=current_conf&id_conf={$conf['bookid']}&organization={$conf['organization_domain']}' class='conf_memb' id='{$conf['bookid']}'>" . $conf["members"] . " / {$max}</a>";
}
$status = "<spam class='conf_status' style='color:green'/>" . _tr("In Progress") . "</spam>";
} else {
if ($date < strtotime($conf["startTime"])) {
$status = "<spam class='conf_status'>" . _tr("Future") . "</spam>";
} else {
$status = "<spam class='conf_status'>" . _tr("Past") . "</spam>";
}
}
} else {
if ($invite_part) {
$participants = "<a href='?menu={$module_name}&action=current_conf&id_conf={$conf['bookid']}&organization={$conf['organization_domain']}' class='conf_memb' id='{$conf['bookid']}'>" . $conf["members"] . " / {$max}</a>";
}
}
$arrTmp[] = $participants;
$arrTmp[] = $status;
$arrData[] = $arrTmp;
//se usa para comprobar si ha habido cambios en el estado de las conferencias
$session['conference']["conf_list"][$conf['bookid']] = array($participants, $status);
}
}
//se escribe en session el estado actual de las conferencias
putSession($session);
//filters
$smarty->assign("USERLEVEL", $credentials['userlevel']);
$smarty->assign("SEARCH", "<input type='submit' class='button' value='" . _tr('Search') . "' name='report'>");
if ($pORGZ->getNumOrganization(array()) >= 1) {
if ($create) {
if ($credentials['userlevel'] == 'superadmin') {
$oGrid->addComboAction("organization_add", _tr("ADD Conference"), array_slice($arrOrgz, 1), $selected = null, "create_conference", $onchange_select = null);
} else {
$oGrid->addNew("create_conference", _tr("ADD Conference"));
}
}
if ($delete) {
$oGrid->deleteList(_tr("Are you sure you wish to delete conference (es)?"), "delete_conference", _tr("Delete"));
}
if ($credentials['userlevel'] == 'superadmin') {
$_POST["organization"] = $domain;
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization") . " = " . $arrOrgz[$domain], $_POST, array("organization" => "all"), true);
}
//arreglo usado para formar los elementos del filtro
$arrState = array("all" => _tr("All"), "past" => _tr("Past Conference"), "current" => _tr("Current Conference"), "future" => _tr("Future Conference"));
$arrType = array("both" => _tr("Both"), "yes" => _tr("Schedule"), "no" => _tr("No Schedule"));
$oGrid->addFilterControl(_tr("Filter applied: ") . _tr("State") . " = " . $arrState[$state_conf], $state_conf, array("state_conf" => "all"), true);
$oGrid->addFilterControl(_tr("Filter applied: ") . _tr("Name") . " = " . $name_conf, $name_conf, array("name_conf" => ""));
$oGrid->addFilterControl(_tr("Filter applied: ") . _tr("Type") . " = " . $arrType[$type_conf], $type_conf, array("type_conf" => "both"), true);
$smarty->assign("SHOW", _tr("Show"));
$arrFormElements = createFieldFilter($arrState, $arrType, $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);
$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='report'>";
$mensaje = showMessageReload($module_name, $pDB, $credentials);
$contenidoModulo = $mensaje . $contenidoModulo;
return $contenidoModulo;
}
示例14: viewFormDomain
function viewFormDomain($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $arrLang)
{
$pEmail = new paloEmail($pDB);
$oGrid = new paloSantoGrid($smarty);
$arrDomains = $pEmail->getDomains();
$end = count($arrDomains);
$arrData = array();
$oGrid->pagingShow(true);
$url = array("menu" => $module_name);
$oGrid->setURL($url);
$oGrid->setTitle(_tr("Domain List"));
$oGrid->setIcon("modules/{$module_name}/images/email_domains.png");
$arrColumns = array(_tr("Domain"), _tr("Number of Accounts"));
$oGrid->setColumns($arrColumns);
$total = 0;
$limit = 20;
$limitInferior = "";
$limitSuperior = "";
$oGrid->setLimit($limit);
$oGrid->addNew("submit_create_domain", _tr('Create Domain'));
if (is_array($arrDomains) && $end > 0) {
$oGrid->setTotal($end);
$offset = $oGrid->calculateOffset();
$cont = 0;
$limitInferior = $offset;
$limitSuperior = $offset + $limit - 1;
foreach ($arrDomains as $domain) {
$arrTmp = array();
if ($cont > $limitSuperior) {
break;
}
if ($cont >= $limitInferior & $cont <= $limitSuperior) {
$arrTmp[0] = " <a href='?menu=email_domains&action=view&id=" . $domain[0] . "'>{$domain['1']}</a>";
//obtener el numero de cuentas que posee ese email
$arrTmp[1] = $pEmail->getNumberOfAccounts($domain[0]);
$arrData[] = $arrTmp;
}
$cont++;
}
} else {
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
}
$oGrid->setData($arrData);
$content = $oGrid->fetchGrid();
return $content;
}
示例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;
}