Added popup functionality and Library
* doPopup() JavaScript call creates a centered popup div with user defined width, height, title, content, and calls an optional callback function * Library with currently non-modifiable book list, and a popup with the books' details Signed-off-by: Gergely Polonkai <polesz@w00d5t0ck.info>
This commit is contained in:
165
src/KekRozsak/FrontBundle/Entity/BookCopy.php
Normal file
165
src/KekRozsak/FrontBundle/Entity/BookCopy.php
Normal file
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
|
||||
namespace KekRozsak\FrontBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;
|
||||
|
||||
use KekRozsak\FrontBundle\Entity\Book;
|
||||
use KekRozsak\SecurityBundle\Entity\User;
|
||||
|
||||
/**
|
||||
* KekRozsak\FrontBundle\Entity\BookCopy
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="book_copies", uniqueConstraints={
|
||||
* @ORM\UniqueConstraint(columns={"owner_id", "book_id"})
|
||||
* })
|
||||
*
|
||||
* @DoctrineAssert\UniqueEntity(fields={"owner_id", "book_id"})
|
||||
*/
|
||||
class BookCopy
|
||||
{
|
||||
public function __construct(Book $book, User $owner)
|
||||
{
|
||||
$this->book = $book;
|
||||
$this->owner = $owner;
|
||||
$this->borrowable = false;
|
||||
$this->buyable = false;
|
||||
$this->borrower = null;
|
||||
$this->borrowerReturned = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var integer $id
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* @var KekRozsak\FrontBundle\Entity\Book $book
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="Book", inversedBy="copies")
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
protected $book;
|
||||
|
||||
/**
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $owner
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
protected $owner;
|
||||
|
||||
/**
|
||||
* Get owner
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getOwner()
|
||||
{
|
||||
return $this->owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $ownerComment
|
||||
*
|
||||
* @ORM\Column(type="text", name="owner_comment", nullable=true)
|
||||
*/
|
||||
protected $ownerComment;
|
||||
|
||||
/**
|
||||
* @var boolean $borrowable
|
||||
*
|
||||
* @ORM\Column(type="boolean", nullable=false)
|
||||
*/
|
||||
protected $borrowable;
|
||||
|
||||
/**
|
||||
* Set borrowable
|
||||
*
|
||||
* @param boolean $borrowable
|
||||
* @return BookCopy
|
||||
*/
|
||||
public function setBorrowable($borrowable)
|
||||
{
|
||||
$this->borrowable = $borrowable;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get borrowable
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isBorrowable()
|
||||
{
|
||||
return $this->borrowable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var boolean $buyable
|
||||
*
|
||||
* @ORM\Column(type="boolean", nullable=false)
|
||||
*/
|
||||
protected $buyable;
|
||||
|
||||
/**
|
||||
* Set buyable
|
||||
*
|
||||
* @param boolean $buyable
|
||||
* @return BookCopy
|
||||
*/
|
||||
public function setBuyable($buyable)
|
||||
{
|
||||
$this->buyable = $buyable;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get borrowable
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isBuyable()
|
||||
{
|
||||
return $this->buyable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $borrower
|
||||
*
|
||||
* @ORM\OneToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
*/
|
||||
protected $borrower;
|
||||
|
||||
/**
|
||||
* Get borrower
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getBorrower()
|
||||
{
|
||||
return $this->borrower;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var boolean $borrowerReturned
|
||||
*
|
||||
* @ORM\Column(type="boolean", nullable=false, name="borrower_returned")
|
||||
*/
|
||||
protected $borrowerReturned;
|
||||
|
||||
/**
|
||||
* Get borrowerReturned
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isBorrowerReturned()
|
||||
{
|
||||
return $this->borrowerReturned();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user