本文整理汇总了PHP中paloSantoGrid::customAction方法的典型用法代码示例。如果您正苦于以下问题:PHP paloSantoGrid::customAction方法的具体用法?PHP paloSantoGrid::customAction怎么用?PHP paloSantoGrid::customAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paloSantoGrid
的用法示例。
在下文中一共展示了paloSantoGrid::customAction方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _moduleContent
//.........这里部分代码省略.........
$arrDefaultRate['default_rate'] = get_key_settings($pDBSetting, "default_rate");
$arrDefaultRate['default_rate_offset'] = get_key_settings($pDBSetting, "default_rate_offset");
$smarty->assign("EDIT", $arrLang["Edit"]);
$smarty->assign("REQUIRED_FIELD", $arrLang["Required field"]);
$strReturn = $oForm->fetchForm("{$local_templates_dir}/default_rate.tpl", $arrLang["Default Rate Configuration"], $arrDefaultRate);
if (isset($_POST['edit_default'])) {
$arrDefaultRate['default_rate'] = get_key_settings($pDBSetting, "default_rate");
$arrDefaultRate['default_rate_offset'] = get_key_settings($pDBSetting, "default_rate_offset");
$oForm = new paloForm($smarty, $arrForm);
$smarty->assign("CANCEL", $arrLang["Cancel"]);
$smarty->assign("SAVE", $arrLang["Save"]);
$smarty->assign("REQUIRED_FIELD", $arrLang["Required field"]);
$strReturn = $oForm->fetchForm("{$local_templates_dir}/default_rate.tpl", $arrLang["Default Rate Configuration"], $arrDefaultRate);
} else {
if (isset($_POST['save_default'])) {
$oForm = new paloForm($smarty, $arrForm);
$arrDefaultRate['default_rate'] = $_POST['default_rate'];
$arrDefaultRate['default_rate_offset'] = $_POST['default_rate_offset'];
if ($oForm->validateForm($_POST)) {
$bValido = set_key_settings($pDBSetting, 'default_rate', $arrDefaultRate['default_rate']);
$bValido = set_key_settings($pDBSetting, 'default_rate_offset', $arrDefaultRate['default_rate_offset']);
if (!$bValido) {
echo $arrLang["Error when saving default rate"];
} else {
header("Location: index.php?menu=billing_setup");
}
} else {
// Error
$smarty->assign("mb_title", $arrLang["Validation Error"]);
$smarty->assign("mb_message", $arrLang["Value for rate is not valid"]);
$smarty->assign("CANCEL", $arrLang["Cancel"]);
$smarty->assign("SAVE", $arrLang["Save"]);
$smarty->assign("REQUIRED_FIELD", $arrLang["Required field"]);
$strReturn = $oForm->fetchForm("{$local_templates_dir}/default_rate.tpl", $arrLang["Default Rate Configuration"], $arrDefaultRate);
}
}
}
$arrTrunks = array();
$arrData = array();
$arrTrunksBill = array();
//obtener todos los trunks
$oTrunk = new paloTrunk($pDBTrunk);
//obtener todos los trunks que son para billing
//$arrTrunksBill=array("DAHDI/g0","DAHDI/g1");
getTrunksBillFiltrado($pDB, $oTrunk, $arrConfig, $arrTrunks, $arrTrunksBill);
if (isset($_POST['submit_bill_trunks'])) {
//obtengo las que estan guardadas y las que ahora no estan
$selectedTrunks = isset($_POST['trunksBills']) ? array_keys($_POST['trunksBills']) : array();
if (count($selectedTrunks) > 0) {
foreach ($selectedTrunks as $selectedTrunk) {
$nuevaListaTrunks[] = base64_decode($selectedTrunk);
}
} else {
$nuevaListaTrunks = array();
}
$listaTrunksNuevos = array_diff($nuevaListaTrunks, $arrTrunksBill);
$listaTrunksAusentes = array_diff($arrTrunksBill, $nuevaListaTrunks);
//tengo que borrar los trunks ausentes
//tengo que agregar los trunks nuevos
// print_r($listaTrunksNuevos);
//print_r($listaTrunksAusentes);
if (count($listaTrunksAusentes) > 0) {
$bExito = $oTrunk->deleteTrunksBill($listaTrunksAusentes);
if (!$bExito) {
$msgError = $oTrunk->errMsg;
}
}
if (count($listaTrunksNuevos) > 0) {
$bExito = $oTrunk->saveTrunksBill($listaTrunksNuevos);
if (!$bExito) {
$msgError .= $oTrunk->errMsg;
}
}
if (!empty($msgError)) {
$smarty->assign("mb_message", $msgError);
}
}
getTrunksBillFiltrado($pDB, $oTrunk, $arrConfig, $arrTrunks, $arrTrunksBill);
$end = count($arrTrunks);
if (is_array($arrTrunks)) {
foreach ($arrTrunks as $trunk) {
$arrTmp = array();
$checked = in_array($trunk[1], $arrTrunksBill) ? "checked" : "";
$arrTmp[0] = "<input type='checkbox' name='trunksBills[" . base64_encode($trunk[1]) . "]' {$checked}>";
$arrTmp[1] = $trunk[1];
$arrData[] = $arrTmp;
}
}
$arrGrid = array("title" => $arrLang["Trunk Bill Configuration"], "icon" => "/modules/{$module_name}/images/reports_billing_setup.png", "width" => "99%", "start" => $end == 0 ? 0 : 1, "end" => $end, "total" => $end, "columns" => array(0 => array("name" => "", "property1" => ""), 1 => array("name" => $arrLang["Trunk"], "property1" => "")));
$oGrid = new paloSantoGrid($smarty);
$oGrid->pagingShow(false);
$oGrid->customAction('submit_bill_trunks', _tr('Billing Capable'));
$trunk_config = $oGrid->fetchGrid($arrGrid, $arrData, $arrLang);
if (strpos($trunk_config, '<form') === FALSE) {
$trunk_config = "<form style='margin-bottom:0;' method='POST' action='?menu=billing_setup'>{$trunk_config}</form>";
}
//mostrar los dos formularios
$contenido .= $strReturn . $trunk_config;
return $contenido;
}
示例2: 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;
}
示例3: 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;
}
示例4: listRepositories
function listRepositories($smarty, $module_name, $local_templates_dir, $arrConf)
{
global $arrLang;
$oRepositories = new PaloSantoRepositories();
$arrReposActivos = array();
$typeRepository = getParameter("typeRepository");
if (isset($_POST['submit_aceptar'])) {
foreach ($_POST as $key => $value) {
if (substr($key, 0, 5) == 'repo-') {
$arrReposActivos[] = substr($key, 5);
}
}
$oRepositories->setRepositorios($arrConf['ruta_repos'], $arrReposActivos, $typeRepository, $arrConf["main_repos"]);
}
$option["main"] = "";
$option["others"] = "";
$option["all"] = "";
$arrRepositorios = $oRepositories->getRepositorios($arrConf['ruta_repos'], $typeRepository, $arrConf["main_repos"]);
$limit = 40;
$total = count($arrRepositorios);
$oGrid = new paloSantoGrid($smarty);
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$offset = $oGrid->calculateOffset();
$end = $oGrid->getEnd();
$arrData = array();
$version = $oRepositories->obtenerVersionDistro();
$arch = $oRepositories->obtenerArquitectura();
// print($arch);
if (is_array($arrRepositorios)) {
for ($i = $offset; $i < $end; $i++) {
$activo = "";
if ($arrRepositorios[$i]['activo']) {
$activo = "checked='checked'";
}
$arrData[] = array("<input {$activo} name='repo-" . $arrRepositorios[$i]['id'] . "' type='checkbox' id='repo-{$i}' />", $valor = str_replace(array("\$releasever", "\$basearch"), array($version, $arch), $arrRepositorios[$i]['name']));
}
}
if (isset($typeRepository)) {
$oGrid->setURL("?menu={$module_name}&typeRepository={$typeRepository}");
$_POST["typeRepository"] = $typeRepository;
} else {
$oGrid->setURL("?menu={$module_name}");
$_POST["typeRepository"] = "main";
}
$arrGrid = array("title" => $arrLang["Repositories"], "icon" => "modules/repositories/images/system_updates_repositories.png", "width" => "99%", "start" => $total == 0 ? 0 : $offset + 1, "end" => $end, "total" => $total, "columns" => array(0 => array("name" => $arrLang["Active"], "property1" => ""), 1 => array("name" => $arrLang["Name"], "property1" => "")));
$oGrid->customAction('submit_aceptar', _tr('Save/Update'));
$oGrid->addButtonAction("default", _tr('Default'), null, "defaultValues({$total},'{$version}','{$arch}')");
$FilterForm = new paloForm($smarty, createFilter());
$arrOpt = array("main" => _tr('Main'), "others" => _tr('Others'), "all" => _tr('All'));
if (isset($arrOpt[$typeRepository])) {
$valorfiltro = $arrOpt[$typeRepository];
} else {
$valorfiltro = _tr('Main');
}
$oGrid->addFilterControl(_tr("Filter applied ") . _tr("Repo") . " = " . $valorfiltro, $_POST, array("typeRepository" => "main"), true);
$htmlFilter = $FilterForm->fetchForm("{$local_templates_dir}/new.tpl", "", $_POST);
$oGrid->showFilter($htmlFilter);
$contenidoModulo = $oGrid->fetchGrid($arrGrid, $arrData, $arrLang);
return $contenidoModulo;
}
示例5: reportRules
//.........这里部分代码省略.........
}
$arrTmp[3] = "<a><img src='{$image}' border=0 title='" . _tr($title) . "'</a>";
$arrTmp[5] = $value['ip_source'];
$arrTmp[6] = $value['ip_destiny'];
$arrTmp[7] = $value['protocol'];
if ($value['protocol'] == "ICMP") {
if ($value["icmp_type"] != "" && $value["icmp_type"] != "ANY") {
$protocolName = $pRules->getProtocolName($value["icmp_type"]);
} else {
$protocolName = $value["icmp_type"];
}
$arrTmp[8] = _tr("Type") . ": {$protocolName}";
} else {
if ($value['protocol'] == "IP") {
if ($value["number_ip"] != "" && $value["number_ip"] != "ANY") {
$protocolName = $pRules->getProtocolName($value["number_ip"]);
} else {
$protocolName = $value["number_ip"];
}
$arrTmp[8] = _tr("Number Protocol IP") . ": {$protocolName}";
} else {
if ($value['protocol'] == "TCP" || $value['protocol'] == "UDP") {
if ($value["sport"] != "" && $value["sport"] != "ANY") {
$sportName = $pRules->getProtocolName($value["sport"]);
} else {
$sportName = $value["sport"];
}
if ($value["dport"] != "" && $value["dport"] != "ANY") {
$dportName = $pRules->getProtocolName($value["dport"]);
} else {
$dportName = $value["dport"];
}
$arrTmp[8] = _tr("Source Port") . ": {$sportName}" . "<br />" . _tr("Destiny Port") . ": {$dportName}";
} else {
if ($value['protocol'] == "STATE") {
$arrTmp[8] = $value['state'];
} else {
$arrTmp[8] = "";
}
}
}
}
if (!$first_time) {
if ($value['activated'] == 1) {
$image = "modules/{$module_name}/images/foco_on.gif";
$activated = "Desactivate";
} else {
$image = "modules/{$module_name}/images/foco_off.gif";
$activated = "Activate";
}
if ($offset != 0) {
$arrTmp[9] = "<a href='?menu={$module_name}&action=" . $activated . "&id=" . $value['id'] . "&nav=next&start={$start}'>" . "<img src='{$image}' border=0 title='" . _tr($activated) . "'</a>";
} else {
$arrTmp[9] = "<a href='?menu={$module_name}&action=" . $activated . "&id=" . $value['id'] . "'>" . "<img src='{$image}' border=0 title='" . _tr($activated) . "'</a>";
}
$arrTmp[10] = "<a href='?menu={$module_name}&action=edit&id=" . $value['id'] . "'>" . "<img src='modules/{$module_name}/images/edit.gif' border=0 title='" . _tr('Edit') . "'</a>";
}
$arrData[] = $arrTmp;
}
// $arrData[] = array("ctrl" => "separator_line", "start" => 0);
}
$oGrid->setData($arrData);
//$smarty->assign("desactivate", _tr("Desactivate FireWall"));
if ($first_time) {
$smarty->assign("mb_message", "<b>" . _tr("The firewall is totally desactivated. It is recommended to activate the firewall rules") . "</b>");
$smarty->assign("mb_title", _tr("WARNING"));
$mensaje = _tr("The firewall is totally desactivated. It is recommended to activate the firewall rules");
$mensaje2 = _tr("Activate FireWall");
$oGrid->customAction("exec", $mensaje2);
} else {
$oGrid->customAction("desactivate", _tr("Desactivate FireWall"));
$oGrid->addNew("new", _tr("New Rule"));
$mensaje = _tr("You have made changes to the definition of firewall rules, for this to take effect in the system press the next button");
$mensaje2 = _tr("Save Changes");
}
if ($pRules->isExecutedInSystem()) {
$smarty->assign("BORDER", "");
$smarty->assign("DISPLAY", "display:none;");
} else {
$smarty->assign("executed_in_sys", $mensaje);
$smarty->assign("BORDER", "border:1px solid; color:#AAAAAA");
$smarty->assign("DISPLAY", "");
}
$smarty->assign("exec", $mensaje2);
if (!$first_time) {
if (!$pRules->isExecutedInSystem()) {
$smarty->assign("mb_title", _tr("MESSAGE"));
$smarty->assign("mb_message", $mensaje . " <form method='POST' style='margin-bottom:0;' action='?menu_sec_rules'><input class='button' type='submit' name='exec' value='{$mensaje2}'></form>");
}
}
$contenidoModulo = $oGrid->fetchGrid();
if ($arrConf["mainTheme"] == "elastixneo") {
$contenidoModulo = "<div id='msg_status' class='mensajeStatus'></div>" . $contenidoModulo;
}
if (strpos($contenidoModulo, '<form') === FALSE) {
$contenidoModulo = "<form method='POST' style='margin-bottom:0;' action={$url}>{$contenidoModulo}</form>";
}
//end grid parameters
return $contenidoModulo;
}
示例6: showLanguages
function showLanguages($smarty, $module_name, $local_templates_dir, $arrLang, $arrLangModule)
{
//$oPaloSanto = new paloSantoLanguageAdmin();
$pLanguages = new paloSantoLanguageAdmin();
$arrFormElements = array("module" => array("LABEL" => $arrLangModule["Select Module"], "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $pLanguages->leer_directorio_modulos(), "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "language" => array("LABEL" => $arrLangModule["Select Language"], "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $pLanguages->leer_directorio_lenguajes(), "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""));
$oFilterForm = new paloForm($smarty, $arrFormElements);
$smarty->assign("SHOW", $arrLang["Show"]);
$smarty->assign("SAVE_ALL", "Save All");
$module = getParameter("module");
$language = getParameter("language");
$action = getParameter('nav');
$start = getParameter('start');
$smarty->assign("start_value", $start);
$smarty->assign("nav_value", $action);
$_POST["module"] = $module;
$_POST["language"] = $language;
$oGrid = new paloSantoGrid($smarty);
if (!is_null($module) && !is_null($language)) {
$nameModule = $arrFormElements["module"]["INPUT_EXTRA_PARAM"][$module];
$valueLanguage = $arrFormElements["language"]["INPUT_EXTRA_PARAM"][$language];
} else {
$nameModule = "";
$valueLanguage = "";
}
$oGrid->addFilterControl(_tr("Filter applied: ") . $nameModule . " = " . $valueLanguage, $_POST, array("module" => null, "language" => null));
$htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
//Paginacion
$limit = 20;
$total_datos = $pLanguages->ObtainNumLanguages($module, $language);
$total = $total_datos;
$oGrid->addNew("new", _tr("Add"));
$oGrid->customAction("save_all", _tr("Save All"));
$oGrid->setLimit($limit);
$oGrid->setTotal($total);
$oGrid->setTitle(_tr("Language Admin"));
$oGrid->setIcon("images/list.png");
$oGrid->pagingShow(true);
$offset = $oGrid->calculateOffset();
$url = "?menu={$module_name}&module={$module}&language={$language}";
$oGrid->setURL($url);
$arrColumns = array(_tr("Key"), _tr("Value"));
$oGrid->setColumns($arrColumns);
$arrLangMod = $pLanguages->obtainLanguages($limit, $offset, $module, $language);
$arrData = array();
$counter = 1;
if (is_array($arrLangMod) && count($arrLangMod) > 0) {
foreach ($arrLangMod as $key => $value) {
$tmpKey = htmlspecialchars($key);
$tmpValue = htmlspecialchars($value);
$arrTmp[0] = $tmpKey;
$arrTmp[1] = "<input class='table_data' style='width:450px' type='text' name=\"langvalue_{$counter}\" id=\"langvalue_{$counter}\" value=\"{$tmpValue}\" /><input type='hidden' name='langkey_{$counter}' id='langkey_{$counter}' value='{$tmpKey}'>";
$counter++;
$arrData[] = $arrTmp;
}
}
$oGrid->setData($arrData);
$oGrid->showFilter(trim($htmlFilter));
$moduleContent = $oGrid->fetchGrid();
if (strpos($moduleContent, '<form') === FALSE) {
$moduleContent = "<form method='POST' style='margin-bottom:0;' action={$url}>{$moduleContent}</form>";
}
return $moduleContent;
}
示例7: 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;
//.........这里部分代码省略.........
示例8: viewMemberList
function viewMemberList($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf)
{
$pEmailList = new paloSantoEmailList($pDB);
$id_list = getParameter("id");
if (!$pEmailList->listExistsbyId($id_list)) {
$smarty->assign("mb_title", _tr("Validation Error"));
$smarty->assign("mb_message", _tr("The List entered does not exist"));
return reportEmailList($smarty, $module_name, $local_templates_dir, $pDB, $arrConf);
}
$field_type = getParameter("filter_type");
$field_pattern = getParameter("filter_txt");
$smarty->assign("IDEMAILLIST", $id_list);
$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"));
$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("/modules/{$module_name}/images/email.png");
$oGrid->pagingShow(true);
$offset = $oGrid->calculateOffset();
$url = array('menu' => $module_name, 'action' => 'view_memberlist', 'id' => $id_list, 'filter_type' => $field_type, 'filter_txt' => $field_pattern);
$oGrid->setURL($url);
$arrColumns = array(_tr("Member name"), _tr("Member email"));
$oGrid->setColumns($arrColumns);
$arrResult = $pEmailList->getMembers($limit, $offset, $id_list, $field_type, $field_pattern);
$arrData = null;
if (is_array($arrResult) && $totalMembers > 0) {
foreach ($arrResult as $key => $value) {
$arrTmp[0] = $value["namemember"];
$arrTmp[1] = $value["mailmember"];
$arrData[] = $arrTmp;
}
}
$oGrid->setData($arrData);
$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"));
$oGrid->customAction("?menu={$module_name}&action=export&id={$id_list}&rawmode=yes", _tr("Export Members"), null, true);
//$arrFiltro = array("filter_type"=>$field_type,"filter_txt"=>$field_pattern);
$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();
if (strpos($content, '<form') === FALSE) {
$content = "<form method='POST' style='margin-bottom:0;' action=" . construirURL($url) . ">{$content}</form>";
}
return $content;
}