/**
  * Handle an advanced search
  *
  * @return mixed
  */
 public function advancedAction()
 {
     $view = parent::advancedAction();
     $config = $this->getConfig();
     $ticks = [0, 900, 1800, 1910];
     if (!empty($config->Site->advSearchYearScale)) {
         $ticks = array_map('trim', explode(',', $config->Site->advSearchYearScale));
     }
     $rangeEnd = date('Y', strtotime('+1 year'));
     $range = ['type' => 'date', 'field' => \Finna\Search\Solr\Params::SPATIAL_DATERANGE_FIELD];
     if ($view->saved && ($filter = $view->saved->getParams()->getSpatialDateRangeFilter())) {
         if (isset($filter['from']) && isset($filter['to'])) {
             $range['values'] = [$filter['from'], $filter['to']];
             $range['rangeType'] = $filter['type'];
             if ($ticks[0] > $filter['from']) {
                 $ticks[0] = $filter['from'];
             }
             if ($rangeEnd < $filter['to']) {
                 $rangeEnd = $filter['to'];
             }
         } else {
             $range['values'] = [null, null];
         }
     }
     array_push($ticks, $rangeEnd);
     $range['ticks'] = $ticks;
     $positions = [];
     $position = 0;
     for ($i = 0; $i < count($ticks); $i++) {
         $positions[] = floor($i * 100 / (count($ticks) - 1));
     }
     $range['ticks_positions'] = $positions;
     $view->daterange = [$range];
     return $view;
 }
Exemple #2
0
 /**
  * Render advanced search
  *
  * @return    ViewModel
  */
 public function advancedAction()
 {
     $viewModel = parent::advancedAction();
     $viewModel->options = $this->getServiceLocator()->get('Swissbib\\SearchOptionsPluginManager')->get($this->searchClassId);
     $results = $this->getResultsManager()->get($this->searchClassId);
     $params = $results->getParams();
     $requestParams = new Parameters($this->getRequest()->getQuery()->toArray() + $this->getRequest()->getPost()->toArray());
     //GH: We need this initialization only to handle personal limit an sort settings for logged in users
     $params->initLimitAdvancedSearch($requestParams);
     $viewModel->setVariable('params', $params);
     return $viewModel;
 }
 /**
  * Handle an advanced search
  *
  * @return mixed
  */
 public function advancedAction()
 {
     $view = parent::advancedAction();
     $range = ['type' => 'date', 'field' => \Finna\Search\Solr\Params::SPATIAL_DATERANGE_FIELD];
     if ($view->saved && ($filter = $view->saved->getParams()->getSpatialDateRangeFilter())) {
         if (isset($filter['from']) && isset($filter['to'])) {
             $range['values'] = [$filter['from'], $filter['to']];
             $range['rangeType'] = $filter['type'];
         } else {
             $range['values'] = [null, null];
         }
     }
     $view->daterange = [$range];
     return $view;
 }
Exemple #4
0
 /**
  * Render advanced search
  *
  * @return    ViewModel
  */
 public function advancedAction()
 {
     $viewModel = parent::advancedAction();
     $viewModel->options = $this->getServiceLocator()->get('Swissbib\\SearchOptionsPluginManager')->get($this->searchClassId);
     $results = $this->getResultsManager()->get($this->searchClassId);
     $viewModel->setVariable('params', $results->getParams());
     $mainConfig = $this->getServiceLocator()->get('Vufind\\Config')->get('config');
     $viewModel->adv_search_activeTabId = $mainConfig->Site->adv_search_activeTabId;
     $viewModel->adv_search_useTabs = $mainConfig->Site->adv_search_useTabs;
     $isCatTreeElementConfigured = $mainConfig->Site->displayCatTreeElement;
     $isCatTreeElementConfigured = !empty($isCatTreeElementConfigured) && ($isCatTreeElementConfigured == "true" || $isCatTreeElementConfigured == "1") ? "1" : 0;
     if ($isCatTreeElementConfigured) {
         $treeGenerator = $this->serviceLocator->get('Swissbib\\Hierarchy\\SimpleTreeGenerator');
         $viewModel->classificationTree = $treeGenerator->getTree($viewModel->facetList['navDrsys_Gen']['list'], 'navDrsys_Gen');
     }
     return $viewModel;
 }