Refactored code to comply with PSR-*

Signed-off-by: Gergely POLONKAI <polesz@w00d5t0ck.info>
This commit is contained in:
Gergely POLONKAI
2012-08-16 15:52:41 +02:00
parent de00a6ad21
commit fab08cad6f
69 changed files with 5253 additions and 4673 deletions

View File

@@ -11,68 +11,66 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
*/
class DefaultController extends Controller
{
/**
* @Route("/manage_regs", name="KekRozsakAdminBundle_manage_regs")
* @Template()
*/
public function manageRegsAction()
{
$users = $this->getDoctrine()->getEntityManager()->createQuery('SELECT u FROM KekRozsakSecurityBundle:User u WHERE u.acceptedBy IS NULL')->getResult();
/**
* @Route("/manage_regs", name="KekRozsakAdminBundle_manage_regs")
* @Template()
*/
public function manageRegsAction()
{
$users = $this->getDoctrine()->getEntityManager()->createQuery('SELECT u FROM KekRozsakSecurityBundle:User u WHERE u.acceptedBy IS NULL')->getResult();
return array(
'users' => $users,
);
}
return array(
'users' => $users,
);
}
/**
* @Route("/csoport_jelentkezok", name="KekRozsakAdminBundle_groupJoinRequests")
* @Template()
*/
public function groupJoinRequestsAction()
{
$user = $this->get('security.context')->getToken()->getUser();
$groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Group');
$myGroups = $groupRepo->findByLeader($user);
/**
* @Route("/csoport_jelentkezok", name="KekRozsakAdminBundle_groupJoinRequests")
* @Template()
*/
public function groupJoinRequestsAction()
{
$user = $this->get('security.context')->getToken()->getUser();
$groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Group');
$myGroups = $groupRepo->findByLeader($user);
$request = $this->getRequest();
if ($request->getMethod() == 'POST')
{
if ($request->request->has('group') && $request->request->has('user'))
{
$userRepo = $this->getDoctrine()->getRepository('KekRozsakSecurityBundle:User');
$aUser = $userRepo->findOneById($request->request->get('user'));
$aGroup = $groupRepo->findOneById($request->request->get('group'));
if ($aUser && $aGroup)
{
$membershipRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:UserGroupMembership');
$membershipObject = $membershipRepo->findOneBy(array('user' => $aUser, 'group' => $aGroup));
if ($membershipObject)
{
$membershipObject->setMembershipAcceptedAt(new \DateTime('now'));
$membershipObject->setMembershipAcceptedBy($user);
$request = $this->getRequest();
if ($request->getMethod() == 'POST') {
if ($request->request->has('group') && $request->request->has('user')) {
$userRepo = $this->getDoctrine()->getRepository('KekRozsakSecurityBundle:User');
$aUser = $userRepo->findOneById($request->request->get('user'));
$aGroup = $groupRepo->findOneById($request->request->get('group'));
if ($aUser && $aGroup) {
$membershipRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:UserGroupMembership');
$membershipObject = $membershipRepo->findOneBy(array('user' => $aUser, 'group' => $aGroup));
if ($membershipObject) {
$membershipObject->setMembershipAcceptedAt(new \DateTime('now'));
$membershipObject->setMembershipAcceptedBy($user);
$em = $this->getDoctrine()->getEntityManager();
$em->persist($membershipObject);
$em->flush();
$em = $this->getDoctrine()->getEntityManager();
$em->persist($membershipObject);
$em->flush();
return $this->redirect($this->generateUrl('KekRozsakAdminBundle_groupJoinRequests'));
}
}
}
}
return $this->redirect($this->generateUrl('KekRozsakAdminBundle_groupJoinRequests'));
}
}
}
}
return array(
'groups' => $myGroups,
);
}
return array(
'groups' => $myGroups,
);
}
/**
* @Route("/csoport_jelentkezok/elutasit", name="KekRozsakAdminBundle_groupJoinDecline")
* @Template()
*/
public function groupJoinDeclineAction()
{
return array(
);
}
/**
* @Route("/csoport_jelentkezok/elutasit", name="KekRozsakAdminBundle_groupJoinDecline")
* @Template()
*/
public function groupJoinDeclineAction()
{
// TODO: A reason must be written to decline a join request!
return array(
);
}
}

View File

@@ -1,4 +1,6 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
</container>

View File

@@ -6,38 +6,38 @@
<h3>Csoport jelentkezők</h3>
<p>Az alábbi listán az általad vezetett csoportokba frissen jelentkezőket láthatod. A mellettük lévő ikonokra kattintva hagyhatod jóvá, illetve utasísthatod el a jelentkezésüket. Amennyiben ez utóbbi mellett döntesz, egy rövid üzenetet is írnod kell az elutasítás okáról.</p>
<table>
<thead>
<tr>
<td colspan="2">Csoport / Jelentkező</td>
<td></td>
</tr>
</thead>
<tbody>
<thead>
<tr>
<td colspan="2">Csoport / Jelentkező</td>
<td></td>
</tr>
</thead>
<tbody>
{% for group in groups %}
<tr>
<td class="ikon">[ikon]</td>
<td colspan="2">{{ group.name }}</td>
</tr>
<tr>
<td class="ikon">[ikon]</td>
<td colspan="2">{{ group.name }}</td>
</tr>
{% for request in group.members %}
{% if not group.isMember(request.user) %}
<tr>
<td colspan="2">{{ request.user|userdataspan }}</td>
<td>
<form method="post" action="{{ path('KekRozsakAdminBundle_groupJoinRequests') }}">
<input type="hidden" name="user" value="{{ request.user.id }}" />
<input type="hidden" name="group" value="{{ group.id }}" />
<button type="submit">[jóváhagyó ikon]</button>
</form>
<form method="post" action="{{ path('KekRozsakAdminBundle_groupJoinDecline') }}">
<input type="hidden" name="user" value="{{ request.user.id }}" />
<input type="hidden" name="group" value="{{ group.id }}" />
<button type="submit">[elutasító ikon]</button>
</form>
</td>
</tr>
<tr>
<td colspan="2">{{ request.user|userdataspan }}</td>
<td>
<form method="post" action="{{ path('KekRozsakAdminBundle_groupJoinRequests') }}">
<input type="hidden" name="user" value="{{ request.user.id }}" />
<input type="hidden" name="group" value="{{ group.id }}" />
<button type="submit">[jóváhagyó ikon]</button>
</form>
<form method="post" action="{{ path('KekRozsakAdminBundle_groupJoinDecline') }}">
<input type="hidden" name="user" value="{{ request.user.id }}" />
<input type="hidden" name="group" value="{{ group.id }}" />
<button type="submit">[elutasító ikon]</button>
</form>
</td>
</tr>
{% endif %}
{% endfor %}
{% endfor %}
</tbody>
</tbody>
</table>
{% endblock content %}

View File

@@ -6,29 +6,29 @@
<h3>Jelentkezők</h3>
{% if users|length > 0 %}
<table>
<thead>
<tr>
<td>Felhasználónév</td>
<td>E-mail cím</td>
<td>Fórum-név</td>
<td>Regisztráció ideje</td>
</tr>
</thead>
<tbody>
<thead>
<tr>
<td>Felhasználónév</td>
<td>E-mail cím</td>
<td>Fórum-név</td>
<td>Regisztráció ideje</td>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user.username }}</td>
<td>{{ user.email }}</td>
<td>{{ user|userdataspan }}</td>
<td>{{ user.registeredAt|date('Y-m-d H:i') }}</td>
<td>
<form method="post" action="">
<button type="submit">Engedélyezem</button>
</form>
</td>
</tr>
<tr>
<td>{{ user.username }}</td>
<td>{{ user.email }}</td>
<td>{{ user|userdataspan }}</td>
<td>{{ user.registeredAt|date('Y-m-d H:i') }}</td>
<td>
<form method="post" action="">
<button type="submit">Engedélyezem</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</tbody>
</table>
{% endif %}
{%endblock content %}

View File

@@ -12,21 +12,28 @@ use KekRozsak\FrontBundle\Entity\Article;
class ArticleController extends Controller
{
/**
* @Route("/cikk/{slug}", name="KekRozsakFrontBundle_articleView")
* @Template()
* @ParamConverter("article")
*
* @param KekRozsak\FrontBundle\Entity\Article $article
*/
public function viewAction(Article $article)
{
$scontext = $this->get('security.context');
if ((!is_object($scontext->getToken()) || !is_object($scontext->getToken()->getUser())) && !$article->isPublic())
throw new AccessDeniedException('A cikk megtekintéséhez be kell jelentkezned!');
/**
* @Route("/cikk/{slug}", name="KekRozsakFrontBundle_articleView")
* @Template()
* @ParamConverter("article")
*
* @param KekRozsak\FrontBundle\Entity\Article $article
*/
public function viewAction(Article $article)
{
$scontext = $this->get('security.context');
if (
(
!is_object($scontext->getToken())
|| !is_object($scontext->getToken()->getUser())
)
&& !$article->isPublic()
) {
throw new AccessDeniedException('A cikk megtekintéséhez be kell jelentkezned!');
}
return array(
'article' => $article,
);
}
return array(
'article' => $article,
);
}
}

View File

@@ -13,123 +13,126 @@ use KekRozsak\FrontBundle\Entity\BookCopy;
class BookController extends Controller
{
/**
* @Route("/konyvtar", name="KekRozsakFrontBundle_bookList")
* @Template()
*/
public function listAction()
{
$query = $this->getDoctrine()->getEntityManager()->createQuery('SELECT b FROM KekRozsakFrontBundle:Book b ORDER BY b.author ASC, b.title ASC, b.year ASC');
/**
* @Route("/konyvtar", name="KekRozsakFrontBundle_bookList")
* @Template()
*/
public function listAction()
{
$query = $this->getDoctrine()->getEntityManager()->createQuery('SELECT b FROM KekRozsakFrontBundle:Book b ORDER BY b.author ASC, b.title ASC, b.year ASC');
$books = $query->getResult();
$books = $query->getResult();
return array(
'books' => $books,
);
}
return array(
'books' => $books,
);
}
/**
* @Route("/konyvadat/{id}/ajax.{_format}", name="KekRozsakFrontBundle_bookAjaxData", defaults={"_format": "html"}, options={"expose": true})
* @Template()
* @ParamConverter("book")
*/
public function ajaxDataAction(Book $book)
{
return array(
'book' => $book,
);
}
/**
* @Route("/konyvadat/{id}/ajax.{_format}", name="KekRozsakFrontBundle_bookAjaxData", defaults={"_format": "html"}, options={"expose": true})
* @Template()
* @ParamConverter("book")
*/
public function ajaxDataAction(Book $book)
{
return array(
'book' => $book,
);
}
/**
* @Route("/konyv/torles/{id}", name="KekRozsakFrontBundle_bookDeleteCopy", requirements={"id": "\d+"}, options={"expose": true})
* @ParamConverter("book")
*/
public function ajaxDeleteBookAction(Book $book)
{
$copies = $book->getUsersCopies($this->get('security.context')->getToken()->getUser());
$em = $this->getDoctrine()->getEntityManager();
$copies->forAll(function($key, $copy) use ($book, $em) {
$book->removeCopy($copy);
$em->remove($copy);
});
$em->persist($book);
$em->flush();
/**
* @Route("/konyv/torles/{id}", name="KekRozsakFrontBundle_bookDeleteCopy", requirements={"id": "\d+"}, options={"expose": true})
* @ParamConverter("book")
*/
public function ajaxDeleteBookAction(Book $book)
{
$copies = $book->getUsersCopies($this->get('security.context')->getToken()->getUser());
$em = $this->getDoctrine()->getEntityManager();
$copies->forAll(function($key, $copy) use ($book, $em)
{
$book->removeCopy($copy);
$em->remove($copy);
});
$em->persist($book);
$em->flush();
return new Response();
}
return new Response();
}
/**
* @Route("/konyv/ujpeldany/{id}", name="KekRozsakFrontBundle_bookAddCopy", requirements={"id": "\d+"}, options={"expose": true})
* @ParamConverter("book")
*/
public function ajaxAddBookAction(Book $book)
{
$user = $this->get('security.context')->getToken()->getUser();
$copies = $book->getUsersCopies($user);
if ($copies->count() == 0)
{
$copy = new BookCopy($book, $user);
$em = $this->getDoctrine()->getEntityManager();
$em->persist($copy);
$em->flush();
}
/**
* @Route("/konyv/ujpeldany/{id}", name="KekRozsakFrontBundle_bookAddCopy", requirements={"id": "\d+"}, options={"expose": true})
* @ParamConverter("book")
*/
public function ajaxAddCopyAction(Book $book)
{
$user = $this->get('security.context')->getToken()->getUser();
$copies = $book->getUsersCopies($user);
if ($copies->count() == 0) {
$copy = new BookCopy($book, $user);
$em = $this->getDoctrine()->getEntityManager();
$em->persist($copy);
$em->flush();
}
return new Response();
}
return new Response();
}
/**
* @Route("/konyv/kolcsonozheto/{id}/{newValue}", name="KekRozsakFrontBundle_bookSetCopyBorrowable", requirements={"id": "\d+"}, options={"expose": true})
* @ParamConverter("book")
*/
public function ajaxSetBookCopyBorrowableAction(Book $book, $newValue)
{
$user = $this->get('security.context')->getToken()->getUser();
$copies = $book->getUsersCopies($user);
$em = $this->getDoctrine()->getEntityManager();
$copies->forAll(function($key, $copy) use ($em, $newValue) {
$copy->setBorrowable($newValue);
$em->persist($copy);
});
$em->flush();
return new Response();
}
/**
* @Route("/konyv/kolcsonozheto/{id}/{newValue}", name="KekRozsakFrontBundle_bookSetCopyBorrowable", requirements={"id": "\d+"}, options={"expose": true})
* @ParamConverter("book")
*/
public function ajaxSetBookCopyBorrowableAction(Book $book, $newValue)
{
$user = $this->get('security.context')->getToken()->getUser();
$copies = $book->getUsersCopies($user);
$em = $this->getDoctrine()->getEntityManager();
$copies->forAll(function($key, $copy) use ($em, $newValue)
{
$copy->setBorrowable($newValue);
$em->persist($copy);
});
$em->flush();
/**
* @Route("/konyv/megveheto/{id}/{newValue}", name="KekRozsakFrontBundle_bookSetCopyForSale", requirements={"id": "\d+"}, options={"expose": true})
* @ParamConverter("book")
*/
public function ajaxSetBookCopyForSaleAction(Book $book, $newValue)
{
$user = $this->get('security.context')->getToken()->getUser();
$copies = $book->getUsersCopies($user);
$em = $this->getDoctrine()->getEntityManager();
$copies->forAll(function($key, $copy) use ($em, $newValue) {
$copy->setBuyable($newValue);
$em->persist($copy);
});
$em->flush();
return new Response();
}
return new Response();
}
/**
* @Route("/konyv/szeretnek/{id}/{wantToBuy}", name="KekRozsakFrontBundle_bookWantOne", requirements={"id": "\d+"}, options={"expose": true})
* @ParamConverter("book")
*/
public function ajaxWantABookAction(Book $book, $wantToBuy)
{
$user = $this->get('security.context')->getToken()->getUser();
if ($wantToBuy)
{
$book->addWouldBuy($user);
}
else
{
$book->addWouldBorrow($user);
}
$em = $this->getDoctrine()->getEntityManager();
$em->persist($book);
$em->flush();
return new Response();
}
/**
* @Route("/konyv/megveheto/{id}/{newValue}", name="KekRozsakFrontBundle_bookSetCopyForSale", requirements={"id": "\d+"}, options={"expose": true})
* @ParamConverter("book")
*/
public function ajaxSetBookCopyForSaleAction(Book $book, $newValue)
{
$user = $this->get('security.context')->getToken()->getUser();
$copies = $book->getUsersCopies($user);
$em = $this->getDoctrine()->getEntityManager();
$copies->forAll(function($key, $copy) use ($em, $newValue)
{
$copy->setBuyable($newValue);
$em->persist($copy);
});
$em->flush();
return new Response();
}
/**
* @Route("/konyv/szeretnek/{id}/{wantToBuy}", name="KekRozsakFrontBundle_bookWantOne", requirements={"id": "\d+"}, options={"expose": true})
* @ParamConverter("book")
*/
public function ajaxWantABookAction(Book $book, $wantToBuy)
{
$user = $this->get('security.context')->getToken()->getUser();
if ($wantToBuy) {
$book->addWouldBuy($user);
} else {
$book->addWouldBorrow($user);
}
$em = $this->getDoctrine()->getEntityManager();
$em->persist($book);
$em->flush();
return new Response();
}
}

View File

