parent
539616f7b7
commit
807cfa1b55
1 changed files with 64 additions and 13 deletions
|
@ -14,6 +14,15 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||||
use Hackspace\Bundle\CalciferBundle\Entity\Event;
|
use Hackspace\Bundle\CalciferBundle\Entity\Event;
|
||||||
use Hackspace\Bundle\CalciferBundle\Form\EventType;
|
use Hackspace\Bundle\CalciferBundle\Form\EventType;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use
|
||||||
|
Sabre\VObject,
|
||||||
|
Sabre\CalDAV,
|
||||||
|
Sabre\DAV,
|
||||||
|
Sabre\DAVACL,
|
||||||
|
Sabre\DAV\Exception\Forbidden,
|
||||||
|
Hackspace\Bundle\CalciferBundle\libs\CalciferCaldavBackend,
|
||||||
|
Hackspace\Bundle\CalciferBundle\libs\CalciferPrincipalBackend;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event controller.
|
* Event controller.
|
||||||
|
@ -22,6 +31,45 @@ use Hackspace\Bundle\CalciferBundle\Form\EventType;
|
||||||
*/
|
*/
|
||||||
class EventController extends Controller
|
class EventController extends Controller
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Finds and displays a Event entity.
|
||||||
|
*
|
||||||
|
* @Route("/{url}", name="events_caldav", requirements={"url" : "caldav(.+)"})
|
||||||
|
*/
|
||||||
|
public function caldavEntry()
|
||||||
|
{
|
||||||
|
// Backends
|
||||||
|
$calendarBackend = new CalciferCaldavBackend($this);
|
||||||
|
$principalBackend = new CalciferPrincipalBackend();
|
||||||
|
// Directory structure
|
||||||
|
$tree = [
|
||||||
|
new CalDAV\CalendarRootNode($principalBackend, $calendarBackend),
|
||||||
|
];
|
||||||
|
|
||||||
|
$server = new DAV\Server($tree);
|
||||||
|
|
||||||
|
$server->setBaseUri('/caldav');
|
||||||
|
|
||||||
|
/*$aclPlugin = new DAVACL\Plugin();
|
||||||
|
$aclPlugin->allowAccessToNodesWithoutACL = false;
|
||||||
|
$server->addPlugin($aclPlugin);*/
|
||||||
|
|
||||||
|
/* CalDAV support */
|
||||||
|
$caldavPlugin = new CalDAV\Plugin();
|
||||||
|
$server->addPlugin($caldavPlugin);
|
||||||
|
|
||||||
|
/* WebDAV-Sync plugin */
|
||||||
|
$server->addPlugin(new DAV\Sync\Plugin());
|
||||||
|
|
||||||
|
// Support for html frontend
|
||||||
|
$browser = new DAV\Browser\Plugin();
|
||||||
|
$server->addPlugin($browser);
|
||||||
|
|
||||||
|
// And off we go!
|
||||||
|
$server->exec();
|
||||||
|
return new Response();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists all Event entities.
|
* Lists all Event entities.
|
||||||
|
@ -49,6 +97,7 @@ class EventController extends Controller
|
||||||
'entities' => $entities,
|
'entities' => $entities,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Event entity.
|
* Creates a new Event entity.
|
||||||
*
|
*
|
||||||
|
@ -284,7 +333,8 @@ class EventController extends Controller
|
||||||
* @Method({"GET", "POST"})
|
* @Method({"GET", "POST"})
|
||||||
* @Template("CalciferBundle:Event:delete.html.twig")
|
* @Template("CalciferBundle:Event:delete.html.twig")
|
||||||
*/
|
*/
|
||||||
public function deleteAction(Request $request, $slug) {
|
public function deleteAction(Request $request, $slug)
|
||||||
|
{
|
||||||
/** @var EntityManager $em */
|
/** @var EntityManager $em */
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
@ -321,7 +371,8 @@ class EventController extends Controller
|
||||||
* @Method("GET")
|
* @Method("GET")
|
||||||
* @Template("CalciferBundle:Event:edit.html.twig")
|
* @Template("CalciferBundle:Event:edit.html.twig")
|
||||||
*/
|
*/
|
||||||
public function copyAction(Request $request, $slug) {
|
public function copyAction(Request $request, $slug)
|
||||||
|
{
|
||||||
/** @var EntityManager $em */
|
/** @var EntityManager $em */
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
|
Reference in a new issue