function forward_tracking in Forward 6
Same name and namespace in other branches
- 5 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 1139
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_range('SELECT n.title, f.* FROM {forward_statistics} f LEFT JOIN {node} n ON f.nid = n.nid ORDER BY f.forward_count DESC', 0, 10);
$num_rows = FALSE;
while ($log = db_fetch_object($result)) {
$num_rows = TRUE;
$_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,
);
}
if ($num_rows) {
$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_range('SELECT n.title, f.* FROM {forward_statistics} f LEFT JOIN {node} n ON f.nid = n.nid ORDER BY f.clickthrough_count DESC', 0, 10);
$num_rows = FALSE;
while ($log = db_fetch_object($result)) {
$num_rows = TRUE;
$_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,
);
}
if ($num_rows) {
$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'),
'field' => 'path',
),
array(
'data' => t('User ID'),
'field' => 'uid',
),
array(
'data' => t('Hostname'),
'field' => 'hostname',
),
);
$result = pager_query('SELECT f.timestamp, f.type, f.path, f.uid, u.name, f.hostname FROM {forward_log} f INNER JOIN {users} u ON f.uid = u.uid' . tablesort_sql($header), 30, 0, NULL);
$num_rows = FALSE;
while ($log = db_fetch_object($result)) {
$num_rows = TRUE;
$_path = drupal_get_path_alias($log->path);
$rows[] = array(
array(
'data' => format_date($log->timestamp, 'small'),
'nowrap' => 'nowrap',
),
$log->type,
l($_path, $_path),
l($log->name, 'user/' . $log->uid),
$log->hostname,
);
}
if ($num_rows) {
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'));
}