1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 17:59:21 +02:00

Add graphs to library items

Remove (temporary?) icon sprite from Reborn theme
This commit is contained in:
Afterster 2014-10-08 23:12:00 +02:00
parent 9ab5f34f2e
commit 5319cdf1d6
16 changed files with 191 additions and 171 deletions

View file

@ -38,24 +38,32 @@ if (!AmpConfig::get('statistical_graphs')) {
$type = $_REQUEST['type'];
$oid = $_REQUEST['oid'];
$start_date = $_REQUEST['start_date'];
$end_date = $_REQUEST['end_date'];
$zoom = $_REQUEST['zoom'];
$user_id = scrub_in($_REQUEST['user_id']);
$object_type = scrub_in($_REQUEST['object_type']);
if (!Core::is_library_item($object_type)) {
$object_type = null;
}
$object_id = scrub_in($_REQUEST['object_id']);
$start_date = scrub_in($_REQUEST['start_date']);
$end_date = scrub_in($_REQUEST['end_date']);
$zoom = scrub_in($_REQUEST['zoom']);
$width = scrub_in($_REQUEST['width']);
$height = scrub_in($_REQUEST['height']);
$graph = new Graph();
switch ($type) {
case 'user_hits':
$graph->render_user_hits($oid, $start_date, $end_date, $zoom);
$graph->render_user_hits($user_id, $object_type, $object_id, $start_date, $end_date, $zoom, $width, $height);
break;
case 'user_bandwidth':
$graph->render_user_bandwidth($oid, $start_date, $end_date, $zoom);
$graph->render_user_bandwidth($user_id, $object_type, $object_id, $start_date, $end_date, $zoom, $width, $height);
break;
case 'catalog_files':
$graph->render_catalog_files($oid, $start_date, $end_date, $zoom);
$graph->render_catalog_files($user_id, $object_type, $object_id, $start_date, $end_date, $zoom, $width, $height);
break;
case 'catalog_size':
$graph->render_catalog_size($oid, $start_date, $end_date, $zoom);
$graph->render_catalog_size($user_id, $object_type, $object_id, $start_date, $end_date, $zoom, $width, $height);
break;
}

BIN
images/icon_sort.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

View file

@ -200,6 +200,9 @@ class Api
$data['username'] = $client->username;
$data['type'] = 'api';
$data['value'] = $timestamp;
if (isset($input['client'])) {
$data['agent'] = $input['client'];
}
if (isset($input['geo_latitude'])) {
$data['geo_latitude'] = $input['geo_latitude'];
}

View file

@ -52,7 +52,7 @@ class Graph
return "UNIX_TIMESTAMP(" . $df . ")";
}
protected function get_user_sql_where($user = 0, $start_date = null, $end_date = null)
protected function get_user_sql_where($user = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null)
{
if ($end_date == null) {
$end_date = time();
@ -70,10 +70,15 @@ class Graph
$user = intval($user);
$sql .= " AND `object_count`.`user` = " . $user;
}
$object_id = intval($object_id);
if (Core::is_library_item($object_type) && $object_id) {
$sql .= " AND `object_count`.`object_type` = '" . $object_type . "' AND `object_count`.`object_id` = '" . $object_id . "'";
}
return $sql;
}
protected function get_catalog_sql_where($type = 'song', $catalog = 0, $start_date = null, $end_date = null)
protected function get_catalog_sql_where($object_type = 'song', $object_id = 0, $catalog = 0, $start_date = null, $end_date = null)
{
if ($end_date == null) {
$end_date = time();
@ -86,19 +91,29 @@ class Graph
$start_date = intval($start_date);
}
$sql = "WHERE `" . $type . "`.`addition_time` >= " . $start_date . " AND `" . $type . "`.`addition_time` <= " . $end_date;
$sql = "WHERE `" . $object_type . "`.`addition_time` >= " . $start_date . " AND `" . $object_type . "`.`addition_time` <= " . $end_date;
if ($catalog > 0) {
$catalog = intval($catalog);
$sql .= " AND `" . $type . "`.`catalog` = " . $catalog;
$sql .= " AND `" . $object_type . "`.`catalog` = " . $catalog;
}
$object_id = intval($object_id);
if ($object_id) {
$sql .= " AND `" . $object_type . "`.`id` = '" . $object_id . "'";
}
return $sql;
}
protected function get_all_type_pts($fct, $id = 0, $start_date = null, $end_date = null, $zoom = 'day')
protected function get_all_type_pts($fct, $id = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day')
{
$song_values = $this->$fct($id, $start_date, $end_date, $zoom, 'song');
if (AmpConfig::get('allow_video')) {
$video_values = $this->$fct($id, $start_date, $end_date, $zoom, 'video');
if ($object_type == null) {
$type = 'song';
} else {
$type = $object_type;
}
$song_values = $this->$fct($id, $type, $object_id, $start_date, $end_date, $zoom);
if ($object_type == null && AmpConfig::get('allow_video')) {
$video_values = $this->$fct($id, 'video', $object_id, $start_date, $end_date, $zoom);
} else {
$video_values = array();
}
@ -114,9 +129,9 @@ class Graph
return $values;
}
protected function get_all_pts($fct, pData $MyData, $id = 0, $start_date = null, $end_date = null, $zoom = 'day', $show_total = true)
protected function get_all_pts($fct, pData $MyData, $id = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day', $show_total = true)
{
$values = $this->get_all_type_pts($fct, $id, $start_date, $end_date, $zoom);
$values = $this->get_all_type_pts($fct, $id, $object_type, $object_id, $start_date, $end_date, $zoom);
foreach ($values as $date => $value) {
if ($show_total) {
$MyData->addPoints($value, "Total");
@ -126,9 +141,9 @@ class Graph
return $values;
}
protected function get_user_all_pts($fct, pData $MyData, $user = 0, $start_date = null, $end_date = null, $zoom = 'day')
protected function get_user_all_pts($fct, pData $MyData, $user = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day')
{
$values = $this->get_all_pts($fct, $MyData, $user, $start_date, $end_date, $zoom);
$values = $this->get_all_pts($fct, $MyData, $user, $object_type, $object_id, $start_date, $end_date, $zoom);
$ustats = User::count();
// Only display other users if the graph is not for a specific user and user count is small
@ -136,7 +151,7 @@ class Graph
$user_ids = User::get_valid_users();
foreach ($user_ids as $user_id) {
$u = new User($user_id);
$user_values = $this->get_all_type_pts($fct, $user_id, $start_date, $end_date, $zoom);
$user_values = $this->get_all_type_pts($fct, $user_id, $object_type, $object_id, $start_date, $end_date, $zoom);
foreach ($values as $date => $value) {
if (array_key_exists($date, $user_values)) {
$value = $user_values[$date];
@ -149,16 +164,16 @@ class Graph
}
}
protected function get_catalog_all_pts($fct, pData $MyData, $catalog = 0, $start_date = null, $end_date = null, $zoom = 'day')
protected function get_catalog_all_pts($fct, pData $MyData, $catalog = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day')
{
$values = $this->get_all_pts($fct, $MyData, $catalog, $start_date, $end_date, $zoom, false);
$values = $this->get_all_pts($fct, $MyData, $catalog, $object_type, $object_id, $start_date, $end_date, $zoom, false);
// Only display other users if the graph is not for a specific catalog
if (!$catalog) {
$catalog_ids = Catalog::get_catalogs();
foreach ($catalog_ids as $catalog_id) {
$c = Catalog::create_from_id($catalog_id);
$catalog_values = $this->get_all_type_pts($fct, $catalog_id, $start_date, $end_date, $zoom);
$catalog_values = $this->get_all_type_pts($fct, $catalog_id, $object_type, $object_id, $start_date, $end_date, $zoom);
$pv = 0;
foreach ($values as $date => $value) {
if (array_key_exists($date, $catalog_values)) {
@ -173,12 +188,11 @@ class Graph
}
}
protected function get_user_hits_pts($user = 0, $start_date = null, $end_date = null, $zoom = 'day', $type = 'song')
protected function get_user_hits_pts($user = 0, $object_type = 'song', $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day')
{
$df = $this->get_sql_date_format("`object_count`.`date`", $zoom);
$where = $this->get_user_sql_where($user, $start_date, $end_date);
$where = $this->get_user_sql_where($user, $object_type, $object_id, $start_date, $end_date);
$sql = "SELECT " . $df . " AS `zoom_date`, COUNT(`object_count`.`id`) AS `hits` FROM `object_count` " . $where .
" AND `object_count`.`object_type` = '" . $type . "'" .
" GROUP BY " . $df;
$db_results = Dba::read($sql);
@ -189,13 +203,12 @@ class Graph
return $values;
}
protected function get_user_bandwidth_pts($user = 0, $start_date = null, $end_date = null, $zoom = 'day', $type = 'song')
protected function get_user_bandwidth_pts($user = 0, $object_type = 'song', $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day')
{
$df = $this->get_sql_date_format("`object_count`.`date`", $zoom);
$where = $this->get_user_sql_where($user, $start_date, $end_date);
$sql = "SELECT " . $df . " AS `zoom_date`, SUM(`" . $type . "`.`size`) AS `bandwith` FROM `object_count` " .
" JOIN `" . $type . "` ON `" . $type . "`.`id` = `object_count`.`object_id` " . $where .
" AND `object_count`.`object_type` = '" . $type . "'" .
$where = $this->get_user_sql_where($user, $object_type, $object_id, $start_date, $end_date);
$sql = "SELECT " . $df . " AS `zoom_date`, SUM(`" . $object_type . "`.`size`) AS `bandwith` FROM `object_count` " .
" JOIN `" . $object_type . "` ON `" . $object_type . "`.`id` = `object_count`.`object_id` " . $where .
" GROUP BY " . $df;
$db_results = Dba::read($sql);
@ -206,12 +219,12 @@ class Graph
return $values;
}
protected function get_catalog_files_pts($catalog = 0, $start_date = null, $end_date = null, $zoom = 'day', $type = 'song')
protected function get_catalog_files_pts($catalog = 0, $object_type = 'song', $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day')
{
$start_date = $start_date ?: ($end_date ?: time()) - 864000;
$df = $this->get_sql_date_format("`" . $type . "`.`addition_time`", $zoom);
$where = $this->get_catalog_sql_where($type, $catalog, $start_date, $end_date);
$sql = "SELECT " . $df . " AS `zoom_date`, ((SELECT COUNT(`t2`.`id`) FROM `" . $type . "` `t2` WHERE `t2`.`addition_time` < `zoom_date`) + COUNT(`" . $type . "`.`id`)) AS `files` FROM `" . $type . "` " . $where .
$df = $this->get_sql_date_format("`" . $object_type . "`.`addition_time`", $zoom);
$where = $this->get_catalog_sql_where($object_type, $object_id, $catalog, $start_date, $end_date);
$sql = "SELECT " . $df . " AS `zoom_date`, ((SELECT COUNT(`t2`.`id`) FROM `" . $object_type . "` `t2` WHERE `t2`.`addition_time` < `zoom_date`) + COUNT(`" . $object_type . "`.`id`)) AS `files` FROM `" . $object_type . "` " . $where .
" GROUP BY " . $df;
$db_results = Dba::read($sql);
@ -222,12 +235,12 @@ class Graph
return $values;
}
protected function get_catalog_size_pts($catalog = 0, $start_date = null, $end_date = null, $zoom = 'day', $type = 'song')
protected function get_catalog_size_pts($catalog = 0, $object_type = 'song', $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day')
{
$start_date = $start_date ?: ($end_date ?: time()) - 864000;
$df = $this->get_sql_date_format("`" . $type . "`.`addition_time`", $zoom);
$where = $this->get_catalog_sql_where($type, $catalog, $start_date, $end_date);
$sql = "SELECT " . $df . " AS `zoom_date`, ((SELECT SUM(`t2`.`size`) FROM `" . $type . "` `t2` WHERE `t2`.`addition_time` < `zoom_date`) + SUM(`" . $type . "`.`size`)) AS `storage` FROM `" . $type . "` " . $where .
$df = $this->get_sql_date_format("`" . $object_type . "`.`addition_time`", $zoom);
$where = $this->get_catalog_sql_where($object_type, $object_id, $catalog, $start_date, $end_date);
$sql = "SELECT " . $df . " AS `zoom_date`, ((SELECT SUM(`t2`.`size`) FROM `" . $object_type . "` `t2` WHERE `t2`.`addition_time` < `zoom_date`) + SUM(`" . $object_type . "`.`size`)) AS `storage` FROM `" . $object_type . "` " . $where .
" GROUP BY " . $df;
$db_results = Dba::read($sql);
@ -238,13 +251,16 @@ class Graph
return $values;
}
protected function get_geolocation_pts($user = 0, $start_date = null, $end_date = null, $zoom = 'day')
protected function get_geolocation_pts($user = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day')
{
$pts = array();
$where = $this->get_user_sql_where($user, $start_date, $end_date);
$where = $this->get_user_sql_where($user, $object_type, $object_id, $start_date, $end_date);
if ($object_type == null) {
$where .= " AND `object_type` IN ('song', 'video')";
}
$sql = "SELECT `geo_latitude`, `geo_longitude`, `geo_name`, MAX(`date`) AS `last_date`, COUNT(`id`) AS `hits` FROM `object_count` " .
$where . " AND `object_type` IN ('song', 'video') AND `geo_latitude` IS NOT NULL AND `geo_longitude` IS NOT NULL " .
$where . " AND `geo_latitude` IS NOT NULL AND `geo_longitude` IS NOT NULL " .
"GROUP BY `geo_latitude`, `geo_longitude` ORDER BY `last_date` DESC";
$db_results = Dba::read($sql);
while ($results = Dba::fetch_assoc($db_results)) {
@ -260,8 +276,18 @@ class Graph
return $pts;
}
protected function render_graph($title, $MyData, $zoom)
protected function render_graph($title, $MyData, $zoom, $width = 0, $height = 0)
{
// Check graph size sanity
$width = intval($width || $width > 4096);
if ($width <= 50) {
$width = 700;
}
$height = intval($height);
if ($height <= 50 || $height > 4096) {
$height = 230;
}
$MyData->setSerieDescription("TimeStamp","time");
$MyData->setAbscissa("TimeStamp");
switch ($zoom) {
@ -280,22 +306,22 @@ class Graph
}
/* Create the pChart object */
$myPicture = new pImage(700,230,$MyData);
$myPicture = new pImage($width,$height,$MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* Draw a background */
$Settings = array("R"=>90, "G"=>90, "B"=>90, "Dash"=>1, "DashR"=>120, "DashG"=>120, "DashB"=>120);
$myPicture->drawFilledRectangle(0,0,700,230,$Settings);
$myPicture->drawFilledRectangle(0,0,$width,$height,$Settings);
/* Overlay with a gradient */
$Settings = array("StartR"=>200, "StartG"=>200, "StartB"=>200, "EndR"=>50, "EndG"=>50, "EndB"=>50, "Alpha"=>50);
$myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,$Settings);
$myPicture->drawGradientArea(0,0,700,230,DIRECTION_HORIZONTAL,$Settings);
$myPicture->drawGradientArea(0,0,$width,$height,DIRECTION_VERTICAL,$Settings);
$myPicture->drawGradientArea(0,0,$width,$height,DIRECTION_HORIZONTAL,$Settings);
/* Add a border to the picture */
$myPicture->drawRectangle(0,0,699,229,array("R"=>0,"G"=>0,"B"=>0));
$myPicture->drawRectangle(0,0,$width-1,$height-1,array("R"=>0,"G"=>0,"B"=>0));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName"=>AmpConfig::get('prefix')."/modules/pChart/fonts/Forgotte.ttf","FontSize"=>11));
@ -305,7 +331,7 @@ class Graph
$myPicture->setFontProperties(array("FontName"=>AmpConfig::get('prefix')."/modules/pChart/fonts/pf_arma_five.ttf","FontSize"=>6));
/* Define the chart area */
$myPicture->setGraphArea(60,40,680,200);
$myPicture->setGraphArea(60,40,$width-20,$height-30);
/* Draw the scale */
$scaleSettings = array("XMargin"=>10,"YMargin"=>10,"Floating"=>TRUE,"GridR"=>200,"GridG"=>200,"GridB"=>200,"RemoveSkippedAxis"=>TRUE,"DrawSubTicks"=>FALSE,"Mode"=>SCALE_MODE_START0,"LabelingMethod"=>LABELING_DIFFERENT);
@ -328,54 +354,54 @@ class Graph
$myPicture->autoOutput();
}
public function render_user_hits($user = 0, $start_date = null, $end_date = null, $zoom = 'day')
public function render_user_hits($user = 0, $object_type, $object_id, $start_date = null, $end_date = null, $zoom = 'day', $width = 0, $height = 0)
{
$MyData = new pData();
$this->get_user_all_pts('get_user_hits_pts', $MyData, $user, $start_date, $end_date, $zoom);
$this->get_user_all_pts('get_user_hits_pts', $MyData, $user, $object_type, $object_id, $start_date, $end_date, $zoom);
$MyData->setAxisName(0, "Hits");
$MyData->setAxisDisplay(0, AXIS_FORMAT_METRIC);
$this->render_graph('Hits', $MyData, $zoom);
$this->render_graph('Hits', $MyData, $zoom, $width, $height);
}
public function render_user_bandwidth($user = 0, $start_date = null, $end_date = null, $zoom = 'day')
public function render_user_bandwidth($user = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day', $width = 0, $height = 0)
{
$MyData = new pData();
$this->get_user_all_pts('get_user_bandwidth_pts', $MyData, $user, $start_date, $end_date, $zoom);
$this->get_user_all_pts('get_user_bandwidth_pts', $MyData, $user, $object_type, $object_id, $start_date, $end_date, $zoom);
$MyData->setAxisName(0, "Bandwidth");
$MyData->setAxisDisplay(0, AXIS_FORMAT_TRAFFIC);
$this->render_graph('Bandwidth', $MyData, $zoom);
$this->render_graph('Bandwidth', $MyData, $zoom, $width, $height);
}
public function render_catalog_files($catalog = 0, $start_date = null, $end_date = null, $zoom = 'day')
public function render_catalog_files($catalog = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day', $width = 0, $height = 0)
{
$MyData = new pData();
$this->get_catalog_all_pts('get_catalog_files_pts', $MyData, $catalog, $start_date, $end_date, $zoom);
$this->get_catalog_all_pts('get_catalog_files_pts', $MyData, $catalog, $object_type, $object_id, $start_date, $end_date, $zoom);
$MyData->setAxisName(0, "Files");
$MyData->setAxisDisplay(0, AXIS_FORMAT_METRIC);
$this->render_graph('Files', $MyData, $zoom);
$this->render_graph('Files', $MyData, $zoom, $width, $height);
}
public function render_catalog_size($catalog = 0, $start_date = null, $end_date = null, $zoom = 'day')
public function render_catalog_size($catalog = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day', $width = 0, $height = 0)
{
$MyData = new pData();
$this->get_catalog_all_pts('get_catalog_size_pts', $MyData, $catalog, $start_date, $end_date, $zoom);
$this->get_catalog_all_pts('get_catalog_size_pts', $MyData, $catalog, $object_type, $object_id, $start_date, $end_date, $zoom);
$MyData->setAxisName(0, "Size");
$MyData->setAxisUnit(0, "B");
$MyData->setAxisDisplay(0, AXIS_FORMAT_CUSTOM, "pGraph_Yformat_bytes");
$this->render_graph('Size', $MyData, $zoom);
$this->render_graph('Size', $MyData, $zoom, $width, $height);
}
public function display_map($user = 0, $start_date = null, $end_date = null, $zoom = 'day')
public function display_map($user = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day')
{
$pts = $this->get_geolocation_pts($user, $start_date, $end_date, $zoom);
$pts = $this->get_geolocation_pts($user, $object_type, $object_id, $start_date, $end_date, $zoom);
foreach (Plugin::get_plugins('display_map') as $plugin_name) {
$plugin = new Plugin($plugin_name);
@ -386,6 +412,53 @@ class Graph
}
}
}
public static function display_from_request()
{
if (!Access::check('interface','50')) {
UI::access_denied();
} else {
$user_id = $_REQUEST['user_id'];
$object_type = $_REQUEST['object_type'];
$object_id = $_REQUEST['object_id'];
$end_date = $_REQUEST['end_date'] ? strtotime($_REQUEST['end_date']) : time();
$f_end_date = date("Y-m-d H:i", $end_date);
$start_date = $_REQUEST['start_date'] ? strtotime($_REQUEST['start_date']) : ($end_date - 864000);
$f_start_date = date("Y-m-d H:i", $start_date);
$zoom = $_REQUEST['zoom'] ?: 'day';
$gtypes = array();
$gtypes[] = 'user_hits';
if ($object_type == null || $object_type == 'song' || $object_type == 'video') {
$gtypes[] = 'user_bandwidth';
}
if (!$user_id && !$object_id) {
$gtypes[] = 'catalog_files';
$gtypes[] = 'catalog_size';
}
$blink = '';
if ($object_id) {
if (Core::is_library_item($object_type)) {
$libitem = new $object_type($object_id);
$libitem->format();
if (isset($libitem->f_name_link)) {
$blink = $libitem->f_name_link;
} else {
if (isset($libitem->f_link)) {
$blink = $libitem->f_link;
}
}
}
} else if ($user_id) {
$u = new User($user_id);
$u->format();
$blink = $u->f_link;
}
require_once AmpConfig::get('prefix') . '/templates/show_graphs.inc.php';
}
}
}
// Need to create a function to pass to pGraph objects

View file

@ -57,13 +57,8 @@ switch ($_REQUEST['action']) {
case 'upload':
require_once AmpConfig::get('prefix') . '/templates/show_uploads.inc.php';
break;
case 'graph_user':
$oid = $_REQUEST['oid'];
$end_date = $_REQUEST['end_date'] ?: time();
$start_date = $_REQUEST['start_date'] ?: ($end_date - 864000);
$zoom = $_REQUEST['zoom'] ?: 'day';
require_once AmpConfig::get('prefix') . '/templates/show_graphs.inc.php';
case 'graph':
Graph::display_from_request();
break;
case 'show':
default:

View file

@ -111,6 +111,12 @@ if (AmpConfig::get('show_played_times')) {
<?php } ?>
<?php } ?>
<?php if (Access::check('interface','50')) { ?>
<?php if (AmpConfig::get('statistical_graphs')) { ?>
<li>
<a href="<?php echo AmpConfig::get('web_path'); ?>/stats.php?action=graph&object_type=album&object_id=<?php echo $album->id; ?>"><?php echo UI::get_icon('statistics', T_('Graphs')); ?></a>
<a href="<?php echo AmpConfig::get('web_path'); ?>/stats.php?action=graph&object_type=album&object_id=<?php echo $album->id; ?>"><?php echo T_('Graphs'); ?></a>
</li>
<?php } ?>
<li>
<a onclick="submitNewItemsOrder('<?php echo $album->id; ?>', 'reorder_songs_table_<?php echo $album->id; ?>', 'song_',
'<?php echo AmpConfig::get('web_path'); ?>/albums.php?action=set_track_numbers', 'refresh_album_songs')">
@ -119,7 +125,7 @@ if (AmpConfig::get('show_played_times')) {
</a>
</li>
<li>
<a href="javascript:NavigateTo('<?php echo $web_path; ?>/albums.php?action=update_from_tags&amp;album_id=<?php echo $album->id; ?>');" onclick="return confirm('<?php echo T_('Do you really want to update from tags?'); ?>');"><?php echo UI::get_icon('file_refresh', T_('Update from tags')); ?> <?php echo T_('Update from tags'); ?></a>
<a href="javascript:NavigateTo('<?php echo $web_path; ?>/albums.php?action=update_from_tags&amp;album_id=<?php echo $album->id; ?>');" onclick="return confirm('<?php echo T_('Do you really want to update from tags?'); ?>');"><?php echo UI::get_icon('file_refresh', T_('Update from tags')); ?> &nbsp;&nbsp;<?php echo T_('Update from tags'); ?></a>
</li>
<li>
<a id="<?php echo 'edit_album_'.$album->id ?>" onclick="showEditDialog('album_row', '<?php echo $album->id ?>', '<?php echo 'edit_album_'.$album->id ?>', '<?php echo T_('Album edit') ?>', '')">

View file

@ -127,6 +127,12 @@ if (AmpConfig::get('show_played_times')) {
<?php } ?>
<?php } ?>
<?php if (Access::check('interface','50')) { ?>
<?php if (AmpConfig::get('statistical_graphs')) { ?>
<li>
<a href="<?php echo AmpConfig::get('web_path'); ?>/stats.php?action=graph&object_type=artist&object_id=<?php echo $artist->id; ?>"><?php echo UI::get_icon('statistics', T_('Graphs')); ?></a>
<a href="<?php echo AmpConfig::get('web_path'); ?>/stats.php?action=graph&object_type=artist&object_id=<?php echo $artist->id; ?>"><?php echo T_('Graphs'); ?></a>
</li>
<?php } ?>
<a id="<?php echo 'edit_artist_'.$artist->id ?>" onclick="showEditDialog('artist_row', '<?php echo $artist->id ?>', '<?php echo 'edit_artist_'.$artist->id ?>', '<?php echo T_('Artist edit') ?>', '')">
<?php echo UI::get_icon('edit', T_('Edit')); ?>
</a>

View file

@ -21,24 +21,17 @@
*/
$boxtitle = T_('Statistical Graphs');
if ($oid) {
$u = new User($oid);
$u->format();
$boxtitle .= ' - ' . $u->f_link;
if ($blink) {
$boxtitle .= ' - ' . $blink;
}
?>
<?php UI::show_box_top($boxtitle, 'box box_graph'); ?>
<div class="stats_graph">
<?php
$types = array('user_hits', 'user_bandwidth');
if (!$oid) {
$types[] = 'catalog_files';
$types[] = 'catalog_size';
}
foreach ($types as $type) {
foreach ($gtypes as $gtype) {
$graph_link = AmpConfig::get('web_path') . "/graph.php?type=" . $gtype . "&start_date=" . $start_date . "&end_date=" . $end_date . "&zoom=" . $zoom . "&user_id=" . $user_id . "&object_type=" . $object_type . "&object_id=" . $object_id;
?>
<img src="<?php echo AmpConfig::get('web_path'); ?>/graph.php?type=<?php echo $type; ?>&start_date=<?php echo $start_date; ?>&end_date=<?php echo $end_date; ?>&zoom=<?php echo $zoom; ?>&oid=<?php echo $oid; ?>" />
<a href="<?php echo $graph_link; ?>&width=1400&height=690" target="_blank" title="<?php echo T_('Show large'); ?>"><img src="<?php echo $graph_link; ?>" /></a>
<br /><br />
<?php } ?>
</div>
@ -49,7 +42,7 @@ if (AmpConfig::get('geolocation')) {
<div class="stats_graph">
<?php
$graph = new Graph();
$graph->display_map($oid);
$graph->display_map($user_id, $object_type, $object_id, $start_date, $end_date, $zoom);
?>
</div>
<?php
@ -60,10 +53,10 @@ if (AmpConfig::get('geolocation')) {
<dl class="media_details">
<?php $rowparity = UI::flip_class(); ?>
<dt class="<?php echo $rowparity; ?>"><?php echo T_('Start Date'); ?></dt>
<dd class="<?php echo $rowparity; ?>"><input type="text" name="start_date" id="start_date" value="<?php echo $start_date; ?>" /></dd>
<dd class="<?php echo $rowparity; ?>"><input type="text" name="start_date" id="start_date" value="<?php echo $f_start_date; ?>" /></dd>
<?php $rowparity = UI::flip_class(); ?>
<dt class="<?php echo $rowparity; ?>"><?php echo T_('End Date'); ?></dt>
<dd class="<?php echo $rowparity; ?>"><input type="text" name="end_date" id="end_date" value="<?php echo $end_date; ?>" /></dd>
<dd class="<?php echo $rowparity; ?>"><input type="text" name="end_date" id="end_date" value="<?php echo $f_end_date; ?>" /></dd>
<?php $rowparity = UI::flip_class(); ?>
<dt class="<?php echo $rowparity; ?>"><?php echo T_('Zoom'); ?></dt>
<dd class="<?php echo $rowparity; ?>">
@ -89,16 +82,20 @@ if (AmpConfig::get('geolocation')) {
<input type="submit" value="<?php echo T_('View'); ?>" />
</dd>
</dl>
<input type="hidden" name="oid" value="<?php echo $oid; ?>" />
<input type="hidden" name="user_id" value="<?php echo $user_id; ?>" />
<input type="hidden" name="object_type" value="<?php echo $object_type; ?>" />
<input type="hidden" name="object_id" value="<?php echo $object_id; ?>" />
<input type="hidden" name="action" value="<?php echo $_REQUEST['action']; ?>" />
<input type="hidden" name="type" value="<?php echo $type; ?>" />
</form>
<script>
$('#start_date').datetimepicker({
format: 'unixtime'
format: 'Y-m-d H:i',
theme: 'dark'
});
$('#end_date').datetimepicker({
format: 'unixtime'
format:'Y-m-d H:i',
theme: 'dark'
});
</script>
<?php UI::show_box_bottom(); ?>

View file

@ -56,7 +56,7 @@ UI::show_box_top('<div id="playlist_row_' . $playlist->id . '">' . $title . '</d
</a>
</li>
<li>
<a href="<?php echo AmpConfig::get('web_path'); ?>/playlist.php?action=sort_tracks&amp;playlist_id=<?php echo $playlist->id; ?>"><?php echo UI::get_icon('statistics',_('Sort Tracks by Artist, Album, Song')); ?>
<a href="<?php echo AmpConfig::get('web_path'); ?>/playlist.php?action=sort_tracks&amp;playlist_id=<?php echo $playlist->id; ?>"><?php echo UI::get_icon('sort',_('Sort Tracks by Artist, Album, Song')); ?>
&nbsp;&nbsp;<?php echo T_('Sort Tracks by Artist, Album, Song'); ?></a>
</li>
<?php } ?>

View file

@ -80,6 +80,10 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path'); ?>/stream.php?action=download&amp;song_id=<?php echo $song->id; ?>"><?php echo UI::get_icon('download', T_('Download')); ?></a>
<?php } ?>
<?php if (Access::check('interface','50')) { ?>
<?php if (AmpConfig::get('statistical_graphs')) { ?>
<a href="<?php echo AmpConfig::get('web_path'); ?>/stats.php?action=graph&object_type=song&object_id=<?php echo $song->id; ?>"><?php echo UI::get_icon('statistics', T_('Graphs')); ?></a>
<?php } ?>
<a onclick="showEditDialog('song_row', '<?php echo $song->id ?>', '<?php echo 'edit_song_'.$song->id ?>', '<?php echo T_('Edit') ?>', '')">
<?php echo UI::get_icon('edit', T_('Edit')); ?>
</a>

View file

@ -69,7 +69,8 @@
<?php } ?>
<?php } ?>
<?php if (Access::check_function('download')) { ?>
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path'); ?>/stream.php?action=download&song_id=<?php echo $libitem->id; ?>"><?php echo UI::get_icon('download', T_('Download')); ?></a><?php } ?>
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path'); ?>/stream.php?action=download&song_id=<?php echo $libitem->id; ?>"><?php echo UI::get_icon('download', T_('Download')); ?></a>
<?php } ?>
<?php if (Access::check('interface','50') || ($libitem->user_upload == $GLOBALS['user']->id && AmpConfig::get('upload_allow_edit'))) { ?>
<a id="<?php echo 'edit_song_'.$libitem->id ?>" onclick="showEditDialog('song_row', '<?php echo $libitem->id ?>', '<?php echo 'edit_song_'.$libitem->id ?>', '<?php echo T_('Song edit') ?>', 'song_')">
<?php echo UI::get_icon('edit', T_('Edit')); ?>

View file

@ -100,11 +100,6 @@ $catalogs = Catalog::get_catalogs();
<?php
if (AmpConfig::get('statistical_graphs')) {
$oid = $_REQUEST['oid'];
$end_date = $_REQUEST['end_date'] ?: time();
$start_date = $_REQUEST['start_date'] ?: ($end_date - 864000);
$zoom = $_REQUEST['zoom'] ?: 'day';
require_once AmpConfig::get('prefix') . '/templates/show_graphs.inc.php';
Graph::display_from_request();
}
?>

View file

@ -44,8 +44,8 @@ if ($client->f_avatar) {
<dt class="<?php echo $rowparity; ?>"><?php echo T_('Activity'); ?></dt>
<dd class="<?php echo $rowparity; ?>">
<?php echo $client->f_useage; ?>
<?php if (AmpConfig::get('statistical_graphs')) { ?>
(<a href="<?php echo AmpConfig::get('web_path'); ?>/stats.php?action=graph_user&oid=<?php echo $client->id; ?>"><?php echo T_('Graphs'); ?></a>)
<?php if (AmpConfig::get('statistical_graphs') && Access::check('interface','50')) { ?>
<a href="<?php echo AmpConfig::get('web_path'); ?>/stats.php?action=graph&user_id=<?php echo $client->id; ?>"><?php echo UI::get_icon('statistics', T_('Graphs')); ?></a>
<?php } ?>
</dd>
<?php $rowparity = UI::flip_class(); ?>

View file

@ -93,6 +93,9 @@ foreach ($subtitles as $subtitle) {
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path'); ?>/stream.php?action=download&video_id=<?php echo $video->id; ?>"><?php echo UI::get_icon('download', T_('Download')); ?></a>
<?php } ?>
<?php if (Access::check('interface','50')) { ?>
<?php if (AmpConfig::get('statistical_graphs')) { ?>
<a href="<?php echo AmpConfig::get('web_path'); ?>/stats.php?action=graph&object_type=video&object_id=<?php echo $video->id; ?>"><?php echo UI::get_icon('statistics', T_('Graphs')); ?></a>
<?php } ?>
<a onclick="showEditDialog('video_row', '<?php echo $video->id ?>', '<?php echo 'edit_video_'.$video->id ?>', '<?php echo T_('Edit') ?>', '')">
<?php echo UI::get_icon('edit', T_('Edit')); ?>
</a>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

View file

@ -1,71 +0,0 @@
.sprite { background: url(../images/icons.sprite.png) no-repeat top left; display: inline-block; }
.sprite-icon_add{ background-position: 0 0; width: 16px; height: 16px; }
.sprite-icon_add12{ background-position: 0 -32px; width: 16px; height: 16px; }
.sprite-icon_add2{ background-position: 0 -64px; width: 16px; height: 16px; }
.sprite-icon_add_key{ background-position: 0 -96px; width: 16px; height: 16px; }
.sprite-icon_add_tag{ background-position: 0 -128px; width: 16px; height: 16px; }
.sprite-icon_add_user{ background-position: 0 -160px; width: 16px; height: 16px; }
.sprite-icon_add_wanted{ background-position: 0 -192px; width: 16px; height: 16px; }
.sprite-icon_admin{ background-position: 0 -224px; width: 16px; height: 16px; }
.sprite-icon_all{ background-position: 0 -256px; width: 16px; height: 16px; }
.sprite-icon_ampache{ background-position: 0 -288px; width: 16px; height: 16px; }
.sprite-icon_batch_download{ background-position: 0 -320px; width: 16px; height: 16px; }
.sprite-icon_broadcast{ background-position: 0 -352px; width: 16px; height: 16px; }
.sprite-icon_cancel{ background-position: 0 -384px; width: 16px; height: 16px; }
.sprite-icon_cog{ background-position: 0 -416px; width: 16px; height: 16px; }
.sprite-icon_comment{ background-position: 0 -448px; width: 16px; height: 16px; }
.sprite-icon_delete{ background-position: 0 -480px; width: 16px; height: 16px; }
.sprite-icon_disable{ background-position: 0 -512px; width: 16px; height: 16px; }
.sprite-icon_download{ background-position: 0 -544px; width: 16px; height: 16px; }
.sprite-icon_drag{ background-position: 0 -576px; width: 16px; height: 16px; }
.sprite-icon_edit{ background-position: 0 -608px; width: 16px; height: 16px; }
.sprite-icon_edit2{ background-position: 0 -640px; width: 16px; height: 16px; }
.sprite-icon_enable{ background-position: 0 -672px; width: 16px; height: 16px; }
.sprite-icon_equalizer{ background-position: 0 -704px; width: 16px; height: 16px; }
.sprite-icon_feed{ background-position: 0 -736px; width: 16px; height: 16px; }
.sprite-icon_flag{ background-position: 0 -768px; width: 16px; height: 16px; }
.sprite-icon_flag_off{ background-position: 0 -800px; width: 16px; height: 16px; }
.sprite-icon_flow{ background-position: 0 -832px; width: 16px; height: 16px; }
.sprite-icon_fullscreen{ background-position: 0 -864px; width: 16px; height: 16px; }
.sprite-icon_google{ background-position: 0 -896px; width: 16px; height: 16px; }
.sprite-icon_home{ background-position: 0 -928px; width: 16px; height: 16px; }
.sprite-icon_image{ background-position: 0 -960px; width: 16px; height: 16px; }
.sprite-icon_info{ background-position: 0 -992px; width: 16px; height: 16px; }
.sprite-icon_lastfm{ background-position: 0 -1024px; width: 16px; height: 16px; }
.sprite-icon_link{ background-position: 0 -1056px; width: 16px; height: 16px; }
.sprite-icon_lock{ background-position: 0 -1088px; width: 16px; height: 16px; }
.sprite-icon_logout{ background-position: 0 -1120px; width: 16px; height: 16px; }
.sprite-icon_microphone{ background-position: 0 -1152px; width: 16px; height: 16px; }
.sprite-icon_money{ background-position: 0 -1184px; width: 16px; height: 16px; }
.sprite-icon_next{ background-position: 0 -1216px; width: 16px; height: 16px; }
.sprite-icon_next_hover{ background-position: 0 -1248px; width: 16px; height: 16px; }
.sprite-icon_pause{ background-position: 0 -1280px; width: 16px; height: 16px; }
.sprite-icon_pause_hover{ background-position: 0 -1312px; width: 16px; height: 16px; }
.sprite-icon_play{ background-position: 0 -1344px; width: 16px; height: 16px; }
.sprite-icon_play_add{ background-position: 0 -1376px; width: 16px; height: 16px; }
.sprite-icon_play_add_preview{ background-position: 0 -1408px; width: 16px; height: 16px; }
.sprite-icon_play_hover{ background-position: 0 -1440px; width: 16px; height: 16px; }
.sprite-icon_play_preview{ background-position: 0 -1472px; width: 16px; height: 16px; }
.sprite-icon_playlist_add{ background-position: 0 -1504px; width: 16px; height: 16px; }
.sprite-icon_plugin{ background-position: 0 -1536px; width: 16px; height: 16px; }
.sprite-icon_preferences{ background-position: 0 -1568px; width: 16px; height: 16px; }
.sprite-icon_prev{ background-position: 0 -1600px; width: 16px; height: 16px; }
.sprite-icon_prev_hover{ background-position: 0 -1632px; width: 16px; height: 16px; }
.sprite-icon_random{ background-position: 0 -1664px; width: 16px; height: 16px; }
.sprite-icon_run{ background-position: 0 -1696px; width: 16px; height: 16px; }
.sprite-icon_save{ background-position: 0 -1728px; width: 16px; height: 16px; }
.sprite-icon_server_lightning{ background-position: 0 -1760px; width: 16px; height: 16px; }
.sprite-icon_share{ background-position: 0 -1792px; width: 16px; height: 16px; }
.sprite-icon_statistics{ background-position: 0 -1824px; width: 16px; height: 16px; }
.sprite-icon_stop{ background-position: 0 -1856px; width: 16px; height: 16px; }
.sprite-icon_stop_hover{ background-position: 0 -1888px; width: 16px; height: 16px; }
.sprite-icon_tick{ background-position: 0 -1920px; width: 16px; height: 16px; }
.sprite-icon_view{ background-position: 0 -1952px; width: 16px; height: 16px; }
.sprite-icon_visualizer{ background-position: -32px 0; width: 16px; height: 16px; }
.sprite-icon_volumedn{ background-position: -32px -32px; width: 16px; height: 16px; }
.sprite-icon_volumemute{ background-position: -32px -64px; width: 16px; height: 16px; }
.sprite-icon_volumeup{ background-position: -32px -96px; width: 16px; height: 16px; }
.sprite-icon_wand{ background-position: -32px -128px; width: 16px; height: 16px; }
.sprite-icon_wikipedia{ background-position: -32px -160px; width: 16px; height: 16px; }
.sprite-icon_world_link{ background-position: -32px -192px; width: 16px; height: 16px; }