コード例 #1
0
 public function __construct($db, $componentId)
 {
     parent::__construct($db, $componentId);
     if ($componentId != null) {
         manageSegmentEntries::getSegmentAttributesFromDatabase($db, $componentId, $this);
     }
 }
コード例 #2
0
            $segment->setIsCanCon(false);
            $segment->setIsNewRelease(false);
            $segment->setIsFrenchVocalMusic(false);
            $segment->setAdNumber(null);
            break;
    }
    $errorsContainer = $segment->isValidForDraftSave($episode);
    if ($errorsContainer->doErrorsExist()) {
        $errorsList = $errorsContainer->getAllErrors();
        outputErrorResponse(json_encode($errorsList));
    }
    if ($editSegment) {
        $segment->setId($segmentId);
        manageSegmentEntries::editSegmentInDatabase($db, $segment);
    } else {
        manageSegmentEntries::saveNewSegmentToDatabase($db, $segment);
    }
    $episode = new Episode($db, $episodeId);
    $segmentList = $episode->getSegments();
    $db = null;
    outputSuccessResponse($segmentList);
} catch (PDOException $e) {
    $db = null;
    outputErrorResponse($e->getMessage());
}
function outputSuccessResponse($data)
{
    outputResponse($data);
}
function outputErrorResponse($errorMessage)
{
コード例 #3
0
 * 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();
    }
}
コード例 #4
0
/**
 * digital-logsheets: A web-based application for tracking the playback of audio segments on a community radio station.
 * Copyright (C) 2015  Mike Dean
 * Copyright (C) 2015-2016  Evan Vassallo
 * Copyright (C) 2016  James Wang
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * 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/php/database/manageSegmentEntries.php";
require_once "../../digital-logsheets-res/php/database/connectToDatabase.php";
$segmentId = $_POST['segment_id'];
try {
    if ($segmentId != null) {
        $dbConn = connectToDatabase();
        manageSegmentEntries::deleteSegmentFromDatabase($dbConn, $segmentId);
    }
} catch (PDOException $e) {
    echo 'ERROR: ' . $e->getMessage();
}