get_logic(); //var_dump($_POST); //exit; //var_dump($_POST); //echo 'kas uuus'; //if (isset($_POST['new_game'])) { if (isset($_POST['new_name'])) { //kuna paikneb nüüd eraldi vormil. if ($_SESSION['game_id'] = $game->create_new(@$_POST['new_name'])) { redirect('?page=maingame'); } } //echo 'kas del'; if (isset($_POST['del_game'])) { if (isset($_POST['game_id'])) { if ($game->set_id($_POST['game_id'])) { $game->remove(); $_SESSION['game_id'] = NULL; redirect('?page=gamelist'); } } } //kuna paiknevad samal formil, võib game_id tulla kaasa ka siis kui näit new_game tehakse //sellepärast kontrollime viimasena - ei kehti enam kuna eri vormidel paiknevad //echo 'kas choose'; if (isset($_POST['choose_game'])) { if (isset($_POST['game_id'])) { if ($game->set_id($_POST['game_id'])) { $_SESSION['game_id'] = $_POST['game_id']; redirect('?page=maingame'); } } } $this->def_tplfile('gamelist.tpl.php'); $list = & new ListView('listview.tpl.php'); $list->set_items($game->get_items()); $list->set('headerLabelsMap', array('label'=>'Nimi','week'=>'nädal','created'=>'loodud','game_id'=>'')); $list->set('inputTypeMap', array('game_id'=>'radio')); $this->set('list', $list->render()); } } ?>