Skip to content

Instantly share code, notes, and snippets.

@yorikvanhavre
Created August 10, 2014 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yorikvanhavre/772999dd8797ec2bd9a2 to your computer and use it in GitHub Desktop.
Save yorikvanhavre/772999dd8797ec2bd9a2 to your computer and use it in GitHub Desktop.
ProjectPier : export tasks to google calendar - application/controllers/FeedController.class.php
187,189d186
< $todo = new iCalendar_Todo();
< $todo->setPropertyValue('SUMMARY', $project->getName().": ".$task->getText());
< $todo->setPropertyValue('UID', 'a9idfv00fd99q344o' . rand() . 'cgef733m6bs@google.com');
190a188,191
> $lines = explode("\n",$task->getText());
> $title = $lines[0];
> $title = preg_replace( "/\r|\n/", "", $title );
> $text = preg_replace( "/\r|\n/", " ", $task->getText() );
191a193,195
> $todo = new iCalendar_Event();
> $todo->setPropertyValue('SUMMARY', $project->getName().": ".$title);
> $todo->setPropertyValue('UID', 'a9idfv00fd99q344o' . rand() . 'cgef733m6bs@google.com');
193c197
< }
---
> $todo->setPropertyValue('DTEND', $date->format('Ymd'), array('VALUE' => 'DATE'));
199c203
< $todo->setPropertyValue('DESCRIPTION', 'Bla Bla Bla');
---
> $todo->setPropertyValue('DESCRIPTION', $text);
203,204c207,208
< $alarm->setPropertyValue('TRIGGER', '-P7D');
< $alarm->setPropertyValue('DESCRIPTION', $project->getName().": ".$task->getText());
---
> $alarm->setPropertyValue('TRIGGER', '-P1D');
> $alarm->setPropertyValue('DESCRIPTION', $project->getName().": ".$title);
208d211
<
210c213
<
---
> }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment