$episodeId = $_POST['episode_id']; $segmentTime = $_POST['segmentTime']; $name = $_POST['name']; $author = $_POST['author']; $album = $_POST['album']; $category = $_POST['category']; $canCon = isset($_POST['can_con']); $newRelease = isset($_POST['new_release']); $frenchVocalMusic = isset($_POST['french_vocal_music']); if (!isset($episodeId) || $episodeId <= 0) { outputErrorResponse("Invalid episode ID"); } try { $db = connectToDatabase(); $episode = new Episode($db, $episodeId); $segmentList = $episode->getSegments(); $db = null; outputSuccessResponse($segmentList); } catch (PDOException $e) { $db = null; error_log("get_segments error: " . $e->getMessage()); outputErrorResponse($e->getMessage()); } function outputSuccessResponse($data) { outputResponse($data); } function outputErrorResponse($errorMessage) { $errorArray = array("error" => $errorMessage); outputResponse($errorArray);
* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ require_once "../../digital-logsheets-res/smarty/libs/Smarty.class.php"; require_once "../../digital-logsheets-res/php/database/manageSegmentEntries.php"; require_once "../../digital-logsheets-res/php/objects/Episode.php"; require_once "../../digital-logsheets-res/php/database/connectToDatabase.php"; require_once "../../digital-logsheets-res/php/objects/logsheetClasses.php"; $episodeId = $_GET["episode_id"]; if ($episodeId != null) { try { $smarty = new Smarty(); $dbConn = connectToDatabase(); $episode = new Episode($dbConn, $episodeId); $segments = $episode->getSegments(); $episodeAsArray = $episode->getObjectAsArray(); $segmentsForThisEpisode = manageSegmentEntries::getAllSegmentsForEpisodeId($dbConn, $episodeId); for ($i = 0; $i < count($segmentsForThisEpisode); $i++) { $currentSegment = $segmentsForThisEpisode[$i]; $segmentsForThisEpisode[$i] = $currentSegment->getObjectAsArray(); } $smarty->assign("episode", $episodeAsArray); $smarty->assign("segments", $segmentsForThisEpisode); // display it echo $smarty->fetch('../../digital-logsheets-res/templates/view-episode-logsheet.tpl'); } catch (PDOException $e) { echo 'ERROR: ' . $e->getMessage(); } }