summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Borg <wolff_borg@users.sourceforge.net>2008-07-25 14:59:11 +0000
committerStephan Borg <wolff_borg@users.sourceforge.net>2008-07-25 14:59:11 +0000
commit7312ea8789905236b3604599565642392f960423 (patch)
tree80e76fdb1c71f23d00b79345ce84b8c20052bd2c
parent5b01439c5815377e01aeb929e5fd143c1ce08807 (diff)
downloadstats-7312ea8789905236b3604599565642392f960423.tar.gz
stats-7312ea8789905236b3604599565642392f960423.tar.bz2
stats-7312ea8789905236b3604599565642392f960423.zip
Standardised data output when single or multiple graphs.
-rw-r--r--Statistics.php20
1 files changed, 7 insertions, 13 deletions
diff --git a/Statistics.php b/Statistics.php
index e48ed76..27e60fb 100644
--- a/Statistics.php
+++ b/Statistics.php
@@ -1,8 +1,8 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_stats/Statistics.php,v 1.3 2007/09/22 12:10:32 threna Exp $
+ * $Header: /cvsroot/bitweaver/_bit_stats/Statistics.php,v 1.4 2008/07/25 14:59:11 wolff_borg Exp $
*
- * $Id: Statistics.php,v 1.3 2007/09/22 12:10:32 threna Exp $
+ * $Id: Statistics.php,v 1.4 2008/07/25 14:59:11 wolff_borg Exp $
* @package stats
*/
@@ -301,11 +301,10 @@ class Statistics extends BitBase {
ON (lc.`content_id` = liberty_content_hits.`content_id`)
WHERE `content_type_guid`=?
ORDER BY `hits` DESC";
- $result = $this->mDb->query( $query, array( $pContentTypeGuid ), 159 );
+ $result = $this->mDb->query( $query, array( $pContentTypeGuid ), 40 );
// this is needed to ensure all arrays have same size
- $tmpHash[] = array( NULL, 0 );
while( $res = $result->fetchRow() ) {
- $tmpHash[] = array(
+ $tmpHash = array(
$res['title'],
$res['hits'],
);
@@ -323,23 +322,18 @@ class Statistics extends BitBase {
ORDER BY `hits` DESC";
$result = $this->mDb->query( $query, array( $contentType['content_type_guid'] ), 40 );
// this is needed to ensure all arrays have same size
- $ret['data'][$contentType['content_type_guid']] = array_fill( 0, 40, array( NULL, NULL ));
$i = 0;
+ $tmpHash = array( NULL, NULL );
while( $res = $result->fetchRow() ) {
- $ret['data'][$contentType['content_type_guid']][$i++] = array(
+ $tmpHash = array(
$res['title'],
$res['hits'],
);
}
+ $ret['data'][$contentType['content_type_guid']] = array_chunk( $tmpHash, 40 );
}
$ret['title'] = 'All Content';
}
- $ret['max'] = $this->mDb->getOne( "
- SELECT MAX(`hits`)
- FROM `".BIT_DB_PREFIX."liberty_content` lc
- LEFT OUTER JOIN `".BIT_DB_PREFIX."liberty_content_hits` liberty_content_hits
- ON (lc.`content_id` = liberty_content_hits.`content_id`)
- ");
return $ret;
}
}