check if router has plan
This commit is contained in:
parent
c5b96df43f
commit
c9eeefcf3d
@ -299,4 +299,23 @@ class Validator
|
||||
return (bool)in_array($format, $formats);
|
||||
}
|
||||
|
||||
public static function countRouterPlan($plans, $router){
|
||||
$n = 0;
|
||||
foreach ($plans as $plan){
|
||||
if($plan['routers'] == $router){
|
||||
$n++;
|
||||
}
|
||||
}
|
||||
return $n;
|
||||
}
|
||||
|
||||
public static function isRouterHasPlan($plans, $router){
|
||||
foreach ($plans as $plan){
|
||||
if($plan['routers'] == $router){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,6 +35,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
{foreach $routers as $router}
|
||||
{if Validator::isRouterHasPlan($plans_hotspot, $router['name'])>0 && Validator::isRouterHasPlan($plans_pppoe, $router['name'])>0}
|
||||
<div class="box box-solid box-info">
|
||||
<div class="box-header text-black">{$router['name']}</div>
|
||||
{if $router['description'] != ''}
|
||||
@ -42,7 +43,7 @@
|
||||
{$router['description']}
|
||||
</div>
|
||||
{/if}
|
||||
{if count($plans_hotspot)>0}
|
||||
{if Validator::countRouterPlan($plans_hotspot, $router['name'])>0}
|
||||
<div class="box-header">{Lang::T('Hotspot Plan')}</div>
|
||||
<div class="box-body row">
|
||||
{foreach $plans_hotspot as $plan}
|
||||
@ -91,7 +92,7 @@
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
{if count($plans_pppoe)>0}
|
||||
{if Validator::countRouterPlan($plans_pppoe,$router['name'])>0}
|
||||
<div class="box-header text-sm">{Lang::T('PPPOE Plan')}</div>
|
||||
<div class="box-body row">
|
||||
{foreach $plans_pppoe as $plan}
|
||||
@ -141,6 +142,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user