sterntours/trunk/src/AppBundle/Util/CalendarDayState.php
2018-08-14 15:14:56 +00:00

284 lines
5.3 KiB
PHP

<?php
namespace AppBundle\Util;
use AppBundle\Entity\FewoLodging;
use AppBundle\Entity\FewoPrice;
use AppBundle\Entity\FewoReservation;
use AppBundle\Entity\FewoSeason;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\EntityManager;
class CalendarDayState
{
/**
* @var int
*/
private $day;
/**
* @var FewoPrice|null
*/
private $price; // der preis / die saison
/**
* @var FewoReservation|null
*/
private $reservation; // die reservierung //todo wenns vorteile bringt, ne zweite speichern
/**
* @var bool
*/
private $isInSeason; // liegt innerhalb einer saison?;
/**
* @var bool
*/
private $isReserved; // ist reserviert?;
/**
* @var bool
*/
private $isBookable; // ist buchbar? nur wenn isReserved = false und isInSeason = true
/**
* @var bool
*/
private $isReservationBegin; // ist es der anfang einer reservierung?
/**
* @var bool
*/
private $isReservationEnd;
/**
* @var \DateTime|null
*/
private $date = null;
/**
* @var bool
*/
private $isEmpty; //empty day in the month
/**
* @var bool
*/
private $isPastDate;
/**
* @return int
*/
public function getDay(): int
{
return $this->day;
}
/**
* @param int $day
*/
public function setDay(int $day)
{
$this->day = $day;
}
/**
* @return FewoPrice|null
*/
public function getPrice()
{
return $this->price;
}
/**
* @param FewoPrice|null $price
*/
public function setPrice($price)
{
$this->price = $price;
}
/**
* @return FewoReservation|null
*/
public function getReservation()
{
return $this->reservation;
}
/**
* @param FewoReservation|null $reservation
*/
public function setReservation($reservation)
{
$this->reservation = $reservation;
}
/**
* @return bool
*/
public function getIsInSeason(): bool
{
return $this->isInSeason;
}
/**
* @param bool $isInSeason
*/
public function setIsInSeason(bool $isInSeason)
{
$this->isInSeason = $isInSeason;
}
/**
* @return bool
*/
public function getIsReserved(): bool
{
return $this->isReserved;
}
/**
* @param bool $isReserved
*/
public function setIsReserved(bool $isReserved)
{
$this->isReserved = $isReserved;
}
/**
* @return bool
*/
public function getIsBookable(): bool
{
return $this->isBookable;
}
/**
* @param bool $isBookable
*/
public function setIsBookable(bool $isBookable)
{
$this->isBookable = $isBookable;
}
/**
* @return bool
*/
public function getIsReservationBegin(): bool
{
return $this->isReservationBegin;
}
/**
* @param bool $isReservationBegin
*/
public function setIsReservationBegin(bool $isReservationBegin)
{
$this->isReservationBegin = $isReservationBegin;
}
/**
* @return bool
*/
public function getIsReservationEnd(): bool
{
return $this->isReservationEnd;
}
/**
* @param bool $isReservationEnd
*/
public function setIsReservationEnd(bool $isReservationEnd)
{
$this->isReservationEnd = $isReservationEnd;
}
/**
* @return \DateTime|null
*/
public function getDate()
{
return $this->date;
}
/**
* @param \DateTime|null $date
*/
public function setDate($date)
{
$this->date = $date;
}
/**
* @return bool
*/
public function getIsEmpty(): bool
{
return $this->isEmpty;
}
/**
* @param bool $isEmpty
*/
public function setIsEmpty(bool $isEmpty)
{
$this->isEmpty = $isEmpty;
}
/**
* @return bool
*/
public function getIsPastDate(): bool
{
return $this->isPastDate;
}
/**
* @param bool $isPastDate
*/
public function setIsPastDate(bool $isPastDate)
{
$this->isPastDate = $isPastDate;
}
public function getCssClass(){
$ret = "";
if($this->getIsPastDate()){
$ret .= 'calendar-light ';
}
if($this->getDay() == 0){
$ret .= 'calendar-day-non ';
}
if($this->getIsReserved()){
$ret .= 'calendar-day-disabled ';
return $ret;
}
if($this->getIsReservationBegin() && $this->getIsReservationEnd()){
$ret .= 'calendar-day-disabled-half ';
return $ret;
}
if($this->getIsReservationBegin()){
$ret .= 'calendar-day-reservation-begin ';
return $ret;
}
if($this->getIsReservationEnd()){
$ret .= 'calendar-day-reservation-end ';
return $ret;
}
return $ret;
}
}