$(document).ready(function(){
$( "#keyword_start_date_start" ).datepicker({ dateFormat: '."'yy-mm-dd'".' });
$( "#keyword_start_date_end" ).datepicker({ dateFormat: '."'yy-mm-dd'".' });
});
function validate(){
if( $("#keyword_start_date_start").val() != "" && $("#keyword_start_date_end").val() != ""){
datestart = $("#keyword_start_date_start").val();
dateend = $("#keyword_start_date_end").val();
dif = $.datepicker.parseDate("dd/mm/yy", datestart) - $.datepicker.parseDate("dd/mm/yy", dateend);
if(dif > 0){
alert("La fecha final no puede ser mayor a la fecha inicial");
return false;
}
}
}
function load_course_list (div_course,my_user_id) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
type: "GET",
url: "course_user_list.php",
data: "user_id="+my_user_id,
success: function(datos) {
$("div#user_request").html(datos);
$("#btnsubmit").attr("disabled", false);
}
});
}
';
$types = TicketManager::get_all_tickets_categories();
$htmlHeadXtra[] = '';
$htmlHeadXtra[] = '';
$tools = array();
$tools['todas']= array('id'=>'','name'=>get_lang('Todas'));
$tools['announcement']= array('id'=>'announcement','name'=>get_lang('Announcement'));
// $tools[]= array('id'=>'assignment','name'=>get_lang('Assignment'));
$tools['calendar_event']= array('id'=>'calendar_event','name'=>get_lang('Calendar_event'));
$tools['chat']= array('id'=>'chat','name'=>get_lang('Chat'));
$tools['conference']= array('id'=>'conference','name'=>get_lang('Conference'));
$tools['course_description']= array('id'=>'course_description','name'=>get_lang('Course_description'));
$tools['document']= array('id'=>'document','name'=>get_lang('Document'));
$tools['dropbox']= array('id'=>'dropbox','name'=>get_lang('Dropbox'));
$tools['group']= array('id'=>'group','name'=>get_lang('Group'));
$tools['learnpath']= array('id'=>'learnpath','name'=>get_lang('Learnpath'));
$tools['link']= array('id'=>'link','name'=>get_lang('Link'));
$tools['quiz']= array('id'=>'quiz','name'=>get_lang('Quiz'));
$tools['student_publication']= array('id'=>'student_publication','name'=>get_lang('Student_publication'));
$tools['user']= array('id'=>'user','name'=>get_lang('User'));
$tools['forum']= array('id'=>'forum','name'=>get_lang('Forum'));
function js_str($s) {
return '"'.addcslashes($s, "\0..\37\"\\").'"';
}
function show_form(){
global $types;
global $tools;
echo '
';
echo '
';
echo '
';
}
/**
* Get the total number of users on the platform
* @see SortableTable#get_total_number_of_items()
*/
function get_number_of_users() {
$user_table = Database :: get_main_table(TABLE_MAIN_USER);
$sql = "SELECT COUNT(u.user_id) AS total_number_of_items FROM $user_table u";
if ((api_is_platform_admin() || api_is_session_admin()) && api_get_multiple_access_url()) {
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
}
if ( isset ($_GET['keyword'])) {
$keyword = Database::escape_string(trim($_GET['keyword']));
$sql .= " WHERE (u.firstname LIKE '%".$keyword."%' OR u.lastname LIKE '%".$keyword."%' OR concat(u.firstname,' ',u.lastname) LIKE '%".$keyword."%' OR concat(u.lastname,' ',u.firstname) LIKE '%".$keyword."%' OR u.username LIKE '%".$keyword."%' OR u.email LIKE '%".$keyword."%' OR u.official_code LIKE '%".$keyword."%') ";
}
$res = Database::query($sql);
$obj = Database::fetch_object($res);
return $obj->total_number_of_items;
}
/**
* Get the users to display on the current page (fill the sortable-table)
* @param int offset of first user to recover
* @param int Number of users to get
* @param int Column to sort on
* @param string Order (ASC,DESC)
* @see SortableTable#get_table_data($from)
*/
function get_user_data($from, $number_of_items, $column, $direction)
{
$user_table = Database :: get_main_table(TABLE_MAIN_USER);
$admin_table = Database :: get_main_table(TABLE_MAIN_ADMIN);
$sql = "SELECT
u.user_id AS col0,
u.official_code AS col2,
".(api_is_western_name_order()
? "u.firstname AS col3,
u.lastname AS col4,"
: "u.lastname AS col3,
u.firstname AS col4,")."
u.username AS col5,
u.email AS col6,
u.status AS col7,
u.active AS col8,
u.user_id AS col9 ".
", u.expiration_date AS exp ".
" FROM $user_table u ";
if (isset ($_GET['keyword']) ) {
$keyword = Database::escape_string(trim($_GET['keyword']));
$sql .= " WHERE (u.firstname LIKE '%".$keyword."%' OR u.lastname LIKE '%".$keyword."%' OR concat(u.firstname,' ',u.lastname) LIKE '%".$keyword."%' OR concat(u.lastname,' ',u.firstname) LIKE '%".$keyword."%' OR u.username LIKE '%".$keyword."%' OR u.official_code LIKE '%".$keyword."%' OR u.email LIKE '%".$keyword."%' )";
}
if (!in_array($direction, array('ASC','DESC'))) {
$direction = 'ASC';
}
$column = intval($column);
$from = intval($from);
$number_of_items = intval($number_of_items);
$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";
$res = Database::query($sql);
$users = array ();
$t = time();
while ($user = Database::fetch_row($res)) {
$image_path = UserManager::get_user_picture_path_by_id($user[0], 'web', false, true);
$user_profile = UserManager::get_picture_user($user[0], $image_path['file'], 22, USER_IMAGE_SIZE_SMALL, ' width="22" height="22" ');
if (!api_is_anonymous()) {
$photo = '