fill_users.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php //$id$
  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_users()
  16. {
  17. $users = array(); //declare only to avoid parsing notice
  18. require_once 'data_users.php'; //fill the $users array
  19. $output = array();
  20. $output[] = array('title'=>'Users Filling Report:');
  21. foreach ($users as $i => $user) {
  22. //first check that the first item doesn't exist already
  23. $output[$i]['line-init'] = $user['firstname'];
  24. $res = UserManager::create_user(
  25. $user['firstname'],
  26. $user['lastname'],
  27. $user['status'],
  28. $user['email'],
  29. $user['username'],
  30. $user['pass'],
  31. null,
  32. null,
  33. null,
  34. null,
  35. $user['auth_source'],
  36. null,
  37. $user['active']
  38. );
  39. $output[$i]['line-info'] = $res ? get_lang('Inserted') : get_lang('NotInserted');
  40. }
  41. return $output;
  42. }