@@ -15,50 +15,58 @@ use KekRozsak\SecurityBundle\Form\Type\UserType;
class DefaultController extends Controller
{
/**
* @Route("/", name="KekRozsakFrontBundle_homepage")
*/
public function homepageAction()
{
$mainPageArticle = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Article')->findOneBy(array('mainPage' => true), true, array('createdAt', 'DESC'), 1);
if (!$mainPageArticle)
throw $this->createNotFoundException('A keresett cikk nem létezik!');
/**
* @Route("/", name="KekRozsakFrontBundle_homepage")
*/
public function homepageAction()
{
$mainPageArticle = $this
->getDoctrine()
->getRepository('KekRozsakFrontBundle:Article')
->findOneBy(
array('mainPage' => true),
true,
array('createdAt', 'DESC'),
1
);
if (!$mainPageArticle) {
throw $this->createNotFoundException('A keresett cikk nem létezik!');
}
return $this->forward('KekRozsakFrontBundle:Article:view', array('slug' => $mainPageArticle->getSlug()));
}
return $this->forward('KekRozsakFrontBundle:Article:view', array('slug' => $mainPageArticle->getSlug()));
}
/**
* @Route("/profil", name="KekRozsakFrontBundle_profile_edit")
* @Template("KekRozsakFrontBundle:Default:userprofile.html.twig")
*/
public function profileEditAction()
{
$user = $this->get('security.context')->getToken()->getUser();
/**
* @Route("/profil", name="KekRozsakFrontBundle_profile_edit")
* @Template("KekRozsakFrontBundle:Default:userprofile.html.twig")
*/
public function profileEditAction()
{
$user = $this->get('security.context')->getToken()->getUser();
$oldPassword = $user->getPassword();
$form = $this->createForm(new UserType(), $user);
$saveSuccess = false;
$request = $this->getRequest();
$oldPassword = $user->getPassword();
$form = $this->createForm(new UserType(), $user);
$saveSuccess = false;
$request = $this->getRequest();
if ($request->getMethod() == 'POST')
{
$form->bind($request);
if ($form->isValid())
{
if ($user->getPassword() == '')
$user->setPassword($oldPassword);
else
$user->setPassword($this->get('security.encoder_factory')->getEncoder($user)->encodePassword($user->getPassword(), $user->getSalt()));
if ($request->getMethod() == 'POST') {
$form->bind($request);
if ($form->isValid()) {
if ($user->getPassword() == '') {
$user->setPassword($oldPassword);
} else {
$user->setPassword($this->get('security.encoder_factory')->getEncoder($user)->encodePassword($user->getPassword(), $user->getSalt()));
}
$em = $this->getDoctrine()->getEntityManager();
$em->persist($user);
$em->flush();
}
}
$em = $this->getDoctrine()->getEntityManager();
$em->persist($user);
$em->flush();
}
}
return array(
'form' => $form->createView(),
'saveSuccess' => $saveSuccess,
);
}
return array(
'form' => $form->createView(),
'saveSuccess' => $saveSuccess,
);
}
}

View File

@@ -13,93 +13,101 @@ use KekRozsak\FrontBundle\Extensions\Slugifier;
class DocumentController extends Controller
{
/**
* @Route("/dokumentum/{slug}.{_format}", name="KekRozsakFrontBundle_documentView", defaults={"_format": "html"}, requirements={"_format": "html|pdf"})
* @Template()
* @ParamConverter("document")
*/
public function viewAction(Document $document, $_format)
{
$templateParams = array(
'document' => $document,
);
/**
* @Route("/dokumentum/{slug}.{_format}", name="KekRozsakFrontBundle_documentView", defaults={"_format": "html"}, requirements={"_format": "html|pdf"})
* @Template()
* @ParamConverter("document")
*/
public function viewAction(Document $document, $_format)
{
$templateParams = array(
'document' => $document,
);
if ($_format == 'pdf')
{
$html = $this->renderView('KekRozsakFrontBundle:Document:pdfView.html.twig', $templateParams);
return $this->get('io_tcpdf')->quick_pdf($html);
}
if ($_format == 'pdf') {
$html = $this->renderView(
'KekRozsakFrontBundle:Document:pdfView.html.twig',
$templateParams
);
return $this->get('io_tcpdf')->quick_pdf($html);
}
return $templateParams;
}
return $templateParams;
}
/**
* @Route("/dokumentumok/uj/", name="KekRozsakFrontBundle_documentCreate")
* @Template()
*/
public function createAction()
{
$document = new Document();
$document->setSlug('n-a');
$form = $this->createForm(new DocumentType(), $document);
$request = $this->getRequest();
/**
* @Route("/dokumentumok/uj/", name="KekRozsakFrontBundle_documentCreate")
* @Template()
*/
public function createAction()
{
$document = new Document();
$document->setSlug('n-a');
$form = $this->createForm(new DocumentType(), $document);
$request = $this->getRequest();
if ($request->getMethod() == 'POST')
{
$form->bind($request);
if ($request->getMethod() == 'POST') {
$form->bind($request);
if ($form->isValid())
{
/* TODO: move these lines into life cycle events */
$slugifier = new Slugifier();
$document->setSlug($slugifier->slugify($document->getTitle()));
$document->setCreatedAt(new \DateTime('now'));
$document->setCreatedBy($this->get('security.context')->getToken()->getUser());
if ($form->isValid()) {
// TODO: move these lines into life cycle events
$slugifier = new Slugifier();
$document->setSlug($slugifier->slugify($document->getTitle()));
$document->setCreatedAt(new \DateTime('now'));
$document->setCreatedBy($this->get('security.context')->getToken()->getUser());
$em = $this->getDoctrine()->getEntityManager();
$em->persist($document);
$em->flush();
$em = $this->getDoctrine()->getEntityManager();
$em->persist($document);
$em->flush();
return $this->redirect($this->generateUrl('KekRozsakFrontBundle_documentView', array('slug' => $document->getSlug())));
}
}
return $this->redirect(
$this->generateUrl(
'KekRozsakFrontBundle_documentView',
array('slug' => $document->getSlug())
)
);
}
}
return array(
'form' => $form->createView(),
);
}
return array(
'form' => $form->createView(),
);
}
/**
* @Route("/dokumentum/{slug}/szerkesztes", name="KekRozsakFrontBundle_documentEdit")
* @Template()
* @ParamConverter("document")
*/
public function editAction(Document $document)
{
$form = $this->createForm(new DocumentType(), $document);
$request = $this->getRequest();
/**
* @Route("/dokumentum/{slug}/szerkesztes", name="KekRozsakFrontBundle_documentEdit")
* @Template()
* @ParamConverter("document")
*/
public function editAction(Document $document)
{
$form = $this->createForm(new DocumentType(), $document);
$request = $this->getRequest();
if ($request->getMethod() == 'POST')
{
$form->bind($request);
if ($form->isValid())
{
/* TODO: move these lines into life cycle events */
$slugifier = new Slugifier();
$document->setSlug($slugifier->slugify($document->getTitle()));
// TODO: add updatedAt, updatedBy, updateReason, etc.
if ($request->getMethod() == 'POST') {
$form->bind($request);
if ($form->isValid()) {
// TODO: move these lines into life cycle events
$slugifier = new Slugifier();
$document->setSlug($slugifier->slugify($document->getTitle()));
// TODO: add updatedAt, updatedBy, updateReason, etc.
$em = $this->getDoctrine()->getEntityManager();
$em->persist($document);
$em->flush();
$em = $this->getDoctrine()->getEntityManager();
$em->persist($document);
$em->flush();
return $this->redirect($this->generateUrl('KekRozsakFrontBundle_documentView', array('slug' => $document->getSlug())));
}
}
return $this->redirect(
$this->generateUrl(
'KekRozsakFrontBundle_documentView',
array('slug' => $document->getSlug())
)
);
}
}
return array(
'document' => $document,
'form' => $form->createView(),
);
}
return array(
'document' => $document,
'form' => $form->createView(),
);
}
}

View File

@@ -12,89 +12,91 @@ use KekRozsak\FrontBundle\Entity\Event;
class EventController extends Controller
{
/**
* @Route("/esesmeny/{startDate}/{eventSlug}", name="KekRozsakFrontBundle_eventView")
* @Template()
* @ParamConverter("event", class="KekRozsakFrontBundle:Event", options={"mapping"={"eventSlug" = "slug", "startDate"="startDate"}})
* @ParamConverter("startDate", class="DateTime", options={"format"="Y-m-d"})
*/
public function viewAction(\DateTime $startDate, Event $event)
{
if ($event->getGroup() !== null)
{
if (!$event->getGroup()->isMember($this->get('security.context')->getToken()->getUser()))
throw new AccessDeniedException('Ehhez az eseményhez nem csatlakozhatsz, mivel a csoportjának nem vagy tagja.');
}
return array(
'event' => $event,
);
}
/**
* @Route("/esemeny/{startDate}/{eventSlug}/csatlakozas", name="KekRozsakFrontBundle_eventJoin")
* @Template()
* @ParamConverter("event", class="KekRozsakFrontBundle:Event", options={"mapping"={"eventSlug": "slug", "startDate": "startDate"}})
* @ParamConverter("startDate", class="DateTime", options={"format"="Y-m-d"})
*/
public function joinAction(\DateTime $startDate, Event $event)
{
if ($event->getGroup() !== null)
{
if (!$event->getGroup()->isMember($this->get('security.context')->getToken()->getUser()))
throw new AccessDeniedException('Ehhez az eseményhez nem csatlakozhatsz, mivel a csoportjának nem vagy tagja.');
}
$event->addAttendee($this->get('security.context')->getToken()->getUser());
$em = $this->getDoctrine()->getEntityManager();
$em->persist($event);
$em->flush();
return $this->redirect($this->generateUrl('KekRozsakFrontBundle_eventView', array(
'eventDate' => $eventDate,
'eventSlug' => $eventSlug,
)));
}
/**
* @Route("/esemenyek/{date}", name="KekRozsakFrontBundle_eventList", defaults={"date": null})
* @Template()
*/
public function listAction($date = null)
{
$realDate = null;
if ($date === null) {
$query = $this->getDoctrine()->getEntityManager()->createQuery('SELECT e FROM KekRozsakFrontBundle:Event e WHERE e.cancelled = FALSE AND (e.startDate >= :day OR (e.startDate <= :day AND e.endDate >= :day))');
$query->setParameter('day', new \DateTime('now'), \Doctrine\DBAL\Types\Type::DATE);
} else {
$realDate = \DateTime::createFromFormat('Y-m-d', $date);
$query = $this->getDoctrine()->getEntityManager()->createQuery('SELECT e FROM KekRozsakFrontBundle:Event e WHERE e.cancelled = FALSE AND ((e.startDate < :day AND e.endDate >= :day) OR e.startDate = :day)');
$query->setParameter('day', $realDate, \Doctrine\DBAL\Types\Type::DATE);
/**
* @Route("/esesmeny/{startDate}/{eventSlug}", name="KekRozsakFrontBundle_eventView")
* @Template()
* @ParamConverter("event", class="KekRozsakFrontBundle:Event", options={"mapping"={"eventSlug" = "slug", "startDate"="startDate"}})
* @ParamConverter("startDate", class="DateTime", options={"format"="Y-m-d"})
*/
public function viewAction(\DateTime $startDate, Event $event)
{
if ($event->getGroup() !== null) {
if (!$event->getGroup()->isMember($this->get('security.context')->getToken()->getUser())) {
throw new AccessDeniedException('Ehhez az eseményhez nem csatlakozhatsz, mivel a csoportjának nem vagy tagja.');
}
$events = $query->getResult();
}
return array(
'day' => $realDate,
'events' => $events,
);
}
return array(
'event' => $event,
);
}
/**
* @Route("/esemenyek/{date}/ajax-lista.{_format}", name="KekRozsakFrontBundle_eventAjaxList", requirements={"_format": "html"})
* @Template()
* @ParamConverter("date", options={"format": "Y-m-d"})
*/
public function ajaxListAction(\DateTime $date)
{
$query = $this->getDoctrine()->getEntityManager()->createQuery('SELECT e FROM KekRozsakFrontBundle:Event e WHERE e.cancelled = FALSE AND ((e.startDate < :day AND e.endDate >= :day) OR e.startDate = :day)');
$query->setParameter('day', $date, \Doctrine\DBAL\Types\Type::DATE);
$events = $query->getResult();
/**
* @Route("/esemeny/{startDate}/{eventSlug}/csatlakozas", name="KekRozsakFrontBundle_eventJoin")
* @Template()
* @ParamConverter("event", class="KekRozsakFrontBundle:Event", options={"mapping"={"eventSlug": "slug", "startDate": "startDate"}})
* @ParamConverter("startDate", class="DateTime", options={"format"="Y-m-d"})
*/
public function joinAction(\DateTime $startDate, Event $event)
{
$user = $this->get('security.context')->getToken()->getUser();
return array(
'day' => $date,
'events' => $events,
);
}
if ($event->getGroup() !== null) {
if (!$event->getGroup()->isMember($user)) {
throw new AccessDeniedException('Ehhez az eseményhez nem csatlakozhatsz, mivel a csoportjának nem vagy tagja.');
}
}
$event->addAttendee($user);
$em = $this->getDoctrine()->getEntityManager();
$em->persist($event);
$em->flush();
return $this->redirect($this->generateUrl('KekRozsakFrontBundle_eventView', array(
'eventDate' => $eventDate,
'eventSlug' => $eventSlug,
)));
}
/**
* @Route("/esemenyek/{date}", name="KekRozsakFrontBundle_eventList", defaults={"date": null})
* @Template()
*/
public function listAction($date = null)
{
$realDate = null;
if ($date === null) {
$query = $this->getDoctrine()->getEntityManager()->createQuery('SELECT e FROM KekRozsakFrontBundle:Event e WHERE e.cancelled = FALSE AND (e.startDate >= :day OR (e.startDate <= :day AND e.endDate >= :day))');
$query->setParameter('day', new \DateTime('now'), \Doctrine\DBAL\Types\Type::DATE);
} else {
$realDate = \DateTime::createFromFormat('Y-m-d', $date);
$query = $this->getDoctrine()->getEntityManager()->createQuery('SELECT e FROM KekRozsakFrontBundle:Event e WHERE e.cancelled = FALSE AND ((e.startDate < :day AND e.endDate >= :day) OR e.startDate = :day)');
$query->setParameter('day', $realDate, \Doctrine\DBAL\Types\Type::DATE);
}
$events = $query->getResult();
return array(
'day' => $realDate,
'events' => $events,
);
}
/**
* @Route("/esemenyek/{date}/ajax-lista.{_format}", name="KekRozsakFrontBundle_eventAjaxList", requirements={"_format": "html"})
* @Template()
* @ParamConverter("date", options={"format": "Y-m-d"})
*/
public function ajaxListAction(\DateTime $date)
{
$query = $this->getDoctrine()->getEntityManager()->createQuery('SELECT e FROM KekRozsakFrontBundle:Event e WHERE e.cancelled = FALSE AND ((e.startDate < :day AND e.endDate >= :day) OR e.startDate = :day)');
$query->setParameter('day', $date, \Doctrine\DBAL\Types\Type::DATE);
$events = $query->getResult();
return array(
'day' => $date,
'events' => $events,
);
}
}

View File

@@ -17,77 +17,90 @@ use KekRozsak\FrontBundle\Form\Type\ForumPostType;
*/
class ForumController extends Controller
{
/**
* @Route("", name="KekRozsakFrontBundle_forumTopicGroupList")
* @Template()
*/
public function topicGroupListAction()
{
$groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopicGroup');
/**
* @Route("", name="KekRozsakFrontBundle_forumTopicGroupList")
* @Template()
*/
public function topicGroupListAction()
{
$groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopicGroup');
// TODO: ORDER the topic list by last post date
$topicGroups = $groupRepo->findAll();
// TODO: ORDER the topic list by last post date
$topicGroups = $groupRepo->findAll();
return array(
'topicGroups' => $topicGroups,
);
}
return array(
'topicGroups' => $topicGroups,
);
}
/**
* @Route("/{slug}", name="KekRozsakFrontBundle_forumTopicList")
* @Template()
* @ParamConverter("topicGroup")
*/
public function topicListAction(ForumTopicgRoup $topicGroup)
{
return array(
'topicGroup' => $topicGroup,
);
}
/**
* @Route("/{slug}", name="KekRozsakFrontBundle_forumTopicList")
* @Template()
* @ParamConverter("topicGroup")
*/
public function topicListAction(ForumTopicgRoup $topicGroup)
{
return array(
'topicGroup' => $topicGroup,
);
}
/**
* @Route("/{topicGroupSlug}/{topicSlug}", name="KekRozsakFrontBundle_forumPostList")
* @Template()
* @ParamConverter("topic", options={"mapping"={"topicGroup"="topicGroup", "topicSlug"="slug"}})
* @ParamConverter("topicGroup", options={"mapping"={"topicGroupSlug"="slug"}})
*/
public function postListAction(ForumTopicGroup $topicGroup, ForumTopic $topic)
{
// Get the list of posts in the requested topic
$postRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumPost');
$posts = $postRepo->findBy(array('topic' => $topic), array('createdAt' => 'DESC') /* TODO: , limit, offset */);
/**
* @Route("/{topicGroupSlug}/{topicSlug}", name="KekRozsakFrontBundle_forumPostList")
* @Template()
* @ParamConverter("topic", options={"mapping"={"topicGroup"="topicGroup", "topicSlug"="slug"}})
* @ParamConverter("topicGroup", options={"mapping"={"topicGroupSlug"="slug"}})
*/
public function postListAction(ForumTopicGroup $topicGroup, ForumTopic $topic)
{
// Get the list of posts in the requested topic
$postRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumPost');
$posts = $postRepo->findBy(
array('topic' => $topic),
array('createdAt' => 'DESC')
/* TODO: , limit, offset */
);
// Create an empty post object for posting
$post = new ForumPost();
$form = $this->createForm(new ForumPostType($topicGroup->getId(), $topic->getId()), $post);
// Create an empty post object for posting
$post = new ForumPost();
$form = $this->createForm(
new ForumPostType(
$topicGroup->getId(),
$topic->getId()
),
$post
);
$request = $this->getRequest();
if ($request->getMethod() == 'POST')
{
$form->bind($request);
if ($form->isValid())
{
$post->setCreatedAt(new \DateTime('now'));
$post->setCreatedBy($this->get('security.context')->getToken()->getUser());
$post->setTopic($topic);
$request = $this->getRequest();
if ($request->getMethod() == 'POST') {
$form->bind($request);
if ($form->isValid()) {
$post->setCreatedAt(new \DateTime('now'));
$post->setCreatedBy($this->get('security.context')->getToken()->getUser());
$post->setTopic($topic);
$em = $this->getDoctrine()->getEntityManager();
$em->persist($post);
$em->persist($topic);
$em->flush();
$em = $this->getDoctrine()->getEntityManager();
$em->persist($post);
$em->persist($topic);
$em->flush();
return $this->redirect($this->generateUrl('KekRozsakFrontBundle_forumPostList', array(
return $this->redirect(
$this->generateUrl(
'KekRozsakFrontBundle_forumPostList',
array(
'topicGroupSlug' => $topicGroup->getSlug(),
'topicSlug' => $topic->getSlug(),
)));
}
}
)
)
);
}
}
return array(
'topicGroup' => $topicGroup,
'topic' => $topic,
'posts' => $posts,
'form' => $form->createView(),
);
}
return array(
'topicGroup' => $topicGroup,
'topic' => $topic,
'posts' => $posts,
'form' => $form->createView(),
);
}
}

View File

@@ -16,151 +16,147 @@ use KekRozsak\FrontBundle\Extensions\Slugifier;
class GroupController extends Controller
{
/**
* @Route("/csoportok", name="KekRozsakFrontBundle_groupList")
* @Template()
*/
public function listAction()
{
$groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Group');
$groups = $groupRepo->findAll(array('name' => 'ASC'));
/**
* @Route("/csoportok", name="KekRozsakFrontBundle_groupList")
* @Template()
*/
public function listAction()
{
$groupRepo = $this
->getDoctrine()
->getRepository('KekRozsakFrontBundle:Group');
$groups = $groupRepo->findAll(array('name' => 'ASC'));
return array(
'groups' => $groups,
);
}
return array(
'groups' => $groups,
);
}
/**
* @Route("/csoport/{slug}", name="KekRozsakFrontBundle_groupView")
* @Template()
* @ParamConverter("group")
*/
public function viewAction(Group $group)
{
return array(
'group' => $group,
);
}
/**
* @Route("/csoport/{slug}", name="KekRozsakFrontBundle_groupView")
* @Template()
* @ParamConverter("group")
*/
public function viewAction(Group $group)
{
return array(
'group' => $group,
);
}
/**
* @Route("/csoport/{slug}/tagok", name="KekRozsakFrontBundle_groupMembers")
* @Template()
* @ParamConverter("group")
*/
public function membersAction(Group $group)
{
return array(
'group' => $group,
);
}
/**
* @Route("/csoport/{slug}/tagok", name="KekRozsakFrontBundle_groupMembers")
* @Template()
* @ParamConverter("group")
*/
public function membersAction(Group $group)
{
return array(
'group' => $group,
);
}
/**
* @Route("/csoport/{slug}/dokumentumok", name="KekRozsakFrontBundle_groupDocuments")
* @Template()
* @ParamConverter("group")
*/
public function documentsAction(Group $group)
{
return array(
'group' => $group,
);
}
/**
* @Route("/csoport/{slug}/dokumentumok", name="KekRozsakFrontBundle_groupDocuments")
* @Template()
* @ParamConverter("group")
*/
public function documentsAction(Group $group)
{
return array(
'group' => $group,
);
}
/**
* @Route("/csoport/{slug}/belepes", name="KekRozsakFrontBundle_groupJoin")
* @Template()
* @ParamConverter("group")
*/
public function joinAction(Group $group)
{
$user = $this->get('security.context')->getToken()->getUser();
/**
* @Route("/csoport/{slug}/belepes", name="KekRozsakFrontBundle_groupJoin")
* @Template()
* @ParamConverter("group")
*/
public function joinAction(Group $group)
{
$user = $this->get('security.context')->getToken()->getUser();
if ($group->isMember($user))
{
return $this->redirect($this->generateUrl('KekRozsakFrontBundle_groupView', array('slug' => $group->getSlug())));
}
if ($group->isMember($user)) {
return $this->redirect($this->generateUrl('KekRozsakFrontBundle_groupView', array('slug' => $group->getSlug())));
}
if ($group->isRequested($user))
{
return array(
'isRequested' => true,
'needApproval' => false,
'group' => $group,
);
}
if ($group->isRequested($user)) {
return array(
'isRequested' => true,
'needApproval' => false,
'group' => $group,
);
}
$membership = new UserGroupMembership($user, $group);
$membership->setUser($user);
$membership->setGroup($group);
$membership->setMembershipRequestedAt(new \DateTime('now'));
if ($group->isOpen())
{
$membership->setMembershipAcceptedAt(new \DateTime('now'));
}
$membership = new UserGroupMembership($user, $group);
$membership->setUser($user);
$membership->setGroup($group);
$membership->setMembershipRequestedAt(new \DateTime('now'));
if ($group->isOpen()) {
$membership->setMembershipAcceptedAt(new \DateTime('now'));
}
$em = $this->getDoctrine()->getEntityManager();
$em->persist($membership);
$em->flush();
$em = $this->getDoctrine()->getEntityManager();
$em->persist($membership);
$em->flush();
if ($group->isOpen())
{
return $this->redirect($this->generateUrl('KekRozsakFrontBundle_groupView', array('slug' => $group->getSlug())));
}
else
{
$message = \Swift_Message::newInstance()
->setSubject('Új jelentkező a csoportodban (' . $group->getName() . '): ' . $user->getDisplayName())
// TODO: Make this a config parameter!
->setFrom('info@blueroses.hu')
->setTo($group->getLeader()->getEmail())
->setBody($this->renderView('KekRozsakFrontBundle:Email:groupJoinRequest.txt.twig', array('user' => $user, 'group' => $group)));
$this->get('mailer')->send($message);
if ($group->isOpen()) {
return $this->redirect($this->generateUrl('KekRozsakFrontBundle_groupView', array('slug' => $group->getSlug())));
} else {
$message = \Swift_Message::newInstance()
->setSubject('Új jelentkező a csoportodban (' . $group->getName() . '): ' . $user->getDisplayName())
// TODO: Make this a config parameter!
->setFrom('info@blueroses.hu')
->setTo($group->getLeader()->getEmail())
->setBody($this->renderView('KekRozsakFrontBundle:Email:groupJoinRequest.txt.twig', array('user' => $user, 'group' => $group)));
$this->get('mailer')->send($message);
return array(
'isRequested' => false,
'needApproval' => true,
'group' => $group,
);
}
}
return array(
'isRequested' => false,
'needApproval' => true,
'group' => $group,
);
}
}
/**
* @Route("/csoportok/uj", name="KekRozsakFrontBundle_groupCreate")
* @Template()
*/
public function createAction()
{
$group = new Group();
$form = $this->createForm(new GroupType(), $group);
$request = $this->getRequest();
/**
* @Route("/csoportok/uj", name="KekRozsakFrontBundle_groupCreate")
* @Template()
*/
public function createAction()
{
$group = new Group();
$form = $this->createForm(new GroupType(), $group);
$request = $this->getRequest();
if ($request->getMethod() == 'POST')
{
$form->bind($request);
if ($form->isValid())
{
$slugifier = new Slugifier();
$user = $this->get('security.context')->getToken()->getUser();
if ($request->getMethod() == 'POST') {
$form->bind($request);
if ($form->isValid()) {
$slugifier = new Slugifier();
$user = $this->get('security.context')->getToken()->getUser();
$group->setCreatedBy($user);
$group->setSlug($slugifier->slugify($group->getName()));
$group->setCreatedAt(new \DateTime('now'));
$group->setOpen(true);
$group->setCreatedBy($user);
$group->setSlug($slugifier->slugify($group->getName()));
$group->setCreatedAt(new \DateTime('now'));
$group->setOpen(true);
$em = $this->getDoctrine()->getEntityManager();
$em->persist($group);
$em->flush();
$em = $this->getDoctrine()->getEntityManager();
$em->persist($group);
$em->flush();
$membership = new UserGroupMembership($user, $group);
$em->persist($membership);
$em->flush();
$membership = new UserGroupMembership($user, $group);
$em->persist($membership);
$em->flush();
return $this->redirect($this->generateUrl('KekRozsakFrontBundle_groupList'));
}
}
return $this->redirect(
$this->generateUrl('KekRozsakFrontBundle_groupList')
);
}
}
return array(
'form' => $form->createView(),
);
}
return array(
'form' => $form->createView(),
);
}
}

View File

@@ -12,247 +12,273 @@ use KekRozsak\SecurityBundle\Entity\User;
*/
class Article
{
/**
* @var integer $id
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* The ID of the Article
*
* @var integer $id
*
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinColumn(name="created_by_id")
*/
protected $createdBy;
/**
* The User who created the Article
*
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
*
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinColumn(name="created_by_id")
*/
protected $createdBy;
/**
* Set createdBy
*
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
* @return Article
*/
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Set createdBy
*
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
* @return Article
*/
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Get createdBy
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* Get createdBy
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* @var DateTime $createdAt
* @ORM\Column(type="datetime", name="created_at", nullable=false)
*/
protected $createdAt;
/**
* The timestamp when the Article was created
*
* @var DateTime $createdAt
*
* @ORM\Column(type="datetime", name="created_at", nullable=false)
*/
protected $createdAt;
/**
* Set createdAt
*
* @param DateTime $createdAt
* @return Article
*/
public function setCreatedAt(\DateTime $createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Set createdAt
*
* @param DateTime $createdAt
* @return Article
*/
public function setCreatedAt(\DateTime $createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Get createdAt
*
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @var string $title
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
*/
protected $title;
/**
* The title of the Article
*
* @var string $title
*
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
*/
protected $title;
/**
* Set title
*
* @param string $title
* @return Article
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Set title
*
* @param string $title
* @return Article
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @var string $slug
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
*/
protected $slug;
/**
* The slugified title of the Article
*
* @var string $slug
*
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
*/
protected $slug;
/**
* Set slug
*
* @param string $slug
* @return Article
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Set slug
*
* @param string $slug
* @return Article
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* @var string $text
* @ORM\Column(type="text", nullable=false)
*/
protected $text;
/**
* The content of the Article
*
* @var string $text
*
* @ORM\Column(type="text", nullable=false)
*/
protected $text;
/**
* Set text
*
* @param string $text
* @return Article
*/
public function setText($text)
{
$this->text = $text;
return $this;
}
/**
* Set text
*
* @param string $text
* @return Article
*/
public function setText($text)
{
$this->text = $text;
return $this;
}
/**
* Get text
*
* return string
*/
public function getText()
{
return $this->text;
}
/**
* Get text
*
* return string
*/
public function getText()
{
return $this->text;
}
/**
* @var boolean $mainPage
* @ORM\Column(type="boolean", name="main_page")
*/
protected $mainPage;
/**
* TRUE if the article should display on the main mage
*
* @var boolean $mainPage
*
* @ORM\Column(type="boolean", name="main_page")
*/
protected $mainPage;
/**
* Set mainPage
*
* @param boolean $mainPage
* @return Article
*/
public function setMainPage($mainPage)
{
$this->mainPage = $mainPage;
return $this;
}
/**
* Set mainPage
*
* @param boolean $mainPage
* @return Article
*/
public function setMainPage($mainPage)
{
$this->mainPage = $mainPage;
return $this;
}
/**
* Get mainPage
*
* @return boolean
*/
public function getMainPage()
{
return $this->mainPage;
}
/**
* Get mainPage
*
* @return boolean
*/
public function getMainPage()
{
return $this->mainPage;
}
/**
* @var boolean public
* @ORM\Column(type="boolean", nullable=false)
*/
protected $public;
/**
* TRUE if the article is viewable by anyone
*
* @var boolean public
*
* @ORM\Column(type="boolean", nullable=false)
*/
protected $public;
/**
* Set public
*
* @param boolean $public
* @return Article
*/
public function setPublic($public = false)
{
$this->public = $public;
return $this;
}
/**
* Set public
*
* @param boolean $public
* @return Article
*/
public function setPublic($public = false)
{
$this->public = $public;
return $this;
}
/**
* Get public
*
* @return boolean
*/
public function isPublic()
{
return $this->public;
}
/**
* Get public
*
* @return boolean
*/
public function isPublic()
{
return $this->public;
}
/**
* @var string $source
* @ORM\Column(type="string", nullable=true)
*/
protected $source;
/**
* The source of the Article, if any
*
* @var string $source
*
* @ORM\Column(type="string", nullable=true)
*/
protected $source;
/**
* Set source
*
* @param string $source
* @return Article
*/
public function setSource($source = null)
{
$this->source = $source;
return $this;
}
/**
* Set source
*
* @param string $source
* @return Article
*/
public function setSource($source = null)
{
$this->source = $source;
return $this;
}
/**
* Get source
*
* @return string
*/
public function getSource()
{
return $this->source;
}
/**
* Get source
*
* @return string
*/
public function getSource()
{
return $this->source;
}
}

View File

@@ -18,282 +18,348 @@ use KekRozsak\SecurityBundle\Entity\User;
*/
class Book
{
public function __construct()
{
$this->copies = new ArrayCollection();
$this->wouldBorrow = new ArrayCollection();
$this->wouldBuy = new ArrayCollection();
}
public function __construct()
{
$this->copies = new ArrayCollection();
$this->wouldBorrow = new ArrayCollection();
$this->wouldBuy = new ArrayCollection();
}
/**
* @var integer $id
*
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* The ID of the Book
*
* @var integer $id
*
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* @var Doctrine\Common\Collections\ArrayCollection $copies
*
* @ORM\OneToMany(targetEntity="BookCopy", mappedBy="book")
*/
protected $copies;
/**
* The copies available for this Book
*
* @var Doctrine\Common\Collections\ArrayCollection $copies
*
* @ORM\OneToMany(targetEntity="BookCopy", mappedBy="book")
*/
protected $copies;
/**
* Remove a copy
*
* @param KekRozsak\FrontBundle\Entity\BookCopy $copy
* @return Book
*/
public function removeCopy(BookCopy $copy)
{
$this->copies->removeElement($copy);
}
/**
* Remove a copy
*
* @param KekRozsak\FrontBundle\Entity\BookCopy $copy
* @return Book
*/
public function removeCopy(BookCopy $copy)
{
$this->copies->removeElement($copy);
}
/**
* Get copies
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getCopies()
{
return $this->copies;
}
/**
* Get copies
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getCopies()
{
return $this->copies;
}
public function getCopiesBorrowed()
{
return $this->copies->filter(function($copy) {
return ($copy->getBorrower() !== null);
});
}
/**
* Get the copies of this Book those are borrowed by someone
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getCopiesBorrowed()
{
return $this->copies->filter(function($copy)
{
return ($copy->getBorrower() !== null);
});
}
public function getCopiesBorrowedByUser(User $user)
{
return $this->copies->filter(function($copy) use ($user) {
return ($copy->getBorrower() == $user);
});
}
/**
* Get the copies of this Book those are borrowed by $user
*
* @param \KekRozsak\SecurityBundle\Entity\User $user
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getCopiesBorrowedByUser(User $user)
{
return $this->copies->filter(function($copy) use ($user)
{
return ($copy->getBorrower() == $user);
});
}
public function getCopiesBorrowedReturnedByUser(User $user)
{
return $this->copies->filter(function($copy) use ($user) {
return ($copy->getBorrower() == $user) && ($copy->isBorrowerReturned());
});
}
/**
* Get the copies of this Book those are borrowed by $user, but marked as
* returned
*
* @param \KekRozsak\SecurityBundle\Entity\User $user
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getCopiesBorrowedReturnedByUser(User $user)
{
return $this->copies->filter(function($copy) use ($user)
{
return ($copy->getBorrower() == $user) && ($copy->isBorrowerReturned());
});
}
public function getCopiesBorrowable()
{
return $this->copies->filter(function($copy) {
return $copy->isBorrowable();
});
}
/**
* Get all the borrowable copies of this Book
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getCopiesBorrowable()
{
return $this->copies->filter(function($copy) {
return $copy->isBorrowable();
});
}
public function getUsersCopies(User $user)
{
return $this->copies->filter(function ($copy) use ($user) {
return ($copy->getOwner() == $user);
});
}
/**
* Get $user's copies of this Book
*
* @param \KekRozsak\SecurityBundle\Entity\User $user
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getUsersCopies(User $user)
{
return $this->copies->filter(function ($copy) use ($user)
{
return ($copy->getOwner() == $user);
});
}
public function getUsersCopiesBorrowable(User $user)
{
return $this->copies->filter(function($copy) use ($user) {
return (($copy->getOwner() == $user) && $copy->isBorrowable());
});
}
/**
* Get $user's borrowable copies of this Book
*
* @param \KekRozsak\SecurityBundle\Entity\User $user
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getUsersCopiesBorrowable(User $user)
{
return $this->copies->filter(function($copy) use ($user)
{
return (($copy->getOwner() == $user) && $copy->isBorrowable());
});
}
public function getUsersCopiesBuyable(User $user)
{
return $this->copies->filter(function($copy) use ($user) {
return (($copy->getOwner() == $user) && $copy->isBuyable());
});
}
/**
* Get $user's buyable copies of this Book
*
* @param \KekRozsak\SecurityBundle\Entity\User $user
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getUsersCopiesBuyable(User $user)
{
return $this->copies->filter(function($copy) use ($user)
{
return (($copy->getOwner() == $user) && $copy->isBuyable());
});
}
/**
* @var string $author
*
* @ORM\Column(type="string", length=100, nullable=false)
*/
protected $author;
/**
* The author of the Book
*
* @var string $author
*
* @ORM\Column(type="string", length=100, nullable=false)
*/
protected $author;
/**
* Set author
*
* @param string $author
* @return Book
*/
public function setAuthor($author)
{
$this->author = $author;
return $this;
}
/**
* Set author
*
* @param string $author
* @return Book
*/
public function setAuthor($author)
{
// TODO: Check if null!
$this->author = $author;
return $this;
}
/**
* Get author
*
* @return string
*/
public function getAuthor()
{
return $this->author;
}
/**
* Get author
*
* @return string
*/
public function getAuthor()
{
return $this->author;
}
/**
* @var string $title
*
* @ORM\Column(type="string", length=100, nullable=false)
*/
protected $title;
/**
* The title of the Book
*
* @var string $title
*
* @ORM\Column(type="string", length=100, nullable=false)
*/
protected $title;
/**
* Set title
*
* @param string $title
* @return Book
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Set title
*
* @param string $title
* @return Book
*/
public function setTitle($title)
{
// TODO: Check if null!
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @var integer $year
*
* @ORM\Column(type="integer", nullable=false)
*/
protected $year;
/**
* The Book's year of publication
*
* @var integer $year
*
* @ORM\Column(type="integer", nullable=false)
*/
protected $year;
/**
* Set year
*
* @param integer $year
* @return Book
*/
public function setYear($year)
{
$this->year = $year;
return $this;
}
/**
* Set year
*
* @param integer $year
* @return Book
*/
public function setYear($year)
{
// TODO: Check if null!
$this->year = $year;
return $this;
}
/**
* Get year
*
* @return integer
*/
public function getYear()
{
return $this->year;
}
/**
* Get year
*
* @return integer
*/
public function getYear()
{
return $this->year;
}
/**
* @var boolean $commentable
*
* @ORM\Column(type="boolean", nullable=false)
*/
protected $commentable;
/**
* TRUE if comments can be written about the Book
* @var boolean $commentable
*
* @ORM\Column(type="boolean", nullable=false)
*/
protected $commentable;
/**
* @var Doctrine\Common\Collections\ArrayCollection $wouldBorrow
*
* @ORM\ManyToMany(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinTable(name="book_would_borrow")
*/
protected $wouldBorrow;
/**
* Collection of Users who would like to borrow a copy
*
* @var Doctrine\Common\Collections\ArrayCollection $wouldBorrow
*
* @ORM\ManyToMany(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinTable(name="book_would_borrow")
*/
protected $wouldBorrow;
/**
* Add a user for want-to-borrowers
*
* @param KekRozsak\SecurityBundle\Entity\User $user
* @return Book
*/
public function addWouldBorrow(User $user)
{
$this->wouldBorrow->add($user);
return $this;
}
/**
* Add a user for want-to-borrowers
*
* @param KekRozsak\SecurityBundle\Entity\User $user
* @return Book
*/
public function addWouldBorrow(User $user)
{
// TODO: Check if null!
$this->wouldBorrow->add($user);
return $this;
}
/**
* Get wouldBorrow list
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getWouldBorrow()
{
return $this->wouldBorrow;
}
/**
* Get wouldBorrow list
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getWouldBorrow()
{
return $this->wouldBorrow;
}
/**
* Check if specified user would borrow this book
*
* @param KekRozsak\SecurityBundle\Entity\User $user
* @return boolean
*/
public function userWouldBorrow(User $user)
{
return $this->wouldBorrow->contains($user);
}
/**
* Check if $user would like to borrow this book
*
* @param KekRozsak\SecurityBundle\Entity\User $user
* @return boolean
*/
public function userWouldBorrow(User $user)
{
return $this->wouldBorrow->contains($user);
}
/**
* @var Doctrine\Common\Collections\ArrayCollection $wouldBuy
*
* @ORM\ManyToMany(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinTable(name="book_would_buy")
*/
protected $wouldBuy;
/**
* Collection of Users who would like to buy a copy of this book
*
* @var Doctrine\Common\Collections\ArrayCollection $wouldBuy
*
* @ORM\ManyToMany(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinTable(name="book_would_buy")
*/
protected $wouldBuy;
/**
* Add a user for want-to-buyers
*
* @param KekRozsak\SecurityBundle\Entity\User $user
* @return Book
*/
public function addWouldBuy(User $user)
{
$this->wouldBuy->add($user);
return $this;
}
/**
* Add a user for want-to-buyers
*
* @param KekRozsak\SecurityBundle\Entity\User $user
* @return Book
*/
public function addWouldBuy(User $user)
{
$this->wouldBuy->add($user);
return $this;
}
/**
* Get wouldBuy list
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getWouldBuy()
{
return $this->wouldBuy;
}
/**
* Get wouldBuy list
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getWouldBuy()
{
return $this->wouldBuy;
}
/**
* Check if specified user would buy this book
*
* @param KekRozsak\SecurityBundle\Entity\User $user
* @return boolean
*/
public function userWouldBuy(User $user)
{
return $this->wouldBuy->contains($user);
}
/**
* Check if specified user would buy this book
*
* @param KekRozsak\SecurityBundle\Entity\User $user
* @return boolean
*/
public function userWouldBuy(User $user)
{
return $this->wouldBuy->contains($user);
}
}

View File

@@ -19,147 +19,163 @@ use KekRozsak\SecurityBundle\Entity\User;
*/
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;
}
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;
/**
* The ID of the BookCopy
*
* @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;
/**
* The Book this BookCopy belongs to
* @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;
/**
* The User this BookCopy belongs to
*
* @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;
}
/**
* 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;
/**
* The owner's comment about this BookCopy's Book
*
* @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;
/**
* TRUE if this BookCopy is borrowable
*
* @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;
}
/**
* Set borrowable
*
* @param boolean $borrowable
* @return BookCopy
*/
public function setBorrowable($borrowable)
{
// TODO: Check if parameter is boolean!
$this->borrowable = $borrowable;
return $this;
}
/**
* Get borrowable
*
* @return boolean
*/
public function isBorrowable()
{
return $this->borrowable;
}
/**
* Get borrowable
*
* @return boolean
*/
public function isBorrowable()
{
return $this->borrowable;
}
/**
* @var boolean $buyable
*
* @ORM\Column(type="boolean", nullable=false)
*/
protected $buyable;
/**
* TRUE if this BookCopy is for sale
*
* @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;
}
/**
* Set buyable
*
* @param boolean $buyable
* @return BookCopy
*/
public function setBuyable($buyable)
{
// Check if parameter is boolean!
$this->buyable = $buyable;
return $this;
}
/**
* Get borrowable
*
* @return boolean
*/
public function isBuyable()
{
return $this->buyable;
}
/**
* Get buyable
*
* @return boolean
*/
public function isBuyable()
{
return $this->buyable;
}
/**
* @var KekRozsak\SecurityBundle\Entity\User $borrower
*
* @ORM\OneToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
*/
protected $borrower;
/**
* The User who is currently borrowing this BookCopy, or null
*
* @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;
}
/**
* 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;
/**
* TRUE if borrower says he/she returned this Copy to the owner
* @var boolean $borrowerReturned
*
* @ORM\Column(type="boolean", nullable=false, name="borrower_returned")
*/
protected $borrowerReturned;
/**
* Get borrowerReturned
*
* @return boolean
*/
public function isBorrowerReturned()
{
return $this->borrowerReturned();
}
/**
* Get borrowerReturned
*
* @return boolean
*/
public function isBorrowerReturned()
{
return $this->borrowerReturned();
}
}

View File

@@ -19,282 +19,305 @@ use KekRozsak\FrontBundle\Entity\Group;
*/
class Document
{
public function __construct()
{
$this->groups = new ArrayCollection();
}
public function __construct()
{
$this->groups = new ArrayCollection();
}
/**
* @var integer $id
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* The ID of the Document
*
* @var integer $id
*
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* @var string $title
* @ORM\Column(type="string", length=150, unique=true, nullable=false)
* @Assert\NotBlank()
*/
protected $title;
/**
* The title of the Document
*
* @var string $title
*
* @ORM\Column(type="string", length=150, unique=true, nullable=false)
* @Assert\NotBlank()
*/
protected $title;
/**
* Set title
*
* @param string $title
* @return Document
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Set title
*
* @param string $title
* @return Document
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @var string $slug
* @ORM\Column(type="string", length=150, unique=true, nullable=false)
* @Assert\NotBlank()
*/
protected $slug;
/**
* The slugified title of this Document
*
* @var string $slug
*
* @ORM\Column(type="string", length=150, unique=true, nullable=false)
* @Assert\NotBlank()
*/
protected $slug;
/**
* Set slug
*
* @param string $slug
* @return Document
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Set slug
*
* @param string $slug
* @return Document
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinColumn(name="created_by_id")
*/
protected $createdBy;
/**
* The User who created this Document
*
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
*
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinColumn(name="created_by_id")
*/
protected $createdBy;
/**
* Set createdBy
*
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
* @return Document
*/
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Set createdBy
*
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
* @return Document
*/
public function setCreatedBy(User $createdBy)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Get createdBy
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* Get createdBy
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* The timestamp when the Document was created
*
* @var DateTime $createdat
*
* @ORM\Column(type="datetime", nullable=false, name="created_at")
*/
protected $createdAt;
/**
* @var DateTime $createdat
* @ORM\Column(type="datetime", nullable=false, name="created_at")
*/
protected $createdAt;
/**
* Set createdAt
*
* @param DateTime $createdAt
* @return Document
*/
public function setCreatedAt(\DateTime $createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Set createdAt
*
* @param DateTime $createdAt
* @return Document
*/
public function setCreatedAt(\DateTime $createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Get createdAt
*
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* The content of the Document
*
* @var string $content
*
* @ORM\Column(type="text", nullable=false)
*/
protected $content;
/**
* @var string $content
* @ORM\Column(type="text", nullable=false)
*/
protected $content;
/**
* Set content
*
* @param string $content
* @return Document
*/
public function setContent($content)
{
$this->content = $content;
return $this;
}
/**
* Set content
*
* @param string $content
* @return Document
*/
public function setContent($content)
{
$this->content = $content;
return $this;
}
/**
* Get content
*
* @return string
*/
public function getContent()
{
return $this->content;
}
/**
* Get content
*
* @return string
*/
public function getContent()
{
return $this->content;
}
/**
* @var Doctrine\Common\Collections\ArrayCollection $groups
* @ORM\ManyToMany(targetEntity="KekRozsak\FrontBundle\Entity\Group", mappedBy="documents")
*/
protected $groups;
/**
* @var Doctrine\Common\Collections\ArrayCollection $groups
* @ORM\ManyToMany(targetEntity="KekRozsak\FrontBundle\Entity\Group", mappedBy="documents")
*/
protected $groups;
/**
* Add a group
*
* @param KekRozsak\FrontBundle\Entity\Group $group
* @return Document
*/
public function addGroup(Group $group)
{
$this->groups[] = $group;
return $this;
}
/**
* Add a group
*
* @param KekRozsak\FrontBundle\Entity\Group $group
* @return Document
*/
public function addGroup(\KekRozsak\FrontBundle\Entity\Group $group)
{
$this->groups[] = $group;
return $this;
}
/**
* Get all groups
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getGroups()
{
return $this->group;
}
/**
* Get all groups
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getGroups()
{
return $this->group;
}
/**
* The User who last updated the Document
*
* @var KekRozsak\SecurityBundle\Entity\User $updatedBy
*
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
*/
protected $updatedBy;
/**
* @var KekRozsak\SecurityBundle\Entity\User $updatedBy
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
*/
protected $updatedBy;
/**
* Set updatedBy
*
* @param KekRozsak\SecurityBundle\Entity\User $updatedBy
* @return Document
*/
public function setUpdatedBy(User $updatedBy = null)
{
$this->updatedBy = $updatedBy;
return $this;
}
/**
* Set updatedBy
*
* @param KekRozsak\SecurityBundle\Entity\User $updatedBy
* @return Document
*/
public function setUpdatedBy(\KekRozsak\SecurityBundle\Entity\User $updatedBy = null)
{
$this->updatedBy = $updatedBy;
return $this;
}
/**
* Get updatedBy
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getUpdatedBy()
{
return $this->updatedBy;
}
/**
* Get updatedBy
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getUpdatedBy()
{
return $this->updatedBy;
}
/**
* The timestamp the Document was last updated
*
* @var DateTime $updatedAt
*
* @ORM\Column(type="datetime", nullable=true)
*/
protected $updatedAt;
/**
* @var DateTime $updatedAt
* @ORM\Column(type="datetime", nullable=true)
*/
protected $updatedAt;
/**
* Set updatedAt
*
* @param DateTime $updatedAt
* @return Document
*/
public function setUpdatedAt(\DateTime $updatedAt = null)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Set updatedAt
*
* @param DateTime $updatedAt
* @return Document
*/
public function setUpdatedAt(\DateTime $updatedAt = null)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* @return DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* Get updatedAt
*
* @return DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* @var string updateReason
* @ORM\Column(type="text", nullable=true)
*/
protected $updateReason;
/**
* @var string updateReason
* @ORM\Column(type="text", nullable=true)
*/
protected $updateReason;
/**
* Set updateReason
*
* @param string $updateReason
* @return Document
*/
public function setUpdateReason($updateReason = null)
{
$this->updateReason = $updateReason;
return $this;
}
/**
* Set updateReason
*
* @param string $updateReason
* @return Document
*/
public function setUpdateReason($updateReason = null)
{
$this->updateReason = $updateReason;
return $this;
}
/**
* Get updateReason
*
* @return string
*/
public function getUpdateReason()
{
return $this->updateReason;
}
/**
* Get updateReason
*
* @return string
*/
public function getUpdateReason()
{
return $this->updateReason;
}
}

View File

@@ -7,6 +7,9 @@ use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;
use KekRozsak\SecurityBundle\Entity\User;
use KekRozsak\FrontBundle\Entity\Group;
/**
* @ORM\Entity
* @ORM\Table(name="events")
@@ -16,403 +19,432 @@ use Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;
*/
class Event
{
/**
* @var integer $id
*
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* The ID of the Event
*
* @var integer $id
*
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
*
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinColumn(name="created_by_id")
*/
protected $createdBy;
/**
* The User who created the Event
*
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
*
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinColumn(name="created_by_id")
*/
protected $createdBy;
/**
* Set createdBy
*
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
* @return Event
*/
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Set createdBy
*
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
* @return Event
*/
public function setCreatedBy(User $createdBy)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Get createdBy
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* Get createdBy
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* @var DateTime $startDate
*
* @ORM\Column(type="date", nullable=true, name="start_date", nullable=false)
*/
protected $startDate;
/**
* The date on which the Event starts
*
* @var DateTime $startDate
*
* @ORM\Column(type="date", nullable=true, name="start_date", nullable=false)
*/
protected $startDate;
/**
* Set startDate
*
* @param DateTime $startDate
* @return Event
*/
public function setStartDate(\DateTime $startDate = null)
{
$this->startDate = $startDate;
return $this;
}
/**
* Set startDate
*
* @param DateTime $startDate
* @return Event
*/
public function setStartDate(\DateTime $startDate = null)
{
$this->startDate = $startDate;
return $this;
}
/**
* Get startDate
*
* @return DateTime
*/
public function getStartDate()
{
return $this->startDate;
}
/**
* Get startDate
*
* @return DateTime
*/
public function getStartDate()
{
return $this->startDate;
}
/**
* @var DateTime $endDate
*
* @ORM\Column(type="date", nullable=true, name="end_date")
*/
protected $endDate;
/**
* The date on which the Event ends. May be null if same as $startDate
*
* @var DateTime $endDate
*
* @ORM\Column(type="date", nullable=true, name="end_date")
*/
protected $endDate;
/**
* Set endDate
*
* @param DateTime $endDate
* @return Event
*/
public function setEndDate(\DateTime $endDate)
{
$this->endDate = $endDate;
return $this;
}
/**
* Set endDate
*
* @param DateTime $endDate
* @return Event
*/
public function setEndDate(\DateTime $endDate = null)
{
// TODO: Check if endDate is later than startDate
$this->endDate = $endDate;
return $this;
}
/**
* Get endDate
*
* @return DateTime
*/
public function getEndDate()
{
return $this->endDate;
}
/**
* Get endDate
*
* @return DateTime
*/
public function getEndDate()
{
return $this->endDate;
}
/**
* @var Doctrine\Common\Collections\ArrayCollection $attendees
*
* @ORM\ManyToMany(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinTable(name="event_attendees")
*/
protected $attendees;
/**
* An ArrayCollection of Users who wish to attend on this Event
*
* @var Doctrine\Common\Collections\ArrayCollection $attendees
*
* @ORM\ManyToMany(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinTable(name="event_attendees")
*/
protected $attendees;
/**
* Add attendee
*
* @param KekRozsak\SecurityBundle\Entity\User $attendee
* @return Event
*/
public function addAttendee(\KekRozsak\SecurityBundle\Entity\User $attendee)
{
$this->attendees[] = $attendee;
return $this;
}
/**
* Add attendee
*
* @param KekRozsak\SecurityBundle\Entity\User $attendee
* @return Event
*/
public function addAttendee(User $attendee)
{
$this->attendees[] = $attendee;
return $this;
}
/**
* Get all attendees
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getAttendees()
{
return $this->attendees;
}
/**
* Get all attendees
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getAttendees()
{
return $this->attendees;
}
/**
* Check if a user is attending
*
* @param KekRozsak\SecurityBundle\Entity\User $user
* @return boolean
*/
public function isAttending(\KekRozsak\SecurityBundle\Entity\User $user)
{
$users = $this->attendees->filter(function ($attendee) use ($user) {
if ($attendee == $user)
return true;
});
return ($users->count() != 0);
}
/**
* @var string $title
*
* @ORM\Column(type="string", length=150)
*
* @Assert\NotBlank()
*/
protected $title;
/**
* Set title
*
* @param string $title
* @return Event
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @var string $slug
*
* @ORM\Column(type="string", length=150)
*
* @Assert\NotBlank()
*/
protected $slug;
/**
* Set slug
*
* @param string $slug
* @return Event
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* @var string $description
*
* @ORM\Column(type="text")
*
* @Assert\NotBlank()
*/
protected $description;
/**
* Set description
*
* @param string $description
* @return Event
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* @var KekRozsak\FrontBundle\Entity\Group $group
*
* @ORM\ManyToOne(targetEntity="KekRozsak\FrontBundle\Entity\Group")
*/
protected $group;
/**
* Set group
*
* @param KekRozsak\FrontBundle\Entity\Group $group
* @return Event
*/
public function setGroup(\KekRozsak\FrontBundle\Entity\Group $group = null)
{
$this->group = $group;
return $this;
}
/**
* Get group
*
* @return KekRozsak\FrontBundle\Entity\Group
*/
public function getGroup()
{
return $this->group;
}
/**
* @var boolean $cancelled
*
* @ORM\Column(type="boolean", nullable=false)
*/
protected $cancelled;
/**
* Set cancelled
*
* @param boolean $cancelled
* @return Event
*/
public function setCancelled($cancelled = false)
{
$this->cancelled = $cancelled;
return $this;
}
/**
* Get cancelled
*
* @return boolean
*/
public function getCancelled()
{
return $this->cancelled;
}
/**
* @var DateTime $startTime
*
* @ORM\Column(type="time", nullable=false, name="start_time")
*/
protected $startTime;
/**
* Set startTime
*
* @param DateTime $startTime
* @return Event
*/
public function setStartTime(\DateTime $startTime)
{
$this->startTime = $startTime;
return $this;
}
/**
* Get startTime
*
* @return DateTime
*/
public function getStartTime()
{
return $this->startTime;
}
/**
* @var DateTime $endTime
*
* @ORM\Column(type="time", nullable=true, name="end_time")
*/
protected $endTime;
/**
* Set endTime
*
* @param DateTime $endTime
* @return Event
*/
public function setEndTime(\DateTime $endTime)
{
$this->endTime = $endTime;
return $this;
}
/**
* Get endTime
*
* @return DateTime
*/
public function getEndTime()
{
return $this->endTime;
}
/**
* Check if an event will go on a specific date
*
* @param DateTime $date
* @return boolean
*/
public function isOnDate(\DateTime $date)
{
$date->setTime(0, 0, 0);
return (
(
($this->startDate == $date)
&& ($this->endDate === null)
)
|| (
($this->startDate <= $date)
&& ($this->endDate >= $date)
)
);
}
/**
* Check if the event happened before a given date
*
* @param DateTime $date
* @return boolean
*/
public function isPast(\DateTime $date = null)
/**
* Check if a user is attending
*
* @param KekRozsak\SecurityBundle\Entity\User $user
* @return boolean
*/
public function isAttending(User $user)
{
$users = $this->attendees->filter(function ($attendee) use ($user)
{
if ($date === null)
{
$date = new \DateTime('now');
if ($attendee == $user) {
return true;
}
});
return ($this->endDate < $date);
return ($users->count() != 0);
}
/**
* The title of the Event
*
* @var string $title
*
* @ORM\Column(type="string", length=150)
*
* @Assert\NotBlank()
*/
protected $title;
/**
* Set title
*
* @param string $title
* @return Event
*/
public function setTitle($title)
{
// TODO: Check if empty or null!
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Slugified title of the event
*
* @var string $slug
*
* @ORM\Column(type="string", length=150)
*
* @Assert\NotBlank()
*/
protected $slug;
/**
* Set slug
*
* @param string $slug
* @return Event
*/
public function setSlug($slug)
{
// TODO: Check if empty or null!
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* Description of the Event
*
* @var string $description
*
* @ORM\Column(type="text")
*
* @Assert\NotBlank()
*/
protected $description;
/**
* Set description
*
* @param string $description
* @return Event
*/
public function setDescription($description)
{
// TODO: Check if empty!
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* @var KekRozsak\FrontBundle\Entity\Group $group
*
* @ORM\ManyToOne(targetEntity="KekRozsak\FrontBundle\Entity\Group")
*/
protected $group;
/**
* Set group
*
* @param KekRozsak\FrontBundle\Entity\Group $group
* @return Event
*/
public function setGroup(Group $group = null)
{
$this->group = $group;
return $this;
}
/**
* Get group
*
* @return KekRozsak\FrontBundle\Entity\Group
*/
public function getGroup()
{
return $this->group;
}
/**
* TRUE if the Event is cancelled
*
* @var boolean $cancelled
*
* @ORM\Column(type="boolean", nullable=false)
*/
protected $cancelled;
/**
* Set cancelled
*
* @param boolean $cancelled
* @return Event
*/
public function setCancelled($cancelled = false)
{
// TODO: Check if parameter is boolean
$this->cancelled = $cancelled;
return $this;
}
/**
* Get cancelled
*
* @return boolean
*/
public function getCancelled()
{
return $this->cancelled;
}
/**
* The time when the Event starts
*
* @var DateTime $startTime
*
* @ORM\Column(type="time", nullable=false, name="start_time")
*/
protected $startTime;
/**
* Set startTime
*
* @param DateTime $startTime
* @return Event
*/
public function setStartTime(\DateTime $startTime)
{
$this->startTime = $startTime;
return $this;
}
/**
* Get startTime
*
* @return DateTime
*/
public function getStartTime()
{
return $this->startTime;
}
/**
* The time when the Event ends
*
* @var DateTime $endTime
*
* @ORM\Column(type="time", nullable=true, name="end_time")
*/
protected $endTime;
/**
* Set endTime
*
* @param DateTime $endTime
* @return Event
*/
public function setEndTime(\DateTime $endTime = null)
{
// TODO: Check if endTime is later than startDate + startTime
$this->endTime = $endTime;
return $this;
}
/**
* Get endTime
*
* @return DateTime
*/
public function getEndTime()
{
return $this->endTime;
}
/**
* Check if an event will go on a specific date
*
* @param DateTime $date
* @return boolean
*/
public function isOnDate(\DateTime $date)
{
$date->setTime(0, 0, 0);
return (
(
($this->startDate == $date)
&& ($this->endDate === null)
)
|| (
($this->startDate <= $date)
&& ($this->endDate >= $date)
)
);
}
/**
* Check if the event happened before a given date
*
* @param DateTime $date
* @return boolean
*/
public function isPast(\DateTime $date = null)
{
if ($date === null) {
$date = new \DateTime('now');
}
return ($this->endDate < $date);
}
}

View File

@@ -5,6 +5,7 @@ namespace KekRozsak\FrontBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use KekRozsak\FrontBundle\Entity\ForumTopic;
use KekRozsak\SecurityBundle\Entity\User;
/**
* @ORM\Entity
@@ -13,146 +14,172 @@ use KekRozsak\FrontBundle\Entity\ForumTopic;
*/
class ForumPost
{
/**
* @var integer $id
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* The ID of the ForumPost
*
* @var integer $id
*
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* @ORM\ManyToOne(targetEntity="\KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinColumn(name="created_by_id")
*/
protected $createdBy;
/**
* Set createdBy
*
* @param \KekRozsak\SecurityBundle\Entity\User $createdBy
* @return ForumPost
*/
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Get createdBy
*
* @return \KekRozsak\SecurityBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* @var DateTime $createdAt
* @ORM\Column(type="datetime", name="created_at")
*/
protected $createdAt;
/**
* Set createdAt
*
* @param DateTime $createdAt
* @return ForumPost
*/
public function setCreatedAt(\DateTime $createdAt)
{
$this->createdAt = $createdAt;
}
/**
* Get createdAt
*
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @var string $text
* @ORM\Column(type="text", nullable=false)
*/
protected $text;
/**
* Set text
*
* @param string $text
* @return ForumPost
*/
public function setText($text)
{
$this->text = $text;
return $this;
}
/**
* Get text
*
* @return string
*/
public function getText()
{
return $this->text;
}
/**
* @var ForumTopic $topic
* @ORM\ManyToOne(targetEntity="ForumTopic", inversedBy="posts")
*/
protected $topic;
/**
* Set topic
*
* @param ForumTopic $topic
* @return ForumPost
*/
public function setTopic(ForumTopic $topic)
{
$this->topic = $topic;
if (!$topic->getLastPost() || ($topic->getLastPost()->getCreatedAt() < $this->createdAt))
$topic->setLastPost($this);
return $this;
}
/**
* Get topic
*
* @return ForumTopic
*/
public function getTopic()
{
return $this->topic;
}
/**
* Set createdAt before persisting
*
* @ORM\PrePersist
*/
public function setCreationTime()
{
if ($this->createdAt === null)
$this->createdAt = new \DateTime('now');
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* The User who created this ForumPost
*
* @var KekRozsak\SecurityBundle\Entity\User $createBy
*
* @ORM\ManyToOne(targetEntity="\KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinColumn(name="created_by_id")
*/
protected $createdBy;
/**
* Set createdBy
*
* @param \KekRozsak\SecurityBundle\Entity\User $createdBy
* @return ForumPost
*/
public function setCreatedBy(User $createdBy)
{
// TODO: Check if null!
$this->createdBy = $createdBy;
return $this;
}
/**
* Get createdBy
*
* @return \KekRozsak\SecurityBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* The timestamp when the ForumPost was created
*
* @var DateTime $createdAt
*
* @ORM\Column(type="datetime", name="created_at")
*/
protected $createdAt;
/**
* Set createdAt
*
* @param DateTime $createdAt
* @return ForumPost
*/
public function setCreatedAt(\DateTime $createdAt)
{
// TODO: Check if null!
$this->createdAt = $createdAt;
}
/**
* Get createdAt
*
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* The content of the ForumPost
*
* @var string $text
*
* @ORM\Column(type="text", nullable=false)
*/
protected $text;
/**
* Set text
*
* @param string $text
* @return ForumPost
*/
public function setText($text)
{
// TODO: Check if empty or null!
$this->text = $text;
return $this;
}
/**
* Get text
*
* @return string
*/
public function getText()
{
return $this->text;
}
/**
* The ForumTopic in which this ForumPost is
*
* @var ForumTopic $topic
*
* @ORM\ManyToOne(targetEntity="ForumTopic", inversedBy="posts")
*/
protected $topic;
/**
* Set topic
*
* @param ForumTopic $topic
* @return ForumPost
*/
public function setTopic(ForumTopic $topic)
{
// Set this as the last post of $topic, if later than $topic's current
// last post
$this->topic = $topic;
if (
!$topic->getLastPost()
|| ($topic->getLastPost()->getCreatedAt() < $this->createdAt)
) {
$topic->setLastPost($this);
}
return $this;
}
/**
* Get topic
*
* @return ForumTopic
*/
public function getTopic()
{
return $this->topic;
}
/**
* Set createdAt before persisting
*
* @ORM\PrePersist
*/
public function setCreationTime()
{
if ($this->createdAt === null) {
$this->createdAt = new \DateTime('now');
}
}
}

View File

@@ -13,226 +13,254 @@ use KekRozsak\SecurityBundle\Entity\User;
*/
class ForumTopic
{
public function __construct()
{
$this->posts = new ArrayCollection();
}
public function __construct()
{
$this->posts = new ArrayCollection();
}
/**
* @var integer $id
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* The ID of the ForumTopic
*
* @var integer $id
*
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinColumn(name="created_by_id")
*/
protected $createdBy;
/**
* The User who created this ForumTopic
*
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
*
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinColumn(name="created_by_id")
*/
protected $createdBy;
/**
* Set createdBy
*
* @param KekRozsak\SecurityBundle\Entity\User
* @return ForumTopic
*/
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Set createdBy
*
* @param KekRozsak\SecurityBundle\Entity\User
* @return ForumTopic
*/
public function setCreatedBy(User $createdBy)
{
// TODO: Check if null!
$this->createdBy = $createdBy;
return $this;
}
/**
* Get createdBy
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* Get createdBy
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* The timestamp when the ForumTopic was created
*
* @var DateTime $createdAt
*
* @ORM\Column(type="datetime", nullable=false, name="created_at")
*/
protected $createdAt;
/**
* @var DateTime $createdAt
* @ORM\Column(type="datetime", nullable=false, name="created_at")
*/
protected $createdAt;
/**
* Set createdAt
*
* @param DateTime $createdAt
* @return ForumTopic
*/
public function setCreatedAt(\DateTime $createdAt)
{
// TODO: Check if not null!
$this->createdAt = $createdAt;
return $this;
}
/**
* Set createdAt
*
* @param DateTime $createdAt
* @return ForumTopic
*/
public function setCreatedAt(\DateTime $createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Get createdAt
*
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* The ForumTopicGroup to which this ForumTopic belongs
*
* @var ForumTopicGroup $topicGroup
*
* @ORM\ManyToOne(targetEntity="ForumTopicGroup", inversedBy="topics")
* @ORM\JoinColumn(name="topic_group_id")
*/
protected $topicGroup;
/**
* @var ForumTopicGroup $topicGroup
* @ORM\ManyToOne(targetEntity="ForumTopicGroup", inversedBy="topics")
* @ORM\JoinColumn(name="topic_group_id")
*/
protected $topicGroup;
/**
* Set topicGroup
*
* @param ForumTopicGroup $topicGroup
* @return ForumTopic
*/
public function setTopicGroup(ForumTopicGroup $topicGroup)
{
// TODO: Check if not null!
$this->topicGroup = $topicGroup;
return $this;
}
/**
* Set topicGroup
*
* @param ForumTopicGroup $topicGroup
* @return ForumTopic
*/
public function setTopicGroup(ForumTopicGroup $topicGroup)
{
$this->topicGroup = $topicGroup;
return $this;
}
/**
* Get topicGroup
*
* @return ForumTopicGroup
*/
public function getTopicGroup()
{
return $this->topicGroup;
}
/**
* Get topicGroup
*
* @return ForumTopicGroup
*/
public function getTopicGroup()
{
return $this->topicGroup;
}
/**
* The slugified title of the ForumTopic
*
* @var string $slug
*
* @ORM\Column(type="string", length=100, nullable=false)
*/
protected $slug;
/**
* @var string $slug
* @ORM\Column(type="string", length=100, nullable=false)
*/
protected $slug;
/**
* Set slug
*
* @param string $slug
* @return ForumTopic
*/
public function setSlug($slug)
{
// TODO: Check if empty or null!
$this->slug = $slug;
return $this;
}
/**
* Set slug
*
* @param string $slug
* @return ForumTopic
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* The title of the ForumTopic
*
* @var string $title
*
* @ORM\Column(type="string", length=100, nullable=false)
*/
protected $title;
/**
* @var string $title
* @ORM\Column(type="string", length=100, nullable=false)
*/
protected $title;
/**
* Set title
*
* @param string $title
* @return ForumTopic
*/
public function setTitle($title)
{
// TODO: Check if empty or null!
$this->title = $title;
return $this;
}
/**
* Set title
*
* @param string $title
* @return ForumTopic
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* The last Post of this ForumTopic, is any
*
* @var ForumPost $lastPost
*
* @ORM\OneToOne(targetEntity="ForumPost", cascade={"persist"})
* @ORM\JoinColumn(name="last_post_id")
*/
protected $lastPost;
/**
* @var ForumPost $lastPost
* @ORM\OneToOne(targetEntity="ForumPost", cascade={"persist"})
* @ORM\JoinColumn(name="last_post_id")
*/
protected $lastPost;
/**
* Set lastPost
*
* @param ForumPost $lastPost
* @return ForumTopic
*/
public function setLastPost($lastPost = null)
{
$this->lastPost = $lastPost;
}
/**
* Set lastPost
*
* @param ForumPost $lastPost
* @return ForumTopic
*/
public function setLastPost($lastPost = null)
{
$this->lastPost = $lastPost;
}
/**
* Get lastPost
*
* @return ForumPost
*/
public function getLastPost()
{
return $this->lastPost;
}
/**
* Get lastPost
*
* @return ForumPost
*/
public function getLastPost()
{
return $this->lastPost;
}
/**
* The list of all the ForumPosts in this topic
*
* @var ArrayCollection $topics;
*
* @ORM\OneToMany(targetEntity="ForumPost", mappedBy="topic", fetch="LAZY")
*/
protected $posts;
/**
* @var ArrayCollection $topics;
* @ORM\OneToMany(targetEntity="ForumPost", mappedBy="topic")
*/
protected $posts;
/**
* Add post
*
* @param ForumPost $post
* @return ForumTopic
*/
public function addPost(ForumPost $post)
{
// TODO: Check if null!
$this->posts[] = $post;
return $this;
}
/**
* Add post
*
* @param ForumPost $post
* @return ForumTopic
*/
public function addPost(ForumPost $post)
{
$this->posts[] = $post;
return $this;
}
/**
* Get posts
*
* @return ArrayCollection
*/
public function getPosts()
{
return $this->posts;
}
/**
* Get posts
*
* @return ArrayCollection
*/
public function getPosts()
{
return $this->posts;
}
}

View File

@@ -14,168 +14,189 @@ use KekRozsak\SecurityBundle\Entity\User;
*/
class ForumTopicGroup
{
public function __construct()
{
$this->topics = new ArrayCollection();
}
public function __construct()
{
$this->topics = new ArrayCollection();
}
/**
* @var integer $id
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* The ID of the ForumTopicGroup
*
* @var integer $id
*
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinColumn(name="created_by_id")
*/
protected $createdBy;
/**
* The User who created this ForumTopicGroup
*
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
*
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinColumn(name="created_by_id")
*/
protected $createdBy;
/**
* Set createdBy
*
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
* @return ForumTopicGroup
*/
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Set createdBy
*
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
* @return ForumTopicGroup
*/
public function setCreatedBy(User $createdBy)
{
// TODO: Check if null!
$this->createdBy = $createdBy;
return $this;
}
/**
* Get createdBy
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* Get createdBy
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* @var DateTime $createdAt
* @ORM\Column(type="datetime", nullable=false)
*/
protected $createdAt;
/**
* The timestamp when this ForumTopicGroup was created
*
* @var DateTime $createdAt
*
* @ORM\Column(type="datetime", nullable=false)
*/
protected $createdAt;
/**
* Set createdAt
*
* @param DateTime $createdAt
* @return ForumTopicGroup
*/
public function setCreatedAt(\DateTime $createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Set createdAt
*
* @param DateTime $createdAt
* @return ForumTopicGroup
*/
public function setCreatedAt(\DateTime $createdAt)
{
// TODO: Check if null!
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Get createdAt
*
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @var string $slug
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
*/
protected $slug;
/**
* The slugified title of this ForumTopicGroup
*
* @var string $slug
*
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
*/
protected $slug;
/**
* Set slug
*
* @param string $slug
* @return ForumTopicGroup
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Set slug
*
* @param string $slug
* @return ForumTopicGroup
*/
public function setSlug($slug)
{
// TODO: Check if empty or null!
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* @var string $title
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
*/
protected $title;
/**
* The title of this ForumTopicGroup
*
* @var string $title
*
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
*/
protected $title;
/**
* Set title
*
* @param string $title
* @return ForumTopicGroup
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Set title
*
* @param string $title
* @return ForumTopicGroup
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @var ArrayCollection $topics
* @ORM\OneToMany(targetEntity="ForumTopic", mappedBy="topicGroup")
*/
protected $topics;
/**
* The ArrayCollection of ForumTopics that belong to this ForumTopicGroup
*
* @var ArrayCollection $topics
*
* @ORM\OneToMany(targetEntity="ForumTopic", mappedBy="topicGroup")
*/
protected $topics;
/**
* Add topic
*
* @param ForumTopic $topic
* @return ForumTopicGroup
*/
public function addTopic(ForumTopic $topic)
{
$this->topics[] = $topic;
return $this;
}
/**
* Add topic
*
* @param ForumTopic $topic
* @return ForumTopicGroup
*/
public function addTopic(ForumTopic $topic)
{
// TODO: Check if null!
$this->topics[] = $topic;
return $this;
}
/**
* Get topics
*
* @return ArrayCollection
*/
public function getTopics()
{
return $this->topics;
}
/**
* Get topics
*
* @return ArrayCollection
*/
public function getTopics()
{
return $this->topics;
}
}

View File

@@ -19,325 +19,357 @@ use KekRozsak\FrontBundle\Entity\Document;
*/
class Group
{
public function __construct()
{
$this->members = new ArrayCollection();
$this->documents = new ArrayCollection();
}
public function __construct()
{
$this->members = new ArrayCollection();
$this->documents = new ArrayCollection();
}
/**
* @var integer $id
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* The ID of this Group
*
* @var integer $id
*
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* @var KekRozsak\SecurityBundle\Entity\User $leader
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
*/
protected $leader;
/**
* @var KekRozsak\SecurityBundle\Entity\User $leader
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
*/
protected $leader;
/**
* Set leader
*
* @param KekRozsak\SecurityBundle\Entity\User $leader
* @return Group
*/
public function setLeader(\KekRozsak\SecurityBundle\Entity\User $leader = null)
{
$this->leader = $leader;
return $this;
}
/**
* Set leader
*
* @param KekRozsak\SecurityBundle\Entity\User $leader
* @return Group
*/
public function setLeader(User $leader = null)
{
$this->leader = $leader;
return $this;
}
/**
* Get leader
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getLeader()
{
return $this->leader;
}
/**
* Get leader
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getLeader()
{
return $this->leader;
}
/**
* @var string $name
* @ORM\Column(type="string", length=50, nullable=false, unique=true)
* @Assert\NotBlank()
*/
protected $name;
/**
* The name of this Group
*
* @var string $name
*
* @ORM\Column(type="string", length=50, nullable=false, unique=true)
*
* @Assert\NotBlank()
*/
protected $name;
/**
* Set name
*
* @param string $name
* @return Group
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Set name
*
* @param string $name
* @return Group
*/
public function setName($name)
{
// TODO: Check if empty or null!
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @var string $slug
* @ORM\Column(type="string", length=50, nullable=false, unique=true)
*/
protected $slug;
/**
* The slugified name of this Group
*
* @var string $slug
*
* @ORM\Column(type="string", length=50, nullable=false, unique=true)
*/
protected $slug;
/**
* Set slug
*
* @param string $slug
* @return Group
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Set slug
*
* @param string $slug
* @return Group
*/
public function setSlug($slug)
{
// TODO: Check if empty or null!
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinColumn(name="created_by_id")
*/
protected $createdBy;
/**
* The User who created this Group
*
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
*
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinColumn(name="created_by_id")
*/
protected $createdBy;
/**
* Set createdBy
*
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
* @return Group
*/
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Set createdBy
*
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
* @return Group
*/
public function setCreatedBy(User $createdBy)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Get createdBy
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* Get createdBy
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* @var DateTime $createdAt
* @ORM\Column(type="datetime", name="created_at", nullable=false)
*/
protected $createdAt;
/**
* The timestamp when this Group was created
*
* @var DateTime $createdAt
*
* @ORM\Column(type="datetime", name="created_at", nullable=false)
*/
protected $createdAt;
/**
* Set createdAt
*
* @param DateTime $createdAt
* @return Group
*/
public function setCreatedAt(\DateTime $createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Set createdAt
*
* @param DateTime $createdAt
* @return Group
*/
public function setCreatedAt(\DateTime $createdAt)
{
// TODO: Check if null!
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Get createdAt
*
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @var Doctrine\Common\Collections\ArrayCollection $members
* @ORM\OneToMany(targetEntity="UserGroupMembership", mappedBy="group")
*/
protected $members;
/**
* An ArrayCollection of UserGroupMemberships representing the Group's
* members
*
* @var Doctrine\Common\Collections\ArrayCollection $members
*
* @ORM\OneToMany(targetEntity="UserGroupMembership", mappedBy="group")
*/
protected $members;
/**
* Add member
*
* @param KekRozsak\FrontBundle\Entity\UserGroupMembership $member
* @return Group
*/
public function addMember(\KekRozsak\FrontBundle\Entity\UserGroupMembership $member)
{
$this->members[] = $member;
return $this;
}
/**
* Add member
*
* @param KekRozsak\FrontBundle\Entity\UserGroupMembership $member
* @return Group
*/
public function addMember(UserGroupMembership $member)
{
// TODO: Check if null!
$this->members[] = $member;
return $this;
}
/**
* Get all members
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getMembers()
{
return $this->members;
}
/**
* Get all members
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getMembers()
{
return $this->members;
}
/**
* Check if user is a member of this Group
*
* @param KekRozsak\SecurityBundle\Entity\User $user
* @return boolean
*/
public function isMember(\KekRozsak\SecurityBundle\Entity\User $user)
{
return ($this->members->filter(
function ($groupMembership) use ($user) {
return (
($groupMembership->getUser() == $user)
&& (
$groupMembership->getGroup()->isOpen()
|| ($groupMembership->getMembershipAcceptedAt() !== null)
)
);
}
)->count() > 0);
}
/**
* Check if user is a member of this Group
*
* @param KekRozsak\SecurityBundle\Entity\User $user
* @return boolean
*/
public function isMember(User $user)
{
return ($this->members->filter(function ($groupMembership) use ($user)
{
return (
($groupMembership->getUser() == $user)
&& (
$groupMembership->getGroup()->isOpen()
|| ($groupMembership->getMembershipAcceptedAt() !== null)
)
);
})->count() > 0);
}
/**
* Check if user already requested a membership in this Group
*
* @param KekRozsak\SecurityBundle\Entity\User $user
* @return boolean
*/
public function isRequested(\KekRozsak\SecurityBundle\Entity\User $user)
{
return ($this->members->filter(
function ($groupMembership) use ($user) {
return (
($groupMembership->getUser() == $user)
&& ($groupMembership->getMembershipRequestedAt() !== null)
);
}
)->count() > 0);
}
/**
* Check if user already requested a membership in this Group
*
* @param KekRozsak\SecurityBundle\Entity\User $user
* @return boolean
*/
public function isRequested(User $user)
{
return ($this->members->filter(function ($groupMembership) use ($user)
{
return (
($groupMembership->getUser() == $user)
&& ($groupMembership->getMembershipRequestedAt() !== null)
);
})->count() > 0);
}
/**
* @var string description
* @ORM\Column(type="text", nullable=true)
*/
protected $description;
/**
* The description of the Group
*
* @var string description
*
* @ORM\Column(type="text", nullable=true)
*/
protected $description;
/**
* Set description
*
* @param string $description
* @return Group
*/
public function setDescription($description = null)
{
$this->description = $description;
return $this;
}
/**
* Set description
*
* @param string $description
* @return Group
*/
public function setDescription($description = null)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* @var boolean open
* @ORM\Column(type="boolean", nullable=false)
*/
protected $open;
/**
* TRUE if this Group is open, and anyone can join
*
* @var boolean open
*
* @ORM\Column(type="boolean", nullable=false)
*/
protected $open;
/**
* Set open
*
* @param boolean $open
* @ return Group
*/
public function setOpen($open = false)
{
$this->open = $open;
return $this;
}
/**
* Set open
*
* @param boolean $open
* @ return Group
*/
public function setOpen($open = false)
{
$this->open = $open;
return $this;
}
/**
* Get open
*
* @return boolean
*/
public function isOpen()
{
return $this->open;
}
/**
* Get open
*
* @return boolean
*/
public function isOpen()
{
return $this->open;
}
/**
* @var Doctrine\Common\Collections\ArrayCollection $documents
* @ORM\ManyToMany(targetEntity="Document", inversedBy="groups")
* @ORM\JoinTable(name="group_document", inverseJoinColumns={
* @ORM\JoinColumn(name="document_id", referencedColumnName="id"),
* }, joinColumns={
* @ORM\JoinColumn(name="group_id", referencedColumnName="id")
* })
*/
protected $documents;
/**
* An ArrayCollection of Documents that belong to this Group
*
* @var Doctrine\Common\Collections\ArrayCollection $documents
*
* @ORM\ManyToMany(targetEntity="Document", inversedBy="groups", fetch="LAZY")
* @ORM\JoinTable(name="group_document", inverseJoinColumns={
* @ORM\JoinColumn(name="document_id", referencedColumnName="id"),
* }, joinColumns={
* @ORM\JoinColumn(name="group_id", referencedColumnName="id")
* })
*/
protected $documents;
/**
* Add document
*
* @param KekRozsak\FrontBundle\Entity\Document $document
* @return Group
*/
public function addDocument(\KekRozsak\FrontBundle\Entity\Document $document)
{
$this->documents[] = $document;
return $this;
}
/**
* Add document
*
* @param KekRozsak\FrontBundle\Entity\Document $document
* @return Group
*/
public function addDocument(Document $document)
{
// TODO: Check if null!
$this->documents[] = $document;
return $this;
}
/**
* Get all documents
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getDocuments()
{
return $this->documents;
}
/**
* Get all documents
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getDocuments()
{
return $this->documents;
}
}

View File

@@ -4,169 +4,192 @@ namespace KekRozsak\FrontBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use KekRozsak\SecurityBundle\Entity\User;
/**
* @ORM\Entity
* @ORM\Table(name="news")
*/
class News
{
/**
* @var integer $id
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* The ID of this News
*
* @var integer $id
*
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* @var string $title
* @ORM\Column(type="string", length=100)
*/
protected $title;
/**
* The title of this News
*
* @var string $title
*
* @ORM\Column(type="string", length=100)
*/
protected $title;
/**
* Set title
*
* @param string $title
* @return News
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Set title
*
* @param string $title
* @return News
*/
public function setTitle($title)
{
// TODO: Check if empty or null!
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @var string $text
* @ORM\Column(type="text", nullable=false)
*/
protected $text;
/**
* The contents of this News
*
* @var string $text
*
* @ORM\Column(type="text", nullable=false)
*/
protected $text;
/**
* Set text
*
* @param string $text
* @return News
*/
public function setText($text)
{
$this->text = $text;
return $this;
}
/**
* Set text
*
* @param string $text
* @return News
*/
public function setText($text)
{
$this->text = $text;
return $this;
}
/**
* Get text
*
* @return string
*/
public function getText()
{
return $this->text;
}
/**
* Get text
*
* @return string
*/
public function getText()
{
return $this->text;
}
/**
* @var DateTime $createdAt
* @ORM\Column(type="datetime", name="created_at", nullable=false)
*/
protected $createdAt;
/**
* The timestamp when this News was created
*
* @var DateTime $createdAt
*
* @ORM\Column(type="datetime", name="created_at", nullable=false)
*/
protected $createdAt;
/**
* Set createdAt
*
* @param DateTime $createdAt
* @return News
*/
public function setCreatedAt(\DateTime $createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Set createdAt
*
* @param DateTime $createdAt
* @return News
*/
public function setCreatedAt(\DateTime $createdAt)
{
// TODO: Check if null!
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Get createdAt
*
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @var \KekRozsak\SecurityBundle\Entity\User $createdBy
* @ORM\ManyToOne(targetEntity="\KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinColumn(name="created_by_id")
*/
protected $createdBy;
/**
* The User who created this News item
*
* @var \KekRozsak\SecurityBundle\Entity\User $createdBy
*
* @ORM\ManyToOne(targetEntity="\KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinColumn(name="created_by_id")
*/
protected $createdBy;
/**
* Set createdBy
*
* @param \KekRozsak\SecurityBundle\Entity\User $createdBy
* @return News
*/
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Set createdBy
*
* @param \KekRozsak\SecurityBundle\Entity\User $createdBy
* @return News
*/
public function setCreatedBy(User $createdBy)
{
// TODO: Check if null!
$this->createdBy = $createdBy;
return $this;
}
/**
* Get createdBy
*
* @return \KekRozsak\SecurityBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* Get createdBy
*
* @return \KekRozsak\SecurityBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* @var boolean $public
*
* @ORM\Column(type="boolean", nullable=false)
*/
protected $public;
/**
* TRUE if this News item is public
*
* @var boolean $public
*
* @ORM\Column(type="boolean", nullable=false)
*/
protected $public;
/**
* Set public
*
* @param boolean $public
* @return News
*/
public function setPublic($public)
{
$this->public = $public;
return $this;
}
/**
* Set public
*
* @param boolean $public
* @return News
*/
public function setPublic($public)
{
// TODO: Check if parameter is boolean!
$this->public = $public;
return $this;
}
/**
* Get public
*
* @return boolean
*/
public function getPublic()
{
return $this->public;
}
/**
* Get public
*
* @return boolean
*/
public function isPublic()
{
return $this->public;
}
}

View File

@@ -13,380 +13,430 @@ use \KekRozsak\SecurityBundle\Entity\User;
*/
class UserData
{
public function __construct()
{
$this->emailPublic = false;
$this->realNamePublic = false;
$this->msnAddressPublic = false;
$this->googleTalkPublic = false;
$this->skypePublic = false;
$this->phoneNumberPublic = false;
}
public function __construct()
{
$this->emailPublic = false;
$this->realNamePublic = false;
$this->msnAddressPublic = false;
$this->googleTalkPublic = false;
$this->skypePublic = false;
$this->phoneNumberPublic = false;
}
/**
* @var KekRozsak\SecurityBundle\Entity\User $user
* @ORM\Id
* @ORM\GeneratedValue(strategy="NONE")
* @ORM\OneToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User", inversedBy="userData")
* @ORM\JoinColumn(name="user_id")
*/
protected $user;
/**
* The User object this UserData belongs to
*
* @var KekRozsak\SecurityBundle\Entity\User $user
*
* @ORM\Id
* @ORM\GeneratedValue(strategy="NONE")
* @ORM\OneToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User", inversedBy="userData")
* @ORM\JoinColumn(name="user_id")
*/
protected $user;
/**
* Set user
*
* @param KekRozsak\SecurityBundle\Entity\User $user
* @return UserData
*/
public function setUser(\KekRozsak\SecurityBundle\Entity\User $user)
{
$this->user = $user;
return $this;
}
/**
* Set user
*
* @param KekRozsak\SecurityBundle\Entity\User $user
* @return UserData
*/
public function setUser(\KekRozsak\SecurityBundle\Entity\User $user)
{
$this->user = $user;
return $this;
}
/**
* Get user
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getUser()
{
return $this->user;
}
/**
* Get user
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getUser()
{
return $this->user;
}
/**
* @var boolean $emailPublic
* @ORM\Column(type="boolean", name="email_public")
*/
protected $emailPublic;
/**
* TRUE if $user's e-mail address is public
*
* @var boolean $emailPublic
*
* @ORM\Column(type="boolean", name="email_public")
*/
protected $emailPublic;
/**
* Set emailPublic
*
* @param boolean $emailPublic
* @return UserData
*/
public function setEmailPublic($emailPublic)
{
$this->emailPublic = $emailPublic;
return $this;
}
/**
* Set emailPublic
*
* @param boolean $emailPublic
* @return UserData
*/
public function setEmailPublic($emailPublic)
{
// TODO: Check if parameter is boolean!
$this->emailPublic = $emailPublic;
return $this;
}
/**
* Get emailPublic
*
* @return boolean
*/
public function getEmailPublic()
{
return $this->emailPublic;
}
/**
* Get emailPublic
*
* @return boolean
*/
public function isEmailPublic()
{
return $this->emailPublic;
}
/**
* @var string $realName
* @ORM\Column(type="string", length=100, nullable=true, name="real_name")
*/
protected $realName;
/**
* The real name of $user
*
* @var string $realName
*
* @ORM\Column(type="string", length=100, nullable=true, name="real_name")
*/
protected $realName;
/**
* Set realName
*
* @param string $realName
* @return UserData
*/
public function setRealName($realName = null)
{
$this->realName = $realName;
return $this;
}
/**
* Set realName
*
* @param string $realName
* @return UserData
*/
public function setRealName($realName = null)
{
// TODO: Check if empty!
$this->realName = $realName;
return $this;
}
/**
* Get realName
*
* @return string
*/
public function getRealName()
{
return $this->realName;
}
/**
* Get realName
*
* @return string
*/
public function getRealName()
{
return $this->realName;
}
/**
* @var boolean $realNamePublic
* @ORM\Column(type="boolean", name="real_name_public")
*/
protected $realNamePublic;
/**
* TRUE is $user's real name is public
*
* @var boolean $realNamePublic
*
* @ORM\Column(type="boolean", name="real_name_public")
*/
protected $realNamePublic;
/**
* Set realNamePublic
*
* @param boolean $realNamePublic
* @return UserData
*/
public function setRealNamePublic($realNamePublic = false)
{
$this->realNamePublic = $realNamePublic;
return $this;
}
/**
* Set realNamePublic
*
* @param boolean $realNamePublic
* @return UserData
*/
public function setRealNamePublic($realNamePublic = false)
{
// TODO: Check if parameter is boolean!
$this->realNamePublic = $realNamePublic;
return $this;
}
/**
* Get realNamePublic
*
* @return boolean
*/
public function getRealNamePublic()
{
return $this->realNamePublic;
}
/**
* Get realNamePublic
*
* @return boolean
*/
public function isRealNamePublic()
{
return $this->realNamePublic;
}
/**
* @var string $selfDescription
* @ORM\Column(type="text", nullable=true, name="self_description")
*/
protected $selfDescription;
/**
* The self description of $user
*
* @var string $selfDescription
*
* @ORM\Column(type="text", nullable=true, name="self_description")
*/
protected $selfDescription;
/**
* Set selfDescription
*
* @param string $selfDescription
* @return UserData
*/
public function setSelfDescription($selfDescription = null)
{
$this->selfDescription = $selfDescription;
return $this;
}
/**
* Set selfDescription
*
* @param string $selfDescription
* @return UserData
*/
public function setSelfDescription($selfDescription = null)
{
$this->selfDescription = $selfDescription;
return $this;
}
/**
* Get selfDescription
*
* @return string
*/
public function getSelfDescription()
{
return $this->selfDescription;
}
/**
* Get selfDescription
*
* @return string
*/
public function getSelfDescription()
{
return $this->selfDescription;
}
/**
* @var string $msnAddress
* @ORM\Column(type="string", length=100, nullable=true, name="msn_address")
*/
protected $msnAddress;
/**
* The MSN address of $user
*
* @var string $msnAddress
*
* @ORM\Column(type="string", length=100, nullable=true, name="msn_address")
*/
protected $msnAddress;
/**
* Set msnAddress
*
* @param string $msnAddress
* @return UserData
*/
public function setMsnAddress($msnAddress = null)
{
$this->msnAddress = $msnAddress;
return $this;
}
/**
* Set msnAddress
*
* @param string $msnAddress
* @return UserData
*/
public function setMsnAddress($msnAddress = null)
{
// TODO: Check if empty!
$this->msnAddress = $msnAddress;
return $this;
}
/**
* Get msnAddress
*
* @return string
*/
public function getMsnAddress()
{
return $this->msnAddress;
}
/**
* Get msnAddress
*
* @return string
*/
public function getMsnAddress()
{
return $this->msnAddress;
}
/**
* @var boolean $msnAddressPublic
* @ORM\Column(type="boolean", name="msn_address_public")
*/
protected $msnAddressPublic;
/**
* TRUE if $user's MSN address is public
*
* @var boolean $msnAddressPublic
*
* @ORM\Column(type="boolean", name="msn_address_public")
*/
protected $msnAddressPublic;
/**
* Set msnAddressPublic
*
* @param boolean $msnAddressPublic
* @return UserData
*/
public function setMsnAddressPublic($msnAddressPublic)
{
$this->msnAddressPublic = $msnAddressPublic;
return $this;
}
/**
* Set msnAddressPublic
*
* @param boolean $msnAddressPublic
* @return UserData
*/
public function setMsnAddressPublic($msnAddressPublic)
{
// TODO: Check if parameter is boolean!
$this->msnAddressPublic = $msnAddressPublic;
return $this;
}
/**
* Get msnAddressPublic
*
* @return boolean
*/
public function getMsnAddressPublic()
{
return $this->msnAddressPublic;
}
/**
* Get msnAddressPublic
*
* @return boolean
*/
public function isMsnAddressPublic()
{
return $this->msnAddressPublic;
}
/**
* @var string $googleTalk
* @ORM\Column(type="string", length=100, nullable=true, name="google_talk")
*/
protected $googleTalk;
/**
* Google Talk address of $user
*
* @var string $googleTalk
*
* @ORM\Column(type="string", length=100, nullable=true, name="google_talk")
*/
protected $googleTalk;
/**
* Set googleTalk
*
* @param string $googleTalk
* @return UserData
*/
public function setGoogleTalk($googleTalk = null)
{
$this->googleTalk = $googleTalk;
return $this;
}
/**
* Set googleTalk
*
* @param string $googleTalk
* @return UserData
*/
public function setGoogleTalk($googleTalk = null)
{
// TODO: Check if empty!
$this->googleTalk = $googleTalk;
return $this;
}
/**
* Get googleTalk
*
* @return string
*/
public function getGoogleTalk()
{
return $this->googleTalk;
}
/**
* Get googleTalk
*
* @return string
*/
public function getGoogleTalk()
{
return $this->googleTalk;
}
/**
* @var boolean $googleTalkPublic
* @ORM\Column(type="boolean", name="google_talk_public")
*/
protected $googleTalkPublic;
/**
* TRUE if $user's Google Talk address is public
*
* @var boolean $googleTalkPublic
*
* @ORM\Column(type="boolean", name="google_talk_public")
*/
protected $googleTalkPublic;
/**
* Set googleTalkPublic
*
* @param boolean $googleTalkPublic
* @return UserData
*/
public function setGoogleTalkPublic($googleTalkPublic)
{
$this->googleTalkPublic = $googleTalkPublic;
return $this;
}
/**
* Set googleTalkPublic
*
* @param boolean $googleTalkPublic
* @return UserData
*/
public function setGoogleTalkPublic($googleTalkPublic)
{
// TODO: Check if parameter is boolean!
$this->googleTalkPublic = $googleTalkPublic;
return $this;
}
/**
* Get googleTalkPublic
*
* @return boolean
*/
public function getGoogleTalkPublic()
{
return $this->googleTalkPublic;
}
/**
* Get googleTalkPublic
*
* @return boolean
*/
public function isGoogleTalkPublic()
{
return $this->googleTalkPublic;
}
/**
* @var string $skype
* @ORM\Column(type="string", length=100, nullable=true, name="skype")
*/
protected $skype;
/**
* Skype name of $user
*
* @var string $skype
*
* @ORM\Column(type="string", length=100, nullable=true, name="skype")
*/
protected $skype;
/**
* Set skype
*
* @param string $skype
* @return UserData
*/
public function setSkype($skype = null)
{
$this->skype = $skype;
return $this;
}
/**
* Set skype
*
* @param string $skype
* @return UserData
*/
public function setSkype($skype = null)
{
// TODO: Check if empty!
$this->skype = $skype;
return $this;
}
/**
* Get skype
*
* @return string
*/
public function getSkype()
{
return $this->skype;
}
/**
* Get skype
*
* @return string
*/
public function getSkype()
{
return $this->skype;
}
/**
* @var boolean $skypePublic
* @ORM\Column(type="boolean", name="skype_public")
*/
protected $skypePublic;
/**
* TRUE if $user's Skype name is public
*
* @var boolean $skypePublic
*
* @ORM\Column(type="boolean", name="skype_public")
*/
protected $skypePublic;
/**
* Set skypePublic
*
* @param boolean $skypePublic
* @return UserData
*/
public function setSkypePublic($skypePublic)
{
$this->skypePublic = $skypePublic;
return $this;
}
/**
* Set skypePublic
*
* @param boolean $skypePublic
* @return UserData
*/
public function setSkypePublic($skypePublic)
{
// TODO: Check if parameter is boolean!
$this->skypePublic = $skypePublic;
return $this;
}
/**
* Get skypePublic
*
* @return boolean
*/
public function getSkypePublic()
{
return $this->skypePublic;
}
/**
* Get skypePublic
*
* @return boolean
*/
public function isSkypePublic()
{
return $this->skypePublic;
}
/**
* @var string $phoneNumber
* @ORM\Column(type="string", length=30, nullable=true, name="phone_number")
*/
protected $phoneNumber;
/**
* Phone number of $user
*
* @var string $phoneNumber
*
* @ORM\Column(type="string", length=30, nullable=true, name="phone_number")
*/
protected $phoneNumber;
/**
* Set phoneNumber
*
* @param string $phoneNumber
* @return UserData
*/
public function setPhoneNumber($phoneNumber = null)
{
$this->phoneNumber = $phoneNumber;
return $this;
}
/**
* Set phoneNumber
*
* @param string $phoneNumber
* @return UserData
*/
public function setPhoneNumber($phoneNumber = null)
{
// TODO: Check if empty!
$this->phoneNumber = $phoneNumber;
return $this;
}
/**
* Get phoneNumber
*
* @return string
*/
public function getPhoneNumber()
{
return $this->phoneNumber;
}
/**
* Get phoneNumber
*
* @return string
*/
public function getPhoneNumber()
{
return $this->phoneNumber;
}
/**
* @var boolean $phoneNumberPublic
* @ORM\Column(type="boolean", name="phone_number_public")
*/
protected $phoneNumberPublic;
/**
* TRUE if $user's phone number is public
*
* @var boolean $phoneNumberPublic
*
* @ORM\Column(type="boolean", name="phone_number_public")
*/
protected $phoneNumberPublic;
/**
* Set phoneNumberPublic
*
* @param boolean $phoneNumberPublic
* @return UserData
*/
public function setPhoneNumberPublic($phoneNumberPublic)
{
$this->phoneNumberPublic = $phoneNumberPublic;
return $this;
}
/**
* Set phoneNumberPublic
*
* @param boolean $phoneNumberPublic
* @return UserData
*/
public function setPhoneNumberPublic($phoneNumberPublic)
{
// TODO: Check if parameter is boolean!
$this->phoneNumberPublic = $phoneNumberPublic;
return $this;
}
/**
* Get phoneNumberPublic
*
* @return boolean
*/
public function getPhoneNumberPublic()
{
return $this->phoneNumberPublic;
}
/**
* Get phoneNumberPublic
*
* @return boolean
*/
public function isPhoneNumberPublic()
{
return $this->phoneNumberPublic;
}
}

View File

@@ -5,6 +5,7 @@ namespace KekRozsak\FrontBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use KekRozsak\SecurityBundle\Entity\User;
use KekRozsak\FrontBundle\Entity\Group;
/**
* KekRozsak\FrontBundle\Entity\UserGroupMembership
@@ -15,171 +16,191 @@ use KekRozsak\SecurityBundle\Entity\User;
*/
class UserGroupMembership
{
public function __construct(\KekRozsak\SecurityBundle\Entity\User $user, \KekRozsak\FrontBundle\Entity\Group $group)
{
$this->setUser($user);
$this->setGroup($group);
$this->setMembershipRequestedAt(new \DateTime('now'));
}
public function __construct(\KekRozsak\SecurityBundle\Entity\User $user, \KekRozsak\FrontBundle\Entity\Group $group)
{
$this->setUser($user);
$this->setGroup($group);
$this->setMembershipRequestedAt(new \DateTime('now'));
}
/**
* @var integer $id
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* The ID of the UserGroupMembership
*
* @var integer $id
*
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* @var KekRozsak\SecurityBundle\Entity\User $user
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User", inversedBy="groups")
* @ORM\JoinColumn(name="user_id")
*/
protected $user;
/**
* The User this membership is applied to
*
* @var KekRozsak\SecurityBundle\Entity\User $user
*
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User", inversedBy="groups")
* @ORM\JoinColumn(name="user_id")
*/
protected $user;
/**
* Set user
*
* @param KekRozsak\SecurityBundle\Entity\User $user
* @return UserGroupMembership
*/
public function setUser(\KekRozsak\SecurityBundle\Entity\User $user)
{
$this->user = $user;
return $this;
}
/**
* Set user
*
* @param KekRozsak\SecurityBundle\Entity\User $user
* @return UserGroupMembership
*/
public function setUser(User $user)
{
// TODO: Check if not null!
$this->user = $user;
return $this;
}
/**
* Get user
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getUser()
{
return $this->user;
}
/**
* Get user
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getUser()
{
return $this->user;
}
/**
* @var KekRozsak\FrontBundle\Entity\Group
* @ORM\ManyToOne(targetEntity="Group", inversedBy="members")
* @ORM\JoinColumn(name="group_id")
*/
protected $group;
/**
* The Group this membership is applied to
*
* @var KekRozsak\FrontBundle\Entity\Group
*
* @ORM\ManyToOne(targetEntity="Group", inversedBy="members")
* @ORM\JoinColumn(name="group_id")
*/
protected $group;
/**
* Set group
*
* @param KekRozsak\FrontBundle\Entity\Group
* @return UserGroupMembership
*/
public function setGroup(\KekRozsak\FrontBundle\Entity\Group $group)
{
$this->group = $group;
return $this;
}
/**
* Set group
*
* @param KekRozsak\FrontBundle\Entity\Group
* @return UserGroupMembership
*/
public function setGroup(Group $group)
{
$this->group = $group;
return $this;
}
/**
* Get group
*
* @return KekRozsak\FrontBundle\Entity\Group
*/
public function getGroup()
{
return $this->group;
}
/**
* Get group
*
* @return KekRozsak\FrontBundle\Entity\Group
*/
public function getGroup()
{
return $this->group;
}
/**
* @var DateTime $membershipRequestedAt
* @ORM\Column(type="datetime", name="membership_requested_at")
*/
protected $membershipRequestedAt;
/**
* The timestamp when $user requested membership in $group
*
* @var DateTime $membershipRequestedAt
*
* @ORM\Column(type="datetime", name="membership_requested_at")
*/
protected $membershipRequestedAt;
/**
* Set membershipRequestedAt
*
* @param DateTime $membershipRequestedAt
* @return UserGroupMembership
*/
public function setMembershipRequestedAt(\DateTime $membershipRequestedAt)
{
$this->membershipRequestedAt = $membershipRequestedAt;
return $this;
}
/**
* Set membershipRequestedAt
*
* @param DateTime $membershipRequestedAt
* @return UserGroupMembership
*/
public function setMembershipRequestedAt(\DateTime $membershipRequestedAt)
{
// TODO: Check if null!
$this->membershipRequestedAt = $membershipRequestedAt;
return $this;
}
/**
* Get membershipRequestedAt
*
* @return DateTime
*/
public function getMembershipRequestedAt()
{
return $this->membershipRequestedAt;
}
/**
* Get membershipRequestedAt
*
* @return DateTime
*/
public function getMembershipRequestedAt()
{
return $this->membershipRequestedAt;
}
/**
* @var DateTime membershipAcceptedAt
* @ORM\Column(type="datetime", nullable=true, name="membership_accepted_at")
*/
protected $membershipAcceptedAt;
/**
* The timestamp when $user's membership was accepted
*
* @var DateTime membershipAcceptedAt
*
* @ORM\Column(type="datetime", nullable=true, name="membership_accepted_at")
*/
protected $membershipAcceptedAt;
/**
* Set membershipAcceptedAt
*
* @param DateTime $membershipAcceptedAt
* @return UserGroupMembership
*/
public function setMembershipAcceptedAt(\DateTime $membershipAcceptedAt = null)
{
$this->membershipAcceptedAt = $membershipAcceptedAt;
return $this;
}
/**
* Set membershipAcceptedAt
*
* @param DateTime $membershipAcceptedAt
* @return UserGroupMembership
*/
public function setMembershipAcceptedAt(\DateTime $membershipAcceptedAt = null)
{
$this->membershipAcceptedAt = $membershipAcceptedAt;
return $this;
}
/**
* Get membershipAcceptedAt
*
* @return DateTime
*/
public function getMembershipAcceptedAt()
{
return $this->membershipAcceptedAt;
}
/**
* Get membershipAcceptedAt
*
* @return DateTime
*/
public function getMembershipAcceptedAt()
{
return $this->membershipAcceptedAt;
}
/**
* @var KekRozsak\SecurityBundle\Entity\User $membershipAcceptedBy
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinColumn(name="membership_accepted_by_id")
*/
protected $membershipAcceptedBy;
/**
* Set membershipAcceptedBy
*
* @param KekRozsak\SecurityBundle\Entity\User
* @return UserGroupMembership
*/
public function setMembershipAcceptedBy(\KekRozsak\SecurityBundle\Entity\User $membershipAcceptedBy = null)
{
$this->membershipAcceptedBy = $membershipAcceptedBy;
return $this;
}
/**
* The User who accepted $user's membership
*
* @var KekRozsak\SecurityBundle\Entity\User $membershipAcceptedBy
*
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinColumn(name="membership_accepted_by_id")
*/
protected $membershipAcceptedBy;
/**
* Get membershipAcceptedBy
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getMembershipAcceptedBy()
{
return $this->membershipAcceptedBy;
}
/**
* Set membershipAcceptedBy
*
* @param KekRozsak\SecurityBundle\Entity\User
* @return UserGroupMembership
*/
public function setMembershipAcceptedBy(\KekRozsak\SecurityBundle\Entity\User $membershipAcceptedBy = null)
{
$this->membershipAcceptedBy = $membershipAcceptedBy;
return $this;
}
/**
* Get membershipAcceptedBy
*
* @return KekRozsak\SecurityBundle\Entity\User
*/
public function getMembershipAcceptedBy()
{
return $this->membershipAcceptedBy;
}
}

View File

@@ -4,30 +4,40 @@ namespace KekRozsak\FrontBundle\Extensions;
class Slugifier
{
/**
* Slugify string
*
* @param string $text
* @return string
*/
public function slugify($text)
{
$text = trim(preg_replace('~[^\\pL\d]+~u', '-', $text));
/**
* Slugify string
*
* @param string $text
* @return string
*/
public function slugify($text)
{
$text = preg_replace(
'~[^-\w]+~',
'',
str_replace(
array('"', "'", ':'),
'',
strtolower(
iconv(
'utf-8',
'us-ascii//TRANSLIT',
trim(
preg_replace(
'~[^\\pL\d]+~u',
'-',
$text
)
)
)
)
)
);
if (function_exists('iconv'))
{
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
}
if (empty($text)) {
$text = 'n-a';
}
$text = strtolower($text);
$text = preg_replace('~[^-\w]+~', '', $text);
if (empty($text))
{
$text = 'n-a';
}
return $text;
}
return $text;
}
}

View File

@@ -8,26 +8,25 @@ use Symfony\Component\Form\FormBuilderInterface;
class HelpMessageTypeExtension extends AbstractTypeExtension
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->setAttribute('help', $options['help']);
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->setAttribute('help', $options['help']);
}
public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->set('help', $form->getAttribute('help'));
}
public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->set('help', $form->getAttribute('help'));
}
public function getDefaultOptions()
{
return array(
'help' => null,
);
}
public function getDefaultOptions()
{
return array(
'help' => null,
);
}
public function getExtendedType()
{
return 'field';
}
public function getExtendedType()
{
return 'field';
}
}

View File

@@ -7,21 +7,23 @@ use Symfony\Component\Form\FormBuilderInterface;
class DocumentType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('title', null, array(
'label' => 'A dokumentum címe',
));
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('title', null, array(
'label' => 'A dokumentum címe',
)
);
$builder->add('content', 'ckeditor', array(
'label' => ' ',
));
$builder->add('content', 'ckeditor', array(
'label' => ' ',
)
);
/* TODO: possibility to add to other groups! */
}
// TODO: possibility to add to other groups!
}
public function getName()
{
return 'document';
}
public function getName()
{
return 'document';
}
}

View File

@@ -7,36 +7,38 @@ use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class ForumPostType extends AbstractType
{
private $topicGroup;
private $topic;
private $topicGroup;
private $topic;
public function __construct($topicGroup = null, $topic = null)
{
$this->topicGroup = $topicGroup;
$this->topic = $topic;
}
public function __construct($topicGroup = null, $topic = null)
{
$this->topicGroup = $topicGroup;
$this->topic = $topic;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('text', null, array(
'label' => ' ',
));
$builder->add('topic', 'hidden', array(
'property_path' => false,
'data' => $this->topic,
));
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('text', null, array(
'label' => ' ',
)
);
public function getName()
{
return 'forum_post';
}
$builder->add('topic', 'hidden', array(
'property_path' => false,
'data' => $this->topic,
)
);
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'KekRozsak\FrontBundle\Entity\ForumPost',
));
}
public function getName()
{
return 'forum_post';
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'KekRozsak\FrontBundle\Entity\ForumPost',
));
}
}

View File

@@ -7,19 +7,21 @@ use Symfony\Component\Form\FormBuilderInterface;
class GroupType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('name', null, array(
'label' => 'A csoport neve',
));
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('name', null, array(
'label' => 'A csoport neve',
)
);
$builder->add('description', 'ckeditor', array(
'label' => 'A csoport leírása',
));
}
$builder->add('description', 'ckeditor', array(
'label' => 'A csoport leírása',
)
);
}
public function getName()
{
return 'group';
}
public function getName()
{
return 'group';
}
}

View File

@@ -7,74 +7,96 @@ use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class UserDataType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('emailPublic', null, array(
'label' => 'Publikus legyen az e-mail címed?',
'help' => 'Ha bejelölöd, a kör többi tagja láthatja az e-mail címedet.',
'required' => false,
));
$builder->add('realName', null, array(
'label' => 'Valódi neved',
'help' => 'A valódi, polgári neved. Nem kötelező mező, akkor érdemes megadni, ha szeretnéd, hogy a többi tag megtalálhasson különféle közösségi oldalakon.',
));
$builder->add('realNamePublic', null, array(
'label' => 'Publikus legyen a valódi neved?',
'help' => 'Ha bejelölöd, a kör többi tagja láthatja a valódi neved.',
'required' => false,
));
$builder->add('selfDescription', null, array(
'label' => 'Rövid leírás Magadról',
'help' => 'Írj ide egy rövid leírást saját magadról. Ez mindenképpen megjelenik majd a profilodon, így a többiek tudhatják, hogy mivel is foglalkozol.',
));
$builder->add('msnAddress', null, array(
'label' => 'MSN címed',
'help' => 'Egy MSN cím, amin elérhető vagy.'
));
$builder->add('msnAddressPublic', null, array(
'label' => 'Publikus legyen az MSN címed?',
'help' => 'Ha bejelölöd, a kör többi tagja láthatja az MSN címedet.',
'required' => false,
));
$builder->add('googleTalk', null, array(
'label' => 'Google Talk címed',
'help' => 'Itt egy olyan GMail-es e-mail címet adhatsz meg, amin elérhető vagy a GMail csevegőben.',
));
$builder->add('googleTalkPublic', null, array(
'label' => 'Publikus legyen a Google Talk címed?',
'help' => 'Ha bejelölöd, a kör többi tagja láthatja a Google Talk címedet.',
'required' => false,
));
$builder->add('skype', null, array(
'label' => 'Skype neved',
'help' => 'Egy Skype név, amin elérhető vagy.',
));
$builder->add('skypePublic', null, array(
'label' => 'Publikus legyen a Skype neved?',
'help' => 'Ha bejelölöd, a kör többi tagja láthatja a Skype nevedet.',
'required' => false,
));
$builder->add('phoneNumber', null, array(
'label' => 'Telefonszámod',
'help' => 'Egy telefonszám, amin elérhető vagy. Programszervezéseknél jól jöhet.',
));
$builder->add('phoneNumberPublic', null, array(
'label' => 'Publikus legyen a telefonszámod?',
'help' => 'Ha bejelölöd, a kör többi tagja láthatja a telefonszámodat.',
'required' => false,
));
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('emailPublic', null, array(
'label' => 'Publikus legyen az e-mail címed?',
'help' => 'Ha bejelölöd, a kör többi tagja láthatja az e-mail címedet.',
'required' => false,
)
);
public function getName()
{
return 'user_data';
}
$builder->add('realName', null, array(
'label' => 'Valódi neved',
'help' => 'A valódi, polgári neved. Nem kötelező mező, akkor érdemes megadni, ha szeretnéd, hogy a többi tag megtalálhasson különféle közösségi oldalakon.',
)
);
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'KekRozsak\FrontBundle\Entity\UserData'
));
}
$builder->add('realNamePublic', null, array(
'label' => 'Publikus legyen a valódi neved?',
'help' => 'Ha bejelölöd, a kör többi tagja láthatja a valódi neved.',
'required' => false,
)
);
$builder->add('selfDescription', null, array(
'label' => 'Rövid leírás Magadról',
'help' => 'Írj ide egy rövid leírást saját magadról. Ez mindenképpen megjelenik majd a profilodon, így a többiek tudhatják, hogy mivel is foglalkozol.',
)
);
$builder->add('msnAddress', null, array(
'label' => 'MSN címed',
'help' => 'Egy MSN cím, amin elérhető vagy.'
)
);
$builder->add('msnAddressPublic', null, array(
'label' => 'Publikus legyen az MSN címed?',
'help' => 'Ha bejelölöd, a kör többi tagja láthatja az MSN címedet.',
'required' => false,
)
);
$builder->add('googleTalk', null, array(
'label' => 'Google Talk címed',
'help' => 'Itt egy olyan GMail-es e-mail címet adhatsz meg, amin elérhető vagy a GMail csevegőben.',
)
);
$builder->add('googleTalkPublic', null, array(
'label' => 'Publikus legyen a Google Talk címed?',
'help' => 'Ha bejelölöd, a kör többi tagja láthatja a Google Talk címedet.',
'required' => false,
)
);
$builder->add('skype', null, array(
'label' => 'Skype neved',
'help' => 'Egy Skype név, amin elérhető vagy.',
)
);
$builder->add('skypePublic', null, array(
'label' => 'Publikus legyen a Skype neved?',
'help' => 'Ha bejelölöd, a kör többi tagja láthatja a Skype nevedet.',
'required' => false,
)
);
$builder->add('phoneNumber', null, array(
'label' => 'Telefonszámod',
'help' => 'Egy telefonszám, amin elérhető vagy. Programszervezéseknél jól jöhet.',
)
);
$builder->add('phoneNumberPublic', null, array(
'label' => 'Publikus legyen a telefonszámod?',
'help' => 'Ha bejelölöd, a kör többi tagja láthatja a telefonszámodat.',
'required' => false,
)
);
}
public function getName()
{
return 'user_data';
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'KekRozsak\FrontBundle\Entity\UserData'
));
}
}

View File

@@ -1,18 +1,20 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="kek_rozsak_front.twig_extension.events" class="KekRozsak\FrontBundle\Twig\EventsExtension">
<argument type="service" id="doctrine" />
<argument type="service" id="security.context" />
<tag name="twig.extension" />
</service>
<service id="form.type_extension.help_message" class="KekRozsak\FrontBundle\Form\Extension\HelpMessageTypeExtension">
<tag name="form.type_extension" alias="field" />
</service>
<service id="bb.twig.extension" class="KekRozsak\FrontBundle\Twig\TwigBBExtension">
<argument type="service" id="service_container" />
<tag name="twig.extension" />
</service>
</services>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="kek_rozsak_front.twig_extension.events" class="KekRozsak\FrontBundle\Twig\EventsExtension">
<argument type="service" id="doctrine" />
<argument type="service" id="security.context" />
<tag name="twig.extension" />
</service>
<service id="form.type_extension.help_message" class="KekRozsak\FrontBundle\Form\Extension\HelpMessageTypeExtension">
<tag name="form.type_extension" alias="field" />
</service>
<service id="bb.twig.extension" class="KekRozsak\FrontBundle\Twig\TwigBBExtension">
<argument type="service" id="service_container" />
<tag name="twig.extension" />
</service>
</services>
</container>

View File

@@ -21,78 +21,78 @@
}
.forum-lista thead td a {
color: #3366ff;
text-decoration: none;
color: #3366ff;
text-decoration: none;
}
.forum-lista tbody td {
padding: 5px;
border-bottom: 1px solid #3366ff;
padding: 5px;
border-bottom: 1px solid #3366ff;
}
.forum-lista tbody tr.odd td {
background-color: #060c16;
background-color: #060c16;
}
.forum-lista tbody tr.even td {
background-color: #000000;
background-color: #000000;
}
.forum-lista tbody td a {
color: #3366ff;
text-decoration: underline;
color: #3366ff;
text-decoration: underline;
}
.post-lista {
border: 1px solid #3366ff;
border-collapse: collapse;
border: 1px solid #3366ff;
border-collapse: collapse;
}
.post-lista td {
border-style: solid;
border-color: #3366ff;
border-width: 3px 1px;
vertical-align: top;
padding: 5px;
border-style: solid;
border-color: #3366ff;
border-width: 3px 1px;
vertical-align: top;
padding: 5px;
}
.post-lista td.felado {
width: 150px !important;
font-size: 80%;
width: 150px !important;
font-size: 80%;
}
.post-lista td.szoveg {
width: 510px;
width: 510px;
}
.post-lista td.szoveg div {
width: 510px;
overflow: auto;
width: 510px;
overflow: auto;
}
td.uj-post {
}
td.uj-post textarea {
width: 500px;
background-color: #000000;
color: #3366ff;
border-style: solid;
border-color: #3366ff;
border-width: 0 0 2px 0;
height: 15em;
width: 500px;
background-color: #000000;
color: #3366ff;
border-style: solid;
border-color: #3366ff;
border-width: 0 0 2px 0;
height: 15em;
}
td.uj-post p {
clear: both;
float: none;
margin: 0;
clear: both;
float: none;
margin: 0;
}
td.uj-post p .eszkoztar {
float: left;
float: left;
}
td.uj-post p .kuldes-gomb {
float: right;
float: right;
}

View File

@@ -1,11 +1,11 @@
ul#submenu {
margin: 0;
padding: 0;
margin: 0;
padding: 0;
}
ul#submenu li {
margin: 0;
padding: 3px;
display: inline;
margin: 0;
padding: 3px;
display: inline;
}

View File

@@ -7,94 +7,94 @@
*/
#popup-container {
display: none;
position: fixed;
height: 300px;
width: 200px;
background: #ffffff;
z-index: 80;
display: none;
position: fixed;
height: 300px;
width: 200px;
background: #ffffff;
z-index: 80;
}
#popup-close {
position: absolute;
width: 16px;
height: 16px;
top: -5px;
right: -5px;
background-image: url('../images/no.png');
position: absolute;
width: 16px;
height: 16px;
top: -5px;
right: -5px;
background-image: url('../images/no.png');
}
#popup-inside {
border: 1px solid black;
height: 292px;
width: 192px;
margin-left: auto;
margin-right: auto;
margin-top: 3px;
border: 1px solid black;
height: 292px;
width: 192px;
margin-left: auto;
margin-right: auto;
margin-top: 3px;
}
#popup-title {
font-weight: bold;
padding: 5px;
font-weight: bold;
padding: 5px;
}
#popup-content {
padding: 3px;
padding: 3px;
}
#popup-scrollable {
width: 192px;
clear: both;
margin: 20px 0 10px;
width: 192px;
clear: both;