Skip to content

Commit

Permalink
Merge pull request #5 from hnuti-brontosaurus/event-parameters-add-op…
Browse files Browse the repository at this point in the history
…tion-to-change-order-and-hide-started-events

EventParameters: added option to change ordering of events based on s…
  • Loading branch information
dakur authored Jan 30, 2019
2 parents a3809af + 2528c41 commit 41a650e
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/Request/EventParameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,21 @@ final class EventParameters extends Parameters

const PARAM_DATE_FORMAT = 'Y-m-d';

const PARAM_DISPLAY_ALREADY_STARTED_KEY = 'aktualni';
const PARAM_DISPLAY_ALREADY_STARTED_NO = 'od';
const PARAM_DISPLAY_ALREADY_STARTED_YES = 'do';

const PARAM_ORDER_BY_KEY = 'razeni';
const PARAM_ORDER_BY_START_DATE = 'od';
const PARAM_ORDER_BY_END_DATE = 'do';


public function __construct()
{
parent::__construct([
self::PARAM_QUERY => 'akce'
self::PARAM_QUERY => 'akce',
self::PARAM_DISPLAY_ALREADY_STARTED_KEY => self::PARAM_DISPLAY_ALREADY_STARTED_YES,
self::PARAM_ORDER_BY_KEY => self::PARAM_ORDER_BY_END_DATE,
]);
}

Expand Down Expand Up @@ -237,6 +247,24 @@ public function setYear($year)
return $this;
}

/**
* @return self
*/
public function hideTheseAlreadyStarted()
{
$this->params[self::PARAM_DISPLAY_ALREADY_STARTED_KEY] = self::PARAM_DISPLAY_ALREADY_STARTED_NO;
return $this;
}

/**
* @return self
*/
public function orderByStartDate()
{
$this->params[self::PARAM_ORDER_BY_KEY] = self::PARAM_ORDER_BY_START_DATE;
return $this;
}

/**
* @return self
*/
Expand Down

0 comments on commit 41a650e

Please sign in to comment.