diff ad.pages.inc @ 1:948362c2a207 ad

update advertisement
author pierre
date Thu, 02 Apr 2009 15:28:21 +0000
parents d8a3998dac8e
children
line wrap: on
line diff
--- a/ad.pages.inc	Fri Feb 20 14:04:09 2009 +0000
+++ b/ad.pages.inc	Thu Apr 02 15:28:21 2009 +0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: ad.pages.inc,v 1.1.2.6 2009/02/16 23:12:28 jeremy Exp $
+// $Id: ad.pages.inc,v 1.1.2.6.2.2 2009/02/28 23:39:47 jeremy Exp $
 
 /**
  * @file
@@ -11,11 +11,11 @@
 
 function theme_node_ad($node, $yield_form = TRUE) {
   $output = '';
-  if (ad_adaccess($node, 'access statistics')) {
+  if (ad_permission($node, 'access statistics')) {
     $output = theme('ad_status_display', $node);
     $output .= theme('ad_statistics_display', ad_statistics($node->nid));
   }
-  if (ad_adaccess($node, 'access click history')) {
+  if (ad_permission($node, 'access click history')) {
     $header = array(
       array('data' => t('Time'), 'field' => 'timestamp', 'sort' => 'desc'),
       array('data' => t('User'), 'field' => 'uid'),
@@ -26,8 +26,8 @@
     }
     $header[] = '';
 
-    if ($node->nid) {
-      $sql = "SELECT cid, timestamp, uid, status, url FROM {ad_clicks} WHERE aid = %d";
+    if (isset($node->nid) && $node->nid > 0) {
+      $sql = "SELECT cid, timestamp, uid, status, hostname, url FROM {ad_clicks} WHERE aid = %d";
       $sql .= tablesort_sql($header);
       $result = pager_query($sql, 25, 0, NULL, $node->nid);
 
@@ -178,7 +178,7 @@
     }
   }
   if (empty($rows) || (!$statistics['global']['views'] && !$statistics['global']['clicks'])) {
-    $statistics = '<p>'. t('There are no any statistics yet.') .'</p>';
+    $statistics = '<p>'. t('There are currently no statistics for this advertisement.') .'</p>';
   }
   else {
     $statistics = theme('table', $header, $rows);
@@ -187,7 +187,9 @@
   return theme('box', t('Statistics'), $statistics);
 }
 
-
+/**
+ * Display details about a specific click.
+ */
 function ad_click_details($node, $cid) {
   drupal_set_breadcrumb(array(l(t('Home'), NULL), l(check_plain($node->title), 'node/'. $node->nid)));
   if ($click = db_fetch_object(db_query('SELECT * FROM {ad_clicks} WHERE cid = %d', $cid))) {