fill_users.php 1.1 KB

12345678910111213141516171819202122232425262728293031
  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. $eol = PHP_EOL;
  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. $i = 1;
  22. foreach ($users as $i => $user) {
  23. //first check that the first item doesn't exist already
  24. $output[$i]['line-init'] = $user['firstname'];
  25. $res = UserManager::create_user($user['firstname'],$user['lastname'],$user['status'],$user['email'],$user['username'],$user['pass'],null,null,null,null,$user['auth_source'],null,$user['active']);
  26. $output[$i]['line-info'] = $res ? get_lang('Inserted') : get_lang('NotInserted');
  27. $i++;
  28. }
  29. return $output;
  30. }