Esempio n. 1
0
 protected function getfeeddata($start, $limit, $city, $bydays, $filter_type = '', $keyword = '', $bytype = '', $location = '', $sort_by = 2)
 {
     $Search = new \WH\Model\Solr();
     $Search->setParam('bycity', $city);
     $Search->setParam('start', $start);
     $Search->setParam('limit', $limit);
     $Search->setParam('byType', $bytype);
     $Search->setParam('bysort', Params::getSort(2));
     $Search->setParam('byLocation', $location);
     $Search->setParam('mm', 3);
     $Search->setSolrType('search');
     if (strtolower($bydays) != 'all') {
         $Search->setParam('byDays', ucwords(strtolower($bydays)));
     }
     if ($filter_type == 'tags') {
         $Search->setParam('byTags', strtolower($keyword));
     } else {
         $Search->setParam('searchname', $keyword);
     }
     if ($keyword == '') {
         $Search->setParam('sponsored', 'true');
         $Search->setParam('spstart', $start);
         $Search->setParam('splimit', $limit);
     }
     if (isset($keyword) && $keyword != '') {
         if ($filter_type == 'tags') {
             $sort_by = 2;
         } else {
             $sort_by = 1;
         }
     } else {
         if (isset($bydays) && strtolower($bydays) != 'all') {
             $sort_by = 4;
         } else {
             $sort_by = 2;
         }
     }
     $Search->setParam('bysort', $sort_by);
     $Search->setSearchEntity();
     $entityresult = $Search->getSearchResults();
     if ($entityresult) {
         foreach ($entityresult['results'] as $key => $entity) {
             if (!empty($entity['image']['uri'])) {
                 if (substr($entity['image']['uri'], 0, 4) != 'http') {
                     $entityresult['results'][$key]['image']['uri'] = $this->getimageendpoint() . $entityresult['results'][$key]['image']['uri'];
                 }
             }
             //$entityresult['results'][$key]['slug'] = $this->create_slug($entity['title']).'-'.str_replace('_', '-', strtolower($entity['id']));
         }
     }
     return $entityresult;
 }