<?php
/**
 * @file
 * Default theme implementation for displaying search results.
 *
 * This template collects each invocation of theme_search_result(). This and
 * the child template are dependent to one another sharing the markup for
 * definition lists.
 *
 * Note that modules and themes may implement their own search type and theme
 * function completely bypassing this template.
 *
 * Available variables:
 * - $result_count: Number of results.
 * - $spellcheck: Possible spelling suggestions from Search spellcheck module.
 * - $search_results: All results rendered as list items in a single HTML string.
 * - $items: All results as it is rendered through search-result.tpl.php.
 * - $search_performance: The number of results and how long the query took.
 * - $sec: The number of seconds it took to run the query.
 * - $pager: Row of control buttons for navigating between pages of results.
 * - $index:
 * - $keys: The keywords of the executed search.
 * - $page_machine_name: Machine name of the current Search API Page.
 *
 * View Mode is set in the Search page settings. If you select
 * "Themed as search results", then the child template will be used for
 * theming the individual result. Any other view mode will bypass the
 * child template.
 *
 * @see template_preprocess_search_api_page_results()
 */

?>
<?php //dsm($index, 'index'); ?>
<?php //dsm($search_performance, 'search_performance'); ?>
<?php //dsm($result_count, 'result_count'); ?>

<?php //if (!empty($result_count)) : ?>
  <div class="materiobase-results <?php print ' view-mode-' . $variables['view_mode'];?>">
    <?php if ($result_count) : ?>
      <p class="search-performance"><?php print render($search_performance); ?></p>
      <?php //print render($spellcheck); ?>
      <div class="search-results">
        <?php //dsm($items, '$items'); ?>
        <?php 
        // TODO: use cache system to gain in speed, view http://drupal.org/node/930760
        ?>
        <?php print render(entity_view($index->item_type, $items, $variables['view_mode'])); ?>
      </div>
      <?php print $pager; ?>
    <?php else : ?>
      <p class="search-noresults"><?php print t('Your search yielded no results.');?></p>
    <?php endif; ?>
  </div>
<?php //endif; ?>
