Fixing session progression graph see BT#2070

skala
Julio Montoya 14 years ago
parent 9897317bf9
commit 8bcbdef490
  1. 47
      main/inc/lib/tracking.lib.php
  2. 2
      main/session/index.php

@ -1986,6 +1986,7 @@ class Tracking {
$exercise_graph_list = array();
$exercise_graph_name_list = array();
$session_graph = array();
foreach ($course_in_session as $my_session_id=>$course_list) {
$session_name = api_get_session_name($my_session_id);
$user_count = count(SessionManager::get_users_by_session($session_id));
@ -2020,10 +2021,6 @@ class Tracking {
}
}
$html .= Display::tag('h2',api_get_session_name($key));
if (!empty($session_graph[$key])) {
$html .= $session_graph[$my_session_id];
}
$html .= '<table class="data_table" width="100%">';
$html .= '<tr>
'.Display::tag('th', get_lang('PublishedExercises'), array('width'=>'300px')).'
@ -2055,11 +2052,13 @@ class Tracking {
$html .= Display::tag('td', convert_to_percentage($all_average));
$html .='</table><br />';
if (!empty($session_graph[$key])) {
$html .= $session_graph[$my_session_id];
}
$html .= Display::tag('h2',get_lang('CourseList'));
$html .= '
<table class="data_table" width="100%">';
$html .= '<table class="data_table" width="100%">';
$html .= '
<tr>
<th width="300px">'.get_lang('Course').'</th>
@ -2124,9 +2123,7 @@ class Tracking {
$details .=Display::return_icon('2rightarrow.gif', get_lang('Details'));
}
$details .= '</a>';
$html .= Display::tag('td', $details, array('align'=>'center'));
$i = $i ? 0 : 1;
$html .= '</tr>';
}
@ -2326,7 +2323,13 @@ class Tracking {
return $html;
}
/**
* Generates an histogram
*
* @param array list of exercise names
* @param array my results 0 to 100
* @param array average scores 0-100
*/
function generate_session_exercise_graph($names, $my_results, $average) {
require_once api_get_path(LIBRARY_PATH).'pchart/pData.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pChart.class.php';
@ -2343,23 +2346,23 @@ class Tracking {
$data_set->AddPoint($names, "Serie3");
$data_set->AddAllSeries();
$data_set->SetAbsciseLabelSerie('Serie3');
$data_set->SetSerieName(get_lang('MyScore'),"Serie1");
$data_set->SetSerieName(get_lang('Average'),"Serie2");
$data_set->SetSerieName(get_lang('MyResults'),"Serie1");
$data_set->SetSerieName(get_lang('AverageScore'),"Serie2");
//$data_set->SetXAxisName(get_lang("Exercises"));
$data_set->SetYAxisName(get_lang("Percentage"));
$data_set->SetYAxisUnit("%");
// Initialise the graph
$main_width = 800;
$main_height = 430;
$main_width = 820;
$main_height = 440;
$y_label_angle = 35;
$data_set->RemoveSerie("Serie3");
$graph = new pChart($main_width, $main_height);
//$graph->setFixedScale(0,100);
$graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$graph->setGraphArea(80,30,$main_width-110,$main_height-110);
$graph->setGraphArea(75,50,$main_width-140, $main_height-120);
$graph->drawFilledRoundedRectangle(7,7,$main_width-7,$main_height-7,5,240,240,240);
$graph->drawRoundedRectangle(5,5,$main_width-5,$main_height -5,5,230,230,230);
$graph->drawGraphArea(255,255,255,TRUE);
@ -2379,9 +2382,9 @@ class Tracking {
// Finish the graph
$graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$graph->drawLegend($main_width - 100,30,$data_set->GetDataDescription(),255,255,255);
$graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',10);
$graph->drawTitle(50,22,'',50,50,50,$main_width-200);
$graph->drawLegend($main_width - 130,50,$data_set->GetDataDescription(),255,255,255);
$graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',11);
$graph->drawTitle(50, 30, get_lang('ExercisesInTimeProgressChart'), 50,50,50,$main_width-110, true);
// $main_graph = new pChart($main_width,$main_height);
@ -2402,6 +2405,12 @@ class Tracking {
return $html;
}
/**
*
* Returns a thumbnail of the function generate_exercise_result_graph
* @param array attempts
*/
function generate_exercise_result_thumbnail_graph($attempts) {
require_once api_get_path(LIBRARY_PATH).'pchart/pData.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pChart.class.php';
@ -2529,6 +2538,10 @@ class Tracking {
return $html;
}
/**
* Generates a big graph with the number of best results
* @param array
*/
function generate_exercise_result_graph($attempts) {
require_once api_get_path(LIBRARY_PATH).'pchart/pData.class.php';

@ -318,10 +318,12 @@ $(function() {
window.location.href=ui.tab;
});
//Generate tabs with jquery-ui
$('#tabs').tabs();
$( "#sub_tab" ).tabs();
<?php
//Displays js code to use a jqgrid
echo Display::grid_js('list_default', $url, $columns, $column_model,$extra_params,array(), '');
echo Display::grid_js('list_course', $url_course, $columns, $column_model,$extra_params_course,array(),'');
echo Display::grid_js('list_week', $url_week, $column_week, $column_week_model, $extra_params_week,array(),'');

Loading…
Cancel
Save