function piwik_reports_outlinks in Piwik Reports 6
1 string reference to 'piwik_reports_outlinks'
- piwik_reports_menu in ./
piwik_reports.module - Implementation of hook_menu().
File
- ./
piwik_reports.pages.inc, line 402 - Drupal Module: Piwik Reports
Code
function piwik_reports_outlinks() {
global $user;
drupal_add_js(drupal_get_path('module', 'piwik_reports') . '/piwik_reports.js');
// Get basic configuration variables.
$piwik_url = variable_get('piwik_url_http', '');
$piwik_site_id = variable_get('piwik_site_id', '');
$piwik_auth = $user->piwik['piwik_token_auth'];
$period = $_SESSION['piwik_reports_period'];
if ($period == 1) {
// Special handling for "yesterday" = 1.
// The yesterday date value is required.
$date = _piwik_reports_select_period($period);
}
else {
// Otherwise it returns the today date value.
$date = _piwik_reports_select_period(0);
}
$period_name = _piwik_reports_get_period_name($period);
// Create an array of data URL parameters for easier maintenance.
$data1_params = array();
$data1_params['module'] = 'API';
$data1_params['method'] = 'Actions.getOutlinks';
$data1_params['idSite'] = $piwik_site_id;
$data1_params['period'] = $period_name;
$data1_params['date'] = $date;
$data1_params['format'] = 'JSON';
if (!empty($piwik_auth)) {
$data1_params['token_auth'] = $piwik_auth;
}
// Build the data URL with all params.
$data1_url = $piwik_url . '/index.php?' . drupal_query_string_encode($data1_params) . '&jsoncallback=?';
$form = piwik_reports_dateselect_form();
$form['page'] = array(
'#type' => 'hidden',
'#value' => 'actions',
);
$form['url'] = array(
'#type' => 'hidden',
'#value' => $data1_url,
);
$form['content'] = array(
'#type' => 'markup',
'#value' => '<div id="pagestable"></div>',
);
return $form;
}