Support #6920

Adding courses to Chamilo programatically

Added by Terence van Jaarsveldt over 6 years ago. Updated over 6 years ago.

Feature implemented
Web services
Target version:
Start date:
Due date:
% Done:


Estimated time:
SCRUM pts - complexity:



I have the need to do a batch import of courses into Chamilo programatically. I already got a script working that can create an empty course and add a general description to the course.

I did this by including the /main/inc/ file and using the classes in the different libraries to help me.

I add an empty course via the CourseManager class (course.lib.php).
I struggled to add a description to the course via a class and used the Database class to import a description via sql statements (this is a workaround, I know).

The next step is to import a learning path in the form of a scorm package. I do not know what class/methods to use as all my efforts has failed. I can't bypass this with sql statements again.

Can someone pleas direct me in the right direction in adding a learning path to the course and maybe how to properly add course descriptions as well? I don't know if this method of mine is the best solution but so far it works. If there is another way, please let me know.




Updated by Yannick Warnier over 6 years ago

  • Tracker changed from Feature to Support
  • Category set to Web services
  • Status changed from New to Feature implemented
  • Assignee set to Yannick Warnier
  • Target version set to 1.9.8
  • % Done changed from 0 to 100

Hi Terence,

Sorry for the delay. Been very busy.

For the courses creation, we recommend you look at either the main/cron/ directory inside Chamilo or the main/webservices/registration.soap.php file, as I believe both implement a way to create courses (at least webservices do).

For the import of SCORM packages, you can look into the main/newscorm/scorm.class.php file and in particular the import_package() method.
I don't have the right version of code under the eyes at the moment, but you can follow the process that is currently used (and check the get_zip_files_in_garbage() function) to upload scorm package as main/upload/index.php -> main/upload/scorm.form.php -> main/upload/upload.scorm.php -> main/newscorm/lp_upload.php (where you can see the call to scorm::import_package().

Hope it helps!

If you find you can contribute anything that comes out of your work, we're happy to help you include it into Chamilo.

I'm closing this support request to avoid interfering with tasks from 1.9.8, but feel free to continue commenting or to open a new task with your contributions if this gets to a happy conclusion.

Also available in: Atom PDF