Issues (1313)

views/layouts/base.php (3 issues)

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 multilanguage 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 $this->params['shortLanguage']; ?>"><?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="/<?php echo $this->params['shortLanguage']; ?>/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
                        'shortLanguage' => $this->params['shortLanguage'],
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $this seems to be never defined.
Loading history...
65
                        'linkOptions' => isset($item['items']) && count($item['items']) > 0 ? [
66
                            'class' => 'dropdown-toggle',
67
                            'data-toggle' => 'dropdown',
68
                            'aria-haspopup' => 'true',
69
                            'aria-expanded' => 'false',
70
                        ] : [],
71
                    ];
72
                },
73
                'mainContainerOptions' => [
74
                    'class' => 'dropdown-menu'
75
                ],
76
                'itemContainerOptions' => function ($level, $item) {
77
                    return [
78
                        'class' => isset($item['items']) && count($item['items']) > 0 ? 'dropdown-item dropdown' : 'dropdown-item'
79
                    ];
80
                }
81
            ]) ?>
82
        </li>
83
        <li class="nav-item dropdown <?php if($controllerId=='category'): ?>active<?php endif; ?>">
84
            <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
85
                <?php echo Yii::t('categories', 'Categories') ?>
86
            </a>
87
            <?php echo MenuWidget::widget([
88
                'data' => $this->params['categories'],
89
                'itemTemplate' => '@app/views/menu/categoryItem.php',
90
                'itemTemplateParams' => function ($level, $item) {
91
                    return [
92
                        'shortLanguage' => $this->params['shortLanguage'],
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $this seems to be never defined.
Loading history...
93
                        'linkOptions' => isset($item['items']) && count($item['items']) > 0 ? [
94
                            'class' => 'dropdown-toggle',
95
                            'data-toggle' => 'dropdown',
96
                            'aria-haspopup' => 'true',
97
                            'aria-expanded' => 'false',
98
                        ] : [],
99
                    ];
100
                },
101
                'mainContainerOptions' => [
102
                    'class' => 'dropdown-menu'
103
                ],
104
                'itemContainerOptions' => function ($level, $item) {
105
                    return [
106
                        'class' => isset($item['items']) && count($item['items']) > 0 ? 'dropdown-item dropdown' : 'dropdown-item'
107
                    ];
108
                }
109
            ]) ?>
110
        </li>
111
        <li class="nav-item <?php if($controllerId=='contact'): ?>active<?php endif; ?>">
112
            <a class="nav-link" href="/<?php echo $this->params['shortLanguage']; ?>/contact" ><?php echo Yii::t('contacts', 'Contacts') ?></a>
113
        </li>
114
        <li class="nav-item dropdown">
115
            <a href="#" class="nav-link dropdown-toggle" id="dropdown_languages" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
116
                <?php echo Yii::t('site', 'Languages') ?>
117
            </a>
118
            <?php echo MenuWidget::widget([
119
                'data' => $this->params['languages'],
120
                'itemTemplate' => '@app/views/menu/languageItem.php',
121
                'mainContainerOptions' => [
122
                    'class' => 'dropdown-menu',
123
                    'aria-labelledby' => 'dropdown_languages'
124
                ],
125
                'itemContainerOptions' => [
126
                    'class' => 'dropdown-item'
127
                ],
128
            ]) ?>
129
        </li>
130
        <?php if (Yii::$app->user->isGuest): ?>
131
            <li class="nav-item dropdown">
132
                <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
133
                    <?php echo Yii::t('site', 'Authorize') ?>
134
                </a>
135
                <ul class="dropdown-menu">
136
                    <li class="dropdown-item">
137
                        <a href="/<?php echo $this->params['shortLanguage']; ?>/reg" ><?php echo Yii::t('site', 'Register') ?></a>
138
                    </li>
139
                    <li class="dropdown-item">
140
                        <a href="/<?php echo $this->params['shortLanguage']; ?>/login" ><?php echo Yii::t('site', 'Login') ?></a>
141
                    </li>
142
                </ul>
143
            </li>
144
        <?php else: ?>
145
            <li class="nav-item dropdown">
146
                <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
147
                    <?php echo Yii::t('site', 'Account') ?>
148
                </a>
149
                <ul class="dropdown-menu">
150
                    <li class="dropdown-item">
151
                        <a href="/<?php echo $this->params['shortLanguage']; ?>/admin" ><?php echo Yii::t('site', 'Dashboard') ?></a>
152
                    </li>
153
                    <li class="dropdown-item">
154
                        <a href="/<?php echo $this->params['shortLanguage']; ?>/logout" ><?php echo Yii::t('site', 'Sign out') ?></a>
155
                    </li>
156
                </ul>
