Test Failed
Push — master ( e3c39f...fe570d )
by Mihail
07:20
created

Apps/View/Admin/default/_layouts/default.php (1 issue)

1
<?php
2
3
4
use Ffcms\Core\Helper\Simplify;
5
use Ffcms\Core\Helper\Text;
6
use Ffcms\Core\Helper\Type\Str;
7
use Ffcms\Templex\Url\Url;
8
9
/** @var \Ffcms\Templex\Template\Template $this */
10
11
// load layout features model
12
$features = new \Apps\Model\Admin\LayoutFeatures\LayoutFeatures();
13
?>
14
<!doctype html>
15
<html lang="en">
16
<head>
17
    <!-- Required meta tags -->
18
    <meta charset="utf-8">
19
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
20
21
    <link rel="shortcut icon" href="<?= \App::$Alias->currentViewUrl ?>/assets/img/favicon.ico" type="image/x-icon">
22
    <link rel="icon" href="<?= \App::$Alias->currentViewUrl ?>/assets/img/favicon.ico" type="image/x-icon">
23
24
    <link rel="stylesheet" href="<?= \App::$Alias->scriptUrl ?>/vendor/twbs/bootstrap/dist/css/bootstrap.min.css" />
25
    <link rel="stylesheet" href="<?= \App::$Alias->scriptUrl ?>/vendor/components/font-awesome/css/font-awesome.min.css" />
26
27
    <!-- theme -->
28
    <link rel="stylesheet" href="<?= \App::$Alias->currentViewUrl ?>/assets/css/style.css" />
29
30
    <?php if (\App::$Properties->get('multiLanguage') && count(\App::$Properties->get('languages')) > 1): ?>
0 ignored issues
show
It seems like App::Properties->get('languages') can also be of type false; however, parameter $var of count() does only seem to accept Countable|array, 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

30
    <?php if (\App::$Properties->get('multiLanguage') && count(/** @scrutinizer ignore-type */ \App::$Properties->get('languages')) > 1): ?>
Loading history...
31
        <link rel="stylesheet" href="<?= \App::$Alias->scriptUrl ?>/vendor/phpffcms/language-flags/flags.css" />
32
    <?php endif; ?>
33
34
    <title><?= $title ?? 'Admin panel' ?></title>
35
36
    <?= $this->section('css') ?>
37
    <!-- jquery usage after-load logic -->
38
    <script>(function(w,d,u){w.readyQ=[];w.bindReadyQ=[];function p(x,y){if(x=="ready"){w.bindReadyQ.push(y);}else{w.readyQ.push(x);}};var a={ready:p,bind:p};w.$=w.jQuery=function(f){if(f===d||f===u){return a}else{p(f)}}})(window,document)</script>
39
    <script>
40
        var script_url = '<?= \App::$Alias->scriptUrl ?>';
41
        var script_lang = '<?= \App::$Request->getLanguage() ?>';
42
        var site_url = '<?= \App::$Alias->baseUrl ?>';
43
    </script>
44
    <?php if (\App::$Debug): ?>
45
        <?= \App::$Debug->renderHead() ?>
46
    <?php endif; ?>
47
48
    <!--[if lt IE 9]>
49
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
50
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
51
    <![endif]-->
52
</head>
53
<body>
54
55
<div id="wrapper">
56
57
    <nav class="navbar navbar-admin navbar-toggleable">
58
        <div class="container-fluid">
59
            <button type="button" class="sidebar-open d-md-none">
60
                <span class="icon-bar"></span>
61
                <span class="icon-bar"></span>
62
                <span class="icon-bar"></span>
63
            </button>
64
            <h1 class="navbar-brand d-none d-md-inline-block">
65
                <a href="<?= \App::$Alias->baseUrl ?>"><i class="fa fa-globe" aria-hidden="true"></i></a>
66
                <small style="font-size: 24px;">FFCMS</small>
67
            </h1>
68
            <ul class="nav navbar-nav navbar-right">
69
                <li class="nav-item dropdown active">
70
                    <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
71
                        <i class="fa fa-cog"></i> <?= __('Quick manage') ?>
72
                    </a>
73
                    <ul class="dropdown-menu">
74
                        <li><?= Url::a(['main/settings'], __('Settings'), ['class' => 'dropdown-item']) ?></li>
75
                        <li><?= Url::a(['user/index'], __('Users'), ['class' => 'dropdown-item']) ?></li>
