Skip to content

Commit

Permalink
Merge pull request #11 from haarlem-festival-gr2/jazz
Browse files Browse the repository at this point in the history
Jazz
  • Loading branch information
piguycs authored Mar 11, 2024
2 parents 9a3d045 + 0acd6a5 commit 7bf83d7
Show file tree
Hide file tree
Showing 35 changed files with 997 additions and 437 deletions.
32 changes: 31 additions & 1 deletion app/controller/artist.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,37 @@
<?php

use Core\Route\Route;
use service\JazzService;

require_once __DIR__.'/../repository/BaseRepository.php';
require_once __DIR__.'/../service/JazzService.php';

Route::serve('/artist', function (array $props) {
Route::render('artist', []);
$artistId = $props['id'];
//var_dump($artistId);

$jazzService = new JazzService();

$artist = $jazzService->getArtistById($artistId);
$albums = $jazzService->getAlbumsByArtistId($artistId);
$songs = $jazzService->getSongsByArtistId($artistId);
$performances = $jazzService->getPerformancesByArtistId($artistId);
//foreach($performances as $performance){
// $performance->setArtist($artist);
//}
$events = [];
foreach($performances as $performance) {
$venue = $jazzService->getVenueByPerformanceId($performance->getPerformanceID());
$events[] = [
'performance' => $performance,
'venue' => $venue
];
}

Route::render('jazz.artist', [
'artist' => $artist,
'albums' => $albums,
'songs' => $songs,
'events' => $events,
]);
});
29 changes: 20 additions & 9 deletions app/controller/jazz.php
Original file line number Diff line number Diff line change
@@ -1,32 +1,43 @@
<?php

use Core\Route\Route;
use Repository\JazzRepository;
use service\FestivalEventService;
use service\JazzService;

require_once __DIR__.'/../repository/BaseRepository.php';
require_once __DIR__.'/../repository/JazzRepository.php';
require_once __DIR__.'/../model/FestivalEvent.php';
require_once __DIR__.'/../service/FestivalEventService.php';
require_once __DIR__.'/../service/JazzService.php';

Route::serve('/jazz', function (array $props) {
$repo = new JazzRepository();
$festivalEventService = new FestivalEventService();
$jazzService = new JazzService();

$festivalEvent = $repo->getFestivalEventByName('Haarlem Jazz');
$jazzDays = $repo->getAllJazzDays();
$user = Route::auth();

$festivalEvent = $festivalEventService->getFestivalEventByName('Haarlem Jazz');
$jazzDays = $jazzService->getAllJazzDays();

$jazzDaysWithPerformances = [];

foreach ($jazzDays as $day) {
$performancesForDay = $repo->getPerformancesByJazzDay($day->getDayId());
$venue = $repo->getVenueById($day->getVenueID());
$performancesForDay = $jazzService->getPerformancesByJazzDay($day->getDayId());
$venue = $jazzService->getVenueById($day->getVenueID());
$jazzPasses = $jazzService->getJazzPassesByDate($day->getDate());
$jazzDaysWithPerformances[] = [
'day' => $day,
'venue' => $venue,
'performances' => $performancesForDay,
'passes' => $jazzPasses,
];
}

Route::render('jazz', [
//if (!$user) {
// Route::redirect('/login');
//}

Route::render('jazz.jazz', [
'festivalEvent' => $festivalEvent,
'jazzDaysWithPerformances' => $jazzDaysWithPerformances,
'user' => $user,
]);
});
12 changes: 6 additions & 6 deletions app/model/Artist.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Artist

private ?string $ArtistImg2;

private string $PerformanceImg;
private ?string $PerformanceImg;

public function getArtistID(): int
{
Expand All @@ -38,7 +38,7 @@ public function setArtistName(string $name): void
$this->Name = $name;
}

public function getBio(): string
public function getBio(): ?string
{
return $this->Bio;
}
Expand All @@ -48,7 +48,7 @@ public function setBio(string $bio): void
$this->Bio = $bio;
}

public function getHeaderImg(): string
public function getHeaderImg(): ?string
{
return $this->HeaderImg;
}
Expand All @@ -58,7 +58,7 @@ public function setHeaderImg(string $headerImg): void
$this->HeaderImg = $headerImg;
}

public function getArtistImg1(): string
public function getArtistImg1(): ?string
{
return $this->ArtistImg1;
}
Expand All @@ -68,7 +68,7 @@ public function setArtistImg1(string $artistImg1): void
$this->ArtistImg1 = $artistImg1;
}

