private function getBlocke($pl_id) { $bloecke = AGDO::getInstance()->GetAll("SELECT * FROM playlist_bloecke WHERE pl_id = " . $pl_id . " ORDER BY pb_sort_order"); $countbloecke = count($bloecke); $newPosition = $this->g['nr'] + $this->g['change']; if ($newPosition < 1) { $newPosition = 1; } if ($newPosition > $countbloecke) { $newPosition = $countbloecke; } $x = 1; foreach ($bloecke as $block) { $b = new playlist_bloecke(); $b->setBlock($block); if ($b->pb_id == $this->g['pb_id']) { $b->pb_sort_order = $newPosition; $b->saveBlock(); } else { $this->bloecke[$x++] = $b; } } for ($sortorder = 1; $sortorder < $countbloecke; $sortorder++) { if ($sortorder == $newPosition) { } elseif ($sortorder > $newPosition) { $block = $this->bloecke[$sortorder - 1]; $block->pb_sort_order = $sortorder; $block->saveBlock(); } else { $block = $this->bloecke[$sortorder]; $block->pb_sort_order = $sortorder; $block->saveBlock(); } } }
private function getBloecke() { $bloecke = AGDO::getInstance()->GetAll("SELECT * FROM playlist_bloecke WHERE pl_id = " . $this->pl_id . " ORDER BY pb_sort_order"); $number = 1; foreach ($bloecke as $data) { $data['number'] = $number++; $block = new playlist_bloecke(); $block->setBlock($data); $this->bloecke[$data['pb_id']] = $block; } }
public function sortSong($post) { $id = str_replace('song_', '', $post['song_id']); $newPosition = $post['position']; $temp_ids = explode('_', $post['parent_id']); $pb_id = $temp_ids[1]; $pl_id = $temp_ids[2]; $song = new playlistSong(); $song->getSongByID($id); $song->getPosition($pl_id); if ($pb_id == 'uebrige') { $song->eraseFromPlaylist(); } else { $block = new playlist_bloecke(); $block->getBlockByID($pb_id); $block->getSongs(); $block->resortSongs($newPosition, $id); } $this->getAndReturnPlayZeiten($pl_id); }
private function savePause($pb_id, $pause) { $block = new playlist_bloecke(); $block->getBlockByID($pb_id); $block->setPause($pause); $block->saveBlock(); $pl = new playlist(); $pl->getPlaylistByID($block->pl_id); $retval = $pl->getDataForJson(); echo json_encode($retval); }