'admin/logs/monitor', 'title' => t('stats monitor'), 'description' => t('Monitor important stats of your site'), 'callback' => 'monitor_dashboard', 'access' => user_access('access monitor'), 'type' => MENU_NORMAL_ITEM); /* $items[] = array( 'path' => 'admin/logs/monitor'; 'title' => t('site monitor admin'), 'description' => t('Administer the monitor module'), 'callback' => 'monitor_admin', 'access' => user_access('administer monitor')); */ //} return $items; } /** * Administer the monitor module. * Returns the settings form array. function monitor_admin() { } */ /** * Veiw the dashboard. */ function monitor_dashboard() { drupal_set_title('Stats Monitor'); return(monitor_search_terms()); } function monitor_search_terms() { $sql = 'SELECT message, link, COUNT(message) AS count FROM watchdog WHERE type = '. "'search'".' AND uid = 0 GROUP BY message ORDER BY count DESC LIMIT 10'; $result = db_query($sql); $rows = array(); $header = array(t('Search Term'), t('Count'), t('Link')); while ($s = db_fetch_object($result)) { preg_match('!(.*?)!', $s->message, $matches); $rows[] = array($matches[1], $s->count, $s->link); } if ($rows) $output .= theme_table($header, $rows, array('width' => '100%'),t('Anonymous users')); $rows = array(); $sql = 'SELECT message, link, COUNT(message) as count FROM watchdog WHERE type = '. "'search'".' AND uid != 0 GROUP BY message ORDER BY count DESC LIMIT 10'; $result = db_query($sql); while ($s = db_fetch_object($result)) { preg_match('!(.*?)!', $s->message, $matches); $rows[] = array($matches[1], $s->count, $s->link); } if ($rows) $output .= theme_table($header, $rows, array('width' => '100%'),t('Authenticated Users')); return $output; }