DEV: Некоторые упрощения в шаблонах
This commit is contained in:
parent
60f602e55a
commit
fe589ac43d
3 changed files with 14 additions and 60 deletions
|
@ -45,27 +45,12 @@ class ActionModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
$user = UserData::get();
|
||||
$field_id = $type . '_id';
|
||||
if ($type == 'post') {
|
||||
$field_tl = 'post_tl';
|
||||
$field_name = 'post_title';
|
||||
$sql = "SELECT post_id, post_title, post_tl, post_is_deleted FROM posts WHERE post_title LIKE :post_title AND post_is_deleted = 0 AND post_tl = 0 AND post_type = 'post' ORDER BY post_id DESC LIMIT 100";
|
||||
$sql = "SELECT post_id, post_title FROM posts WHERE post_title LIKE :post_title AND post_is_deleted = 0 AND post_tl = 0 AND post_type = 'post' ORDER BY post_id DESC LIMIT 100";
|
||||
} elseif ($type == 'user') {
|
||||
$field_tl = 'trust_level';
|
||||
$field_id = 'id';
|
||||
$field_name = 'login';
|
||||
$sql = "SELECT id, login, trust_level, activated FROM users WHERE activated = 1 AND login LIKE :login";
|
||||
} elseif ($type == 'section') {
|
||||
$field_id = 'facet_id';
|
||||
$field_tl = 'facet_tl';
|
||||
$field_name = 'facet_title';
|
||||
$condition = 'AND facet_user_id = ' . $user['id'];
|
||||
$sql = "SELECT facet_id, facet_title, facet_tl, facet_type FROM facets
|
||||
WHERE facet_title LIKE :facet_title AND facet_type = 'section' $condition ORDER BY facet_count DESC LIMIT 100";
|
||||
} elseif ($type == 'category') {
|
||||
$field_id = 'facet_id';
|
||||
$field_tl = 'facet_tl';
|
||||
$field_name = 'facet_title';
|
||||
$sql = "SELECT facet_id, facet_title, facet_tl, facet_type FROM facets
|
||||
WHERE facet_title LIKE :facet_title AND facet_type = 'category' ORDER BY facet_count DESC LIMIT 100";
|
||||
} else {
|
||||
$condition = '';
|
||||
if (!UserData::checkAdmin()) {
|
||||
|
@ -75,9 +60,8 @@ class ActionModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
}
|
||||
|
||||
$field_id = 'facet_id';
|
||||
$field_tl = 'facet_tl';
|
||||
$field_name = 'facet_title'; // AND facet_type = '$type'
|
||||
$sql = "SELECT facet_id, facet_title, facet_tl, facet_type FROM facets
|
||||
$field_name = 'facet_title';
|
||||
$sql = "SELECT facet_id, facet_title, facet_type FROM facets
|
||||
WHERE facet_title LIKE :facet_title AND facet_type = '$type' $condition ORDER BY facet_count DESC LIMIT 200";
|
||||
}
|
||||
|
||||
|
@ -89,7 +73,6 @@ class ActionModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
$response[] = array(
|
||||
"id" => $list[$field_id],
|
||||
"value" => $list[$field_name],
|
||||
"tl" => $list[$field_tl]
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
<?php if (UserData::checkAdmin()) : ?>
|
||||
<a data-type="answer" data-id="<?= $answer['answer_id']; ?>" class="type-action gray-600">
|
||||
<svg class="icons icon-small"><use xlink:href="/assets/svg/icons.svg#trash"></use></svg>
|
||||
<svg class="icons"><use xlink:href="/assets/svg/icons.svg#trash"></use></svg>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
|
@ -65,7 +65,7 @@
|
|||
|
||||
<?php if (UserData::getUserId() != $answer['answer_user_id'] && UserData::getRegType(config('trust-levels.tl_add_report'))) : ?>
|
||||
<a data-post_id="<?= $post['post_id']; ?>" data-type="answer" data-content_id="<?= $answer['answer_id']; ?>" class="msg-flag gray-600">
|
||||
<svg class="icons icon-small"><use xlink:href="/assets/svg/icons.svg#flag"></use></svg>
|
||||
<svg class="icons"><use xlink:href="/assets/svg/icons.svg#flag"></use></svg>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
@ -171,7 +171,7 @@
|
|||
|
||||
<?php if (UserData::getUserId() != $comment['comment_user_id'] && UserData::getRegType(config('trust-levels.tl_add_report'))) : ?>
|
||||
<a data-post_id="<?= $post['post_id']; ?>" data-type="comment" data-content_id="<?= $comment['comment_id']; ?>" class="msg-flag gray-600">
|
||||
<svg class="icons icon-small"><use xlink:href="/assets/svg/icons.svg#flag"></use></svg>
|
||||
<svg class="icons"><use xlink:href="/assets/svg/icons.svg#flag"></use></svg>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
|
|
@ -7,7 +7,6 @@ $url = url('redirect.facet', ['id' => $fs['facet_id']]);
|
|||
<div class="flex justify-between">
|
||||
<?= __('app.edit_' . $data['type']); ?>
|
||||
<ul class="nav">
|
||||
|
||||
<?= insert(
|
||||
'/_block/navigation/nav',
|
||||
[
|
||||
|
@ -20,7 +19,6 @@ $url = url('redirect.facet', ['id' => $fs['facet_id']]);
|
|||
]
|
||||
]
|
||||
); ?>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +79,6 @@ $url = url('redirect.facet', ['id' => $fs['facet_id']]);
|
|||
</fieldset>
|
||||
|
||||
<?php if ($fs['facet_type'] != 'blog' && UserData::checkAdmin()) : ?>
|
||||
|
||||
<fieldset>
|
||||
<input type="checkbox" name="facet_top_level" <?php if ($fs['facet_top_level'] == 1) : ?>checked <?php endif; ?>> <?= __('app.root_help'); ?>?
|
||||
</fieldset>
|
||||
|
@ -94,31 +91,16 @@ $url = url('redirect.facet', ['id' => $fs['facet_id']]);
|
|||
'help' => __('app.necessarily'),
|
||||
'red' => 'red'
|
||||
]); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($data['high_arr'])) : ?>
|
||||
<div class="box">
|
||||
<h3 class="uppercase-box"><?= __('app.parents'); ?></h3>
|
||||
<?php foreach ($data['high_arr'] as $high) : ?>
|
||||
<a class="flex relative pt5 pb5 items-center hidden gray" href="<?= $url; ?>">
|
||||
<?= Html::image($high['facet_img'], $high['facet_title'], 'img-base', 'logo', 'max'); ?>
|
||||
<?= $high['facet_title']; ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($data['low_arr'])) : ?>
|
||||
<div class="box">
|
||||
<h3 class="uppercase-box"><?= __('app.children'); ?></h3>
|
||||
<?php foreach ($data['low_arr'] as $sub) : ?>
|
||||
<a class="flex relative pt5 pb5 items-center hidden gray" href="<?= $url; ?>">
|
||||
<?= Html::image($sub['facet_img'], $sub['facet_title'], 'img-base', 'logo', 'max'); ?>
|
||||
<?= $sub['facet_title']; ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<h3 class="uppercase-box"><?= __('app.parents'); ?></h3>
|
||||
<?php foreach ($data['high_arr'] as $high) : ?>
|
||||
<a class="flex relative pt5 pb5 items-center hidden gray" href="<?= $url; ?>">
|
||||
<?= Html::image($high['facet_img'], $high['facet_title'], 'img-base mr5', 'logo', 'max'); ?>
|
||||
<?= $high['facet_title']; ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<fieldset>
|
||||
|
@ -156,18 +138,6 @@ $url = url('redirect.facet', ['id' => $fs['facet_id']]);
|
|||
'red' => 'red'
|
||||
]); ?>
|
||||
</fieldset>
|
||||
|
||||
<?php if (!empty($data['high_matching'])) : ?>
|
||||
<div class="box max-w780">
|
||||
<h3 class="uppercase-box"><?= __('app.bound_parents'); ?></h3>
|
||||
<?php foreach ($data['high_matching'] as $low_mat) : ?>
|
||||
<a class="flex relative pt5 pb5 items-center hidden gray" href="<?= $url; ?>">
|
||||
<?= Html::image($low_mat['facet_img'], $low_mat['facet_title'], 'img-base', 'logo', 'max'); ?>
|
||||
<?= $low_mat['facet_title']; ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (UserData::checkAdmin()) : ?>
|
||||
|
@ -180,6 +150,7 @@ $url = url('redirect.facet', ['id' => $fs['facet_id']]);
|
|||
'help' => __('app.necessarily'),
|
||||
]); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<fieldset>
|
||||
<input type="hidden" name="facet_id" value="<?= $fs['facet_id']; ?>">
|
||||
<?= Html::sumbit(__('app.edit')); ?>
|
||||
|
|
Loading…
Reference in a new issue