require_once 'ActivityDAO.class.php'; require_once 'SongDAO.class.php'; require_once 'partial_form_track.php'; $action = from_get('action', 'new'); $id = from_get('id', -1); if ($action !== 'update' && $action !== 'new') { die('opciĆ³ invalida'); exit; } if ($action === 'update') { $c = new Connection(); $conn = $c->getConnection(); $activityDAO = new ActivityDAO($conn); $activity = $activityDAO->select($id); $songDAO = new SongDAO($conn); $songs = $songDAO->selectFromActivity($id); } else { $activity = array('id' => -1, 'activity_name' => '', 'description' => '', 'goals' => '', 'materials' => '', 'observations' => '', 'assesment' => '', 'comments' => '', 'keywords' => '', 'types' => '', 'song_themes' => '', 'ages' => ''); $songs = array(); } $title = $action === 'new' ? 'Nova activitat' : 'Modificar activitat'; include 'head.php'; ?> <br> <div> <h1 class="text-center"><?php echo $title; ?>