Example #1
0
{
    return sprintf("%0" . $n . "d", $s);
}
$client = new SoapClient("http://{$server}/CablecastWS/CablecastWS.asmx?WSDL");
// Creates New SOAP client using WSDL file
$showID = 1;
if (isset($_GET['ShowID'])) {
    $showID = $_GET['ShowID'];
}
$result = $client->GetShowInformation(array('ShowID' => $showID));
$searchLength = strtotime(date("Y-m-d") . "T" . date("H:i:s")) + 60 * 60 * 24 * 35;
echo "<table>\n";
echo "<tr><th>Program Title</th><td>" . $result->GetShowInformationResult->Title . "</td></tr>\n";
echo "<tr><th>Program Length:</th><td>" . floor($result->GetShowInformationResult->TotalSeconds / 3600) . ":" . padWithZeros(floor(floor($result->GetShowInformationResult->TotalSeconds % 3600) / 60), 2) . ":" . padWithZeros($result->GetShowInformationResult->TotalSeconds % 60, 2) . "</td></tr>\n";
foreach ($channels as $channel) {
    $scheduleResult = $client->GetScheduleInformation(array('ChannelID' => $channel["id"], 'FromDate' => date("Y-m-d") . "T00:00:00", 'ToDate' => date("Y-m-d", $searchLength) . "T" . date("H:i:s", $searchLength), 'restrictToShowID' => $showID));
    echo "<tr><th>Scheduled on " . $channel['name'] . "</th>\n";
    if (!isset($scheduleResult->GetScheduleInformationResult->ScheduleInfo) || $scheduleResult->GetScheduleInformationResult->ScheduleInfo == NULL) {
        $schedule = array();
    } else {
        $schedule = is_array($scheduleResult->GetScheduleInformationResult->ScheduleInfo) ? $scheduleResult->GetScheduleInformationResult->ScheduleInfo : array($scheduleResult->GetScheduleInformationResult->ScheduleInfo);
    }
    if (count($schedule) == 0) {
        echo "<td>This Program is Not Currently Scheduled on " . $channel['name'] . "</td></tr>\n";
    } else {
        echo "<td>\n";
        foreach ($schedule as $run) {
            echo date("{$dateFormat}", strtotime($run->StartTime)) . "<br />\n";
        }
        echo "</td></tr>\n";
    }
Example #2
0
//End Configure
$client = new SoapClient($server . "CablecastWS/CablecastWS.asmx?WSDL");
// Creates New SOAP client using WSDL file
// Get year month and day from individual query string parameters if exist.
// There must of been some reason I did it this way. Probably some crappy calendar
// I was using at the time. Feel free to change to a better calendar.
if (isset($_GET['d']) && isset($_GET['m']) && isset($_GET['y'])) {
    $dateString = $_GET['y'] . "-" . $_GET['m'] . "-" . $_GET['d'];
} else {
    //default to today's date
    $dateString = date("Y-m-d");
}
//Calculate the end date
$endDate = date("Y-m-d", strtotime($dateString) + $displayDays * 24 * 60 * 60) . "T23:59:59";
//Get the schedule from the web service
$result = $client->GetScheduleInformation(array('ChannelID' => $channelID, 'FromDate' => $dateString . "T00:00:00", 'ToDate' => $endDate, 'restrictToShowID' => 0));
// if there are no results or a single result make an array anyway
// so we can deal with it all the same way below
if ($result->GetScheduleInformationResult->ScheduleInfo == NULL) {
    $scheduleItems = array();
} else {
    $scheduleItems = is_array($result->GetScheduleInformationResult->ScheduleInfo) ? $result->GetScheduleInformationResult->ScheduleInfo : array($result->GetScheduleInformationResult->ScheduleInfo);
}
// Print it all out in a table
if (count($scheduleItems) == '0') {
    echo "Nothing is Currently Scheduled for this channel";
} else {
    $startDay = "";
    echo "<table>\n<tr><th>Time</th><th>Program Title</th></tr>\n";
    foreach ($scheduleItems as $run) {
        $day = date("Y-m-d", strtotime($run->StartTime));
Example #3
0
<?php

//Configure Script
date_default_timezone_set('America/New_York');
// Set this to timezone of Cablecast Server
$server = "http://frontdoor.ctn5.org/";
//include trailing backslash
$channelID = 2;
//Cablecast Channel ID
$defualtSource = "Community Bulletin Board";
//End Configure
$server = $server . "CablecastWS/CablecastWS.asmx?WSDL";
$client = new SoapClient($server);
//Creates New SOAP client using WSDL file
$result = $client->GetScheduleInformation(array('ChannelID' => $channelID, 'FromDate' => date("Y-m-d") . "T00:00:00", 'ToDate' => date("Y-m-d") . "T23:59:59", 'restrictToShowID' => 0));
if ($result->GetScheduleInformationResult->ScheduleInfo == NULL) {
    $schedule = array();
    // No results so set results to empty array.
} else {
    // If the result isn't an array, then its a single result. Put that single
    // result into an array so we can just work with an array below.
    // Its simpler that way.
    $schedule = is_array($result->GetScheduleInformationResult->ScheduleInfo) ? $result->GetScheduleInformationResult->ScheduleInfo : array($result->GetScheduleInformationResult->ScheduleInfo);
}
$foundRun = FALSE;
foreach ($schedule as $run) {
    $beginingTime = strtotime($run->StartTime);
    $endingTime = strtotime($run->EndTime);
    if ($beginingTime <= time() && $endingTime > time()) {
        $foundRun = TRUE;
        echo $run->ShowTitle;