Pressemitteilungen

AddSolrParam('fq', '-lang:en'); $search->AddSolrParam('fq', 'docMetaPagetype:Pressemitteilung'); $search->SetSmartyTitle('Aktuelle Pressemeldungen'); $search->SetSmartyTemplate('teaserlist.tpl'); //Filter $daterange = ''; $dr = ''; $sort = ''; $sortby = 'Relevanz'; $type = ''; $itemsperpage = 15; if (isset($_POST['ipp'])) $itemsperpage = $_POST['ipp']; if (isset($_GET['ipp'])) $itemsperpage = $_GET['ipp']; if (isset($_GET['dr'])) $dr = strtolower($_GET['dr']); if (isset($_POST['dr'])) $dr = strtolower($_POST['dr']); if (in_array($dr, array('l2w','l1m','l3m','l1y','custom'))) $daterange = $dr; $filterPastOrFuture = 'past'; $dateRangeSolrFilter = array( 'l2w' => 'docDate:[NOW-14DAYS/DAY TO NOW/DAY+1DAY]', 'l1m' => 'docDate:[NOW-1MONTH/DAY TO NOW/DAY+1DAY]', 'l3m' => 'docDate:[NOW-3MONTHS/DAY TO NOW/DAY+1DAY]', 'l1y' => 'docDate:[NOW-1YEAR/DAY TO NOW/DAY+1DAY]', ); if($filterPastOrFuture == 'future'){ $dateRangeSolrFilter = array( 'l2w' => 'docMetaDateStart:[NOW/DAY TO NOW+14DAYS/DAY]', 'l1m' => 'docMetaDateStart:[NOW/DAY TO NOW+1MONTH/DAY]', 'l3m' => 'docMetaDateStart:[NOW/DAY TO NOW+3MONTHS/DAY]', 'l1y' => 'docMetaDateStart:[NOW/DAY TO NOW+1YEAR/DAY]', ); } switch ($daterange) { case 'l2w': $search->AddSolrParam('fq', $dateRangeSolrFilter[$daterange]); break; case 'l1m': $search->AddSolrParam('fq', $dateRangeSolrFilter[$daterange]); break; case 'l3m': $search->AddSolrParam('fq', $dateRangeSolrFilter[$daterange]); break; case 'l1y': $search->AddSolrParam('fq', $dateRangeSolrFilter[$daterange]); break; case 'custom': $dateRangeFrom = null; if(isset($_GET['date-range-from'])) $dateRangeFrom = $_GET['date-range-from']; if(isset($_POST['date-range-from'])) $dateRangeFrom = $_POST['date-range-from']; $dateRangeTo = null; if(isset($_GET['date-range-to'])) $dateRangeTo = $_GET['date-range-to']; if(isset($_POST['date-range-to'])) $dateRangeTo = $_POST['date-range-to']; if(!empty($dateRangeFrom) && !empty($dateRangeTo)){ $_dateRangeFrom = DateTime::createFromFormat('d.m.Y', $dateRangeFrom); $_dateRangeTo = DateTime::createFromFormat('d.m.Y', $dateRangeTo); if($_dateRangeFrom !== false && $_dateRangeTo !== false){ $dateRangeFrom = $_dateRangeFrom->format('Y-m-d\T23:59:59.999\Z'); $dateRangeTo = $_dateRangeTo->format('Y-m-d\T00:00:00\Z'); $search->AddSolrParam('fq', "docMetaDateStart:[$dateRangeFrom TO $dateRangeTo]"); } } break; } //Nach Datum oder Relevanz sortieren if(isset($_POST['sort']) || isset($_GET['sort'])){ if(isset($_POST['sort'])) $sortby = $_POST['sort']; if(isset($_GET['sort'])) $sortby = $_GET['sort']; } if(!isset($sortby) || empty($sortby)){ $search->AddSolrParam('sort', 'docDate desc, docMetaDate desc'); } $data_category = array(); if(isset($_POST['category']) || isset($_GET['category'])){ $category_data = array(); if (isset($_GET['category'])) $category_data[] = $_GET['category']; if (isset($_POST['category'])) $category_data[] = $_POST['category']; $i = 0; $fq_category = ""; foreach( $category_data[0] as $category ) { if($i==0){ $fq_category .= "docMetaCategory:".$category; $data_category[str_replace("ä", "ae", $category)] = $category; }else{ $fq_category .= " OR docMetaCategory:".$category; $data_category[str_replace("ä", "ae", $category)] = $category; } $i++; } $search->AddSolrParam('fq', $fq_category); } $search->SetSmartyCustomValues( array( 'daterange' => $daterange, 'action_url' => '/de/suche.php', 'sortby' => $sortby, 'pagesize' => $itemsperpage, 'data_category' => $data_category, ) ); $search->SetConfig( array( 'itemsperpage' => $itemsperpage, 'smarty' => array( 'caching' => true ) ) ); $search->SetDebug(FALSE); $search->Search('',0,'','',TRUE); $eventResults = $search->getResult(); $futureEventResults = array(); $pastEventResults = array(); foreach($eventResults as $result){ if(isset($result['docMetaDateStart'])){ $eventDate = DateTime::createFromFormat('Y-m-d\TH:m:sP', $result['docMetaDateStart']); if($eventDate->format('Y-m-d') >= date('Y-m-d')){ $futureEventResults[$eventDate->format('U')] = $result; } else { $pastEventResults[$eventDate->format('U')] = $result; } } } ksort($futureEventResults); ksort($pastEventResults); $pastEventResults = array_reverse($pastEventResults); $eventResults = $futureEventResults; if(count($pastEventResults) > 0) $eventResults[] = array('HTML' => '

Vergangene Termine


'); foreach($pastEventResults as $pastEventResult){ $eventResults[] = $pastEventResult; } $search->setResult($eventResults); echo $search->Output; ?>