Minor - format code.

1.9.x
Julio Montoya 12 years ago
parent 7676bbac14
commit b6df93a346
  1. 82
      plugin/dashboard/block_course/block_course.class.php
  2. 78
      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

@ -16,7 +16,8 @@ require_once api_get_path(LIBRARY_PATH).'thematic.lib.php';
* the class name must be registered inside path.info file (e.g: controller = "BlockCourse"), so dashboard controller will be instantiate it * the class name must be registered inside path.info file (e.g: controller = "BlockCourse"), so dashboard controller will be instantiate it
* @package chamilo.dashboard * @package chamilo.dashboard
*/ */
class BlockCourse extends Block { class BlockCourse extends Block
{
private $user_id; private $user_id;
private $courses; private $courses;
@ -26,14 +27,17 @@ class BlockCourse extends Block {
/** /**
* Constructor * Constructor
*/ */
public function __construct ($user_id) { public function __construct($user_id)
{
$this->user_id = $user_id; $this->user_id = $user_id;
$this->path = 'block_course'; $this->path = 'block_course';
if ($this->is_block_visible_for_user($user_id)) { if ($this->is_block_visible_for_user($user_id)) {
/*if (api_is_platform_admin()) { /*if (api_is_platform_admin()) {
$this->courses = CourseManager::get_real_course_list(); $this->courses = CourseManager::get_real_course_list();
} else {*/ } 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 * @param int User id
* @return bool Is block visible for user * @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_info = api_get_user_info($user_id);
$user_status = $user_info['status']; $user_status = $user_info['status'];
$is_block_visible_for_user = false; $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; $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 courses and its position for showing it inside dashboard interface * 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 * it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html * @return array column and content html
*/ */
public function get_block() { public function get_block()
{
global $charset; global $charset;
$column = 2; $column = 2;
$data = array(); $data = array();
$content = ''; $content = '';
@ -72,7 +79,16 @@ class BlockCourse extends Block {
<li class="widget color-green" id="intro"> <li class="widget color-green" id="intro">
<div class="widget-head"> <div class="widget-head">
<h3>' . get_lang('CoursesInformation') . '</h3> <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 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>
<div class="widget-content"> <div class="widget-content">
' . $content . ' ' . $content . '
@ -89,19 +105,26 @@ class BlockCourse extends Block {
* This method return a content html, it's used inside get_block method for showing it inside dashboard interface * This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html * @return string content html
*/ */
public function get_content_html() { public function get_content_html()
{
$course_data = $this->get_course_information_data(); $course_data = $this->get_course_information_data();
$content = '<div style="margin:10px;">'; $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; $data_table = null;
if (!empty($course_data)) { if (!empty($course_data)) {
$data_table .= '<table class="data_table" width:"95%">'; $data_table .= '<table class="data_table" width:"95%">';
$data_table .= '<tr> $data_table .= '<tr>
<th>' . get_lang('CourseTitle') . '</th> <th>' . get_lang('CourseTitle') . '</th>
<th width="20%">' . get_lang('NbStudents') . '</th> <th width="20%">' . get_lang('NbStudents') . '</th>
<th width="20%">'.get_lang('AvgTimeSpentInTheCourse').'</th> <th width="20%">' . get_lang(
<th width="20%">'.get_lang('ThematicAdvance').'</th> 'AvgTimeSpentInTheCourse'
) . '</th>
<th width="20%">' . get_lang(
'ThematicAdvance'
) . '</th>
</tr>'; </tr>';
$i = 1; $i = 1;
foreach ($course_data as $course) { foreach ($course_data as $course) {
@ -126,7 +149,9 @@ class BlockCourse extends Block {
} }
$content .= $data_table; $content .= $data_table;
if (!empty($course_data)) { 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>'; $content .= '</div>';
@ -137,7 +162,8 @@ class BlockCourse extends Block {
* Get number of courses * Get number of courses
* @return int * @return int
*/ */
function get_number_of_courses() { function get_number_of_courses()
{
return count($this->courses); return count($this->courses);
} }
@ -145,11 +171,9 @@ class BlockCourse extends Block {
* Get course information data * Get course information data
* @return array * @return array
*/ */
function get_course_information_data() { 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); $tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$a_course_students = array();
$course_data = array(); $course_data = array();
$courses = $this->courses; $courses = $this->courses;
@ -158,10 +182,11 @@ class BlockCourse extends Block {
foreach ($courses as $row_course) { foreach ($courses as $row_course) {
$course_code = $row_course['code']; $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 // 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); $rs = Database::query($sql);
$users = array(); $users = array();
while ($row = Database::fetch_array($rs)) { while ($row = Database::fetch_array($rs)) {
@ -169,14 +194,15 @@ class BlockCourse extends Block {
} }
if (count($users) > 0) { if (count($users) > 0) {
$nb_students_in_course = count($users); $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 { } else {
$avg_time_spent_in_course = null; $avg_time_spent_in_course = null;
} }
$tematic_advance = $thematic->get_total_average_of_thematic_advances(
$tematic_advance_progress = 0; $course_code,
0
$tematic_advance = $thematic->get_total_average_of_thematic_advances($course_code, 0); );
if (!empty($tematic_advance)) { 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>';
@ -194,6 +220,4 @@ class BlockCourse extends Block {
return $course_data; return $course_data;
} }
} }
?>

@ -5,7 +5,6 @@
* @package chamilo.dashboard * @package chamilo.dashboard
* @author Marco Sousa original code * @author Marco Sousa original code
* @author Julio Montoya class named was changed of name, and some minor changes * @author Julio Montoya class named was changed of name, and some minor changes
*/ */
/** /**
@ -21,7 +20,8 @@ require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be.inc.php';
* the class name must be registered inside path.info file (e.g: controller = "BlockDiario"), so dashboard controller will be instantiate it * the class name must be registered inside path.info file (e.g: controller = "BlockDiario"), so dashboard controller will be instantiate it
* @package chamilo.dashboard * @package chamilo.dashboard
*/ */
class BlockDaily extends Block { class BlockDaily extends Block
{
private $user_id; private $user_id;
private $courses; private $courses;
@ -31,14 +31,17 @@ class BlockDaily extends Block {
/** /**
* Constructor * Constructor
*/ */
public function __construct ($user_id) { public function __construct($user_id)
{
$this->user_id = $user_id; $this->user_id = $user_id;
$this->path = 'block_daily'; $this->path = 'block_daily';
if ($this->is_block_visible_for_user($user_id)) { if ($this->is_block_visible_for_user($user_id)) {
/*if (api_is_platform_admin()) { /*if (api_is_platform_admin()) {
$this->courses = CourseManager::get_real_course_list(); $this->courses = CourseManager::get_real_course_list();
} else {*/ } 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 * @param int User id
* @return bool Is block visible for user * @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_info = api_get_user_info($user_id);
$user_status = $user_info['status']; $user_status = $user_info['status'];
$is_block_visible_for_user = false; $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; $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 courses and its position for showing it inside dashboard interface * 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 * it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html * @return array column and content html
*/ */
public function get_block() { public function get_block()
{
global $charset; global $charset;
@ -76,7 +84,16 @@ class BlockDaily extends Block {
$html = '<li class="widget color-green" id="intro"> $html = '<li class="widget color-green" id="intro">
<div class="widget-head"> <div class="widget-head">
<h3>' . get_lang('GradebookAndAttendances') . '</h3> <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 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>
<div class="widget-content"> <div class="widget-content">
' . $content . ' ' . $content . '
@ -93,11 +110,14 @@ class BlockDaily extends Block {
* This method return a content html, it's used inside get_block method for showing it inside dashboard interface * This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html * @return string content html
*/ */
public function get_content_html() { public function get_content_html()
{
$course_data = $this->get_course_information_data(); $course_data = $this->get_course_information_data();
$content = '<div style="margin:10px;">'; $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; $data_table = null;
if (!empty($course_data)) { if (!empty($course_data)) {
$data_table .= '<table class="data_table" width:"95%">'; $data_table .= '<table class="data_table" width:"95%">';
@ -130,7 +150,8 @@ class BlockDaily extends Block {
} }
$content .= $data_table; $content .= $data_table;
if (!empty($course_data)) { 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>'; $content .= '</div>';
return $content; return $content;
@ -140,7 +161,8 @@ class BlockDaily extends Block {
* Get number of courses * Get number of courses
* @return int * @return int
*/ */
function get_number_of_courses() { function get_number_of_courses()
{
return count($this->courses); return count($this->courses);
} }
@ -148,11 +170,9 @@ class BlockDaily extends Block {
* Get course information data * Get course information data
* @return array * @return array
*/ */
function get_course_information_data() { 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); $tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$a_course_students = array();
$course_data = array(); $course_data = array();
$courses = $this->courses; $courses = $this->courses;
@ -167,7 +187,8 @@ class BlockDaily extends Block {
// Attendance table // Attendance table
$table_course = Database::get_course_table(TABLE_ATTENDANCE); $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); $rs = Database::query($sql);
$attendance = array(); $attendance = array();
$attendances = array(); $attendances = array();
@ -183,15 +204,17 @@ class BlockDaily extends Block {
//$attendance['name'] = $row['name']; //$attendance['name'] = $row['name'];
$attendance['course_code'] = $course_code; $attendance['course_code'] = $course_code;
if ($attendance['done'] != '0') 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>'; $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 } else {
$attendances[] = get_lang("NotAvailable"); $attendances[] = get_lang("NotAvailable");
} }
}
// quantidade de alunos // 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); $rs = Database::query($sql);
$users = array(); $users = array();
while ($row = Database::fetch_array($rs)) { while ($row = Database::fetch_array($rs)) {
@ -202,14 +225,21 @@ class BlockDaily extends Block {
} }
if (!empty($tematic_advance)) { 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 { } else {
$tematic_advance_progress = '0%'; $tematic_advance_progress = '0%';
} }
// Score // Score
$tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); $tbl_grade_categories = Database :: get_main_table(
$sql = "SELECT id from " . $tbl_grade_categories ." WHERE course_code ='".$course_code."'"; TABLE_MAIN_GRADEBOOK_CATEGORY
);
$sql = "SELECT id from " . $tbl_grade_categories . "
WHERE course_code ='" . $course_code . "'";
$rs = Database::query($sql); $rs = Database::query($sql);
$category = null; $category = null;
while ($row = Database::fetch_array($rs)) { while ($row = Database::fetch_array($rs)) {

@ -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 * the class name must be registered inside path.info file (e.g: controller = "BlockEvaluationGraph"), so dashboard controller will be instantiate it
* @package chamilo.dashboard * @package chamilo.dashboard
*/ */
class BlockEvaluationGraph extends Block { class BlockEvaluationGraph extends Block
{
private $user_id; private $user_id;
private $courses; private $courses;
private $sessions; private $sessions;
@ -38,25 +38,18 @@ class BlockEvaluationGraph extends Block {
/** /**
* Constructor * Constructor
*/ */
public function __construct ($user_id) { public function __construct($user_id)
{
$this->path = 'block_evaluation_graph'; $this->path = 'block_evaluation_graph';
$this->user_id = $user_id; $this->user_id = $user_id;
$this->bg_width = 450; $this->bg_width = 450;
$this->bg_height = 350; $this->bg_height = 350;
if ($this->is_block_visible_for_user($user_id)) { 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()) { if (!api_is_session_admin()) {
$this->courses = CourseManager::get_courses_followed_by_drh($user_id); $this->courses = CourseManager::get_courses_followed_by_drh($user_id);
} }
$this->sessions = SessionManager::get_sessions_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 * @param int User id
* @return bool Is block visible for user * @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_info = api_get_user_info($user_id);
$user_status = $user_info['status']; $user_status = $user_info['status'];
$is_block_visible_for_user = false; $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 * it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html * @return array column and content html
*/ */
public function get_block() { public function get_block()
{
global $charset; global $charset;
$column = 1; $column = 1;
$data = array(); $data = array();
$evaluations_base_courses_graph = $this->get_evaluations_base_courses_graph(); $evaluations_base_courses_graph = $this->get_evaluations_base_courses_graph();
$evaluations_courses_in_sessions_graph = $this->get_evaluations_courses_in_sessions_graph(); $evaluations_courses_in_sessions_graph = $this->get_evaluations_courses_in_sessions_graph();
$html = '<li class="widget color-orange" id="intro"> $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 * @return string img html
*/ */
public function get_evaluations_base_courses_graph() { public function get_evaluations_base_courses_graph()
{
$graphs = array(); $graphs = array();
if (!empty($this->courses)) { if (!empty($this->courses)) {
$courses_code = array_keys($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 * @return string img html
*/ */
public function get_evaluations_courses_in_sessions_graph() { public function get_evaluations_courses_in_sessions_graph()
{
$graphs = array(); $graphs = array();
if (!empty($this->sessions)) { if (!empty($this->sessions)) {
$session_ids = array_keys($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, * 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 * @package chamilo.dashboard
*/ */
class BlockSession extends Block { class BlockSession extends Block
{
private $user_id; private $user_id;
private $sessions; private $sessions;
@ -26,15 +28,12 @@ class BlockSession extends Block {
/** /**
* Constructor * Constructor
*/ */
public function __construct ($user_id) { public function __construct ($user_id)
{
$this->user_id = $user_id; $this->user_id = $user_id;
$this->path = 'block_session'; $this->path = 'block_session';
if ($this->is_block_visible_for_user($user_id)) { 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);
//}
} }
} }
@ -43,7 +42,8 @@ class BlockSession extends Block {
* @param int User id * @param int User id
* @return bool Is block visible for user * @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_info = api_get_user_info($user_id);
$user_status = $user_info['status']; $user_status = $user_info['status'];
$is_block_visible_for_user = false; $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 * it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html * @return array column and content html
*/ */
public function get_block() { public function get_block()
{
global $charset; 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 * This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html * @return string content html
*/ */
public function get_content_html() { public function get_content_html()
{
$content = ''; $content = '';
$sessions = $this->sessions; $sessions = $this->sessions;
@ -147,7 +149,8 @@ class BlockSession extends Block {
* Get number of sessions * Get number of sessions
* @return int * @return int
*/ */
function get_number_of_sessions() { function get_number_of_sessions()
{
return count($this->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 * the class name must be registered inside path.info file (e.g: controller = "BlockStudent"), so dashboard controller will be instantiate it
* @package chamilo.dashboard * @package chamilo.dashboard
*/ */
class BlockStudent extends Block { class BlockStudent extends Block
{
private $user_id; private $user_id;
private $students; private $students;
@ -31,16 +32,12 @@ class BlockStudent extends Block {
/** /**
* Constructor * Constructor
*/ */
public function __construct ($user_id) { public function __construct ($user_id)
{
$this->user_id = $user_id; $this->user_id = $user_id;
$this->path = 'block_student'; $this->path = 'block_student';
if ($this->is_block_visible_for_user($user_id)) { 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); $this->students = UserManager::get_users_followed_by_drh($user_id, STUDENT);
//}
} }
} }
@ -49,7 +46,8 @@ class BlockStudent extends Block {
* @param int User id * @param int User id
* @return bool Is block visible for user * @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_info = api_get_user_info($user_id);
$user_status = $user_info['status']; $user_status = $user_info['status'];
$is_block_visible_for_user = false; $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 * it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html * @return array column and content html
*/ */
public function get_block() { public function get_block()
{
global $charset; global $charset;
$column = 1; $column = 1;
$data = array(); $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 * This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html * @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; $students = $this->students;
$content = '<div style="margin:10px;">'; $content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourStudents').'</font></h3>'; $content .= '<h3><font color="#000">'.get_lang('YourStudents').'</font></h3>';
@ -235,6 +235,7 @@ class BlockStudent extends Block {
</div>'; </div>';
} }
$content .= '</div>'; $content .= '</div>';
return $content; return $content;
} }
@ -242,7 +243,8 @@ class BlockStudent extends Block {
* Get number of students * Get number of students
* @return int * @return int
*/ */
function get_number_of_students() { function get_number_of_students()
{
return count($this->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 * the class name must be registered inside path.info file (e.g: controller = "BlockStudentGraph"), so dashboard controller will be instantiate it
* @package chamilo.dashboard * @package chamilo.dashboard
*/ */
class BlockStudentGraph extends Block { class BlockStudentGraph extends Block
{
private $user_id; private $user_id;
private $students; private $students;
@ -39,7 +40,8 @@ class BlockStudentGraph extends Block {
/** /**
* Constructor * Constructor
*/ */
public function __construct ($user_id) { public function __construct ($user_id)
{
$this->user_id = $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 ($this->is_block_visible_for_user($user_id)) {
@ -56,7 +58,8 @@ class BlockStudentGraph extends Block {
* @param int User id * @param int User id
* @return bool Is block visible for user * @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_info = api_get_user_info($user_id);
$user_status = $user_info['status']; $user_status = $user_info['status'];
$is_block_visible_for_user = false; $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 * This method return content html containing information about students
* it's important to use the name 'get_block' for beeing used from dashboard controller * 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 * @return array column and content html
*/ */
public function get_block() { public function get_block()
{
global $charset; global $charset;
$column = 1; $column = 1;
$data = array(); $data = array();
$students_attendance_graph = $this->get_students_attendance_graph(); $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 * @return string img html
*/ */
public function get_students_attendance_graph() { public function get_students_attendance_graph()
{
$students = $this->students; $students = $this->students;
$attendance = new Attendance(); $attendance = new Attendance();
@ -203,7 +209,8 @@ class BlockStudentGraph extends Block {
* Get number of students * Get number of students
* @return int * @return int
*/ */
function get_number_of_students() { function get_number_of_students()
{
return count($this->students); return count($this->students);
} }
} }

@ -12,10 +12,12 @@
/** /**
* This class is used like controller for teacher block plugin, * 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 * @package chamilo.dashboard
*/ */
class BlockTeacher extends Block { class BlockTeacher extends Block
{
private $user_id; private $user_id;
private $teachers; private $teachers;
@ -25,15 +27,12 @@ class BlockTeacher extends Block {
/** /**
* Controller * Controller
*/ */
public function __construct ($user_id) { public function __construct ($user_id)
{
$this->user_id = $user_id; $this->user_id = $user_id;
$this->path = 'block_teacher'; $this->path = 'block_teacher';
if ($this->is_block_visible_for_user($user_id)) { 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 * @param int User id
* @return bool Is block visible for user * @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_info = api_get_user_info($user_id);
$user_status = $user_info['status']; $user_status = $user_info['status'];
$is_block_visible_for_user = false; $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 * it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html * @return array column and content html
*/ */
public function get_block() { public function get_block()
{
global $charset; global $charset;
$column = 1; $column = 1;
$data = array(); $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(); $teacher_content_html = $this->get_teachers_content_html_for_drh();
//}
$html = ' $html = '
<li class="widget color-blue" id="intro"> <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 * This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html * @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; $teachers = $this->teachers;
$content = '<div style="margin:10px;">'; $content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourTeachers').'</font></h3>'; $content .= '<h3><font color="#000">'.get_lang('YourTeachers').'</font></h3>';
@ -141,16 +136,17 @@ class BlockTeacher extends Block {
$content .= $teachers_table; $content .= $teachers_table;
if (count($teachers) > 0) { 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>'; $content .= '</div>';
return $content; return $content;
} }
public function get_teachers_content_html_for_drh() { public function get_teachers_content_html_for_drh()
{
$teachers = $this->teachers; $teachers = $this->teachers;
$content = '<div style="margin:10px;">'; $content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourTeachers').'</font></h3>'; $content .= '<h3><font color="#000">'.get_lang('YourTeachers').'</font></h3>';
@ -198,15 +194,14 @@ class BlockTeacher extends Block {
$content .= '</div>'; $content .= '</div>';
return $content; return $content;
} }
/** /**
* Get number of teachers * Get number of teachers
* @return int * @return int
*/ */
function get_number_of_teachers() { function get_number_of_teachers()
{
return count($this->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/pChart.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pCache.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 * the class name must be registered inside path.info file (e.g: controller = "BlockTeacherGraph"), so dashboard controller will be instantiate it
* @package chamilo.dashboard * @package chamilo.dashboard
*/ */
class BlockTeacherGraph extends Block { class BlockTeacherGraph extends Block
{
private $user_id; private $user_id;
private $teachers; private $teachers;
@ -33,15 +32,12 @@ class BlockTeacherGraph extends Block {
/** /**
* Controller * Controller
*/ */
public function __construct ($user_id) { public function __construct ($user_id)
{
$this->user_id = $user_id; $this->user_id = $user_id;
$this->path = 'block_teacher_graph'; $this->path = 'block_teacher_graph';
if ($this->is_block_visible_for_user($user_id)) { 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);
//}
} }
} }
@ -50,7 +46,8 @@ class BlockTeacherGraph extends Block {
* @param int User id * @param int User id
* @return bool Is block visible for user * @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_info = api_get_user_info($user_id);
$user_status = $user_info['status']; $user_status = $user_info['status'];
$is_block_visible_for_user = false; $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 * it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html * @return array column and content html
*/ */
public function get_block() { public function get_block()
{
global $charset; global $charset;
$column = 1; $column = 1;
$data = array(); $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(); $teacher_information_graph = $this->get_teachers_information_graph();
//}
$html = ' $html = '
<li class="widget color-blue" id="intro"> <li class="widget color-blue" id="intro">
<div class="widget-head"> <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 * This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html * @return string content html
*/ */
public function get_teachers_information_graph() { public function get_teachers_information_graph()
{
$teachers = $this->teachers; $teachers = $this->teachers;
$graph = ''; $graph = '';
@ -188,16 +179,16 @@ class BlockTeacherGraph extends Block {
} else { } else {
$graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>'; $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 * @return int
*/ */
function get_number_of_teachers() { function get_number_of_teachers()
{
return count($this->teachers); return count($this->teachers);
} }

Loading…
Cancel
Save