Issues (1256)

views/layouts/base.php (1 issue)

Labels
Severity
1
<?php
2
use yii\helpers\Html;
3
use yii\bootstrap\NavBar;
4
use yii\widgets\Breadcrumbs;
5
use app\assets\AppAsset;
6
use app\models\Contact;
7
use Itstructure\MultiLevelMenu\MenuWidget;
8
9
$contacts = $this->params['contacts'];
10
$controllerId = $this->params['controllerId'];
11
12
/* @var \yii\web\View $this */
13
/* @var string $content */
14
/* @var Contact $contacts */
15
16
AppAsset::register($this);
17
?>
18
<?php $this->beginPage() ?>
19
<!DOCTYPE html>
20
<html lang="<?php echo Yii::$app->language; ?>">
21
<head>
22
    <meta charset="<?php echo Yii::$app->charset; ?>">
23
    <title><?php echo Html::encode($this->title); ?></title>
24
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
25
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
26
    <?php echo Html::csrfMetaTags(); ?>
27
28
    <!--<link rel="shortcut icon" href="/images/favicon.ico">-->
29
    <link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
30
31
    <?php $this->head() ?>
32
</head>
33
<body>
34
<?php $this->beginBody() ?>
35
36
<?php echo $this->render('preloader') ?>
37
38
<div class="wrap">
39
    <?php
40
    NavBar::begin([
41
        'brandLabel' => Yii::t('app', 'Yii2 simple project template'),
42
        'brandUrl' => Yii::$app->homeUrl,
43
        'options' => [
44
            'class' => 'navbar navbar-inverse navbar-fixed-top',
45
        ],
46
    ]); ?>
47
48
    <ul class="nav navbar-nav navbar-right">
49
        <li class="nav-item <?php if($controllerId=='home'): ?>active<?php endif; ?>">
50
            <a class="nav-link" href="/"><?php echo Yii::t('app', 'Home') ?></a>
51
        </li>
52
        <li class="nav-item <?php if($controllerId=='about'): ?>active<?php endif; ?>">
53
            <a class="nav-link" href="/about"><?php echo Yii::t('about', 'About') ?></a>
54
        </li>
55
        <li class="nav-item dropdown <?php if($controllerId=='page'): ?>active<?php endif; ?>">
56
            <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
57
                <?php echo Yii::t('pages', 'Pages') ?>
58
            </a>
59
            <?php echo MenuWidget::widget([
60
                'data' => $this->params['pages'],
61
                'itemTemplate' => '@app/views/menu/pageItem.php',
62
                'itemTemplateParams' => function ($level, $item) {
63
                    return [
64
                        'linkOptions' => isset($item['items']) && count($item['items']) > 0 ? [
65
                            'class' => 'dropdown-toggle',
66
                            'data-toggle' => 'dropdown',
67
                            'aria-haspopup' => 'true',
68
                            'aria-expanded' => 'false',
69
                        ] : [],
70
                    ];
71
                },
72
                'mainContainerOptions' => [
73
                    'class' => 'dropdown-menu'
74
                ],
75
                'itemContainerOptions' => function ($level, $item) {
76
                    return [
77
                        'class' => isset($item['items']) && count($item['items']) > 0 ? 'dropdown-item dropdown' : 'dropdown-item'
78
                    ];
79
                }
80
            ]) ?>
81
        </li>
82
        <li class="nav-item dropdown <?php if($controllerId=='category'): ?>active<?php endif; ?>">
83
            <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
84
                <?php echo Yii::t('categories', 'Categories') ?>
85
            </a>
86
            <?php echo MenuWidget::widget([
87
                'data' => $this->params['categories'],
88
                'itemTemplate' => '@app/views/menu/categoryItem.php',
89
                'itemTemplateParams' => function ($level, $item) {
90
                    return [
91
                        'linkOptions' => isset($item['items']) && count($item['items']) > 0 ? [
92
                            'class' => 'dropdown-toggle',
93
                            'data-toggle' => 'dropdown',
94
                            'aria-haspopup' => 'true',
95
                            'aria-expanded' => 'false',
96
                        ] : [],
97
                    ];
98
                },
99
                'mainContainerOptions' => [
100
                    'class' => 'dropdown-menu'
101
                ],
102
                'itemContainerOptions' => function ($level, $item) {
103
                    return [
104
                        'class' => isset($item['items']) && count($item['items']) > 0 ? 'dropdown-item dropdown' : 'dropdown-item'
105
                    ];
106
                }
107
            ]) ?>
108
        </li>
109
        <li class="nav-item <?php if($controllerId=='contact'): ?>active<?php endif; ?>">
110
            <a class="nav-link" href="/contact" ><?php echo Yii::t('contacts', 'Contacts') ?></a>
111
        </li>
112
        <?php if (Yii::$app->user->isGuest): ?>
113
            <li class="nav-item dropdown">
114
                <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
115
                    <?php echo Yii::t('site', 'Authorize') ?>
116
                </a>
117
                <ul class="dropdown-menu">
118
                    <li class="dropdown-item">
