added student horizontal bar graph - partial BT#540

skala
Cristian Fasanando 15 years ago
parent 137e3d93f1
commit db50119163
  1. 2
      main/mySpace/session.php
  2. 282
      plugin/dashboard/block_evaluation_graph/block_evaluation_graph.class.php
  3. 3
      plugin/dashboard/block_session/block_session.class.php
  4. 18
      plugin/dashboard/block_student/block_student.class.php
  5. 104
      plugin/dashboard/block_student_graph/block_student_graph.class.php
  6. 20
      plugin/dashboard/block_teacher/block_teacher.class.php
  7. 5
      plugin/dashboard/block_teacher_graph/block_teacher_graph.class.php

@ -139,7 +139,7 @@ if ($nb_sessions > 0) {
//$row[] = $session['status'];
if ($session['date_start'] != '0000-00-00' && $session['date_end'] != '0000-00-00') {
$row[] = get_lang('From').' '.format_locale_date(get_lang('DateFormatLongWithoutDay'), strtotime($session['date_start'])).' '.get_lang('To').' '.format_locale_date(get_lang('DateFormatLongWithoutDay'), strtotime($session['date_end']));
$row[] = get_lang('From').' '.format_locale_date(DATE_FORMAT_LONG_WITHOUT_DAY, strtotime($session['date_start'])).' '.get_lang('To').' '.format_locale_date(DATE_FORMAT_LONG_WITHOUT_DAY, strtotime($session['date_end']));
} else {
$row[] = ' - ';
}

@ -16,6 +16,9 @@ require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pData.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pChart.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pCache.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/gradebookitem.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/evaluation.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/linkfactory.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/flatview_data_generator.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/gradebook_functions.inc.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php';
@ -32,20 +35,40 @@ class BlockEvaluationGraph extends Block {
private $courses;
private $sessions;
private $path;
private $permission = array(DRH, SESSIONADMIN);
/**
* Constructor
*/
public function __construct ($user_id) {
$this->path = 'block_evaluation_graph';
$this->user_id = $user_id;
if (api_is_platform_admin()) {
$this->courses = CourseManager::get_real_course_list();
$this->sessions = SessionManager::get_sessions_list();
} else if (api_is_drh()) {
$this->courses = CourseManager::get_courses_followed_by_drh($user_id);
$this->sessions = SessionManager::get_sessions_followed_by_drh($user_id);
}
$this->user_id = $user_id;
if ($this->is_block_visible_for_user($user_id)) {
/*if (api_is_platform_admin()) {
$this->courses = CourseManager::get_real_course_list();
$this->sessions = SessionManager::get_sessions_list();
} else {*/
if (!api_is_session_admin()) {
$this->courses = CourseManager::get_courses_followed_by_drh($user_id);
}
$this->sessions = SessionManager::get_sessions_followed_by_drh($user_id);
//}
}
}
/**
* This method check if a user is allowed to see the block inside dashboard interface
* @param int User id
* @return bool Is block visible for user
*/
public function is_block_visible_for_user($user_id) {
$user_info = api_get_user_info($user_id);
$user_status = $user_info['status'];
$is_block_visible_for_user = false;
if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) {
$is_block_visible_for_user = true;
}
return $is_block_visible_for_user;
}
/**
@ -107,126 +130,104 @@ class BlockEvaluationGraph extends Block {
* This method return a graph containing informations about evaluations inside base courses, it's used inside get_block method for showing it inside dashboard interface
* @return string img html
*/
public function get_evaluations_base_courses_graph() {
$graphs = array();
$courses_code = array_keys($this->courses);
foreach ($courses_code as $course_code) {
$cats = Category::load(null, null, $course_code, null, null, null, false);
if (isset($cats)) {
$alleval = $cats[0]->get_evaluations(null, true, $course_code);
$alllinks = $cats[0]->get_links(null, true);
$users = get_all_users($alleval, $alllinks);
$datagen = new FlatViewDataGenerator ($users, $alleval, $alllinks);
$evaluation_sumary = $datagen->get_evaluation_sumary_results();
if (!empty($evaluation_sumary)) {
$items = array_keys($evaluation_sumary);
$max = $min = $avg = array();
foreach ($evaluation_sumary as $evaluation) {
$max[] = $evaluation['max'];
$min[] = $evaluation['min'];
$avg[] = $evaluation['avg'];
}
// Dataset definition
$data_set = new pData;
$data_set->AddPoint($max, "Max");
$data_set->AddPoint($avg, "Avg");
$data_set->AddPoint($min, "Min");
$data_set->AddPoint($items, "Items");
$data_set->SetXAxisName(get_lang('Step'));
$data_set->SetYAxisName(get_lang('Percentage'));
$data_set->AddAllSeries();
$data_set->RemoveSerie("Items");
$data_set->SetAbsciseLabelSerie("Items");
$graph_id = $this->user_id.'StudentEvaluationGraph';
$cache = new pCache();
// the graph id
$data = $data_set->GetData();
if ($cache->IsInCache($graph_id, $data)) {
//if we already created the img
$img_file = $cache->GetHash($graph_id, $data);
} else {
// Initialise the graph
$test = new pChart(450,260);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test->setGraphArea(50,30,375,200);
$test->drawFilledRoundedRectangle(7,7,373,223,5,240,240,240);
$test->drawRoundedRectangle(5,5,375,225,5,230,230,230);
$test->drawGraphArea(255,255,255,TRUE);
$test->setFixedScale(0,100,5);
$test->drawScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_ADDALL,150,150,150,TRUE,0,2,TRUE);
$test->setColorPalette(0,125,201,44);
$test->setColorPalette(1,255,138,0);
$test->setColorPalette(2,255,0,0);
$test->drawGrid(4,TRUE,230,230,230,50);
// Draw the 0 line
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',6);
$test->drawTreshold(0,143,55,72,TRUE,TRUE);
// Draw the bar graph
$test->drawOverlayBarGraph($data_set->GetData(),$data_set->GetDataDescription(), 100);
// Finish the graph
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test->drawLegend(370,20,$data_set->GetDataDescription(),255,255,255);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',10);
//$test->drawTitle(50,22,$course_code,50,50,50,185);
$test->writeValues($data_set->GetData(),$data_set->GetDataDescription(),array("Min", "Max", "Avg"));
$cache->WriteToCache($graph_id, $data_set->GetData(), $test);
ob_start();
$test->Stroke();
ob_end_clean();
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
public function get_evaluations_base_courses_graph() {
$graphs = array();
if (!empty($this->courses)) {
$courses_code = array_keys($this->courses);
foreach ($courses_code as $course_code) {
$cats = Category::load(null, null, $course_code, null, null, null, false);
if (isset($cats)) {
$alleval = $cats[0]->get_evaluations(null, true, $course_code);
$alllinks = $cats[0]->get_links(null, true);
$users = get_all_users($alleval, $alllinks);
$datagen = new FlatViewDataGenerator ($users, $alleval, $alllinks);
$evaluation_sumary = $datagen->get_evaluation_sumary_results();
if (!empty($evaluation_sumary)) {
$items = array_keys($evaluation_sumary);
$max = $min = $avg = array();
foreach ($evaluation_sumary as $evaluation) {
$max[] = $evaluation['max'];
$min[] = $evaluation['min'];
$avg[] = $evaluation['avg'];
}
// Dataset definition
$data_set = new pData;
$data_set->AddPoint($max, "Max");
$data_set->AddPoint($avg, "Avg");
$data_set->AddPoint($min, "Min");
$data_set->AddPoint($items, "Items");
$data_set->SetXAxisName(get_lang('Step'));
$data_set->SetYAxisName(get_lang('Percentage'));
$data_set->AddAllSeries();
$data_set->RemoveSerie("Items");
$data_set->SetAbsciseLabelSerie("Items");
$graph_id = $this->user_id.'StudentEvaluationGraph';
$cache = new pCache();
// the graph id
$data = $data_set->GetData();
if ($cache->IsInCache($graph_id, $data)) {
//if we already created the img
$img_file = $cache->GetHash($graph_id, $data);
} else {
// Initialise the graph
$test = new pChart(450,260);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test->setGraphArea(50,30,375,200);
$test->drawFilledRoundedRectangle(7,7,373,223,5,240,240,240);
$test->drawRoundedRectangle(5,5,375,225,5,230,230,230);
$test->drawGraphArea(255,255,255,TRUE);
$test->setFixedScale(0,100,5);
$test->drawScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_ADDALL,150,150,150,TRUE,0,2,TRUE);
$test->setColorPalette(0,125,201,44);
$test->setColorPalette(1,255,138,0);
$test->setColorPalette(2,255,0,0);
$test->drawGrid(4,TRUE,230,230,230,50);
// Draw the 0 line
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',6);
$test->drawTreshold(0,143,55,72,TRUE,TRUE);
// Draw the bar graph
$test->drawOverlayBarGraph($data_set->GetData(),$data_set->GetDataDescription(), 100);
// Finish the graph
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test->drawLegend(365,20,$data_set->GetDataDescription(),255,255,255);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',10);
//$test->drawTitle(50,22,$course_code,50,50,50,185);
$test->writeValues($data_set->GetData(),$data_set->GetDataDescription(),array("Min", "Max", "Avg"));
$cache->WriteToCache($graph_id, $data_set->GetData(), $test);
ob_start();
$test->Stroke();
ob_end_clean();
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
}
if (!empty($img_file)) {
$graphs[$course_code] = '<img src="'.api_get_path(WEB_ARCHIVE_PATH).$img_file.'">';
}
}
if (!empty($img_file)) {
$graphs[$course_code] = '<img src="'.api_get_path(WEB_ARCHIVE_PATH).$img_file.'">';
}
}
}
} // end for
}
} // end for
}
return $graphs;
}
/**
* This method return a graph containing informations about evaluations inside courses in sessions, it's used inside get_block method for showing it inside dashboard interface
* @return string img html
*/
public function get_evaluations_courses_in_sessions_graph() {
$graphs = array();
$session_ids = array_keys($this->sessions);
foreach ($session_ids as $session_id) {
$courses_code = array_keys(Tracking::get_courses_list_from_session($session_id));
$courses_graph = array();
foreach ($courses_code as $course_code) {
$cats = Category::load(null, null, $course_code, null, null, $session_id);
if (isset($cats)) {
$alleval = $cats[0]->get_evaluations(null, true, $course_code);
$alllinks = $cats[0]->get_links(null, true);
$users = get_all_users($alleval, $alllinks);
public function get_evaluations_courses_in_sessions_graph() {
$graphs = array();
if (!empty($this->sessions)) {
$session_ids = array_keys($this->sessions);
foreach ($session_ids as $session_id) {
$courses_code = array_keys(Tracking::get_courses_list_from_session($session_id));
$courses_graph = array();
foreach ($courses_code as $course_code) {
$cats = Category::load(null, null, $course_code, null, null, $session_id);
if (isset($cats)) {
$alleval = $cats[0]->get_evaluations(null, true, $course_code);
$alllinks = $cats[0]->get_links(null, true);
$users = get_all_users($alleval, $alllinks);
$datagen = new FlatViewDataGenerator ($users, $alleval, $alllinks);
$evaluation_sumary = $datagen->get_evaluation_sumary_results();
if (!empty($evaluation_sumary)) {
$items = array_keys($evaluation_sumary);
$max = $min = $avg = array();
@ -234,27 +235,22 @@ class BlockEvaluationGraph extends Block {
$max[] = $evaluation['max'];
$min[] = $evaluation['min'];
$avg[] = $evaluation['avg'];
}
}
// Dataset definition
$data_set = new pData;
$data_set->AddPoint($max, "Max");
$data_set->AddPoint($avg, "Avg");
$data_set->AddPoint($min, "Min");
$data_set->AddPoint($items, "Items");
$data_set->AddPoint($items, "Items");
$data_set->SetXAxisName(get_lang('Step'));
$data_set->SetYAxisName(get_lang('Percentage'));
$data_set->SetYAxisName(get_lang('Percentage'));
$data_set->AddAllSeries();
$data_set->RemoveSerie("Items");
$data_set->SetAbsciseLabelSerie("Items");
$data_set->SetAbsciseLabelSerie("Items");
$graph_id = $this->user_id.'StudentEvaluationGraph';
$cache = new pCache();
// the graph id
$data = $data_set->GetData();
$data = $data_set->GetData();
if ($cache->IsInCache($graph_id, $data)) {
//if we already created the img
$img_file = $cache->GetHash($graph_id, $data);
@ -265,38 +261,29 @@ class BlockEvaluationGraph extends Block {
$test->setGraphArea(50,30,375,200);
$test->drawFilledRoundedRectangle(7,7,373,230,5,240,240,240);
$test->drawRoundedRectangle(5,5,375,225,5,230,230,230);
$test->drawGraphArea(255,255,255,TRUE);
$test->setFixedScale(0,100,5);
$test->drawScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_ADDALL,150,150,150,TRUE,0,2,TRUE);
$test->drawGraphArea(255,255,255,TRUE);
$test->setFixedScale(0,100,5);
$test->drawScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_ADDALL,150,150,150,TRUE,0,2,TRUE);
$test->setColorPalette(0,125,201,44);
$test->setColorPalette(1,255,138,0);
$test->setColorPalette(2,255,0,0);
$test->drawGrid(4,TRUE,230,230,230,50);
$test->setColorPalette(2,255,0,0);
$test->drawGrid(4,TRUE,230,230,230,50);
// Draw the 0 line
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',6);
$test->drawTreshold(0,143,55,72,TRUE,TRUE);
$test->drawTreshold(0,143,55,72,TRUE,TRUE);
// Draw the bar graph
$test->drawOverlayBarGraph($data_set->GetData(),$data_set->GetDataDescription(), 100);
$test->drawOverlayBarGraph($data_set->GetData(),$data_set->GetDataDescription(), 100);
// Finish the graph
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test->drawLegend(370,20,$data_set->GetDataDescription(),255,255,255);
$test->drawLegend(365,20,$data_set->GetDataDescription(),255,255,255);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',10);
//$test->drawTitle(50,22,$course_code,50,50,50,185);
$test->writeValues($data_set->GetData(),$data_set->GetDataDescription(),array("Min", "Max", "Avg"));
$cache->WriteToCache($graph_id, $data_set->GetData(), $test);
ob_start();
$test->Stroke();
ob_end_clean();
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
}
}
if (!empty($img_file)) {
$courses_graph[$course_code] = '<img src="'.api_get_path(WEB_ARCHIVE_PATH).$img_file.'">';
}
@ -306,7 +293,8 @@ class BlockEvaluationGraph extends Block {
if (!empty($courses_graph)) {
$graphs[$session_id] = $courses_graph;
}
}
}
}
return $graphs;
}

@ -113,8 +113,9 @@ class BlockSession extends Block {
$session_id = intval($session['id']);
$title = $session['name'];
if ($session['date_start'] != '0000-00-00' && $session['date_end'] != '0000-00-00') {
$date = get_lang('From').' '.format_locale_date(get_lang('DateFormatLongWithoutDay'), strtotime($session['date_start'])).' '.get_lang('To').' '.format_locale_date(get_lang('DateFormatLongWithoutDay'), strtotime($session['date_end']));
$date = get_lang('From').' '.format_locale_date(DATE_FORMAT_LONG_WITHOUT_DAY,strtotime($session['date_start'])).' '.get_lang('To').' '.format_locale_date(DATE_FORMAT_LONG_WITHOUT_DAY, strtotime($session['date_end']));
} else {
$date = ' - ';
}

@ -175,15 +175,14 @@ class BlockStudent extends Block {
$attendance = new Attendance();
$students = $this->students;
$content = '';
$content = '<div style="margin:10px;">';
$content = '<div style="margin:5px;">';
$content .= '<h3><font color="#000">'.get_lang('YourStudents').'</font></h3>';
if (count($students) > 0) {
$students_table = '<table class="data_table" width:"95%">';
$students_table .= '
<tr>
<th>'.get_lang('FirstName').'</th>
<th>'.get_lang('LastName').'</th>
<tr>
<th>'.get_lang('User').'</th>
<th>'.get_lang('AttendancesFaults').'</th>
<th>'.get_lang('Evaluations').'</th>
</tr>
@ -194,7 +193,9 @@ class BlockStudent extends Block {
$student_id = $student['user_id'];
$firstname = $student['firstname'];
$lastname = $student['lastname'];
$lastname = $student['lastname'];
$username = $student['username'];
// get average of faults in attendances by student
$results_faults_avg = $attendance->get_faults_average_inside_courses($student_id);
@ -227,9 +228,8 @@ class BlockStudent extends Block {
if ($i%2 == 0) $class_tr = 'row_odd';
else $class_tr = 'row_even';
$students_table .= '<tr class="'.$class_tr.'">
<td>'.$firstname.'</td>
<td>'.$lastname.'</td>
$students_table .= '<tr class="'.$class_tr.'">
<td>'.api_get_person_name($firstname,$lastname).' ('.$username.')</td>
<td align="right">'.$attendances_faults_avg.'</td>
<td align="right">'.$evaluations_avg.'</td>
</tr>';

@ -16,6 +16,7 @@ require_once api_get_path(LIBRARY_PATH).'attendance.lib.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pData.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pChart.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pCache.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/MyHorBar.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/gradebookitem.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/evaluation.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/result.class.php';
@ -83,7 +84,8 @@ class BlockStudentGraph extends Block {
<h3>'.get_lang('StudentsInformationsGraph').'</h3>
<div class="widget-actions"><a onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'">'.Display::return_icon('close.gif',get_lang('Close')).'</a></div>
</div>
<div class="widget-content" align="center">
<div class="widget-content" align="center">
<div style="padding:10px;"><strong>'.get_lang('AttendancesFaults').'</strong></div>
'.$students_attendance_graph.'
</div>
</li>
@ -102,6 +104,102 @@ class BlockStudentGraph extends Block {
*/
public function get_students_attendance_graph() {
$students = $this->students;
$attendance = new Attendance();
// get data
$attendances_faults_avg = array();
foreach ($students as $student) {
$student_id = $student['user_id'];
$student_info = api_get_user_info($student_id);
// get average of faults in attendances by student
$results_faults_avg = $attendance->get_faults_average_inside_courses($student_id);
if (!empty($results_faults_avg)) {
$attendances_faults_avg[$student_info['username']] = $results_faults_avg['porcent'];
} else {
$attendances_faults_avg[$student_info['username']] = 0;
}
}
arsort($attendances_faults_avg);
$usernames = array_keys($attendances_faults_avg);
// get only until five users
if (count($usernames) > 5) { array_splice($usernames,5); }
$faults = array();
foreach ($usernames as $username) {
$faults[] = $attendances_faults_avg[$username];
}
$graph = '';
$img_file = '';
if (is_array($usernames) && count($usernames) > 0) {
// Defining data
$data_set = new pData;
$data_set->AddPoint($faults,"Promedio");
$data_set->AddPoint($usernames,"Usuario");
$data_set->AddAllSeries();
//$data_set->SetYAxisName(get_lang('UserName'));
//$data_set->SetXAxisName(get_lang('AttendancesFaults'));
$data_set->SetAbsciseLabelSerie("Usuario");
// prepare cache for saving image
$graph_id = $this->user_id.'StudentEvaluationGraph'; // the graph id
$cache = new pCache();
$data = $data_set->GetData(); // return $this->DataDescription
if ($cache->IsInCache($graph_id, $data_set->GetData())) {
//if we already created the img
$img_file = $cache->GetHash($graph_id, $data_set->GetData()); // image file with hash
} else {
// Initialise the graph
$test = new MyHorBar(400,280);
//$Test->setFontProperties("Fonts/tahoma.ttf",8);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 8);
//$test->setGraphArea(120,60,450,650);
$test->setGraphArea(65,30,350,200);
//$Test->setFixedScale(0,5,5,0,0,0);
//$test->drawFilledRoundedRectangle(7,7,493,693,5,240,240,240);
$test->drawFilledRoundedRectangle(7,7,393,253,5,240,240,240);
//$test->drawRoundedRectangle(5,5,495,695,5,230,230,230);
$test->drawRoundedRectangle(5,5,395,255,5,230,230,230);
$test->drawGraphArea(255,255,255,TRUE);
$test->setFixedScale(0,100,5);
$test->drawHorScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_NORMAL,150,150,150,TRUE,0,2,TRUE);
$test->setColorPalette(0,255,0,0);
$test->drawHorGrid(10,TRUE,230,230,230,50);
// Draw the 0 line
//$Test->setFontProperties("Fonts/tahoma.ttf",6);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 6);
$test->drawTreshold(0,143,55,72,TRUE,TRUE);
// Draw the bar graph
$test->drawHorBarGraph($data_set->GetData(),$data_set->GetDataDescription(),FALSE);
$cache->WriteToCache($graph_id, $data_set->GetData(), $test);
ob_start();
$test->Stroke();
ob_end_clean();
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
}
if (!empty($img_file)) {
$graph = '<img src="'.api_get_path(WEB_ARCHIVE_PATH).$img_file.'">';
}
} else {
$graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>';
}
/*
$students = $this->students;
$attendance = new Attendance();
@ -181,7 +279,7 @@ class BlockStudentGraph extends Block {
$Y2 = 200;
//$this->GArea_X1 = $X1;$this->GArea_Y1 = $Y1;$this->GArea_X2 = $X2;$this->GArea_Y2 = $Y2;
$test->setGraphArea($X1,$Y1,$X2,$Y2);
$test->setGraphArea(50,30,345,200);
$test->drawFilledRoundedRectangle(7,7,371,240,5,240,240,240);
@ -229,7 +327,7 @@ class BlockStudentGraph extends Block {
} else {
$graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>';
}
*/
return $graph;
}

@ -107,8 +107,7 @@ class BlockTeacher extends Block {
$teachers_table = '<table class="data_table" width:"95%">';
$teachers_table .= '
<tr>
<th>'.get_lang('FirstName').'</th>
<th>'.get_lang('LastName').'</th>
<th>'.get_lang('User').'</th>
<th>'.get_lang('TimeSpentOnThePlatform').'</th>
<th>'.get_lang('LastConnexion').'</th>
</tr>
@ -118,8 +117,10 @@ class BlockTeacher extends Block {
foreach ($teachers as $teacher) {
$teacher_id = $teacher['user_id'];
$firtname = $teacher['firstname'];
$lastname = $teacher['lastname'];
$firstname = $teacher['firstname'];
$lastname = $teacher['lastname'];
$username = $teacher['username'];
$time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($teacher_id));
$last_connection = Tracking :: get_last_connection_date($teacher_id);
@ -128,8 +129,7 @@ class BlockTeacher extends Block {
$teachers_table .= '
<tr class="'.$class_tr.'">
<td>'.$firtname.'</td>
<td>'.$lastname.'</td>
<td>'.api_get_person_name($firstname,$lastname).' ('.$username.')</td>
<td align="right">'.$time_on_platform.'</td>
<td align="right">'.$last_connection.'</td>
</tr>
@ -168,8 +168,7 @@ class BlockTeacher extends Block {
$teachers_table = '<table class="data_table" width:"95%">';
$teachers_table .= '
<tr>
<th>'.get_lang('FirstName').'</th>
<th>'.get_lang('LastName').'</th>
<th>'.get_lang('User').'</th>
<th>'.get_lang('TimeSpentLastWeek').'<br />'.$last_week.'</th>
</tr>
';
@ -180,14 +179,13 @@ class BlockTeacher extends Block {
$teacher_id = $teacher['user_id'];
$firstname = $teacher['firstname'];
$lastname = $teacher['lastname'];
$username = $teacher['username'];
$time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($teacher_id,true));
if ($i%2 == 0) $class_tr = 'row_odd';
else $class_tr = 'row_even';
$teachers_table .= '<tr class="'.$class_tr.'">
<td>'.$firstname.'</td>
<td>'.$lastname.'</td>
<td>'.api_get_person_name($firstname,$lastname).' ('.$username.')</td>
<td align="right">'.$time_on_platform.'</td>
</tr>';

@ -85,6 +85,7 @@ class BlockTeacherGraph extends Block {
<div class="widget-actions"><a onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'">'.Display::return_icon('close.gif',get_lang('Close')).'</a></div>
</div>
<div class="widget-content" align="center">
<div style="padding:10px;"><strong>'.get_lang('TimeSpentOnThePlatformLastWeekByDay').'</strong></div>
'.$teacher_information_graph.'
</div>
</li>
@ -187,8 +188,8 @@ class BlockTeacherGraph extends Block {
$test->drawLegend(320,20,$data_set->GetDataDescription(),204,204,255);
// Drawing title
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',10);
$test->drawTitle(50,22,get_lang('TimeSpentOnThePlatformLastWeekByDay'),50,50,50,385);
//$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',10);
//$test->drawTitle(50,22,get_lang('TimeSpentOnThePlatformLastWeekByDay'),50,50,50,385);
$test->writeValues($data_set->GetData(),$data_set->GetDataDescription(),"Days");

Loading…
Cancel
Save