Inheritance: extends AppModel
Esempio n. 1
0
 /**
  * Gets details from the referenced artist
  *
  * @param String[Required] $id
  * @return String
  */
 public function getDetails($id)
 {
     // If it's an ajax search
     $json_content = file_get_contents('php://input');
     if ($json_content) {
         // Gets JSON request to read country name typed
         $data = json_decode($json_content);
         $id = $data->id;
         $response = array();
         // Gets details from artist
         $artist = new Artist();
         $artist_info = $artist->getById($id);
         $response['name'] = $artist_info['name'];
         $response['img'] = $artist_info['img'];
         // Gets top tracks
         $response['tracks'] = $artist->getTopTracks($id);
         // Returns JSON for AngularJS
         print json_encode($response);
         exit;
     }
     // If it's a GET request, just displays the HTML
     $template = 'views/artist/details.html';
     $html = file_get_contents($template);
     $html = str_replace('$id', $id, $html);
     print $html;
 }
Esempio n. 2
0
 public function afterUpdate($id, $data = null)
 {
     $artist = Artist::where('artistName', '=', $data['artist'])->where('ownerId', '=', Auth::user()->_id)->first();
     if ($artist == null) {
         $artist = new Artist();
     }
     $artist->artistName = $data['artist'];
     $artist->ownerId = Auth::user()->_id;
     $artist->ownerName = Auth::user()->firstname . ' ' . Auth::user()->lastname;
     $artist->save();
     return $id;
 }
Esempio n. 3
0
 function getList($params = NULL, $proyection = '*', $order = '1', $limit = '')
 {
     if ($this->db != NULL) {
         $this->db->read($this->table, $proyection, $params);
         $r = array();
         while ($param = $this->db->getRow()) {
             $artist = new Artist();
             $artist->set($param);
             $r[] = $artist;
         }
         return $r;
     }
     return NULL;
 }
Esempio n. 4
0
 public static function read($id)
 {
     global $db;
     if ($db) {
         $q = $db->prepare('SELECT * FROM `artist` WHERE id = ?');
         $q->execute(array($id));
         if ($item = $q->fetch()) {
             $artist = new Artist($item['name'], $item['origin'], $item['active_years']);
             $artist->setID($item['id']);
             return $item;
         }
     }
     return false;
 }
Esempio n. 5
0
 public function testRemoveAlbumFromArtist()
 {
     $artist = Artist::create('id', 'Artist name');
     $artist->addAlbum(Album::create('id', 'Album name'));
     $artist->removeAlbum(Album::create('id', 'Album name'));
     $this->assertCount(0, $artist->getAlbums());
 }
Esempio n. 6
0
 function getList($pagina = 1, $orden = "", $nrpp = Configuracion::NRPP, $condicion = "1=1", $parametros = array())
 {
     $ordenPredeterminado = "{$orden}, email";
     if (trim($orden) === "" || trim($orden) === NULL) {
         $ordenPredeterminado = "titulo";
     }
     $registroInicial = ($pagina - 1) * $nrpp;
     $this->bd->select($this->tabla, "*", $condicion, $parametros, $ordenPredeterminado, "{$registroInicial}, {$nrpp}");
     $r = array();
     while ($fila = $this->bd->getRow()) {
         $artista = new Artist();
         $artista->set($fila);
         $r[] = $artista;
     }
     return $r;
 }
 public function removeArtist($id)
 {
     $artist = Artist::find($id);
     $name = $artist->name;
     $artist->delete();
     return Redirect::route('account')->with('status', 'alert-success')->with('global', 'You just deleted ' . $name);
 }
Esempio n. 8
0
 /**
  * 
  * @param Artist $artist Infos of the artist
  * @return resource Resource of the image
  */
 public static function imageFromArtist(Artist $artist)
 {
     $image = null;
     $path = self::$baseDirectoryLogos . $artist->getPathLogo();
     switch ($artist->getExtensionLogo()) {
         case 'gif':
             $image = imagecreatefromgif($path);
             break;
         case 'jpeg':
         case 'jpg':
             $image = imagecreatefromjpeg($path);
             break;
         case 'png':
             $image = imagecreatefrompng($path);
             break;
     }
     return $image;
 }
