Service
Service
    $searchterm = rex_request('searchterm', 'string', ''); $logicalmode = rex_request('logicalmode', 'string', 'and'); $showmax = rex_request('resultcount', 'int', 10); $searchinIDs = rex_request('searchin', 'array', array()); $traverseSubcats = rex_request('subcats', 'bool', false); if(!empty($searchterm)) { $rexsearch = new RexSearch(); $rexsearch->setLimit(array($start = rex_get('start', 'int', 0), $showmax)); $rexsearch->setLogicalMode($logicalmode); if($traverseSubcats) $rexsearch->searchInCategories(a587_getCategories(true, true, $searchinIDs)); else { $rexsearch->searchInCategories($searchinIDs); } $result = $rexsearch->search($searchterm); if(count($result['simwords']) > 0) { $newsearchString = $result['simwordsnewsearch']; $result = $rexsearch->search($newsearchString); if($result['count'] > 0) echo '

    Meinten Sie '.$newsearchString.'?

    '; } if($result['count'] > 0) { echo '
      '; foreach($result['hits'] as $hit) { switch($hit['type']) { case 'file': $text = $hit['highlightedtext']; // PDF-Datei $filename = explode('/', $hit['filename']); $pdf = OOMedia::getMediaByFileName($filename[count($filename)-1]); echo '
    • '.$pdf->getOrgFileName().'

      '.$text.'

      '.$REX['SERVER'].'files/'.$pdf->getOrgFileName().'

    • '; break; case 'db_column': case 'article': if($hit['type'] == 'db_column') { $text = $hit['article_teaser']; if($hit['table'] == $REX['TABLE_PREFIX'].'article') $hit['fid'] = $hit['values']['id']; } else { $text = $hit['highlightedtext']; } // Artikel oder DB-Spalte aus der Artikel-Tabelle $article = OOArticle::getArticleById($hit['fid']); echo '
    • '.$article->getName().'

      '.$text.'

      '.$REX['SERVER'].rex_getUrl($hit['fid'], $hit['clang']).'

    • '; break; } } echo '
    '; // Pagination if($result['count'] > $showmax) { $self = OOArticle::getArticleById(887); echo '
      '; for($i = 0; ($i*$showmax) < $result['count']; $i++) { if(($i*$showmax) == $start) echo '
    • '.($i+1).'
    • '; else echo '
    • '.($i+1).'
    • '; } echo '
    '; } } else { echo 'Leider nichts gefunden.'; } }