Improve ICal export

This commit is contained in:
Frederic Guillot
2016-06-26 16:14:27 -04:00
parent 82623f1a21
commit 9a95621599
3 changed files with 15 additions and 4 deletions

View File

@@ -9,6 +9,7 @@ New features:
Improvements: Improvements:
* Improve ICal export
* Added argument owner_id and identifier to project API calls * Added argument owner_id and identifier to project API calls
* Rewrite integration tests to run with Docker containers * Rewrite integration tests to run with Docker containers
* Use the same task form layout everywhere * Use the same task form layout everywhere

View File

@@ -6,6 +6,7 @@ use DateTime;
use Eluceo\iCal\Component\Calendar; use Eluceo\iCal\Component\Calendar;
use Eluceo\iCal\Component\Event; use Eluceo\iCal\Component\Event;
use Eluceo\iCal\Property\Event\Attendees; use Eluceo\iCal\Property\Event\Attendees;
use Eluceo\iCal\Property\Event\Organizer;
use Kanboard\Core\Filter\FormatterInterface; use Kanboard\Core\Filter\FormatterInterface;
/** /**
@@ -117,16 +118,24 @@ class TaskICalFormatter extends BaseTaskCalendarFormatter implements FormatterIn
$vEvent->setModified($dateModif); $vEvent->setModified($dateModif);
$vEvent->setUseTimezone(true); $vEvent->setUseTimezone(true);
$vEvent->setSummary(t('#%d', $task['id']).' '.$task['title']); $vEvent->setSummary(t('#%d', $task['id']).' '.$task['title']);
$vEvent->setDescription($task['description']);
$vEvent->setDescriptionHTML($this->helper->text->markdown($task['description']));
$vEvent->setUrl($this->helper->url->base().$this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); $vEvent->setUrl($this->helper->url->base().$this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
if (! empty($task['owner_id'])) { if (! empty($task['owner_id'])) {
$vEvent->setOrganizer($task['assignee_name'] ?: $task['assignee_username'], $task['assignee_email']); $attendees = new Attendees;
$attendees->add(
'MAILTO:'.($task['assignee_email'] ?: $task['assignee_username'].'@kanboard.local'),
array('CN' => $task['assignee_name'] ?: $task['assignee_username'])
);
$vEvent->setAttendees($attendees);
} }
if (! empty($task['creator_id'])) { if (! empty($task['creator_id'])) {
$attendees = new Attendees; $vEvent->setOrganizer(new Organizer(
$attendees->add('MAILTO:'.($task['creator_email'] ?: $task['creator_username'].'@kanboard.local')); 'MAILTO:' . $task['creator_email'] ?: $task['creator_username'].'@kanboard.local',
$vEvent->setAttendees($attendees); array('CN' => $task['creator_name'] ?: $task['creator_username'])
));
} }
return $vEvent; return $vEvent;

View File

@@ -367,6 +367,7 @@ class TaskFinderModel extends Base
'ua.name AS assignee_name', 'ua.name AS assignee_name',
'ua.username AS assignee_username', 'ua.username AS assignee_username',
'uc.email AS creator_email', 'uc.email AS creator_email',
'uc.name AS creator_name',
'uc.username AS creator_username' 'uc.username AS creator_username'
); );
} }