Esempio n. 9
0
 /**
  * @covers Artist::structureData
  */
 public function testStructureData()
 {
     $this->object->id = '50';
     $this->object->name = 'artistName50';
     $artist = $this->object->structureData();
     $this->assertInstanceOf(Artist::class, $artist, 'Result should be an instance of Artist class');
     $this->assertEquals(50, $artist->id, 'Id should be convert in integer');
     $this->assertEquals('artistName50', $artist->name, 'Name should be set to artistName50, but found:' . $artist->name);
 }
Esempio n. 10
0
 /** Get an artist chart for a group, for a given date range. If no date range is supplied, it will return the most recent album chart for this group.
  *
  * @param	string	$group	The last.fm group name to fetch the charts of. (Required)
  * @param	integer	$from	The date at which the chart should start from. See {@link de.felixbruns.lastfm.Group#getWeeklyChartList Group::getWeeklyChartList} for more. (Optional)
  * @param	integer	$to		The date at which the chart should end on. See {@link de.felixbruns.lastfm.Group#getWeeklyChartList Group::getWeeklyChartList} for more. (Optional)
  * @return	array			An array of Artist objects.
  *
  * @static
  * @access	public
  * @throws	Error
  */
 public static function getWeeklyArtistChart($group, $from = null, $to = null)
 {
     $xml = CallerFactory::getDefaultCaller()->call('group.getWeeklyArtistChart', array('group' => $group, 'from' => $from, 'to' => $to));
     $artists = array();
     foreach ($xml->children() as $artist) {
         $artists[] = Artist::fromSimpleXMLElement($artist);
     }
     return $artists;
 }
Esempio n. 11
0
 /** Get the most popular artists on last.fm by country.
  *
  * @param	string	country		A country name, as defined by the ISO 3166-1 country names standard. (Required)
  * @return	array				An array of Artist objects.
  *
  * @static
  * @access	public
  * @throws	Error
  */
 public static function getTopArtists($country)
 {
     $xml = CallerFactory::getDefaultCaller()->call('geo.getTopArtists', array('country' => $country));
     $artists = array();
     foreach ($xml->children() as $artist) {
         $artists[] = Artist::fromSimpleXMLElement($artist);
     }
     return $artists;
 }
Esempio n. 12
0
 /**
  * Add an Artist to the database or get its key if it exists
  * @param name str: the name of the artist to add
  * @return     int: the primary key added or found
  */
 public function addArtist($name)
 {
     //is this name already in the collection?
     $q = Doctrine_Query::create()->select('a.id')->from('Artist a')->where('a.name = ?', $name);
     $result = $q->fetchOne();
     if (is_object($result) && $result->id > 0) {
         $retId = $result->id;
         unset($q, $result);
         return (int) $retId;
     } else {
         $item = new Artist();
         $item->name = $name;
         $item->save();
         $id = $item->getId();
         $item->free();
         unset($item, $q, $result);
         return (int) $id;
     }
 }
Esempio n. 13
0
 public function add_artists($artists)
 {
     if (!is_array($artists)) {
         $artists = array($artists);
     }
     foreach ($artists as $artist) {
         if ($artist == "") {
             continue;
         }
         $exists = Artists::get_by_name($artist);
         if ($exists) {
             $exists->add_to_track($this);
         } else {
             $object = new Artist();
             $object->set_name($artist);
             $object->add_to_track($this);
         }
     }
 }
Esempio n. 14
0
 public function execute($smarty, $params, $session)
 {
     $smarty->assign('name', $session['screen_name']);
     $artists = Artist::findAll();
     $smarty->assign('artists', $artists);
     $songs = Song::findAll();
     $smarty->assign('songs', $songs);
     $parts = Part::findAll();
     $smarty->assign('parts', $parts);
     $smarty->display('index.tpl');
 }
