Minor - format code.

1.9.x
Julio Montoya 12 years ago
parent 7676bbac14
commit b6df93a346
  1. 100
      plugin/dashboard/block_course/block_course.class.php
  2. 114
      plugin/dashboard/block_daily/block_daily.class.php
  3. 37
      plugin/dashboard/block_evaluation_graph/block_evaluation_graph.class.php
  4. 25
      plugin/dashboard/block_session/block_session.class.php
  5. 24
      plugin/dashboard/block_student/block_student.class.php
  6. 27
      plugin/dashboard/block_student_graph/block_student_graph.class.php
  7. 41
      plugin/dashboard/block_teacher/block_teacher.class.php
  8. 35
      plugin/dashboard/block_teacher_graph/block_teacher_graph.class.php

@ -9,14 +9,15 @@
/**
* 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 {
class BlockCourse extends Block
{
private $user_id;
private $courses;
@ -26,14 +27,17 @@ class BlockCourse extends Block {
/**
* Constructor
*/
public function __construct ($user_id) {
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->courses = CourseManager::get_courses_followed_by_drh(
$user_id
);
//}
}
}
@ -43,26 +47,29 @@ class BlockCourse 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;
if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) {
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;
$column = 2;
$data = array();
$content = '';
@ -71,11 +78,20 @@ class BlockCourse extends Block {
$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>
';
@ -89,33 +105,40 @@ class BlockCourse 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()
{
$course_data = $this->get_course_information_data();
$content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourCourseList').'</font></h3>';
$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>
<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) {
if ($i % 2 == 0) {
$class_tr = 'row_odd';
} else {
$class_tr = 'row_even';
}
$data_table .= '<tr class="'.$class_tr.'">';
$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 .= '<td align="right">' . $cell . '</td>';
}
$data_table .= '</tr>';
$i++;
@ -126,7 +149,9 @@ class BlockCourse extends Block {
}
$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 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>';
@ -137,7 +162,8 @@ class BlockCourse extends Block {
* Get number of courses
* @return int
*/
function get_number_of_courses() {
function get_number_of_courses()
{
return count($this->courses);
}
@ -145,11 +171,9 @@ class BlockCourse extends Block {
* Get course information data
* @return array
*/
function get_course_information_data() {
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
function get_course_information_data()
{
$tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$a_course_students = array();
$course_data = array();
$courses = $this->courses;
@ -158,10 +182,11 @@ class BlockCourse extends Block {
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;
$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'";
$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)) {
@ -169,17 +194,18 @@ class BlockCourse extends Block {
}
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);
$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);
$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>';
$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%';
}
@ -194,6 +220,4 @@ class BlockCourse extends Block {
return $course_data;
}
}
?>

@ -5,23 +5,23 @@
* @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 {
class BlockDaily extends Block
{
private $user_id;
private $courses;
@ -31,14 +31,17 @@ class BlockDaily extends Block {
/**
* Constructor
*/
public function __construct ($user_id) {
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->courses = CourseManager::get_courses_followed_by_drh(
$user_id
);
//}
}
}
@ -48,23 +51,28 @@ class BlockDaily 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;
if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) {
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;
@ -75,11 +83,20 @@ class BlockDaily extends Block {
$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>
';
@ -93,33 +110,36 @@ class BlockDaily 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()
{
$course_data = $this->get_course_information_data();
$content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourCourseList').'</font></h3>';
$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>
<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) {
if ($i % 2 == 0) {
$class_tr = 'row_odd';
} else {
$class_tr = 'row_even';
}
$data_table .= '<tr class="'.$class_tr.'">';
$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 .= '<td align="right">' . $cell . '</td>';
}
$data_table .= '</tr>';
$i++;
@ -130,7 +150,8 @@ class BlockDaily extends Block {
}
$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 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;
@ -140,7 +161,8 @@ class BlockDaily extends Block {
* Get number of courses
* @return int
*/
function get_number_of_courses() {
function get_number_of_courses()
{
return count($this->courses);
}
@ -148,11 +170,9 @@ class BlockDaily extends Block {
* Get course information data
* @return array
*/
function get_course_information_data() {
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
function get_course_information_data()
{
$tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$a_course_students = array();
$course_data = array();
$courses = $this->courses;
@ -167,31 +187,34 @@ 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";
$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'";
$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)) {
@ -202,14 +225,21 @@ class BlockDaily extends Block {
}
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>';
$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."'";
$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)) {
@ -219,11 +249,11 @@ class BlockDaily extends Block {
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++;

@ -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,25 +38,18 @@ 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);
//}
}
}
/**
@ -64,7 +57,8 @@ class BlockEvaluationGraph 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;
@ -79,15 +73,14 @@ 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">
@ -127,10 +120,13 @@ class BlockEvaluationGraph extends Block {
}
/**
* This method return a graph containing informations about evaluations inside base courses, it's used inside get_block method for showing it inside dashboard interface
* 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() {
public function get_evaluations_base_courses_graph()
{
$graphs = array();
if (!empty($this->courses)) {
$courses_code = array_keys($this->courses);
@ -214,10 +210,13 @@ class BlockEvaluationGraph extends Block {
}
/**
* 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);

@ -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);
//}
}
}
@ -43,7 +42,8 @@ class BlockSession 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;
@ -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,7 +90,8 @@ 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;
@ -147,7 +149,8 @@ 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);
}
}

@ -29,7 +29,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 = "BlockStudentGraph"), so dashboard controller will be instantiate it
* @package chamilo.dashboard
*/
class BlockStudentGraph extends Block {
class BlockStudentGraph extends Block
{
private $user_id;
private $students;
@ -39,7 +40,8 @@ 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';
if ($this->is_block_visible_for_user($user_id)) {
@ -56,7 +58,8 @@ class BlockStudentGraph 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;
@ -67,14 +70,15 @@ class BlockStudentGraph extends Block {
}
/**
* 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();
$students_attendance_graph = $this->get_students_attendance_graph();
@ -95,10 +99,12 @@ class BlockStudentGraph extends Block {
}
/**
* 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();
@ -203,7 +209,8 @@ class BlockStudentGraph extends Block {
* 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);
//}
}
}
@ -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,18 +57,13 @@ 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();
//}
$html = '
<li class="widget color-blue" id="intro">
@ -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);
}
}

@ -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,
* 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,15 +32,12 @@ 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);
//}
}
}
@ -50,7 +46,8 @@ class BlockTeacherGraph 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;
@ -65,19 +62,13 @@ class BlockTeacherGraph 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_information_graph = $this->get_teachers_information_graph();
//}
$html = '
<li class="widget color-blue" id="intro">
<div class="widget-head">
@ -102,8 +93,8 @@ class BlockTeacherGraph 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_information_graph() {
public function get_teachers_information_graph()
{
$teachers = $this->teachers;
$graph = '';
@ -188,16 +179,16 @@ class BlockTeacherGraph extends Block {
} else {
$graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>';
}
return $graph;
return $graph;
}
/**
* Get number of teachers
* @return int
*/
function get_number_of_teachers() {
function get_number_of_teachers()
{
return count($this->teachers);
}

Loading…
Cancel
Save