76
                        <li><?= Url::a(['content/index'], __('Content'), ['class' => 'dropdown-item']) ?></li>
77
                        <li role="separator" class="dropdown-divider"></li>
78
                        <li><a class="dropdown-item" href="<?= \App::$Alias->scriptUrl ?>/user/logout" data-method="post"><?= __('Logout') ?></a></li>
79
                    </ul>
80
                </li>
81
82
                <!-- @todo: implement orders when CRM cart shop ready
83
                <li class="nav-item dropdown">
84
                    <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
85
                        <i class="fa fa-cart-arrow-down"></i> Orders
86
                    </a>
87
                    <div class="dropdown-menu dropdown-md">
88
                        <div class="media-items">
89
                            <div class="media">
90
                                <div class="media-left">
91
                                    <a href="#">
92
                                        <i class="fa fa-shopping-cart fa-2x text-primary"></i>
93
                                    </a>
94
                                </div>
95
                                <div class="media-body text-muted">
96
                                    <p class="media-heading"><a href="#">4 items, $215.45</a></p>
97
                                    <span class="text-sm">
98
                                        <span class="badge badge-secondary">item #1</span>
99
                                        <span class="badge badge-secondary">item #2</span>
100
                                        <span class="badge badge-secondary">item #3</span>
101
                                        <span class="badge badge-secondary">item #4</span>
102
                                    </span>
103
                                </div>
104
                            </div>
105
                            <div class="media">
106
                                <div class="media-left">
107
                                    <a href="#">
108
                                        <i class="fa fa-shopping-cart fa-2x text-muted"></i>
109
                                    </a>
110
                                </div>
111
                                <div class="media-body text-muted">
112
                                    <p class="media-heading"><a href="#">1 items, $15.45</a></p>
113
                                    <span class="text-sm">
114
                                        <span class="badge badge-secondary">Black dildo 7"</span>
115
                                    </span>
116
                                </div>
117
                            </div>
118
                        </div>
119
120
                        <a class="dropdown-menu-footer" href="#">
121
                            View all
122
                        </a>
123
124
                    </div>
125
                </li> -->
126
127
                <li class="nav-item dropdown">
128
                    <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
129
                        <i class="fa fa-question-circle-o"></i> <?= __('Feedback') ?>
130
                        <?php if ($features->getFeedback()->count() > 0): ?>
131
                        <span class="badge badge-primary"><?= $features->getFeedback()->count() ?></span>
132
                        <?php endif; ?>
133
                    </a>
134
                    <div class="dropdown-menu dropdown-md">
135
                        <div class="media-items">
136
                            <?php if ($features->getFeedback()->count() < 1):?>
137
                            <div class="media">
138
                                <div class="media-body text-muted">
139
                                    <span class="text-sm">No feedback queries found</span>
140
                                </div>
141
                            </div>
142
                            <?php else: ?>
143
                                <?php foreach ($features->getFeedback() as $feed): ?>
144
                                    <div class="media">
145
                                        <div class="media-left">
146
                                            <?= Url::a(['feedback/read', [$feed->id]], '<i class="fa fa-question-circle fa-2x text-primary"></i>', ['html' => true]) ?>
147
                                        </div>
148
                                        <div class="media-body text-muted">
149
                                            <p class="media-heading"><?= Url::a(['feedback/read', [$feed->id]], $feed->name) ?></p>
150
                                            <span class="text-sm"><?= Text::snippet($feed->message, 100) ?></span>
151
                                        </div>
152
                                    </div>
153
                                <?php endforeach; ?>
154
                            <?php endif; ?>
155
                        </div>
156
157
                        <a class="dropdown-menu-footer" href="<?= Url::to('feedback/index') ?>">
158
                            <?= __('View all') ?>
159
                        </a>
160
                    </div>
161
                </li>
162
163
                <li class="nav-item dropdown">
164
                    <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
165
                        <i class="fa fa-comment-o"></i> <?= __('Comments') ?>
166
                    </a>
167
                    <div class="dropdown-menu dropdown-md">
168
                        <div class="media-items">
169
                            <?php if ($features->getComments()->count() < 1): ?>
170
                            <div class="media">
171
                                <div class="media-body text-muted">
172
                                    <span class="text-sm">No comments found</span>
173
                                </div>
174
                            </div>
175
                            <?php else: ?>
176
                                <?php foreach ($features->getComments() as $comment): ?>
177
                                <?php /** @var \Apps\ActiveRecord\CommentPost $comment */ ?>