Esempio n. 15
0
 public static function insertAndGet($pdo, $name)
 {
     $st = $pdo->prepare('select * from artists where name = ?');
     $st->execute(array($name));
     if ($row = $st->fetch()) {
         return Artist::factory($row);
     } else {
         $st = $pdo->prepare('insert into artists(name) values(?)');
         $st->execute(array($name));
         return self::insertAndGet($pdo, $name);
     }
 }
Esempio n. 16
0
 public static function insertMultiple($tracks)
 {
     // build insert multiple data
     $model = self::model();
     $track_sql = "INSERT IGNORE INTO {$model->tableName()} (hash, title, artist_hash, created_at, updated_at) VALUES ";
     $values_sql = array();
     foreach ($tracks as $hash => $track) {
         $title = Artist::mres($track['title']);
         $values_sql[] = "('{$hash}', '{$title}', '{$track['artist_hash']}', NOW(), NOW())";
     }
     $track_sql .= implode(', ', $values_sql);
     return Yii::app()->getDb()->createCommand($track_sql)->execute();
 }
Esempio n. 17
0
 public function actionInject()
 {
     header('Content-type:application/json');
     $post = Yii::app()->getRequest()->getPost('chart');
     $weeks = $post['weeks'];
     $artists = array();
     $tracks = array();
     $chart_entries = array();
     // traverse $week
     /* weeks : [
      *  {
      *      week : 1,
      *      year : 2008,
      *      tracks : [{
      *          start : 0,
      *          mark : 1,
      *          position : 32,
      *          track : "Sexual Eruption",
      *          artist : "Snoop Dogg"
      *      }]
      *  }
      * ]
      */
     foreach ($weeks as $week) {
         foreach ($week['tracks'] as $chart_entry) {
             // populate artists
             $artist_name = $chart_entry['artist'];
             $artist_hash = md5($artist_name);
             if (!isset($artists[$artist_hash])) {
                 $artists[$artist_hash] = $artist_name;
             }
             // populate tracks
             $track_title = $chart_entry['track'];
             $track_hash = md5("{$track_title}\\%charty\\%{$artist_name}");
             if (!isset($tracks[$track_hash])) {
                 $tracks[$track_hash] = array('title' => $track_title, 'artist_hash' => $artist_hash);
             }
             // populate chart_entry_data
             $chart_entries[] = array('year' => $week['year'], 'week' => $week['week'], 'position' => $chart_entry['position'], 'track_hash' => $track_hash);
         }
     }
     $inserted_artists = Artist::insertMultiple($artists);
     $inserted_tracks = Track::insertMultiple($tracks);
     $inserted_chart_entries = ChartEntry::insertMultiple($chart_entries);
     echo json_encode(array('inserted_artists' => $inserted_artists, 'inserted_tracks' => $inserted_tracks, 'inserted_chart_entries' => $inserted_chart_entries));
 }
Esempio n. 18
0
 /**
  * format
  * this function takes the object and reformats some values
  */
 public function format($details = true)
 {
     parent::format($details);
     if ($details) {
         if ($this->artist) {
             $artist = new Artist($this->artist);
             $artist->format();
             $this->f_artist = $artist->link;
         }
         if ($this->song) {
             $song = new Song($this->song);
             $song->format();
             $this->f_song = $song->f_link;
         }
     }
     return true;
 }
Esempio n. 19
0
 /**
  * {@inheritDoc}
  */
 public static function fromObject($object)
 {
     $retval = new Track();
     $retval->ids = (array) $object->ids;
     $retval->title = $object->title;
     $retval->performers = Artist::fromObjectArray((array) $object->performers);
     $retval->composers = Artist::fromObjectArray((array) $object->composers);
     $retval->part = $object->part;
     $retval->duration = $object->duration;
     $retval->disc = $object->disc;
     $retval->isPick = $object->isPick;
     $retval->hasReview = $object->hasReview;
     $retval->sample = $object->sample;
     $retval->flags = $object->flags;
     $retval->number = $object->array_index;
     return $retval;
 }
