Removing tracking.lib.php calls

skala
Julio Montoya 13 years ago
parent 0fe6e0aa88
commit 4e7f9b5e26
  1. 1
      main/announcements/announcements.php
  2. 1
      main/inc/lib/main_api.lib.php
  3. 1
      main/inc/lib/tracking.lib.php
  4. 93
      main/mySpace/current_courses.php
  5. 73
      main/mySpace/myspace.lib.php
  6. 129
      plugin/dashboard/block_teacher_graph/block_teacher_graph.class.php

@ -55,7 +55,6 @@ $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
/* Libraries */
$lib = api_get_path(LIBRARY_PATH); //avoid useless function calls
require_once $lib.'tracking.lib.php';
require_once $lib.'fckeditor/fckeditor.php';
require_once $lib.'fileUpload.lib.php';

@ -1133,7 +1133,6 @@ function _api_format_user($user, $add_password = false) {
$result['language'] = $user['language'];
if (!isset($user['lastLogin']) && !isset($user['last_login'])) {
require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
$timestamp = Tracking::get_last_connection_date($result['user_id'], false, true);
// Convert the timestamp back into a datetime
// NOTE: this timestamp has ALREADY been converted to the local timezone in the get_last_connection_date function

@ -13,7 +13,6 @@
define('SESSION_LINK_TARGET', '_self');
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php';
//require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.class.php'; moved to autoload
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathList.class.php';
/**

@ -12,7 +12,6 @@ $cidReset = true;
require_once '../inc/global.inc.php';
$this_section = SECTION_TRACKING;
require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
require_once api_get_path(LIBRARY_PATH).'pear/Spreadsheet_Excel_Writer/Writer.php';
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php';
@ -34,25 +33,25 @@ if (!empty($my_courses)) {
$course_code = $course['course_code'];
$course_id = $course['real_id'];
$course_info = api_get_course_info($course_code);
//Only show open courses
//Only show open courses
if ($course_info['visibility'] == 0) {
continue;
}
$teachers = CourseManager::get_teacher_list_from_course_code($course_code);
$teacher_list = array();
//$teacher_list = array($course_info['titular']);
//$teacher_list = array($course_info['titular']);
if (!empty($teachers)) {
foreach($teachers as $teacher) {
$teacher_list[]= $teacher['firstname'].' '.$teacher['lastname'];
}
}
}
$tmp_students = CourseManager :: get_student_list_from_course_code($course_code, false);
//Cleaning students only REAL students
$students = array();
foreach ($tmp_students as $student) {
@ -61,55 +60,55 @@ if (!empty($my_courses)) {
continue;
}
$students[] = $student['user_id'];
}
}
$t_lp = Database :: get_course_table(TABLE_LP_MAIN);
$sql_lp = "SELECT lp.name, lp.id FROM $t_lp lp WHERE c_id = $course_id AND lp.session_id = 0";
$rs_lp = Database::query($sql_lp);
$t_lpi = Database :: get_course_table(TABLE_LP_ITEM);
$t_news = Database :: get_course_table(TABLE_ANNOUNCEMENT);
//No needed
//No needed
/*$nb_assignments = Tracking::count_student_assignments($students, $course_code, $session_id);
$messages = Tracking::count_student_messages($students, $course_code, $session_id);
$links = Tracking::count_student_visited_links($students, $course_code, $session_id);
$chat_last_connection = Tracking::chat_last_connection($students, $course_code, $session_id);
$documents = Tracking::count_student_downloaded_documents($students, $course_code, $session_id);*/
$documents = Tracking::count_student_downloaded_documents($students, $course_code, $session_id);*/
$total_tools_list = Tracking::get_tools_most_used_by_course($course_code, $session_id);
$total_tools = 0;
foreach($total_tools_list as $tool) {
$total_tools += $tool['count_access_tool'];
}
if (Database :: num_rows($rs_lp) > 0) {
$total_tools += $tool['count_access_tool'];
}
if (Database :: num_rows($rs_lp) > 0) {
while ($learnpath = Database :: fetch_array($rs_lp)) {
$lp_id = $learnpath['id'];
$lp_items =
$lp_items =
$array[$i]['lp'] = '<a href="'.api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?cidReq='.$course_code.'&amp;action=view&amp;lp_id='.$lp_id.'" target="_blank">'.$learnpath['name'].'</a>';
$array[$i]['teachers'] = '';
if (!empty($teacher_list)) {
$array[$i]['teachers'] = implode(', ', $teacher_list);
}
$array[$i]['course_name'] = $course['title'];
$count_students_accessing = 0;
$count_students_complete_all_activities = 0;
$count_students_complete_all_activities_at_50 = 0;
$total_time_spent = 0;
$total_average_progress = 0;
if (!empty($students)) {
if (!empty($students)) {
foreach ($students as $student_id) {
$avg_student_progress = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id);
$myavg_temp = Tracking::get_avg_student_score($student_id, $course_code, array($lp_id), $session_id);
$myavg_temp = Tracking::get_avg_student_score($student_id, $course_code, array($lp_id), $session_id);
$avg_progress_in_course = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id);
if (intval($avg_progress_in_course) == 100) {
$count_students_complete_all_activities++;
}
@ -117,18 +116,18 @@ if (!empty($my_courses)) {
$count_students_complete_all_activities_at_50 ++;
}
$total_average_progress +=$avg_progress_in_course;
$time_spent = Tracking::get_time_spent_on_the_course($student_id, $course_code, $session_id);
$total_time_spent += $time_spent;
if (!empty($time_spent)) {
$count_students_accessing++;
}
}
//$total_tools += $nb_assignments + $messages + $links + $chat_last_connection + $documents;
}
//$total_tools += $nb_assignments + $messages + $links + $chat_last_connection + $documents;
}
$student_count = count($students);
$array[$i]['count_students'] = $student_count;
$array[$i]['count_students_accessing'] = 0;
$array[$i]['count_students_accessing_percentage'] = 0;
@ -138,8 +137,8 @@ if (!empty($my_courses)) {
$array[$i]['total_time_spent'] = 0;
$array[$i]['average_time_spent_per_student'] = 0;
$array[$i]['total_time_spent'] = 0;
$array[$i]['average_time_spent_per_student'] = 0;
//$array[$i]['tools_used'] = 0;
$array[$i]['average_time_spent_per_student'] = 0;
//$array[$i]['tools_used'] = 0;
$array[$i]['learnpath_docs'] = 0;
$array[$i]['learnpath_exercises'] = 0;
$array[$i]['learnpath_links'] = 0;
@ -177,10 +176,10 @@ if (!empty($my_courses)) {
while ($row_news = Database::fetch_array($res_news)) {
$array[$i]['total_announcements'] = $row_news[0];
}
//@todo don't know what means this value
$count_students_complete_all_activities_at_50 = 0;
if (!empty($student_count)) {
$array[$i]['count_students_accessing'] = $count_students_accessing;
$array[$i]['count_students_accessing_percentage'] = round($count_students_accessing / $student_count *100 , 0);
@ -189,7 +188,7 @@ if (!empty($my_courses)) {
$array[$i]['average_percentage_activities_completed_per_student'] = round($count_students_complete_all_activities/$student_count*100,2);
$array[$i]['total_time_spent'] = 0;
$array[$i]['average_time_spent_per_student'] = 0;
if (!empty($total_time_spent)) {
$array[$i]['total_time_spent'] = api_time_to_hms($total_time_spent);
$array[$i]['average_time_spent_per_student'] = api_time_to_hms($total_time_spent / $student_count);
@ -198,7 +197,7 @@ if (!empty($my_courses)) {
}
$i++;
}
}
}
}
}
@ -232,10 +231,10 @@ if (isset($_GET['export'])) {
$worksheet =& $workbook->addWorksheet('Report');
//$worksheet->setInputEncoding(api_get_system_encoding());
$worksheet->setInputEncoding($charset);
$line = 0;
$column = 0; //skip the first column (row titles)
foreach($headers as $header) {
$worksheet->write($line,$column, $header);
$column++;
@ -271,8 +270,8 @@ foreach ($headers as $header) {
}
$row++;
foreach ($array as $row_table) {
$column = 0;
foreach ($array as $row_table) {
$column = 0;
foreach ($row_table as $cell) {
$table->setCellContents($row, $column, $cell);
//$table->updateCellAttributes($row, $column, 'align="center"');
@ -282,7 +281,7 @@ foreach ($array as $row_table) {
$row++;
}
echo '<div class="actions">';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace">'.Display::return_icon('back.png', get_lang('Back'), array(), 32).'</a>';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/current_courses.php?export=1">'.Display::return_icon('export_excel.png', get_lang('CurrentCoursesReport'), array(), 32).'</a> ';
@ -290,5 +289,5 @@ echo '</div>';
echo '<div style="overflow:auto;">';
echo $table->toHtml();
echo '</div>';
Display::display_footer();

@ -8,7 +8,6 @@
* Init
*/
require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
/**
* MySpace class definition
*/
@ -71,9 +70,9 @@ class MySpace {
$session_id = intval($session_id);
$sql = 'SELECT login_course_date, logout_course_date FROM ' . $tbl_track_course . '
WHERE user_id = '.$user_id.' AND
course_code="'.$course_code.'" AND
session_id = '.$session_id.'
WHERE user_id = '.$user_id.' AND
course_code="'.$course_code.'" AND
session_id = '.$session_id.'
ORDER BY login_course_date ASC';
$rs = Database::query($sql);
$connections = array();
@ -85,12 +84,12 @@ class MySpace {
}
return $connections;
}
static function get_connections_from_course_list($user_id, $course_list, $session_id = 0) {
// Database table definitions
$tbl_track_course = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
if (empty($course_list)) {
return false;
return false;
}
// protect data
@ -98,18 +97,18 @@ class MySpace {
$course_code = Database::escape_string($course_code);
$session_id = intval($session_id);
$new_course_list = array();;
foreach ($course_list as $course_item) {
foreach ($course_list as $course_item) {
$new_course_list[] = '"'.Database::escape_string($course_item['code']).'"';
}
$course_list = implode(', ', $new_course_list);
if (empty($course_list)) {
return false;
return false;
}
$sql = 'SELECT login_course_date, logout_course_date, course_code FROM ' . $tbl_track_course . '
WHERE user_id = '.$user_id.' AND
course_code IN ('.$course_list.') AND
session_id = '.$session_id.'
WHERE user_id = '.$user_id.' AND
course_code IN ('.$course_list.') AND
session_id = '.$session_id.'
ORDER BY login_course_date ASC';
$rs = Database::query($sql);
$connections = array();
@ -410,11 +409,11 @@ class MySpace {
* @param string Order direction
* @return array Results
*/
public function get_course_data_tracking_overview($from, $number_of_items, $column, $direction) {
public function get_course_data_tracking_overview($from, $number_of_items, $column, $direction) {
$main_course_table = Database :: get_main_table(TABLE_MAIN_COURSE);
$from = intval($from);
$number_of_items = intval($number_of_items);
$sql = "SELECT code AS col0, title AS col1 FROM $main_course_table";
$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";
@ -1237,7 +1236,7 @@ class MySpace {
$sql = "SELECT course.code as col1, course.title as col2
FROM $tbl_course course
WHERE course.code IN (".implode(',',$courses_code).")";
if (!in_array($direction, array('ASC','DESC'))) $direction = 'ASC';
$column = intval($column);
@ -1248,7 +1247,7 @@ class MySpace {
$res = Database::query($sql);
while ($row_course = Database::fetch_row($res)) {
$course_code = $row_course[0];
$course_info = api_get_course_info($course_code);
$avg_assignments_in_course = $avg_messages_in_course = $nb_students_in_course = $avg_progress_in_course = $avg_score_in_course = $avg_time_spent_in_course = $avg_score_in_exercise = 0;
@ -1267,9 +1266,9 @@ class MySpace {
$nb_students_in_course = count($users);
$avg_assignments_in_course = Tracking::count_student_assignments($users, $course_code, $session_id);
$avg_messages_in_course = Tracking::count_student_messages($users, $course_code, $session_id);
$avg_progress_in_course = Tracking::get_avg_student_progress($users, $course_code, array(), $session_id);
$avg_progress_in_course = Tracking::get_avg_student_progress($users, $course_code, array(), $session_id);
$avg_score_in_course = Tracking::get_avg_student_score($users, $course_code, array(), $session_id);
$avg_score_in_exercise = Tracking::get_avg_student_exercise_score($users, $course_code, 0, $session_id);
$avg_score_in_exercise = Tracking::get_avg_student_exercise_score($users, $course_code, 0, $session_id);
$avg_time_spent_in_course = Tracking::get_time_spent_on_the_course($users, $course_code, $session_id);
$avg_progress_in_course = round($avg_progress_in_course / $nb_students_in_course, 2);
@ -1811,24 +1810,24 @@ class MySpace {
xml_parse($parser, api_utf8_encode_xml(file_get_contents($file)));
xml_parser_free($parser);
return $users;
}
}
}
function get_stats($user_id, $course_code, $start_date = null, $end_date = null) {
// Database table definitions
$tbl_track_course = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$tbl_main = Database :: get_main_table(TABLE_MAIN_COURSE);
$course_info = api_get_course_info($course_code);
if (!empty($course_info)) {
if (!empty($course_info)) {
$strg_sd = "";
$strg_ed = "";
$strg_ed = "";
if ($start_date != null && $end_date != null){
$end_date = add_day_to( $end_date );
$strg_sd = "AND login_course_date BETWEEN '$start_date' AND '$end_date'";
$strg_ed = "AND logout_course_date BETWEEN '$start_date' AND '$end_date'";
}
}
$sql = 'SELECT SEC_TO_TIME(avg(time_to_sec(timediff(logout_course_date,login_course_date)))) as avrg,
SEC_TO_TIME(sum(time_to_sec(timediff(logout_course_date,login_course_date)))) as total,
count(user_id) as times
@ -1836,11 +1835,11 @@ function get_stats($user_id, $course_code, $start_date = null, $end_date = null)
WHERE user_id = ' . intval($user_id) . '
AND course_code = "' . Database::escape_string($course_code) . '" '.$strg_sd.' '.$strg_ed.' '.'
ORDER BY login_course_date ASC';
$rs = Database::query($sql);
$result = array();
if ($row = Database::fetch_array($rs)) {
if ($row = Database::fetch_array($rs)) {
$foo_avg = $row['avrg'];
$foo_total = $row['total'];
$foo_times = $row['times'];
@ -1872,25 +1871,25 @@ function get_connections_to_course_by_date($user_id, $course_code, $start_date,
// Database table definitions
$tbl_track_course = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$tbl_main = Database :: get_main_table(TABLE_MAIN_COURSE);
$course_info = api_get_course_info($course_code);
$user_id = intval($user_id);
if (!empty($course_info)) {
$end_date = add_day_to($end_date);
$sql = "SELECT login_course_date, logout_course_date FROM $tbl_track_course
$sql = "SELECT login_course_date, logout_course_date FROM $tbl_track_course
WHERE user_id = $user_id
AND course_code = '$course_code'
AND course_code = '$course_code'
AND login_course_date BETWEEN '$start_date' AND '$end_date'
AND logout_course_date BETWEEN '$start_date' AND '$end_date'
ORDER BY login_course_date ASC";
ORDER BY login_course_date ASC";
$rs = Database::query($sql);
$connections = array();
while ($row = Database::fetch_array($rs)) {
while ($row = Database::fetch_array($rs)) {
$login_date = $row['login_course_date'];
$logout_date = $row['logout_course_date'];
$logout_date = $row['logout_course_date'];
$timestamp_login_date = strtotime($login_date);
$timestamp_logout_date = strtotime($logout_date);
$timestamp_logout_date = strtotime($logout_date);
$connections[] = array('login' => $timestamp_login_date, 'logout' => $timestamp_logout_date);
}
}
@ -1898,9 +1897,9 @@ function get_connections_to_course_by_date($user_id, $course_code, $start_date,
}
/**
*
*
* @param array
*
* @param array
* @author Jorge Frisancho Jibaja
* @version OCT-22- 2010
* @return array
@ -2052,7 +2051,7 @@ function grapher($sql_result, $start_date, $end_date, $type = "") {
// Finish the graph
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 8);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 10);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 10);
$test->drawTitle(60, 22, get_lang('AccessDetails'), 50, 50, 50, 585);
//------------------

@ -1,6 +1,6 @@
<?php
/**
* This file is part of teacher graph block plugin for dashboard,
* This file is part of teacher graph block plugin for dashboard,
* it should be required inside dashboard controller for showing it into dashboard interface from plattform
* @package chamilo.dashboard
* @author Christian Fasanando
@ -9,13 +9,12 @@
/**
* required files for getting data
*/
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';
/**
* This class is used like controller for teacher graph block plugin,
* This class is used like controller for teacher graph block plugin,
* the class name must be registered inside path.info file (e.g: controller = "BlockTeacherGraph"), so dashboard controller will be instantiate it
* @package chamilo.dashboard
*/
@ -29,7 +28,7 @@ class BlockTeacherGraph extends Block {
/**
* Controller
*/
public function __construct ($user_id) {
public function __construct ($user_id) {
$this->user_id = $user_id;
$this->path = 'block_teacher_graph';
if ($this->is_block_visible_for_user($user_id)) {
@ -37,41 +36,41 @@ class BlockTeacherGraph extends Block {
$this->teachers = UserManager::get_user_list(array('status' => COURSEMANAGER));
} else {*/
$this->teachers = UserManager::get_users_followed_by_drh($user_id, COURSEMANAGER);
//}
//}
}
}
/**
* 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) {
*/
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;
}
return $is_block_visible_for_user;
}
/**
* This method return content html containing information about teachers and its position for showing it inside dashboard interface
* it's important to use the name 'get_block' for beeing used from dashboard controller
* it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html
*/
public function get_block() {
global $charset;
public function get_block() {
global $charset;
$column = 1;
$data = array();
/*if (api_is_platform_admin()) {
$teacher_content_html = $this->get_teachers_content_html_for_platform_admin();
} else if (api_is_drh()) {*/
$teacher_information_graph = $this->get_teachers_information_graph();
//}
$html = '<li class="widget color-blue" id="intro">
<div class="widget-head">
<h3>'.get_lang('TeachersInformationsGraph').'</h3>
@ -81,106 +80,106 @@ class BlockTeacherGraph extends Block {
<div style="padding:10px;"><strong>'.get_lang('TimeSpentOnThePlatformLastWeekByDay').'</strong></div>
'.$teacher_information_graph.'
</div>
</li>';
</li>';
$data['column'] = $column;
$data['content_html'] = $html;
return $data;
$data['content_html'] = $html;
return $data;
}
/**
* This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html
*/
public function get_teachers_information_graph() {
$graph = '';
$user_ids = array_keys($this->teachers);
$user_ids = array_keys($this->teachers);
$a_last_week = get_last_week();
if (is_array($user_ids) && count($user_ids) > 0) {
$data_set = new pData;
$data_set = new pData;
foreach ($user_ids as $user_id) {
$teacher_info = api_get_user_info($user_id);
$teacher_info = api_get_user_info($user_id);
$username = $teacher_info['username'];
$time_by_days = array();
foreach ($a_last_week as $day) {
$date = new DateTime(api_get_utc_datetime($day));
$start_date = $date->format('Y-m-d').' 00:00:00';
$end_date = $date->format('Y-m-d').' 23:59:59';
$time_on_platform_by_day = Tracking::get_time_spent_on_the_platform($user_id, 'custom', $start_date, $end_date);
$hours = floor($time_on_platform_by_day / 3600);
$end_date = $date->format('Y-m-d').' 23:59:59';
$time_on_platform_by_day = Tracking::get_time_spent_on_the_platform($user_id, 'custom', $start_date, $end_date);
$hours = floor($time_on_platform_by_day / 3600);
$min = floor(($time_on_platform_by_day - ($hours * 3600)) / 60);
$time_by_days[] = $min;
}
$data_set->AddPoint($time_by_days, $username);
$time_by_days[] = $min;
}
$data_set->AddPoint($time_by_days, $username);
$data_set->AddSerie($username);
}
$last_week = date('Y-m-d', $a_last_week[0]).' '.get_lang('To').' '.date('Y-m-d', $a_last_week[6]);
$days_on_week = array();
$days_on_week = array();
foreach ($a_last_week as $weekday) {
$days_on_week[] = date('d/m',$weekday);
}
$data_set->AddPoint($days_on_week,"Days");
$data_set->AddPoint($days_on_week,"Days");
$data_set->SetXAxisName($last_week);
$data_set->SetYAxisName(get_lang('Minutes'));
$data_set->SetAbsciseLabelSerie("Days");
$graph_id = $this->user_id.'TeacherConnectionsGraph';
$cache = new pCache();
// the graph id
$data = $data_set->GetData();
if ($cache->IsInCache($graph_id, $data_set->GetData())) {
if ($cache->IsInCache($graph_id, $data_set->GetData())) {
//if we already created the img
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
} else {
// Initializing the graph
// Initializing the graph
$bg_width = 440;
$bg_height = 350;
$test = new pChart($bg_width+10,$bg_height+20);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test->setGraphArea(65,30,$bg_width-70,$bg_height-50);
$test->drawFilledRoundedRectangle(7,7,$bg_width,$bg_height,5,240,240,240);
$test->drawRoundedRectangle(5,5,$bg_width+2,$bg_height+2,5,230,230,230);
$test->drawGraphArea(255,255,255,TRUE);
$test->drawScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_NORMAL,150,150,150,TRUE,0,2,TRUE);
$test->drawGrid(4,TRUE,230,230,230,50);
$test = new pChart($bg_width+10,$bg_height+20);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test->setGraphArea(65,30,$bg_width-70,$bg_height-50);
$test->drawFilledRoundedRectangle(7,7,$bg_width,$bg_height,5,240,240,240);
$test->drawRoundedRectangle(5,5,$bg_width+2,$bg_height+2,5,230,230,230);
$test->drawGraphArea(255,255,255,TRUE);
$test->drawScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_NORMAL,150,150,150,TRUE,0,2,TRUE);
$test->drawGrid(4,TRUE,230,230,230,50);
// Drawing lines
//$test->drawLineGraph($data_set->GetData(),$data_set->GetDataDescription());
$test->drawFilledCubicCurve($data_set->GetData(),$data_set->GetDataDescription(),.1,30);
//$test->drawPlotGraph($data_set->GetData(),$data_set->GetDataDescription(),3,2,255,255,255);
// Drawing Legend
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test->drawLegend($bg_width-80,20,$data_set->GetDataDescription(),204,204,255);
$test->writeValues($data_set->GetData(),$data_set->GetDataDescription(),array("Days"));
// Drawing Legend
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test->drawLegend($bg_width-80,20,$data_set->GetDataDescription(),204,204,255);
$test->writeValues($data_set->GetData(),$data_set->GetDataDescription(),array("Days"));
$cache->WriteToCache($graph_id, $data_set->GetData(), $test);
ob_start();
$test->Stroke();
ob_end_clean();
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
}
$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>';
}
return $graph;
}
}
return $graph;
}
/**
* Get number of teachers
* Get number of teachers
* @return int
*/
function get_number_of_teachers() {
return count($this->teachers);
}
}
}
Loading…
Cancel
Save