fill_courses.php 927 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /**
  3. * This script contains a data filling procedure for users
  4. * @author Yannick Warnier <yannick.warnier@beeznest.com>
  5. *
  6. */
  7. /**
  8. * Initialisation section
  9. */
  10. /**
  11. * Loads the data and injects it into the Chamilo database, using the Chamilo
  12. * internal functions.
  13. * @return array List of user IDs for the users that have just been inserted
  14. */
  15. function fill_courses() {
  16. $eol = PHP_EOL;
  17. $courses = array(); //declare only to avoid parsing notice
  18. require_once 'data_courses.php'; //fill the $users array
  19. $output = array();
  20. $output[] = array('title'=>'Courses Filling Report: ');
  21. $i = 1;
  22. foreach ($courses as $i => $course) {
  23. //first check that the first item doesn't exist already
  24. $output[$i]['line-init'] = $course['title'];
  25. $output[$i]['line-info'] = ($res = CourseManager::create_course($course)? $res: get_lang('NotInserted'));
  26. $i++;
  27. }
  28. return $output;
  29. }