function forward_tracking in Forward 5
Same name and namespace in other branches
- 6 forward.module \forward_tracking()
- 7 forward.module \forward_tracking()
- 7.2 forward.module \forward_tracking()
Forward Tracking Page
1 string reference to 'forward_tracking'
- forward_menu in ./
forward.module - Menu Hooks
File
- ./
forward.module, line 843
Code
function forward_tracking() {
$output = '<p><strong>' . variable_get('forward_total', 0) . '</strong> ' . t('emails sent to') . ' <strong>' . variable_get('forward_recipients', 0) . '</strong> ' . t('recipients') . '</p>';
/**
* Most Forwarded Nodes
*/
$output .= '<h2>Most Forwarded Nodes</h2>';
$rows = array();
$header = array(
array(
'data' => t('Title'),
),
array(
'data' => t('Path'),
),
array(
'data' => t('Forwards'),
),
array(
'data' => t('Clickthroughs'),
),
);
$result = db_query('SELECT n.title, f.* FROM {forward_statistics} f LEFT JOIN {node} n ON f.nid = n.nid ORDER BY f.forward_count DESC LIMIT 10');
if (db_num_rows($result)) {
while ($log = db_fetch_object($result)) {
$_path = drupal_get_path_alias('node/' . $log->nid);
$title = $log->nid ? $log->title : 'Front Page';
$rows[] = array(
l(_forward_column_width($title), $_path),
l($_path, $_path),
$log->forward_count,
$log->clickthrough_count,
);
}
$output .= theme('table', $header, $rows);
}
else {
$output = '<p>' . t('No one has used Forward yet.') . '</p>';
}
/**
* Most Clickthroughs
*/
$output .= '<h2>Most Clickthroughs (nodes only)</h2>';
$rows = array();
$header = array(
array(
'data' => t('Title'),
),
array(
'data' => t('Path'),
),
array(
'data' => t('Forwards'),
),
array(
'data' => t('Clickthroughs'),
),
);
$result = db_query('SELECT n.title, f.* FROM {forward_statistics} f LEFT JOIN {node} n ON f.nid = n.nid ORDER BY f.clickthrough_count DESC LIMIT 10');
if (db_num_rows($result)) {
while ($log = db_fetch_object($result)) {
$_path = drupal_get_path_alias('node/' . $log->nid);
$title = $log->nid ? $log->title : 'Front Page';
$rows[] = array(
l(_forward_column_width($title), $_path),
l($_path, $_path),
$log->forward_count,
$log->clickthrough_count,
);
}
$output .= theme('table', $header, $rows);
}
else {
$output = '<p>' . t('No one has used Forward yet.') . '</p>';
}
/**
* Recently Forwarded Pages
*/
$output .= '<h2>Recently Forwarded Pages</h2>';
$rows = array();
$header = array(
array(
'data' => t('Time'),
'field' => 'timestamp',
'sort' => 'desc',
),
array(
'data' => t('Type'),
'field' => 'type',
),
array(
'data' => t('Path'),
),
);
$result = pager_query('SELECT * FROM {forward_log}' . tablesort_sql($header), 30, 0, null);
if (db_num_rows($result)) {
while ($log = db_fetch_object($result)) {
$_path = drupal_get_path_alias($log->path);
//menu_set_active_item($_path);
//$content = new stdClass();
//$content->title = menu_get_active_title();
$rows[] = array(
array(
'data' => format_date($log->timestamp, 'small'),
'nowrap' => 'nowrap',
),
$log->type,
l($_path, $_path),
);
}
if ($pager = theme('pager', null, 30, 0)) {
$rows[] = array(
array(
'data' => $pager,
'colspan' => '3',
),
);
}
$output .= theme('table', $header, $rows);
}
else {
$output = '<p>' . t('No one has used Forward yet.') . '</p>';
}
print theme('page', $output);
drupal_set_title(t('Forward Tracking'));
}