119
                        <a href="/reg" ><?php echo Yii::t('site', 'Register') ?></a>
120
                    </li>
121
                    <li class="dropdown-item">
122
                        <a href="/login" ><?php echo Yii::t('site', 'Login') ?></a>
123
                    </li>
124
                </ul>
125
            </li>
126
        <?php else: ?>
127
            <li class="nav-item dropdown">
128
                <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
129
                    <?php echo Yii::t('site', 'Account') ?>
130
                </a>
131
                <ul class="dropdown-menu">
132
                    <li class="dropdown-item">
133
                        <a href="/admin" ><?php echo Yii::t('site', 'Dashboard') ?></a>
134
                    </li>
135
                    <li class="dropdown-item">
136
                        <a href="/logout" ><?php echo Yii::t('site', 'Sign out') ?></a>
137
                    </li>
138
                </ul>
139
            </li>
140
        <?php endif; ?>
141
    </ul>
142
143
    <?php NavBar::end(); ?>
144
145
    <div class="container">
146
        <?php if (isset($this->params['breadcrumbs'])): ?>
147
            <section class="full_width breadcrumbs_block clearfix">
148
                <div class="container">
149
                    <div class="breadcrumbs_content">
150
                        <h1 class="pull-left"><?php echo Html::encode($this->title) ?></h1>
151
                        <?php echo Breadcrumbs::widget([
152
                            'tag' => 'ol',
153
                            'options' => [
154
                                'class' => 'pull-right breadcrumb'
155
                            ],
156
                            'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
157
                            'homeLink' => [
158
                                'label' => Yii::t('yii', 'Home'),
159
                                'url' => rtrim(Yii::$app->homeUrl, '/'),
0 ignored issues
show
It seems like Yii::app->homeUrl can also be of type null and object; however, parameter $string of rtrim() 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

159
                                'url' => rtrim(/** @scrutinizer ignore-type */ Yii::$app->homeUrl, '/'),
Loading history...
160
                            ]
161
                        ]) ?>
162
                    </div>
163
                </div>
164
                <div class="overlay"></div>
165
                <div class="overlay_black"></div>
166
            </section>
167
        <?php endif; ?>
168
169
        <?php echo $content ?>
170
    </div>
171
</div>
172
173
<footer class="footer">
174
    <div class="container">
175
        <div class="row" data-animated="fadeInUp">
176
            <div class="col-lg-7 col-md-8 col-sm-8 padbot30">
177
                <ul class="foot_menu">
178
                    <li <?php if($controllerId=='home'): ?>class="active"<?php endif; ?> >
179
                        <a href="/" alt=""><?php echo Yii::t('app', 'Home') ?></a>
180
                    </li>
181
                    <li <?php if($controllerId=='about'): ?>class="active"<?php endif; ?> >
182
                        <a href="/about" ><?php echo Yii::t('about', 'About me') ?></a>
183
                    </li>
184
                    <li <?php if($controllerId=='contact'): ?>class="active"<?php endif; ?> >
185
                        <a href="/contact" ><?php echo Yii::t('contacts', 'Contacts') ?></a>
186
                    </li>
187
                </ul>
188
                <hr>
189
                <?php if (null !== $contacts): ?>
190
                    <ul class="foot_info">
191
                        <?php if (!empty($contacts->address)): ?>
192
                            <li><i class="fa fa-home"></i><?php echo $contacts->address ?></li>
193
                        <?php endif; ?>
194
                        <?php if (!empty($contacts->phone)): ?>
195
                            <li><i class="fa fa-phone"></i><?php echo $contacts->phone ?></li>
196
                        <?php endif; ?>
197
                        <?php if (!empty($contacts->email)): ?>
198
                            <li><i class="fa fa-envelope-o"></i><a href="mailto:<?php echo $contacts->email ?>"><?php echo $contacts->email ?></a></li>
199
                        <?php endif; ?>
200
                    </ul>
201
                <?php endif; ?>
202
            </div>
203
            <div class="col-lg-4 col-md-4 col-sm-4 padbot30 pull-right foot_social_block">
204
                <?php if (null !== $contacts && is_array($contacts->social)): ?>
205
                    <h2><?php echo Yii::t('social', 'Social') ?></h2>
206
                    <hr>
207
                    <div class="social">
208
                        <?php foreach ($contacts->social as $social): ?>
209
                            <a href="<?php echo $social->url ?>" target="_blank" ><i class="<?php echo $social->icon ?>"></i></a>
210
                        <?php endforeach; ?>
211
                    </div>
212
                <?php endif; ?>
213
            </div>
214
        </div>
215
    </div>
216
    <div class="copyright clearfix">
217
        <div class="container">
218
            <div class="padbot20">
219
                <a class="copyright_logo" href="javascript:void(0);"><?php echo Yii::t('app', 'Yii2 project simple template') ?></a> <span> &copy; Copyright <?php echo date('Y') ?></span>
220
            </div>
221
        </div>
222
    </div>
223
</footer>
224
225
<?php $this->endBody() ?>
226
</body>
227
</html>
228
<?php $this->endPage() ?>
229