Previously I’ve made a connection to Evernote and display list of all notes. Nice. But the project is about managing reminders, so let’s go to work!

Receiving reminders

First of all, I want to display only notes with reminders. It could be done using NoteFilter. It’s enough to add just one line:

$nFilter->words = "reminderTime:* -reminderDoneTime:*";

It says Evernote to get only notes with any reminder time and not the ones with status done. You can actually try it in the Evernote application – paste reminderTime:* -reminderDoneTime:* in the search bar and you will receive exactly that – all notes with reminders which are not done yet. Perfect.

Receiving information about reminders

Next action will be displaying reminder time on the list. This information is available in the note’s attributes. I must say Evernote to return this information with the notes, but it is also oneliner:

$rSpec->includeAttributes = true;

One more thing. For now received notes are ordered by creation date. Let’s change it to reminder date, which is much more intuitive. Unfortunately, I didn’t find a way to do it during the request, so I must do it after receiving the notes. The function is very simple:

Now just use this function to sort the notes before passing them to the foreach loop

Displaying information about reminders

Now I have all information I need. It’s time to display them.

I have prepared the field in the Note’s model, so I must just fill this information. Because reminder time in Evernote is stored as a timestamp in microseconds I have to divide it by 1000.

Go to app/Resources/views/note/list.html.twig and change displayed date from creation date to reminder date:
reminder: {{ note.remindAt | date("Y-m-d H:i:s") }}

Summary

And this is all for today. Thanks to some simple changes I have now the list of notes that I really want in proper order. Now go to your Evernote and add some notes with reminders, set them as done and watch how your application is reacting.

As always, you can find all the code described in this post on GitHub.

Next time I’ll show you how to add notes from our application and how to set reminders as done. Stay tuned!

Don’t forget to check out other PHPhyts!