You are here

protected function Referers::_setReferersCondition in Visitors 8.2

Build sql query from referer type value.

1 call to Referers::_setReferersCondition()
Referers::_getData in src/Controller/Report/Referers.php
Returns a table content.

File

src/Controller/Report/Referers.php, line 158
Contains Drupal\visitors\Controller\Report\Referers.

Class

Referers

Namespace

Drupal\visitors\Controller\Report

Code

protected function _setReferersCondition(&$query) {
  switch ($_SESSION['referer_type']) {
    case REFERER_TYPE_INTERNAL_PAGES:
      $query
        ->condition('visitors_referer', sprintf('%%%s%%', $_SERVER['HTTP_HOST']), 'LIKE');
      $query
        ->condition('visitors_referer', '', '<>');
      break;
    case REFERER_TYPE_EXTERNAL_PAGES:
      $query
        ->condition('visitors_referer', sprintf('%%%s%%', $_SERVER['HTTP_HOST']), 'NOT LIKE');
      break;
    default:
      break;
  }
  return $query;
}