Ampache
[ class tree: Ampache ] [ index: Ampache ] [ all elements ]

Class: Democratic

Source Location: /lib/class/democratic.class.php

Class Overview

tmpPlaylist
   |
   --Democratic

Democratic


Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 27]
Democratic

This class handles democratic play, which is a fancy name for voting based playback. This extends the tmpplaylist




[ Top ]


Class Variables

$base_playlist =

[line 34]



Tags:

access:  public

Type:   mixed
Overrides:   Array


[ Top ]

$cooldown =

[line 30]



Tags:

access:  public

Type:   mixed


[ Top ]

$level =

[line 31]



Tags:

access:  public

Type:   mixed


[ Top ]

$name =

[line 29]



Tags:

access:  public

Type:   mixed


[ Top ]

$primary =

[line 33]



Tags:

access:  public

Type:   mixed


[ Top ]

$tmp_playlist =

[line 37]



Tags:

access:  public

Type:   mixed


[ Top ]

$user =

[line 32]



Tags:

access:  public

Type:   mixed


[ Top ]



Class Methods


static method create [line 483]

static void create( $data)

create

This is the democratic play create function it inserts this into the democratic table




Tags:

access:  public


Overrides tmpPlaylist::create() (create)

Parameters:

   $data  

[ Top ]

static method delete [line 452]

static void delete( $democratic_id)

delete

This deletes a democratic playlist




Tags:

access:  public


Overrides tmpPlaylist::delete() (delete)

Parameters:

   $democratic_id  

[ Top ]

static method get_current_playlist [line 148]

static void get_current_playlist( )

get_current_playlist

This returns the curren users current playlist, or if specified this current playlist of the user




Tags:

access:  public


[ Top ]

static method get_playlists [line 125]

static void get_playlists( )

get_playlists This returns all of the current valid 'Democratic' Playlists that have been created.



Tags:

access:  public


[ Top ]

static method prune_tracks [line 511]

static void prune_tracks( )

prune_tracks

This replaces the normal prune tracks and correctly removes the votes as well




Tags:

access:  public


Overrides tmpPlaylist::prune_tracks() (prune_tracks)

[ Top ]

constructor __construct [line 43]

Democratic __construct( [ $id = ''])

constructor

We need a constructor for this class. It does it's own thing now




Tags:

access:  public


Overrides tmpPlaylist::__construct() (Constructor)

Parameters:

   $id  

[ Top ]

method add_vote [line 380]

void add_vote( $object_id, [ $object_type = ''])

add_vote

This takes a object id and user and actually inserts the row




Tags:

access:  public


Parameters:

   $object_id  
   $object_type  

[ Top ]

method clear [line 529]

void clear( )

clear This is really just a wrapper function, it clears the entire playlist including all votes etc.



Tags:

access:  public


Overrides tmpPlaylist::clear() (clear)

[ Top ]

method delete_votes [line 434]

void delete_votes( $row_id)

delete_votes

This removes the votes for the specified object on the current playlist




Tags:

access:  public


Parameters:

   $row_id  

[ Top ]

method format [line 95]

void format( )

format

This makes the objects variables all purrty so that they can be displayed




Tags:

access:  public


[ Top ]

method get_cool_songs [line 317]

void get_cool_songs( )

get_cool_songs This returns all of the song_ids for songs that have happened within the last 'cooldown' for this user.



Tags:

access:  public


[ Top ]

method get_items [line 183]

void get_items( )

get_items

This returns an array of all object_ids currently in this tmpPlaylist. This has gotten a little more complicated because of type, the values are an array

  1. being ID 1 being TYPE
FIXME: This is too complex, it makes my brain hurt [VOTE COUNT] [DATE OF NEWEST VOTE] [ROW ID] [OBJECT_ID] [OBJECT_TYPE]

Sorting does the following sort largest VOTE COUNT to top sort smallest DATE OF NEWEST VOTE]




Tags:

access:  public


Overrides tmpPlaylist::get_items() (get_items)

[ Top ]

method get_next_object [line 258]

void get_next_object( [ $offset = ''])

get_next_object

This returns the next object in the tmp_playlist most of the time this will just be the top entry, but if there is a base_playlist and no items in the playlist then it returns a random entry from the base_playlist




Tags:

access:  public


Overrides tmpPlaylist::get_next_object() (get_next_object)

Parameters:

   $offset  

[ Top ]

method get_uid_from_object_id [line 296]

void get_uid_from_object_id( $object_id, [ $object_type = ''])

get_uid_from_object_id

This takes an object_id and an object type and returns the ID for the row




Tags:

access:  public


Parameters:

   $object_id  
   $object_type  

[ Top ]

method get_url [line 237]

void get_url( )

get_url

This returns the special play URL for democratic play, only open to ADMINs




Tags:

access:  public


[ Top ]

method has_vote [line 352]

void has_vote( $object_id, [ $type = ''])

has_vote

This checks to see if the current user has already voted on this object




Tags:

access:  public


Parameters:

   $object_id  
   $type  

[ Top ]

method remove_vote [line 415]

void remove_vote( $row_id)

remove_vote

This is called to remove a vote by a user for an object, it uses the object_id As that's what we'll have most the time, no need to check if they've got an existing vote for this, just remove anything that is there




Tags:

access:  public


Parameters:

   $row_id  

[ Top ]

method set_parent [line 77]

void set_parent( )

set_parent

This returns the tmpPlaylist for this democratic play instance




Tags:

access:  public


[ Top ]

method update [line 472]

void update( $data)

update

This updates an existing democratic playlist item. It takes a key'd array just like the create




Tags:

access:  public


Parameters:

   $data  

[ Top ]

method vote [line 335]

void vote( $items)

vote

This function is called by users to vote on a system wide playlist This adds the specified objects to the tmp_playlist and adds a 'vote' by this user, naturally it checks to make sure that the user hasn't already voted on any of these objects




Tags:

access:  public


Parameters:

   $items  

[ Top ]


Documentation generated on Thu, 12 Feb 2009 07:59:57 +0900 by phpDocumentor 1.4.2