Changeset 766 for trunk/admin/stats.php
- Timestamp:
- Apr 25, 2005, 5:41:56 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/stats.php
r724 r766 31 31 include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' ); 32 32 33 $url_img_global_report = PHPWG_ROOT_PATH.'admin/images/global_stats.img.php'; 33 $url_img = PHPWG_ROOT_PATH.'admin/images/'; 34 $nls_value_title = $lang['w_month']; 35 $group_clause = "DATE_FORMAT(date,'%Y-%m') DESC"; 36 $where_clause = "1"; 37 38 if (isset($_GET['month']) && isset($_GET['year']) ) 39 { 40 $url_img .= 'monthly_stats.img.php?year='.$_GET['year'].'&month='.$_GET['month']; 41 $nls_value_title = $lang['w_day']; 42 $group_clause = "DATE_FORMAT(date,'%Y-%m-%d') ASC"; 43 $where_clause = "(YEAR(date) = ".$_GET['year']." AND MONTH(date) = ".$_GET['month']." )"; 44 } 45 else 46 { 47 $url_img .= 'global_stats.img.php'; 48 } 49 34 50 //----------------------------------------------------- template initialization 35 51 $template->set_filenames( array('stats'=>'admin/stats.tpl') ); 36 52 37 53 $template->assign_vars(array( 38 'L_ MONTH'=>$lang['w_month'],54 'L_VALUE'=>$nls_value_title, 39 55 'L_PAGES_SEEN'=>$lang['stats_pages_seen'], 40 56 'L_VISITORS'=>$lang['visitors'], … … 44 60 'L_STAT_MONTHLY_ALT'=>$lang['stats_global_graph_title'], 45 61 46 'IMG_ MONTHLY_REPORT'=>add_session_id($url_img_global_report)62 'IMG_REPORT'=>add_session_id($url_img) 47 63 )); 48 64 … … 50 66 $query = ' 51 67 SELECT DISTINCT COUNT(*) as p, 68 DATE(date) as d, 52 69 MONTH(date) as m, 53 70 YEAR(date) as y 54 71 FROM '.HISTORY_TABLE.' 55 GROUP BY DATE_FORMAT(date,\'%Y-%m\') DESC 56 ;'; 72 WHERE '.$where_clause.' 73 GROUP BY '.$group_clause.';'; 74 57 75 $result = pwg_query( $query ); 58 76 $i=0; 59 77 while ( $row = mysql_fetch_array( $result ) ) 60 78 { 61 $current_month = $row['y']."-"; 62 if ($row['m'] <10) {$current_month.='0';} 63 $current_month .= $row['m']; 79 $where_clause=""; 80 $value = ''; 81 if (isset($_GET['month']) && isset($_GET['year']) ) 82 { 83 $where_clause = "DATE_FORMAT(date,'%Y-%m-%d') = '".$row['d']."'"; 84 $value = substr($row['d'],8,2); 85 } 86 else 87 { 88 $current_month = $row['y']."-"; 89 if ($row['m'] <10) {$current_month.='0';} 90 $current_month .= $row['m']; 91 $where_clause = "DATE_FORMAT(date,'%Y-%m') = '".$current_month."'"; 92 $value = "<a href='".PHPWG_ROOT_PATH."admin.php?page=stats"; 93 $value.= "&year=".$row['y']."&month=".$row['m']."'>"; 94 $value.= $lang['month'][$row['m']].' '.$row['y']; 95 $value.= "</a>"; 96 } 97 64 98 // Number of pictures seen 65 99 $query = ' 66 100 SELECT COUNT(*) as p, 67 68 FROM '.HISTORY_TABLE.'69 WHERE DATE_FORMAT(date,\'%Y-%m\') = \''.$current_month.'\'101 FILE as f 102 FROM '.HISTORY_TABLE.' 103 WHERE '.$where_clause.' 70 104 AND FILE = \'picture\' 71 GROUP BY FILE105 GROUP BY FILE 72 106 ;'; 73 107 $pictures = mysql_fetch_array(pwg_query( $query )); … … 77 111 SELECT COUNT(*) as p, login 78 112 FROM '.HISTORY_TABLE.' 79 WHERE DATE_FORMAT(date,\'%Y-%m\') = \''.$current_month.'\'113 WHERE '.$where_clause.' 80 114 GROUP BY login, IP 81 115 ;'; … … 93 127 $class = ($i % 2)? 'row1':'row2'; $i++; 94 128 95 $template->assign_block_vars(' month',array(96 'MONTH'=>$lang['month'][$row['m']].' '.$row['y'],129 $template->assign_block_vars('statrow',array( 130 'VALUE'=>$value, 97 131 'PAGES'=>$row['p'], 98 132 'VISITORS'=>$nb_visitors,
Note: See TracChangeset
for help on using the changeset viewer.