mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2025-02-02 10:04:52 +00:00
add content locale filter #14
This commit is contained in:
parent
0c26c0ac9b
commit
bbd54b3a14
@ -4,7 +4,20 @@ class AppControllerModuleSearch
|
|||||||
{
|
{
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
$query = empty($_GET['query']) ? false : urldecode($_GET['query']);
|
$query = empty($_GET['query']) ? false : urldecode($_GET['query']);
|
||||||
|
$locale = empty($_GET['locale']) ? 'all' : urldecode($_GET['locale']);
|
||||||
|
|
||||||
|
$locales = [];
|
||||||
|
|
||||||
|
foreach (Environment::config('locales') as $key => $value)
|
||||||
|
{
|
||||||
|
$locales[$key] = (object)
|
||||||
|
[
|
||||||
|
'key' => $key,
|
||||||
|
'value' => $value[0],
|
||||||
|
'active' => $key === $locale // false !== stripos($_SERVER['HTTP_ACCEPT_LANGUAGE'], $key) ? true : false,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
include __DIR__ . '../../../view/theme/default/module/search.phtml';
|
include __DIR__ . '../../../view/theme/default/module/search.phtml';
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,20 @@
|
|||||||
<form class="margin-t-8" name="search" method="get" action="search">
|
<form class="margin-t-8" name="search" method="get" action="search">
|
||||||
<input class="min-width-200-px" type="text" name="query" value="<?php echo $query ?>" placeholder="<?php echo _('keyword, file, extension, hash...') ?>" />
|
<input class="min-width-200-px" type="text" name="query" value="<?php echo $query ?>" placeholder="<?php echo _('Keyword, file, extension, hash...') ?>" />
|
||||||
<input type="submit" value="<?php echo _('search') ?>" />
|
<select class="min-width-120-px" type="text" name="locale">
|
||||||
|
<option value="">
|
||||||
|
<?php echo _('All languages') ?>
|
||||||
|
</option>
|
||||||
|
<?php foreach ($locales as $locale) { ?>
|
||||||
|
<?php if ($locale->active) { ?>
|
||||||
|
<option value="<?php echo $locale->key ?>" selected="selected">
|
||||||
|
<?php echo $locale->value ?>
|
||||||
|
</option>
|
||||||
|
<?php } else { ?>
|
||||||
|
<option value="<?php echo $locale->key ?>">
|
||||||
|
<?php echo $locale->value ?>
|
||||||
|
</option>
|
||||||
|
<?php } ?>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
<input type="submit" value="<?php echo _('Search') ?>" />
|
||||||
</form>
|
</form>
|
@ -413,8 +413,12 @@ a:visited.background-color-hover-night-light:hover {
|
|||||||
width: 180px;
|
width: 180px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.min-width-120-px {
|
||||||
|
min-width: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
.min-width-200-px {
|
.min-width-200-px {
|
||||||
width: 200px;
|
min-width: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 1220px) {
|
@media (max-width: 1220px) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user