I'm trying to make a 'learning' site, something similar to Codecademy but for a small company. The setup at the moment is that I have a Training channel, with description and courses channel fields. Courses is a grid field with the name and title of the resource (so a book or video etc) and also a checkbox that will show whether the user has completed that resource. The channel entries will be for example, 'HTML' and then the description will be a little bit about HTML, and the grid will contain a list of books, videos etc about learning HTML.

I can set up with jQuery and AJAX to check whether the checkbox should be checked from the database, but the issue is that different members will have different things completed. What's the best way to organise the data so I can record who has done what? Would it be easier to do a separate channel for the resources and use relationships to link it to the types of training, then relationships to the member ID for the checkbox?


...and also a checkbox that will show whether the user has completed that resource

You can't store the member choices in the channel entries information. Well, technically you could, but it would have to store every members details so not optimal and not recommended.

I'm assuming there could be a crossover - so 2 courses could share the same resource. So therefore a better approach would be making the resources a separate channel, linking the course to the resource via a relationship.

The user (member) progress would have to be stored either via a custom add-on and database, or (easier) via a custom field in the member data. It won't be flexible to have a separate member field for each course (or resource), as that will mean each time a new course is added, new member fields would need to be added. Because you're going to be using Ajax to set and retrieve the user progress, I'd suggest a single member field for progress. In this store a JSON encoded array representing each course and resource, say with keys of each entry ID, for example:

{1:[{10:0, 11:1, 12:0, 13:1}], 2:[{12:1,14:0,15:1}], etc

(Note: mocked up and probably not correct JSON format!)

Entry IDs 1 and 2 would be the course entry IDs. 10 - 15 would be resources. 1 and 0 values would be if they completed the resource. You could take this further to show scores, time spent, whatever.

In your JavaScript you could then decode the JSON and have all the information readily available as an array.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.