Esempio n. 20
0
 /**
  * 返回基于主键值的数据模型,主键值由 GET 变量提供。
  * 若数据模型没有找到,一个 HTTP 异常被唤起。
  */
 public function loadModel()
 {
     if ($this->_model === null) {
         if (isset($_GET['id'])) {
             if (Yii::app()->user->name == "admin") {
                 $condition = '';
             } else {
                 $condition = 'proved=' . Artist::STATUS_PROVED;
             }
             $this->_model = Artist::model()->findbyPk($_GET['id'], $condition);
         }
         if ($this->_model === null) {
             throw new CHttpException(404, '您所请求的页面不存在。');
         }
     }
     return $this->_model;
 }
Esempio n. 21
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $list = [];
     $n = 0;
     DB::table('tmp_musics')->chunk(10000, function ($data) use(&$list, &$n) {
         foreach ($data as $record) {
             ++$n;
             // 合并整段记录
             $key = implode('_', [$record->audio_part, $record->acrid]);
             if (empty($list) or isset($list[$key])) {
                 $list[$key][] = $record;
                 if (!empty($record->acrid)) {
                     continue;
                 }
                 // 插入数据
             } else {
                 // 插入歌手记录
                 $list = current($list);
                 $first = current($list);
                 $end = end($list);
                 $artistIds = [];
                 foreach (explode('|', $first->artists) as $name) {
                     $artist = Artist::firstOrCreate(['name' => $name]);
                     $artist->increment('counts', 1);
                     $artistIds[] = $artist->id;
                 }
                 // 插入音乐记录
                 $music = Music::firstOrCreate(['title' => $first->title, 'album' => $first->album, 'genres' => $first->genres, 'label' => $first->label, 'release_date' => $first->release_date, 'acrid' => $first->acrid, 'isrc' => $first->isrc, 'upc' => $first->upc, 'external_metadata' => $first->external_metadata]);
                 // 插入音乐歌手记录
                 $music->artists()->sync($artistIds);
                 // 插入节目音乐记录
                 Program::where('date', $first->program_date)->first()->musics()->attach($music->id, ['program_part' => $first->audio_part, 'start_sec' => $first->audio_start_sec, 'end_sec' => $end->audio_start_sec, 'url' => self::getQiniuUrl($first->program_date, $first->audio_start_sec, $end->audio_start_sec)]);
                 // 插入节目歌手记录
                 foreach ($music->artists as $artist) {
                     Program::where('date', $first->program_date)->first()->artists()->attach($artist->id);
                 }
                 // 输出日志
                 $this->info(implode("\t", [$n, $music->id, $first->artists, $first->title]));
             }
             // 清空列表
             $list = [];
         }
     });
 }
