summaryrefslogtreecommitdiffstats
path: root/lib/class/artist.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-08-06 01:57:29 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-08-06 01:57:29 +0000
commitfb5c43b2df8a190fecfe4bf04bcd64aa1bad9c2d (patch)
tree86cee2ea4acaaf51dae5f4732d13e54213f12137 /lib/class/artist.class.php
parent573c3014b982bd52f0b6959f51d65dfc86ae35c0 (diff)
downloadampache-fb5c43b2df8a190fecfe4bf04bcd64aa1bad9c2d.tar.gz
ampache-fb5c43b2df8a190fecfe4bf04bcd64aa1bad9c2d.tar.bz2
ampache-fb5c43b2df8a190fecfe4bf04bcd64aa1bad9c2d.zip
proof of concept, nothing one should actually use
Diffstat (limited to 'lib/class/artist.class.php')
-rw-r--r--lib/class/artist.class.php31
1 files changed, 28 insertions, 3 deletions
diff --git a/lib/class/artist.class.php b/lib/class/artist.class.php
index 2d12e8c6..15258e66 100644
--- a/lib/class/artist.class.php
+++ b/lib/class/artist.class.php
@@ -31,18 +31,21 @@ class Artist {
public $albums;
public $prefix;
+ // Constructed vars
+ public $_fake = false; // Set if construct_from_array() used
+
/**
* Artist
* Artist class, for modifing a artist
* Takes the ID of the artist and pulls the info from the db
*/
- function Artist($artist_id = 0) {
+ public function __construct($id='') {
/* If they failed to pass in an id, just run for it */
- if (!$artist_id) { return false; }
+ if (!$id) { return false; }
/* Assign id for use in get_info() */
- $this->id = intval($artist_id);
+ $this->id = intval($id);
/* Get the information from the db */
$info = $this->_get_info();
@@ -56,6 +59,25 @@ class Artist {
} //constructor
/**
+ * construct_from_array
+ * This is used by the metadata class specifically but fills out a Artist object
+ * based on a key'd array, it sets $_fake to true
+ */
+ public static function construct_from_array($data) {
+
+ $artist = new Artist(0);
+ foreach ($data as $key=>$value) {
+ $artist->$key = $value;
+ }
+
+ //Ack that this is not a real object from the DB
+ $artist->_fake = true;
+
+ return $artist;
+
+ } // construct_from_array
+
+ /**
* _get_info
* get's the vars for $this out of the database taken from the object
*/
@@ -186,6 +208,9 @@ class Artist {
$name = truncate_with_ellipsis(trim($this->prefix . " " . $this->name));
$this->f_name = $name;
+ // If this is a fake object, we're done here
+ if ($this->_fake) { return true; }
+
$this->f_name_link = "<a href=\"" . Config::get('web_path') . "/artists.php?action=show&amp;artist=" . $this->id . "\" title=\"" . $this->full_name . "\">" . $name . "</a>";
// Get the counts