<?php $current_page = "streams"; require_once "header.php"; require_once "objects/stream.php"; $message = ''; if ($_POST) { $result = Stream::update($_POST); if ($result) { $message = '<div class="alert alert-success" role="alert">Stream updated!</div>'; } else { $message = '<div class="alert alert-danger" role="alert">Problem updating stream...</div>'; } } $games = Stream::games(); $leagues = Stream::leagues(); $champions = Stream::champions(); $selected_game = $_GET['game'] ? $_GET['game'] : ''; $selected_champion = $_GET['champion'] ? $_GET['champion'] : ''; $selected_league = $_GET['league'] ? $_GET['league'] : ''; $game_html = ''; foreach ($games as $game) { $checked = ''; if ($selected_game == $game->name) { $checked = ' selected="selected"'; } $game_html .= <<<HTML \t\t\t<option value="{$game->name}"{$checked}>{$game->name}</option> HTML; } $league_html = '';
<button type="reset">RESET</button> <button type="submit" name="stage" value="2">submit</button> </fieldset> </form> </div>'; break; case "2": // $stream = new Stream( "00000", $_POST[ "name" ], $_POST[ "description" ], $_POST[ "startYear" ], $_POST[ "stopYear" ] ); $stream->setName($_POST["name"]); $stream->setDescription($_POST["description"]); $stream->setStartYear($_POST["startYear"]); $stream->setStopYear($_POST["stopYear"]); if ($stream->validate()) { if ($stream->update()) { $pageBody .= ' <div class="dialog"> <p>stream successfully saved</p> </div>'; } } break; } } else { // You need to specify a target } break; case "list": $streams = getStreams(); if (count($streams) > 0) {