public function getArtistImg2(): string
public function getArtistImg2(): ?string
{
return $this->ArtistImg2;
}
Expand All @@ -78,7 +78,7 @@ public function setArtistImg2(string $artistImg2): void
$this->ArtistImg2 = $artistImg2;
}

public function getPerformanceImg(): string
public function getPerformanceImg(): ?string
{
return $this->PerformanceImg;
}
Expand Down
12 changes: 12 additions & 0 deletions app/model/FestivalEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class FestivalEvent

private string $EndDate;

private string $Title;

public function getFestivalEventID(): int
{
return $this->FestivalEventID;
Expand All @@ -26,6 +28,16 @@ public function setFestivalEventID(int $festivalEventID): void
$this->FestivalEventID = $festivalEventID;
}

public function getTitle(): string
{
return $this->Title;
}

public function setTitle(string $title): void
{
$this->Title = $title;
}

public function getFestivalEventName(): string
{
return $this->Name;
Expand Down
2 changes: 1 addition & 1 deletion app/model/JazzDay.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function setVenueID(int $venueID): void
$this->VenueID = $venueID;
}

public function getNote(): string
public function getNote(): ?string
{
return $this->Note;
}
Expand Down
88 changes: 88 additions & 0 deletions app/model/JazzPass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php

namespace model;


class JazzPass
{
private int $JazzPassID;
private float $Price;
private string $StartDateTime;
private string $EndDateTime;
private string $Note;

private int $TotalTickets;

private int $AvailableTickets;

public function getJazzPassID(): int
{
return $this->JazzPassID;
}

public function setJazzPassID(int $JazzPassID): void
{
$this->JazzPassID = $JazzPassID;
}

public function getPrice(): float
{
return $this->Price;
}

public function setPrice(float $Price): void
{
$this->Price = $Price;
}

public function getStartDateTime(): string
{
return $this->StartDateTime;
}

public function setStartDateTime(string $StartDateTime): void
{
$this->StartDateTime = $StartDateTime;
}

public function getEndDateTime(): string
{
return $this->EndDateTime;
}

public function setEndDateTime(string $EndDateTime): void
{
$this->EndDateTime = $EndDateTime;
}

public function getNote(): string
{
return $this->Note;
}

public function setNote(string $Note): void
{
$this->Note = $Note;
}

public function getAvailableTickets(): int
{
return $this->AvailableTickets;
}

public function setAvailableTickets(int $AvailableTickets): void
{
$this->AvailableTickets = $AvailableTickets;
}

public function getTotalTickets(): int
{
return $this->TotalTickets;
}

public function setTotalTickets(int $TotalTickets): void
{
$this->TotalTickets = $TotalTickets;
}
}

23 changes: 17 additions & 6 deletions app/model/Performance.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class Performance
{
private int $PerformanceID;

//private int $ArtistID;
private Artist $Artist;

private float $Price;
Expand All @@ -17,11 +16,13 @@ class Performance

private int $AvailableTickets;

private int $TotalTickets;

private int $DayID;

private int $VenueID;

private ?string $Hall;
private ?string $Details;

public function getPerformanceID(): int
{
Expand Down Expand Up @@ -83,6 +84,16 @@ public function setAvailableTickets(int $availableTickets): void
$this->AvailableTickets = $availableTickets;
}

public function getTotalTickets(): int
{
return $this->TotalTickets;
}

public function setTotalTickets(int $totalTickets): void
{
$this->TotalTickets = $totalTickets;
}

public function getDayID(): int
{
return $this->DayID;
Expand All @@ -103,14 +114,14 @@ public function setVenueID(int $venueID): void
$this->VenueID = $venueID;
}

public function getHall(): string
public function getDetails(): ?string
{
return $this->Hall;
return $this->Details;
}

public function setHall(string $hall): void
public function setDetails(string $details): void
{
$this->Hall = $hall;
$this->Details = $details;
}

public function setArtist(Artist $artist): void
Expand Down
12 changes: 0 additions & 12 deletions app/model/Venue.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ class Venue

private string $Address;

private ?string $Email;

private ?string $ContactDetails;

public function getVenueID(): int
Expand Down Expand Up @@ -44,16 +42,6 @@ public function setAddress(string $address): void
$this->Address = $address;
}

public function getEmail(): string
{
return $this->Email;
}

public function setEmail(string $email): void
{
$this->Email = $email;
}

public function getContactDetails(): string
{
return $this->ContactDetails;
Expand Down
Loading

0 comments on commit 7bf83d7

Please sign in to comment.