function getLinesVegaForm($smarty, $module_name, $local_templates_dir, $dsnAsterisk, $dsnSqlite, $arrConf, $validationError) { $paloEndPoint = new paloSantoEndPoint($dsnAsterisk, $dsnSqlite); $arrSession = getSession(); $mac = $arrSession["endpoint_configurator"]["mac"]; if (!$validationError) { $arrParameters = $paloEndPoint->getEndpointParameters($mac); if ($arrParameters === false) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("In the query to database endpoint.db")); return endpointConfiguratedShow($smarty, $module_name, $local_templates_dir, $dsnAsterisk, $dsnSqlite, $arrConf); } $_DATA = array(); foreach ($arrParameters as $key => $parameter) { $_DATA[$parameter["name"]] = $parameter["value"]; } $_DATA = array_merge($_DATA, $_POST); for ($i = 0; $i < $arrSession["endpoint_configurator"]["analog_extension_lines"]; $i++) { if (getParameter("user{$i}") == "" || getParameter("authentication_user{$i}") == "") { $smarty->assign("mb_title", _tr("Validation Error")); $smarty->assign("mb_message", _tr("Fields User and Authentication User can not be empty")); return getExtensionsVegaForm($smarty, $module_name, $local_templates_dir, $dsnAsterisk, $dsnSqlite, $arrConf, true); } else { $arrSession["endpoint_configurator"]["user_name{$i}"] = getParameter("user_name{$i}"); $arrSession["endpoint_configurator"]["user{$i}"] = getParameter("user{$i}"); $arrSession["endpoint_configurator"]["authentication_user{$i}"] = getParameter("authentication_user{$i}"); $arrSession["endpoint_configurator"]["call_conference{$i}"] = getParameter("call_conference{$i}"); $arrSession["endpoint_configurator"]["call_transfer{$i}"] = getParameter("call_transfer{$i}"); $arrSession["endpoint_configurator"]["call_waiting{$i}"] = getParameter("call_waiting{$i}"); $arrSession["endpoint_configurator"]["caller_id{$i}"] = getParameter("caller_id{$i}"); $arrSession["endpoint_configurator"]["call_dnd{$i}"] = getParameter("call_dnd{$i}"); if (getParameter("enable{$i}")) { $arrSession["endpoint_configurator"]["enable{$i}"] = 1; } else { $arrSession["endpoint_configurator"]["enable{$i}"] = 0; } } } putSession($arrSession); } else { $_DATA = $_POST; } if ($arrSession["endpoint_configurator"]["analog_trunk_lines"] > 0) { $smarty->assign("REQUIRED_FIELD", _tr("Required field")); $smarty->assign("CANCEL", _tr("Cancel")); $smarty->assign("SAVE", _tr("Save")); $smarty->assign("RETURN", _tr("Return")); $smarty->assign("IMG", "/modules/{$module_name}/images/sangoma.gif"); if ($arrSession["endpoint_configurator"]["analog_extension_lines"] > 0) { $smarty->assign("RETURN2_VEGA", "return2_vega"); } else { $smarty->assign("RETURN2_VEGA", "return1_vega"); } $fields = ""; $fields .= "<tr align='center' style='font-size:13px; font-weight:bold;'><td>" . _tr("Port ID") . "</td><td>" . _tr("Enable") . "<br><input type='checkbox' name='checkall' class='checkall'/> </td><td>" . _tr("Interface") . "</td><td>" . _tr("DN") . "</td><td>" . _tr("Username") . "</td><td>" . _tr("Telephone number(s) to route to the FXO interface") . "</td></tr>"; $model = $arrSession["endpoint_model"][$arrSession["endpoint_configurator"]["mac"]]; $title = _tr("Lines Configuration for Vega (FXO)"); for ($i = 0; $i < $arrSession["endpoint_configurator"]["analog_trunk_lines"]; $i++) { $number = $i + 1; $nport = $arrSession["endpoint_configurator"]["analog_extension_lines"] + $number; if (!isset($_DATA["line{$i}"])) { $_DATA["line{$i}"] = 1000 + $i; } if (!isset($_DATA["ID{$i}"])) { $_DATA["ID{$i}"] = 1000 + $i; } if (!isset($_DATA["authentication_ID{$i}"])) { $_DATA["authentication_ID{$i}"] = "FXO{$nport}"; } if (isset($_DATA["enable_line{$i}"]) && $_DATA["enable_line{$i}"] == 1) { $check = "checked=checked"; } else { $check = ""; } $fields .= "<tr class='letra12' align='center'>\n <td><b>{$nport}:</b></td>\n <td class='enable'><input type='checkbox'name='enable_line{$i}' {$check}/></td>\n <td width='25%'><input type='text' maxlength='100' style='width: 100px;' value='" . $_DATA["line{$i}"] . "' name='line{$i}'></td>\n <td><input type='text' maxlength='100' style='width: 100px;' value='" . $_DATA["ID{$i}"] . "' name='ID{$i}'></td>\n <td><input type='text' maxlength='100' style='width: 100px;' value='" . $_DATA["authentication_ID{$i}"] . "' name='authentication_ID{$i}'></td>\n <td><input type='text' maxlength='200' style='width: 200px;' value='" . $_DATA["num_list{$i}"] . "' name='num_list{$i}'></td>\n </tr>"; /* Telephone number(s) to route to the FXO interface $fields .= "<tr class='letra12'> <td><b>$nport:</b> <span class='required'>*</span></td> <td><input type='checkbox'name='enable_line$i'/></td> <td width='25%'><input type='text' maxlength='100' style='width: 200px;' value='' name='line$i'></td> <td><b>ID $number: <span class='required'>*</span></b></td> <td><input type='text' maxlength='100' style='width: 200px;' value='' name='ID$i'></td> <td><b>"._tr("Authentication ID")."$number:</b> <span class='required'>*</span></td> <td><input type='text' maxlength='100' style='width: 200px;' value='' name='authentication_ID$i'></td> </tr>";*/ } $smarty->assign("fields", $fields); $oForm = new paloForm($smarty, array()); $htmlForm = $oForm->fetchForm("{$local_templates_dir}/vega_lines.tpl", $title, $_DATA); $content = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; } else { $content = savePatton($smarty, $module_name, $local_templates_dir, $dsnAsterisk, $dsnSqlite, $arrConf); } return $content; }