forked from Chouffe/magic-blog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Arthur Caillau
committed
Dec 26, 2012
1 parent
766abe1
commit abd0a4f
Showing
32 changed files
with
824 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,17 +41,54 @@ | |
<a class="brand" href="#">My Website</a> | ||
<div class="nav-collapse collapse"> | ||
<ul class="nav"> | ||
<li {% if page is defined %} {% if page == 'home'%} class="active" {% endif %} {% endif %}><a href="{{ path('home') }}">Home</a></li> | ||
<li {% if page is defined %} {% if page == 'gallery'%} class="active" {% endif %} {% endif %}><a href="{{ path('gallery') }}">Gallery</a></li> | ||
<li {% if page is defined %} {% if page == 'about'%} class="active" {% endif %} {% endif %}><a href="{{ path('about') }}">About</a></li> | ||
<li {% if page is defined %} {% if page == 'contact'%} class="active" {% endif %} {% endif %}><a href="{{ path('contact') }}">Contact</a></li> | ||
<li{% if page is defined %} {% if page == 'home'%} class="active" {% endif %} {% endif %}><a href="{{ path('home') }}"><i class="icon-home icon-white"> </i></a></li> | ||
<li{% if page is defined %} {% if page == 'gallery'%} class="active" {% endif %} {% endif %}><a href="{{ path('gallery') }}"><i class="icon-picture icon-white"> </i></a></li> | ||
<li{% if page is defined %} {% if page == 'about'%} class="active" {% endif %} {% endif %}><a href="{{ path('about') }}"><i class="icon-question-sign icon-white"> </i></a></li> | ||
<li><a href="#email" data-toggle="modal"><i class="icon-envelope icon-white"> </i></a></li> | ||
</ul> | ||
</div><!--/.nav-collapse --> | ||
</div> | ||
</div> | ||
</div> | ||
<div id="email" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | ||
<h3 id="myModalLabel">Send me an email</h3> | ||
</div> | ||
<div class="modal-body"> | ||
<form class="form-horizontal"> | ||
<div class="control-group"> | ||
<label class="control-label" for="inputEmail">Your Email</label> | ||
<div class="controls"> | ||
<input type="text" id="inputEmail" placeholder="[email protected]"><br /> | ||
</div> | ||
</div> | ||
<div class="control-group"> | ||
<label class="control-label" for="subject">Subject</label> | ||
<div class="controls"> | ||
<select name="subject"> | ||
<option value="">1</option> | ||
<option>2</option> | ||
<option>3</option> | ||
<option>4</option> | ||
</select> | ||
</div> | ||
|
||
</div> | ||
<div class="control-group"> | ||
<label class="control-label" for="content">Content</label> | ||
<div class="controls"> | ||
<textarea rows="8" name="content" id="content"></textarea> | ||
|
||
{# render "SdzBlogBundle:Blog:menu" with {'nombre': 3} #} | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
<div class="modal-footer"> | ||
<a href="#" class="btn" data-dismiss="modal">Close</a> | ||
<a href="#" class="btn btn-primary">Send email</a> | ||
</div> | ||
</div> | ||
|
||
<header id="header1"> | ||
<div class="container"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
namespace Chouffe\MagicBundle\Controller; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Chouffe\MagicBundle\Entity\Event; | ||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; | ||
use JMS\SecurityExtraBundle\Annotation\Secure; | ||
use Chouffe\MagicBundle\Form\EventType; | ||
|
||
|
||
class EventController extends Controller | ||
{ | ||
|
||
/** | ||
* @Secure(roles="ROLE_ADMIN") | ||
*/ | ||
public function addAction() | ||
{ | ||
$event = new Event(); | ||
$form = $this->createForm(new EventType, $event); | ||
|
||
// La gestion d'un formulaire est particulière, mais l'idée est la suivante | ||
if( $this->get('request')->getMethod() == 'POST' ) | ||
{ | ||
// Ici, on s'occupera de la création et de la gestion du formulaire | ||
$request = $this->get('request'); | ||
$form->bind($request); | ||
|
||
$em = $this->getDoctrine()->getManager(); | ||
$em->persist($event); | ||
$em->flush(); | ||
|
||
$this->get('session')->getFlashBag()->add('notice', 'Event saved'); | ||
return new Response('1'); | ||
} | ||
|
||
|
||
return new Response('0'); | ||
} | ||
/** | ||
* @Secure(roles="ROLE_ADMIN") | ||
*/ | ||
public function deleteAction(Event $event) | ||
{ | ||
$em = $this->getDoctrine()->getManager(); | ||
$em->remove($event); | ||
|
||
$response = new Response('1'); | ||
$em->flush(); | ||
return $response; | ||
} | ||
|
||
public function agendaAction() | ||
{ | ||
$em = $this->getDoctrine()->getManager(); | ||
$repo = $em->getRepository('ChouffeMagicBundle:Event'); | ||
$eventList = $repo->findAll(); | ||
|
||
$event = new Event(); | ||
$formEvent = $this->createForm(new EventType, $event); | ||
|
||
return $this->render('ChouffeMagicBundle:Default:event.html.twig', array('formEvent' => $formEvent->createView(), 'eventList' => $eventList)); | ||
|
||
} | ||
|
||
public function seeAction(Event $event) | ||
{ | ||
return $this->render('ChouffeMagicBundle:Default:event-zoom.html.twig', array('event' => $event)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.