original_string: public function render_results($results, $page, $totalcount, $url, $cat = null) {
          $content = '';
  
          if (\core_search\manager::is_search_area_categories_enabled() && !empty($cat)) {
              $toprow = [];
              foreach (\core_search\manager::get_search_area_categories() as $category) {
                  $taburl = clone $url;
                  $taburl->param('cat', $category->get_name());
                  $taburl->param('page', 0);
                  $taburl->remove_params(['page', 'areaids']);
                  $toprow[$category->get_name()] = new \tabobject($category->get_name(), $taburl, $category->get_visiblename());
              }
  
              if (\core_search\manager::should_hide_all_results_category()) {
                  unset($toprow[\core_search\manager::SEARCH_AREA_CATEGORY_ALL]);
              }
  
              $content .= $this->tabtree($toprow, $cat->get_name());
          }
  
          // Paging bar.
          $perpage = \core_search\manager::DISPLAY_RESULTS_PER_PAGE;
          $content .= $this->output->paging_bar($totalcount, $page, $perpage, $url);
  
          // Results.
          $resultshtml = array();
          foreach ($results as $hit) {
              $resultshtml[] = $this->render_result($hit);
          }
          $content .= \html_writer::tag('div', implode('<hr/>', $resultshtml), array('class' => 'search-results'));
  
          // Paging bar.
          $content .= $this->output->paging_bar($totalcount, $page, $perpage, $url);
  
          return $content;
      }
code: public function render_results($results, $page, $totalcount, $url, $cat = null) {
          $content = '';
  
          if (\core_search\manager::is_search_area_categories_enabled() && !empty($cat)) {
              $toprow = [];
              foreach (\core_search\manager::get_search_area_categories() as $category) {
                  $taburl = clone $url;
                  $taburl->param('cat', $category->get_name());
                  $taburl->param('page', 0);
                  $taburl->remove_params(['page', 'areaids']);
                  $toprow[$category->get_name()] = new \tabobject($category->get_name(), $taburl, $category->get_visiblename());
              }
  
              if (\core_search\manager::should_hide_all_results_category()) {
                  unset($toprow[\core_search\manager::SEARCH_AREA_CATEGORY_ALL]);
              }
  
              $content .= $this->tabtree($toprow, $cat->get_name());
          }
  
          // Paging bar.
          $perpage = \core_search\manager::DISPLAY_RESULTS_PER_PAGE;
          $content .= $this->output->paging_bar($totalcount, $page, $perpage, $url);
  
          // Results.
          $resultshtml = array();
          foreach ($results as $hit) {
              $resultshtml[] = $this->render_result($hit);
          }
          $content .= \html_writer::tag('div', implode('<hr/>', $resultshtml), array('class' => 'search-results'));
  
          // Paging bar.
          $content .= $this->output->paging_bar($totalcount, $page, $perpage, $url);
  
          return $content;
      }
code_tokens: public function render_results ( $ results , $ page , $ totalcount , $ url , $ cat = null ) { $ content = '' ; if ( \ core_search \ manager :: is_search_area_categories_enabled ( ) && ! empty ( $ cat ) ) { $ toprow = [ ] ; foreach ( \ core_search \ manager :: get_search_area_categories ( ) as $ category ) { $ taburl = clone $ url ; $ taburl -> param ( 'cat' , $ category -> get_name ( ) ) ; $ taburl -> param ( 'page' , 0 ) ; $ taburl -> remove_params ( [ 'page' , 'areaids' ] ) ; $ toprow [ $ category -> get_name ( ) ] = new \ tabobject ( $ category -> get_name ( ) , $ taburl , $ category -> get_visiblename ( ) ) ; } if ( \ core_search \ manager :: should_hide_all_results_category ( ) ) { unset ( $ toprow [ \ core_search \ manager :: SEARCH_AREA_CATEGORY_ALL ] ) ; } $ content .= $ this -> tabtree ( $ toprow , $ cat -> get_name ( ) ) ; } // Paging bar. $ perpage = \ core_search \ manager :: DISPLAY_RESULTS_PER_PAGE ; $ content .= $ this -> output -> paging_bar ( $ totalcount , $ page , $ perpage , $ url ) ; // Results. $ resultshtml = array ( ) ; foreach ( $ results as $ hit ) { $ resultshtml [ ] = $ this -> render_result ( $ hit ) ; } $ content .= \ html_writer :: tag ( 'div' , implode ( '<hr/>' , $ resultshtml ) , array ( 'class' => 'search-results' ) ) ; // Paging bar. $ content .= $ this -> output -> paging_bar ( $ totalcount , $ page , $ perpage , $ url ) ; return $ content ; }
docstring: Renders search results.
  
  @param \core_search\document[] $results
  @param int $page Zero based page number.
  @param int $totalcount Total number of results available.
  @param \moodle_url $url
  @param \core_search\area_category|null $cat Selected search are category or null if category functionality is disabled.
  @return string HTML
docstring_tokens: Renders search results .