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.
110 lines
2.8 KiB
110 lines
2.8 KiB
13 years ago
|
<?php
|
||
|
/* See license terms in /license.txt */
|
||
|
|
||
|
require_once '../inc/global.inc.php';
|
||
10 years ago
|
|
||
13 years ago
|
$this_section = SECTION_COURSES;
|
||
|
$exercise_id = (isset($_GET['exerciseId']) && !empty($_GET['exerciseId'])) ? intval($_GET['exerciseId']) : 0;
|
||
|
|
||
13 years ago
|
// Access control
|
||
|
api_protect_course_script(true);
|
||
|
|
||
|
if (!api_is_allowed_to_edit()) {
|
||
|
api_not_allowed();
|
||
|
}
|
||
|
|
||
13 years ago
|
$objExercise = new Exercise();
|
||
|
$result = $objExercise->read($exercise_id);
|
||
|
|
||
|
if (!$result) {
|
||
11 years ago
|
api_not_allowed(true);
|
||
|
}
|
||
13 years ago
|
|
||
9 years ago
|
$interbreadcrumb[] = array(
|
||
|
"url" => "exercise.php?".api_get_cidreq(),
|
||
|
"name" => get_lang('Exercises'),
|
||
|
);
|
||
|
$interbreadcrumb[] = array(
|
||
|
"url" => "admin.php?exerciseId=$exercise_id&".api_get_cidreq(),
|
||
|
"name" => $objExercise->name,
|
||
|
);
|
||
13 years ago
|
|
||
|
//Add the JS needed to use the jqgrid
|
||
13 years ago
|
$htmlHeadXtra[] = api_get_jqgrid_js();
|
||
13 years ago
|
|
||
|
// The header.
|
||
13 years ago
|
Display::display_header(get_lang('StudentsWhoAreTakingTheExerciseRightNow'));
|
||
13 years ago
|
|
||
|
//jqgrid will use this URL to do the selects
|
||
|
|
||
13 years ago
|
$minutes = 60;
|
||
9 years ago
|
$url = api_get_path(WEB_AJAX_PATH).'exercise.ajax.php?a=get_live_stats&exercise_id='.$objExercise->id.'&minutes='.$minutes;
|
||
13 years ago
|
|
||
11 years ago
|
//The order is important you need to check the the $column variable in the model.ajax.php file
|
||
13 years ago
|
$columns = array(get_lang('FirstName'), get_lang('LastName'), get_lang('Time'), get_lang('QuestionsAlreadyAnswered'), get_lang('Score'));
|
||
13 years ago
|
|
||
|
//Column config
|
||
9 years ago
|
$column_model = array(
|
||
|
array(
|
||
|
'name' => 'firstname',
|
||
|
'index' => 'firstname',
|
||
|
'width' => '100',
|
||
|
'align' => 'left',
|
||
|
),
|
||
|
array(
|
||
|
'name' => 'lastname',
|
||
|
'index' => 'lastname',
|
||
|
'width' => '100',
|
||
|
'align' => 'left',
|
||
|
),
|
||
|
array(
|
||
|
'name' => 'start_date',
|
||
|
'index' => 'start_date',
|
||
|
'width' => '100',
|
||
|
'align' => 'left',
|
||
|
),
|
||
|
array(
|
||
|
'name' => 'question',
|
||
|
'index' => 'count_questions',
|
||
|
'width' => '60',
|
||
|
'align' => 'left',
|
||
|
'sortable' => 'false',
|
||
|
),
|
||
|
array(
|
||
|
'name' => 'score',
|
||
|
'index' => 'score',
|
||
|
'width' => '50',
|
||
|
'align' => 'left',
|
||
|
'sortable' => 'false',
|
||
|
),
|
||
|
);
|
||
11 years ago
|
//Autowidth
|
||
13 years ago
|
$extra_params['autowidth'] = 'true';
|
||
11 years ago
|
//height auto
|
||
|
$extra_params['height'] = 'auto';
|
||
13 years ago
|
?>
|
||
|
<script>
|
||
13 years ago
|
|
||
|
function refreshGrid() {
|
||
|
var grid = $("#live_stats");
|
||
|
grid.trigger("reloadGrid");
|
||
13 years ago
|
t = setTimeout("refreshGrid()", 10000);
|
||
13 years ago
|
}
|
||
|
|
||
13 years ago
|
$(function() {
|
||
11 years ago
|
<?php
|
||
|
echo Display::grid_js('live_stats', $url, $columns, $column_model, $extra_params, array(), null, true);
|
||
13 years ago
|
?>
|
||
13 years ago
|
refreshGrid();
|
||
13 years ago
|
});
|
||
|
</script>
|
||
|
<?php
|
||
|
|
||
9 years ago
|
$actions = '<a href="exercise_report.php?exerciseId='.intval($_GET['exerciseId']).'&'.api_get_cidreq().'">' .
|
||
|
Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
|
||
13 years ago
|
echo $actions = Display::div($actions, array('class'=> 'actions'));
|
||
|
|
||
11 years ago
|
echo Display::grid_html('live_stats');
|
||
13 years ago
|
|
||
13 years ago
|
Display::display_footer();
|