Ejemplo n.º 1
0
 /**
  * Define Index page title and load template files
  */
 public function listen($parameter)
 {
     $playlistSlug = $parameter[0];
     $albumModel = new Album();
     $this->data['playlist'] = Album::row('album_slug', $playlistSlug);
     $this->data['songs'] = \Models\Playlist::items($this->data['playlist']->album_id);
     $this->data['title'] = 'Listen ';
     // $albumModel = new \Models\Album;
     // $albumitemModel = new \Models\Albumitem;
     // $this->data['slider'] = $albumModel->name('homes');
     View::renderTemplate('header', $this->data);
     View::renderTemplate('sidebar', $this->data);
     View::render('playlist/listen.playlist', $this->data);
     View::renderTemplate('footer', $this->data);
 }
Ejemplo n.º 2
0
 /**
  * remove song from playlist
  **/
 public function untag($parameter)
 {
     $song_id = $parameter[0];
     $playlist_id = $parameter[1];
     $model = new \Models\Playlist();
     $item = $model->find($id);
     $delete = $model->delete(array('playlist_album_id' => $playlist_id, 'playlist_song_id' => $song_id));
     if ($delete > 0) {
         Session::set('success', 'record deleted!');
     } else {
         Session::set('error', 'operation fails!');
     }
     Url::previous();
 }
Ejemplo n.º 3
0
 /**
  * add songs to playlist
  *
  **/
 public function tagplaylist($param)
 {
     $album_id = $param[0];
     $songModel = new \Models\Song();
     $tagModel = new \Models\Songtag();
     $playlistModel = new Playlist();
     $album_detail = $this->albumModel->find($album_id);
     $this->data['title'] = ucfirst($album_detail->album_name);
     if (isset($_POST) && !empty($_POST)) {
         //attach tags
         if (count($_POST['tag_songs']) > 0) {
             foreach ($_POST['tag_songs'] as $item) {
                 $playlistArray = array('playlist_album_id' => $album_id, 'playlist_song_id' => $item, 'playlist_created' => time());
                 $playlistArray = Gump::xss_clean($playlistArray);
                 $playlistArray = Gump::sanitize($playlistArray);
                 $playlist_id = $playlistModel->create($playlistArray);
             }
         }
         if ($playlist_id > 0) {
             $message = 'ok';
             Session::set('success', 'Songs has been added to playlist');
         } else {
             Session::set('error', 'tagging fails');
         }
     }
     $total = count(Playlist::items($album_id));
     $pages = new Paginator('10', 'p');
     $this->data['songs'] = Playlist::items($album_id, $pages->getLimit());
     $pages->setTotal($total);
     $path = DIR . 'song/tagplaylist/' . $album_id . '?';
     $this->data['page_links'] = $pages->pageLinks($path, null);
     $this->data['tag_songs'] = $songModel->all();
     View::rendertemplate('header', $this->data);
     View::rendertemplate('sidebar', $this->data);
     View::render('song/song.tagplaylist', $this->data);
     View::rendertemplate('footer', $this->data);
 }
Ejemplo n.º 4
0
    ?>
</td>
									<td class="center"><?php 
    echo Assets::image($item->album_image, '', 'height: 80px');
    ?>
</td>
									<td class="center"><?php 
    echo $item->category_title;
    ?>
</td>
									<td class="center"><?php 
    echo $item->album_slug;
    ?>
</td>
									<td class="center"><?php 
    echo Playlist::itemCount($item->album_id);
    ?>
</td>
									<td class="center"><?php 
    echo date('d/m/Y', $item->album_created);
    ?>
</td>
									<td class="center"><span class="label label-success">Active</span></td> 
									<td class="center">
									<div class="btn-group">
							<button class="btn btn-small">Option</button>
							<button class="btn btn-small dropdown-toggle" data-toggle="dropdown">
							<span class="caret"></span></button>
							<ul class="dropdown-menu">
								<li><a href="<?php 
    echo DIR . 'song/editalbum/' . $item->album_id;