Esempio n. 22
0
 public function run()
 {
     $model = new Album();
     if (isset($_GET['artist_id'])) {
         $artist_id = $_GET['artist_id'];
         $artist_info = Artist::model()->findByPk($artist_id);
         $model->artist_id = $artist_id;
     }
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Album'])) {
         $model->attributes = $_POST['Album'];
         $model->image = CUploadedFile::getInstance($model, 'image');
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
Esempio n. 23
0
    public static function add($userId, $artistName, $songName, $partName)
    {
        $pdo = new PDO('mysql:host=localhost; dbname=twitter_band', 'root', '');
        $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        $artist = Artist::insertAndGet($pdo, $artistName);
        $song = Song::insertAndGet($pdo, $songName, $artist);
        $part = Part::insertAndGet($pdo, $partName);
        $st = $pdo->prepare('
			select * from repertoire 
			where user_id = ? and artist_id = ? and song_id = ? and part_id = ?');
        $st->execute(array($userId, $artist->id, $song->id, $part->id));
        if ($row = $st->fetch()) {
            return true;
        } else {
            $st = $pdo->prepare('			
				insert into repertoire(user_id, artist_id, song_id, part_id) values(?,?,?,?)');
            $res = $st->execute(array($userId, $artist->id, $song->id, $part->id));
            return true;
        }
    }
Esempio n. 24
0
 /**
  * {@inheritDoc}
  */
 public static function fromObject($object)
 {
     $retval = new Album();
     $retval->ids = (array) $object->ids;
     $retval->title = $object->title;
     $retval->primaryArtists = Artist::fromObjectArray((array) $object->primaryArtists);
     $retval->guestArtists = Artist::fromObjectArray((array) $object->guestArtists);
     $retval->flags = $object->flags;
     $retval->duration = $object->duration;
     $retval->originalReleaseDate = $object->originalReleaseDate;
     $retval->rating = $object->rating;
     $retval->isPick = $object->isPick;
     $retval->genres = Genre::fromObjectArray((array) $object->genres);
     $retval->headlineReview = $object->headlineReview;
     $retval->classicalReview = ClassicalReview::fromObject($object->classicalReview);
     $retval->credits = Credit::fromObjectArray((array) $object->credits);
     $retval->tracks = Track::fromObjectArray((array) $object->tracks);
     $retval->styles = Style::fromObjectArray((array) $object->styles);
     return $retval;
 }
Esempio n. 25
0
 /** Get a Tasteometer score from two inputs, along with a list of shared artists. If the input is a User or a Myspace URL, some additional information is returned.
  *
  * @param	integer	$type1	A Tasteometer comparison type. (Required)
  * @param	integer	$type2	A Tasteometer comparison type. (Required)
  * @param	mixed	$value1	A last.fm username, an array of artist names or a myspace profile URL. (Required)
  * @param	mixed	$value2	A last.fm username, an array of artist names or a myspace profile URL. (Required)
  * @param	integer	$limit	How many shared artists to display (default = 5). (Optional)
  * @return	array			An array containing comparison results, input information and shared artists.
  *
  * @static
  * @access	public
  * @throws	Error
  */
 public static function compare($type1, $type2, $value1, $value2, $limit = null)
 {
     /* Handle arrays of artist names. */
     if (is_array($value1)) {
         $value1 = implode(',', $value1);
     }
     if (is_array($value2)) {
         $value2 = implode(',', $value2);
     }
     /* API call. */
     $xml = CallerFactory::getDefaultCaller()->call('tasteometer.compare', array('type1' => $type1, 'type2' => $type2, 'value1' => $value1, 'value2' => $value2, 'limit' => $limit));
     /* Get shared artists. */
     $artists = array();
     foreach ($xml->result->artists->children() as $artist) {
         $artists[] = Artist::fromSimpleXMLElement($artist);
     }
     /* Get input information. */
     $inputs = array();
     foreach ($xml->input->children() as $input) {
         $inputs[] = User::fromSimpleXMLElement($input);
     }
     return array('score' => Util::toFloat($xml->result->score), 'input' => $inputs, 'artists' => $artists);
 }
Esempio n. 26
0
 public function run($region = 1, $type = 2)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'proved=:proved';
     $criteria->params = array(':proved' => Artist::STATUS_PROVED);
     $criteria->order = "sort ASC,add_time DESC";
     $criteria->group = 'sort,id';
     $region = (int) $region;
     $type = (int) $type;
     $criteria->addSearchCondition('area_id', $region);
     $criteria->addSearchCondition('type_id', $type);
     $rawData = Artist::model()->findAll($criteria);
     $value = Yii::app()->cache->get('ARTISTS_' . $region . '_' . $type);
     if ($value === false) {
         $dataProvider = new CArrayDataProvider($rawData, array('id' => 'artist', 'pagination' => array('pageSize' => 500)));
         Yii::app()->cache->set('ARTISTS_' . $region . '_' . $type, $dataProvider, 10);
     } else {
         $dataProvider = $value;
     }
     $regionData = ArtistArea::model()->findByPk($region);
     $typeData = ArtistType::model()->findByPk($type);
     $this->render('index', array('dataProvider' => $dataProvider, 'region' => $region, 'type' => $type, 'regionData' => $regionData, 'typeData' => $typeData));
 }
Esempio n. 27
0
     break;
 case 'single_song':
     $media_ids[] = array('object_type' => 'song', 'object_id' => scrub_in($_REQUEST['song_id']), 'custom_play_action' => $_REQUEST['custom_play_action']);
     break;
 case 'single_video':
     $media_ids[] = array('object_type' => 'video', 'object_id' => scrub_in($_REQUEST['video_id']));
     break;
 case 'artist':
     $artist = new Artist($_REQUEST['artist_id']);
     $songs = $artist->get_songs();
     foreach ($songs as $song) {
         $media_ids[] = array('object_type' => 'song', 'object_id' => $song);
     }
     break;
 case 'artist_random':
     $artist = new Artist($_REQUEST['artist_id']);
     $media_ids = $artist->get_random_songs();
     break;
 case 'album_random':
     $album = new Album($_REQUEST['album_id']);
     $media_ids = $album->get_random_songs();
     break;
 case 'album':
     debug_event('stream.php', 'Playing/Adding all songs of album(s) {' . $_REQUEST['album_id'] . '}...', '5');
     $albums_array = explode(',', $_REQUEST['album_id']);
     foreach ($albums_array as $a) {
         $album = new Album($a);
         $songs = $album->get_songs();
         foreach ($songs as $song) {
             $media_ids[] = array('object_type' => 'song', 'object_id' => $song);
         }
Esempio n. 28
0
 /**
  * show_objects
  * This takes an array of objects
  * and requires the correct template based on the
  * type that we are currently browsing
  *
  * @param int[] $object_ids
  */
 public function show_objects($object_ids = null, $argument = null)
 {
     if ($this->is_simple() || !is_array($object_ids)) {
         $object_ids = $this->get_saved();
     } else {
         $this->save_objects($object_ids);
     }
     // Limit is based on the user's preferences if this is not a
     // simple browse because we've got too much here
     if ($this->get_start() >= 0 && count($object_ids) > $this->get_start() && !$this->is_simple()) {
         $object_ids = array_slice($object_ids, $this->get_start(), $this->get_offset(), true);
     } else {
         if (!count($object_ids)) {
             $this->set_total(0);
         }
     }
     // Load any additional object we need for this
     $extra_objects = $this->get_supplemental_objects();
     $browse = $this;
     foreach ($extra_objects as $class_name => $id) {
         ${$class_name} = new $class_name($id);
     }
     $match = '';
     // Format any matches we have so we can show them to the masses
     if ($filter_value = $this->get_filter('alpha_match')) {
         $match = ' (' . $filter_value . ')';
     } elseif ($filter_value = $this->get_filter('starts_with')) {
         $match = ' (' . $filter_value . ')';
         /*} elseif ($filter_value = $this->get_filter('regex_match')) {
               $match = ' (' . $filter_value . ')';
           } elseif ($filter_value = $this->get_filter('regex_not_match')) {
               $match = ' (' . $filter_value . ')';*/
     } elseif ($filter_value = $this->get_filter('catalog')) {
         // Get the catalog title
         $catalog = Catalog::create_from_id(intval($filter_value));
         $match = ' (' . $catalog->name . ')';
     }
     $type = $this->get_type();
     // Update the session value only if it's allowed on the current browser
     if ($this->get_update_session()) {
         $_SESSION['browse_current_' . $type]['start'] = $browse->get_start();
     }
     // Set the correct classes based on type
     $class = "box browse_" . $type;
     $argument_param = $argument ? '&argument=' . scrub_in($argument) : '';
     debug_event('browse', 'Show objects called for type {' . $type . '}', '5');
     $limit_threshold = $this->get_threshold();
     // Switch on the type of browsing we're doing
     switch ($type) {
         case 'song':
             $box_title = T_('Songs') . $match;
             Song::build_cache($object_ids, $limit_threshold);
             $box_req = AmpConfig::get('prefix') . '/templates/show_songs.inc.php';
             break;
         case 'album':
             Album::build_cache($object_ids);
             $box_title = T_('Albums') . $match;
             if (is_array($argument)) {
                 $allow_group_disks = $argument['group_disks'];
                 if ($argument['title']) {
                     $box_title = $argument['title'];
                 }
             } else {
                 $allow_group_disks = false;
             }
             $box_req = AmpConfig::get('prefix') . '/templates/show_albums.inc.php';
             break;
         case 'user':
             $box_title = T_('Users') . $match;
             $box_req = AmpConfig::get('prefix') . '/templates/show_users.inc.php';
             break;
         case 'artist':
             $box_title = T_('Artists') . $match;
             Artist::build_cache($object_ids, true, $limit_threshold);
             $box_req = AmpConfig::get('prefix') . '/templates/show_artists.inc.php';
             break;
         case 'live_stream':
             require_once AmpConfig::get('prefix') . '/templates/show_live_stream.inc.php';
             $box_title = T_('Radio Stations') . $match;
             $box_req = AmpConfig::get('prefix') . '/templates/show_live_streams.inc.php';
             break;
         case 'playlist':
             Playlist::build_cache($object_ids);
             $box_title = T_('Playlists') . $match;
             $box_req = AmpConfig::get('prefix') . '/templates/show_playlists.inc.php';
             break;
         case 'playlist_song':
             $box_title = T_('Playlist Songs') . $match;
             $box_req = AmpConfig::get('prefix') . '/templates/show_playlist_songs.inc.php';
             break;
         case 'playlist_localplay':
             $box_title = T_('Current Playlist');
             $box_req = AmpConfig::get('prefix') . '/templates/show_localplay_playlist.inc.php';
             UI::show_box_bottom();
             break;
         case 'smartplaylist':
             $box_title = T_('Smart Playlists') . $match;
             $box_req = AmpConfig::get('prefix') . '/templates/show_searches.inc.php';
             break;
         case 'catalog':
             $box_title = T_('Catalogs');
             $box_req = AmpConfig::get('prefix') . '/templates/show_catalogs.inc.php';
             break;
         case 'shoutbox':
             $box_title = T_('Shoutbox Records');
             $box_req = AmpConfig::get('prefix') . '/templates/show_manage_shoutbox.inc.php';
             break;
         case 'tag':
             Tag::build_cache($object_ids);
             $box_title = T_('Tag Cloud');
             $box_req = AmpConfig::get('prefix') . '/templates/show_tagcloud.inc.php';
             break;
         case 'video':
             Video::build_cache($object_ids);
             $video_type = 'video';
             $box_title = T_('Videos');
             $box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php';
             break;
         case 'democratic':
             $box_title = T_('Democratic Playlist');
             $box_req = AmpConfig::get('prefix') . '/templates/show_democratic_playlist.inc.php';
             break;
         case 'wanted':
             $box_title = T_('Wanted Albums');
             $box_req = AmpConfig::get('prefix') . '/templates/show_wanted_albums.inc.php';
             break;
         case 'share':
             $box_title = T_('Shared Objects');
             $box_req = AmpConfig::get('prefix') . '/templates/show_shared_objects.inc.php';
             break;
         case 'song_preview':
             $box_title = T_('Songs');
             $box_req = AmpConfig::get('prefix') . '/templates/show_song_previews.inc.php';
             break;
         case 'channel':
             $box_title = T_('Channels');
             $box_req = AmpConfig::get('prefix') . '/templates/show_channels.inc.php';
             break;
         case 'broadcast':
             $box_title = T_('Broadcasts');
             $box_req = AmpConfig::get('prefix') . '/templates/show_broadcasts.inc.php';
             break;
         case 'license':
             $box_title = T_('Media Licenses');
             $box_req = AmpConfig::get('prefix') . '/templates/show_manage_license.inc.php';
             break;
         case 'tvshow':
             $box_title = T_('TV Shows');
             $box_req = AmpConfig::get('prefix') . '/templates/show_tvshows.inc.php';
             break;
         case 'tvshow_season':
             $box_title = T_('Seasons');
             $box_req = AmpConfig::get('prefix') . '/templates/show_tvshow_seasons.inc.php';
             break;
         case 'tvshow_episode':
             $box_title = T_('Episodes');
             $video_type = $type;
             $box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php';
             break;
         case 'movie':
             $box_title = T_('Movies');
             $video_type = $type;
             $box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php';
             break;
         case 'clip':
             $box_title = T_('Clips');
             $video_type = $type;
             $box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php';
             break;
         case 'personal_video':
             $box_title = T_('Personal Videos');
             $video_type = $type;
             $box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php';
             break;
         case 'label':
             $box_title = T_('Labels');
             $box_req = AmpConfig::get('prefix') . '/templates/show_labels.inc.php';
             break;
         case 'pvmsg':
             $box_title = T_('Private Messages');
             $box_req = AmpConfig::get('prefix') . '/templates/show_pvmsgs.inc.php';
             break;
         default:
             // Rien a faire
             break;
     }
     // end switch on type
     Ajax::start_container($this->get_content_div(), 'browse_content');
     if ($this->get_show_header()) {
         if (isset($box_req) && isset($box_title)) {
             UI::show_box_top($box_title, $class);
         }
     }
     if (isset($box_req)) {
         require $box_req;
     }
     if ($this->get_show_header()) {
         if (isset($box_req)) {
             UI::show_box_bottom();
         }
         echo '<script type="text/javascript">';
         echo Ajax::action('?page=browse&action=get_filters&browse_id=' . $this->id . $argument_param, '');
         echo ';</script>';
     } else {
         if (!$this->get_use_pages()) {
             $this->show_next_link($argument);
         }
     }
     Ajax::end_container();
 }
Esempio n. 29
0
         break;
     }
     $album = new Album($album_id[0]);
     $songs = $album->get_songs();
     foreach ($songs as $song_id) {
         $GLOBALS['user']->playlist->add_object($song_id, 'song');
     }
     $results['rightbar'] = UI::ajax_include('rightbar.inc.php');
     break;
 case 'artist':
     $artist_id = Random::artist();
     if (!$artist_id) {
         $results['rfc3514'] = '0x1';
         break;
     }
     $artist = new Artist($artist_id);
     $songs = $artist->get_songs();
     foreach ($songs as $song_id) {
         $GLOBALS['user']->playlist->add_object($song_id, 'song');
     }
     $results['rightbar'] = UI::ajax_include('rightbar.inc.php');
     break;
 case 'playlist':
     $playlist_id = Random::playlist();
     if (!$playlist_id) {
         $results['rfc3514'] = '0x1';
         break;
     }
     $playlist = new Playlist($playlist_id);
     $items = $playlist->get_items();
     foreach ($items as $item) {
    echo T_('Similar Artists');
    ?>
</label>
        <?php 
    foreach ($artists as $a) {
        ?>
            <div class="np_cell cel_similar_artist">
            <?php 
        if (is_null($a['id'])) {
            if (AmpConfig::get('wanted') && $a['mbid']) {
                echo "<a class=\"missing_album\" href=\"" . AmpConfig::get('web_path') . "/artists.php?action=show_missing&mbid=" . $a['mbid'] . "\" title=\"" . scrub_out($a['name']) . "\">" . scrub_out($a['name']) . "</a>";
            } else {
                echo scrub_out($a['name']);
            }
        } else {
            $artist = new Artist($a['id']);
            $artist->format();
            echo $artist->f_link;
        }
        ?>
            </div>
        <?php 
    }
    ?>
    </div>
</div>
<?php 
}
?>

<?php