add devices list and description

This commit is contained in:
Ibnu Maksum 2024-07-05 21:31:23 +07:00
parent 307abd64d3
commit b3b058df48
No known key found for this signature in database
GPG key ID: 7FC82848810579E5
8 changed files with 123 additions and 1 deletions

View file

@ -12,6 +12,33 @@ $action = $routes['1'];
$ui->assign('_admin', $admin);
switch ($action) {
case 'devices':
$files = scandir($DEVICE_PATH);
$devices = [];
foreach ($files as $file) {
$ext = pathinfo($file, PATHINFO_EXTENSION);
if ($ext == 'php') {
$dev = pathinfo($file, PATHINFO_FILENAME);
require_once $DEVICE_PATH . DIRECTORY_SEPARATOR . $file;
$dvc = new $dev;
if(method_exists($dvc, 'description')){
$arr = $dvc->description();
$arr['file'] = $dev;
$devices[] = $arr;
}else{
$devices[] = [
'title' => $dev,
'description' => '',
'author' => 'unknown',
'url' => [],
'file' => $dev
];
}
}
}
$ui->assign('devices', $devices);
$ui->display('app-devices.tpl');
break;
case 'app':
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
_alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard");

View file

@ -13,6 +13,22 @@ use PEAR2\Net\RouterOS;
class MikrotikHotspot
{
// show Description
function description()
{
return [
'title' => 'Mikrotik Hotspot',
'description' => 'To handle connection between PHPNuxBill with Mikrotik Hotspot',
'author' => 'ibnux',
'url' => [
'Github' => 'https://github.com/hotspotbilling/phpnuxbill/',
'Telegram' => 'https://t.me/ibnux',
'Donate' => 'https://paypal.me/ibnux'
]
];
}
function add_customer($customer, $plan)
{
$mikrotik = $this->info($plan['routers']);

View file

@ -12,6 +12,20 @@ use PEAR2\Net\RouterOS;
class MikrotikPppoe
{
// show Description
function description()
{
return [
'title' => 'Mikrotik PPPOE',
'description' => 'To handle connection between PHPNuxBill with Mikrotik PPPOE',
'author' => 'ibnux',
'url' => [
'Github' => 'https://github.com/hotspotbilling/phpnuxbill/',
'Telegram' => 'https://t.me/ibnux',
'Donate' => 'https://paypal.me/ibnux'
]
];
}
function add_customer($customer, $plan)
{

View file

@ -11,6 +11,21 @@
class Radius
{
// show Description
function description()
{
return [
'title' => 'Radius',
'description' => 'Radius system with database Mysql/Mariadb as database',
'author' => 'ibnux',
'url' => [
'Github' => 'https://github.com/hotspotbilling/phpnuxbill/',
'Telegram' => 'https://t.me/ibnux',
'Donate' => 'https://paypal.me/ibnux'
]
];
}
function add_customer($customer, $plan)
{
global $b;

View file

@ -7,6 +7,22 @@ just follow the template
class FileName {
// show Description
function description()
{
return [
'title' => 'Device',
'description' => '',
'author' => 'ibnu maksum',
'url' => [
'Github' => 'https://github.com/hotspotbilling/phpnuxbill/',
'Telegram' => 'https://t.me/ibnux',
'Donate' => 'https://paypal.me/ibnux',
'any text' => 'Any Url'
]
];
}
// Add Customer to Mikrotik/Device
function add_customer($customer, $plan)
{

View file

@ -560,5 +560,6 @@
"Please_wait_1039_seconds_before_sending_another_SMS": "Harap tunggu 1039 detik sebelum mengirim SMS lainnya",
"Please_wait_1015_seconds_before_sending_another_SMS": "Harap tunggu 1015 detik sebelum mengirim SMS lainnya",
"Phone_number_updated_successfully": "Nomor telepon berhasil diperbarui",
"You_cannot_use_your_current_phone_number": "Anda tidak dapat menggunakan nomor telepon Anda saat ini"
"You_cannot_use_your_current_phone_number": "Anda tidak dapat menggunakan nomor telepon Anda saat ini",
"Devices": "Perangkat"
}

31
ui/ui/app-devices.tpl Normal file
View file

@ -0,0 +1,31 @@
{include file="sections/header.tpl"}
<div class="panel panel-primary">
<div class="panel-heading">
Installed Devices
</div>
<div class="panel-body">
<div class="row">
{foreach $devices as $d}
<div class="col-md-3">
<div class="panel panel-primary">
<div class="panel-heading"><b>{$d['title']}</b> <small>by {$d['author']}</small></div>
<div class="panel-body" style="overflow-y: scroll;">
<div style="max-height: 50px; min-height: 50px;">{nl2br(strip_tags($d['description']))}</div>
</div>
<div class="panel-footer" style="overflow-y: scroll;">
<center style="max-height: 40px; min-height: 40px;">
<span class="label label-default">{$d['file']}</span>
{foreach $d['url'] as $name => $url}
<a href="{$url}" target="_blank" class="label label-primary">{$name}</a>
{/foreach}
</center>
</div>
</div>
</div>
{/foreach}
</div>
</div>
</div>
{include file="sections/footer.tpl"}

View file

@ -433,6 +433,8 @@
href="{$_url}settings/maintenance">{Lang::T('Maintenance Mode')}</a></li>
<li {if $_routes[1] eq 'notifications' }class="active" {/if}><a
href="{$_url}settings/notifications">{Lang::T('User Notification')}</a></li>
<li {if $_routes[1] eq 'devices' }class="active" {/if}><a
href="{$_url}settings/devices">{Lang::T('Devices')}</a></li>
{/if}
{if in_array($_admin['user_type'],['SuperAdmin','Admin','Agent'])}
<li {if $_routes[1] eq 'users' }class="active" {/if}><a