Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gnu-fm
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
16
Issues
16
List
Boards
Labels
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gnu.io
gnu-fm
Commits
23dac5ab
Commit
23dac5ab
authored
Jun 24, 2011
by
Matt Pugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed merge request points, tested
parent
07a1dbab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
24 deletions
+31
-24
nixtape/data/Graph.php
nixtape/data/Graph.php
+15
-12
nixtape/data/GraphTypes.php
nixtape/data/GraphTypes.php
+14
-10
nixtape/js/stats/user.js
nixtape/js/stats/user.js
+2
-2
No files found.
nixtape/data/Graph.php
View file @
23dac5ab
...
...
@@ -39,7 +39,7 @@ class Graph {
public
$user
,
$type
,
$renderer
,
$label_renderer
;
public
$max_x_axis
,
$max_y_axis
;
public
$tick_interval
=
20
;
public
$x_axis_label
=
"X axis"
,
$y_axis_label
=
"Y Axis"
;
public
$x_axis_label
=
'X axis'
,
$y_axis_label
=
'Y Axis'
;
/* Multidimensional array to allow for multiple series of data. */
protected
$graph_types
=
array
(
array
());
...
...
@@ -131,11 +131,11 @@ class Graph {
**/
protected
function
buildJsDataArray
(
$inverse
=
FALSE
)
{
$temp
=
"["
;
$temp
=
'['
;
foreach
(
$this
->
data
as
$i
=>
$series
)
{
$temp
.=
"["
;
$temp
.=
'['
;
if
(
$inverse
)
$i
=
0
;
foreach
(
$series
as
$j
=>
$set
)
...
...
@@ -143,32 +143,35 @@ class Graph {
foreach
(
$set
as
$k
=>
$node
)
{
/* Determine if the node is numeric, if not, escape. */
$temp
.=
"["
.
((
!
is_numeric
(
$node
))
?
"'"
.
(
addslashes
(
$node
))
.
"'"
:
$node
);
$temp
.=
'['
.
((
!
is_numeric
(
$node
))
?
'\''
.
addslashes
(
$node
)
.
'\''
:
$node
);
/* @TODO: check $node for len > 1, if so tokenise string */
if
(
$inverse
)
$temp
.=
","
.
++
$i
;
$temp
.=
"],"
;
if
(
$inverse
)
$temp
.=
','
.
++
$i
;
$temp
.=
'],'
;
}
$temp
=
rtrim
(
$temp
,
','
);
$temp
=
rtrim
(
$temp
,
','
);
}
$temp
.=
"],"
;
$temp
.=
'],'
;
}
$temp
=
rtrim
(
$temp
,
','
);
$temp
.=
"]"
;
$temp
.=
']'
;
return
$temp
;
}
protected
function
buildJsSingleArray
(
$source
)
{
$temp
=
"["
;
$temp
=
'['
;
foreach
(
$source
as
$i
=>
$node
)
{
$temp
.=
((
!
is_numeric
(
$node
))
?
"'"
.
$node
.
"'"
:
$node
)
.
","
;
$temp
.=
((
!
is_numeric
(
$node
))
?
'\''
.
$node
.
'\''
:
$node
)
.
','
;
}
$temp
=
rtrim
(
$temp
,
','
)
.
"]"
;
$temp
=
rtrim
(
$temp
,
','
)
.
']'
;
return
$temp
;
}
}
\ No newline at end of file
nixtape/data/GraphTypes.php
View file @
23dac5ab
...
...
@@ -39,7 +39,7 @@ class GraphTopArtists extends Graph {
**/
function
__construct
(
$user
,
$num
=
20
)
{
parent
::
__construct
(
$user
,
"bar_horiz"
);
parent
::
__construct
(
$user
,
'bar_horiz'
);
$this
->
number_of_tracks
=
$num
;
$this
->
buildGraphData
();
}
...
...
@@ -53,12 +53,14 @@ class GraphTopArtists extends Graph {
**/
private
function
buildGraphData
()
{
$tmp
=
Statistic
::
G
eneratePlayStats
(
'Scrobbles'
,
'artist'
,
$tmp
=
Statistic
::
g
eneratePlayStats
(
'Scrobbles'
,
'artist'
,
$this
->
number_of_tracks
,
$this
->
user
->
uniqueid
,
300
);
foreach
(
$tmp
as
$root
=>
$node
)
{
$artists
[]
=
'<a href="'
.
$node
[
'artisturl'
]
.
'">'
.
addslashes
(
$node
[
'artist'
])
.
'</a>'
;
$tmp
=
'<a href="'
.
$node
[
'pageurl'
]
.
'">'
;
$tmp
.=
addslashes
(
htmlentities
(
$node
[
'artist'
]))
.
'</a>'
;
$artists
[]
=
$tmp
;
$artists_data
[]
=
$node
[
'count'
];
}
...
...
@@ -86,7 +88,7 @@ class GraphTopTracks extends Graph {
**/
function
__construct
(
$user
,
$num
=
20
)
{
parent
::
__construct
(
$user
,
"bar_horiz"
);
parent
::
__construct
(
$user
,
'bar_horiz'
);
$this
->
number_of_tracks
=
$num
;
$this
->
buildGraphData
();
}
...
...
@@ -106,8 +108,10 @@ class GraphTopTracks extends Graph {
foreach
(
$this
->
data_buffer
as
$key
=>
$entry
)
{
$tmp_line
=
'<a href="'
.
$entry
[
'artisturl'
]
.
'">'
.
$entry
[
'artist'
]
.
'</a>'
;
$tmp_line
.=
' - <a href="'
.
$entry
[
'trackurl'
]
.
'">'
.
addslashes
(
$entry
[
'track'
])
.
'</a>'
;
$tmp_line
=
'<a href="'
.
$entry
[
'artisturl'
]
.
'">'
;
$tmp_line
.=
addslashes
(
htmlentities
(
$entry
[
'artist'
]))
.
'</a>'
;
$tmp_line
.=
' - <a href="'
.
$entry
[
'trackurl'
]
.
'">'
;
$tmp_line
.=
addslashes
(
htmlentities
(
$entry
[
'track'
]))
.
'</a>'
;
$listings
[]
=
$entry
[
'freq'
];
$tracks
[]
=
$tmp_line
;
}
...
...
@@ -136,7 +140,7 @@ class GraphPlaysByDays extends Graph {
**/
function
__construct
(
$user
,
$num
=
20
)
{
parent
::
__construct
(
$user
,
"line"
);
parent
::
__construct
(
$user
,
'line'
);
$this
->
number_of_days
=
$num
;
$this
->
buildGraphData
();
}
...
...
@@ -155,15 +159,15 @@ class GraphPlaysByDays extends Graph {
$this
->
data_buffer
=
Statistic
::
generatePlayByDays
(
'Scrobbles'
,
$this
->
number_of_days
,
$this
->
user
->
uniqueid
,
300
);
$date_line
=
"["
;
$date_line
=
'['
;
foreach
(
$this
->
data_buffer
as
$key
=>
$entry
)
{
$date_line
.=
"['"
.
$entry
[
'date'
]
.
"', "
.
$entry
[
'count'
]
.
"],"
;
$date_line
.=
'[\''
.
$entry
[
'date'
]
.
'\', '
.
$entry
[
'count'
]
.
'],'
;
}
$this
->
plays_by_days
=
rtrim
(
$date_line
,
','
);
$this
->
plays_by_days
.=
"]"
;
$this
->
plays_by_days
.=
']'
;
}
}
...
...
nixtape/js/stats/user.js
View file @
23dac5ab
...
...
@@ -7,7 +7,7 @@ $(document).ready(function() {
color
:
'
#ff0000
'
,
rendererOptions
:
{
barDirection
:
'
horizontal
'
,
barWidth
:
15
barWidth
:
def_bar_width
}
},
axes
:
{
...
...
@@ -32,7 +32,7 @@ $(document).ready(function() {
color
:
'
#ff0000
'
,
rendererOptions
:
{
barDirection
:
'
horizontal
'
,
barWidth
:
15
barWidth
:
def_bar_width
}
},
axes
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment