You are here

function seotools_dashboard_entrances_box in Drupal SEO Tools 7

Same name and namespace in other branches
  1. 6 seotools.report.inc \seotools_dashboard_entrances_box()
1 call to seotools_dashboard_entrances_box()
seotools_dashboard_page in ./seotools.report.inc

File

./seotools.report.inc, line 863

Code

function seotools_dashboard_entrances_box($gid, $siteURL, $date_range, $enabled_modules) {
  $output = '<h3 class="content">' . t('Entry pages') . '</h3>';
  $links[] = l(t('report'), 'admin/content/seotools/entrances');
  $links[] = l(t('analytics'), 'https://www.google.com/analytics/reporting/entrances', array(
    'query' => "id={$gid}",
    'attributes' => array(
      'target' => 'googleanalytics',
    ),
  ));
  $links[] = l(t('optimize'), 'admin/reports/seo/contentanalysis', array(
    'query' => "sort=desc&order=Quick+SEO",
    'attributes' => array(
      'target' => 'seo_friend',
    ),
  ));
  $links[] = l(t('html suggestions'), 'https://www.google.com/webmasters/tools/html-suggestions', array(
    'query' => "siteUrl={$siteURL}#",
    'attributes' => array(
      'target' => 'googlewebmastertools',
    ),
  ));
  $links[] = l(t('crawl errors'), 'https://www.google.com/webmasters/tools/crawl-errors', array(
    'query' => "siteUrl={$siteURL}#",
    'attributes' => array(
      'target' => 'googlewebmastertools',
    ),
  ));
  $output .= '<div class="dashboard-links">';
  $output .= implode(' | ', $links);
  $output .= '</div>';
  $output .= seotools_generate_report_top_and_trends('entrances', t('landing pages'), $mode, $gid, $siteURL, $date_range, $enabled_modules);

  // By priority report
  if ($enabled_modules['linkintel']) {
    $header[] = array(
      'data' => t('Priority'),
      'field' => 'effective_priority',
      'sort' => 'desc',
    );
    $result = linkintel_load_filtered_pages_result($filter, $options, $header = array(), $limit = 100000);
    $counts = array(
      'top' => 0,
      'high' => 0,
      'standard' => 0,
      'total' => 0,
    );
    while ($row = db_fetch_object($result)) {
      $counts['total']++;
      if ($row->effective_priority > 80) {
        $counts['top']++;
      }
      else {
        if ($row->effective_priority > 60) {
          $counts['high']++;
        }
        else {
          if ($row->effective_priority > 40) {
            $counts['standard']++;
          }
        }
      }
    }
    $rows = array();
    $header = array(
      array(
        'data' => t('By priority'),
        'class' => 'label-header',
      ),
      array(
        'data' => t('Count'),
        'class' => 'numeric-header',
      ),
    );
    $rows[] = array(
      l(t('All prioritized pages'), 'admin/content/linkintel/pages'),
      array(
        'data' => number_format($counts['total']),
        'class' => 'numeric-cell',
      ),
    );
    $rows[] = array(
      '&nbsp;&nbsp;' . l(t('Top'), 'admin/content/linkintel/pages', array(
        'query' => 'filters={"priority":90}',
        'attributes' => array(
          'target' => 'linkintel',
        ),
      )),
      array(
        'data' => number_format($counts['top']),
        'class' => 'numeric-cell',
      ),
    );
    $rows[] = array(
      '&nbsp;&nbsp;' . l(t('High'), 'admin/content/linkintel/pages', array(
        'query' => 'filters={"priority":70}',
        'attributes' => array(
          'target' => 'linkintel',
        ),
      )) . '|' . l(t('& up'), 'admin/content/linkintel/pages', array(
        'query' => 'filters={"priority":{"1":90,"2":70}}',
        'attributes' => array(
          'target' => 'linkintel',
        ),
      )),
      array(
        'data' => number_format($counts['high']),
        'class' => 'numeric-cell',
      ),
    );
    $rows[] = array(
      '&nbsp;&nbsp;' . l(t('Standard'), 'admin/content/linkintel/pages', array(
        'query' => 'filters={"priority":50}',
        'attributes' => array(
          'target' => 'linkintel',
        ),
      )) . '|' . l(t('& up'), 'admin/content/linkintel/pages', array(
        'query' => 'filters={"priority":{"1":90,"2":70,"3":50}}',
        'attributes' => array(
          'target' => 'linkintel',
        ),
      )),
      array(
        'data' => number_format($counts['standard']),
        'class' => 'numeric-cell',
      ),
    );
    $output .= theme('table', $header, $rows, array(
      'id' => 'seotools-dashboard-link-box',
    ));
  }
  return $output;
}