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

View/Admin/default/content/category_update.php (1 issue)

Labels
Severity
1
<?php
2
3
use Ffcms\Core\Helper\Type\Str;
4
use Ffcms\Templex\Url\Url;
0 ignored issues
show
This use statement conflicts with another class in this namespace, Url. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
5
6
/** @var \Ffcms\Templex\Template\Template $this */
7
/** @var Apps\Model\Admin\Content\FormCategoryUpdate $model */
8
9
$this->layout('_layouts/default', [
10
    'title' => __('Category manage'),
11
    'breadcrumbs' => [
12
        Url::to('main/index') => __('Main'),
13
        Url::to('application/index') => __('Applications'),
14
        Url::to('content/categories') => __('Categories'),
15
        __('Category manage')
16
    ]
17
]);
18
?>
19
20
<?php $this->start('body') ?>
21
22
<?= $this->insert('content/_tabs') ?>
23
24
<h1><?= __('Category manage') ?></h1>
25
26
<?php $form = $this->form($model) ?>
27
<?= $form->start() ?>
28
29
<?php
30
$menu = $this->bootstrap()->nav('ul', ['class' => 'nav-tabs']);
31
foreach (\App::$Properties->get('languages') as $lang) {
32
    $menu->menu([
33
        'text' => Str::upperCase($lang),
34
        'tab' => function() use ($form, $lang) {
35
            return $form->fieldset()->text('title.' . $lang, null, __('Enter category title, visible for users')) .
36
                $form->fieldset()->text('description.' . $lang, null, __('Enter category description'));
37
        },
38
        'tabActive' => $lang === \App::$Request->getLanguage()
39
    ]);
40
}
41
?>
42
43
<div class="nav-border">
44
    <?= $menu->display() ?>
45
</div>
46
47
<?php
48
if ($model->id === 1) { // general category (root) - no remove/rename/etc sh@t
49
    echo $form->fieldset()->text('path', ['disabled' => null], __('Enter category path slug for URI building'));
50
} else {
51
    echo $form->fieldset()->select('dependId', ['options' => $model->categoryList(), 'optionsKey' => true]);
52
    echo $form->fieldset()->text('path', null, __('Enter category path slug for URI building'));
53
}
54
?>
55
56
<?= $form->fieldset()->boolean('configs.showDate', null, __('Display dates of content in this category?')) ?>
57
<?= $form->fieldset()->boolean('configs.showRating', null, __('Display rating for items in this category?'))?>
58
<?= $form->fieldset()->boolean('configs.showCategory', null, __('Display current category for content?')) ?>
59
<?= $form->fieldset()->boolean('configs.showSimilar', null, __('Show the similar content items for this category? This option introduce additional system load and memory usage.')) ?>
60
<?= $form->fieldset()->boolean('configs.showAuthor', null, __('Display information about content authors in this category?')) ?>
61
<?= $form->fieldset()->boolean('configs.showViews', null, __('Display information about content view count in this category?')) ?>
62
<?= $form->fieldset()->boolean('configs.showComments', null, __('Display comment list and comment form in this category?')) ?>
63
<?= $form->fieldset()->boolean('configs.showPoster', null, __('Display content poster from gallery in this category?')) ?>
64
<?= $form->fieldset()->boolean('configs.showTags', null, __('Display tag list, based on keywords data?')) ?>
65
<?= $form->fieldset()->boolean('configs.showRss', null, __('Allow display RSS 2.0 feed for this category?')) ?>
66
67
<?= $form->button()->submit(__('Save'), ['class' => 'btn btn-primary']) ?>
68
<?= $form->button()->cancel(__('Cancel'), ['class' => 'btn btn-secondary', 'link' => ['content/categories']]) ?>
69
70
<?= $form->stop() ?>
71
72
<?php $this->stop() ?>
73