Added the url to the ics file.

This commit is contained in:
Tim Schumacher 2014-07-31 09:51:34 +02:00
parent f554de91ba
commit 4f187ad08a
4 changed files with 31 additions and 5 deletions

View file

@ -33,7 +33,7 @@
"incenteev/composer-parameter-handler": "~2.0",
"jquery/jquery": "1.10.*",
"knplabs/knp-markdown-bundle": "~1.3",
"jsvrcek/ics": "dev-master",
"enko/ics": "~0.1",
"doctrine/migrations": "dev-master",
"doctrine/doctrine-migrations-bundle": "dev-master",
"jbroadway/urlify" : "~1.0"

View file

@ -24,7 +24,7 @@ use Jsvrcek\ICS\Model\Relationship\Organizer;
use Jsvrcek\ICS\Utility\Formatter;
use Jsvrcek\ICS\CalendarStream;
use Jsvrcek\ICS\CalendarExport;
use Symfony\Component\Validator\Constraints\DateTime;
use Jsvrcek\ICS\Model\Description\Geo;
/**
* Location controller.
@ -82,6 +82,18 @@ class LocationController extends Controller
if ($entity->enddate instanceof \DateTime)
$event->setEnd($entity->enddate);
$event->setSummary($entity->summary);
$event->setUrl($entity->url);
if ($entity->location instanceof Location) {
$location = new \Jsvrcek\ICS\Model\Description\Location();
$location->setName($entity->location->name);
$event->setLocations([$location]);
if (\is_float($entity->location->lon) && \is_float($entity->location->lat)) {
$geo = new Geo();
$geo->setLatitude($entity->location->lat);
$geo->setLongitude($entity->location->lon);
$event->setGeo($geo);
}
}
$event->setDescription($entity->description);
$location = new \Jsvrcek\ICS\Model\Description\Location();
$location->setName($entity->getLocation()->name);

View file

@ -7,6 +7,7 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Hackspace\Bundle\CalciferBundle\Entity\Location;
use Hackspace\Bundle\CalciferBundle\Entity\Tag;
use Jsvrcek\ICS\Model\Description\Geo;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
@ -79,9 +80,18 @@ class TagController extends Controller
$event->setEnd($entity->enddate);
$event->setSummary($entity->summary);
$event->setDescription($entity->description);
$location = new \Jsvrcek\ICS\Model\Description\Location();
$location->setName($entity->location->name);
$event->setLocations([$location]);
$event->setUrl($entity->url);
if ($entity->location instanceof Location) {
$location = new \Jsvrcek\ICS\Model\Description\Location();
$location->setName($entity->location->name);
$event->setLocations([$location]);
if (\is_float($entity->location->lon) && \is_float($entity->location->lat)) {
$geo = new Geo();
$geo->setLatitude($entity->location->lat);
$geo->setLongitude($entity->location->lon);
$event->setGeo($geo);
}
}
$calendar->addEvent($event);
}

View file

@ -7,6 +7,10 @@ use Doctrine\ORM\Mapping as ORM;
/**
* Location
*
* @property string $name
* @property float $lon
* @property float $lat
*
* @ORM\Table(name="locations")
* @ORM\Entity
*/