Added: There are three file added in reports folder for create the chart date.
This commit is contained in:
parent
68660716a9
commit
0bf35fcefe
7 changed files with 511 additions and 167 deletions
|
@ -1,48 +1,117 @@
|
|||
<?php
|
||||
include '../../includes/admin_config.php';
|
||||
include 'ofc-library/open-flash-chart.php';
|
||||
|
||||
error_reporting(E_ALL);
|
||||
//required_once '../../includes/admin_config.php';
|
||||
require_once('../../includes/admin_config.php');
|
||||
//include 'ofc-library/open-flash-chart.php';
|
||||
|
||||
|
||||
$days = 10;
|
||||
$last_week = time()-86400*$days + 86400;
|
||||
$the_last_week = date('M d', $last_week);
|
||||
$title = new title("ClipBucket Daily Activity ".$the_last_week." - ".date("M d"));
|
||||
$title->set_style("{font-size:14px;font-family:Century Gothic;font-weight:bold}");
|
||||
|
||||
//$title = new title("ClipBucket Daily Activity ".$the_last_week." - ".date("M d"));
|
||||
|
||||
//$title->set_style("{font-size:14px;font-family:Century Gothic;font-weight:bold}");
|
||||
|
||||
$vid_stats = $data['video_stats'];
|
||||
$vid_stats = json_decode($vid_stats);
|
||||
|
||||
|
||||
$year = array();
|
||||
|
||||
//Getting This Weeks Data
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
if($i<$days-1)
|
||||
if($i<$days)
|
||||
{
|
||||
$date_pattern = date("Y-m-d",$last_week+($i*86400));
|
||||
|
||||
//echo "date_added LIKE '%$date_pattern%'";
|
||||
$data = $db->select(tbl("stats"),"*"," date_added LIKE '%$date_pattern%' ",1);
|
||||
$data = $data[0];
|
||||
$data = $data[0];
|
||||
if(!empty($data['video_stats'])){
|
||||
//$data = array(array('1999',3.0),array('2000',3.9),array('2001',2.0),array('2002',1.2));
|
||||
//echo $data['video_stats'];
|
||||
/* [{"label":"videos","data":{"uploads":"3","processing":"555555","active":"6","views":"1","comments":"10"}}];
|
||||
[{"label":"Scores","data":[["1999",3],["2000",3.9],["2001",2],["2002",1.2]]}]*/
|
||||
//$data = json_decode($data['video_stats']);
|
||||
//$array = array('label' => 'videos','data'=>$data['video_stats']);
|
||||
//echo json_encode(array($array));
|
||||
}
|
||||
//echo $data['video_stats'].'spliter'.$data['user_stats'].'spliter'.$data['group_stats'];
|
||||
|
||||
$datas[] = $data;
|
||||
}
|
||||
|
||||
$year[] = date("M d",$last_week+($i*86400));
|
||||
}
|
||||
//Videos
|
||||
echo $_post['videos'];
|
||||
if(isset($_post['videos'])){
|
||||
|
||||
}
|
||||
//Geting the data for Flot Charts
|
||||
|
||||
//videos
|
||||
$videos['uploads'] = $cbvid->get_videos(array("count_only"=>true,"date_added"=>"'%$date_pattern%'"),TRUE);
|
||||
$videos['processing'] = $cbvid->get_videos(array("count_only"=>true,"status"=>"Processing","date_added"=>"'%$date_pattern%'"),TRUE);
|
||||
$videos['active'] = $cbvid->get_videos(array("count_only"=>true,"active"=>"yes","date_added"=>"'%$date_pattern%'"),TRUE);
|
||||
$V = array(array('uploads',$videos['uploads']),array('processing',$videos['processing']),array('active',$videos['active']));
|
||||
|
||||
//Users
|
||||
$users['signups'] = $userquery->get_users(array("count_only"=>true,"date_added"=>"'%$date_pattern%'"));
|
||||
$users['inactive'] = $userquery->get_users(array("count_only"=>true,"date_added"=>"'%$date_pattern%'","status"=>'ToActivate'));
|
||||
$users['active'] = $userquery->get_users(array("count_only"=>true,"date_added"=>"'%$date_pattern%'","status"=>'Ok'));
|
||||
//Views
|
||||
$user_views = $db->select(tbl("users"),"SUM(profile_hits) as total_views"," doj LIKE '%$date_pattern%'");
|
||||
$users['views'] = $user_views[0]['total_views'];
|
||||
//Total Comments
|
||||
$user_comments = $db->select(tbl("users"),"SUM(comments_count) as total_comments"," doj LIKE '%$date_pattern%'");
|
||||
$users['comments'] = $user_comments[0]['total_comments'];
|
||||
|
||||
$U = array(array('signups',$users['signups']),array('inactive',$users['inactive']),array('Active User',$users['active']),array('views User',$users['views']),array('comments User',$users['comments']));
|
||||
|
||||
//Groups
|
||||
$groups['created'] = $cbgroup->get_groups(array("count_only"=>true,"date_added"=>"'%$date_pattern%'"));
|
||||
$groups['active'] = $cbgroup->get_groups(array("count_only"=>true,"date_added"=>"'%$date_pattern%'","active"=>"yes"));
|
||||
//Total Views
|
||||
$group_views = $db->select(tbl("groups"),"SUM(total_views) as the_views"," date_added LIKE '%$date%'");
|
||||
$groups['views'] = $group_views[0]['the_views'];
|
||||
//Total Discussion
|
||||
$group_topics = $db->select(tbl("groups"),"SUM(total_topics) as the_topics"," date_added LIKE '%$date%'");
|
||||
$groups['total_topics'] = $group_topics[0]['the_topics'];
|
||||
//TOtal Comments
|
||||
$group_discussions = $db->select(tbl("group_topics"),"SUM(total_replies) as the_discussions"," date_added LIKE '%$date%'");
|
||||
$groups['total_discussions'] = $group_discussions[0]['the_discussions'];
|
||||
|
||||
|
||||
$G = array(array('created',$groups['created']),array('Groups views',$groups['views']),
|
||||
array('total_topics',$groups['total_topics']),array('total_discussions',$groups['total_discussions']));
|
||||
//Make arrays for json
|
||||
$array_video = array('label' => 'Videos','data'=>$V);
|
||||
|
||||
$array_user = array('label' => 'Users','data'=>$U);
|
||||
|
||||
$array_group = array('label' => 'Groups','data'=>$G);
|
||||
|
||||
echo json_encode(array($array_user,$array_video,$array_group));
|
||||
//echo json_encode(array($array2));
|
||||
|
||||
|
||||
|
||||
//pr($datas,true);
|
||||
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
$day[$i]['video'] = json_decode($datas[$i]['video_stats']);
|
||||
$day[$i]['users'] = json_decode($datas[$i]['user_stats']);
|
||||
$day[$i]['groups'] = json_decode($datas[$i]['group_stats']);
|
||||
|
||||
$day[$i]['groups'] = json_decode($datas[$i]['group_stats']);
|
||||
}
|
||||
|
||||
$max = 1;
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
if($i==$days-1)
|
||||
if($i==$days)
|
||||
{
|
||||
$vid_uploads[] = $cbvid->get_videos(array("count_only"=>true,"date_span"=>"today"))+0;
|
||||
$user_signups[] = $userquery->get_users(array("count_only"=>true,"date_span"=>"today"))+0;
|
||||
|
@ -54,58 +123,16 @@ for($i=0;$i<$days;$i++)
|
|||
}
|
||||
$max = max($max,$vid_uploads[$i],$user_signups[$i],$groups_added[$i]);
|
||||
}
|
||||
//echo $max;
|
||||
//echo $vid_uploads;
|
||||
//echo 'uploads='.json_decode($vid_uploads);
|
||||
//print_r($vid_uploads);
|
||||
|
||||
//echo 'signup='.json_decode($user_signups);
|
||||
|
||||
|
||||
$vid_line = new line();
|
||||
$vid_line->set_values($vid_uploads);
|
||||
$vid_line->colour( '#336600');
|
||||
$vid_line->set_key('Videos', 14);
|
||||
|
||||
|
||||
$user_line = new line();
|
||||
$user_line->set_values($user_signups);
|
||||
$user_line->colour( '#0099cc');
|
||||
$user_line->set_key('User', 14);
|
||||
|
||||
|
||||
$grp_line = new line();
|
||||
$grp_line->set_values($groups_added);
|
||||
$grp_line->colour( '#990000');
|
||||
$grp_line->set_key('Groups', 14);
|
||||
|
||||
|
||||
//echo 'groups_added'.json_decode($groups_added);
|
||||
//pr($vid_uploads,true);
|
||||
$max = $max;
|
||||
$steps = round($max/5,0.49);
|
||||
$y = new y_axis();
|
||||
$y->set_range( 0, $max, $steps);
|
||||
|
||||
|
||||
$chart = new open_flash_chart();
|
||||
$chart->set_title( $title );
|
||||
$chart->add_element( $vid_line );
|
||||
$chart->add_element( $user_line );
|
||||
$chart->add_element( $grp_line );
|
||||
|
||||
$x_labels = new x_axis_labels();
|
||||
$x_labels->set_steps( 1 );
|
||||
$x_labels->set_vertical();
|
||||
$x_labels->set_colour( '#A2ACBA' );
|
||||
$x_labels->set_labels( $year );
|
||||
|
||||
$x = new x_axis();
|
||||
$x->set_colour( '#A2ACBA' );
|
||||
$x->set_grid_colour( '#D7E4A3' );
|
||||
$x->set_offset( false );
|
||||
$x->set_steps(4);
|
||||
// Add the X Axis Labels to the X Axis
|
||||
$x->set_labels( $x_labels );
|
||||
|
||||
$chart->set_x_axis( $x );
|
||||
|
||||
|
||||
$chart->set_y_axis( $y );
|
||||
|
||||
echo $chart->toString();
|
||||
|
||||
?>
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
include '../../includes/admin_config.php';
|
||||
include 'ofc-library/open-flash-chart.php';
|
||||
//include 'ofc-library/open-flash-chart.php';
|
||||
|
||||
$days = 7;
|
||||
$last_week = time()-86400*$days + 86400;
|
||||
$the_last_week = date('M d', $last_week);
|
||||
$title = new title("Groups Stats ".$the_last_week." - ".date("M d"));
|
||||
$title->set_style("{font-size:14px;font-family:Century Gothic;font-weight:bold}");
|
||||
//$title = new title("Groups Stats ".$the_last_week." - ".date("M d"));
|
||||
//$title->set_style("{font-size:14px;font-family:Century Gothic;font-weight:bold}");
|
||||
|
||||
|
||||
$vid_stats = $data['video_stats'];
|
||||
|
@ -18,7 +18,7 @@ $year = array();
|
|||
//Getting This Weeks Data
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
if($i<$days-1)
|
||||
if($i<$days)
|
||||
{
|
||||
$date_pattern = date("Y-m-d",$last_week+($i*86400));
|
||||
$data = $db->select(tbl("stats"),"*"," date_added LIKE '%$date_pattern%' ",1);
|
||||
|
@ -29,7 +29,7 @@ for($i=0;$i<$days;$i++)
|
|||
$year[] = date("M d",$last_week+($i*86400));
|
||||
}
|
||||
|
||||
|
||||
pr($datas,true);
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
$day[$i]['video'] = json_decode($datas[$i]['video_stats'],true);
|
||||
|
@ -56,54 +56,54 @@ for($i=0;$i<$days;$i++)
|
|||
|
||||
|
||||
|
||||
$total_bars = new bar_cylinder();
|
||||
$total_bars->set_values($groups);
|
||||
$total_bars->colour( '#0066ff');
|
||||
$total_bars->key('Total', 14);
|
||||
//$total_bars = new bar_cylinder();
|
||||
//echo 'Groups ='.pr($groups,true);
|
||||
//$total_bars->colour( '#0066ff');
|
||||
//$total_bars->key('Total', 14);
|
||||
|
||||
$active_bars = new bar_cylinder();
|
||||
$active_bars->set_values($active);
|
||||
$active_bars->colour( '#99cc00');
|
||||
$active_bars->key('Active', 14);
|
||||
//$active_bars = new bar_cylinder();
|
||||
//echo 'Groups Active ='.pr($active,true);
|
||||
//$active_bars->colour( '#99cc00');
|
||||
//$active_bars->key('Active', 14);
|
||||
|
||||
$topics_bar = new bar_cylinder();
|
||||
$topics_bar->set_values($topics_bar_data);
|
||||
$topics_bar->colour( '#BF3B69');
|
||||
$topics_bar->key('Topics', 14);
|
||||
//$topics_bar = new bar_cylinder();
|
||||
//echo 'Groups Topics='.pr($topics_bar_data,true);
|
||||
//$topics_bar->colour( '#BF3B69');
|
||||
//$topics_bar->key('Topics', 14);
|
||||
|
||||
|
||||
|
||||
|
||||
//$max = $max+(round($max/2,0.49));
|
||||
/*/$max = $max+(round($max/2,0.49));
|
||||
$steps = round($max/5,0.49);
|
||||
$y = new y_axis();
|
||||
$y->set_range( 0, $max, $steps);
|
||||
//$y->set_range( 0, $max, $steps);
|
||||
|
||||
|
||||
$chart = new open_flash_chart();
|
||||
$chart->set_title( $title );
|
||||
$chart->add_element( $total_bars );
|
||||
$chart->add_element( $active_bars );
|
||||
$chart->add_element( $topics_bar );
|
||||
//$chart = new open_flash_chart();
|
||||
//$chart->set_title( $title );
|
||||
//$chart->add_element( $total_bars );
|
||||
//$chart->add_element( $active_bars );
|
||||
//$chart->add_element( $topics_bar );
|
||||
|
||||
$x_labels = new x_axis_labels();
|
||||
$x_labels->set_steps( 1 );
|
||||
$x_labels->set_colour( '#A2ACBA' );
|
||||
$x_labels->set_labels( $year );
|
||||
//$x_labels = new x_axis_labels();
|
||||
//$x_labels->set_steps( 1 );
|
||||
//$x_labels->set_colour( '#A2ACBA' );
|
||||
//$x_labels->set_labels( $year );
|
||||
|
||||
$x = new x_axis();
|
||||
$x->set_colour( '#A2ACBA' );
|
||||
$x->set_grid_colour( '#D7E4A3' );
|
||||
$x->set_offset( true );
|
||||
$x->set_steps(4);
|
||||
//$x = new x_axis();
|
||||
//$x->set_colour( '#A2ACBA' );
|
||||
//$x->set_grid_colour( '#D7E4A3' );
|
||||
//$x->set_offset( true );
|
||||
//$x->set_steps(4);
|
||||
// Add the X Axis Labels to the X Axis
|
||||
$x->set_labels( $x_labels );
|
||||
//$x->set_labels( $x_labels );
|
||||
|
||||
$chart->set_x_axis( $x );
|
||||
$chart->set_bg_colour('#ffffff');
|
||||
//$chart->set_x_axis( $x );
|
||||
//$chart->set_bg_colour('#ffffff');
|
||||
|
||||
$chart->set_y_axis( $y );
|
||||
|
||||
echo $chart->toString();
|
||||
//$chart->set_y_axis( $y );
|
||||
|
||||
//echo $chart->toString();
|
||||
*/
|
||||
?>
|
86
upload/admin_area/charts/reports/daily_activity_reports.php
Normal file
86
upload/admin_area/charts/reports/daily_activity_reports.php
Normal file
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
//required_once '../../includes/admin_config.php';
|
||||
require_once('../../../includes/admin_config.php');
|
||||
//include 'ofc-library/open-flash-chart.php';
|
||||
|
||||
|
||||
$days = 10;
|
||||
$last_week = time()-86400*$days + 86400;
|
||||
$the_last_week = date('M d', $last_week);
|
||||
|
||||
$vid_stats = $data['video_stats'];
|
||||
$vid_stats = json_decode($vid_stats);
|
||||
|
||||
$year = array();
|
||||
|
||||
//Getting This Weeks Data
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
if($i<$days)
|
||||
{
|
||||
$date_pattern = date("Y-m-d",$last_week+($i*86400));
|
||||
|
||||
//echo "date_added LIKE '%$date_pattern%'";
|
||||
$data = $db->select(tbl("stats"),"*"," date_added LIKE '%$date_pattern%' ",1);
|
||||
$data = $data[0];
|
||||
$datas[] = $data;
|
||||
}
|
||||
|
||||
$year[] = date("M d",$last_week+($i*86400));
|
||||
}
|
||||
//Videos
|
||||
echo $_post['videos'];
|
||||
if(isset($_post['videos'])){
|
||||
|
||||
}
|
||||
$date_pattern = date("Y-m-d");
|
||||
|
||||
$videos['uploads'] = $cbvid->get_videos(array("count_only"=>true,"date_span"=>"today"),TRUE);
|
||||
$videos['processing'] = $cbvid->get_videos(array("count_only"=>true,"status"=>"Processing","date_span"=>"today"),TRUE);
|
||||
$videos['active'] = $cbvid->get_videos(array("count_only"=>true,"active"=>"yes","date_span"=>"today"),TRUE);
|
||||
$V = array(array('uploads',$videos['uploads']),array('processing',$videos['processing']),array('active',$videos['active']));
|
||||
|
||||
|
||||
//Users
|
||||
$users['signups'] = $userquery->get_users(array("count_only"=>true,"date_span"=>"today"));
|
||||
$users['inactive'] = $userquery->get_users(array("count_only"=>true,"date_span"=>"today","status"=>'ToActivate'));
|
||||
$users['active'] = $userquery->get_users(array("count_only"=>true,"date_span"=>"today","status"=>'Ok'));
|
||||
//Views
|
||||
$user_views = $db->select(tbl("users"),"SUM(profile_hits) as total_views"," doj LIKE '%$date%'");
|
||||
//$users['views'] = $user_views[0]['total_views'];
|
||||
//Total Comments
|
||||
$user_comments = $db->select(tbl("users"),"SUM(comments_count) as total_comments"," doj LIKE '%$date%'");
|
||||
//$users['comments'] = $user_comments[0]['total_comments'];
|
||||
|
||||
$U = array(array('signups',$users['signups']),array('inactive',$users['inactive']),array('Active User',$users['active']),array('views User',$users['views']),array('comments User',$users['comments']));
|
||||
|
||||
//Groups
|
||||
$groups['created'] = $cbgroup->get_groups(array("count_only"=>true,"date_span"=>"today"));
|
||||
$groups['active'] = $cbgroup->get_groups(array("count_only"=>true,"date_span"=>"today","active"=>"yes"));
|
||||
//Total Views
|
||||
$group_views = $db->select(tbl("groups"),"SUM(total_views) as the_views"," date_added LIKE '%$date%'");
|
||||
//$groups['views'] = $group_views[0]['the_views'];
|
||||
//Total Discussion
|
||||
$group_topics = $db->select(tbl("groups"),"SUM(total_topics) as the_topics"," date_added LIKE '%$date%'");
|
||||
//$groups['total_topics'] = $group_topics[0]['the_topics'];
|
||||
//TOtal Comments
|
||||
$group_discussions = $db->select(tbl("group_topics"),"SUM(total_replies) as the_discussions"," date_added LIKE '%$date%'");
|
||||
//$groups['total_discussions'] = $group_discussions[0]['the_discussions'];
|
||||
|
||||
|
||||
$G = array(array('created',$groups['created']),array('Active',$groups['active']),
|
||||
array('total_topics',$groups['total_topics']),array('total_discussions',$groups['total_discussions']));
|
||||
//Make arrays for json
|
||||
$array_video = array('label' => 'Videos','data'=>$V);
|
||||
|
||||
$array_user = array('label' => 'Users','data'=>$U);
|
||||
|
||||
$array_group = array('label' => 'Groups','data'=>$G);
|
||||
|
||||
echo json_encode(array($array_user,$array_video,$array_group));
|
||||
//echo json_encode(array($array2));
|
||||
|
||||
|
||||
?>
|
136
upload/admin_area/charts/reports/monthly_activity_reports.php
Normal file
136
upload/admin_area/charts/reports/monthly_activity_reports.php
Normal file
|
@ -0,0 +1,136 @@
|
|||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
//required_once '../../includes/admin_config.php';
|
||||
require_once('../../../includes/admin_config.php');
|
||||
//include 'ofc-library/open-flash-chart.php';
|
||||
|
||||
|
||||
$days = 10;
|
||||
$last_week = time()-86400*$days + 86400;
|
||||
$the_last_week = date('M d', $last_week);
|
||||
|
||||
//$title = new title("ClipBucket Daily Activity ".$the_last_week." - ".date("M d"));
|
||||
|
||||
//$title->set_style("{font-size:14px;font-family:Century Gothic;font-weight:bold}");
|
||||
|
||||
$vid_stats = $data['video_stats'];
|
||||
$vid_stats = json_decode($vid_stats);
|
||||
|
||||
$year = array();
|
||||
|
||||
//Getting This Weeks Data
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
if($i<$days)
|
||||
{
|
||||
$date_pattern = date("Y-m-d",$last_week+($i*86400));
|
||||
|
||||
//echo "date_added LIKE '%$date_pattern%'";
|
||||
$data = $db->select(tbl("stats"),"*"," date_added LIKE '%$date_pattern%' ",1);
|
||||
$data = $data[0];
|
||||
if(!empty($data['video_stats'])){
|
||||
//$data = array(array('1999',3.0),array('2000',3.9),array('2001',2.0),array('2002',1.2));
|
||||
//echo $data['video_stats'];
|
||||
/* [{"label":"videos","data":{"uploads":"3","processing":"555555","active":"6","views":"1","comments":"10"}}];
|
||||
[{"label":"Scores","data":[["1999",3],["2000",3.9],["2001",2],["2002",1.2]]}]*/
|
||||
//$data = json_decode($data['video_stats']);
|
||||
//$array = array('label' => 'videos','data'=>$data['video_stats']);
|
||||
//echo json_encode(array($array));
|
||||
}
|
||||
//echo $data['video_stats'].'spliter'.$data['user_stats'].'spliter'.$data['group_stats'];
|
||||
|
||||
$datas[] = $data;
|
||||
}
|
||||
|
||||
$year[] = date("M d",$last_week+($i*86400));
|
||||
}
|
||||
//Videos
|
||||
echo $_post['videos'];
|
||||
if(isset($_post['videos'])){
|
||||
|
||||
}
|
||||
|
||||
$videos['uploads'] = $cbvid->get_videos(array("count_only"=>true,"date_span"=>"this_month"),TRUE);
|
||||
$videos['processing'] = $cbvid->get_videos(array("count_only"=>true,"status"=>"Processing","date_span"=>"this_month"),TRUE);
|
||||
$videos['active'] = $cbvid->get_videos(array("count_only"=>true,"active"=>"yes","date_span"=>"this_month"),TRUE);
|
||||
$V = array(array('uploads',$videos['uploads']),array('processing',$videos['processing']),array('active',$videos['active']));
|
||||
|
||||
//Users
|
||||
$users['signups'] = $userquery->get_users(array("count_only"=>true,"date_span"=>"this_month"));
|
||||
$users['inactive'] = $userquery->get_users(array("count_only"=>true,"date_span"=>"this_month","status"=>'ToActivate'));
|
||||
$users['active'] = $userquery->get_users(array("count_only"=>true,"date_span"=>"this_month","status"=>'Ok'));
|
||||
//Views
|
||||
$user_views = $db->select(tbl("users"),"SUM(profile_hits) as total_views"," doj LIKE '%$date_pattern%'");
|
||||
//$users['views'] = $user_views[0]['total_views'];
|
||||
//Total Comments
|
||||
$user_comments = $db->select(tbl("users"),"SUM(comments_count) as total_comments"," doj LIKE '%$date_pattern%'");
|
||||
//$users['comments'] = $user_comments[0]['total_comments'];
|
||||
|
||||
$U = array(array('signups',$users['signups']),array('inactive',$users['inactive']),array('Active User',$users['active']),array('views User',$users['views']),array('comments User',$users['comments']));
|
||||
|
||||
//Groups
|
||||
$groups['created'] = $cbgroup->get_groups(array("count_only"=>true,"date_span"=>"this_month"));
|
||||
$groups['active'] = $cbgroup->get_groups(array("count_only"=>true,"date_span"=>"this_month","active"=>"yes"));
|
||||
//Total Views
|
||||
$group_views = $db->select(tbl("groups"),"SUM(total_views) as the_views"," date_added LIKE '%$date%'");
|
||||
//$groups['views'] = $group_views[0]['the_views'];
|
||||
//Total Discussion
|
||||
$group_topics = $db->select(tbl("groups"),"SUM(total_topics) as the_topics"," date_added LIKE '%$date%'");
|
||||
//$groups['total_topics'] = $group_topics[0]['the_topics'];
|
||||
//TOtal Comments
|
||||
$group_discussions = $db->select(tbl("group_topics"),"SUM(total_replies) as the_discussions"," date_added LIKE '%$date%'");
|
||||
//$groups['total_discussions'] = $group_discussions[0]['the_discussions'];
|
||||
|
||||
|
||||
$G = array(array('created',$groups['created']),array('Active',$groups['active']),
|
||||
array('total_topics',$groups['total_topics']),array('total_discussions',$groups['total_discussions']));
|
||||
//Make arrays for json
|
||||
$array_video = array('label' => 'Videos','data'=>$V);
|
||||
|
||||
$array_user = array('label' => 'Users','data'=>$U);
|
||||
|
||||
$array_group = array('label' => 'Groups','data'=>$G);
|
||||
|
||||
echo json_encode(array($array_user,$array_video,$array_group));
|
||||
//echo json_encode(array($array2));
|
||||
|
||||
|
||||
|
||||
//pr($datas,true);
|
||||
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
$day[$i]['video'] = json_decode($datas[$i]['video_stats']);
|
||||
$day[$i]['users'] = json_decode($datas[$i]['user_stats']);
|
||||
$day[$i]['groups'] = json_decode($datas[$i]['group_stats']);
|
||||
}
|
||||
|
||||
$max = 1;
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
if($i==$days)
|
||||
{
|
||||
$vid_uploads[] = $cbvid->get_videos(array("count_only"=>true,"date_span"=>"today"))+0;
|
||||
$user_signups[] = $userquery->get_users(array("count_only"=>true,"date_span"=>"today"))+0;
|
||||
$groups_added[] = $cbgroup->get_groups(array("count_only"=>true,"date_span"=>"today"))+0;
|
||||
}else{
|
||||
$vid_uploads[] =$day[$i]['video']->uploads+0;
|
||||
$user_signups[] =$day[$i]['users']->signups+0;
|
||||
$groups_added[] =$day[$i]['groups']->created+0;
|
||||
}
|
||||
$max = max($max,$vid_uploads[$i],$user_signups[$i],$groups_added[$i]);
|
||||
}
|
||||
//echo $max;
|
||||
//echo $vid_uploads;
|
||||
//echo 'uploads='.json_decode($vid_uploads);
|
||||
//print_r($vid_uploads);
|
||||
|
||||
//echo 'signup='.json_decode($user_signups);
|
||||
|
||||
//echo 'groups_added'.json_decode($groups_added);
|
||||
//pr($vid_uploads,true);
|
||||
$max = $max;
|
||||
$steps = round($max/5,0.49);
|
||||
|
||||
?>
|
136
upload/admin_area/charts/reports/weekly_activity_reports.php
Normal file
136
upload/admin_area/charts/reports/weekly_activity_reports.php
Normal file
|
@ -0,0 +1,136 @@
|
|||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
//required_once '../../includes/admin_config.php';
|
||||
require_once('../../../includes/admin_config.php');
|
||||
//include 'ofc-library/open-flash-chart.php';
|
||||
|
||||
|
||||
$days = 10;
|
||||
$last_week = time()-86400*$days + 86400;
|
||||
$the_last_week = date('M d', $last_week);
|
||||
|
||||
//$title = new title("ClipBucket Daily Activity ".$the_last_week." - ".date("M d"));
|
||||
|
||||
//$title->set_style("{font-size:14px;font-family:Century Gothic;font-weight:bold}");
|
||||
|
||||
$vid_stats = $data['video_stats'];
|
||||
$vid_stats = json_decode($vid_stats);
|
||||
|
||||
$year = array();
|
||||
|
||||
//Getting This Weeks Data
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
if($i<$days)
|
||||
{
|
||||
$date_pattern = date("Y-m-d",$last_week+($i*86400));
|
||||
|
||||
//echo "date_added LIKE '%$date_pattern%'";
|
||||
$data = $db->select(tbl("stats"),"*"," date_added LIKE '%$date_pattern%' ",1);
|
||||
$data = $data[0];
|
||||
if(!empty($data['video_stats'])){
|
||||
//$data = array(array('1999',3.0),array('2000',3.9),array('2001',2.0),array('2002',1.2));
|
||||
//echo $data['video_stats'];
|
||||
/* [{"label":"videos","data":{"uploads":"3","processing":"555555","active":"6","views":"1","comments":"10"}}];
|
||||
[{"label":"Scores","data":[["1999",3],["2000",3.9],["2001",2],["2002",1.2]]}]*/
|
||||
//$data = json_decode($data['video_stats']);
|
||||
//$array = array('label' => 'videos','data'=>$data['video_stats']);
|
||||
//echo json_encode(array($array));
|
||||
}
|
||||
//echo $data['video_stats'].'spliter'.$data['user_stats'].'spliter'.$data['group_stats'];
|
||||
|
||||
$datas[] = $data;
|
||||
}
|
||||
|
||||
$year[] = date("M d",$last_week+($i*86400));
|
||||
}
|
||||
//Videos
|
||||
echo $_post['videos'];
|
||||
if(isset($_post['videos'])){
|
||||
|
||||
}
|
||||
|
||||
$videos['uploads'] = $cbvid->get_videos(array("count_only"=>true,"date_span"=>"this_week"),TRUE);
|
||||
$videos['processing'] = $cbvid->get_videos(array("count_only"=>true,"status"=>"Processing","date_span"=>"this_week"),TRUE);
|
||||
$videos['active'] = $cbvid->get_videos(array("count_only"=>true,"active"=>"yes","date_span"=>"this_week"),TRUE);
|
||||
$V = array(array('uploads',$videos['uploads']),array('processing',$videos['processing']),array('active',$videos['active']));
|
||||
|
||||
//Users
|
||||
$users['signups'] = $userquery->get_users(array("count_only"=>true,"date_span"=>"this_week"));
|
||||
$users['inactive'] = $userquery->get_users(array("count_only"=>true,"date_span"=>"this_week","status"=>'ToActivate'));
|
||||
$users['active'] = $userquery->get_users(array("count_only"=>true,"date_span"=>"this_week","status"=>'Ok'));
|
||||
//Views
|
||||
$user_views = $db->select(tbl("users"),"SUM(profile_hits) as total_views"," doj LIKE '%$date_pattern%'");
|
||||
//$users['views'] = $user_views[0]['total_views'];
|
||||
//Total Comments
|
||||
$user_comments = $db->select(tbl("users"),"SUM(comments_count) as total_comments"," doj LIKE '%$date_pattern%'");
|
||||
//$users['comments'] = $user_comments[0]['total_comments'];
|
||||
|
||||
$U = array(array('signups',$users['signups']),array('inactive',$users['inactive']),array('Active User',$users['active']),array('views User',$users['views']),array('comments User',$users['comments']));
|
||||
|
||||
//Groups
|
||||
$groups['created'] = $cbgroup->get_groups(array("count_only"=>true,"date_span"=>"this_week"));
|
||||
$groups['active'] = $cbgroup->get_groups(array("count_only"=>true,"date_span"=>"this_week","active"=>"yes"));
|
||||
//Total Views
|
||||
$group_views = $db->select(tbl("groups"),"SUM(total_views) as the_views"," date_added LIKE '%$date%'");
|
||||
//$groups['views'] = $group_views[0]['the_views'];
|
||||
//Total Discussion
|
||||
$group_topics = $db->select(tbl("groups"),"SUM(total_topics) as the_topics"," date_added LIKE '%$date%'");
|
||||
//$groups['total_topics'] = $group_topics[0]['the_topics'];
|
||||
//TOtal Comments
|
||||
$group_discussions = $db->select(tbl("group_topics"),"SUM(total_replies) as the_discussions"," date_added LIKE '%$date%'");
|
||||
//$groups['total_discussions'] = $group_discussions[0]['the_discussions'];
|
||||
|
||||
|
||||
$G = array(array('created',$groups['created']),array('Active',$groups['active']),
|
||||
array('total_topics',$groups['total_topics']),array('total_discussions',$groups['total_discussions']));
|
||||
//Make arrays for json
|
||||
$array_video = array('label' => 'Videos','data'=>$V);
|
||||
|
||||
$array_user = array('label' => 'Users','data'=>$U);
|
||||
|
||||
$array_group = array('label' => 'Groups','data'=>$G);
|
||||
|
||||
echo json_encode(array($array_user,$array_video,$array_group));
|
||||
//echo json_encode(array($array2));
|
||||
|
||||
|
||||
|
||||
//pr($datas,true);
|
||||
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
$day[$i]['video'] = json_decode($datas[$i]['video_stats']);
|
||||
$day[$i]['users'] = json_decode($datas[$i]['user_stats']);
|
||||
$day[$i]['groups'] = json_decode($datas[$i]['group_stats']);
|
||||
}
|
||||
|
||||
$max = 1;
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
if($i==$days)
|
||||
{
|
||||
$vid_uploads[] = $cbvid->get_videos(array("count_only"=>true,"date_span"=>"today"))+0;
|
||||
$user_signups[] = $userquery->get_users(array("count_only"=>true,"date_span"=>"today"))+0;
|
||||
$groups_added[] = $cbgroup->get_groups(array("count_only"=>true,"date_span"=>"today"))+0;
|
||||
}else{
|
||||
$vid_uploads[] =$day[$i]['video']->uploads+0;
|
||||
$user_signups[] =$day[$i]['users']->signups+0;
|
||||
$groups_added[] =$day[$i]['groups']->created+0;
|
||||
}
|
||||
$max = max($max,$vid_uploads[$i],$user_signups[$i],$groups_added[$i]);
|
||||
}
|
||||
//echo $max;
|
||||
//echo $vid_uploads;
|
||||
//echo 'uploads='.json_decode($vid_uploads);
|
||||
//print_r($vid_uploads);
|
||||
|
||||
//echo 'signup='.json_decode($user_signups);
|
||||
|
||||
//echo 'groups_added'.json_decode($groups_added);
|
||||
//pr($vid_uploads,true);
|
||||
$max = $max;
|
||||
$steps = round($max/5,0.49);
|
||||
|
||||
?>
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
include '../../includes/admin_config.php';
|
||||
include 'ofc-library/open-flash-chart.php';
|
||||
//include 'ofc-library/open-flash-chart.php';
|
||||
|
||||
$days = 7;
|
||||
$last_week = time()-86400*$days + 86400;
|
||||
$the_last_week = date('M d', $last_week);
|
||||
$title = new title("User Stats ".$the_last_week." - ".date("M d"));
|
||||
$title->set_style("{font-size:14px;font-family:Century Gothic;font-weight:bold}");
|
||||
//$title = new title("User Stats ".$the_last_week." - ".date("M d"));
|
||||
//$title->set_style("{font-size:14px;font-family:Century Gothic;font-weight:bold}");
|
||||
|
||||
|
||||
$vid_stats = $data['video_stats'];
|
||||
|
@ -18,7 +18,7 @@ $year = array();
|
|||
//Getting This Weeks Data
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
if($i<$days-1)
|
||||
if($i<$days)
|
||||
{
|
||||
$date_pattern = date("Y-m-d",$last_week+($i*86400));
|
||||
$data = $db->select(tbl("stats"),"*"," date_added LIKE '%$date_pattern%' ",1);
|
||||
|
@ -29,7 +29,7 @@ for($i=0;$i<$days;$i++)
|
|||
$year[] = date("M d",$last_week+($i*86400));
|
||||
}
|
||||
|
||||
|
||||
pr($datas,true);
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
$day[$i]['video'] = json_decode($datas[$i]['video_stats'],true);
|
||||
|
@ -55,28 +55,28 @@ for($i=0;$i<$days;$i++)
|
|||
|
||||
|
||||
|
||||
$signups_bars = new bar_cylinder();
|
||||
$signups_bars->set_values($signups);
|
||||
$signups_bars->colour( '#0066ff');
|
||||
$signups_bars->key('Signups', 14);
|
||||
//$signups_bars = new bar_cylinder();
|
||||
//pr($signups,ture);
|
||||
//$signups_bars->colour( '#0066ff');
|
||||
//$signups_bars->key('Signups', 14);
|
||||
|
||||
$active_bars = new bar_cylinder();
|
||||
$active_bars->set_values($active);
|
||||
$active_bars->colour( '#99cc00');
|
||||
$active_bars->key('Active', 14);
|
||||
|
||||
$inactivebar = new bar_cylinder();
|
||||
$inactivebar->set_values($inactive);
|
||||
$inactivebar->colour( '#BF3B69');
|
||||
$inactivebar->key('Inactive', 14);
|
||||
//$active_bars = new bar_cylinder();
|
||||
//pr($active,true);
|
||||
//$active_bars->colour( '#99cc00');
|
||||
//$active_bars->key('Active', 14);
|
||||
|
||||
//$inactivebar = new bar_cylinder();
|
||||
//pr($inactive,ture);
|
||||
//$inactivebar->colour( '#BF3B69');
|
||||
//$inactivebar->key('Inactive', 14);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
$max = $max+(round($max/2,0.49));
|
||||
$steps = round($max/5,0.49);
|
||||
$y = new y_axis();
|
||||
$y->set_range( 0, $max, $steps);
|
||||
//$y = new y_axis();
|
||||
//$y->set_range( 0, $max, $steps);
|
||||
|
||||
|
||||
$chart = new open_flash_chart();
|
||||
|
@ -104,5 +104,5 @@ $chart->set_bg_colour('#ffffff');
|
|||
$chart->set_y_axis( $y );
|
||||
|
||||
echo $chart->toString();
|
||||
|
||||
*/
|
||||
?>
|
|
@ -1,12 +1,10 @@
|
|||
<?php
|
||||
include '../../includes/admin_config.php';
|
||||
include 'ofc-library/open-flash-chart.php';
|
||||
//include 'ofc-library/open-flash-chart.php';
|
||||
|
||||
$days = 7;
|
||||
$last_week = time()-86400*$days + 86400;
|
||||
$the_last_week = date('M d', $last_week);
|
||||
$title = new title("Video Stats ".$the_last_week." - ".date("M d"));
|
||||
$title->set_style("{font-size:14px;font-family:Century Gothic;font-weight:bold}");
|
||||
|
||||
|
||||
$vid_stats = $data['video_stats'];
|
||||
|
@ -18,7 +16,7 @@ $year = array();
|
|||
//Getting This Weeks Data
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
if($i<$days-1)
|
||||
if($i<$days)
|
||||
{
|
||||
$date_pattern = date("Y-m-d",$last_week+($i*86400));
|
||||
$data = $db->select(tbl("stats"),"*"," date_added LIKE '%$date_pattern%' ",1);
|
||||
|
@ -29,7 +27,7 @@ for($i=0;$i<$days;$i++)
|
|||
$year[] = date("M d",$last_week+($i*86400));
|
||||
}
|
||||
|
||||
|
||||
pr($datas,true);
|
||||
for($i=0;$i<$days;$i++)
|
||||
{
|
||||
$day[$i]['video'] = json_decode($datas[$i]['video_stats'],true);
|
||||
|
@ -55,54 +53,15 @@ for($i=0;$i<$days;$i++)
|
|||
|
||||
|
||||
|
||||
$total_bars = new bar_cylinder();
|
||||
$total_bars->set_values($uploads);
|
||||
$total_bars->colour( '#0066ff');
|
||||
$total_bars->key('Total', 14);
|
||||
|
||||
$active_bars = new bar_cylinder();
|
||||
$active_bars->set_values($active);
|
||||
$active_bars->colour( '#99cc00');
|
||||
$active_bars->key('Active', 14);
|
||||
|
||||
$processing_bar = new bar_cylinder();
|
||||
$processing_bar->set_values($processing);
|
||||
$processing_bar->colour( '#BF3B69');
|
||||
$processing_bar->key('Processing', 14);
|
||||
//pr($uploads,true);
|
||||
|
||||
//pr($active,true);
|
||||
|
||||
//pr($processing,true);
|
||||
|
||||
|
||||
//$max = $max+(round($max/2,0.49));
|
||||
$steps = round($max/5,0.49);
|
||||
$y = new y_axis();
|
||||
$y->set_range( 0, $max, $steps);
|
||||
//$steps = round($max/5,0.49);
|
||||
|
||||
|
||||
$chart = new open_flash_chart();
|
||||
$chart->set_title( $title );
|
||||
$chart->add_element( $total_bars );
|
||||
$chart->add_element( $active_bars );
|
||||
$chart->add_element( $processing_bar );
|
||||
|
||||
$x_labels = new x_axis_labels();
|
||||
$x_labels->set_steps( 1 );
|
||||
$x_labels->set_colour( '#A2ACBA' );
|
||||
$x_labels->set_labels( $year );
|
||||
|
||||
$x = new x_axis();
|
||||
$x->set_colour( '#A2ACBA' );
|
||||
$x->set_grid_colour( '#D7E4A3' );
|
||||
$x->set_offset( true );
|
||||
$x->set_steps(4);
|
||||
// Add the X Axis Labels to the X Axis
|
||||
$x->set_labels( $x_labels );
|
||||
|
||||
$chart->set_x_axis( $x );
|
||||
$chart->set_bg_colour('#ffffff');
|
||||
|
||||
$chart->set_y_axis( $y );
|
||||
|
||||
echo $chart->toString();
|
||||
|
||||
?>
|
Loading…
Add table
Reference in a new issue