PPPOE Radius Plan
This commit is contained in:
parent
efc0ba93b6
commit
78cbb105aa
@ -105,25 +105,31 @@ class Radius
|
||||
public static function planUpdate($plan_id, $plan_name, $rate, $pool = null)
|
||||
{
|
||||
$rates = explode('/', $rate);
|
||||
$r = Radius::getTablePackage()->where_equal('plan_id', $plan_id)->whereEqual('attribute', 'Ascend-Data-Rate')->findOne();
|
||||
$r->groupname = $plan_name;
|
||||
$r->value = $rates[1];
|
||||
if ($r->save()) {
|
||||
$r = Radius::getTablePackage()->where_equal('plan_id', $plan_id)->whereEqual('attribute', 'Ascend-Xmit-Rate')->findOne();
|
||||
if(Radius::getTablePackage()->where_equal('plan_id', $plan_id)->find_one()){
|
||||
$r = Radius::getTablePackage()->where_equal('plan_id', $plan_id)->whereEqual('attribute', 'Ascend-Data-Rate')->findOne();
|
||||
$r->groupname = $plan_name;
|
||||
$r->value = $rates[0];
|
||||
$r->value = $rates[1];
|
||||
if ($r->save()) {
|
||||
if ($pool != null) {
|
||||
$r = Radius::getTablePackage()->where_equal('plan_id', $plan_id)->whereEqual('attribute', 'Framed-Pool')->findOne();
|
||||
$r->groupname = $plan_name;
|
||||
$r->value = $pool;
|
||||
if ($r->save()) {
|
||||
$r = Radius::getTablePackage()->where_equal('plan_id', $plan_id)->whereEqual('attribute', 'Ascend-Xmit-Rate')->findOne();
|
||||
$r->groupname = $plan_name;
|
||||
$r->value = $rates[0];
|
||||
if ($r->save()) {
|
||||
if ($pool != null) {
|
||||
$r = Radius::getTablePackage()->where_equal('plan_id', $plan_id)->whereEqual('attribute', 'Framed-Pool')->findOne();
|
||||
$r->groupname = $plan_name;
|
||||
$r->value = $pool;
|
||||
if ($r->save()) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(!empty($plan_id)){
|
||||
return Radius::planAdd($plan_id, $plan_name, $rate, $pool);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -28,9 +28,8 @@ switch ($action) {
|
||||
$log = '';
|
||||
$router = '';
|
||||
foreach ($plans as $plan) {
|
||||
if($plan['is_radius']){
|
||||
|
||||
}else{
|
||||
if ($plan['is_radius']) {
|
||||
} else {
|
||||
if ($router != $plan['routers']) {
|
||||
$mikrotik = Mikrotik::info($plan['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
@ -56,7 +55,7 @@ switch ($action) {
|
||||
}
|
||||
}
|
||||
r2(U . 'services/hotspot', 's', $log);
|
||||
}else if ($routes['2'] == 'pppoe') {
|
||||
} else if ($routes['2'] == 'pppoe') {
|
||||
$plans = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'PPPOE')->where('tbl_plans.enabled', '1')->find_many();
|
||||
$log = '';
|
||||
$router = '';
|
||||
@ -176,7 +175,7 @@ switch ($action) {
|
||||
if ($name == '' or $id_bw == '' or $price == '' or $validity == '') {
|
||||
$msg .= $_L['All_field_is_required'] . '<br>';
|
||||
}
|
||||
if(empty($radius)){
|
||||
if (empty($radius)) {
|
||||
if ($routers == '') {
|
||||
$msg .= $_L['All_field_is_required'] . '<br>';
|
||||
}
|
||||
@ -205,7 +204,7 @@ switch ($action) {
|
||||
$radup = '000000';
|
||||
}
|
||||
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
|
||||
$radiusRate = $b['rate_up'].$radup.'/'.$b['rate_down'].$raddown;
|
||||
$radiusRate = $b['rate_up'] . $radup . '/' . $b['rate_down'] . $raddown;
|
||||
|
||||
$d = ORM::for_table('tbl_plans')->create();
|
||||
$d->name_plan = $name;
|
||||
@ -221,10 +220,10 @@ switch ($action) {
|
||||
$d->validity = $validity;
|
||||
$d->validity_unit = $validity_unit;
|
||||
$d->shared_users = $sharedusers;
|
||||
if(!empty($radius)){
|
||||
if (!empty($radius)) {
|
||||
$d->is_radius = 1;
|
||||
$d->routers = '';
|
||||
}else{
|
||||
} else {
|
||||
$d->is_radius = 0;
|
||||
$d->routers = $routers;
|
||||
$d->pool_expired = $pool_expired;
|
||||
@ -235,7 +234,7 @@ switch ($action) {
|
||||
|
||||
if ($config['radius_enable']) {
|
||||
Radius::planAdd($plan_id, $name, $radiusRate);
|
||||
}else{
|
||||
} else {
|
||||
$mikrotik = Mikrotik::info($routers);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::addHotspotPlan($client, $name, $sharedusers, $rate);
|
||||
@ -302,11 +301,11 @@ switch ($action) {
|
||||
$radup = '000000';
|
||||
}
|
||||
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
|
||||
$radiusRate = $b['rate_up'].$radup.'/'.$b['rate_down'].$raddown;
|
||||
$radiusRate = $b['rate_up'] . $radup . '/' . $b['rate_down'] . $raddown;
|
||||
|
||||
if ($config['radius_enable']) {
|
||||
Radius::planUpdate($id, $name, $radiusRate);
|
||||
}else{
|
||||
} else {
|
||||
$mikrotik = Mikrotik::info($routers);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::setHotspotPlan($client, $name, $sharedusers, $rate);
|
||||
@ -372,11 +371,14 @@ switch ($action) {
|
||||
$d = ORM::for_table('tbl_plans')->find_one($id);
|
||||
if ($d) {
|
||||
$ui->assign('d', $d);
|
||||
$p = ORM::for_table('tbl_pool')->where('routers', $d['routers'])->find_many();
|
||||
$p = ORM::for_table('tbl_pool')->where('routers', ($d['is_radius']) ? 'radius' : $d['routers'])->find_many();
|
||||
$ui->assign('p', $p);
|
||||
$b = ORM::for_table('tbl_bandwidth')->find_many();
|
||||
$ui->assign('b', $b);
|
||||
$r = ORM::for_table('tbl_routers')->find_many();
|
||||
$r = [];
|
||||
if (($d['is_radius'])) {
|
||||
$r = ORM::for_table('tbl_routers')->find_many();
|
||||
}
|
||||
$ui->assign('r', $r);
|
||||
run_hook('view_edit_ppoe'); #HOOK
|
||||
$ui->display('pppoe-edit.tpl');
|
||||
@ -404,6 +406,7 @@ switch ($action) {
|
||||
|
||||
case 'pppoe-add-post':
|
||||
$name = _post('name_plan');
|
||||
$radius = _post('radius');
|
||||
$id_bw = _post('id_bw');
|
||||
$price = _post('price');
|
||||
$validity = _post('validity');
|
||||
@ -420,9 +423,14 @@ switch ($action) {
|
||||
if (Validator::UnsignedNumber($price) == false) {
|
||||
$msg .= 'The price must be a number' . '<br>';
|
||||
}
|
||||
if ($name == '' or $id_bw == '' or $price == '' or $validity == '' or $routers == '' or $pool == '') {
|
||||
if ($name == '' or $id_bw == '' or $price == '' or $validity == '' or $pool == '') {
|
||||
$msg .= $_L['All_field_is_required'] . '<br>';
|
||||
}
|
||||
if (empty($radius)) {
|
||||
if ($routers == '') {
|
||||
$msg .= $_L['All_field_is_required'] . '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
$d = ORM::for_table('tbl_plans')->where('name_plan', $name)->find_one();
|
||||
if ($d) {
|
||||
@ -433,24 +441,20 @@ switch ($action) {
|
||||
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
|
||||
if ($b['rate_down_unit'] == 'Kbps') {
|
||||
$unitdown = 'K';
|
||||
$raddown = '000';
|
||||
} else {
|
||||
$unitdown = 'M';
|
||||
$raddown = '000000';
|
||||
}
|
||||
if ($b['rate_up_unit'] == 'Kbps') {
|
||||
$unitup = 'K';
|
||||
$radup = '000';
|
||||
} else {
|
||||
$unitup = 'M';
|
||||
$radup = '000000';
|
||||
}
|
||||
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
|
||||
|
||||
if (!$config['radius_enable']) {
|
||||
$mikrotik = Mikrotik::info($routers);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::addPpoePlan($client, $name, $pool, $rate);
|
||||
if (!empty($pool_expired)) {
|
||||
Mikrotik::setPpoePlan($client, 'EXPIRED NUXBILL ' . $pool_expired, $pool_expired, '512K/512K');
|
||||
}
|
||||
}
|
||||
$radiusRate = $b['rate_up'] . $radup . '/' . $b['rate_down'] . $raddown;
|
||||
|
||||
$d = ORM::for_table('tbl_plans')->create();
|
||||
$d->type = 'PPPOE';
|
||||
@ -459,11 +463,29 @@ switch ($action) {
|
||||
$d->price = $price;
|
||||
$d->validity = $validity;
|
||||
$d->validity_unit = $validity_unit;
|
||||
$d->routers = $routers;
|
||||
$d->pool = $pool;
|
||||
$d->pool_expired = $pool_expired;
|
||||
if (!empty($radius)) {
|
||||
$d->is_radius = 1;
|
||||
$d->routers = '';
|
||||
} else {
|
||||
$d->is_radius = 0;
|
||||
$d->routers = $routers;
|
||||
$d->pool_expired = $pool_expired;
|
||||
}
|
||||
$d->enabled = $enabled;
|
||||
$d->save();
|
||||
$plan_id = $d->id();
|
||||
|
||||
if ($config['radius_enable']) {
|
||||
Radius::planAdd($plan_id, $name, $radiusRate, $pool);
|
||||
} else {
|
||||
$mikrotik = Mikrotik::info($routers);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::addPpoePlan($client, $name, $pool, $rate);
|
||||
if (!empty($pool_expired)) {
|
||||
Mikrotik::setPpoePlan($client, 'EXPIRED NUXBILL ' . $pool_expired, $pool_expired, '512K/512K');
|
||||
}
|
||||
}
|
||||
|
||||
r2(U . 'services/pppoe', 's', $_L['Created_Successfully']);
|
||||
} else {
|
||||
@ -490,7 +512,7 @@ switch ($action) {
|
||||
if (Validator::UnsignedNumber($price) == false) {
|
||||
$msg .= 'The price must be a number' . '<br>';
|
||||
}
|
||||
if ($name == '' or $id_bw == '' or $price == '' or $validity == '' or $routers == '' or $pool == '') {
|
||||
if ($name == '' or $id_bw == '' or $price == '' or $validity == '' or $pool == '') {
|
||||
$msg .= $_L['All_field_is_required'] . '<br>';
|
||||
}
|
||||
|
||||
@ -504,17 +526,24 @@ switch ($action) {
|
||||
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
|
||||
if ($b['rate_down_unit'] == 'Kbps') {
|
||||
$unitdown = 'K';
|
||||
$raddown = '000';
|
||||
} else {
|
||||
$unitdown = 'M';
|
||||
$raddown = '000000';
|
||||
}
|
||||
if ($b['rate_up_unit'] == 'Kbps') {
|
||||
$unitup = 'K';
|
||||
$radup = '000';
|
||||
} else {
|
||||
$unitup = 'M';
|
||||
$radup = '000000';
|
||||
}
|
||||
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
|
||||
$radiusRate = $b['rate_up'] . $radup . '/' . $b['rate_down'] . $raddown;
|
||||
|
||||
if (!$config['radius_enable']) {
|
||||
if ($config['radius_enable']) {
|
||||
Radius::planUpdate($id, $name, $radiusRate, $pool);
|
||||
} else {
|
||||
$mikrotik = Mikrotik::info($routers);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::setPpoePlan($client, $name, $pool, $rate);
|
||||
|
@ -1,4 +1,4 @@
|
||||
<option value=''>{$_L['Select_Pool']}</option>
|
||||
{foreach $d as $ds}
|
||||
<option value="{$ds['pool_name']}">{$ds['pool_name']}</option>
|
||||
<option value="{$ds['pool_name']}">{$ds['pool_name']}{if $routers==''} - {$ds['routers']}{/if}</option>
|
||||
{/foreach}
|
@ -20,11 +20,12 @@
|
||||
{if $_c['radius_enable']}
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">Radius</label>
|
||||
<div class="col-md-10">
|
||||
<div class="col-md-6">
|
||||
<label class="radio-inline">
|
||||
<input type="checkbox" name="radius" onclick="isRadius(this)" value="1"> Radius Plan
|
||||
</label>
|
||||
</div>
|
||||
<p class="help-block col-md-4">{Lang::T('Cannot be change after saved')}</p>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
@ -164,26 +165,27 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{literal}
|
||||
<script>
|
||||
function isRadius(cek) {
|
||||
if (cek.checked) {
|
||||
$("#routerChoose").addClass('hidden');
|
||||
document.getElementById("routers").required = false;
|
||||
document.getElementById("Limited").disabled = true;
|
||||
document.getElementById("Unlimited").checked = true;
|
||||
document.getElementById("Limited").checked = false;
|
||||
$('#Type').hide();
|
||||
$('#TimeLimit').hide();
|
||||
$('#DataLimit').hide();
|
||||
} else {
|
||||
document.getElementById("Limited").disabled = false;
|
||||
document.getElementById("routers").required = true;
|
||||
$("#routerChoose").removeClass('hidden');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{/literal}
|
||||
{if $_c['radius_enable']}
|
||||
{literal}
|
||||
<script>
|
||||
function isRadius(cek) {
|
||||
if (cek.checked) {
|
||||
$("#routerChoose").addClass('hidden');
|
||||
document.getElementById("routers").required = false;
|
||||
document.getElementById("Limited").disabled = true;
|
||||
document.getElementById("Unlimited").checked = true;
|
||||
document.getElementById("Limited").checked = false;
|
||||
$('#Type').hide();
|
||||
$('#TimeLimit').hide();
|
||||
$('#DataLimit').hide();
|
||||
} else {
|
||||
document.getElementById("Limited").disabled = false;
|
||||
document.getElementById("routers").required = true;
|
||||
$("#routerChoose").removeClass('hidden');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{/literal}
|
||||
{/if}
|
||||
|
||||
{include file="sections/footer.tpl"}
|
@ -39,8 +39,9 @@
|
||||
<div class="col-md-10">
|
||||
<input type="radio" id="Unlimited" name="typebp" value="Unlimited"
|
||||
{if $d['typebp'] eq 'Unlimited'} checked {/if}> {$_L['Unlimited']}
|
||||
<input type="radio" id="Limited" {if $_c['radius_enable'] and $d['is_radius']}disabled{/if} name="typebp" value="Limited"
|
||||
{if $d['typebp'] eq 'Limited'} checked {/if}> {$_L['Limited']}
|
||||
<input type="radio" id="Limited" {if $_c['radius_enable'] and $d['is_radius']}disabled{/if}
|
||||
name="typebp" value="Limited" {if $d['typebp'] eq 'Limited'} checked {/if}>
|
||||
{$_L['Limited']}
|
||||
</div>
|
||||
</div>
|
||||
<div {if $d['typebp'] eq 'Unlimited'} style="display:none;" {/if} id="Type">
|
||||
@ -176,19 +177,21 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{literal}
|
||||
<script>
|
||||
function isRadius(cek) {
|
||||
if (cek.checked) {
|
||||
$("#routerChoose").addClass('hidden');
|
||||
document.getElementById("routers").required = false;
|
||||
document.getElementById("Limited").disabled = true;
|
||||
} else {
|
||||
document.getElementById("Limited").disabled = false;
|
||||
document.getElementById("routers").required = true;
|
||||
$("#routerChoose").removeClass('hidden');
|
||||
{if $_c['radius_enable']}
|
||||
{literal}
|
||||
<script>
|
||||
function isRadius(cek) {
|
||||
if (cek.checked) {
|
||||
$("#routerChoose").addClass('hidden');
|
||||
document.getElementById("routers").required = false;
|
||||
document.getElementById("Limited").disabled = true;
|
||||
} else {
|
||||
document.getElementById("Limited").disabled = false;
|
||||
document.getElementById("routers").required = true;
|
||||
$("#routerChoose").removeClass('hidden');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{/literal}
|
||||
</script>
|
||||
{/literal}
|
||||
{/if}
|
||||
{include file="sections/footer.tpl"}
|
@ -1,100 +1,139 @@
|
||||
{include file="sections/header.tpl"}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<div class="panel panel-primary panel-hovered panel-stacked mb30">
|
||||
<div class="panel-heading">{$_L['Add_Plan']}</div>
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal" method="post" role="form" action="{$_url}services/pppoe-add-post" >
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{Lang::T('Status')}</label>
|
||||
<div class="col-md-10">
|
||||
<label class="radio-inline warning">
|
||||
<input type="radio" checked name="enabled" value="1"> Enable
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="enabled" value="0"> Disable
|
||||
</label>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<div class="panel panel-primary panel-hovered panel-stacked mb30">
|
||||
<div class="panel-heading">{$_L['Add_Plan']}</div>
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal" method="post" role="form" action="{$_url}services/pppoe-add-post">
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{Lang::T('Status')}</label>
|
||||
<div class="col-md-10">
|
||||
<label class="radio-inline warning">
|
||||
<input type="radio" checked name="enabled" value="1"> Enable
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="enabled" value="0"> Disable
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{if $_c['radius_enable']}
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">Radius</label>
|
||||
<div class="col-md-6">
|
||||
<label class="radio-inline">
|
||||
<input type="checkbox" name="radius" onclick="isRadius(this)" value="1"> Radius Plan
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Plan_Name']}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" id="name_plan" maxlength="40" name="name_plan">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a href="{$_url}bandwidth/add">{$_L['BW_Name']}</a></label>
|
||||
<div class="col-md-6">
|
||||
<select id="id_bw" name="id_bw" class="form-control select2">
|
||||
<option value="">{$_L['Select_BW']}...</option>
|
||||
{foreach $d as $ds}
|
||||
<option value="{$ds['id']}">{$ds['name_bw']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Plan_Price']}</label>
|
||||
<div class="col-md-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">{$_c['currency_code']}</span>
|
||||
<input type="number" class="form-control" name="price" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Plan_Validity']}</label>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" id="validity" name="validity">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<select class="form-control" id="validity_unit" name="validity_unit">
|
||||
<option value="Mins">{$_L['Mins']}</option>
|
||||
<option value="Hrs">{$_L['Hrs']}</option>
|
||||
<option value="Days">{$_L['Days']}</option>
|
||||
<option value="Months">{$_L['Months']}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a href="{$_url}routers/add">{$_L['Router_Name']}</a></label>
|
||||
<div class="col-md-6">
|
||||
<select id="routers" name="routers" required class="form-control select2">
|
||||
<option value=''>{$_L['Select_Routers']}</option>
|
||||
{foreach $r as $rs}
|
||||
<option value="{$rs['name']}">{$rs['name']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<p class="help-block">{Lang::T('Cannot be change after saved')}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{$_L['Pool']}</a></label>
|
||||
<div class="col-md-6">
|
||||
<select id="pool_name" name="pool_name" required class="form-control select2">
|
||||
<option value=''>{$_L['Select_Pool']}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{Lang::T('Expired IP Pool')}</a></label>
|
||||
<div class="col-md-6">
|
||||
<select id="pool_expired" name="pool_expired" class="form-control select2">
|
||||
<option value=''>{$_L['Select_Pool']}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<button class="btn btn-primary waves-effect waves-light" type="submit">{$_L['Save']}</button>
|
||||
Or <a href="{$_url}services/pppoe">{$_L['Cancel']}</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{include file="sections/footer.tpl"}
|
||||
<p class="help-block col-md-4">{Lang::T('Cannot be change after saved')}</p>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Plan_Name']}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" id="name_plan" maxlength="40" name="name_plan">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a
|
||||
href="{$_url}bandwidth/add">{$_L['BW_Name']}</a></label>
|
||||
<div class="col-md-6">
|
||||
<select id="id_bw" name="id_bw" class="form-control select2">
|
||||
<option value="">{$_L['Select_BW']}...</option>
|
||||
{foreach $d as $ds}
|
||||
<option value="{$ds['id']}">{$ds['name_bw']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Plan_Price']}</label>
|
||||
<div class="col-md-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">{$_c['currency_code']}</span>
|
||||
<input type="number" class="form-control" name="price" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Plan_Validity']}</label>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" id="validity" name="validity">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<select class="form-control" id="validity_unit" name="validity_unit">
|
||||
<option value="Mins">{$_L['Mins']}</option>
|
||||
<option value="Hrs">{$_L['Hrs']}</option>
|
||||
<option value="Days">{$_L['Days']}</option>
|
||||
<option value="Months">{$_L['Months']}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a
|
||||
href="{$_url}routers/add">{$_L['Router_Name']}</a></label>
|
||||
<div class="col-md-6">
|
||||
<select id="routers" name="routers" required class="form-control select2">
|
||||
<option value=''>{$_L['Select_Routers']}</option>
|
||||
{foreach $r as $rs}
|
||||
<option value="{$rs['name']}">{$rs['name']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<p class="help-block">{Lang::T('Cannot be change after saved')}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{$_L['Pool']}</a></label>
|
||||
<div class="col-md-6">
|
||||
<select id="pool_name" name="pool_name" required class="form-control select2">
|
||||
<option value=''>{$_L['Select_Pool']}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a
|
||||
href="{$_url}pool/add">{Lang::T('Expired IP Pool')}</a></label>
|
||||
<div class="col-md-6">
|
||||
<select id="pool_expired" name="pool_expired" class="form-control select2">
|
||||
<option value=''>{$_L['Select_Pool']}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<button class="btn btn-primary waves-effect waves-light"
|
||||
type="submit">{$_L['Save']}</button>
|
||||
Or <a href="{$_url}services/pppoe">{$_L['Cancel']}</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{if $_c['radius_enable']}
|
||||
{literal}
|
||||
<script>
|
||||
function isRadius(cek) {
|
||||
if (cek.checked) {
|
||||
document.getElementById("routers").required = false;
|
||||
document.getElementById("routers").disabled = true;
|
||||
document.getElementById("pool_expired").disabled = true;
|
||||
$.ajax({
|
||||
url: "index.php?_route=autoload/pool",
|
||||
data: "routers=radius",
|
||||
cache: false,
|
||||
success: function(msg) {
|
||||
$("#pool_name").html(msg);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
document.getElementById("routers").required = true;
|
||||
document.getElementById("routers").disabled = false;
|
||||
document.getElementById("pool_expired").disabled = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{/literal}
|
||||
{/if}
|
||||
{include file="sections/footer.tpl"}
|
@ -1,100 +1,131 @@
|
||||
{include file="sections/header.tpl"}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<div class="panel panel-primary panel-hovered panel-stacked mb30">
|
||||
<div class="panel-heading">{$_L['Edit_Plan']}</div>
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal" method="post" role="form" action="{$_url}services/edit-pppoe-post">
|
||||
<input type="hidden" name="id" value="{$d['id']}">
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{Lang::T('Status')}</label>
|
||||
<div class="col-md-10">
|
||||
<label class="radio-inline warning">
|
||||
<input type="radio" {if $d['enabled'] == 1}checked{/if} name="enabled" value="1"> Enable
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" {if $d['enabled'] == 0}checked{/if} name="enabled" value="0"> Disable
|
||||
</label>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<div class="panel panel-primary panel-hovered panel-stacked mb30">
|
||||
<div class="panel-heading">{$_L['Edit_Plan']}</div>
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal" method="post" role="form" action="{$_url}services/edit-pppoe-post">
|
||||
<input type="hidden" name="id" value="{$d['id']}">
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{Lang::T('Status')}</label>
|
||||
<div class="col-md-10">
|
||||
<label class="radio-inline warning">
|
||||
<input type="radio" {if $d['enabled'] == 1}checked{/if} name="enabled" value="1"> Enable
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" {if $d['enabled'] == 0}checked{/if} name="enabled" value="0">
|
||||
Disable
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{if $_c['radius_enable'] and $d['is_radius']}
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">Radius</label>
|
||||
<div class="col-md-10">
|
||||
<label class="label label-primary">RADIUS</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Plan_Name']}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" id="name_plan" maxlength="40" name="name_plan" value="{$d['name_plan']}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a href="{$_url}bandwidth/add">{$_L['BW_Name']}</a></label>
|
||||
<div class="col-md-6">
|
||||
<select id="id_bw" name="id_bw" class="form-control select2">
|
||||
{foreach $b as $bs}
|
||||
<option value="{$bs['id']}" {if $d['id_bw'] eq $bs['id']} selected {/if}>{$bs['name_bw']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Plan_Price']}</label>
|
||||
<div class="col-md-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">{$_c['currency_code']}</span>
|
||||
<input type="number" class="form-control" name="price" required value="{$d['price']}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Plan_Validity']}</label>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" id="validity" name="validity" value="{$d['validity']}">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<select class="form-control" id="validity_unit" name="validity_unit">
|
||||
<option value="Mins" {if $d['validity_unit'] eq 'Mins'} selected {/if}>{$_L['Mins']}</option>
|
||||
<option value="Hrs" {if $d['validity_unit'] eq 'Hrs'} selected {/if}>{$_L['Hrs']}</option>
|
||||
<option value="Days" {if $d['validity_unit'] eq 'Days'} selected {/if}>{$_L['Days']}</option>
|
||||
<option value="Months" {if $d['validity_unit'] eq 'Months'} selected {/if}>{$_L['Months']}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{$_L['Pool']}</a></label>
|
||||
<div class="col-md-6">
|
||||
<select id="pool_name" name="pool_name" required class="form-control select2">
|
||||
{foreach $p as $ps}
|
||||
<option value="{$ps['pool_name']}" {if $d['pool'] eq $ps['pool_name']} selected {/if}>{$ps['pool_name']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{Lang::T('Expired IP Pool')}</a></label>
|
||||
<div class="col-md-6">
|
||||
<select id="pool_expired" name="pool_expired" class="form-control select2">
|
||||
<option value=''>{$_L['Select_Pool']}</option>
|
||||
{foreach $p as $ps}
|
||||
<option value="{$ps['pool_name']}" {if $d['pool_expired'] eq $ps['pool_name']} selected {/if}>{$ps['pool_name']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Router_Name']}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" id="routers" name="routers" value="{$d['routers']}" readonly>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Plan_Name']}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" id="name_plan" maxlength="40" name="name_plan"
|
||||
value="{$d['name_plan']}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a
|
||||
href="{$_url}bandwidth/add">{$_L['BW_Name']}</a></label>
|
||||
<div class="col-md-6">
|
||||
<select id="id_bw" name="id_bw" class="form-control select2">
|
||||
{foreach $b as $bs}
|
||||
<option value="{$bs['id']}" {if $d['id_bw'] eq $bs['id']} selected {/if}>
|
||||
{$bs['name_bw']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Plan_Price']}</label>
|
||||
<div class="col-md-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">{$_c['currency_code']}</span>
|
||||
<input type="number" class="form-control" name="price" required value="{$d['price']}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Plan_Validity']}</label>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" id="validity" name="validity"
|
||||
value="{$d['validity']}">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<select class="form-control" id="validity_unit" name="validity_unit">
|
||||
<option value="Mins" {if $d['validity_unit'] eq 'Mins'} selected {/if}>{$_L['Mins']}
|
||||
</option>
|
||||
<option value="Hrs" {if $d['validity_unit'] eq 'Hrs'} selected {/if}>{$_L['Hrs']}
|
||||
</option>
|
||||
<option value="Days" {if $d['validity_unit'] eq 'Days'} selected {/if}>{$_L['Days']}
|
||||
</option>
|
||||
<option value="Months" {if $d['validity_unit'] eq 'Months'} selected {/if}>
|
||||
{$_L['Months']}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{$_L['Pool']}</a></label>
|
||||
<div class="col-md-6">
|
||||
<select id="pool_name" name="pool_name" required class="form-control select2">
|
||||
{foreach $p as $ps}
|
||||
<option value="{$ps['pool_name']}" {if $d['pool'] eq $ps['pool_name']} selected {/if}>
|
||||
{$ps['pool_name']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a
|
||||
href="{$_url}pool/add">{Lang::T('Expired IP Pool')}</a></label>
|
||||
<div class="col-md-6">
|
||||
<select id="pool_expired" name="pool_expired" class="form-control select2">
|
||||
<option value=''>{$_L['Select_Pool']}</option>
|
||||
{foreach $p as $ps}
|
||||
<option value="{$ps['pool_name']}" {if $d['pool_expired'] eq $ps['pool_name']} selected
|
||||
{/if}>{$ps['pool_name']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Router_Name']}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" id="routers" name="routers" value="{$d['routers']}"
|
||||
readonly>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-lg-offset-2 col-lg-10">
|
||||
<button class="btn btn-success waves-effect waves-light" type="submit">{$_L['Save']}</button>
|
||||
Or <a href="{$_url}services/pppoe">{$_L['Cancel']}</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-lg-offset-2 col-lg-10">
|
||||
<button class="btn btn-success waves-effect waves-light"
|
||||
type="submit">{$_L['Save']}</button>
|
||||
Or <a href="{$_url}services/pppoe">{$_L['Cancel']}</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{include file="sections/footer.tpl"}
|
||||
{if $_c['radius_enable'] and $d['is_radius']}
|
||||
{literal}
|
||||
<script>
|
||||
document.getElementById("routers").required = false;
|
||||
document.getElementById("routers").disabled = true;
|
||||
document.getElementById("pool_expired").disabled = true;
|
||||
</script>
|
||||
{/literal}
|
||||
{/if}
|
||||
{include file="sections/footer.tpl"}
|
@ -54,7 +54,14 @@
|
||||
<td>{$ds['validity']} {$ds['validity_unit']}</td>
|
||||
<td>{$ds['pool']}</td>
|
||||
<td>{$ds['pool_expired']}</td>
|
||||
<td>{$ds['routers']}</td>
|
||||
<td>
|
||||
{if $ds['is_radius']}
|
||||
<span class="label label-primary">RADIUS</span>
|
||||
{else}
|
||||
{if $ds['routers']!=''}
|
||||
<a href="{$_url}routers/edit/0&name={$ds['routers']}">{$ds['routers']}</a>
|
||||
{/if}
|
||||
{/if}</td>
|
||||
<td>
|
||||
<a href="{$_url}services/pppoe-edit/{$ds['id']}"
|
||||
class="btn btn-info btn-xs">{$_L['Edit']}</a>
|
||||
|
Loading…
x
Reference in New Issue
Block a user