Beispiel #1
0
        if (empty($scheduling_date_start)) {
            die('Data inici no informada');
        }
        if (empty($scheduling_date_end)) {
            die('Data fi no informada');
        }
        if (empty($age)) {
            die("Grup d'edat no informat");
        }
        $activities = isset($_POST['activity']) ? $_POST['activity'] : array();
        $scheduling = array('id' => $id, 'scheduling_date_start' => $scheduling_date_start, 'scheduling_date_end' => $scheduling_date_end, 'observations' => $observations, 'comments' => $comments, 'age' => $age, 'activities' => $activities);
        break;
}
$c = new Connection();
$conn = $c->getConnection();
$schedulingDAO = new SchedulingDAO($conn);
switch ($action) {
    case 'new':
        /*echo 'case new';
          print_r($scheduling);*/
        $insert_id = $schedulingDAO->create($scheduling);
        if (count(flatten($activities)) > 0) {
            $schedulingDAO->linkActivities($insert_id, $activities);
        }
        break;
    case 'update':
        $schedulingDAO->update($scheduling);
        $schedulingDAO->unlinkActivities($scheduling['id']);
        if (count(flatten($activities)) > 0) {
            $schedulingDAO->linkActivities($scheduling['id'], $activities);
        }
Beispiel #2
0
$links = from_get('links', 7);
$expanded = from_get('expanded', 'on');
$search_string = from_get('search_string', '');
$search_order = from_get('search_order', '');
$search_types = from_get('search_types', array());
$search_song_themes = from_get('search_song_themes', array());
$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);
    $schedulingDAO = new SchedulingDAO($conn);
    $scheduling = $schedulingDAO->select($id);
} else {
    $scheduling = array('id' => -1, 'scheduling_date_start' => '', 'scheduling_date_end' => '', 'observations' => '', 'comments' => '', 'age' => '0', 'activity' => array());
}
$title = $action === 'new' ? 'Nova planificació' : 'Modificar planificació';
$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 id="scheduling-form" class="toggle-panel-shrink form-page">

<h1 class="text-center"><?php