Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chamilo-lms/tests/datafiller/fill_whoisonline.php

32 lines
932 B

<?php //$id$
/**
* This script contains a data filling procedure for users
* @author Julio Montoya <gugli100@gmail.com>
*
*/
/**
* Initialisation section
*/
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
/**
* Loads the data and injects it into the Dokeos database, using the Dokeos
* internal functions.
* @return array List of user IDs for the users that have just been inserted
*/
function fill_whoisonline() {
$table_e_online = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$max = 100;
//Cleaning the table
$sql = "TRUNCATE $table_e_online";
$rs = Database::query($sql);
//filling the table
for ($i=1;$i <=$max;$i++) {
$date = api_get_local_time();
$sql = "INSERT INTO $table_e_online (login_id, login_user_id, login_date, login_ip, course, session_id, access_url_id)
VALUES ('$i', '$i', '$date', '127.0.0.1', '', '0','1')";
$rs = Database::query($sql);
}
}