Esempio n. 1
0
function buildScheduleTable($auth, $where)
{
    //Fetch the content
    $dbh = db_connect();
    $durations = db_fetchDurations($dbh, $where);
    //Editing rights
    $write = account_getDurationWriteability($auth, $where);
    //Format it
    $html = '<table class="scroll_content">';
    foreach ($durations as $duration) {
        $html .= '<tr ' . assoc_to_data($duration) . '>';
        $html .= '<td>' . $duration['duration_name'] . '<br/>' . $duration['content_name'] . '<br/>' . friendlyDate($duration['date_start']) . ' - ' . friendlyDate($duration['date_end']) . '</td>';
        $html .= '<td>';
        if ($write == PRIV_ALL || $write == PRIV_MINE && $duration['user_id'] == $auth['user']['user_id']) {
            $html .= '<button name="duration_delete">Delete</button>';
        }
        $html .= '</td>';
        $html .= '<td><img src="' . $duration['content_src'] . '" alt="' . $duration['content_name'] . '" /></td>';
        $html .= '</tr>';
    }
    $html .= '</table>';
    return $html;
}
Esempio n. 2
0
}
if (isset($_REQUEST['name'])) {
    $where['player_shortname'] = $_REQUEST['name'];
}
if (isset($_REQUEST['player_id'])) {
    $where['player_id'] = $_REQUEST['player_id'];
}
if (isset($_REQUEST['player_shortname'])) {
    $where['player_shortname'] = $_REQUEST['player_shortname'];
}
$player = db_fetchPlayerInfo($dbh, $where);
//TODO: Error handling, make sure a player was fetched
//die(json_encode($player));
//Get the slides
$player['range'] = 'current';
$slides = db_fetchDurations($dbh, $player);
//Query astra for schedule
$ah = astra_createHandle();
$schedule = astra_fetchSchedule($ah, $player['astra_guid']);
//Pack it up
$pack = array();
$row['type'] = 'schedule';
$row['content'] = $schedule;
$pack[] = $row;
foreach ($slides as $slide) {
    $row['type'] = 'image';
    $row['content'] = $slide['content_src'];
    $pack[] = $row;
}
header('content-type:text/plain');
//$json = json_encode($pack, JSON_PRETTY_PRINT);