Skip to content

Commit

Permalink
refactor: rename dta and dtb parameters
Browse files Browse the repository at this point in the history
They are now named min and max respectively, which is hopefully less
cryptic.
  • Loading branch information
micgro42 committed Mar 29, 2018
1 parent ec27794 commit 422bbbc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions inc/Action/Search.php
Expand Up @@ -64,8 +64,8 @@ public function tplContent()
protected function execute()
{
global $INPUT, $QUERY;
$after = $INPUT->str('dta');
$before = $INPUT->str('dtb');
$after = $INPUT->str('min');
$before = $INPUT->str('max');
$this->pageLookupResults = ft_pageLookup($QUERY, true, useHeading('navigation'), $after, $before);
$this->fullTextResults = ft_pageSearch($QUERY, $highlight, $INPUT->str('srt'), $after, $before);
$this->highlight = $highlight;
Expand Down
12 changes: 6 additions & 6 deletions inc/Ui/Search.php
Expand Up @@ -69,11 +69,11 @@ protected function getSearchFormHTML($query)
$searchForm->setHiddenField('do', 'search');
$searchForm->setHiddenField('id', $ID);
$searchForm->setHiddenField('sf', '1');
if ($INPUT->has('dta')) {
$searchForm->setHiddenField('dta', $INPUT->str('dta'));
if ($INPUT->has('min')) {
$searchForm->setHiddenField('min', $INPUT->str('min'));
}
if ($INPUT->has('dtb')) {
$searchForm->setHiddenField('dtb', $INPUT->str('dtb'));
if ($INPUT->has('max')) {
$searchForm->setHiddenField('max', $INPUT->str('max'));
}
if ($INPUT->has('srt')) {
$searchForm->setHiddenField('srt', $INPUT->str('srt'));
Expand Down Expand Up @@ -421,7 +421,7 @@ protected function addDateSelector(Form $searchForm)
];
$activeOption = 'any';
foreach ($options as $key => $option) {
if ($INPUT->str('dta') === $option['after']) {
if ($INPUT->str('min') === $option['after']) {
$activeOption = $key;
break;
}
Expand All @@ -430,7 +430,7 @@ protected function addDateSelector(Form $searchForm)
$searchForm->addTagOpen('div')->addClass('toggle')->attr('aria-haspopup', 'true');
// render current
$currentWrapper = $searchForm->addTagOpen('div')->addClass('current');
if ($INPUT->has('dtb') || $INPUT->has('dta')) {
if ($INPUT->has('max') || $INPUT->has('min')) {
$currentWrapper->addClass('changed');
}
$searchForm->addHTML($options[$activeOption]['label']);
Expand Down
8 changes: 4 additions & 4 deletions inc/Ui/SearchState.php
Expand Up @@ -20,10 +20,10 @@ public function __construct(array $parsedQuery)

$this->parsedQuery = $parsedQuery;
if (!isset($parsedQuery['after'])) {
$this->parsedQuery['after'] = $INPUT->str('dta');
$this->parsedQuery['after'] = $INPUT->str('min');
}
if (!isset($parsedQuery['before'])) {
$this->parsedQuery['before'] = $INPUT->str('dtb');
$this->parsedQuery['before'] = $INPUT->str('max');
}
if (!isset($parsedQuery['sort'])) {
$this->parsedQuery['sort'] = $INPUT->str('srt');
Expand Down Expand Up @@ -126,10 +126,10 @@ public function getSearchLink($label)
);
$hrefAttributes = ['do' => 'search', 'sf' => '1', 'q' => $newQuery];
if ($parsedQuery['after']) {
$hrefAttributes['dta'] = $parsedQuery['after'];
$hrefAttributes['min'] = $parsedQuery['after'];
}
if ($parsedQuery['before']) {
$hrefAttributes['dtb'] = $parsedQuery['before'];
$hrefAttributes['max'] = $parsedQuery['before'];
}
if ($parsedQuery['sort']) {
$hrefAttributes['srt'] = $parsedQuery['sort'];
Expand Down

0 comments on commit 422bbbc

Please sign in to comment.