Picture of aashwin malik
Adding content programmatically?
by aashwin malik - Monday, 6 November 2017, 11:24 AM
 

Is there way to add components to a course programmatically ? 

Picture of Matt Leathes
Re: Adding content programmatically?
by Matt Leathes - Monday, 6 November 2017, 1:01 PM
 

Well sure; how you'd do this would be very dependent on your requirements. If you could go into a bit more detail about that we might be able to help...

Picture of aashwin malik
Re: Adding content programmatically?
by aashwin malik - Tuesday, 7 November 2017, 3:45 AM
 
I researched a bit on the github pages yesterday and have come up with the following strategy : 1. Try to pick data from the database . 2. create a component specific json , course object json through some script. 3.Build the course using the framework. 4.Finally upload it to some webserver. Is it the right strategy or can we directly add components programmatically ? Something like adapt.getCourse.ById(id).getArticle(id).getBlock(id).addComponent()
Picture of aashwin malik
Re: Adding content programmatically?
by aashwin malik - Tuesday, 7 November 2017, 4:34 AM
 

Basically , we have a question pool in database and we are trying to build an assessment by adding question components programmatically. 

Picture of Matt Leathes
Re: Adding content programmatically?
by Matt Leathes - Tuesday, 7 November 2017, 10:01 AM
 

No, there isn't anything like adapt.getCourse.ById(id).getArticle(id).getBlock(id).addComponent()

If you just want to be able to add questions to the JSON then you just need to be able to output the JSON files that contain all the Adapt content.

If you want to be able to add questions whilst the course is running then that's a very different matter indeed, potentially quite complex.

I haven't done server-side programming in a while but I presume there's some way to get the server to respond with dynamically-created JSON files when the course loads. Could be a good solution?

Picture of aashwin malik
Re: Adding content programmatically?
by aashwin malik - Wednesday, 8 November 2017, 10:28 AM
 

Thanks Matt. We will stick to creating json files  and add question components to the course .