One way to do it, is you may just want to just create a file for each teacher.
You can always make it a .php file and keep it's contents from being downloaded, if that's a concern.
Make the name of the file the same as the ID, and then you can have an easy time of restricting access to each teacher if that ever becomes needed.
To grab the data, you may want to use a regex to capture all data between "ASSIGN:" and "NOTE:", thus grabbing the assignment data. Then grab between "NOTE:" and the end of the file, grabbing your note data.
I have the feeling there is a better way, but that's one idea for you.