Exemplo n.º 1
0
$album = $_POST['album'];
$category = $_POST['category'];
$canCon = isset($_POST['can_con']);
$newRelease = isset($_POST['new_release']);
$frenchVocalMusic = isset($_POST['french_vocal_music']);
$editSegment = isset($_POST['is_existing_segment']);
$segmentId = $_POST['segment_id'];
if (!isset($episodeId) || $episodeId <= 0) {
    outputErrorResponse("Invalid episode ID");
}
try {
    $db = connectToDatabase();
    $episode = new Episode($db, $episodeId);
    $episodeStartDateTime = $episode->getStartTime();
    $segmentTime = addDateToSegmentStartTime($episodeStartDateTime, $segmentTime);
    $playlistId = $episode->getPlaylistId();
    $segment = new Segment($db, $segmentId);
    $segment->setCategory($category);
    $segment->setPlaylistId($playlistId);
    $segment->setDuration(null);
    $segment->setStartTime($segmentTime);
    switch ($category) {
        case 2:
        case 3:
            $segment->setName($name);
            $segment->setAuthor($author);
            $segment->setAlbum($album);
            $segment->setCategory($category);
            $segment->setIsCanCon($canCon);
            $segment->setIsNewRelease($newRelease);
            $segment->setIsFrenchVocalMusic($frenchVocalMusic);
 /**
  * @param $dbConn
  * @param $episodeId
  * @return Segment[]
  */
 public static function getAllSegmentsForEpisodeId($dbConn, $episodeId)
 {
     $episode = new Episode($dbConn, $episodeId);
     $playlistId = $episode->getPlaylistId();
     $segments = managePlaylistEntries::getPlaylistSegmentsFromDatabase($dbConn, $playlistId);
     return $segments;
 }