<?php
/**
 * @copyright (c) Kufer Software GmbH, Oderstraße 7, D-84453 Mühldorf
 */

namespace Kufer\Web\KuferTools\Dozent\KursUebersicht\KursUebersicht;

class KursUebersichtSetFilterController extends KursUebersichtController
{
  protected function getRequestObj()
  {
    $requestObj = parent::getRequestObj();
    if (!$this->isBrowserRefresh()) {
      $requestObj->suchParameter = $this->getFilterFromPost();
      $requestObj->aendereFilter = true;
    }

    return $requestObj;
  }

  protected function getFilterFromPost()
  {
    $tool = 1;
    $suchApi = new \KurssuchAPIwSearch();

    return $suchApi->getSearchParamsFromReq('tool' . $tool, 'searchkurs');
  }

  private function isBrowserRefresh()
  {
    
    return !\RequestOperations::isDefined('search_stichworte');
  }
}