178
                                    <div class="media">
179
                                        <div class="media-left">
180
                                            <a href="<?= ($comment->user ? Url::link(['user/update', [$comment->user->id]]) : '#') ?>">
181
                                                <?php
182
                                                $commentAva = \App::$Alias->scriptUrl . '/upload/user/avatar/small/default.jpg';
183
                                                if ($comment->user && $comment->user->id > 0) {
184
                                                    $commentAva = $comment->user->profile->getAvatarUrl('small');
185
                                                }
186
                                                ?>
187
                                                <img class="media-object img-circle" src="<?= $commentAva ?>" width="38" height="38" alt="avatar" />
188
                                            </a>
189
                                        </div>
190
                                        <div class="media-body text-muted">
191
                                            <p class="media-heading">
192
                                                <a href="#"><?= $comment->user_id > 0 ? Simplify::parseUserNick($comment->user_id) : $comment->guest_name ?></a>
193
                                            </p>
194
                                            <span class="text-sm"><?= Text::snippet($comment->message, 100) ?></span>
195
                                        </div>
196
                                    </div>
197
                                <?php endforeach; ?>
198
                            <?php endif; ?>
199
                        </div>
200
201
                        <a class="dropdown-menu-footer" href="<?= Url::to('comments/index') ?>">
202
                            <?= __('View all') ?>
203
                        </a>
204
205
                    </div>
206
                </li>
207
208
                <li class="nav-item">
209
                    <a href="<?= \App::$Alias->scriptUrl ?>" class="nav-link" target="_blank">
210
                        <i class="fa fa-sign-out"></i> <?= __('Open site') ?>
211
                    </a>
212
                </li>
213
            </ul>
214
        </div>
215
    </nav>
216
217
    <div id="content">
218
        <header id="page-header">
219
            <div class="container-fluid">
220
                <div class="row">
221
                    <div class="col-sm-8 page-title-wrapper">
222
                        <?php if (\App::$Properties->get('multiLanguage') && count(\App::$Properties->get('languages')) > 1) {
223
                            $list = $this->listing('ul', ['class' => 'list-inline']);
224
                            foreach (\App::$Properties->get('languages') as $lang) {
225
                                $list->li([
226
                                    'text' => '<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="flag flag-' . $lang . '" alt="' . $lang . '">',
227
                                    'link' => App::$Alias->baseUrlNoLang . '/' . $lang . App::$Request->getPathInfo(),
228
                                    'html' => true
229
                                ], ['class' => 'list-inline-item']);
230
                            }
231
                            echo $list->display();
232
                        } ?>
233
                        <!--<h1 class="page-title">FFCMS<sup>3</sup></h1>-->
234
                        <h2 class="page-subtitle">
235
                        <?php if (isset($breadcrumbs) && is_array($breadcrumbs)): ?>
236
                            <?php foreach ($breadcrumbs as $url => $text): ?>
237
                                <?php if (\Ffcms\Core\Helper\Type\Any::isInt($url)): ?>
238
                                    <?= $text ?>
239
                                <?php else: ?>
240
                                    <a href="<?= $url ?>"><?= $text ?></a> /
241
                                <?php endif; ?>
242
                            <?php endforeach; ?>
243
                        <?php endif; ?>
244
                        </h2>
245
                    </div>
246
                    <div class="col-sm-4 d-none d-md-inline-block page-search-wrapper">
247
                        <form class="form-inline" method="get" action="<?= Url::link(['main/search']) ?>">
248
                            <input type="text" class="form-control col" name="search" placeholder="<?= __('Type search query') ?>" value="<?= $query ?? null ?>">&nbsp;
249
                            <input type="submit" name="submit" value="<?= __('Search') ?>" class="btn btn-secondary" />
250
                        </form>
251
                    </div>
252
                </div>
253
            </div>
254
        </header>
255
        <div id="page-body">
256
            <!-- left menu -->
257
            <div class="container-fluid">
258
                <div id="page-sidebar" class="toggled sidebar">
259
                    <nav class="sidebar-collapse d-none d-md-block">
260
                        <i class="fa fa-arrow-right show-on-collapsed"></i>
261
                        <i class="fa fa-arrow-left hide-on-collapsed"></i>
262
                    </nav>
263
264
                    <ul class="nav nav-pills nav-stacked" id="sidebar-stacked">
265
                        <li class="d-md-none">
266
                            <a href="#" class="sidebar-close"><i class="fa fa-arrow-left"></i></a>
