Minor - format code.

1.9.x
Julio Montoya 12 years ago
parent 7676bbac14
commit b6df93a346
  1. 338
      plugin/dashboard/block_course/block_course.class.php
  2. 360
      plugin/dashboard/block_daily/block_daily.class.php
  3. 309
      plugin/dashboard/block_evaluation_graph/block_evaluation_graph.class.php
  4. 53
      plugin/dashboard/block_session/block_session.class.php
  5. 26
      plugin/dashboard/block_student/block_student.class.php
  6. 167
      plugin/dashboard/block_student_graph/block_student_graph.class.php
  7. 67
      plugin/dashboard/block_teacher/block_teacher.class.php
  8. 173
      plugin/dashboard/block_teacher_graph/block_teacher_graph.class.php

@ -9,191 +9,215 @@
/**
* required files for getting data
*/
require_once api_get_path(LIBRARY_PATH).'thematic.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'thematic.lib.php';
/**
* This class is used like controller for this course block plugin,
* the class name must be registered inside path.info file (e.g: controller = "BlockCourse"), so dashboard controller will be instantiate it
* @package chamilo.dashboard
*/
class BlockCourse extends Block {
private $user_id;
private $courses;
private $path;
private $permission = array(DRH);
/**
* Constructor
*/
public function __construct ($user_id) {
$this->user_id = $user_id;
$this->path = 'block_course';
if ($this->is_block_visible_for_user($user_id)) {
/*if (api_is_platform_admin()) {
$this->courses = CourseManager::get_real_course_list();
} else {*/
$this->courses = CourseManager::get_courses_followed_by_drh($user_id);
//}
}
}
class BlockCourse extends Block
{
private $user_id;
private $courses;
private $path;
private $permission = array(DRH);
/**
* 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;
/**
* Constructor
*/
public function __construct($user_id)
{
$this->user_id = $user_id;
$this->path = 'block_course';
if ($this->is_block_visible_for_user($user_id)) {
/*if (api_is_platform_admin()) {
$this->courses = CourseManager::get_real_course_list();
} else {*/
$this->courses = CourseManager::get_courses_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;
}
/**
* This method return content html containing information about courses and its position for showing it inside dashboard interface
* 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;
$column = 2;
$data = array();
$content = '';
$data_table = '';
$content = $this->get_content_html();
$html = '
public function get_block()
{
global $charset;
$column = 2;
$data = array();
$content = '';
$data_table = '';
$content = $this->get_content_html();
$html = '
<li class="widget color-green" id="intro">
<div class="widget-head">
<h3>'.get_lang('CoursesInformation').'</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>
<h3>' . get_lang('CoursesInformation') . '</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">
'.$content.'
' . $content . '
</div>
</li>
';
$data['column'] = $column;
$data['content_html'] = $html;
$data['column'] = $column;
$data['content_html'] = $html;
return $data;
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_content_html() {
$course_data = $this->get_course_information_data();
$content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourCourseList').'</font></h3>';
/**
* 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_content_html()
{
$course_data = $this->get_course_information_data();
$content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">' . get_lang(
'YourCourseList'
) . '</font></h3>';
$data_table = null;
if (!empty($course_data)) {
$data_table .= '<table class="data_table" width:"95%">';
$data_table .= '<tr>
<th>'.get_lang('CourseTitle').'</th>
<th width="20%">'.get_lang('NbStudents').'</th>
<th width="20%">'.get_lang('AvgTimeSpentInTheCourse').'</th>
<th width="20%">'.get_lang('ThematicAdvance').'</th>
if (!empty($course_data)) {
$data_table .= '<table class="data_table" width:"95%">';
$data_table .= '<tr>
<th>' . get_lang('CourseTitle') . '</th>
<th width="20%">' . get_lang('NbStudents') . '</th>
<th width="20%">' . get_lang(
'AvgTimeSpentInTheCourse'
) . '</th>
<th width="20%">' . get_lang(
'ThematicAdvance'
) . '</th>
</tr>';
$i = 1;
foreach ($course_data as $course) {
if ($i%2 == 0) {
$class_tr = 'row_odd';
} else {
$class_tr = 'row_even';
}
$data_table .= '<tr class="'.$class_tr.'">';
if (!isset($course[2])) {
$course[2] = '0:00:00';
}
foreach ($course as $cell) {
$data_table .= '<td align="right">'.$cell.'</td>';
}
$data_table .= '</tr>';
$i++;
}
$data_table .= '</table>';
} else {
$data_table .= get_lang('ThereIsNoInformationAboutYourCourses');
}
$content .= $data_table;
if (!empty($course_data)) {
$content .= '<div style="text-align:right;margin-top:10px;"><a href="'.api_get_path(WEB_CODE_PATH).'mySpace/course.php">'.get_lang('SeeMore').'</a></div>';
}
$content .= '</div>';
return $content;
}
$i = 1;
foreach ($course_data as $course) {
if ($i % 2 == 0) {
$class_tr = 'row_odd';
} else {
$class_tr = 'row_even';
}
$data_table .= '<tr class="' . $class_tr . '">';
if (!isset($course[2])) {
$course[2] = '0:00:00';
}
foreach ($course as $cell) {
$data_table .= '<td align="right">' . $cell . '</td>';
}
$data_table .= '</tr>';
$i++;
}
$data_table .= '</table>';
} else {
$data_table .= get_lang('ThereIsNoInformationAboutYourCourses');
}
$content .= $data_table;
if (!empty($course_data)) {
$content .= '<div style="text-align:right;margin-top:10px;"><a href="' . api_get_path(
WEB_CODE_PATH
) . 'mySpace/course.php">' . get_lang('SeeMore') . '</a></div>';
}
$content .= '</div>';
return $content;
}
/**
* Get number of courses
* @return int
*/
function get_number_of_courses() {
return count($this->courses);
}
/**
* Get course information data
* @return array
*/
function get_course_information_data() {
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$a_course_students = array();
$course_data = array();
$courses = $this->courses;
$thematic = new Thematic();
foreach ($courses as $row_course) {
$course_code = $row_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;
// students directly subscribed to the course
$sql = "SELECT user_id FROM $tbl_course_user as course_rel_user WHERE course_rel_user.status=".STUDENT." AND course_rel_user.course_code='$course_code'";
$rs = Database::query($sql);
$users = array();
while ($row = Database::fetch_array($rs)) {
$users[] = $row['user_id'];
}
if (count($users) > 0) {
$nb_students_in_course = count($users);
$avg_time_spent_in_course = api_time_to_hms(Tracking::get_time_spent_on_the_course($users, $course_code)/$nb_students_in_course);
} else {
$avg_time_spent_in_course = null;
}
$tematic_advance_progress = 0;
$tematic_advance = $thematic->get_total_average_of_thematic_advances($course_code, 0);
if (!empty($tematic_advance)) {
$tematic_advance_progress = '<a title="'.get_lang('GoToThematicAdvance').'" href="'.api_get_path(WEB_CODE_PATH).'course_progress/index.php?cidReq='.$course_code.'&action=thematic_details">'.$tematic_advance.'%</a>';
} else {
$tematic_advance_progress = '0%';
}
$table_row = array();
$table_row[] = $row_course['title'];
$table_row[] = $nb_students_in_course;
$table_row[] = $avg_time_spent_in_course;
$table_row[] = $tematic_advance_progress;
$course_data[] = $table_row;
}
return $course_data;
}
* Get number of courses
* @return int
*/
function get_number_of_courses()
{
return count($this->courses);
}
/**
* Get course information data
* @return array
*/
function get_course_information_data()
{
$tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$course_data = array();
$courses = $this->courses;
$thematic = new Thematic();
foreach ($courses as $row_course) {
$course_code = $row_course['code'];
$nb_students_in_course = $avg_progress_in_course = $avg_score_in_course = $avg_time_spent_in_course = $avg_score_in_exercise = 0;
// students directly subscribed to the course
$sql = "SELECT user_id FROM $tbl_course_user as course_rel_user
WHERE course_rel_user.status=" . STUDENT . " AND course_rel_user.course_code='$course_code'";
$rs = Database::query($sql);
$users = array();
while ($row = Database::fetch_array($rs)) {
$users[] = $row['user_id'];
}
if (count($users) > 0) {
$nb_students_in_course = count($users);
$avg_time_spent_in_course = api_time_to_hms(
Tracking::get_time_spent_on_the_course($users, $course_code ) / $nb_students_in_course);
} else {
$avg_time_spent_in_course = null;
}
$tematic_advance = $thematic->get_total_average_of_thematic_advances(
$course_code,
0
);
if (!empty($tematic_advance)) {
$tematic_advance_progress = '<a title="' . get_lang('GoToThematicAdvance') . '" href="' . api_get_path(WEB_CODE_PATH) . 'course_progress/index.php?cidReq=' . $course_code . '&action=thematic_details">' . $tematic_advance . '%</a>';
} else {
$tematic_advance_progress = '0%';
}
$table_row = array();
$table_row[] = $row_course['title'];
$table_row[] = $nb_students_in_course;
$table_row[] = $avg_time_spent_in_course;
$table_row[] = $tematic_advance_progress;
$course_data[] = $table_row;
}
return $course_data;
}
}
?>

@ -5,158 +5,178 @@
* @package chamilo.dashboard
* @author Marco Sousa original code
* @author Julio Montoya class named was changed of name, and some minor changes
*/
/**
* required files for getting data
*/
require_once api_get_path(LIBRARY_PATH).'thematic.lib.php';
require_once api_get_path(LIBRARY_PATH).'attendance.lib.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be.inc.php';
require_once api_get_path(LIBRARY_PATH) . 'thematic.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'attendance.lib.php';
require_once api_get_path(SYS_CODE_PATH) . 'gradebook/lib/be.inc.php';
/**
* This class is used like controller for this course block plugin,
* the class name must be registered inside path.info file (e.g: controller = "BlockDiario"), so dashboard controller will be instantiate it
* @package chamilo.dashboard
*/
class BlockDaily extends Block {
private $user_id;
private $courses;
private $path;
private $permission = array(DRH);
/**
* Constructor
*/
public function __construct ($user_id) {
$this->user_id = $user_id;
$this->path = 'block_daily';
if ($this->is_block_visible_for_user($user_id)) {
/*if (api_is_platform_admin()) {
$this->courses = CourseManager::get_real_course_list();
} else {*/
$this->courses = CourseManager::get_courses_followed_by_drh($user_id);
//}
}
}
class BlockDaily extends Block
{
private $user_id;
private $courses;
private $path;
private $permission = array(DRH);
/**
* 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;
/**
* Constructor
*/
public function __construct($user_id)
{
$this->user_id = $user_id;
$this->path = 'block_daily';
if ($this->is_block_visible_for_user($user_id)) {
/*if (api_is_platform_admin()) {
$this->courses = CourseManager::get_real_course_list();
} else {*/
$this->courses = CourseManager::get_courses_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;
}
/**
* This method return content html containing information about courses and its position for showing it inside dashboard interface
* 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() {
public function get_block()
{
global $charset;
global $charset;
$column = 2;
$data = array();
$content = '';
$data_table = '';
$content = $this->get_content_html();
$html = '<li class="widget color-green" id="intro">
$column = 2;
$data = array();
$content = '';
$data_table = '';
$content = $this->get_content_html();
$html = '<li class="widget color-green" id="intro">
<div class="widget-head">
<h3>'.get_lang('GradebookAndAttendances').'</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>
<h3>' . get_lang('GradebookAndAttendances') . '</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">
'.$content.'
' . $content . '
</div>
</li>
';
$data['column'] = $column;
$data['content_html'] = $html;
$data['column'] = $column;
$data['content_html'] = $html;
return $data;
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_content_html() {
/**
* 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_content_html()
{
$course_data = $this->get_course_information_data();
$content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourCourseList').'</font></h3>';
$course_data = $this->get_course_information_data();
$content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">' . get_lang(
'YourCourseList'
) . '</font></h3>';
$data_table = null;
if (!empty($course_data)) {
$data_table .= '<table class="data_table" width:"95%">';
$data_table .= '<tr>
<th>'.get_lang('CourseTitle').'</th>
<th width="20%">'.get_lang('NbStudents').'</th>
<th width="20%">'.get_lang('Evaluation').'</th>
<th width="20%">'.get_lang('ToolAttendance').'</th>
if (!empty($course_data)) {
$data_table .= '<table class="data_table" width:"95%">';
$data_table .= '<tr>
<th>' . get_lang('CourseTitle') . '</th>
<th width="20%">' . get_lang('NbStudents') . '</th>
<th width="20%">' . get_lang('Evaluation') . '</th>
<th width="20%">' . get_lang('ToolAttendance') . '</th>
</tr>';
$i = 1;
foreach ($course_data as $course) {
if ($i%2 == 0) {
$class_tr = 'row_odd';
} else {
$class_tr = 'row_even';
}
$data_table .= '<tr class="'.$class_tr.'">';
if (!isset($course[3])) {
$course[3] = get_lang('NotAvailable');
}
foreach ($course as $cell) {
$data_table .= '<td align="right">'.$cell.'</td>';
}
$data_table .= '</tr>';
$i++;
}
$data_table .= '</table>';
} else {
$data_table .= get_lang('ThereIsNoInformationAboutYourCourses');
}
$content .= $data_table;
if (!empty($course_data)) {
$content .= '<div style="text-align:right;margin-top:10px;"><a href="'.api_get_path(WEB_CODE_PATH).'mySpace/course.php">'.get_lang('SeeMore').'</a></div>';
}
$content .= '</div>';
return $content;
}
$i = 1;
foreach ($course_data as $course) {
if ($i % 2 == 0) {
$class_tr = 'row_odd';
} else {
$class_tr = 'row_even';
}
$data_table .= '<tr class="' . $class_tr . '">';
if (!isset($course[3])) {
$course[3] = get_lang('NotAvailable');
}
foreach ($course as $cell) {
$data_table .= '<td align="right">' . $cell . '</td>';
}
$data_table .= '</tr>';
$i++;
}
$data_table .= '</table>';
} else {
$data_table .= get_lang('ThereIsNoInformationAboutYourCourses');
}
$content .= $data_table;
if (!empty($course_data)) {
$content .= '<div style="text-align:right;margin-top:10px;">
<a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/course.php">' . get_lang('SeeMore') . '</a></div>';
}
$content .= '</div>';
return $content;
}
/**
* Get number of courses
* @return int
*/
function get_number_of_courses()
{
return count($this->courses);
}
/**
* Get number of courses
* @return int
*/
function get_number_of_courses() {
return count($this->courses);
}
/**
* Get course information data
* @return array
*/
function get_course_information_data() {
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$a_course_students = array();
$course_data = array();
$courses = $this->courses;
foreach ($courses as $row_course) {
* Get course information data
* @return array
*/
function get_course_information_data()
{
$tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$course_data = array();
$courses = $this->courses;
foreach ($courses as $row_course) {
$score = null;
$course_code = $row_course['code'];
$course_info = api_get_course_info($course_code);
@ -167,63 +187,73 @@ class BlockDaily extends Block {
// Attendance table
$table_course = Database::get_course_table(TABLE_ATTENDANCE);
$sql = "SELECT id, name, attendance_qualify_max FROM $table_course WHERE c_id = ".$course_info['real_id']." AND active = 1 AND session_id = 0";
$rs = Database::query($sql);
$attendance = array();
$sql = "SELECT id, name, attendance_qualify_max FROM $table_course
WHERE c_id = " . $course_info['real_id'] . " AND active = 1 AND session_id = 0";
$rs = Database::query($sql);
$attendance = array();
$attendances = array();
$param_gradebook = '';
if (isset($_SESSION['gradebook'])) {
$param_gradebook = '&gradebook='.$_SESSION['gradebook'];
$param_gradebook = '&gradebook=' . $_SESSION['gradebook'];
}
while ($row = Database::fetch_array($rs,'ASSOC')) {
while ($row = Database::fetch_array($rs, 'ASSOC')) {
$attendance['done'] = $row['attendance_qualify_max'];
$attendance['id'] = $row['id'];
//$attendance['name'] = $row['name'];
$attendance['course_code'] = $course_code;
if ($attendance['done'] != '0')
$attendances[] = '<a href="'.api_get_path(WEB_PATH).'main/attendance/index.php?cidReq='.$attendance['course_code'].'&action=attendance_sheet_print&attendance_id='.$attendance['id'].$param_gradebook.'">'.Display::return_icon('printmgr.gif',get_lang('Print')).'</a>';
else
if ($attendance['done'] != '0') {
$attendances[] = '<a href="' . api_get_path(WEB_PATH).'main/attendance/index.php?cidReq=' . $attendance['course_code'] . '&action=attendance_sheet_print&attendance_id=' . $attendance['id'] . $param_gradebook . '">' . Display::return_icon('printmgr.gif', get_lang('Print')).'</a>';
} else {
$attendances[] = get_lang("NotAvailable");
}
// quantidade de alunos
$sql = "SELECT user_id FROM $tbl_course_user as course_rel_user WHERE course_rel_user.status=".STUDENT." AND course_rel_user.course_code='$course_code'";
$rs = Database::query($sql);
$users = array();
while ($row = Database::fetch_array($rs)) {
$users[] = $row['user_id'];
}
if (count($users) > 0) {
$nb_students_in_course = count($users);
}
if (!empty($tematic_advance)) {
$tematic_advance_progress = '<a title="'.get_lang('GoToThematicAdvance').'" href="'.api_get_path(WEB_CODE_PATH).'attendance/index.php?cidReq='.$course_code.'&action=attendance_sheet_print&attendance_id=">'.$tematic_advance.'%</a>';
} else {
$tematic_advance_progress = '0%';
}
}
}
// quantidade de alunos
$sql = "SELECT user_id FROM $tbl_course_user as course_rel_user
WHERE course_rel_user.status=" . STUDENT . " AND course_rel_user.course_code='$course_code'";
$rs = Database::query($sql);
$users = array();
while ($row = Database::fetch_array($rs)) {
$users[] = $row['user_id'];
}
if (count($users) > 0) {
$nb_students_in_course = count($users);
}
if (!empty($tematic_advance)) {
$tematic_advance_progress = '<a title="' . get_lang(
'GoToThematicAdvance'
) . '" href="' . api_get_path(
WEB_CODE_PATH
) . 'attendance/index.php?cidReq=' . $course_code . '&action=attendance_sheet_print&attendance_id=">' . $tematic_advance . '%</a>';
} else {
$tematic_advance_progress = '0%';
}
// Score
$tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$sql = "SELECT id from " . $tbl_grade_categories ." WHERE course_code ='".$course_code."'";
$rs = Database::query($sql);
$category = null;
while ($row = Database::fetch_array($rs)) {
$category = $row['id'];
}
if (!empty($category)) {
$tbl_grade_categories = Database :: get_main_table(
TABLE_MAIN_GRADEBOOK_CATEGORY
);
$sql = "SELECT id from " . $tbl_grade_categories . "
WHERE course_code ='" . $course_code . "'";
$rs = Database::query($sql);
$category = null;
while ($row = Database::fetch_array($rs)) {
$category = $row['id'];
}
if (!empty($category)) {
$cat = Category::load($category);
$eval = $cat[0]->get_evaluations();
if (count($eval) > 0){
if (count($eval) > 0) {
$i = 0;
foreach ($eval as $item) {
$score .= '<a href="'.api_get_path(WEB_PATH).'main/gradebook/gradebook_view_result.php?export=pdf&cat_code='.$cat[0]->get_id().'&official_code='.$cat[0]->get_course_code().'&selecteval='.$item->get_id().$param_gradebook.'">'.$item->get_name().'</a>';
if (count($eval)-1 != $i) {
$score .= '<a href="' . api_get_path(WEB_PATH).'main/gradebook/gradebook_view_result.php?export=pdf&cat_code=' . $cat[0]->get_id() . '&official_code=' . $cat[0]->get_course_code() . '&selecteval=' . $item->get_id().$param_gradebook . '">' . $item->get_name() . '</a>';
if (count($eval) - 1 != $i) {
$score .= ', ';
}
$i++;
@ -231,17 +261,17 @@ class BlockDaily extends Block {
} else {
$score = get_lang("NotAvailable");
}
} else {
} else {
$score = get_lang("NotAvailable");
}
$table_row = array();
$table_row[] = $row_course['title'];
$table_row[] = $nb_students_in_course;
$table_row[] = $score;
$table_row[] = $attendances[0];
$course_data[] = $table_row;
}
return $course_data;
}
}
$table_row = array();
$table_row[] = $row_course['title'];
$table_row[] = $nb_students_in_course;
$table_row[] = $score;
$table_row[] = $attendances[0];
$course_data[] = $table_row;
}
return $course_data;
}
}

@ -27,8 +27,8 @@ require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php';
* the class name must be registered inside path.info file (e.g: controller = "BlockEvaluationGraph"), so dashboard controller will be instantiate it
* @package chamilo.dashboard
*/
class BlockEvaluationGraph extends Block {
class BlockEvaluationGraph extends Block
{
private $user_id;
private $courses;
private $sessions;
@ -38,40 +38,34 @@ class BlockEvaluationGraph extends Block {
/**
* Constructor
*/
public function __construct ($user_id) {
public function __construct($user_id)
{
$this->path = 'block_evaluation_graph';
$this->user_id = $user_id;
$this->bg_width = 450;
$this->bg_height = 350;
if ($this->is_block_visible_for_user($user_id)) {
//$this->courses = CourseManager::get_real_course_list();
/*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);
//}
if ($this->is_block_visible_for_user($user_id)) {
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) {
*/
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;
}
/**
@ -79,70 +73,72 @@ class BlockEvaluationGraph extends Block {
* 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() {
public function get_block()
{
global $charset;
$column = 1;
$data = array();
$evaluations_base_courses_graph = $this->get_evaluations_base_courses_graph();
$evaluations_courses_in_sessions_graph = $this->get_evaluations_courses_in_sessions_graph();
$html = '<li class="widget color-orange" id="intro">
<div class="widget-head">
<h3>'.get_lang('EvaluationsGraph').'</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">';
if (empty($evaluations_base_courses_graph) && empty($evaluations_courses_in_sessions_graph)) {
$html .= '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>';
} else {
// display evaluations base courses graph
if (!empty($evaluations_base_courses_graph)) {
foreach ($evaluations_base_courses_graph as $course_code => $img_html) {
$html .= '<div><strong>'.$course_code.'</strong></div>';
$html .= $img_html;
}
}
// display evaluations base courses graph
if (!empty($evaluations_courses_in_sessions_graph)) {
foreach ($evaluations_courses_in_sessions_graph as $session_id => $courses) {
$session_name = api_get_session_name($session_id);
$html .= '<div><strong>'.$session_name.':'.get_lang('Evaluations').'</strong></div>';
foreach ($courses as $course_code => $img_html) {
$html .= '<div><strong>'.$course_code.'</strong></div>';
$html .= $img_html;
}
}
}
}
$html .= '</div>
</li>';
<div class="widget-head">
<h3>'.get_lang('EvaluationsGraph').'</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">';
if (empty($evaluations_base_courses_graph) && empty($evaluations_courses_in_sessions_graph)) {
$html .= '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>';
} else {
// display evaluations base courses graph
if (!empty($evaluations_base_courses_graph)) {
foreach ($evaluations_base_courses_graph as $course_code => $img_html) {
$html .= '<div><strong>'.$course_code.'</strong></div>';
$html .= $img_html;
}
}
// display evaluations base courses graph
if (!empty($evaluations_courses_in_sessions_graph)) {
foreach ($evaluations_courses_in_sessions_graph as $session_id => $courses) {
$session_name = api_get_session_name($session_id);
$html .= '<div><strong>'.$session_name.':'.get_lang('Evaluations').'</strong></div>';
foreach ($courses as $course_code => $img_html) {
$html .= '<div><strong>'.$course_code.'</strong></div>';
$html .= $img_html;
}
}
}
}
$html .= '</div>
</li>';
$data['column'] = $column;
$data['content_html'] = $html;
return $data;
return $data;
}
/**
* 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
* 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();
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);
$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) && isset($cats[0])) {
$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();
$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();
@ -150,74 +146,77 @@ class BlockEvaluationGraph extends Block {
$max[] = $evaluation['max'];
$min[] = $evaluation['min'];
$avg[] = $evaluation['avg'];
}
// Dataset definition
$data_set = new pData;
$data_set->AddPoint($max, "Max");
}
// 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($min, "Min");
$data_set->AddPoint($items, "Items");
$data_set->SetXAxisName(get_lang('EvaluationName'));
$data_set->SetYAxisName(get_lang('Percentage'));
$data_set->AddAllSeries();
$data_set->RemoveSerie("Items");
$data_set->SetAbsciseLabelSerie("Items");
$graph_id = $this->user_id.'StudentEvaluationGraph';
$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)) {
$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($this->bg_width,$this->bg_height);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test->setGraphArea(50,30,$this->bg_width-75,$this->bg_height-75);
$test->drawFilledRoundedRectangle(7,7,$this->bg_width-20,$this->bg_height-20,5,240,240,240);
$test->drawRoundedRectangle(5,5,$this->bg_width-18,$this->bg_height-18,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);
// Initialise the graph
$test = new pChart($this->bg_width,$this->bg_height);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test->setGraphArea(50,30,$this->bg_width-75,$this->bg_height-75);
$test->drawFilledRoundedRectangle(7,7,$this->bg_width-20,$this->bg_height-20,5,240,240,240);
$test->drawRoundedRectangle(5,5,$this->bg_width-18,$this->bg_height-18,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,105,221,34);
$test->setColorPalette(1,255,135,30);
$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(), 90);
// Finish the graph
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test->drawLegend($this->bg_width-80,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->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(), 90);
// Finish the graph
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test->drawLegend($this->bg_width-80,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->setColorPalette(0,50,50,50);
$test->setColorPalette(1,50,50,50);
$test->setColorPalette(2,50,50,50);
$test->writeValues($data_set->GetData(),$data_set->GetDataDescription(),array("Min", "Max", "Avg"));
$test->setColorPalette(2,50,50,50);
$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());
}
$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.'">';
}
}
}
}
}
} // end for
}
return $graphs;
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
* This method return a graph containing information 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() {
public function get_evaluations_courses_in_sessions_graph()
{
$graphs = array();
if (!empty($this->sessions)) {
$session_ids = array_keys($this->sessions);
@ -227,7 +226,7 @@ class BlockEvaluationGraph extends Block {
foreach ($courses_code as $course_code) {
$cats = Category::load(null, null, $course_code, null, null, $session_id);
if (isset($cats) && isset($cats[0])) {
$alleval = $cats[0]->get_evaluations(null, true, $course_code);
$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);
@ -239,69 +238,69 @@ class BlockEvaluationGraph extends Block {
$max[] = $evaluation['max'];
$min[] = $evaluation['min'];
$avg[] = $evaluation['avg'];
}
// Dataset definition
$data_set = new pData;
$data_set->AddPoint($max, "Max");
}
// 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($min, "Min");
$data_set->AddPoint($items, "Items");
$data_set->SetXAxisName(get_lang('EvaluationName'));
$data_set->SetYAxisName(get_lang('Percentage'));
$data_set->AddAllSeries();
$data_set->RemoveSerie("Items");
$data_set->SetAbsciseLabelSerie("Items");
$graph_id = $this->user_id.'StudentEvaluationGraph';
$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)) {
$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($this->bg_width,$this->bg_height);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test->setGraphArea(50,30,$this->bg_width-75,$this->bg_height-75);
$test->drawFilledRoundedRectangle(7,7,$this->bg_width-20,$this->bg_height-20,5,240,240,240);
$test->drawRoundedRectangle(5,5,$this->bg_width-18,$this->bg_height-18,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);
// Initialise the graph
$test = new pChart($this->bg_width,$this->bg_height);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test->setGraphArea(50,30,$this->bg_width-75,$this->bg_height-75);
$test->drawFilledRoundedRectangle(7,7,$this->bg_width-20,$this->bg_height-20,5,240,240,240);
$test->drawRoundedRectangle(5,5,$this->bg_width-18,$this->bg_height-18,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,105,221,34);
$test->setColorPalette(1,255,135,30);
$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($this->bg_width-80,20,$data_set->GetDataDescription(),255,255,255);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',10);
$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($this->bg_width-80,20,$data_set->GetDataDescription(),255,255,255);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',10);
$test->setColorPalette(0,50,50,50);
$test->setColorPalette(1,50,50,50);
$test->setColorPalette(2,50,50,50);
$test->writeValues($data_set->GetData(),$data_set->GetDataDescription(),array("Min", "Max", "Avg"));
$test->setColorPalette(2,50,50,50);
$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());
}
$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.'">';
}
}
}
}
}
}
}
if (!empty($courses_graph)) {
$graphs[$session_id] = $courses_graph;
}
}
}
$graphs[$session_id] = $courses_graph;
}
}
}
return $graphs;
}
}
}

@ -13,10 +13,12 @@ require_once api_get_path(LIBRARY_PATH).'course_description.lib.php';
/**
* This class is used like controller for this session block plugin,
* the class name must be registered inside path.info file (e.g: controller = "BlockSession"), so dashboard controller will be instantiate it
* the class name must be registered inside path.info file
* (e.g: controller = "BlockSession"), so dashboard controller will be instantiate it
* @package chamilo.dashboard
*/
class BlockSession extends Block {
class BlockSession extends Block
{
private $user_id;
private $sessions;
@ -26,15 +28,12 @@ class BlockSession extends Block {
/**
* Constructor
*/
public function __construct ($user_id) {
public function __construct ($user_id)
{
$this->user_id = $user_id;
$this->path = 'block_session';
if ($this->is_block_visible_for_user($user_id)) {
/*if (api_is_platform_admin()) {
$this->sessions = SessionManager::get_sessions_list();
} else {*/
$this->sessions = SessionManager::get_sessions_followed_by_drh($user_id);
//}
$this->sessions = SessionManager::get_sessions_followed_by_drh($user_id);
}
}
@ -42,15 +41,16 @@ class BlockSession extends Block {
* 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;
}
/**
@ -58,7 +58,8 @@ class BlockSession extends Block {
* 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() {
public function get_block()
{
global $charset;
@ -89,47 +90,48 @@ class BlockSession extends Block {
* 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_content_html() {
public function get_content_html()
{
$content = '';
$sessions = $this->sessions;
$content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourSessionsList').'</font></h3>';
if (count($sessions) > 0) {
if (count($sessions) > 0) {
$sessions_table = '<table class="data_table" width:"95%">';
$sessions_table .= '<tr>
$sessions_table .= '<tr>
<th >'.get_lang('Title').'</th>
<th >'.get_lang('Date').'</th>
<th width="100px">'.get_lang('NbCoursesPerSession').'</th>
<th width="100px">'.get_lang('NbCoursesPerSession').'</th>
</tr>';
$i = 1;
foreach ($sessions as $session) {
$session_id = intval($session['id']);
$title = $session['name'];
$title = $session['name'];
if ($session['date_start'] != '0000-00-00' && $session['date_end'] != '0000-00-00') {
$date = get_lang('From').' '.api_convert_and_format_date($session['date_start'], DATE_FORMAT_SHORT, date_default_timezone_get()).' '.get_lang('To').' '.api_convert_and_format_date($session['date_end'], DATE_FORMAT_SHORT, date_default_timezone_get());
} else {
$date = ' - ';
}
$count_courses_in_session = count(Tracking::get_courses_list_from_session($session_id));
if ($i%2 == 0) $class_tr = 'row_odd';
else $class_tr = 'row_even';
$sessions_table .= '<tr class="'.$class_tr.'">
<td>'.$title.'</td>
<td align="center">'.$date.'</td>
<td align="center">'.$count_courses_in_session.'</td>
<td align="center">'.$count_courses_in_session.'</td>
</tr>';
$i++;
}
$sessions_table .= '</table>';
$content .= $sessions_table;
$content .= $sessions_table;
} else {
$content .= get_lang('ThereIsNoInformationAboutYourSessions');
}
@ -147,8 +149,9 @@ class BlockSession extends Block {
* Get number of sessions
* @return int
*/
function get_number_of_sessions() {
function get_number_of_sessions()
{
return count($this->sessions);
}
}
}

@ -21,7 +21,8 @@ require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php';
* the class name must be registered inside path.info file (e.g: controller = "BlockStudent"), so dashboard controller will be instantiate it
* @package chamilo.dashboard
*/
class BlockStudent extends Block {
class BlockStudent extends Block
{
private $user_id;
private $students;
@ -31,16 +32,12 @@ class BlockStudent extends Block {
/**
* Constructor
*/
public function __construct ($user_id) {
public function __construct ($user_id)
{
$this->user_id = $user_id;
$this->path = 'block_student';
if ($this->is_block_visible_for_user($user_id)) {
/*if (api_is_platform_admin()) {
$this->students = UserManager::get_user_list(array('status' => STUDENT));
} else {*/
$this->students = UserManager::get_users_followed_by_drh($user_id, STUDENT);
//}
}
}
@ -49,7 +46,8 @@ class BlockStudent extends Block {
* @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;
@ -64,7 +62,8 @@ class BlockStudent extends Block {
* 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() {
public function get_block()
{
global $charset;
$column = 1;
$data = array();
@ -90,7 +89,8 @@ class BlockStudent extends Block {
* 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_students_content_html_for_platform_admin() {
public function get_students_content_html_for_platform_admin()
{
$students = $this->students;
$content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourStudents').'</font></h3>';
@ -235,6 +235,7 @@ class BlockStudent extends Block {
</div>';
}
$content .= '</div>';
return $content;
}
@ -242,7 +243,8 @@ class BlockStudent extends Block {
* Get number of students
* @return int
*/
function get_number_of_students() {
function get_number_of_students()
{
return count($this->students);
}
}
}

@ -2,17 +2,17 @@
/* For licensing terms, see /license.txt */
/**
* This file is part of student graph block plugin for dashboard,
* This file is part of student 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
* @author Julio Montoya <gugli100@gmail.com>
* @author Julio Montoya <gugli100@gmail.com>
*/
/**
* required files for getting data
*/
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';
@ -25,11 +25,12 @@ require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/linkfactory.class.php
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php';
/**
* This class is used like controller for student graph block plugin,
* This class is used like controller for student graph block plugin,
* the class name must be registered inside path.info file (e.g: controller = "BlockStudentGraph"), so dashboard controller will be instantiate it
* @package chamilo.dashboard
*/
class BlockStudentGraph extends Block {
class BlockStudentGraph extends Block
{
private $user_id;
private $students;
@ -38,172 +39,178 @@ class BlockStudentGraph extends Block {
/**
* Constructor
*/
public function __construct ($user_id) {
*/
public function __construct ($user_id)
{
$this->user_id = $user_id;
$this->path = 'block_student_graph';
$this->path = 'block_student_graph';
if ($this->is_block_visible_for_user($user_id)) {
/*if (api_is_platform_admin()) {
$this->students = UserManager::get_user_list(array('status' => STUDENT));
} else if (api_is_drh()) {*/
$this->students = UserManager::get_users_followed_by_drh($user_id, STUDENT);
//}
}
//}
}
}
/**
* 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 students and its position for showing it inside dashboard interface
* it's important to use the name 'get_block' for beeing used from dashboard controller
* This method return content html containing information about students
* and its position for showing it inside dashboard interface
* it's important to use the name 'get_block' for being used from dashboard controller
* @return array column and content html
*/
public function get_block() {
public function get_block()
{
global $charset;
$column = 1;
$data = array();
$data = array();
$students_attendance_graph = $this->get_students_attendance_graph();
$html = '<li class="widget color-orange" id="intro">
<div class="widget-head">
<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 style="padding:10px;"><strong>'.get_lang('AttendancesFaults').'</strong></div>
</div>
<div class="widget-content" align="center">
<div style="padding:10px;"><strong>'.get_lang('AttendancesFaults').'</strong></div>
'.$students_attendance_graph.'
</div>
</li>';
</li>';
$data['column'] = $column;
$data['content_html'] = $html;
return $data;
$data['content_html'] = $html;
return $data;
}
/**
* This method return a graph containing informations about students evaluation, it's used inside get_block method for showing it inside dashboard interface
* This method return a graph containing information about students evaluation,
* it's used inside get_block method for showing it inside dashboard interface
* @return string img html
*/
public function get_students_attendance_graph() {
public function get_students_attendance_graph()
{
$students = $this->students;
$attendance = new Attendance();
// get data
// get data
$attendances_faults_avg = array();
if (is_array($students) && count($students) > 0) {
foreach ($students as $student) {
if (is_array($students) && count($students) > 0) {
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
//$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['lastname']] = $results_faults_avg['porcent'];
$attendances_faults_avg[$student['lastname']] = $results_faults_avg['porcent'];
} else {
$attendances_faults_avg[$student['lastname']] = 0;
}
}
}
}
arsort($attendances_faults_avg);
$usernames = array_keys($attendances_faults_avg);
$faults = array();
arsort($attendances_faults_avg);
$usernames = array_keys($attendances_faults_avg);
$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->AddPoint($faults,"Promedio");
$data_set->AddPoint($usernames,"Usuario");
$data_set->AddAllSeries();
$data_set->SetAbsciseLabelSerie("Usuario");
// prepare cache for saving image
$graph_id = $this->user_id.'StudentEvaluationGraph'; // the graph id
$cache = new pCache();
$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 (0) {
//if we already created the img
$img_file = $cache->GetHash($graph_id, $data_set->GetData()); // image file with hash
} else {
if (count($usernames) < 5) {
$height = 200;
} else {
$height = (count($usernames)*40);
} else {
if (count($usernames) < 5) {
$height = 200;
} else {
$height = (count($usernames)*40);
}
// Initialise the graph
$test = new MyHorBar(400,($height+30));
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 8);
$test->setGraphArea(100,30,370,$height);
$test->drawFilledRoundedRectangle(7,7,393,$height,5,240,240,240);
$test->drawRoundedRectangle(5,5,395,$height,5,230,230,230);
$test->drawGraphArea(255,255,255,TRUE);
//X axis
$test->setFixedScale(0,100,10);
//var_dump($data_set->GetDataDescription());
$test->drawHorScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_ADDALL,150,150,150,TRUE,0,0,TRUE);
$test->setColorPalette(0,255,0,0);
$test->drawHorScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_ADDALL,150,150,150,TRUE,0,0,TRUE);
$test->setColorPalette(0,255,0,0);
$test->drawHorGrid(10,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->drawHorBarGraph($data_set->GetData(),$data_set->GetDataDescription(),TRUE,50);
$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;
}
/**
* Get number of students
* @return int
*/
function get_number_of_students() {
function get_number_of_students()
{
return count($this->students);
}
}
}
}

@ -12,10 +12,12 @@
/**
* This class is used like controller for teacher block plugin,
* the class name must be registered inside path.info file (e.g: controller = "BlockTeacher"), so dashboard controller will be instantiate it
* the class name must be registered inside path.info file
* (e.g: controller = "BlockTeacher"), so dashboard controller will be instantiate it
* @package chamilo.dashboard
*/
class BlockTeacher extends Block {
class BlockTeacher extends Block
{
private $user_id;
private $teachers;
@ -25,15 +27,12 @@ class BlockTeacher extends Block {
/**
* Controller
*/
public function __construct ($user_id) {
public function __construct ($user_id)
{
$this->user_id = $user_id;
$this->path = 'block_teacher';
if ($this->is_block_visible_for_user($user_id)) {
/*if (api_is_platform_admin()) {
$this->teachers = UserManager::get_user_list(array('status' => COURSEMANAGER));
} else {*/
$this->teachers = UserManager::get_users_followed_by_drh($user_id, COURSEMANAGER);
//}
$this->teachers = UserManager::get_users_followed_by_drh($user_id, COURSEMANAGER);
}
}
@ -42,7 +41,8 @@ class BlockTeacher extends Block {
* @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;
@ -57,29 +57,24 @@ class BlockTeacher extends Block {
* 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() {
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_content_html = $this->get_teachers_content_html_for_drh();
//}
$data = array();
$teacher_content_html = $this->get_teachers_content_html_for_drh();
$html = '
<li class="widget color-blue" id="intro">
<div class="widget-head">
<h3>'.get_lang('TeachersInformationsList').'</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">
'.$teacher_content_html.'
</div>
</li>
<li class="widget color-blue" id="intro">
<div class="widget-head">
<h3>'.get_lang('TeachersInformationsList').'</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">
'.$teacher_content_html.'
</div>
</li>
';
$data['column'] = $column;
@ -93,8 +88,8 @@ class BlockTeacher extends Block {
* 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_content_html_for_platform_admin() {
public function get_teachers_content_html_for_platform_admin()
{
$teachers = $this->teachers;
$content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourTeachers').'</font></h3>';
@ -141,16 +136,17 @@ class BlockTeacher extends Block {
$content .= $teachers_table;
if (count($teachers) > 0) {
$content .= '<div style="text-align:right;margin-top:10px;"><a href="'.api_get_path(WEB_CODE_PATH).'mySpace/index.php?view=admin">'.get_lang('SeeMore').'</a></div>';
$content .= '<div style="text-align:right;margin-top:10px;">
<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/index.php?view=admin">'.get_lang('SeeMore').'</a></div>';
}
$content .= '</div>';
return $content;
}
public function get_teachers_content_html_for_drh() {
public function get_teachers_content_html_for_drh()
{
$teachers = $this->teachers;
$content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourTeachers').'</font></h3>';
@ -198,15 +194,14 @@ class BlockTeacher extends Block {
$content .= '</div>';
return $content;
}
/**
* Get number of teachers
* @return int
*/
function get_number_of_teachers() {
function get_number_of_teachers()
{
return count($this->teachers);
}
}
}

@ -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
@ -16,14 +16,13 @@ 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
*/
class BlockTeacherGraph extends Block {
class BlockTeacherGraph extends Block
{
private $user_id;
private $teachers;
@ -33,87 +32,79 @@ 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)) {
/*if (api_is_platform_admin()) {
$this->teachers = UserManager::get_user_list(array('status' => COURSEMANAGER));
} else {*/
$this->teachers = UserManager::get_users_followed_by_drh($user_id, COURSEMANAGER);
//}
$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() {
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>
<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>
';
$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>
<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>
';
$data['column'] = $column;
$data['content_html'] = $html;
return $data;
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() {
public function get_teachers_information_graph()
{
$teachers = $this->teachers;
$graph = '';
$user_ids = array_keys($teachers);
$user_ids = array_keys($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) {
@ -122,83 +113,83 @@ class BlockTeacherGraph extends Block {
$end_date = api_get_utc_datetime($day+(3600*24-1));
$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);
$hours = floor($time_on_platform_by_day / 3600);
$min = floor(($time_on_platform_by_day - ($hours * 3600)) / 60);
$time_by_days[] = $min;
$time_by_days[] = $min;
}
$data_set->AddPoint($time_by_days,$username);
$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() {
function get_number_of_teachers()
{
return count($this->teachers);
}
}
}

Loading…
Cancel
Save