Passed
Push — master ( df5b6f...0d9957 )
by Mihail
05:31
created

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

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