267
                        </li>
268
                        <li class="nav-item">
269
                            <a class="nav-link" href="<?= App::$Alias->baseUrl ?>"><i class="fa fa-home"></i> <span class="nav-text"><?= __('Main') ?></span></a>
270
                        </li>
271
                        <li class="nav-item<?= (\App::$Request->getController() === 'Main' && \App::$Request->getAction() !== 'Index') ? ' active' : null ?>">
272
                            <?= Url::a(['#system-dropdown'],
273
                                '<i class="fa fa-fire"></i> <span class="nav-text">' . __('System') . '</span>',
274
                                [
275
                                    'class' => 'nav-container',
276
                                    'data-toggle' => 'collapse',
277
                                    'html' => true
278
                                ])
279
                            ?>
280
281
                            <?= $this->bootstrap()->nav('ul', ['class' => 'nav nav-pills nav-stacked collapse' . ((\App::$Request->getController() === 'Main' && \App::$Request->getAction() !== 'Index') ? 'in show' : null), 'id' => 'system-dropdown'])
282
                                ->menu(['link' => ['main/settings'], 'text' => '<i class="fa fa-cogs"></i> ' . __('Settings'), 'html' => true])
283
                                ->menu(['link' => ['main/files'], 'text' => '<i class="fa fa-file-o"></i> ' . __('Files'), 'html' => true])
284
                                ->menu(['link' => ['main/antivirus'], 'text' => '<i class="fa fa-shield"></i> ' . __('Antivirus'), 'html' => true])
285
                                ->menu(['link' => ['main/routing'], 'text' => '<i class="fa fa-code"></i> ' . __('Routing'), 'html' => true])
286
                                ->menu(['link' => ['main/updates'], 'text' => '<i class="fa fa-gavel"></i> ' . __('Updates'), 'html' => true])
287
                                ->display();
288
                            ?>
289
                        </li>
290
                        <?php
291
                        $apps = [];
292
                        $widgets = [];
293
                        foreach (\Apps\ActiveRecord\App::all() as $ext) {
294
                            /** @var \Apps\ActiveRecord\App $ext */
295
                            if ($ext->type === 'app') {
296
                                $apps[$ext->sys_name] = $ext;
297
                            } elseif ($ext->type === 'widget') {
298
                                $widgets[$ext->sys_name] = $ext;
299
                            }
300
                        }
301
                        ?>
302
                        <li class="nav-item<?= (array_key_exists(\App::$Request->getController(), $apps) || \App::$Request->getController() === 'Application') ? ' active' : null ?>">
303
                            <?= Url::a(['#apps-dropdown'],
304
                                '<i class="fa fa-plug"></i> <span class="nav-text">' . __('Applications') . '</span>',
305
                                [
306
                                    'class' => 'nav-container',
307
                                    'data-toggle' => 'collapse',
308
                                    'html' => true
309
                                ])
310
                            ?>
311
312
                            <?php
313
                            $appMenu = $this->bootstrap()->nav('ul', ['class' => 'nav nav-pills nav-stacked collapse' . ((array_key_exists(\App::$Request->getController(), $apps) || \App::$Request->getController() === 'Application') ? 'in show' : null), 'id' => 'apps-dropdown']);
314
                            foreach ($apps as $app) {
315
                                /** @var \Apps\ActiveRecord\App $app */
316
                                $appMenu->menu(['link' => [Str::lowerCase($app->sys_name) . '/index'], 'text' => $app->getLocaleName()]);
317
                            }
318
                            $appMenu->menu(['link' => 'application/index', 'text' => __('All apps') . '...']);
319
                            echo $appMenu->display();
320
                            ?>
321
                        </li>
322
                        <li class="nav-item<?= (array_key_exists(\App::$Request->getController(), $widgets) || \App::$Request->getController() === 'Widget') ? ' active' : null ?>">
323
                            <?= Url::a(['#widgets-dropdown'],
324
                                '<i class="fa fa-puzzle-piece"></i> <span class="nav-text">' . __('Widgets') . '</span>',
325
                                [
326
                                    'class' => 'nav-container',
327
                                    'data-toggle' => 'collapse',
328
                                    'html' => true
329
                                ])
330
                            ?>
331
332
                            <?php
333
                            $widgetMenu = $this->bootstrap()->nav('ul', ['class' => 'nav nav-pills nav-stacked collapse' . ((array_key_exists(\App::$Request->getController(), $widgets) || \App::$Request->getController() === 'Widget') ? 'in show' : null), 'id' => 'widgets-dropdown']);
