• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Artist类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: insertMultiple

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


示例17: actionInject

 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));
 }
开发者ID:passport90,项目名称:charty,代码行数:46,代码来源:FactoryController.php


示例18: format

 /**
  * 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;
 }
开发者ID:cheese1,项目名称:ampache,代码行数:21,代码来源:clip.class.php


示例19: fromObject

 /**
  * {@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;
 }
开发者ID:lovek323,项目名称:rovi-tagger,代码行数:20,代码来源:Track.php


示例20: loadModel

 /**
  * 返回基于主键值的数据模型,主键值由 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;
 }
开发者ID:robebeye,项目名称:MusicDream,代码行数:21,代码来源:ArtistController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Artists类代码示例发布时间:2022-05-23
下一篇:
PHP Artisan类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap