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;
margin: 20px 0 10px;
}
#popup-scrollable .viewport {
width: 172px;
height: 246px;
overflow: hidden;
position: relative;
width: 172px;
height: 246px;
overflow: hidden;
position: relative;
}
#popup-scrollable .overview {
list-style: none;
position: absolute;
left: 0;
top: 0;
list-style: none;
position: absolute;
left: 0;
top: 0;
}
#popup-scrollable .thumb .end, #popup-scrollable .thumb {
background-color: #003D5D;
background-color: #003D5D;
}
#popup-scrollable .scrollbar {
position: relative;
float: right;
width: 15px;
position: relative;
float: right;
width: 15px;
}
#popup-scrollable .track {
background-color: #D8EEFD;
height: 100%;
width: 13px;
position: relative;
padding: 0 1px;
background-color: #D8EEFD;
height: 100%;
width: 13px;
position: relative;
padding: 0 1px;
}
#popup-scrollable .thumb {
height: 20px;
width: 13px;
cursor: pointer;
overflow: hidden;
position: absolute;
top: 0;
height: 20px;
width: 13px;
cursor: pointer;
overflow: hidden;
position: absolute;
top: 0;
}
#popup-scrollable .thumb .end {
overflow: hidden;
height: 5px;
width: 13px;
overflow: hidden;
height: 5px;
width: 13px;
}
#popup-scrollable .disable {
display: none;
display: none;
}

View File

@ -1,63 +1,63 @@
{# vim: ft=htmljinja
#}
<p>
<strong>Szerző:</strong> {{ book.author }}<br />
<strong>Cím:</strong> {{ book.title }}<br />
<strong>Kiadás éve:</strong> {{ book.year }}<br />
<strong>Szerző:</strong> {{ book.author }}<br />
<strong>Cím:</strong> {{ book.title }}<br />
<strong>Kiadás éve:</strong> {{ book.year }}<br />
</p>
<p>
Nekem van <strong>{{ book.usersCopies(app.user)|length }}</strong>, ebből kölcsön van adva <strong>X</strong>.<br />
A teljes közösségnek összesen <strong>{{ book.copies|length }}</strong> példánya van.<br />
Kölcsönkérhető <strong>{{ book.copiesBorrowable|length }}</strong> példány, ebből <strong>{{ book.copiesBorrowedByUser(app.user)|length }}</strong> nálam van.<br />
Nekem van <strong>{{ book.usersCopies(app.user)|length }}</strong>, ebből kölcsön van adva <strong>X</strong>.<br />
A teljes közösségnek összesen <strong>{{ book.copies|length }}</strong> példánya van.<br />
Kölcsönkérhető <strong>{{ book.copiesBorrowable|length }}</strong> példány, ebből <strong>{{ book.copiesBorrowedByUser(app.user)|length }}</strong> nálam van.<br />
</p>
<p>
{% if book.usersCopies(app.user)|length == 0 %}
<span class="gomb add-copy-button" id="add-copy-button-{{ book.id }}">[Nekem is van egy]</span>
<span class="gomb add-copy-button" id="add-copy-button-{{ book.id }}">[Nekem is van egy]</span>
{% else %}
<span class="gomb delete-copy-button" id="delete-copy-button-{{ book.id }}">[Nincs már]</span>
<span class="gomb delete-copy-button" id="delete-copy-button-{{ book.id }}">[Nincs már]</span>
{# TODO
<span class="gomb">[Eladtam valakinek a körben]</span>
<span class="gomb">[Eladtam valakinek a körben]</span>
#}
{% if book.usersCopiesBorrowable(app.user)|length == 0 %}
<span class="gomb mine-is-borrowable-button" id="mine-is-borrowable-button-{{ book.id }}">[Az enyém is kölcsönkérhető]</span>
<span class="gomb mine-is-borrowable-button" id="mine-is-borrowable-button-{{ book.id }}">[Az enyém is kölcsönkérhető]</span>
{% else %}
<span class="gomb mine-is-not-borrowable-button" id="mine-is-not-borrowable-button-{{ book.id }}">[Nem szeretném kölcsönadni]</span>
<span class="gomb mine-is-not-borrowable-button" id="mine-is-not-borrowable-button-{{ book.id }}">[Nem szeretném kölcsönadni]</span>
{% endif %}
{% endif %}
{% if book.usersCopies(app.user)|length > 0 %}
{% if book.usersCopiesBuyable(app.user)|length == 0 %}
<span class="gomb mine-is-for-sale-button" id="mine-is-for-sale-button-{{ book.id }}">[Az enyém eladó]</span>
<span class="gomb mine-is-for-sale-button" id="mine-is-for-sale-button-{{ book.id }}">[Az enyém eladó]</span>
{% else %}
<span class="gomb mine-is-not-for-sale-button" id="mine-is-not-for-sale-button-{{ book.id }}">[Nem szeretném eladni]</span>
<span class="gomb mine-is-not-for-sale-button" id="mine-is-not-for-sale-button-{{ book.id }}">[Nem szeretném eladni]</span>
{% endif %}
{% endif %}
{% if book.copiesBorrowedByUser(app.user)|length == 0 and book.usersCopies(app.user)|length == 0 and not book.userWouldBorrow(app.user) %}
<span class="gomb want-to-borrow-button" id="want-to-borrow-button-{{ book.id }}">[Kérek egyet kölcsön]</span>
<span class="gomb want-to-borrow-button" id="want-to-borrow-button-{{ book.id }}">[Kérek egyet kölcsön]</span>
{% endif %}
{% if book.usersCopies(app.user)|length == 0 and not book.userWouldBuy(app.user) %}
<span class="gomb want-to-buy-button" id="want-to-buy-button-{{ book.id }}">[Vennék egyet]</span>
<span class="gomb want-to-buy-button" id="want-to-buy-button-{{ book.id }}">[Vennék egyet]</span>
{% endif %}
</p>
{% if book.wouldBuy|length > 0 %}
<p>
Ők szeretnének egyet kölcsönkérni:<br />
<ul>
Ők szeretnének egyet kölcsönkérni:<br />
<ul>
{% for user in book.wouldBorrow %}
<li>{{ user|userdataspan }}</li>
<li>{{ user|userdataspan }}</li>
{% endfor %}
</ul>
</ul>
</p>
{% endif %}
{% if book.wouldBuy|length > 0 %}
<p>
Ők szeretnének venni egyet:<br />
<ul>
Ők szeretnének venni egyet:<br />
<ul>
{% for user in book.wouldBuy %}
<li>{{ user|userdataspan }}</li>
<li>{{ user|userdataspan }}</li>
{% endfor %}
</ul>
</ul>
</p>
{% endif %}

View File

@ -7,127 +7,155 @@
[Saját könyveim] [Nálam lévő kölcsönzött könyvek]
{% if books|length > 0 %}
<table>
<thead>
<tr>
<td>Szerző</td>
<td>Cím</td>
<td>Év</td>
<td>Összes</td>
<td>Kölcsönözhető</td>
<td>Saját</td>
<td>Nálam (Vissza)</td>
</tr>
</thead>
<tbody>
<thead>
<tr>
<td>Szerző</td>
<td>Cím</td>
<td>Év</td>
<td>Összes</td>
<td>Kölcsönözhető</td>
<td>Saját</td>
<td>Nálam (Vissza)</td>
</tr>
</thead>
<tbody>
{% for book in books %}
<tr class="book-row popup-opener" id="book-{{ book.id }}">
<td class="popup-opener">{{ book.author }}</td>
<td>{{ book.title }}</td>
<td>{{ book.year }}</td>
<td>{{ book.copies|length }}</td>
<td>{{ book.copiesBorrowable|length }}</td>
<td>{{ book.usersCopies(app.user)|length }}</td>
<td>{{ book.copiesBorrowedByUser(app.user)|length }} ({{ book.copiesBorrowedReturnedByUser(app.user)|length }})</td>
</tr>
<tr class="book-row popup-opener" id="book-{{ book.id }}">
<td class="popup-opener">{{ book.author }}</td>
<td>{{ book.title }}</td>
<td>{{ book.year }}</td>
<td>{{ book.copies|length }}</td>
<td>{{ book.copiesBorrowable|length }}</td>
<td>{{ book.usersCopies(app.user)|length }}</td>
<td>{{ book.copiesBorrowedByUser(app.user)|length }} ({{ book.copiesBorrowedReturnedByUser(app.user)|length }})</td>
</tr>
{% endfor %}
</tbody>
</tbody>
</table>
{% endif %}
{% endblock %}
{% block bottomscripts %}
<script type="text/javascript">
$('.book-row').click(function() {
bookid = 0;
if (!$(this).attr('id').match(/^book-\d+$/))
return false;
bookid = $(this).attr('id').replace(/^book-/, '');
bookUrl = Routing.generate('KekRozsakFrontBundle_bookAjaxData', { id: bookid, _format: 'html' });
bookCallback = function() {
// TODO: Change alert() calls to HTML flashes
$('.delete-copy-button').click(function() {
bookid = 0;
if (!$(this).attr('id').match(/^delete-copy-button-\d+$/))
return false;
bookid = $(this).attr('id').replace(/^delete-copy-button-/, '');
url = Routing.generate('KekRozsakFrontBundle_bookDeleteCopy', { id: bookid });
$.ajax({
method: 'GET',
url: url
}).done(function() {
doPopup('', 'Betöltés...', bookUrl, 400, 300, bookCallback);
}).error(function() {
alert('Nem sikerült törölni');
});
});
bookid = 0;
if (!$(this).attr('id').match(/^book-\d+$/)) {
return false;
}
bookid = $(this).attr('id').replace(/^book-/, '');
bookUrl = Routing.generate('KekRozsakFrontBundle_bookAjaxData', { id: bookid, _format: 'html' });
bookCallback = function()
{
// TODO: Change alert() calls to HTML flashes
$('.delete-copy-button').click(function()
{
bookid = 0;
if (!$(this).attr('id').match(/^delete-copy-button-\d+$/)) {
return false;
}
$('.add-copy-button').click(function() {
bookid = 0;
if (!$(this).attr('id').match(/^add-copy-button-\d+$/))
return false;
bookid = $(this).attr('id').replace(/^add-copy-button-/, '');
url = Routing.generate('KekRozsakFrontBundle_bookAddCopy', { id: bookid });
$.ajax({
method: 'GET',
url: url
}).done(function() {
doPopup('', 'Betöltés...', bookUrl, 400, 300, bookCallback);
}).error(function() {
alert('Nem sikerült bejegyezni ezt a példányt');
});
});
bookid = $(this).attr('id').replace(/^delete-copy-button-/, '');
url = Routing.generate('KekRozsakFrontBundle_bookDeleteCopy', { id: bookid });
$.ajax({
method: 'GET',
url: url
}).done(function()
{
doPopup('', 'Betöltés...', bookUrl, 400, 300, bookCallback);
}).error(function()
{
// TODO: Make this a flash!
alert('Nem sikerült törölni');
});
});
$('.mine-is-borrowable-button, .mine-is-not-borrowable-button').click(function() {
bookid = 0;
if (!$(this).attr('id').match(/^mine-is-(not-)?borrowable-button-\d+$/))
return false;
isBorrowable = ($(this).attr('id').match(/^mine-is-not-borrowable-button-\d+$/)) ? 0 : 1;
bookid = $(this).attr('id').replace(/^mine-is-(not-)?borrowable-button-/, '');
url = Routing.generate('KekRozsakFrontBundle_bookSetCopyBorrowable', { id: bookid, newValue: isBorrowable });
$.ajax({
method: 'GET',
url: url
}).done(function() {
doPopup('', 'Betöltés...', bookUrl, 400, 300, bookCallback);
}).error(function() {
alert('Nem sikerült bejegyezni ezt a példányt');
});
});
$('.add-copy-button').click(function()
{
bookid = 0;
if (!$(this).attr('id').match(/^add-copy-button-\d+$/)) {
return false;
}
bookid = $(this).attr('id').replace(/^add-copy-button-/, '');
url = Routing.generate('KekRozsakFrontBundle_bookAddCopy', { id: bookid });
$.ajax({
method: 'GET',
url: url
}).done(function()
{
doPopup('', 'Betöltés...', bookUrl, 400, 300, bookCallback);
}).error(function()
{
// TODO: Make this a flash!
alert('Nem sikerült bejegyezni ezt a példányt');
});
});
$('.mine-is-for-sale-button, .mine-is-not-for-sale-button').click(function() {
bookid = 0;
if (!$(this).attr('id').match(/^mine-is-(not-)?for-sale-button-\d+$/))
return false;
isForSale = ($(this).attr('id').match(/^mine-is-not-for-sale-button-\d+$/)) ? 0 : 1;
bookid = $(this).attr('id').replace(/^mine-is-(not-)?for-sale-button-/, '');
url = Routing.generate('KekRozsakFrontBundle_bookSetCopyForSale', { id: bookid, newValue: isForSale });
$.ajax({
method: 'GET',
url: url
}).done(function() {
doPopup('', 'Betöltés...', bookUrl, 400, 300, bookCallback);
}).error(function() {
alert('Nem sikerült bejegyezni ezt a példányt');
});
});
$('.mine-is-borrowable-button, .mine-is-not-borrowable-button').click(function()
{
bookid = 0;
if (!$(this).attr('id').match(/^mine-is-(not-)?borrowable-button-\d+$/)) {
return false;
}
isBorrowable = ($(this).attr('id').match(/^mine-is-not-borrowable-button-\d+$/)) ? 0 : 1;
bookid = $(this).attr('id').replace(/^mine-is-(not-)?borrowable-button-/, '');
url = Routing.generate('KekRozsakFrontBundle_bookSetCopyBorrowable', { id: bookid, newValue: isBorrowable });
$.ajax({
method: 'GET',
url: url
}).done(function()
{
doPopup('', 'Betöltés...', bookUrl, 400, 300, bookCallback);
}).error(function()
{
// TODO: Make this a flash!
alert('Nem sikerült bejegyezni ezt a példányt');
});
});
$('.want-to-buy-button, .want-to-borrow-button').click(function() {
bookid = 0;
if (!$(this).attr('id').match(/^want-to-(buy|borrow)-button-\d+$/))
return false;
toBuy = ($(this).attr('id').match(/^want-to-buy-button-\d+$/)) ? 1 : 0;
bookid = $(this).attr('id').replace(/^want-to-(buy|borrow)-button-/, '');
url = Routing.generate('KekRozsakFrontBundle_bookWantOne', { id: bookid, wantToBuy: toBuy });
$.ajax({
method: 'GET',
url: url
}).done(function() {
doPopup('', 'Betöltés...', bookUrl, 400, 300, bookCallback);
}).error(function() {
alert('Nem sikerült bejegyezni a kérést');
});
});
};
doPopup('', 'Betöltés...', bookUrl, 400, 300, bookCallback);
$('.mine-is-for-sale-button, .mine-is-not-for-sale-button').click(function()
{
bookid = 0;
if (!$(this).attr('id').match(/^mine-is-(not-)?for-sale-button-\d+$/)) {
return false;
}
isForSale = ($(this).attr('id').match(/^mine-is-not-for-sale-button-\d+$/)) ? 0 : 1;
bookid = $(this).attr('id').replace(/^mine-is-(not-)?for-sale-button-/, '');
url = Routing.generate('KekRozsakFrontBundle_bookSetCopyForSale', { id: bookid, newValue: isForSale });
$.ajax({
method: 'GET',
url: url
}).done(function()
{
doPopup('', 'Betöltés...', bookUrl, 400, 300, bookCallback);
}).error(function()
{
// TODO: Make this a flash!
alert('Nem sikerült bejegyezni ezt a példányt');
});
});
$('.want-to-buy-button, .want-to-borrow-button').click(function()
{
bookid = 0;
if (!$(this).attr('id').match(/^want-to-(buy|borrow)-button-\d+$/)) {
return false;
}
toBuy = ($(this).attr('id').match(/^want-to-buy-button-\d+$/)) ? 1 : 0;
bookid = $(this).attr('id').replace(/^want-to-(buy|borrow)-button-/, '');
url = Routing.generate('KekRozsakFrontBundle_bookWantOne', { id: bookid, wantToBuy: toBuy });
$.ajax({
method: 'GET',
url: url
}).done(function()
{
doPopup('', 'Betöltés...', bookUrl, 400, 300, bookCallback);
}).error(function()
{
alert('Nem sikerült bejegyezni a kérést');
});
});
};
doPopup('', 'Betöltés...', bookUrl, 400, 300, bookCallback);
});
</script>
{% endblock bottomscripts %}

View File

@ -1,31 +1,31 @@
{# vim: ft=htmljinja
#}
<div id="events-button">
<span id="event-shower" class="gomb">[események gomb]</span>
<div id="event-box">
<div id="event-inside">
<p class="month">{{ firstDay|date('Y-m') }}</p>
<table>
<thead>
<tr>
<td></td>
<td>H</td>
<td>K</td>
<td>Sze</td>
<td>Cs</td>
<td>P</td>
<td>Szo</td>
<td>V</td>
</tr>
</thead>
<tbody>
<tr>
<td class="woy">{{ firstDay|date('W') }}</td>
<div id="events-button">
<span id="event-shower" class="gomb">[események gomb]</span>
<div id="event-box">
<div id="event-inside">
<p class="month">{{ firstDay|date('Y-m') }}</p>
<table>
<thead>
<tr>
<td></td>
<td>H</td>
<td>K</td>
<td>Sze</td>
<td>Cs</td>
<td>P</td>
<td>Szo</td>
<td>V</td>
</tr>
</thead>
<tbody>
<tr>
<td class="woy">{{ firstDay|date('W') }}</td>
{% set curDow = 0 %}
{% if firstDayWeekday != 1 %}
{% for i in 1..(firstDayWeekday - 1) %}
{% set curDow = curDow + 1 %}{% if curDow == 8 %}{% set curDow = 1 %}{% endif %}
<td></td>
<td></td>
{% endfor %}
{% endif %}
{% set cur = firstDayWeekday - 1 %}
@ -33,30 +33,26 @@
{% set cur = cur + 1 %}
{% set curDow = curDow + 1 %}{% if curDow == 8 %}{% set curDow = 1 %}{% endif %}
{% set eventCount = 0 %}
{# TODO Check if an event occurs on this date:
(event.startDate = this day AND event.endDate is NULL)
OR (event.startDate <= this day AND evend.endDate >= this day)
#}
<td id="event-calendar-{{ i }}"{% if eventList[i].events|length > 0 %} class="program" rel="{{ path('KekRozsakFrontBundle_eventAjaxList', {date: eventList[i].date|date('Y-m-d'), _format: 'html'}) }}"{% endif %}>
<a href="{{ path('KekRozsakFrontBundle_eventList', { date: eventList[i].date|date('Y-m-d')}) }}">{{ eventList[i].date|date('d') }}</a>
</td>
<td id="event-calendar-{{ i }}"{% if eventList[i].events|length > 0 %} class="program" rel="{{ path('KekRozsakFrontBundle_eventAjaxList', {date: eventList[i].date|date('Y-m-d'), _format: 'html'}) }}"{% endif %}>
<a href="{{ path('KekRozsakFrontBundle_eventList', { date: eventList[i].date|date('Y-m-d')}) }}">{{ eventList[i].date|date('d') }}</a>
</td>
{% if cur is divisibleby(7) %}
</tr>
</tr>
{% if cur != numDays %}
<tr>
<td class="woy">{{ eventList[i + 1].date|date('W') }}</td>
<tr>
<td class="woy">{{ eventList[i + 1].date|date('W') }}</td>
{% endif %}
{% endif %}
{% endfor %}
{% if curDow != 7 %}
{% for i in (curDow + 1)..7 %}
<td></td>
<td></td>
{% endfor %}
{% endif %}
</tr>
</tbody>
</table>
<a href="{{ path('KekRozsakFrontBundle_eventList') }}">További események</a>
</div>
</div>
</div>
</tr>
</tbody>
</table>
<a href="{{ path('KekRozsakFrontBundle_eventList') }}">További események</a>
</div>
</div>
</div>

View File

@ -1,14 +1,14 @@
{# vim: ft=htmljinja
#}
<div id="login-gomb">
<span id="login-mutato" class="gomb">Bejelentkezés</span>
<div id="login-box">
<div id="login-belso">
<form method="post" action="{{ path('KekRozsakSecurityBundle_login_check') }}">
Felhasználónév: <input type="text" name="_username" /><br />
Jelszó: <input type="password" name="_password" /><br />
<button type="submit">Bejelentkezés</button>
</form>
</div>
</div>
</div>
<div id="login-gomb">
<span id="login-mutato" class="gomb">Bejelentkezés</span>
<div id="login-box">
<div id="login-belso">
<form method="post" action="{{ path('KekRozsakSecurityBundle_login_check') }}">
Felhasználónév: <input type="text" name="_username" /><br />
Jelszó: <input type="password" name="_password" /><br />
<button type="submit">Bejelentkezés</button>
</form>
</div>
</div>
</div>

View File

@ -1,28 +1,27 @@
{# vim: ft=htmljinja
#}
<div id="profil-gomb">
<span id="profil-mutato" class="gomb">[avatar] {{ app.user.displayName }}</span>
<div id="profil-box">
<div id="profil-belso">
[avatar]
{{ app.user.displayName }}<br />
<span id="jog-lista" title="|Jogosultságok|{% for role in app.user.roles %}{{ role.shortDescription }}<br />{% endfor %}">Jogosultság{% if app.user.roles|length > 1 %}ok{% endif %}</span><br />
<dl>
<dt>Csoportjaim</dt>
<div id="profil-gomb">
<span id="profil-mutato" class="gomb">[avatar] {{ app.user.displayName }}</span>
<div id="profil-box">
<div id="profil-belso">
<span class="avatar">[avatar]</span>
{{ app.user.displayName }}<br />
<span id="jog-lista" title="|Jogosultságok|{% for role in app.user.roles %}{{ role.shortDescription }}<br />{% endfor %}">Jogosultság{% if app.user.roles|length > 1 %}ok{% endif %}</span><br />
<dl>
<dt>Csoportjaim</dt>
{% for group in app.user.groups %}
{% if group.group.open or group.membershipAcceptedAt %}
<dl><a href="{{ path('KekRozsakFrontBundle_groupView', {slug: group.group.slug}) }}">{{ group.group.name }}</a></dl>
<dd><a href="{{ path('KekRozsakFrontBundle_groupView', {slug: group.group.slug}) }}">{{ group.group.name }}</a></dd>
{% endif %}
{% endfor %}
<dl><a href="{{ path('KekRozsakFrontBundle_groupList') }}">További csoportok</a></dl>
<dd><a href="{{ path('KekRozsakFrontBundle_groupList') }}">További csoportok</a></dd>
<dt>Kedvenc Fórum-témáim</dt>
<dt>Kedvenc Fórum-témáim</dt>
<dd><a href="{{ path('KekRozsakFrontBundle_forumTopicGroupList') }}">Fórum</a></dd>
<dl><a href="{{ path('KekRozsakFrontBundle_forumTopicGroupList') }}">Fórum</a></dl>
<dt>Üzenetek</dt>
</dl>
</div>
<div id="profil-szerkesztes"><a href="{{ path('KekRozsakFrontBundle_profile_edit') }}">Profil szerkesztése</a></div>
</div>
</div>
<dt>Üzenetek</dt>
</dl>
</div>
<div id="profil-szerkesztes"><a href="{{ path('KekRozsakFrontBundle_profile_edit') }}">Profil szerkesztése</a></div>
</div>
</div>

View File

@ -8,9 +8,9 @@
<p>Az itt megadott adataidat szigorúan kezeljük, azt más számára kizárólag hatósági felszólításra adjuk ki.</p>
<p>A publikusnak megjelölt adataidat csak a kör tagjai láthatják, míg a nem publikusnak megjelölteket kizárólag az oldal adminisztrátorai.</p>
<form method="post" action="{{ path('KekRozsakFrontBundle_profile_edit') }}">
<table>
<table>
{{ form_widget(form) }}
</table>
<button type="submit">Mentés</button>
</table>
<button type="submit">Mentés</button>
</form>
{% endblock content %}

View File

@ -5,7 +5,7 @@
{% block content %}
<h3>Új dokumentum létrehozása</h3>
<form method="post" action="{{ path('KekRozsakFrontBundle_documentCreate') }}">
{{ form_widget(form) }}
<button type="submit">Mentés</button>
{{ form_widget(form) }}
<button type="submit">Mentés</button>
</form>
{% endblock content %}

View File

@ -5,7 +5,7 @@
{% block content %}
<h3>Dokumentum szerkesztése - {{ document.title }}</h3>
<form method="post" action="{{ path('KekRozsakFrontBundle_documentEdit', {slug: document.slug}) }}">
{{ form_widget(form) }}
<button type="submit">Mentés</button>
{{ form_widget(form) }}
<button type="submit">Mentés</button>
</form>
{% endblock content %}

View File

@ -4,7 +4,7 @@
{% block title %} - Dokumentum - {{ document.title }}{% endblock %}
{% block content %}
<h3>
{{ document.title }}{% if document.createdBy == app.user %} [ <a href="{{ path('KekRozsakFrontBundle_documentEdit', {slug: document.slug}) }}">Szerkesztés</a> ] {% endif %}
{{ document.title }}{% if document.createdBy == app.user %} [ <a href="{{ path('KekRozsakFrontBundle_documentEdit', {slug: document.slug}) }}">Szerkesztés</a> ] {% endif %}
</h3>
{{ document.content|raw }}
<div class="szerzo">{{ document.createdBy|userdataspan }}</div>

View File

@ -1,16 +1,16 @@
{# vim: ft=htmljinja
#}
<html>
<head>
<title>Események</title>
</head>
<body>
<head>
<title>Események</title>
</head>
<body>
{% if events|length > 0 %}
<ul>
<ul>
{% for event in events %}
<li>{{ event.title }}</li>
<li>{{ event.title }}</li>
{% endfor %}
</ul>
</ul>
{% endif %}
</body>
</body>
</html>

View File

@ -7,7 +7,7 @@
{% if events %}
<ul>
{% for event in events %}
<li><a href="{{ path('KekRozsakFrontBundle_eventView', {startDate: event.startDate|date('Y-m-d'), eventSlug: event.slug}) }}">{{ event.title }}</a></li>
<li><a href="{{ path('KekRozsakFrontBundle_eventView', {startDate: event.startDate|date('Y-m-d'), eventSlug: event.slug}) }}">{{ event.title }}</a></li>
{% endfor %}
</ul>
{% else %}

View File

@ -7,12 +7,12 @@
<p class="esemeny-idopont">{{ event.startDate|date('Y-m-d') }} {{ event.startTime|date('H:i') }}{% if event.endDate or event.endTime %} - {% endif %}{% if event.endDate is not null %} {{ event.endDate|date('Y-m-d') }}{% endif %}{% if event.endTime is not null %} {{ event.endTime|date('H:i') }}{% endif %}</p>
<p class="esemeny-szervezo">Az eseményt szervezi: {{ event.createdBy|userdataspan }}</p>
<p>
{{ event.description }}
{{ event.description }}
</p>
<h4>Eddigi résztvevők</h4>
<ul>
{% for attendee in event.attendees %}
<li>{{ attendee|userdataspan }}</li>
<li>{{ attendee|userdataspan }}</li>
{% endfor %}
</ul>
{% if not event.isAttending(app.user) and not event.isPast %}

View File

@ -2,11 +2,11 @@
#}
{% block field_row %}
<tr>
<td>{{ form_label(form) }}</td>
<td>{{ form_widget(form) }}</td>
<td>
{{ help }}
</td>
<td>{{ form_errors(form) }}</td>
<td>{{ form_label(form) }}</td>
<td>{{ form_widget(form) }}</td>
<td>
{{ help }}
</td>
<td>{{ form_errors(form) }}</td>
</td>
{% endblock %}

View File

@ -5,42 +5,42 @@
{% block content %}
<h3><a href="{{ path('KekRozsakFrontBundle_forumTopicGroupList') }}">Fórum</a> - <a href="{{ path('KekRozsakFrontBundle_forumTopicList', {slug: topicGroup.slug}) }}">{{ topicGroup.title }}</a> - {{ topic.title }}</h3>
<table class="post-lista">
<tbody>
<tr>
<td class="uj-post">
<form method="post" action="{{ path('KekRozsakFrontBundle_forumPostList', { topicGroupSlug: topicGroup.slug, topicSlug: topic.slug } ) }}">
{{ form_widget(form) }}
<p>
<span class="eszkoztar">Súgó</span><span class="kuldes-gomb" /><button type="submit">Küldés</button>
</p>
</form>
</td>
<td class="felado">
<br />
<br />
[avatar]<br />
{{ app.user.displayName }}<br />
Saját szint<br />
<br />
Tagság kezdete:<br />
{{ app.user.registeredAt|date('Y-m-d') }}
</td>
</tr>
<tbody>
<tr>
<td class="uj-post">
<form method="post" action="{{ path('KekRozsakFrontBundle_forumPostList', { topicGroupSlug: topicGroup.slug, topicSlug: topic.slug } ) }}">
{{ form_widget(form) }}
<p>
<span class="eszkoztar">Súgó</span><span class="kuldes-gomb" /><button type="submit">Küldés</button>
</p>
</form>
</td>
<td class="felado">
<br />
<br />
[avatar]<br />
{{ app.user.displayName }}<br />
Saját szint<br />
<br />
Tagság kezdete:<br />
{{ app.user.registeredAt|date('Y-m-d') }}
</td>
</tr>
{% for post in posts %}
<tr>
<td class="szoveg"><div>{{ post.text|bbdecode }}</div></td>
<td class="felado">
{{ post.createdAt|date('Y-m-d') }}<br />
{{ post.createdAt|date('H:i') }}<br />
[avatar]<br />
{{ post.createdBy|userdataspan }}<br />
Szint<br />
<br />
Tagság kezdete:<br />
{{ post.createdBy.RegisteredAt|date('Y-m-d') }}
</td>
</tr>
<tr>
<td class="szoveg"><div>{{ post.text|bbdecode }}</div></td>
<td class="felado">
{{ post.createdAt|date('Y-m-d') }}<br />
{{ post.createdAt|date('H:i') }}<br />
[avatar]<br />
{{ post.createdBy|userdataspan }}<br />
Szint<br />
<br />
Tagság kezdete:<br />
{{ post.createdBy.RegisteredAt|date('Y-m-d') }}
</td>
</tr>
{% endfor %}
</tbody>
</tbody>
</table>
{% endblock %}

View File

@ -6,36 +6,36 @@
<h3>Fórum</h3>
{% for topicGroup in topicGroups %}
<table class="forum-lista">
<thead>
<tr>
<td colspan="2"><a href="{{ path('KekRozsakFrontBundle_forumTopicList', {slug: topicGroup.slug}) }}">{{ topicGroup.title }}</a></td>
<td>Hozzászólások száma</td>
<td>Utolsó hozzászólás</td>
</tr>
</thead>
<tbody>
<thead>
<tr>
<td colspan="2"><a href="{{ path('KekRozsakFrontBundle_forumTopicList', {slug: topicGroup.slug}) }}">{{ topicGroup.title }}</a></td>
<td>Hozzászólások száma</td>
<td>Utolsó hozzászólás</td>
</tr>
</thead>
<tbody>
{% if topicGroup.topics|length > 0 %}
{% for topic in topicGroup.topics %}
<tr class="{{ cycle(['odd', 'even'], loop.index0) }}">
<td>[ikon]</td>
<td><a href="{{ path('KekRozsakFrontBundle_forumPostList', {topicGroupSlug: topicGroup.slug, topicSlug: topic.slug}) }}">{{ topic.title }}</a></td>
<td></td>
<td>
<tr class="{{ cycle(['odd', 'even'], loop.index0) }}">
<td>[ikon]</td>
<td><a href="{{ path('KekRozsakFrontBundle_forumPostList', {topicGroupSlug: topicGroup.slug, topicSlug: topic.slug}) }}">{{ topic.title }}</a></td>
<td></td>
<td>
{% if topic.lastPost %}
{{ topic.lastPost.createdBy|userdataspan }}<br />
{{ topic.lastPost.createdAt|date('Y-m-d H:i') }}
{{ topic.lastPost.createdBy|userdataspan }}<br />
{{ topic.lastPost.createdAt|date('Y-m-d H:i') }}
{% else %}
&nbsp;<br />&nbsp;
&nbsp;<br />&nbsp;
{% endif %}
</td>
</tr>
</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td colspan="4">Ebben a kategóriában nincsenek témák</td>
</tr>
<tr>
<td colspan="4">Ebben a kategóriában nincsenek témák</td>
</tr>
{% endif %}
</tbody>
</tbody>
</table>
{% endfor %}
{% endblock content %}

View File

@ -6,29 +6,29 @@
<h3><a href="{{ path('KekRozsakFrontBundle_forumTopicGroupList') }}">Fórum</a> - {{ topicGroup.title }}</h3>
{% if topicGroup.topics|length > 0 %}
<table class="forum-lista">
<thead>
<tr>
<td></td>
<td>Hozzászólások száma</td>
<td>Utolsó hozzászólás</td>
</tr>
</thead>
<tbody>
<thead>
<tr>
<td></td>
<td>Hozzászólások száma</td>
<td>Utolsó hozzászólás</td>
</tr>
</thead>
<tbody>
{% for topic in topicGroup.topics %}
<tr class="{{ cycle(['odd', 'even'], loop.index0) }}">
<td><a href="{{ path('KekRozsakFrontBundle_forumPostList', { topicGroupSlug: topicGroup.slug, topicSlug: topic.slug }) }}">{{ topic.title }}</a></td>
<td></td>
<td>
<tr class="{{ cycle(['odd', 'even'], loop.index0) }}">
<td><a href="{{ path('KekRozsakFrontBundle_forumPostList', { topicGroupSlug: topicGroup.slug, topicSlug: topic.slug }) }}">{{ topic.title }}</a></td>
<td></td>
<td>
{% if topic.lastPost %}
{{ topic.lastPost.createdBy|userdataspan }}<br />
{{ topic.lastPost.createdAt|date('Y-m-d H:i') }}
{{ topic.lastPost.createdBy|userdataspan }}<br />
{{ topic.lastPost.createdAt|date('Y-m-d H:i') }}
{% else %}
&nbsp;<br />&nbsp;
&nbsp;<br />&nbsp;
{% endif %}
</td>
</tr>
</td>
</tr>
{% endfor %}
</tbody>
</tbody>
</table>
{% else %}
Ebben a témakörben nincsenek témák.

View File

@ -4,7 +4,8 @@
{% block title %} - Csoport létrehozása{% endblock %}
{% block content %}
<h3>Csoport létrehozása</h3>
<p>Warning</p>
{# TODO: Leírást készíteni ide, hogy mivel jár a csoportok létrehozása #}
<p></p>
<form method="post" action="{{ path('KekRozsakFrontBundle_groupCreate') }}">
{{ form_widget(form) }}
<button type="submit">Létrehozás</button>

View File

@ -2,34 +2,31 @@
#}
{% extends 'KekRozsakFrontBundle:Default:main_template.html.twig' %}
{% block title %} - {{ group.name }}{% endblock %}
{% block additional_css %}
<link rel="stylesheet" href="{{ asset('css/group.css') }}" type="text/css" />
{% endblock additional_css %}
{% block content %}
<ul id="submenu">
<li><a href="{{ path('KekRozsakFrontBundle_groupMembers', {slug: group.slug}) }}">Tagok</a></li>
<li><a href="{{ path('KekRozsakFrontBundle_groupView', {slug: group.slug}) }}">Leírás</a></li>
<li><a href="{{ path('KekRozsakFrontBundle_groupMembers', {slug: group.slug}) }}">Tagok</a></li>
<li><a href="{{ path('KekRozsakFrontBundle_groupView', {slug: group.slug}) }}">Leírás</a></li>
</ul>
<h3>{{ group.name }} - Dokumentumok</h3>
<table>
<thead>
<tr>
<td colspan="2">Cím</td>
<td>Készítette</td>
</tr>
</thead>
<tbody>
<thead>
<tr>
<td colspan="2">Cím</td>
<td>Készítette</td>
</tr>
</thead>
<tbody>
{% for document in group.documents %}
<tr>
<td>[ikon]</td>
<td><a href="{{ path('KekRozsakFrontBundle_documentView', {slug: document.slug}) }}">{{ document.title }}</a></td>
<td>
{{ document.createdBy|userdataspan }}<br />
{{ document.createdAt|date('Y-m-d H:i') }}
</td>
</tr>
<tr>
<td>[ikon]</td>
<td><a href="{{ path('KekRozsakFrontBundle_documentView', {slug: document.slug}) }}">{{ document.title }}</a></td>
<td>
{{ document.createdBy|userdataspan }}<br />
{{ document.createdAt|date('Y-m-d H:i') }}
</td>
</tr>
{% endfor %}
</tbody>
</tbody>
</table>
<a href="{{ path('KekRozsakFrontBundle_documentCreate', {slug: group.slug}) }}">Új dokumentum</a>
{% endblock %}

View File

@ -9,53 +9,47 @@
<p>Szintén fontos, hogy egy új csoport létrehozása nem tesz azonnal annak vezetőjévé, azt a csoport tagjainak meg kell szavazniuk, vagy a Véneknek jóváhagyniuk, hiszen a Kék Rózsák, ezáltal annak csoportjai is az egyenlőség elvén működnek.</p>
<p>Amennyiben látni szeretnéd egy csoport leírását, kattints a csoport nevére!</p>
<table>
<thead>
<tr>
<td colspan="2">Csoport neve</td>
<td>Státusz</td>
<td>Vezető</td>
</tr>
</thead>
<tbody>
<thead>
<tr>
<td colspan="2">Csoport neve</td>
<td>Státusz</td>
<td>Vezető</td>
</tr>
</thead>
<tbody>
{% for group in groups %}
<tr>
<td>[ikon]</td>
<td class="csoport" title="|Csoport leírás|{{ group.description }}"><a href="{{ path('KekRozsakFrontBundle_groupView', {slug: group.slug}) }}">{{ group.name }}</a></td>
<td>
{% if group.isMember(app.user) %}
<span title="|Állapot|Már tag vagy" class="ikon">[tag ikon]</span>
{% elseif group.isRequested(app.user) %}
<span title="|Állapot|Már jelentkeztél, de a jelentkezésedet a csoport vezetője még nem fogadta el" class="ikon">[jelentkeztél ikon]</span>
{% else %}
{% if group.isOpen %}
<a href="{{ path('KekRozsakFrontBundle_groupJoin', {slug: group.slug}) }}"><span title="|Állapot|Nyílt csoport, kattints a belépéshez!" class="ikon">[nyílt ikon]</span></a>
{% else %}
<a href="{{ path('KekRozsakFrontBundle_groupJoin', {slug: group.slug}) }}"><span title="|Állapot|Zárt csoport, kattints a jelentkezéshez!" class="ikon">[zárt ikon]</span></a>
{% endif %}
{% endif %}
</td>
<td>{% if group.leader %}{{ group.leader|userdataspan }}{% else %}Nincs{% endif %}</td>
</tr>
<tr>
<td>[ikon]</td>
<td class="csoport" title="|Csoport leírás|{{ group.description }}"><a href="{{ path('KekRozsakFrontBundle_groupView', {slug: group.slug}) }}">{{ group.name }}</a></td>
<td>
{% if group.isMember(app.user) %}
<span title="|Állapot|Már tag vagy" class="ikon">[tag ikon]</span>
{% elseif group.isRequested(app.user) %}
<span title="|Állapot|Már jelentkeztél, de a jelentkezésedet a csoport vezetője még nem fogadta el" class="ikon">[jelentkeztél ikon]</span>
{% else %}
{% if group.isOpen %}
<a href="{{ path('KekRozsakFrontBundle_groupJoin', {slug: group.slug}) }}"><span title="|Állapot|Nyílt csoport, kattints a belépéshez!" class="ikon">[nyílt ikon]</span></a>
{% else %}
<a href="{{ path('KekRozsakFrontBundle_groupJoin', {slug: group.slug}) }}"><span title="|Állapot|Zárt csoport, kattints a jelentkezéshez!" class="ikon">[zárt ikon]</span></a>
{% endif %}
{% endif %}
</td>
<td>{% if group.leader %}{{ group.leader|userdataspan }}{% else %}Nincs{% endif %}</td>
</tr>
{% endfor %}
</tbody>
</tbody>
</table>
<a href="{{ path('KekRozsakFrontBundle_groupCreate') }}">Új csoport létrehozása</a>
{% endblock content %}
{% block bottomscripts %}
<script type="text/javascript">
$('.csoport').cluetip({
splitTitle: '|',
showTitle: false
});
$('.ikon').tooltip({
splitTitle: '|',
showTitle: false
});
</script>
<script type="text/javascript">
$('.csoport').cluetip({
splitTitle: '|',
showTitle: false
});
$('.ikon').tooltip({
splitTitle: '|',
showTitle: false
});
</script>
{% endblock bottomscripts %}

View File

@ -2,13 +2,10 @@
#}
{% extends 'KekRozsakFrontBundle:Default:main_template.html.twig' %}
{% block title %} - {{ group.name }}{% endblock %}
{% block additional_css %}
<link rel="stylesheet" href="{{ asset('css/group.css') }}" type="text/css" />
{% endblock additional_css %}
{% block content %}
<ul id="submenu">
<li><a href="{{ path('KekRozsakFrontBundle_groupView', {slug: group.slug}) }}">Leírás</a></li>
<li><a href="{{ path('KekRozsakFrontBundle_groupDocuments', {slug: group.slug}) }}">Dokumentumok</a></li>
<li><a href="{{ path('KekRozsakFrontBundle_groupView', {slug: group.slug}) }}">Leírás</a></li>
<li><a href="{{ path('KekRozsakFrontBundle_groupDocuments', {slug: group.slug}) }}">Dokumentumok</a></li>
</ul>
<h3>{{ group.name }} - Tagok</h3>
<ul>
@ -18,4 +15,4 @@
{% endif %}
{% endfor %}
</ul>
{% endblock %}
{% endblock content %}

View File

@ -3,12 +3,12 @@
{% extends 'KekRozsakFrontBundle:Default:main_template.html.twig' %}
{% block title %} - {{ group.name }}{% endblock %}
{% block additional_css %}
<link rel="stylesheet" href="{{ asset('css/group.css') }}" type="text/css" />
<link rel="stylesheet" href="{{ asset('css/group.css') }}" type="text/css" />
{% endblock additional_css %}
{% block content %}
<ul id="submenu">
<li><a href="{{ path('KekRozsakFrontBundle_groupMembers', {slug: group.slug}) }}">Tagok</a></li>
<li><a href="{{ path('KekRozsakFrontBundle_groupDocuments', {slug: group.slug}) }}">Dokumentumok</a></li>
<li><a href="{{ path('KekRozsakFrontBundle_groupMembers', {slug: group.slug}) }}">Tagok</a></li>
<li><a href="{{ path('KekRozsakFrontBundle_groupDocuments', {slug: group.slug}) }}">Dokumentumok</a></li>
</ul>
<h3>{{ group.name }}</h3>
{{ group.description|raw }}

View File

@ -5,77 +5,118 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class TwigBBExtension extends \Twig_Extension
{
private $container;
private $assets;
private $container;
private $assets;
public function __construct(ContainerInterface $container)
{
$this->container = $container;
}
public function __construct(ContainerInterface $container)
{
$this->container = $container;
}
public function getFilters()
{
return array(
'bbdecode' => new \Twig_Filter_Method($this, 'bbdecode', array(
'is_safe' => array('html'),
)),
);
}
public function getFilters()
{
return array(
'bbdecode' => new \Twig_Filter_Method($this, 'bbdecode', array(
'is_safe' => array('html'),
)),
);
}
public function bbdecode($sentence)
{
$sentence = htmlspecialchars($sentence, ENT_NOQUOTES);
$sentence = str_replace(array("\r\n", "\n", "\r"), "<br />", $sentence);
$sentence = preg_replace('/\\[u\\](.*?)\\[\\/u\\]/im', '<span class="u">\\1</span>', $sentence);
$sentence = preg_replace('/\\[b\\](.*?)\\[\\/b\\]/im', '<span class="b">\\1</span>', $sentence);
$sentence = preg_replace('/\\[i\\](.*?)\\[\\/i\\]/im', '<span class="i">\\1</span>', $sentence);
while (preg_match('/\\[img( (ns|name)="[^"]+"){1,}\\]/i', $sentence, $m, PREG_OFFSET_CAPTURE))
{
$start = $m[0][1];
$len = strlen($m[0][0]);
$full_tag = $m[0][0];
public function bbdecode($sentence)
{
$sentence = preg_replace(
'/\\[i\\](.*?)\\[\\/i\\]/im',
'<span class="i">\\1</span>',
preg_replace(
'/\\[b\\](.*?)\\[\\/b\\]/im',
'<span class="b">\\1</span>',
preg_replace(
'/\\[u\\](.*?)\\[\\/u\\]/im',
'<span class="u">\\1</span>',
str_replace(
array("\r\n", "\n", "\r"),
"<br />",
htmlspecialchars($sentence, ENT_NOQUOTES)
)
)
)
);
$ns = (preg_match('/ ns="([^"]+)"/', $full_tag, $ns)) ? trim($ns[1]) : '';
$name = (preg_match('/ name="([^"]+)"/', $full_tag, $name)) ? trim($name[1]) : '';
$m = array();
if ($name == '')
{
$sentence = substr_replace($sentence, 'Hibás kép', $start, $len);
}
else
{
// TODO: Thumbnailing!
$sentence = substr_replace($sentence, '<img src="' . $this->container->get('templating.helper.assets')->getUrl('upload/images/' . (($ns == '') ? '' : $ns . '/') . $name) . '" alt="" />', $start, $len);
}
}
while (preg_match('/\\[link( (url)="[^"]+"){1,}\\](?P<content>.*?)\\[\\/link\\]/i', $sentence, $m, PREG_OFFSET_CAPTURE))
{
$start = $m[0][1];
$len = strlen($m[0][0]);
$full_tag = $m[0][0];
while (
preg_match(
'/\\[img( (ns|name)="[^"]+"){1,}\\]/i',
$sentence,
$m,
PREG_OFFSET_CAPTURE
)
) {
$start = $m[0][1];
$len = strlen($m[0][0]);
$full_tag = $m[0][0];
$url = (preg_match('/ url="([^"]+)"/', $full_tag, $url)) ? trim($url[1]) : '';
$content = '';
if (array_key_exists('content', $m))
{
$content = trim($m['content'][0]);
}
$ns = (preg_match('/ ns="([^"]+)"/', $full_tag, $ns)) ? trim($ns[1]) : '';
$name = (preg_match('/ name="([^"]+)"/', $full_tag, $name)) ? trim($name[1]) : '';
if (($url == '') || ($content == ''))
{
$sentence = substr_replace($sentence, 'Hibás link', $start, $len);
}
else
{
$sentence = substr_replace($sentence, '<a href="' . $url . '" target="_blank">' . $content . '</a>', $start, $len);
}
}
return $sentence;
}
if ($name == '') {
$sentence = substr_replace($sentence, 'Hibás kép', $start, $len);
} else {
// TODO: Thumbnailing!
$sentence = substr_replace(
$sentence,
'<img src="'
. $this
->container
->get('templating.helper.assets')
->getUrl(
'upload/images/'
. (($ns == '') ? '' : $ns . '/')
. $name
)
. '" alt="" />',
$start,
$len
);
}
}
public function getName()
{
return 'twig_bb';
}
while (
preg_match(
'/\\[link( (url)="[^"]+"){1,}\\](?P<content>.*?)\\[\\/link\\]/i',
$sentence, $m, PREG_OFFSET_CAPTURE)
) {
$start = $m[0][1];
$len = strlen($m[0][0]);
$full_tag = $m[0][0];
$url = (preg_match('/ url="([^"]+)"/', $full_tag, $url)) ? trim($url[1]) : '';
$content = '';
if (array_key_exists('content', $m)) {
$content = trim($m['content'][0]);
}
if (($url == '') || ($content == '')) {
$sentence = substr_replace($sentence, 'Hibás link', $start, $len);
} else {
$sentence = substr_replace(
$sentence,
'<a href="'
. $url
. '" target="_blank">'
. $content
. '</a>',
$start,
$len
);
}
}
return $sentence;
}
public function getName()
{
return 'twig_bb';
}
}

View File

@ -16,124 +16,138 @@ use KekRozsak\FrontBundle\Entity\UserData;
class DefaultController extends Controller
{
/**
* @Route("/login", name="KekRozsakSecurityBundle_login")
* @Template()
*/
public function loginAction()
{
$request = $this->getRequest();
$session = $request->getSession();
/**
* @Route("/login", name="KekRozsakSecurityBundle_login")
* @Template()
*/
public function loginAction()
{
$request = $this->getRequest();
$session = $request->getSession();
if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR))
{
$error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
}
else
{
$error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
$session->remove(SecurityContext::AUTHENTICATION_ERROR);
}
if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
$error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
} else {
$error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
$session->remove(SecurityContext::AUTHENTICATION_ERROR);
}
return array(
'last_username' => $session->get(SecurityContext::LAST_USERNAME),
'error' => $error,
);
}
return array(
'last_username' => $session->get(SecurityContext::LAST_USERNAME),
'error' => $error,
);
}
/**
* @Route("/login_check", name="KekRozsakSecurityBundle_login_check")
*/
public function loginCheckAction()
{
// The security layer will intercept this request. This method will never be called.
}
/**
* @Route("/login_check", name="KekRozsakSecurityBundle_login_check")
*/
public function loginCheckAction()
{
// The security layer will intercept this request. This method will never be called.
}
/**
* @Route("/logout", name="KekRozsakSecurityBundle_logout")
*/
public function logoutAction()
{
// The security layer will intercept this request. This method will never be called.
}
/**
* @Route("/logout", name="KekRozsakSecurityBundle_logout")
*/
public function logoutAction()
{
// The security layer will intercept this request. This method will never be called.
}
/**
* @Route("/jelentkezes", name="KekRozsakSecurityBundle_registration")
* @Template()
*/
public function registrationAction()
{
$user = $this->get('security.context')->getToken()->getUser();
if ($user instanceof UserInterface)
{
return $this->redirect($this->generateUrl('KekRozsakFrontBundle_homepage'));
}
/**
* @Route("/jelentkezes", name="KekRozsakSecurityBundle_registration")
* @Template()
*/
public function registrationAction()
{
$user = $this->get('security.context')->getToken()->getUser();
if ($user instanceof UserInterface) {
return $this->redirect($this->generateUrl('KekRozsakFrontBundle_homepage'));
}
$user = new User();
$form = $this->createForm(new UserType(true), $user);
$request = $this->getRequest();
$user = new User();
$form = $this->createForm(new UserType(true), $user);
$request = $this->getRequest();
if ($request->getMethod() == 'POST')
{
$form->bind($request);
if ($request->getMethod() == 'POST') {
$form->bind($request);
if ($form->isValid(array('registration')))
{
$roleRepo = $this->getDoctrine()->getRepository('KekRozsakSecurityBundle:Role');
$defaultRoles = $roleRepo->findByDefault(true);
if ($form->isValid(array('registration'))) {
$roleRepo = $this->getDoctrine()->getRepository('KekRozsakSecurityBundle:Role');
$defaultRoles = $roleRepo->findByDefault(true);
$user->setRegisteredAt(new \DateTime('now'));
$user->setPassword($this->get('security.encoder_factory')->getEncoder($user)->encodePassword($user->getPassword(), $user->getSalt()));
foreach ($defaultRoles as $role)
$user->addRole($role);
$em = $this->getDoctrine()->getEntityManager();
$em->persist($user);
$em->flush();
$user->setRegisteredAt(new \DateTime('now'));
$user->setPassword(
$this
->get('security.encoder_factory')
->getEncoder($user)
->encodePassword(
$user->getPassword(),
$user->getSalt()
)
);
$userData = new UserData();
$user->setUserData($userData);
$em->persist($user);
$em->persist($userData);
$em->flush();
/* Add default Roles */
foreach ($defaultRoles as $role) {
$user->addRole($role);
}
$message = \Swift_Message::newInstance()
->setSubject('Új jelentkező')
// TODO: Make this a config parameter!
->setFrom('info@blueroses.hu')
// TODO: Make this a config parameter!
->setTo('jelentkezes@blueroses.hu')
->setBody($this->renderView('KekRozsakSecurityBundle:Email:new_registration.txt.twig', array('user' => $user)));
$this->get('mailer')->send($message);
$em = $this->getDoctrine()->getEntityManager();
$em->persist($user);
$em->flush();
return $this->redirect($this->generateUrl('KekRozsakSecurityBundle_reg_success'));
}
}
$userData = new UserData();
$user->setUserData($userData);
$em->persist($user);
$em->persist($userData);
$em->flush();
return array(
'form' => $form->createView(),
);
}
$message = \Swift_Message::newInstance()
->setSubject('Új jelentkező')
// TODO: Make the next two config parameters!
->setFrom('info@blueroses.hu')
->setTo('jelentkezes@blueroses.hu')
->setBody(
$this->renderView(
'KekRozsakSecurityBundle:Email:new_registration.txt.twig',
array('user' => $user)
)
);
$this->get('mailer')->send($message);
/**
* @Route("/most_varj", name="KekRozsakSecurityBundle_reg_success")
* @Template()
*/
public function regSuccessAction()
{
return array(
);
}
return $this->redirect(
$this->generateUrl(
'KekRozsakSecurityBundle_reg_success'
)
);
}
}
/**
* @Route("/profil/{id}/ajax-felhasznalo-info.{_format}", name="KekRozsakSecurityBundle_ajaxUserdata", requirements={"_format": "html"})
* @Method({"GET"})
* @Template()
* @ParamConverter("user")
*/
public function ajaxUserdataAction(User $user)
{
return array(
'user' => $user,
);
}
return array(
'form' => $form->createView(),
);
}
/**
* @Route("/most_varj", name="KekRozsakSecurityBundle_reg_success")
* @Template()
*/
public function regSuccessAction()
{
return array(
);
}
/**
* @Route("/profil/{id}/ajax-felhasznalo-info.{_format}", name="KekRozsakSecurityBundle_ajaxUserdata", requirements={"_format": "html"})
* @Method({"GET"})
* @Template()
* @ParamConverter("user")
*/
public function ajaxUserdataAction(User $user)
{
return array(
'user' => $user,
);
}
}

View File

@ -7,10 +7,10 @@ use Symfony\Component\DependencyInjection\Reference;
class OverrideServiceCompilerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
$definition = $container->getDefinition('security.role_hierarchy');
$definition->setClass('KekRozsak\SecurityBundle\Service\RoleHierarchy');
$definition->setArguments(array(new Reference('doctrine')));
}
public function process(ContainerBuilder $container)
{
$definition = $container->getDefinition('security.role_hierarchy');
$definition->setClass('KekRozsak\SecurityBundle\Service\RoleHierarchy');
$definition->setArguments(array(new Reference('doctrine')));
}
}

View File

@ -15,155 +15,171 @@ use KekRozsak\SecurityBundle\Entity\User;
*/
class Role implements RoleInterface
{
/**
* @var integer $id
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* The ID of the Role
*
* @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 name
* @ORM\Column(type="string", length=50, unique=true, nullable=false)
*/
protected $name;
/**
* The role name of the Role
*
* @var string name
*
* @ORM\Column(type="string", length=50, unique=true, nullable=false)
*/
protected $name;
/**
* Set name
*
* @param string $name
* @return Role
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Set name
*
* @param string $name
* @return Role
*/
public function setName($name)
{
// TODO: Check if null or empty!
$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 boolean $default
* @ORM\Column(type="boolean", nullable=false)
*/
protected $default;
/**
* TRUE if this Role is automatically added to newly registered Users
*
* @var boolean $default
*
* @ORM\Column(type="boolean", nullable=false)
*/
protected $default;
/**
* Set default
*
* @param boolean $default
*/
public function setDefault($default)
{
$this->default = $default;
return $this;
}
/**
* Set default
*
* @param boolean $default
*/
public function setDefault($default)
{
// TODO: Check if parameter is boolean!
$this->default = $default;
return $this;
}
/**
* @var text description
* @ORM\Column(type="string", length=150, nullable=true)
*/
protected $description;
/**
* The description of this Role
*
* @var text description
*
* @ORM\Column(type="string", length=150, nullable=true)
*/
protected $description;
/**
* Set description
*
* @param string $description
* @return Role
*/
public function setDescription($description = null)
{
$this->description = $description;
return $this;
}
/**
* Set description
*
* @param string $description
* @return Role
*/
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;
}
/* Here comes the rest of RoleInterface's implementation */
/* Here comes the rest of RoleInterface's implementation */
public function getRole()
{
return $this->name;
}
public function getRole()
{
return $this->name;
}
/**
* Short description
*
* @var string shortDescription
*
* @ORM\Column(type="string", length=50, nullable=false, unique=true, name="short_description")
*/
protected $shortDescription;
/**
* Short description of the Role (e.g readable name)
*
* @var string shortDescription
*
* @ORM\Column(type="string", length=50, nullable=false, unique=true, name="short_description")
*/
protected $shortDescription;
/**
* Set shortDescription
*
* @param string $shortDescription
* @return Role
*/
public function setShortDescription($shortDescription)
{
$this->shortDescription = $shortDescription;
return $this;
}
/**
* Set shortDescription
*
* @param string $shortDescription
* @return Role
*/
public function setShortDescription($shortDescription)
{
// TODO: Check if empty or null!
$this->shortDescription = $shortDescription;
return $this;
}
/**
* Get shortDescription
*
* @return string
*/
public function getShortDescription()
{
return $this->shortDescription;
}
/**
* Get shortDescription
*
* @return string
*/
public function getShortDescription()
{
return $this->shortDescription;
}
/**
* List of inherited Roles
*
* @ORM\ManyToMany(targetEntity="Role", fetch="LAZY")
* @ORM\JoinTable(name="role_hierarchy", joinColumns={
* @ORM\JoinColumn(name="parent_role_id", referencedColumnName="id")
* }, inverseJoinColumns={
* @ORM\JoinColumn(name="child_role_id", referencedColumnName="id")
* })
*/
protected $inheritedRoles;
/**
* List of inherited Roles. Required for RoleHierarchy
*
* @var Doctrine\Common\Collections\ArrayCollection $inheritedRoles
*
* @ORM\ManyToMany(targetEntity="Role", fetch="LAZY")
* @ORM\JoinTable(name="role_hierarchy", joinColumns={
* @ORM\JoinColumn(name="parent_role_id", referencedColumnName="id")
* }, inverseJoinColumns={
* @ORM\JoinColumn(name="child_role_id", referencedColumnName="id")
* })
*/
protected $inheritedRoles;
/**
* Get all inherited roles
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getInheritedRoles()
{
return $this->inheritedRoles;
}
/**
* Get all inherited roles
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getInheritedRoles()
{
return $this->inheritedRoles;
}
}

View File

@ -11,6 +11,7 @@ use Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;
use KekRozsak\FrontBundle\Entity\UserData;
use KekRozsak\FrontBundle\Entity\UserGroupMembership;
use KekRozsak\SecurityBundle\Entity\Role;
/**
* KekRozsak\SecurityBundle\Entity\User
@ -22,364 +23,403 @@ use KekRozsak\FrontBundle\Entity\UserGroupMembership;
*/
class User implements UserInterface, AdvancedUserInterface
{
public function __construct()
{
$this->groups = new ArrayCollection();
$this->roles = new ArrayCollection();
}
public function __construct()
{
$this->groups = new ArrayCollection();
$this->roles = new ArrayCollection();
}
/**
* @var integer $id
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* The ID of the User
*
* @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 $username
* @ORM\Column(type="string", length=50, nullable=false, unique=true)
* @Assert\NotBlank(groups="registration")
*/
protected $username;
/**
* The login name of the User
*
* @var string $username
*
* @ORM\Column(type="string", length=50, nullable=false, unique=true)
* @Assert\NotBlank(groups="registration")
*/
protected $username;
/**
* Set username
*
* @param string $username
* @return User
*/
public function setUsername($username)
{
$this->username = $username;
return $this;
}
/**
* Set username
*
* @param string $username
* @return User
*/
public function setUsername($username)
{
// TODO: check if null or empty!
$this->username = $username;
return $this;
}
/**
* Get username
*
* @return string
*/
public function getUsername()
{
return $this->username;
}
/**
* Get username
*
* @return string
*/
public function getUsername()
{
return $this->username;
}
/**
* @var string $password
* @ORM\Column(type="string", length=50, nullable=false)
* @Assert\NotBlank(groups="registration")
*/
protected $password;
/**
* The encrypted password of the User
*
* @var string $password
*
* @ORM\Column(type="string", length=50, nullable=false)
* @Assert\NotBlank(groups="registration")
*/
protected $password;
/**
* Set password
*
* @param string $password
* @return User
*/
public function setPassword($password)
{
$this->password = $password;
return $this;
}
/**
* Set password
*
* @param string $password
* @return User
*/
public function setPassword($password)
{
$this->password = $password;
return $this;
}
/**
* Get password
*
* @return string
*/
public function getPassword()
{
return $this->password;
}
/**
* Get password
*
* @return string
*/
public function getPassword()
{
return $this->password;
}
/**
* @var string $displayName
* @ORM\Column(type="string", length=50, unique=true, name="display_name")
*/
protected $displayName;
/**
* The display name of the User
*
* @var string $displayName
*
* @ORM\Column(type="string", length=50, unique=true, name="display_name")
*/
protected $displayName;
/**
* Set displayName
*
* @param string $displayName
* @return User
*/
public function setDisplayName($displayName)
{
$this->displayName = $displayName;
return $this;
}
/**
* Set displayName
*
* @param string $displayName
* @return User
*/
public function setDisplayName($displayName)
{
// TODO: Check if empty or null!
$this->displayName = $displayName;
return $this;
}
/**
* Get displayName
*
* @return string
*/
public function getDisplayName()
{
return $this->displayName;
}
/**
* Get displayName
*
* @return string
*/
public function getDisplayName()
{
return $this->displayName;
}
/**
* @var string $email
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
*/
protected $email;
/**
* The e-mail address of the User
*
* @var string $email
*
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
*/
protected $email;
/**
* Set email
*
* @param string $email
* @return User
*/
public function setEmail($email)
{
$this->email = $email;
return $this;
}
/**
* Set email
*
* @param string $email
* @return User
*/
public function setEmail($email)
{
// TODO: Check if empty or null!
$this->email = $email;
return $this;
}
/**
* Get email
*
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* Get email
*
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* @var DateTime $registeredAt
* @ORM\Column(type="datetime", nullable=false, name="registered_at")
*/
protected $registeredAt;
/**
* The timestamp when the user registered
*
* @var DateTime $registeredAt
*
* @ORM\Column(type="datetime", nullable=false, name="registered_at")
*/
protected $registeredAt;
/**
* Set registeredAt
*
* @param DateTime $registeredAt
* @return User
*/
public function setRegisteredAt(\DateTime $registeredAt)
{
$this->registeredAt = $registeredAt;
return $this;
}
/**
* Set registeredAt
*
* @param DateTime $registeredAt
* @return User
*/
public function setRegisteredAt(\DateTime $registeredAt)
{
$this->registeredAt = $registeredAt;
return $this;
}
/**
* Get registeredAt
*
* @return DateTime
*/
public function getRegisteredAt()
{
return $this->registeredAt;
}
/**
* Get registeredAt
*
* @return DateTime
*/
public function getRegisteredAt()
{
return $this->registeredAt;
}
/**
* @var User acceptedBy
* @ORM\ManyToOne(targetEntity="User")
* @ORM\JoinColumn(name="accepted_by_id")
*/
protected $acceptedBy;
/**
* The User who accepted this User's registration
*
* @var User acceptedBy
*
* @ORM\ManyToOne(targetEntity="User")
* @ORM\JoinColumn(name="accepted_by_id")
*/
protected $acceptedBy;
/**
* Set acceptedBy
*
* @param User $acceptedBy
* @return User
*/
public function setAcceptedBy(User $acceptedBy = null)
{
$this->acceptedBy = $acceptedBy;
return $this;
}
/**
* Set acceptedBy
*
* @param User $acceptedBy
* @return User
*/
public function setAcceptedBy(User $acceptedBy = null)
{
$this->acceptedBy = $acceptedBy;
return $this;
}
/**
* Get acceptedBy
*
* @return User
*/
public function getAcceptedBy()
{
return $this->acceptedBy;
}
/**
* Get acceptedBy
*
* @return User
*/
public function getAcceptedBy()
{
return $this->acceptedBy;
}
/**
* @var DateTime $lastLoginAt
* @ORM\Column(type="datetime", nullable=true, name="last_login_at")
*/
protected $lastLoginAt;
/**
* The timestamp when the User logged in last time
*
* @var DateTime $lastLoginAt
*
* @ORM\Column(type="datetime", nullable=true, name="last_login_at")
*/
protected $lastLoginAt;
/**
* Set lastLoginAt;
*
* @param DateTime $lastLoginAt
* @return User
*/
public function setLastLoginAt(\DateTime $lastLoginAt = null)
{
$this->lastLoginAt = $lastLoginAt;
return $this;
}
/**
* Set lastLoginAt;
*
* @param DateTime $lastLoginAt
* @return User
*/
public function setLastLoginAt(\DateTime $lastLoginAt = null)
{
$this->lastLoginAt = $lastLoginAt;
return $this;
}
/**
* Get lastLoginAt
*
* @return DateTime
*/
public function getLastLoginAt()
{
return $this->lastLoginAt;
}
/**
* Get lastLoginAt
*
* @return DateTime
*/
public function getLastLoginAt()
{
return $this->lastLoginAt;
}
/**
* @var \KekRozsak\FrontBundle\Entity\UserData $userData
* @ORM\OneToOne(targetEntity="KekRozsak\FrontBundle\Entity\UserData", fetch="LAZY", cascade={"persist"}, mappedBy="user")
*/
protected $userData;
/**
* The UserData object for this User
*
* @var \KekRozsak\FrontBundle\Entity\UserData $userData
*
* @ORM\OneToOne(targetEntity="KekRozsak\FrontBundle\Entity\UserData", fetch="LAZY", cascade={"persist"}, mappedBy="user")
*/
protected $userData;
/**
* Set userData
*
* @param \KekRozsak\FrontBundle\Entity\UserData $userData
* @return User
*/
public function setUserData(\KekRozsak\FrontBundle\Entity\UserData $userData = null)
{
$this->userData = $userData;
$userData->setUser($this);
return $this;
}
/**
* Set userData
*
* @param \KekRozsak\FrontBundle\Entity\UserData $userData
* @return User
*/
public function setUserData(\KekRozsak\FrontBundle\Entity\UserData $userData = null)
{
$this->userData = $userData;
$userData->setUser($this);
return $this;
}
/**
* Get userData
*
* @return \KekRozsak\FrontBundle\Entity\UserData
*/
public function getUserData()
{
return $this->userData;
}
/**
* Get userData
*
* @return \KekRozsak\FrontBundle\Entity\UserData
*/
public function getUserData()
{
return $this->userData;
}
/**
* The Group memberships of this User represented by UserGroupMembership
* objects
*
* @var Doctrine\Common\Collections\ArrayCollection $groups
*
* @ORM\OneToMany(targetEntity="KekRozsak\FrontBundle\Entity\UserGroupMembership", mappedBy="user")
* @ORM\JoinColumn(referencedColumnName="user_id")
*/
protected $groups;
/**
* @var Doctrine\Common\Collections\ArrayCollection $groups
* @ORM\OneToMany(targetEntity="KekRozsak\FrontBundle\Entity\UserGroupMembership", mappedBy="user")
* @ORM\JoinColumn(referencedColumnName="user_id")
*/
protected $groups;
/**
* Add group
*
* @param KekRozsak\FrontBundle\Entity\UserGroupMembership $group
* @return User
*/
public function addGroup(UserGroupMembership $group)
{
// TODO: Check if null!
$this->groups[] = $group;
return $this;
}
/**
* Add group
*
* @param KekRozsak\FrontBundle\Entity\UserGroupMembership $group
* @return User
*/
public function addGroup(\KekRozsak\FrontBundle\Entity\UserGroupMembership $group)
{
$this->groups[] = $group;
return $this;
}
/**
* Get all groups
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getGroups()
{
return $this->groups;
}
/**
* Get all groups
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getGroups()
{
return $this->groups;
}
/**
* The Roles belonging to this User
*
* @var Doctrine\Common\Collections\ArrayCollection $roles
*
* @ORM\ManyToMany(targetEntity="Role")
*/
protected $roles;
/**
* @var Doctrine\Common\Collections\ArrayCollection $roles
* @ORM\ManyToMany(targetEntity="Role")
*/
protected $roles;
/**
* Add a role
*
* @param KekRozsak\SecurityBundle\Entity\Role $role
* @return User
*/
public function addRole(Role $role)
{
// TODO: Check if null!
$this->roles[] = $role;
return $this;
}
/**
* Add a role
*
* @param KekRozsak\SecurityBundle\Entity\Role $role
* @return User
*/
public function addRole(\KekRozsak\SecurityBundle\Entity\Role $role)
{
$this->roles[] = $role;
return $this;
}
/**
* Get all roles as an ArrayCollection
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getRolesCollection()
{
return $this->roles;
}
/**
* Get all roles as an ArrayCollection
*
* @return Doctrine\Common\Collections\ArrayCollection
*/
public function getRolesCollection()
{
return $this->roles;
}
/**
* Get all roles, for UserInterface implementation. To get the
* ArrayCollection, use getRolesCollection() instead
*
* @return array
*/
public function getRoles()
{
return $this->roles->toArray();
}
/**
* Get all roles, for UserInterface implementation. To get the
* collection, use getRolesCollection() instead
*
* @return array
*/
public function getRoles()
{
return $this->roles->toArray();
}
/* Here comes the remaining part of UserInterface implementation */
/* Here comes the remaining part of UserInterface implementation */
public function getSalt()
{
/*
* As we use crypt() to encode passwords, salt is always the same as the
* password
*/
return $this->password;
}
public function getSalt()
{
/* As we use crypt() to encode passwords, salt is always the
* same as password
*/
return $this->password;
}
public function eraseCredentials()
{
}
public function eraseCredentials()
{
}
/* Here comes the AdvancedUserInterface implementation */
/* Here comes the AdvancedUserInterface implementation */
public function isAccountNonExpired()
{
/* Currently, accounts never expire */
return true;
}
public function isAccountNonExpired()
{
/* Currently, accounts never expire */
return true;
}
public function isAccountNonLocked()
{
/* Currently, accounts cannot be locked */
return true;
}
public function isAccountNonLocked()
{
/* Currently, accounts cannot be locked */
return true;
}
public function isCredentialsNonExpired()
{
/* Currently, credentials never expire */
return true;
}
public function isCredentialsNonExpired()
{
/* Currently, credentials never expire */
return true;
}
public function isEnabled()
{
/* Account is enabled if it is accepted by someone */
return ($this->acceptedBy !== null);
}
public function isEnabled()
{
/* Account is enabled if it is accepted by someone */
return ($this->acceptedBy !== null);
}
}

View File

@ -9,68 +9,76 @@ use KekRozsak\FrontBundle\Form\Type\UserDataType;
class UserType extends AbstractType
{
protected $_registration;
protected $_registration;
public function __construct($registration = false)
{
$this->_registration = $registration;
}
public function __construct($registration = false)
{
$this->_registration = $registration;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('username', null, array(
'label' => 'Felhasználónév',
'read_only' => (!$this->_registration),
'help' => 'Ezt fogod használni az oldalra való bejelentkezéshez. Jelszavadhoz hasonlóan kezeld bizalmasan! Jelentkezés után nem lehet megváltoztatni!',
));
$builder->add('password', 'repeated', array(
'type' => 'password',
'second_name' => 'confirm',
'invalid_message' => 'A két jelszó nem egyezik meg!',
'required' => ($this->_registration),
'options' => array(
'label' => 'Jelszó',
'help' => 'Ezt fogod használni az oldalra való bejelentkezéshez. Soha ne add meg senkinek!',
),
));
$builder->add('email', null, array(
'label' => 'E-mail cím',
'help' => 'Ezen az e-mail címen értesítünk majd, ha felvételt nyersz a körbe.',
));
$builder->add('displayName', null, array(
'label' => 'Név',
'help' => 'Ezen a néven fog szólítani a közösség. Bármikor megváltoztathatod, de az egyértelműség kedvéért ezt mindig jelezd a többiek felé!',
));
if (!$this->_registration)
{
$builder->add('userData', new UserDataType(), array(
'label' => 'Egyéb adatok',
));
}
else
{
$builder->add('agree', 'checkbox', array(
'property_path' => false,
'label' => ' ',
'help' => 'A Jelentkezés gomb megnyomásával kijelentem, hogy a Kék Rózsa okkultista kör Házirendjét elolvastam, és azt felvételem esetén magamra nézve teljes mértékben elfogadom.',
));
}
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('username', null, array(
'label' => 'Felhasználónév',
'read_only' => (!$this->_registration),
'help' => 'Ezt fogod használni az oldalra való bejelentkezéshez. Jelszavadhoz hasonlóan kezeld bizalmasan! Jelentkezés után nem lehet megváltoztatni!',
)
);
public function getName()
{
return 'user';
}
$builder->add('password', 'repeated', array(
'type' => 'password',
'second_name' => 'confirm',
'invalid_message' => 'A két jelszó nem egyezik meg!',
'required' => ($this->_registration),
'options' => array(
'label' => 'Jelszó',
'help' => 'Ezt fogod használni az oldalra való bejelentkezéshez. Soha ne add meg senkinek!',
),
)
);
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$opts = array(
'data_class' => 'KekRozsak\SecurityBundle\Entity\User',
);
if ($this->_registration)
$opts['validation_groups'] = array('registration');
$builder->add('email', null, array(
'label' => 'E-mail cím',
'help' => 'Ezen az e-mail címen értesítünk majd, ha felvételt nyersz a körbe.',
)
);
$resolver->setDefaults($opts);
}
$builder->add('displayName', null, array(
'label' => 'Név',
'help' => 'Ezen a néven fog szólítani a közösség. Bármikor megváltoztathatod, de az egyértelműség kedvéért ezt mindig jelezd a többiek felé!',
)
);
if (!$this->_registration) {
$builder->add('userData', new UserDataType(), array(
'label' => 'Egyéb adatok',
)
);
} else {
$builder->add('agree', 'checkbox', array(
'property_path' => false,
'label' => ' ',
'help' => 'A Jelentkezés gomb megnyomásával kijelentem, hogy a Kék Rózsa okkultista kör Házirendjét elolvastam, és azt felvételem esetén magamra nézve teljes mértékben elfogadom.',
)
);
}
}
public function getName()
{
return 'user';
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$opts = array(
'data_class' => 'KekRozsak\SecurityBundle\Entity\User',
);
if ($this->_registration) {
$opts['validation_groups'] = array('registration');
}
$resolver->setDefaults($opts);
}
}

View File

@ -9,9 +9,9 @@ use KekRozsak\SecurityBundle\DependencyInjection\Compiler\OverrideServiceCompile
class KekRozsakSecurityBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new OverrideServiceCompilerPass());
}
public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new OverrideServiceCompilerPass());
}
}

View File

@ -1,17 +1,19 @@
<?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_security.encoder.crypt" class="KekRozsak\SecurityBundle\Service\CryptEncoder">
</service>
<service id="kek_rozsak_security.auth.success" class="KekRozsak\SecurityBundle\Security\AuthSuccess">
<argument type="service" id="doctrine" />
<tag name="kernel.event_listener" event="security.authentication.success" />
</service>
<service id="kek_rozsak_security.twig_extension.userdataspan" class="KekRozsak\SecurityBundle\Twig\UserDataSpanExtension">
<argument type="service" id="router" />
<argument type="service" id="security.context" />
<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_security.encoder.crypt" class="KekRozsak\SecurityBundle\Service\CryptEncoder">
</service>
<service id="kek_rozsak_security.auth.success" class="KekRozsak\SecurityBundle\Security\AuthSuccess">
<argument type="service" id="doctrine" />
<tag name="kernel.event_listener" event="security.authentication.success" />
</service>
<service id="kek_rozsak_security.twig_extension.userdataspan" class="KekRozsak\SecurityBundle\Twig\UserDataSpanExtension">
<argument type="service" id="router" />
<argument type="service" id="security.context" />
<tag name="twig.extension" />
</service>
</services>
</container>

View File

@ -1,10 +1,10 @@
{# vim: ft=htmljinja
#}
<html>
<head>
<title>{{ user.displayName }}</title>
</head>
<body>
Tagság kezdete: {{ user.registeredAt|date('Y-m-d') }}
</body>
<head>
<title>{{ user.displayName }}</title>
</head>
<body>
Tagság kezdete: {{ user.registeredAt|date('Y-m-d') }}
</body>
</html>

View File

@ -7,8 +7,8 @@
<div id="error-message">{{ error.message }}</div>
{% endif %}
<form action="{{ path('KekRozsakSecurityBundle_login_check') }}" method="post">
<input type="text" id="username" name="_username" value="{{ last_username }}" />
<input type="password" id="password" name="_password" />
<button type="submit">Bejelentkezés</button>
<input type="text" id="username" name="_username" value="{{ last_username }}" />
<input type="password" id="password" name="_password" />
<button type="submit">Bejelentkezés</button>
</form>
{% endblock content %}

View File

@ -3,5 +3,5 @@
{% extends 'KekRozsakFrontBundle:Default:main_template.html.twig' %}
{% block title %} - Sikeres regisztráció{% endblock %}
{% block content %}
A regisztrációd sikeres volt. A Vének hamarosan kapcsolatba lépnek Veled, és elbírálják jelentkezésedet. Kérünk, addig légy türelemmel!
A regisztrációd sikeres volt. A Vének hamarosan kapcsolatba lépnek Veled, és elbírálják jelentkezésedet. Kérünk, addig légy türelemmel!
{% endblock %}

View File

@ -8,10 +8,10 @@
<p>Amennyiben már tagja vagy a körnek, <a href="{{ path('KekRozsakSecurityBundle_login') }}">itt bejelentkezhetsz</a>.
<p>Az alábbi űrlap kitöltésével jelentkezhetsz a Kék Rózsa okkultista kör tagjai közé. Kérünk, hogy jelentkezés előtt figyelmesen olvasd el a <a href="{{ path('KekRozsakFrontBundle_articleView', { slug: 'rolunk' }) }}">Rólunk</a> menüpont szövegét, különös tekintettel a Házirendre.</p>
<p>A jelentkezés NEM jár automatikus tagsággal. A Házirend szerint a Vének jogot formálhatnak arra, hogy a jelentkezésedet elutasítsák, vagy próbáknak vessenek alá, mielőtt a tagok közé fogadnak.</p>
<p><strong>FONTOS!</strong> Aki a régi fórumon írt bármilyen bejegyzést, az már regisztrálva van ezen az oldalon is! Ez esetben kérlek lépjetek kapcsolatba velem <a href="http://www.facebook.com/Polesz" target="_blank">Facebookon</a> vagy e-mailben a <a href="jelentkezes@blueroses.hu">jelentkezes@blueroses.hu</a> címen!</p>
<p><strong>FONTOS!</strong> Aki a régi fórumon írt bármilyen bejegyzést, az már regisztrálva van ezen az oldalon is! Ez esetben kérlek lépjetek kapcsolatba velem <a href="http://www.facebook.com/Polesz" target="_blank">Facebookon</a> vagy e-mailben a <a href="jelentkezes@blueroses.hu">jelentkezes@blueroses.hu</a> címen!</p>
<form method="post" action="{{ path('KekRozsakSecurityBundle_registration') }}">
<table>
<table>
{{ form_widget(form) }}
</table>
<button type="submit">Jelentkezés</button>
</table>
<button type="submit">Jelentkezés</button>
{% endblock content %}

View File

@ -2,7 +2,6 @@
namespace KekRozsak\SecurityBundle\Security;
use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
use Doctrine\ORM\EntityManager;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Bridge\Doctrine\RegistryInterface;
@ -10,29 +9,29 @@ use Symfony\Component\Security\Core\Event\AuthenticationEvent;
class AuthSuccess implements AuthenticationSuccessHandlerInterface
{
private $doctrine;
private $doctrine;
public function __construct(RegistryInterface $doctrine)
{
$this->doctrine = $doctrine;
}
public function __construct(RegistryInterface $doctrine)
{
$this->doctrine = $doctrine;
}
public function onSecurityAuthenticationSuccess(AuthenticationEvent $event)
{
$user = $event->getAuthenticationToken()->getUser();
$em = $this->doctrine->getEntityManager();
$user->setLastLoginAt(new \DateTime('now'));
$em->persist($user);
$em->flush();
}
public function onSecurityAuthenticationSuccess(AuthenticationEvent $event)
{
$user = $event->getAuthenticationToken()->getUser();
$em = $this->doctrine->getEntityManager();
$user->setLastLoginAt(new \DateTime('now'));
$em->persist($user);
$em->flush();
}
public function onAuthenticationSuccess(Request $request, TokenInterface $token)
{
$user = $token->getUser();
$em = $this->doctrine->getEntityManager();
$user->setLastLoginAt(new \DateTime('now'));
$em->persist($user);
$em->flush();
}
public function onAuthenticationSuccess(Request $request, TokenInterface $token)
{
$user = $token->getUser();
$em = $this->doctrine->getEntityManager();
$user->setLastLoginAt(new \DateTime('now'));
$em->persist($user);
$em->flush();
}
}

View File

@ -5,14 +5,14 @@ use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface;
class CryptEncoder implements PasswordEncoderInterface
{
function encodePassword($raw, $salt)
{
return crypt($raw);
}
function encodePassword($raw, $salt)
{
return crypt($raw);
}
function isPasswordValid($encoded, $raw, $salt)
{
return (crypt($raw, $salt) == $encoded);
}
function isPasswordValid($encoded, $raw, $salt)
{
return (crypt($raw, $salt) == $encoded);
}
}

View File

@ -9,33 +9,40 @@ use KekRozsak\SecurityBundle\Entity\User;
class UserDataSpanExtension extends \Twig_Extension
{
protected $_securityContext;
protected $_router;
protected $_securityContext;
protected $_router;
public function __construct(Router $router, SecurityContextInterface $security)
{
$this->_router = $router;
$this->_securityContext = $security;
}
public function __construct(Router $router, SecurityContextInterface $security)
{
$this->_router = $router;
$this->_securityContext = $security;
}
public function getFilters()
{
return array(
'userdataspan' => new \Twig_Filter_Method($this, 'getUserDataSpan', array('is_safe' => array('html'))),
);
}
public function getFilters()
{
return array(
'userdataspan' => new \Twig_Filter_Method(
$this,
'getUserDataSpan',
array('is_safe' => array('html'))
),
);
}
public function getUserDataSpan(User $user)
{
if (!is_object($this->_securityContext->getToken()) || !is_object($this->_securityContext->getToken()->getUser()))
return '<span class="userdata-secret" title="|Felhasználó|A felhasználóink kiléte szigorúan bizalmas, csak a tagok számára elérhető.">[nem jelenhet meg]</span>';
public function getUserDataSpan(User $user)
{
if (
!is_object($this->_securityContext->getToken())
|| !is_object($this->_securityContext->getToken()->getUser())
) {
return '<span class="userdata-secret" title="|Felhasználó|A felhasználóink kiléte szigorúan bizalmas, csak a tagok számára elérhető.">[nem jelenhet meg]</span>';
}
return '<span class="userdata" rel="' . $this->_router->generate('KekRozsakSecurityBundle_ajaxUserdata', array('id' => $user->getId(), '_format' => 'html')) . '"><a href="">' . $user->getDisplayName() . '</a></span>';
}
return '<span class="userdata" rel="' . $this->_router->generate('KekRozsakSecurityBundle_ajaxUserdata', array('id' => $user->getId(), '_format' => 'html')) . '"><a href="">' . $user->getDisplayName() . '</a></span>';
}
public function getName()
{
return 'twig_userdataspan';
}
public function getName()
{
return 'twig_userdataspan';
}
}