Files
librenms-librenms/html/plugins/Test/Test.php
T

40 lines
883 B
PHP
Raw Normal View History

<?php
2016-08-17 20:24:27 -05:00
namespace LibreNMS\Plugins;
2021-07-02 19:26:05 +00:00
use App\Models\Device;
use App\Models\Port;
2016-08-18 20:28:22 -05:00
class Test
{
public static function menu()
2016-08-18 20:28:22 -05:00
{
2021-07-02 19:26:05 +00:00
$name = self::className();
echo view(self::viewPath(), compact('name'));
2020-09-21 14:54:51 +02:00
}
2020-09-21 14:54:51 +02:00
public function device_overview_container($device)
{
2021-07-02 19:26:05 +00:00
$name = self::className() . ' Plugin';
$device = Device::find($device['device_id']);
echo view(self::viewPath(), compact('name','device'));
}
2020-09-21 14:54:51 +02:00
public function port_container($device, $port)
{
2021-07-02 19:26:05 +00:00
$name = self::className() . ' Plugin';
$port = Port::find($port['port_id']);
echo view(self::viewPath(), compact('name','port'));
}
private static function viewPath()
{
return 'plugins.' . strtolower(self::className()) . '.' . debug_backtrace()[1]['function'];
}
private static function className()
{
return str_replace(__NAMESPACE__ . '\\', '', self::class);
}
2015-07-13 20:10:26 +02:00
}