Ejemplo n.º 1
0
 public function testRemoveTrackFromAlbum()
 {
     $album = Album::create('id', 'Album name');
     $album->addTrack(Track::create('id', 'Track name'));
     $album->removeTrack(Track::create('id', 'Track name'));
     $this->assertCount(0, $album->getTracks());
 }
Ejemplo n.º 2
0
 /**
  * Gets track by url
  * @param  string $url
  * @return string
  */
 public static function search($query)
 {
     // create a client object with your app credentials
     $client = new Services_Soundcloud(Base::$g['soundcloud_client'], '');
     // find all sounds
     $tracks = $client->get('tracks', array('q' => $query, 'limit' => 40));
     $tracks = json_decode($tracks);
     $ret = array();
     foreach ($tracks as $track) {
         $table = Track::create();
         $table->scid = $track->id;
         $table->name = $track->title;
         $table->scurl = $track->permalink_url;
         $table->duration = round($track->duration / 1000);
         $table->save();
         $ret[] = $table->orm->asArray();
     }
     return $ret;
 }
Ejemplo n.º 3
0
<script type="text/javascript">
$(document).ready(function(){

});
</script>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
  <link rel="stylesheet" href="bootstrap-select.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
  <script src="bootstrap-select.js"></script>
<?php 
include 'models.php';
$track = isset($_GET['id']) ? Track::find($_GET['id']) : Track::create(null, null, 0, 0, 0, 1);
?>



	
</head>
<body>
<div class="jumbotron" >
<div class="container"><?php 
if (isset($track->TrackId)) {
    ?>
			<h1>Track</h1>
			<?php 
} else {
    ?>
Ejemplo n.º 4
0
<?php

include 'models.php';
if (isset($_POST['id'])) {
    $a = Track::find($_POST['id']);
    $a->Name = $_POST['name'];
    $a->Album = intval($_POST['album']);
    $a->Composer = $_POST['composer'];
    $a->Milliseconds = $_POST['milliseconds'];
    $a->Bytes = $_POST['bytes'];
    $a->UnitPrice = $_POST['unitprice'];
    if ($a->save()) {
        header("Location: " . "../index.php?id=" . $a->TrackId);
    }
} else {
    $a = Track::create($_POST['name'], $_POST['composer'], $_POST['milliseconds'], $_POST['bytes'], $_POST['unitprice'], intval($_POST['album']));
    if ($a->save()) {
        header("Location: " . "../index.php?id=" . $a->TrackId);
    }
}