generate/recover training sequence in index.php

- Restructured index.php to generate, or recover, the entire sequence of
training trials for a given participant, including category, type
(active/intermediate/passive), and problem ID. The reason for doing
this, instead of generating trial content on a trial-by-trial basis, is
that we need to ensure that participants use the same problem ID within
each "cycle" of training trials. This update only provides the
structure; the actual functionality will be added in a later commit.
- Also added structure for generating posttest content; actual content
will be added later.