Added sessions list icon in admin's users list - refs BT#6451

1.9.x
Yannick Warnier 11 years ago
parent 69f3809a1c
commit b7034b0e74
  1. 31
      main/admin/user_list.php
  2. BIN
      main/img/icons/22/course_na.png
  3. 1
      main/inc/ajax/course.ajax.php
  4. 32
      main/inc/ajax/session.ajax.php

@ -21,6 +21,7 @@ if (isset($_configuration['deny_delete_users']) && $_configuration['deny_delete
$delete_user_available = false;
}
$url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=get_user_courses';
$urlSession = api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=get_user_sessions';
$htmlHeadXtra[] = '<script type="text/javascript">
function load_course_list (div_course,my_user_id) {
@ -38,6 +39,21 @@ function load_course_list (div_course,my_user_id) {
}
});
}
function load_session_list (div_session,my_user_id) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("div#"+div_session).html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "POST",
url: "'.$urlSession.'",
data: "user_id="+my_user_id,
success: function(datos) {
$("div#"+div_session).html(datos);
$("div#div_s_"+my_user_id).attr("class","blackboard_show");
$("div#div_s_"+my_user_id).attr("style","");
}
});
}
function active_user(element_div) {
id_image=$(element_div).attr("id");
@ -80,6 +96,10 @@ function clear_course_list (div_course) {
$("div#"+div_course).html("&nbsp;");
$("div#"+div_course).hide("");
}
function clear_session_list (div_session) {
$("div#"+div_session).html("&nbsp;");
$("div#"+div_session).hide("");
}
function display_advanced_search_form () {
if ($("#advanced_search_form").css("display") == "none") {
@ -503,11 +523,16 @@ function modify_filter($user_id, $url_params, $row) {
$result = '';
if (!$user_is_anonymous) {
$result .= '<a href="javascript:void(0)" onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')" >
<img onmouseout="clear_course_list (\'div_'.$user_id.'\')" src="../img/course.gif" title="'.get_lang('Courses').'" alt="'.get_lang('Courses').'"/>
<img onmouseout="clear_course_list (\'div_'.$user_id.'\')" src="../img/icons/22/course.png" title="'.get_lang('Courses').'" alt="'.get_lang('Courses').'"/>
<div class="blackboard_hide" id="div_'.$user_id.'">&nbsp;&nbsp;</div>
</a>&nbsp;&nbsp;';
$result .= '<a href="javascript:void(0)" onclick="load_session_list(\'div_s_'.$user_id.'\','.$user_id.')" >
<img onmouseout="clear_session_list (\'div_s_'.$user_id.'\')" src="../img/icons/22/session.png" title="'.get_lang('Sessions').'" alt="'.get_lang('Sessions').'"/>
<div class="blackboard_hide" id="div_s_'.$user_id.'">&nbsp;&nbsp;</div>
</a>&nbsp;&nbsp;';
} else {
$result .= Display::return_icon('course_na.gif',get_lang('Courses')).'&nbsp;&nbsp;';
$result .= Display::return_icon('course_na.png',get_lang('Courses')).'&nbsp;&nbsp;';
$result .= Display::return_icon('course_na.png',get_lang('Sessions')).'&nbsp;&nbsp;';
}
if (api_is_platform_admin()) {
@ -933,4 +958,4 @@ $tpl = new Template($tool_name);
$tpl->assign('actions', $actions);
$tpl->assign('message', $message);
$tpl->assign('content', $form.$table_result.$extra_search_options);
$tpl->display_one_col_template();
$tpl->display_one_col_template();

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

@ -4,6 +4,7 @@
* Responses to AJAX calls
*/
$language_file[] = 'admin';
require_once '../global.inc.php';
$action = $_REQUEST['a'];

@ -0,0 +1,32 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Responses to AJAX calls
*/
$language_file[] = 'admin';
require_once '../global.inc.php';
$action = $_REQUEST['a'];
//$user_id = api_get_user_id();
switch ($action) {
case 'get_user_sessions':
if (api_is_platform_admin()) {
$user_id = intval($_POST['user_id']);
$list_sessions = SessionManager::get_sessions_by_user($user_id);
if (!empty($list_sessions)) {
foreach($list_sessions as $session_item) {
echo $session_item['session_name'].'<br />';
}
} else {
echo get_lang('NoSessionsForThisUser');
}
unset($list_sessions);
}
break;
default:
echo '';
}
exit;
Loading…
Cancel
Save