예제 #1
0
$search_ages = from_get('search_ages', array());
if ($action !== 'update' && $action !== 'new') {
    die('opció invalida');
    exit;
}
$c = new Connection();
$conn = $c->getConnection();
if ($action === 'update') {
    $activityDAO = new ActivityDAO($conn);
    $workshopDAO = new WorkshopDAO($conn);
    $workshop = $workshopDAO->select($id);
} else {
    $workshop = array('id' => -1, 'workshop_date' => '', 'group_id' => '', 'observations' => '', 'comments' => '', 'favourite' => '', 'age' => '', 'activity' => array());
}
$groupDAO = new GroupDAO($conn);
$groups = $groupDAO->getCurrentGroupsKeysAndNames();
$title = $action === 'new' ? 'Nou taller' : 'Modificar taller';
$query = "SELECT DISTINCT A.id, A.activity_name, A.description, A.goals, A.materials, A.observations, A.assesment, A.comments, A.keywords, A.types, A.song_themes, A.ages, A.timestamp, group_concat(C.name separator ', ') FROM wp_musicteach_activity A LEFT JOIN wp_musicteach_activity_song B ON A.id = B.activity_id LEFT JOIN wp_musicteach_song C ON B.song_id = C.id";
$group = " GROUP BY A.id ";
$Paginator = new ActivityPaginator($conn, $query, $group, $search_string, $search_order, $search_types, $search_song_themes, $search_ages);
$results = $Paginator->getData($limit, $page);
include 'head.php';
?>


<div class="toggle-panel-shrink form-page">

<h1 class="text-center"><?php 
echo $title;
?>
</h1>