Add user tracking to both song requests and votes.

This commit is contained in:
Buster Neece 2014-05-26 04:51:15 -05:00
parent 51b87dabbc
commit d9c5ab60d6
3 changed files with 44 additions and 1 deletions

View File

@ -16,6 +16,12 @@ class SongVote extends \DF\Doctrine\Entity
{
$this->ip = self::getIp();
$this->timestamp = time();
if (\DF\Auth::isLoggedIn())
{
$user = \DF\Auth::getLoggedInUser();
$this->user = $user;
}
}
/**
@ -31,6 +37,9 @@ class SongVote extends \DF\Doctrine\Entity
/** @Column(name="station_id", type="integer") */
protected $station_id;
/** @Column(name="user_id", type="integer", nullable=true) */
protected $user_id;
/** @Column(name="ip", type="string", length=45) */
protected $ip;
@ -56,6 +65,14 @@ class SongVote extends \DF\Doctrine\Entity
*/
protected $station;
/**
* @ManyToOne(targetEntity="User")
* @JoinColumns({
* @JoinColumn(name="user_id", referencedColumnName="uid", onDelete="SET NULL")
* })
*/
protected $user;
/**
* Static Functions
*/

View File

@ -13,6 +13,12 @@ class StationRequest extends \DF\Doctrine\Entity
{
$this->timestamp = time();
$this->ip = $_SERVER['REMOTE_ADDR'];
if (\DF\Auth::isLoggedIn())
{
$user = \DF\Auth::getLoggedInUser();
$this->user = $user;
}
}
/**
@ -28,6 +34,9 @@ class StationRequest extends \DF\Doctrine\Entity
/** @Column(name="track_id", type="integer") */
protected $track_id;
/** @Column(name="user_id", type="integer", nullable=true) */
protected $user_id;
/** @Column(name="timestamp", type="integer") */
protected $timestamp;
@ -49,4 +58,12 @@ class StationRequest extends \DF\Doctrine\Entity
* })
*/
protected $track;
/**
* @ManyToOne(targetEntity="User")
* @JoinColumns({
* @JoinColumn(name="user_id", referencedColumnName="uid", onDelete="SET NULL")
* })
*/
protected $user;
}

View File

@ -36,6 +36,7 @@
padding-left: 5px;
padding-right: 10px;
padding-bottom: 8px;
cursor: default;
@ -49,7 +50,7 @@
padding-top: 3px;
}
.station.playing .media-body {
overflow: hidden;
overflow: initial;
padding-top: 3px;
padding-bottom: 3px;
}
@ -86,6 +87,10 @@
margin-top: 5px;
}
.station.playing .media-body {
text-shadow: 0.1em 0.1em 0.2em #000000;
}
.station.offline {
cursor: default;
}
@ -261,6 +266,10 @@ li.podcast {
padding-left: 5px;
}
.station .station-player-container a {
color: #149BDF;
}
/**
* Voting Functionality
*/