aboutsummaryrefslogtreecommitdiff
path: root/lib/raumzeit/MetaDateDB.class.php
blob: 5f5e1dfda4ce2622b46de9c36411045958f33f29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
# Lifter002: DONE - not applicable
# Lifter007: TEST
# Lifter003: TEST
# Lifter010: DONE - not applicable

// +--------------------------------------------------------------------------+
// This file is part of Stud.IP
// MetaDateDB.class.php
//
// Datenbank-Abfragen für MetaDate.class.php
//
// +--------------------------------------------------------------------------+
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or any later version.
// +--------------------------------------------------------------------------+
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
// +--------------------------------------------------------------------------+


/**
 * MetaDateDB.class.php
 *
 *
 * @author      Till Glöggler <tgloeggl@uos.de>
 * @version     19. Oktober 2005
 * @access      protected
 * @package     raumzeit
 */
class MetaDateDB
{
    public static function has_dates($metadate_id, $seminar_id, $filterStart = 0, $filterEnd = 0)
    {
        $query = "SELECT 1 FROM termine WHERE range_id = ? AND metadate_id = ?";
        $parameters = [$seminar_id, $metadate_id];

        if ($filterStart != 0) {
            $query .= " AND date >= ? AND end_time <= ?";
            array_push($parameters, $filterStart, $filterEnd);
        }

        $statement = DBManager::get()->prepare($query);
        $statement->execute($parameters);

        return (bool)$statement->fetchColumn();
    }
}