Changeset View
Changeset View
Standalone View
Standalone View
includes/class-QueryEvent.php
<?php | <?php | ||||
# Linux Day Torino website - classes | # Linux Day Torino website - classes | ||||
# Copyright (C) 2018, 2019 Valerio Bozzolan, Linux Day Torino | # Copyright (C) 2018, 2019, 2020 Valerio Bozzolan, Linux Day Torino | ||||
# | # | ||||
# This program is free software: you can redistribute it and/or modify | # This program is free software: you can redistribute it and/or modify | ||||
# it under the terms of the GNU Affero General Public License as published by | # it under the terms of the GNU Affero General Public License as published by | ||||
# the Free Software Foundation, either version 3 of the License, or | # the Free Software Foundation, either version 3 of the License, or | ||||
# (at your option) any later version. | # (at your option) any later version. | ||||
# | # | ||||
# This program is distributed in the hope that it will be useful, | # This program is distributed in the hope that it will be useful, | ||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
# GNU Affero General Public License for more details. | # GNU Affero General Public License for more details. | ||||
# | # | ||||
# You should have received a copy of the GNU Affero General Public License | # You should have received a copy of the GNU Affero General Public License | ||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
// load dependent traits | // load dependent traits | ||||
class_exists( QueryConference::class, true ); | class_exists( QueryConference::class, true ); | ||||
class_exists( QueryChapter ::class, true ); | |||||
class_exists( QueryTrack ::class, true ); | |||||
class_exists( QueryRoom ::class, true ); | |||||
/** | /** | ||||
* Methods for a QueryEvent class | * Methods for a QueryEvent class | ||||
*/ | */ | ||||
trait QueryEventTrait { | trait QueryEventTrait { | ||||
use QueryConferenceTrait; | use QueryConferenceTrait; | ||||
Show All 36 Lines | |||||
} | } | ||||
/** | /** | ||||
* Class able to query a FullEvent. | * Class able to query a FullEvent. | ||||
*/ | */ | ||||
class QueryEvent extends Query { | class QueryEvent extends Query { | ||||
use QueryEventTrait; | use QueryEventTrait; | ||||
use QueryChapterTrait; | |||||
use QueryTrackTrait; | |||||
use QueryRoomTrait; | |||||
/** | /** | ||||
* Univoque Event ID column name | * Univoque Event ID column name | ||||
* | * | ||||
* @var | * @var | ||||
*/ | */ | ||||
protected $EVENT_ID = 'event.event_ID'; | protected $EVENT_ID = 'event.event_ID'; | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | class QueryEvent extends Query { | ||||
* @return self | * @return self | ||||
*/ | */ | ||||
public function whereUser( $user ) { | public function whereUser( $user ) { | ||||
return $this->joinEventUser() | return $this->joinEventUser() | ||||
->whereInt( EventUser::USER_, $user->getUserID() ); | ->whereInt( EventUser::USER_, $user->getUserID() ); | ||||
} | } | ||||
/** | /** | ||||
* Join a table with the Chapter table | |||||
* | |||||
* @param string $type Join type | |||||
* @return self | |||||
*/ | |||||
public function joinChapter( $type = 'INNER' ) { | |||||
return $this->joinOn( $type, 'chapter', 'chapter.chapter_ID' , $this->CHAPTER_ID ); | |||||
} | |||||
/** | |||||
* Join a table with the Track table | * Join a table with the Track table | ||||
* | * | ||||
* @return self | * @return self | ||||
*/ | */ | ||||
public function joinTrack() { | public function joinTrack() { | ||||
return $this->joinOn( 'INNER', Track::T, Track::ID_, $this->TRACK_ID ); | return $this->joinOn( 'INNER', Track::T, Track::ID_, $this->TRACK_ID ); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |
Public contents are in Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) or GNU Free Documentation License (at your option) unless otherwise noted. · Contact / Register