Issues (2963)

includes/html/pages/apps/default.inc.php (1 issue)

1
<?php
2
3
use App\Models\Application;
4
use LibreNMS\Util\Url;
5
6
$graph_array['height'] = '100';
7
$graph_array['width'] = '220';
8
$graph_array['to'] = \LibreNMS\Config::get('time.now');
9
$graph_array['from'] = \LibreNMS\Config::get('time.day');
10
$graph_array_zoom = $graph_array;
11
$graph_array_zoom['height'] = '150';
12
$graph_array_zoom['width'] = '400';
13
$graph_array['legend'] = 'no';
14
15
$apps = Application::query()->hasAccess(Auth::user())->where('app_type', $vars['app'])->with('device')->get()->sortBy(function ($app) {
16
    return $app->device->hostname;
17
});
18
19
foreach ($apps as $app) {
20
    $app_state = \LibreNMS\Util\Html::appStateIcon($app['app_state']);
0 ignored issues
show
It seems like $app['app_state'] can also be of type Illuminate\Database\Eloq...uent\Relations\Relation and Illuminate\Database\Eloquent\Relations\Relation; however, parameter $app_state of LibreNMS\Util\Html::appStateIcon() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

20
    $app_state = \LibreNMS\Util\Html::appStateIcon(/** @scrutinizer ignore-type */ $app['app_state']);
Loading history...
21
    if (! empty($app_state['icon'])) {
22
        $app_state_info = '<font color="' . $app_state['color'] . '"><i title="' . $app_state['hover_text'] . '" class="fa ' . $app_state['icon'] . ' fa-fw fa-lg" aria-hidden="true"></i></font>';
23
    } else {
24
        $app_state_info = '';
25
    }
26
27
    echo '<div class="panel panel-default">
28
        <div class="panel-heading">
29
        <h3 class="panel-title">' .
30
        $app_state_info .
31
        Url::deviceLink($app->device, null, ['tab' => 'apps', 'app' => $app->app_type]) . '
32
        <div class="pull-right"><small class="muted">' . $app->app_instance . ' ' . $app->app_status . '</small></div>
33
        </h3>
34
        </div>
35
        <div class="panel-body">
36
        <div class="row">';
37
38
    foreach ($graphs[$app->app_type] as $graph_type) {
39
        $graph_array['type'] = empty($graph_type) ? 'application_' . $app->app_type : 'application_' . $app->app_type . '_' . $graph_type;
40
        $graph_array['id'] = $app->app_id;
41
        $graph_array_zoom['type'] = 'application_' . $app->app_type . '_' . $graph_type;
42
        $graph_array_zoom['id'] = $app->app_id;
43
44
        $link = Url::generate(['page' => 'device', 'device' => $app->device_id, 'tab' => 'apps', 'app' => $app->app_type]);
45
46
        echo '<div class="pull-left">';
47
        echo Url::overlibLink($link, Url::lazyGraphTag($graph_array), Url::graphTag($graph_array_zoom));
48
        echo '</div>';
49
    }
50
51
    echo '</div>';
52
    echo '</div>';
53
    echo '</div>';
54
}//end foreach
55
56
echo '</table>';
57