[ Index ] |
|
Code source de b2evolution 2.1.0-beta |
1 <?php 2 /** 3 * This file implements the UI view for the User Agents stats. 4 * 5 * This file is part of the evoCore framework - {@link http://evocore.net/} 6 * See also {@link http://sourceforge.net/projects/evocms/}. 7 * 8 * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/} 9 * 10 * {@internal License choice 11 * - If you have received this file as part of a package, please find the license.txt file in 12 * the same folder or the closest folder above for complete license terms. 13 * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/) 14 * then you must choose one of the following licenses before using the file: 15 * - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php 16 * - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php 17 * }} 18 * 19 * {@internal Open Source relicensing agreement: 20 * }} 21 * 22 * @package admin 23 * 24 * @version $Id: _stats_refdomains.view.php,v 1.1 2007/06/25 11:01:03 fplanque Exp $ 25 */ 26 if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' ); 27 28 /** 29 * View funcs 30 */ 31 require_once dirname(__FILE__).'/_stats_view.funcs.php'; 32 33 34 global $blog, $admin_url, $rsc_url; 35 36 global $dtyp_normal, $dtyp_searcheng, $dtyp_aggregator, $dtyp_unknown; 37 38 // For the referring domains list: 39 param( 'dtyp_normal', 'integer', 0, true ); 40 param( 'dtyp_searcheng', 'integer', 0, true ); 41 param( 'dtyp_aggregator', 'integer', 0, true ); 42 param( 'dtyp_unknown', 'integer', 0, true ); 43 44 if( !$dtyp_normal && !$dtyp_searcheng && !$dtyp_aggregator && !$dtyp_unknown ) 45 { // Set default status filters: 46 $dtyp_normal = 1; 47 $dtyp_searcheng = 1; 48 $dtyp_aggregator = 1; 49 $dtyp_unknown = 1; 50 } 51 52 53 echo '<h2>'.T_('Referring domains').'</h2>'; 54 55 $selected_agnt_types = array(); 56 if( $dtyp_normal ) $selected_agnt_types[] = "'normal'"; 57 if( $dtyp_searcheng ) $selected_agnt_types[] = "'searcheng'"; 58 if( $dtyp_aggregator ) $selected_agnt_types[] = "'aggregator'"; 59 if( $dtyp_unknown ) $selected_agnt_types[] = "'unknown'"; 60 $where_clause = ' WHERE dom_type IN ('.implode(',',$selected_agnt_types).')'; 61 62 // Exclude hits of type "self" and "admin": 63 // TODO: fp>implement filter checkboxes, not a hardwired filter 64 //$where_clause .= ' AND hit_referer_type NOT IN ( "self", "admin" )'; 65 66 if( !empty($blog) ) 67 { 68 $where_clause .= ' AND hit_blog_ID = '.$blog; 69 } 70 71 $total_hit_count = $DB->get_var( " 72 SELECT COUNT(*) AS hit_count 73 FROM T_basedomains INNER JOIN T_hitlog ON dom_ID = hit_referer_dom_ID " 74 .$where_clause, 0, 0, 'Get total hit count - referred hits only' ); 75 76 77 // Create result set: 78 $results_sql = " 79 SELECT dom_name, dom_status, dom_type, COUNT( * ) AS hit_count 80 FROM T_basedomains LEFT JOIN T_hitlog ON dom_ID = hit_referer_dom_ID " 81 .$where_clause.' 82 GROUP BY dom_ID '; 83 84 $results_count_sql = " 85 SELECT COUNT( DISTINCT dom_ID ) 86 FROM T_basedomains INNER JOIN T_hitlog ON dom_ID = hit_referer_dom_ID " 87 .$where_clause; 88 89 $Results = & new Results( $results_sql, 'refdom_', '---D', 20, $results_count_sql ); 90 91 92 /** 93 * Callback to add filters on top of the result set 94 * 95 * @param Form 96 */ 97 function filter_basedomains( & $Form ) 98 { 99 global $blog, $dtyp_normal, $dtyp_searcheng, $dtyp_aggregator, $dtyp_unknown; 100 101 $Form->checkbox( 'dtyp_normal', $dtyp_normal, T_('Regular sites') ); 102 $Form->checkbox( 'dtyp_searcheng', $dtyp_searcheng, T_('Search engines') ); 103 $Form->checkbox( 'dtyp_aggregator', $dtyp_aggregator, T_('Feed aggregators') ); 104 $Form->checkbox( 'dtyp_unknown', $dtyp_unknown, T_('Unknown') ); 105 } 106 $Results->filter_area = array( 107 'callback' => 'filter_basedomains', 108 'url_ignore' => 'results_refdom_page,dtyp_normal,dtyp_searcheng,dtyp_aggregator,dtyp_unknown', // ignore page param and checkboxes 109 'presets' => array( 110 'browser' => array( T_('Regular'), '?ctrl=stats&tab=domains&dtyp_normal=1&blog='.$blog ), 111 'robot' => array( T_('Search engines'), '?ctrl=stats&tab=domains&dtyp_searcheng=1&blog='.$blog ), 112 'rss' => array( T_('Aggregators'), '?ctrl=stats&tab=domains&dtyp_aggregator=1&blog='.$blog ), 113 'unknown' => array( T_('Unknown'), '?ctrl=stats&tab=domains&dtyp_unknown=1&blog='.$blog ), 114 'all' => array( T_('All'), '?ctrl=stats&tab=domains&dtyp_normal=1&dtyp_searcheng=1&dtyp_aggregator=1&dtyp_unknown=1&blog='.$blog ), 115 ) 116 ); 117 118 119 $Results->title = T_('Referring domains'); 120 121 $Results->cols[] = array( 122 'th' => T_('Domain name'), 123 'order' => 'dom_name', 124 'td' => '²dom_name²', 125 'total' => '<strong>'.T_('Global total').'</strong>', 126 ); 127 128 $Results->cols[] = array( 129 'th' => T_('Type'), 130 'order' => 'dom_type', 131 'td' => '$dom_type$', 132 'total' => '', 133 ); 134 135 $Results->cols[] = array( 136 'th' => T_('Status'), 137 'order' => 'dom_status', 138 'td' => '$dom_status$', 139 'total' => '', 140 ); 141 142 $Results->cols[] = array( 143 'th' => T_('Hit count'), 144 'order' => 'hit_count', 145 'td_class' => 'right', 146 'total_class' => 'right', 147 'td' => '$hit_count$', 148 'total' => $total_hit_count, 149 ); 150 151 $Results->cols[] = array( 152 'th' => T_('Hit %'), 153 'order' => 'hit_count', 154 'td_class' => 'right', 155 'total_class' => 'right', 156 'td' => '%percentage( #hit_count#, '.$total_hit_count.' )%', 157 'total' => '%percentage( 100, 100 )%', 158 ); 159 160 // Display results: 161 $Results->display(); 162 163 /* 164 * $Log: _stats_refdomains.view.php,v $ 165 * Revision 1.1 2007/06/25 11:01:03 fplanque 166 * MODULES (refactored MVC) 167 * 168 * Revision 1.8 2007/04/26 00:11:13 fplanque 169 * (c) 2007 170 * 171 * Revision 1.7 2007/03/20 09:53:26 fplanque 172 * Letting boggers view their own stats. 173 * + Letthing admins view the aggregate by default. 174 * 175 * Revision 1.6 2006/11/26 01:42:10 fplanque 176 * doc 177 */ 178 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 23:58:50 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |