function seotools_dashboard_page in Drupal SEO Tools 6
Same name and namespace in other branches
- 7 seotools.report.inc \seotools_dashboard_page()
1 string reference to 'seotools_dashboard_page'
- seotools_menu in ./
seotools.module - Implementation of hook_menu()
File
- ./
seotools.report.inc, line 4
Code
function seotools_dashboard_page($rid = 'dashboard', $range = 30) {
//Check that kwresearch and linkintel are install as this will crash if not.
// check enabled modules
$enabled_modules = array(
'linkintel' => module_exists('linkintel'),
'kwresearch' => module_exists('kwresearch'),
'google_analytics_api' => module_exists('google_analytics_api'),
'seo_friend' => module_exists('seo_friend'),
);
if (module_exists('google_analytics_reports')) {
if (!variable_get('google_analytics_reports_profile_id', 0)) {
$enabled_modules['google_analytics_reports'] = FALSE;
$msg = t('You enable full dashboard reporting you need to !link.', array(
'!link' => l(t('set your Google Analytics ID'), 'admin/settings/google-analytics-reports', array(
'attributes' => array(
'target' => 'google_analytics_api',
),
)),
));
drupal_set_message($msg, 'warning');
}
}
else {
$enabled_modules['google_analytics_reports'] = FALSE;
$msg = t('You enable full dashboard reporting you need to !link.', array(
'!link' => l(t('enable the Google Analytics API module.'), 'http://drupal.org/project/google_analytics_reports', array(
'attributes' => array(
'target' => 'drupal.org',
),
)),
));
drupal_set_message($msg, 'warning');
}
if (!$enabled_modules['google_analytics_api']) {
$msg = t('SEO Tools has not been configured properly. Please go to ' . l('seotools presets', 'admin/presets/seotools') . ' and ensure that it is configured properly.');
drupal_set_message($msg, 'error');
return t('Unable to generate dashboard.');
}
drupal_add_css(drupal_get_path('module', 'seotools') . '/seotools.css');
drupal_add_js(drupal_get_path('module', 'seotools') . '/seotools.js');
$gid = variable_get('google_analytics_reports_profile_id', 0);
if (!$gid) {
return t('Google Analytics id not set.');
}
global $base_url;
$siteURL = variable_get('seotools_base_url', $base_url);
$e = explode('-', $range);
if (count($e) == 1) {
$date_range = seotools_get_dates($range);
}
else {
// TODO allow custom ranges
}
$labels = array(
'keywords' => t('keywords'),
);
if ($rid == 'dashboard') {
$output .= '<div id="seotools-dashboard">' . "\n";
$output .= '<div id="dashboard-pane-top">' . "\n";
$output .= seotools_dashboard_analytics_box($gid, $siteURL, $date_range, $enabled_modules);
$output .= '</div>' . "\n";
$output .= '<div id="dashboard-pane-left">' . "\n";
$output .= seotools_dashboard_keywords_box($gid, $siteURL, $date_range, $enabled_modules);
$output .= seotools_dashboard_sources_box($gid, $siteURL, $date_range, $enabled_modules, $mediums_data);
$output .= seotools_dashboard_map_box($gid, $siteURL, $date_range, $enabled_modules, $mediums_data);
$output .= '</div>' . "\n";
$output .= '<div class="dashboard-spacer"> </div>';
$output .= '<div id="dashboard-pane-right">' . "\n";
$output .= seotools_dashboard_entrances_box($gid, $siteURL, $date_range, $enabled_modules);
$output .= seotools_dashboard_referrers_box($gid, $siteURL, $date_range, $enabled_modules, $mediums_data);
$output .= seotools_dashboard_pageviews_box($gid, $siteURL, $date_range, $enabled_modules, $mediums_data);
$output .= '</div>' . "\n";
$output .= '</div>' . "\n";
}
else {
$output .= seotools_generate_report_top_and_trends($rid, $labels[$rid], 'full', $gid, $siteURL, $date_range, $enabled_modules);
}
return $output;
}