当前位置: 首页>>代码示例>>PHP>>正文


PHP Artist类代码示例

本文整理汇总了PHP中Artist的典型用法代码示例。如果您正苦于以下问题:PHP Artist类的具体用法?PHP Artist怎么用?PHP Artist使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Artist类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDetails

 /**
  * 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;
 }
开发者ID:humbertomn,项目名称:topmusic,代码行数:32,代码来源:artist.php

示例2: afterUpdate

 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;
 }
开发者ID:awidarto,项目名称:tmadminflat,代码行数:12,代码来源:AlbumController.php

示例3: getList

 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;
 }
开发者ID:developdms,项目名称:Practica-5,代码行数:14,代码来源:ManagerArtist.php

示例4: read

 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;
 }
开发者ID:novomancy,项目名称:dig540,代码行数:14,代码来源:Artist.php

示例5: testRemoveAlbumFromArtist

 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());
 }
开发者ID:alexgt9,项目名称:PlayCool,代码行数:7,代码来源:ArtistTest.php

示例6: getList

 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;
 }
开发者ID:ealvarez1990,项目名称:galeriaarte,代码行数:16,代码来源:ManageArtist.php

示例7: removeArtist

 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);
 }
开发者ID:mlauren,项目名称:midway-gallery,代码行数:7,代码来源:ArtistController.php

示例8: imageFromArtist

 /**
  * 
  * @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;
 }
开发者ID:hazrpg,项目名称:bandlogos,代码行数:23,代码来源:Artists.class.php

示例9: testStructureData

 /**
  * @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);
 }
开发者ID:nioc,项目名称:web-music-player,代码行数:12,代码来源:ArtistTest.php

示例10: getWeeklyArtistChart

 /** 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;
 }
开发者ID:niczak,项目名称:php-last.fm-api,代码行数:20,代码来源:Group.php

示例11: getTopArtists

 /** 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;
 }
开发者ID:niczak,项目名称:php-last.fm-api,代码行数:18,代码来源:Geo.php

示例12: addArtist

 /**
  * 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;
     }
 }
开发者ID:Alenpiera,项目名称:streeme,代码行数:24,代码来源:ArtistTable.class.php

示例13: add_artists

 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);
         }
     }
 }
开发者ID:radiowarwick,项目名称:digiplay,代码行数:19,代码来源:Advert.php

示例14: execute

 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');
 }
开发者ID:kenmaz,项目名称:www.kenmaz.net,代码行数:11,代码来源:IndexAction.class.php

示例15: insertAndGet

 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);
     }
 }
开发者ID:kenmaz,项目名称:www.kenmaz.net,代码行数:12,代码来源:Artist.class.php


注:本文中的Artist类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。