334
                            foreach ($widgets as $widget) {
335
                                /** @var \Apps\ActiveRecord\App $widget */
336
                                $widgetMenu->menu(['link' => [Str::lowerCase($widget->sys_name) . '/index'], 'text' => $widget->getLocaleName()]);
337
                            }
338
                            $widgetMenu->menu(['link' => 'widget/index', 'text' => __('All widgets') . '...']);
339
                            echo $widgetMenu->display();
340
                            ?>
341
                        </li>
342
                        <li class="nav-item">
343
                            <a class="nav-link" href="<?= Url::to('store/index') ?>"><i class="fa fa-briefcase"></i> <span class="nav-text"><?= __('App store') ?></span></a>
344
                        </li>
345
                    </ul>
346
                </div>
347
                <!-- / left menu -->
348
                <div id="page-content">
349
                    <div class="row page-canvas">
350
                        <div class="col-md-12">
351
                            <div class="card card-default widget animated" style="animation-delay: 0.05s;">
352
                                <div class="card-body content-body">
353
                                    <?php
354
                                    if ($this->section('body')) {
355
                                        // display notifications if exist
356
                                        $notifyMessages = \App::$Session->getFlashBag()->all();
357
                                        if (\Ffcms\Core\Helper\Type\Any::isArray($notifyMessages) && count($notifyMessages) > 0) {
358
                                            foreach ($notifyMessages as $mType => $mArray) {
359
                                                if ($mType === 'error') {
360
                                                    $mType = 'danger';
361
                                                }
362
                                                foreach ($mArray as $mText) {
363
                                                    echo $this->bootstrap()->alert($mType, $mText);
364
                                                }
365
                                            }
366
                                        }
367
                                        echo $this->section('body');
368
                                    } else {
369
                                        echo $this->bootstrap()->alert('warning', __('Page not found!'));
370
                                    }
371
                                    ?>
372
                                </div>
373
                            </div>
374
                        </div>
375
                    </div>
376
377
                    <footer id="footer" class="text-center">
378
                        <p>All rights reserved &copy; <a href="https://ffcms.org">FFCMS</a>, 2016 - <?= date('Y') ?></p>
379
                        <ul class="list-inline">
380
                            <li class="list-inline-item"><a href="https://ffcms.org">Project</a></li>
381
                            <li class="list-inline-item"><a href="https://github.com/phpffcms">Github</a></li>
382
                            <li class="list-inline-item"><a href="https://doc.ffcms.org">Docs</a></li>
383
                            <li class="list-inline-item"><a href="https://ffcms.org/feedback/create">Contact</a></li>
384
                        </ul>
385
                    </footer>
386
                </div>
387
            </div>
388
        </div>
389
    </div>
390
</div>
391
<!-- /#wrapper -->
392
393
<script src="<?= \App::$Alias->scriptUrl ?>/vendor/components/jquery/jquery.min.js"></script>
394
<script src="<?= \App::$Alias->scriptUrl ?>/vendor/phpffcms/ffcms-assets/node_modules/popper.js/dist/umd/popper.min.js"></script>
395
<script src="<?= \App::$Alias->scriptUrl ?>/vendor/twbs/bootstrap/dist/js/bootstrap.min.js"></script>
396
397
<?php if (\App::$Debug): ?>
398
    <?= \App::$Debug->renderOut() ?>
399
<?php endif; ?>
400
401
<?= $this->section('javascript') ?>
402
403
<!-- jQuery code interprier after library loaded -->
404
<script>(function($,d){$.each(readyQ,function(i,f){$(f)});$.each(bindReadyQ,function(i,f){$(d).bind("ready",f)})})(jQuery,document)</script>
405
406
<script>
407
    $(document).ready(function(){
408
        $('.sidebar-collapse').on('click', function(){
409
            $('#page-body').toggleClass('collapsed');
410
        });
411
        $('.sidebar-open').on('click', function(){
412
            $('#page-sidebar').removeClass('toggled');
413
        });
414
        $('.sidebar-close').on('click', function(){
415
            $('#page-sidebar').addClass('toggled');
416
        });
417
418
        $('.nav-stacked').on('show.bs.collapse', function () {
419
            $('.nav-stacked .in').collapse('hide');
420
        });
421
422
        $('[data-toggle="tooltip"]').tooltip()
423
    });
424
</script>
425
</body>
426
</html>