Todo taks suscription by ical

With this patch the ical suscription include your pending tasks.
Now i can suscribe to my pending tasks in evolution using ical suscription.

--- FeedController.class.php 2007-07-08 08:40:20.000000000 +0200
+++ FeedController.class.php 2007-11-28 18:50:34.963009715 +0100
@@ -115,7 +115,7 @@
die();
} // if

- $this->renderCalendar($user, lang('user calendar', $user->getDisplayName()), $user->getActiveMilestones());
+ $this->renderCalendar($user, lang('user calendar', $user->getDisplayName()), $user->getActiveMilestones(), $user->getActiveProjects());
} // user_ical

/**
@@ -154,13 +154,27 @@
* @param array $milestones
* @return null
*/
- private function renderCalendar(User $user, $calendar_name, $milestones) {
+ private function renderCalendar(User $user, $calendar_name, $milestones, $user_active_projects) {
$calendar = new iCalendar_Calendar();
$calendar->setPropertyValue('VERSION', '2.0');
$calendar->setPropertyValue('PRODID', '-//Apple Computer\, Inc//iCal 1.5//EN');
$calendar->setPropertyValue('X-WR-CALNAME', $calendar_name);
$calendar->setPropertyValue('X-WR-TIMEZONE', 'GMT');

+ foreach($user_active_projects as $project) {
+ $assigned_tasks = $project->getUsersTasks(logged_user());
+ if(is_array($assigned_tasks)) {
+ foreach($assigned_tasks as $task) {
+ $todo = new iCalendar_Todo();
+ $todo->setPropertyValue('SUMMARY', $task->getText());
+ $todo->setPropertyValue('UID', $task->getId());
+ $todo->setPropertyValue('PRIORITY', 1);
+ $todo->setPropertyValue('STATUS', "NEEDS-ACTION");
+ $todo->setPropertyValue('URL', $task->getCompleteUrl());
+ $calendar->addComponent($todo);
+ }
+ }
+ }
if(is_array($milestones)) {
foreach($milestones as $milestone) {
if(!$user->isMemberOfOwnerCompany() && $milestone->isPrivate()) continue; // hide private milestone
@@ -181,6 +195,8 @@
} // if
} // foreach
} // if
+
+

header('Content-Disposition: inline; filename=calendar.ics');
$this->renderText(iCalendar::render($calendar), true);
@@ -236,4 +252,4 @@

} // FeedController

-?>
\ No hay ningún carácter de nueva línea al final del fichero
+?>

Hi,

Its great that you created this patch, can you please create an issue for this and attach the patch file there? This will prevent any formatting problems

I hope this patch will be usefull to someone.

http://www.projectpier.org/node/491

Regards

Much appreciated, and I'm sure it'll get tested more now.