157
            </li>
158
        <?php endif; ?>
159
    </ul>
160
161
    <?php NavBar::end(); ?>
162
163
    <div class="container">
164
        <?php if (isset($this->params['breadcrumbs'])): ?>
165
            <section class="full_width breadcrumbs_block clearfix">
166
                <div class="container">
167
                    <div class="breadcrumbs_content">
168
                        <h1 class="pull-left"><?php echo Html::encode($this->title) ?></h1>
169
                        <?php echo Breadcrumbs::widget([
170
                            'tag' => 'ol',
171
                            'options' => [
172
                                'class' => 'pull-right breadcrumb'
173
                            ],
174
                            'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
175
                            'homeLink' => [
176
                                'label' => Yii::t('yii', 'Home'),
177
                                'url' => rtrim(Yii::$app->homeUrl, '/') . '/' . $this->params['shortLanguage'],
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

177
                                'url' => rtrim(/** @scrutinizer ignore-type */ Yii::$app->homeUrl, '/') . '/' . $this->params['shortLanguage'],
Loading history...
178
                            ]
179
                        ]) ?>
180
                    </div>
181
                </div>
182
                <div class="overlay"></div>
183
                <div class="overlay_black"></div>
184
            </section>
185
        <?php endif; ?>
186
187
        <?php echo $content ?>
188
    </div>
189
</div>
190
191
<footer class="footer">
192
    <div class="container">
193
        <div class="row" data-animated="fadeInUp">
194
            <div class="col-lg-7 col-md-8 col-sm-8 padbot30">
195
                <ul class="foot_menu">
196
                    <li <?php if($controllerId=='home'): ?>class="active"<?php endif; ?> >
197
                        <a href="/<?php echo $this->params['shortLanguage']; ?>" alt=""><?php echo Yii::t('app', 'Home') ?></a>
198
                    </li>
199
                    <li <?php if($controllerId=='about'): ?>class="active"<?php endif; ?> >
200
                        <a href="/<?php echo $this->params['shortLanguage']; ?>/about" ><?php echo Yii::t('about', 'About me') ?></a>
201
                    </li>
202
                    <li <?php if($controllerId=='contact'): ?>class="active"<?php endif; ?> >
203
                        <a href="/<?php echo $this->params['shortLanguage']; ?>/contact" ><?php echo Yii::t('contacts', 'Contacts') ?></a>
204
                    </li>
205
                </ul>
206
                <hr>
207
                <?php if (null !== $contacts): ?>
208
                    <ul class="foot_info">
209
                        <?php if (!empty($contacts->{'address_'.$this->params['shortLanguage']})): ?>
210
                            <li><i class="fa fa-home"></i><?php echo $contacts->{'address_'.$this->params['shortLanguage']} ?></li>
211
                        <?php endif; ?>
212
                        <?php if (!empty($contacts->{'phone_'.$this->params['shortLanguage']})): ?>
213
                            <li><i class="fa fa-phone"></i><?php echo $contacts->{'phone_'.$this->params['shortLanguage']} ?></li>
214
                        <?php endif; ?>
215
                        <?php if (!empty($contacts->{'email_'.$this->params['shortLanguage']})): ?>
216
                            <li><i class="fa fa-envelope-o"></i><a href="mailto:<?php echo $contacts->{'email_'.$this->params['shortLanguage']} ?>"><?php echo $contacts->{'email_'.$this->params['shortLanguage']} ?></a></li>
217
                        <?php endif; ?>
218
                    </ul>
219
                <?php endif; ?>
220
            </div>
221
            <div class="col-lg-4 col-md-4 col-sm-4 padbot30 pull-right foot_social_block">
222
                <?php if (null !== $contacts && is_array($contacts->social)): ?>
223
                    <h2><?php echo Yii::t('social', 'Social') ?></h2>
224
                    <hr>
225
                    <div class="social">
226
                        <?php foreach ($contacts->social as $social): ?>
227
                            <a href="<?php echo $social->url ?>" target="_blank" ><i class="<?php echo $social->icon ?>"></i></a>
228
                        <?php endforeach; ?>
229
                    </div>
230
                <?php endif; ?>
231
            </div>
232
        </div>
233
    </div>
234
    <div class="copyright clearfix">
235
        <div class="container">
236
            <div class="padbot20">
237
                <a class="copyright_logo" href="javascript:void(0);"><?php echo Yii::t('app', 'Yii2 multilanguage project template') ?></a> <span> &copy; Copyright <?php echo date('Y') ?></span>
238
            </div>
239
        </div>
240
    </div>
241
</footer>
242
243
<?php $this->endBody() ?>
244
</body>
245
</html>
246
<?php $this->endPage() ?>
247