added information for blocks in dashboards

skala
Cristian Fasanando 16 years ago
parent efa71972d8
commit 81ec406ca9
  1. 4
      main/admin/dashboard_add_courses_to_user.php
  2. 4
      main/admin/dashboard_add_sessions_to_user.php
  3. 5
      main/admin/dashboard_add_users_to_user.php
  4. 33
      main/attendance/attendance_controller.php
  5. 219
      main/attendance/attendance_sheet.php
  6. 2
      main/course_description/listing.php
  7. 1
      main/course_home/course_home.php
  8. 2
      main/course_info/download.php
  9. 1
      main/dashboard/dashboard_controller.php
  10. 2
      main/dashboard/index.php
  11. 128
      main/inc/lib/attendance.lib.php
  12. 110
      main/inc/lib/dashboard.lib.php
  13. 9
      main/inc/lib/main_api.lib.php
  14. 8
      main/inc/lib/sessionmanager.lib.php
  15. 59
      main/mySpace/course.php
  16. 32
      main/mySpace/index.php
  17. 23
      main/mySpace/myStudents.php
  18. 52
      main/mySpace/session.php
  19. 53
      main/mySpace/student.php
  20. 84
      main/mySpace/teachers.php
  21. 2
      main/tracking/courseLog.php
  22. 2
      main/tracking/courseLogCSV.php
  23. 38
      plugin/dashboard/block_course/block_course.class.php
  24. 95
      plugin/dashboard/block_session/block_session.class.php
  25. 96
      plugin/dashboard/block_student/block_student.class.php
  26. 87
      plugin/dashboard/block_teacher/block_teacher.class.php

@ -66,7 +66,7 @@ function search_courses($needle,$type) {
$charset = api_get_setting('platform_charset'); $charset = api_get_setting('platform_charset');
$needle = api_convert_encoding($needle, $charset, 'utf-8'); $needle = api_convert_encoding($needle, $charset, 'utf-8');
$assigned_courses_to_hrm = CourseManager::get_assigned_courses_to_hr_manager($hrm_id); $assigned_courses_to_hrm = CourseManager::get_courses_followed_by_drh($hrm_id);
$assigned_courses_code = array_keys($assigned_courses_to_hrm); $assigned_courses_code = array_keys($assigned_courses_to_hrm);
foreach ($assigned_courses_code as &$value) { foreach ($assigned_courses_code as &$value) {
$value = "'".$value."'"; $value = "'".$value."'";
@ -167,7 +167,7 @@ echo '<div class="row"><div class="form_header">'.get_lang('AssignedCoursesTo').
// ******************* // *******************
$assigned_courses_to_hrm = CourseManager::get_assigned_courses_to_hr_manager($hrm_id); $assigned_courses_to_hrm = CourseManager::get_courses_followed_by_drh($hrm_id);
$assigned_courses_code = array_keys($assigned_courses_to_hrm); $assigned_courses_code = array_keys($assigned_courses_to_hrm);
foreach ($assigned_courses_code as &$value) { foreach ($assigned_courses_code as &$value) {
$value = "'".$value."'"; $value = "'".$value."'";

@ -67,7 +67,7 @@ function search_sessions($needle,$type) {
$charset = api_get_setting('platform_charset'); $charset = api_get_setting('platform_charset');
$needle = api_convert_encoding($needle, $charset, 'utf-8'); $needle = api_convert_encoding($needle, $charset, 'utf-8');
$assigned_sessions_to_hrm = SessionManager::get_assigned_sessions_to_hr_manager($hrm_id); $assigned_sessions_to_hrm = SessionManager::get_sessions_followed_by_drh($hrm_id);
$assigned_sessions_id = array_keys($assigned_sessions_to_hrm); $assigned_sessions_id = array_keys($assigned_sessions_to_hrm);
@ -170,7 +170,7 @@ echo '<div class="row"><div class="form_header">'.get_lang('AssignedSessionsTo')
// ******************* // *******************
$assigned_sessions_to_hrm = SessionManager::get_assigned_sessions_to_hr_manager($hrm_id); $assigned_sessions_to_hrm = SessionManager::get_sessions_followed_by_drh($hrm_id);
$assigned_sessions_id = array_keys($assigned_sessions_to_hrm); $assigned_sessions_id = array_keys($assigned_sessions_to_hrm);
$without_assigned_sessions = ''; $without_assigned_sessions = '';
if (count($assigned_sessions_id) > 0) { if (count($assigned_sessions_id) > 0) {

@ -65,7 +65,7 @@ function search_users($needle,$type) {
$charset = api_get_setting('platform_charset'); $charset = api_get_setting('platform_charset');
$needle = api_convert_encoding($needle, $charset, 'utf-8'); $needle = api_convert_encoding($needle, $charset, 'utf-8');
$assigned_users_to_hrm = UserManager::get_assigned_users_to_hr_manager($hrm_id); $assigned_users_to_hrm = UserManager::get_users_followed_by_drh($hrm_id);
$assigned_users_id = array_keys($assigned_users_to_hrm); $assigned_users_id = array_keys($assigned_users_to_hrm);
$without_assigned_users = ''; $without_assigned_users = '';
if (count($assigned_users_id) > 0) { if (count($assigned_users_id) > 0) {
@ -164,8 +164,7 @@ echo '<div class="row"><div class="form_header">'.get_lang('AssignedUsersTo').'&
// ******************* // *******************
$assigned_users_to_hrm = UserManager::get_assigned_users_to_hr_manager($hrm_id); $assigned_users_to_hrm = UserManager::get_users_followed_by_drh($hrm_id);
$assigned_users_id = array_keys($assigned_users_to_hrm); $assigned_users_id = array_keys($assigned_users_to_hrm);
$without_assigned_users = ''; $without_assigned_users = '';
if (count($assigned_users_id) > 0) { if (count($assigned_users_id) > 0) {

@ -156,7 +156,7 @@
* @param string action * @param string action
* @param int attendance id * @param int attendance id
*/ */
public function attendance_sheet($action,$attendance_id) { public function attendance_sheet($action, $attendance_id, $student_id = 0) {
$attendance = new Attendance(); $attendance = new Attendance();
$data = array(); $data = array();
$data['attendance_id'] = $attendance_id; $data['attendance_id'] = $attendance_id;
@ -166,8 +166,14 @@
if (api_is_allowed_to_edit(null, true)) { if (api_is_allowed_to_edit(null, true)) {
$data['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id); $data['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id);
} else { } else {
$data['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id, api_get_user_id()); if (!empty($student_id)) {
$data['faults'] = $attendance->get_faults_of_user(api_get_user_id(), $attendance_id); $user_id = intval($student_id);
} else {
$user_id = api_get_user_id();
}
$data['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id, $user_id);
$data['faults'] = $attendance->get_faults_of_user($user_id, $attendance_id);
$data['user_id'] = $user_id;
} }
$data['next_attendance_calendar_id'] = $attendance->get_next_attendance_calendar_id($attendance_id); $data['next_attendance_calendar_id'] = $attendance->get_next_attendance_calendar_id($attendance_id);
@ -175,6 +181,8 @@
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") { if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
$presences = array(); $presences = array();
$check_values = array(); $check_values = array();
$users_present = array();
if (isset($_POST['check_presence'])) { if (isset($_POST['check_presence'])) {
$presences = $_POST['check_presence']; $presences = $_POST['check_presence'];
$calendar_tmp = array(); $calendar_tmp = array();
@ -187,11 +195,22 @@
$check_values[$calendar_id][] = $user_id; $check_values[$calendar_id][] = $user_id;
} }
} }
// save when is present at least one user
foreach ($check_values as $cal_id => $value) {
$users_present = $value;
$affected_rows = $attendance->attendance_sheet_add($cal_id,$users_present,$attendance_id);
}
} else {
// save attendance done with all absents students
if (isset($_POST['datetime_column'])) {
foreach ($_POST['datetime_column'] as $key=>$date_time_col) {
$cal_id = $key;
$affected_rows = $attendance->attendance_sheet_add($cal_id,$users_present,$attendance_id);
}
}
} }
foreach ($check_values as $cal_id => $value) {
$users_present = $value;
$affected_rows = $attendance->attendance_sheet_add($cal_id,$users_present,$attendance_id);
}
$data['users_in_course'] = $attendance->get_users_rel_course($attendance_id); $data['users_in_course'] = $attendance->get_users_rel_course($attendance_id);
$data['attendant_calendar'] = $attendance->get_attendance_calendar($attendance_id); $data['attendant_calendar'] = $attendance->get_attendance_calendar($attendance_id);
$data['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id); $data['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id);

@ -8,140 +8,139 @@
*/ */
if (api_is_allowed_to_edit(null, true)) { if (api_is_allowed_to_edit(null, true)) {
$param_gradebook = ''; $param_gradebook = '';
if (isset($_SESSION['gradebook'])) { if (isset($_SESSION['gradebook'])) {
$param_gradebook = '&gradebook='.$_SESSION['gradebook']; $param_gradebook = '&gradebook='.$_SESSION['gradebook'];
} }
echo '<div class="actions" style="margin-bottom:30px">'; echo '<div class="actions" style="margin-bottom:30px">';
echo '<a href="index?'.api_get_cidreq().'&action=calendar_list&attendance_id='.$attendance_id.$param_gradebook.'">'.Display::return_icon('calendar_up.gif',get_lang('AttendanceCalendar')).' '.get_lang('AttendanceCalendar').'</a>'; echo '<a href="index?'.api_get_cidreq().'&action=calendar_list&attendance_id='.$attendance_id.$param_gradebook.'">'.Display::return_icon('calendar_up.gif',get_lang('AttendanceCalendar')).' '.get_lang('AttendanceCalendar').'</a>';
echo '</div>'; echo '</div>';
$message_information = get_lang('informationAttendanceSheet'); $message_information = get_lang('informationAttendanceSheet');
if (!empty($message_information)) { if (!empty($message_information)) {
$message = '<strong>'.get_lang('Information').'</strong><br />'; $message = '<strong>'.get_lang('Information').'</strong><br />';
$message .= $message_information; $message .= $message_information;
Display::display_normal_message($message, false); Display::display_normal_message($message, false);
} }
?> ?>
<?php <?php
if (count($users_in_course) > 0) { if (count($users_in_course) > 0) {
?> ?>
<form method="post" action="index?action=attendance_sheet_add&<?php echo api_get_cidreq().$param_gradebook ?>&attendance_id=<?php echo $attendance_id?>" > <form method="post" action="index?action=attendance_sheet_add&<?php echo api_get_cidreq().$param_gradebook ?>&attendance_id=<?php echo $attendance_id?>" >
<div class="attendance-sheet-content" style="width:100%;background-color:#E1E1E1;border:1px solid gray;margin-top:20px;"> <div class="attendance-sheet-content" style="width:100%;background-color:#E1E1E1;border:1px solid gray;margin-top:20px;">
<div class="attendance-users-table" style="width:450px;float:left;">
<table class="data_table" width="100%"> <div class="attendance-users-table" style="width:450px;float:left;">
<tr class="row_odd" >
<th height="60px" width="35px" ><?php echo get_lang('Order')?></th>
<th width="45px" ><?php echo get_lang('Photo')?></th>
<th><?php echo get_lang('LastName')?></th>
<th><?php echo get_lang('FirstName')?></th>
<th width="90px"><?php echo get_lang('faults')?></th>
</tr>
<?php <table class="data_table" width="100%">
$i = 1; <tr class="row_odd" >
$class = ''; <th height="60px" width="35px" ><?php echo get_lang('Order')?></th>
foreach ($users_in_course as $data) { <th width="45px" ><?php echo get_lang('Photo')?></th>
$faults = 0; <th><?php echo get_lang('LastName')?></th>
if ($i%2 == 0) {$class='row_odd';} <th><?php echo get_lang('FirstName')?></th>
else {$class='row_even';} <th width="90px"><?php echo get_lang('faults')?></th>
?>
<tr class="<?php echo $class ?>">
<td height="50px"><center><?php echo $i ?></center></td>
<td><?php echo $data['photo'] ?></td>
<td><?php echo $data['lastname'] ?></td>
<td><?php echo $data['firstname'] ?></td>
<td><center><div class="attendance-faults-bar" style="background-color:<?php echo (!empty($data['result_color_bar'])?$data['result_color_bar']:'none') ?>"><?php echo $data['attendance_result'] ?></div></center></td>
</tr> </tr>
<?php
$i++;
}
?>
</table>
</div> <?php
$i = 1;
<div class="attendance-calendar-table" style="overflow:auto;overflow-y:hidden;"> $class = '';
<table class="data_table" width="100%"> foreach ($users_in_course as $data) {
<tr class="row_odd"> $faults = 0;
<?php if ($i%2 == 0) {$class='row_odd';}
if (count($attendant_calendar) > 0 ) { else {$class='row_even';}
foreach ($attendant_calendar as $calendar) {
//$datetime = explode(' ',$calendar['date_time']);
$date = $calendar['date'];
$time = $calendar['time'];
$datetime = $date.'<br />'.$time;
$checked_date = '';
if (!empty($calendar['done_attendance'])){
$datetime = '<font color="blue">'.$date.'<br />'.$time.'</font>';
}
if ($next_attendance_calendar_id == $calendar['id']) {
$checked_date = 'checked';
}
?> ?>
<th height="60px" style="padding:5px;"><?php echo '<span style="font-size:10px;">'.$datetime.'<br /><input type="checkbox" id="datetime_column_'.$calendar['id'].'" '.$checked_date.'/></span>' ?></th> <tr class="<?php echo $class ?>">
<?php } <td height="50px"><center><?php echo $i ?></center></td>
} else { ?> <td><?php echo $data['photo'] ?></td>
<th height="60px" style="padding:5px;"><span><a href="index?<?php echo api_get_cidreq() ?>&action=calendar_list&attendance_id=<?php echo $attendance_id.$param_gradebook ?>"> <td><?php echo $data['lastname'] ?></td>
<?php echo Display::return_icon('calendar_up.gif',get_lang('AttendanceCalendar')).' '.get_lang('GoToAttendanceCalendar') ?></a></span></th> <td><?php echo $data['firstname'] ?></td>
<?php } ?> <td><center><div class="attendance-faults-bar" style="background-color:<?php echo (!empty($data['result_color_bar'])?$data['result_color_bar']:'none') ?>"><?php echo $data['attendance_result'] ?></div></center></td>
</tr> </tr>
<?php <?php
$i = 0; $i++;
foreach ($users_in_course as $user) { }
$class = ''; ?>
if ($i%2==0) {$class = 'row_even';} </table>
else {$class = 'row_odd';}
?> </div>
<tr class="<?php echo $class ?>">
<div class="attendance-calendar-table" style="overflow:auto;overflow-y:hidden;">
<table class="data_table" width="100%">
<tr class="row_odd">
<?php <?php
if (count($attendant_calendar) > 0 ) { if (count($attendant_calendar) > 0 ) {
foreach ($attendant_calendar as $calendar) { foreach ($attendant_calendar as $calendar) {
$checked = 'checked'; //$datetime = explode(' ',$calendar['date_time']);
if (isset($users_presence[$user['user_id']][$calendar['id']]['presence'])) { $date = $calendar['date'];
$presence = $users_presence[$user['user_id']][$calendar['id']]['presence']; $time = $calendar['time'];
if (intval($presence) == 1) { $datetime = $date.'<br />'.$time;
$checked = 'checked'; $checked_date = '';
} else { if (!empty($calendar['done_attendance'])){
$checked = ''; $datetime = '<font color="blue">'.$date.'<br />'.$time.'</font>';
}
} }
$disabled = 'disabled';
$style_td = '';
if ($next_attendance_calendar_id == $calendar['id']) { if ($next_attendance_calendar_id == $calendar['id']) {
$style_td = 'background-color:#e1e1e1'; $checked_date = 'checked';
$disabled = '';
} }
?> ?>
<td height="50px" style="<?php echo $style_td ?>" class="checkboxes_col_<?php echo $calendar['id'] ?>"><center><input type="checkbox" name="check_presence[]" value="cal_<?php echo $calendar['id'] ?>_user_<?php echo $user['user_id'] ?>" <?php echo $disabled.' '.$checked ?> /><span class="<?php echo 'anchor_'.$calendar['id'] ?>"></span></center></td> <th height="60px" style="padding:5px;"><?php echo '<span style="font-size:10px;">'.$datetime.'<br /><input type="checkbox" name="datetime_column['.$calendar['id'].']" id="datetime_column_'.$calendar['id'].'" '.$checked_date.'/></span>' ?></th>
<?php }
<?php }
} else { ?> } else { ?>
<td height="50px" class="checkboxes_col_<?php echo $calendar['id'] ?>"><center>&nbsp;</center></td> <th height="60px" style="padding:5px;"><span><a href="index?<?php echo api_get_cidreq() ?>&action=calendar_list&attendance_id=<?php echo $attendance_id.$param_gradebook ?>">
<?php } ?> <?php echo Display::return_icon('calendar_up.gif',get_lang('AttendanceCalendar')).' '.get_lang('GoToAttendanceCalendar') ?></a></span></th>
<?php } ?>
</tr> </tr>
<?php $i++ ; <?php
} $i = 0;
?> foreach ($users_in_course as $user) {
$class = '';
if ($i%2==0) {$class = 'row_even';}
else {$class = 'row_odd';}
?>
<tr class="<?php echo $class ?>">
<?php
if (count($attendant_calendar) > 0 ) {
foreach ($attendant_calendar as $calendar) {
$checked = 'checked';
if (isset($users_presence[$user['user_id']][$calendar['id']]['presence'])) {
$presence = $users_presence[$user['user_id']][$calendar['id']]['presence'];
if (intval($presence) == 1) {
$checked = 'checked';
} else {
$checked = '';
}
}
$disabled = 'disabled';
$style_td = '';
if ($next_attendance_calendar_id == $calendar['id']) {
$style_td = 'background-color:#e1e1e1';
$disabled = '';
}
?>
<td height="50px" style="<?php echo $style_td ?>" class="checkboxes_col_<?php echo $calendar['id'] ?>"><center><input type="checkbox" name="check_presence[]" value="cal_<?php echo $calendar['id'] ?>_user_<?php echo $user['user_id'] ?>" <?php echo $disabled.' '.$checked ?> /><span class="<?php echo 'anchor_'.$calendar['id'] ?>"></span></center></td>
</table> <?php }
} else { ?>
<td height="50px" class="checkboxes_col_<?php echo $calendar['id'] ?>"><center>&nbsp;</center></td>
<?php } ?>
</tr>
<?php $i++ ;
}
?>
</table>
</div>
</div> </div>
</div>
<div class="clear"></div> <div class="clear"></div>
<div style="margin-top:20px;"><button type="submit" class="save"><?php echo get_lang('SaveAttendanceSheet') ?></button></div> <div style="margin-top:20px;"><button type="submit" class="save"><?php echo get_lang('SaveAttendanceSheet') ?></button></div>
</form> </form>
<?php } else { <?php } else {
echo '<div><a href="'.api_get_path(WEB_CODE_PATH).'user/user.php?'.api_get_cidreq().'">'.get_lang('ThereAreNoRegisteredLearnersInsidetheCourse').'</a></div>'; echo '<div><a href="'.api_get_path(WEB_CODE_PATH).'user/user.php?'.api_get_cidreq().'">'.get_lang('ThereAreNoRegisteredLearnersInsidetheCourse').'</a></div>';
} }
} else { } else {
// View for students // View for students
$user_id = api_get_user_id();
?> ?>
<h3><?php echo get_lang('AttendanceSheetReport') ?></h3> <h3><?php echo get_lang('AttendanceSheetReport') ?></h3>
<div> <div>

@ -71,7 +71,7 @@ if (isset($descriptions) && count($descriptions) > 0) {
$progress = (isset($description['progress'])?$description['progress'].'%':''); $progress = (isset($description['progress'])?$description['progress'].'%':'');
if ($description['description_type'] == THEMATIC_ADVANCE) { if ($description['description_type'] == THEMATIC_ADVANCE) {
echo '<a name="thematic_advance"></a>';
echo get_lang('ThematicAdvance').' : '.$description['title'].' - '.$progress; echo get_lang('ThematicAdvance').' : '.$description['title'].' - '.$progress;
} else { } else {
echo $description['title']; echo $description['title'];

@ -162,7 +162,6 @@ if ($is_speacialcourse==true){
} }
} }
/* /*
----------------------------------------------------------- -----------------------------------------------------------
Is the user allowed here? Is the user allowed here?

@ -49,7 +49,7 @@ if (empty($extension) || !file_exists($archive_path.$archive_file)) {
$content_type = ''; $content_type = '';
if (in_array(strtolower($extension), array('xml','csv')) && api_is_platform_admin(true)) { if (in_array(strtolower($extension), array('xml','csv')) && (api_is_platform_admin(true) || api_is_drh())) {
$content_type = 'application/force-download'; $content_type = 'application/force-download';
} }
elseif (strtolower($extension) == 'zip' && $_cid && $is_courseAdmin) { elseif (strtolower($extension) == 'zip' && $_cid && $is_courseAdmin) {

@ -37,6 +37,7 @@ class DashboardController { // extends Controller {
$data = array(); $data = array();
$user_id = $this->user_id; $user_id = $this->user_id;
$block_data_without_plugin = DashboardManager::get_block_data_without_plugin();
$dashboard_blocks = DashboardManager::get_enabled_dashboard_blocks(); $dashboard_blocks = DashboardManager::get_enabled_dashboard_blocks();
$user_block_data = DashboardManager::get_user_block_data($user_id); $user_block_data = DashboardManager::get_user_block_data($user_id);
$user_blocks_id = array_keys($user_block_data); $user_blocks_id = array_keys($user_block_data);

@ -12,9 +12,7 @@ $language_file = array ('registration', 'index', 'tracking', 'userInfo');
// including files // including files
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'dashboard.lib.php'; require_once api_get_path(LIBRARY_PATH).'dashboard.lib.php';
require_once api_get_path(LIBRARY_PATH).'display.lib.php';
require_once api_get_path(LIBRARY_PATH).'app_view.php'; require_once api_get_path(LIBRARY_PATH).'app_view.php';
require_once 'dashboard_controller.php'; require_once 'dashboard_controller.php';
require_once 'block.class.php'; require_once 'block.class.php';

@ -39,6 +39,34 @@ class Attendance
return $obj->total_number_of_items; return $obj->total_number_of_items;
} }
/**
* Get attendance list
* @param string course code (optional)
* @param int session id (optional)
* @return array attendances list
*/
function get_attendances_list($course_code = '', $session_id = 0) {
// initializing database table and variables
$tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE);
$session_id = intval($session_id);
$data = array();
if (!empty($course_code)) {
$course_info = api_get_course_info($course_code);
$tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE, $course_info['dbName']);
}
// get attendance data
$sql = "SELECT * FROM $tbl_attendance WHERE session_id='$session_id'";
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0){
while ($row = Database::fetch_array($rs)) {
$data[$row['id']] = $row;
}
}
return $data;
}
/** /**
* Get the attendaces to display on the current page (fill the sortable-table) * Get the attendaces to display on the current page (fill the sortable-table)
* @param int offset of first user to recover * @param int offset of first user to recover
@ -73,7 +101,13 @@ class Attendance
} }
while ($attendance = Database::fetch_row($res)) { while ($attendance = Database::fetch_row($res)) {
$attendance[1] = '<a href="index.php?'.api_get_cidreq().'&action=attendance_sheet_list&attendance_id='.$attendance[0].$param_gradebook.'">'.$attendance[1].'</a>';
$student_param = '';
if (api_is_drh() && ($_GET['student_id'])) {
$student_param = '&student_id='.Security::remove_XSS($_GET['student_id']);
}
$attendance[1] = '<a href="index.php?'.api_get_cidreq().'&action=attendance_sheet_list&attendance_id='.$attendance[0].$param_gradebook.$student_param.'">'.$attendance[1].'</a>';
$attendance[3] = '<center>'.$attendance[3].'</center>'; $attendance[3] = '<center>'.$attendance[3].'</center>';
if (api_is_allowed_to_edit(null, true)) { if (api_is_allowed_to_edit(null, true)) {
$actions = ''; $actions = '';
@ -247,7 +281,8 @@ class Attendance
foreach ($a_course_users as $key => $value) { foreach ($a_course_users as $key => $value) {
$uid = intval($value['user_id']); $uid = intval($value['user_id']);
if ($uid <= 1) continue; $status = $value['status'];
if ($uid <= 1 || $status == DRH) continue;
if (!empty($attendance_id)) { if (!empty($attendance_id)) {
$attendance_id = intval($attendance_id); $attendance_id = intval($attendance_id);
$user_faults = $this->get_faults_of_user($uid, $attendance_id); $user_faults = $this->get_faults_of_user($uid, $attendance_id);
@ -409,6 +444,8 @@ class Attendance
* @return array results containing number of faults, total done attendance, porcent of faults and color depend on result (red, orange) * @return array results containing number of faults, total done attendance, porcent of faults and color depend on result (red, orange)
*/ */
public function get_faults_of_user($user_id, $attendance_id) { public function get_faults_of_user($user_id, $attendance_id) {
// initializing database table and variables
$tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT); $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT);
$user_id = intval($user_id); $user_id = intval($user_id);
$attendance_id = intval($attendance_id); $attendance_id = intval($attendance_id);
@ -416,6 +453,7 @@ class Attendance
$attendance_data = $this->get_attendance_by_id($attendance_id); $attendance_data = $this->get_attendance_by_id($attendance_id);
$total_done_attendance = $attendance_data['attendance_qualify_max']; $total_done_attendance = $attendance_data['attendance_qualify_max'];
$attendance_user_score = $this->get_user_score($user_id, $attendance_id); $attendance_user_score = $this->get_user_score($user_id, $attendance_id);
// calculate results // calculate results
$faults = $total_done_attendance-$attendance_user_score; $faults = $total_done_attendance-$attendance_user_score;
$faults = $faults > 0 ? $faults:0; $faults = $faults > 0 ? $faults:0;
@ -433,6 +471,92 @@ class Attendance
return $results; return $results;
} }
/**
* Get results of faults average for all courses by user
* @param int user id
* @return array results containing number of faults, total done attendance, porcent of faults and color depend on result (red, orange)
*/
public function get_faults_average_inside_courses($user_id) {
// get all courses of current user
$courses = CourseManager::get_courses_list_by_user_id($user_id, true);
$user_id = intval($user_id);
$results = array();
$total_faults = $total_weight = $porcent = 0;
foreach ($courses as $course) {
$course_code = $course['code'];
$course_info = api_get_course_info($course_code);
$tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT, $course_info['dbName']);
$attendances_by_course = $this->get_attendances_list($course_code);
foreach ($attendances_by_course as $attendance) {
// get total faults and total weight
$attendance_id = $attendance['id'];
$total_done_attendance = $attendance['attendance_qualify_max'];
$sql = "SELECT score FROM $tbl_attendance_result WHERE user_id='$user_id' AND attendance_id='$attendance_id'";
$rs = Database::query($sql);
$score = 0;
if (Database::num_rows($rs) > 0) {
$row = Database::fetch_array($rs);
$score = $row['score'];
}
$faults = $total_done_attendance-$score;
$faults = $faults > 0 ? $faults:0;
$total_faults += $faults;
$total_weight += $total_done_attendance;
}
}
$porcent = $total_weight > 0 ?round(($total_faults*100)/$total_weight,0):0;
$results['faults'] = $total_faults;
$results['total'] = $total_weight;
$results['porcent'] = $porcent;
return $results;
}
/**
* Get results of faults average by course
* @param int user id
* @return array results containing number of faults, total done attendance, porcent of faults and color depend on result (red, orange)
*/
public function get_faults_average_by_course($user_id, $course_code) {
// Database tables and variables
$course_info = api_get_course_info($course_code);
$tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT, $course_info['dbName']);
$user_id = intval($user_id);
$results = array();
$total_faults = $total_weight = $porcent = 0;
$attendances_by_course = $this->get_attendances_list($course_code);
foreach ($attendances_by_course as $attendance) {
// get total faults and total weight
$attendance_id = $attendance['id'];
$total_done_attendance = $attendance['attendance_qualify_max'];
$sql = "SELECT score FROM $tbl_attendance_result WHERE user_id='$user_id' AND attendance_id='$attendance_id'";
$rs = Database::query($sql);
$score = 0;
if (Database::num_rows($rs) > 0) {
$row = Database::fetch_array($rs);
$score = $row['score'];
}
$faults = $total_done_attendance-$score;
$faults = $faults > 0 ? $faults:0;
$total_faults += $faults;
$total_weight += $total_done_attendance;
}
$porcent = $total_weight > 0 ?round(($total_faults*100)/$total_weight,0):0;
$results['faults'] = $total_faults;
$results['total'] = $total_weight;
$results['porcent'] = $porcent;
return $results;
}
/** /**
* Get registered users' attendance sheet inside current course * Get registered users' attendance sheet inside current course
* @param int attendance id * @param int attendance id

@ -7,11 +7,13 @@
* @package chamilo.dashboard * @package chamilo.dashboard
*/ */
// required files
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
/** /**
* DashboardManager can be used to manage dashboard * DashboardManager can be used to manage dashboard
* @package chamilo.dashboard * @package chamilo.dashboard
*/ */
class DashboardManager class DashboardManager
{ {
/** /**
@ -42,7 +44,7 @@ class DashboardManager
echo '<th>'.get_lang('Description').'</th>'; echo '<th>'.get_lang('Description').'</th>';
echo '</tr>'; echo '</tr>';
$disabled_block_data = self::get_block_data_without_plugin(); $disabled_blocks_data = self::get_block_data_without_plugin();
// We display all the possible enabled or disabled plugins // We display all the possible enabled or disabled plugins
foreach ($possibleplugins as $testplugin) { foreach ($possibleplugins as $testplugin) {
@ -70,14 +72,12 @@ class DashboardManager
} }
// display all disabled block data // display all disabled block data
if (count($disabled_block_data) > 0) { if (count($disabled_blocks_data) > 0) {
foreach ($disabled_block_data as $disabled_block) { foreach ($disabled_blocks_data as $disabled_block) {
echo '<tr style="background-color:#eee">'; echo '<tr style="background-color:#eee">';
echo '<td><center><input type="checkbox" name="disabled_block" value="true" disabled /></center>'; echo '<td><center><input type="checkbox" name="disabled_block" value="true" checked disabled /></center>';
for ($j = 0 ; $j < count($table_cols); $j++) { for ($j = 0 ; $j < count($table_cols); $j++) {
if (isset($disabled_block[strtolower($table_cols[$j])])) { if (isset($disabled_block[strtolower($table_cols[$j])])) {
if ($j == 2) { if ($j == 2) {
echo '<td>'; echo '<td>';
echo '<font color="#aaa">'.$disabled_block[$table_cols[$j]].'</font><br />'; echo '<font color="#aaa">'.$disabled_block[$table_cols[$j]].'</font><br />';
@ -88,8 +88,6 @@ class DashboardManager
echo '<font color="#aaa">'.$disabled_block[$table_cols[$j]].'</font>'; echo '<font color="#aaa">'.$disabled_block[$table_cols[$j]].'</font>';
echo '</td>'; echo '</td>';
} }
} else { } else {
echo '<td>&nbsp;</td>'; echo '<td>&nbsp;</td>';
} }
@ -141,30 +139,73 @@ class DashboardManager
$dashboard_pluginpath = api_get_path(SYS_PLUGIN_PATH).'dashboard/'; $dashboard_pluginpath = api_get_path(SYS_PLUGIN_PATH).'dashboard/';
$possibleplugins = self::get_posible_dashboard_plugins_path(); $possibleplugins = self::get_posible_dashboard_plugins_path();
$condition_path = '';
if (count($possibleplugins) > 0) { if (count($possibleplugins) > 0) {
$tmp_possibleplugins = $possibleplugins;
foreach ($tmp_possibleplugins as &$plugins) { $selected_plugins = array_intersect(array_keys($plugin_paths),$possibleplugins);
$plugins = "'".$plugins."'"; $not_selected_plugins = array_diff($possibleplugins,array_keys($plugin_paths));
// get blocks id from not selected path
$not_selected_blocks_id = array();
foreach ($not_selected_plugins as $plugin) {
$block_data = self::get_enabled_dashboard_blocks($plugin);
if (!empty($block_data[$plugin])) {
$not_selected_blocks_id[] = $block_data[$plugin]['id'];
}
} }
$condition_path = ' WHERE path IN('.implode(',',$tmp_possibleplugins).')';
/* clean not selected plugins for extra user data and block data */
// clean block table for adding paths // clean from extra user data
$sql = "SELECT id FROM $tbl_block $condition_path "; $field_variable = 'dashboard';
$rs = Database::query($sql); $extra_user_data = UserManager::get_extra_user_data_by_field_variable($field_variable);
if (Database::num_rows($rs) > 0) { foreach ($extra_user_data as $key => $user_data) {
$sql_del = "DELETE FROM $tbl_block $condition_path "; $user_id = $key;
Database::query($sql_del); $user_block_data = self::get_user_block_data($user_id);
$user_block_id = array_keys($user_block_data);
// clean disabled block data
foreach ($user_block_id as $block_id) {
if (in_array($block_id, $not_selected_blocks_id)) {
unset($user_block_data[$block_id]);
}
}
// get columns and blocks id for updating extra user data
$columns = array();
$user_blocks_id = array();
foreach ($user_block_data as $data) {
$user_blocks_id[$data['block_id']] = true;
$columns[$data['block_id']] = $data['column'];
}
// update extra user blocks data
$upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns);
} }
// get selected plugins // clean from block data
$selected_plugins = array(); if (!empty($not_selected_blocks_id)) {
if (!empty($plugin_paths)) { $sql_check = "SELECT id FROM $tbl_block WHERE id IN(".implode(',',$not_selected_blocks_id).")";
$selected_plugins = array_intersect(array_keys($plugin_paths),$possibleplugins); $rs_check = Database::query($sql_check);
if (Database::num_rows($rs_check) > 0) {
$del = "DELETE FROM $tbl_block WHERE id IN(".implode(',',$not_selected_blocks_id).")";
Database::query($del);
}
} }
if (count($selected_plugins) > 0) {
foreach ($selected_plugins as $testplugin) { // store selected plugins
foreach ($selected_plugins as $testplugin) {
$selected_path = Database::escape_string($testplugin);
// check if the path already stored inside block table for updating or adding it
$sql = "SELECT path FROM $tbl_block WHERE path = '$selected_path'";
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0) {
// update
$upd = "UPDATE $tbl_block SET active = 1 WHERE path = '$selected_path'";
Database::query($upd);
} else {
// insert
$plugin_info_file = $dashboard_pluginpath.$testplugin."/$testplugin.info"; $plugin_info_file = $dashboard_pluginpath.$testplugin."/$testplugin.info";
$plugin_info = array(); $plugin_info = array();
if (file_exists($plugin_info_file)) { if (file_exists($plugin_info_file)) {
@ -190,13 +231,14 @@ class DashboardManager
$plugin_controller = Database::escape_string($plugin_info['controller']); $plugin_controller = Database::escape_string($plugin_info['controller']);
} }
$sql_ins = "INSERT INTO $tbl_block(name, description, path, controller) VALUES ('$plugin_name', '$plugin_description', '$plugin_path', '$plugin_controller')"; $ins = "INSERT INTO $tbl_block(name, description, path, controller) VALUES ('$plugin_name', '$plugin_description', '$plugin_path', '$plugin_controller')";
Database::query($sql_ins); Database::query($ins);
$affected_rows = Database::affected_rows();
} }
$affected_rows = Database::affected_rows();
} }
} }
return $affected_rows; return $affected_rows;
} }
@ -242,7 +284,6 @@ class DashboardManager
} else { } else {
$active = 1; $active = 1;
} }
// update active // update active
$upd = "UPDATE $tbl_block SET active = '$active' WHERE path = '".$row['path']."'"; $upd = "UPDATE $tbl_block SET active = '$active' WHERE path = '".$row['path']."'";
Database::query($upd); Database::query($upd);
@ -272,10 +313,10 @@ class DashboardManager
$condition_path = ''; $condition_path = '';
if (!empty($path)) { if (!empty($path)) {
$path = Database::escape_string($path); $path = Database::escape_string($path);
$condition_path = ' WHERE path = "'.$path.'" '; $condition_path = ' AND path = "'.$path.'" ';
} }
$sql = "SELECT * FROM $tbl_block $condition_path WHERE active = 1"; $sql = "SELECT * FROM $tbl_block WHERE active = 1 $condition_path ";
$rs = Database::query($sql); $rs = Database::query($sql);
$block_data = array(); $block_data = array();
if (Database::num_rows($rs) > 0) { if (Database::num_rows($rs) > 0) {
@ -293,6 +334,7 @@ class DashboardManager
*/ */
public static function display_user_dashboard_list($user_id) { public static function display_user_dashboard_list($user_id) {
$block_data_without_plugin = self::get_block_data_without_plugin();
$enabled_dashboard_plugins = self::get_enabled_dashboard_blocks(); $enabled_dashboard_plugins = self::get_enabled_dashboard_blocks();
$user_block_data = self::get_user_block_data($user_id); $user_block_data = self::get_user_block_data($user_id);

@ -1740,6 +1740,15 @@ function api_is_session_admin() {
return $_user['status'] == SESSIONADMIN; return $_user['status'] == SESSIONADMIN;
} }
/**
* Check if the current user is a human resources manager
* @return boolean True if current user is a human resources manager
*/
function api_is_drh() {
global $_user;
return $_user['status'] == DRH;
}
/** /**
* This function check is a session is assigned into a category * This function check is a session is assigned into a category
* @param int - session id * @param int - session id

@ -1055,11 +1055,11 @@ class SessionManager {
} }
/** /**
* Get assigned sessions to human resources manager * Get sessions followed by human resources manager
* @param int Human resources manager id * @param int Human resources manager id
* @return array assigned sessions * @return array sessions
*/ */
public static function get_assigned_sessions_to_hr_manager($hr_manager_id) { public static function get_sessions_followed_by_drh($hr_manager_id) {
// Database Table Definitions // Database Table Definitions
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);

@ -13,6 +13,7 @@ require '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'tracking.lib.php'; require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php'; require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'course.lib.php'; require_once api_get_path(LIBRARY_PATH).'course.lib.php';
require_once api_get_path(LIBRARY_PATH).'course_description.lib.php';
$this_section = "session_my_space"; $this_section = "session_my_space";
$id_session = intval($_GET['id_session']); $id_session = intval($_GET['id_session']);
@ -58,6 +59,33 @@ if (api_get_setting('add_users_by_coach') == 'true') {
Display :: display_header($nameTools); Display :: display_header($nameTools);
$a_courses = array();
if (api_is_drh()) {
$a_courses = array_keys(CourseManager::get_courses_followed_by_drh($_user['user_id']));
$menu_items[] = '<a href="index.php?view=drh_students">'.get_lang('Learners').'</a>';
$menu_items[] = '<a href="teachers.php">'.get_lang('Teachers').'</a>';
$menu_items[] = get_lang('Trainings');
$menu_items[] = '<a href="session.php">'.get_lang('Sessions').'</a>';
echo '<div class="actions-title" style ="font-size:10pt;">';
$nb_menu_items = count($menu_items);
if ($nb_menu_items > 1) {
foreach ($menu_items as $key => $item) {
echo $item;
if ($key != $nb_menu_items - 1) {
echo '&nbsp;|&nbsp;';
}
}
}
if (count($a_courses) > 0) {
echo '&nbsp;&nbsp;<a href="javascript: void(0);" onclick="javascript: window.print()"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a> ';
}
echo '</div>';
echo '<br />';
}
// Database Table Definitions // Database Table Definitions
$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE); $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$tbl_user_course = Database :: get_main_table(TABLE_MAIN_COURSE_USER); $tbl_user_course = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
@ -82,24 +110,29 @@ if ($show_import_icon) {
echo "</div><br />"; echo "</div><br />";
} }
$a_courses = Tracking :: get_courses_followed_by_coach($_user['user_id'], $id_session); if (!api_is_drh()) {
$a_courses = Tracking :: get_courses_followed_by_coach($_user['user_id'], $id_session);
}
$nb_courses = count($a_courses); $nb_courses = count($a_courses);
$table = new SortableTable('tracking_list_course', 'count_courses'); $table = new SortableTable('tracking_list_course', 'count_courses');
$table -> set_header(0, get_lang('CourseTitle'), false, 'align="center"'); $table -> set_header(0, get_lang('CourseTitle'), false, 'align="center"');
$table -> set_header(1, get_lang('NbStudents'), false); $table -> set_header(1, get_lang('NbStudents'), false);
$table -> set_header(2, get_lang('TimeSpentInTheCourse'), false); $table -> set_header(2, get_lang('TimeSpentInTheCourse'), false);
$table -> set_header(3, get_lang('AvgStudentsProgress'), false); $table -> set_header(3, get_lang('ThematicAdvance'), false);
$table -> set_header(4, get_lang('AvgCourseScore'), false); $table -> set_header(4, get_lang('AvgStudentsProgress'), false);
$table -> set_header(5, get_lang('AvgCourseScore'), false);
//$table -> set_header(5, get_lang('AvgExercisesScore'), false);// no code for this? //$table -> set_header(5, get_lang('AvgExercisesScore'), false);// no code for this?
$table -> set_header(5, get_lang('AvgMessages'), false); $table -> set_header(6, get_lang('AvgMessages'), false);
$table -> set_header(6, get_lang('AvgAssignments'), false); $table -> set_header(7, get_lang('AvgAssignments'), false);
$table -> set_header(7, get_lang('Details'), false); $table -> set_header(8, get_lang('Details'), false);
$csv_header[] = array( $csv_header[] = array(
get_lang('CourseTitle', ''), get_lang('CourseTitle', ''),
get_lang('NbStudents', ''), get_lang('NbStudents', ''),
get_lang('TimeSpentInTheCourse', ''), get_lang('TimeSpentInTheCourse', ''),
get_lang('ThematicAdvance', ''),
get_lang('AvgStudentsProgress', ''), get_lang('AvgStudentsProgress', ''),
get_lang('AvgCourseScore', ''), get_lang('AvgCourseScore', ''),
//get_lang('AvgExercisesScore', ''), //get_lang('AvgExercisesScore', ''),
@ -150,10 +183,23 @@ if (is_array($a_courses)) {
$avg_assignments_in_course = null; $avg_assignments_in_course = null;
} }
$tematic_advance_progress = 0;
$course_description = new CourseDescription();
$course_description->set_session_id(0);
$tematic_advance = $course_description->get_data_by_description_type(8, $course_code);
if (!empty($tematic_advance)) {
$tematic_advance_csv = $tematic_advance_progress.'%';
$tematic_advance_progress = '<a title="'.get_lang('GoToThematicAdvance').'" href="'.api_get_path(WEB_CODE_PATH).'course_description/?cidReq='.$course_code.'#thematic_advance">'.$tematic_advance['progress'].'%</a>';
} else {
$tematic_advance_progress = '0%';
}
$table_row = array(); $table_row = array();
$table_row[] = $course['title']; $table_row[] = $course['title'];
$table_row[] = $nb_students_in_course; $table_row[] = $nb_students_in_course;
$table_row[] = $avg_time_spent_in_course; $table_row[] = $avg_time_spent_in_course;
$table_row[] = $tematic_advance_progress;
$table_row[] = is_null($avg_progress_in_course) ? '' : $avg_progress_in_course.'%'; $table_row[] = is_null($avg_progress_in_course) ? '' : $avg_progress_in_course.'%';
$table_row[] = is_null($avg_score_in_course) ? '' : $avg_score_in_course.'%'; $table_row[] = is_null($avg_score_in_course) ? '' : $avg_score_in_course.'%';
$table_row[] = $avg_messages_in_course; $table_row[] = $avg_messages_in_course;
@ -164,6 +210,7 @@ if (is_array($a_courses)) {
$course['title'], $course['title'],
$nb_students_in_course, $nb_students_in_course,
$avg_time_spent_in_course, $avg_time_spent_in_course,
$tematic_advance_csv,
is_null($avg_progress_in_course) ? null : $avg_progress_in_course.'%', is_null($avg_progress_in_course) ? null : $avg_progress_in_course.'%',
is_null($avg_score_in_course) ? null : $avg_score_in_course.'%', is_null($avg_score_in_course) ? null : $avg_score_in_course.'%',
$avg_messages_in_course, $avg_messages_in_course,

@ -15,6 +15,7 @@ require_once '../inc/global.inc.php';
// including additional libraries // including additional libraries
require_once api_get_path(LIBRARY_PATH).'tracking.lib.php'; require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
require_once api_get_path(LIBRARY_PATH).'course.lib.php'; require_once api_get_path(LIBRARY_PATH).'course.lib.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php'; require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
// the section (for the tabs) // the section (for the tabs)
@ -124,6 +125,7 @@ if (api_is_allowed_to_create_course()) {
} }
} }
} }
if ($is_coach) { if ($is_coach) {
if ($nb_teacher_courses == 0 && !$is_platform_admin) { if ($nb_teacher_courses == 0 && !$is_platform_admin) {
$view = 'coach'; $view = 'coach';
@ -135,6 +137,7 @@ if ($is_coach) {
$menu_items[] = '<a href="'.api_get_self().'?view=coach">'.get_lang('CoachInterface').'</a>'; $menu_items[] = '<a href="'.api_get_self().'?view=coach">'.get_lang('CoachInterface').'</a>';
} }
} }
if ($is_platform_admin) { if ($is_platform_admin) {
if (!$is_coach && $nb_teacher_courses == 0) { if (!$is_coach && $nb_teacher_courses == 0) {
$view = 'admin'; $view = 'admin';
@ -146,24 +149,27 @@ if ($is_platform_admin) {
$menu_items[] = '<a href="'.api_get_self().'?view=admin">'.get_lang('AdminInterface').'</a>'; $menu_items[] = '<a href="'.api_get_self().'?view=admin">'.get_lang('AdminInterface').'</a>';
} }
} }
if ($_user['status'] == DRH) {
$view = 'drh'; if (api_is_drh()) {
$title = get_lang('DrhInterface'); $view = 'drh_students';
$menu_items[] = '<a href="'.api_get_self().'?view=drh">'.get_lang('DrhInterface').'</a>'; $menu_items[] = get_lang('Learners');
$menu_items[] = '<a href="teachers.php">'.get_lang('Trainers').'</a>';
$menu_items[] = '<a href="course.php">'.get_lang('Trainings').'</a>';
$menu_items[] = '<a href="session.php">'.get_lang('Sessions').'</a>';
} }
echo '<div class="actions">'; echo '<div class="actions-title" style ="font-size:10pt;">';
$nb_menu_items = count($menu_items); $nb_menu_items = count($menu_items);
if ($nb_menu_items > 1) { if ($nb_menu_items > 1) {
foreach ($menu_items as $key => $item) { foreach ($menu_items as $key => $item) {
echo $item; echo $item;
if ($key != $nb_menu_items - 1) { if ($key != $nb_menu_items - 1) {
echo ' | '; echo '&nbsp;|&nbsp;';
} }
} }
} }
echo '&nbsp;<a href="javascript: void(0);" onclick="javascript: window.print()"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a> '; echo '&nbsp;&nbsp;<a href="javascript: void(0);" onclick="javascript: window.print()"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a> ';
if ($view == 'admin') { if ($view == 'admin') {
echo (isset($_GET['display']) && $_GET['display'] == 'useroverview')? '<a href="'.api_get_self().'?display=useroverview&export=csv&view='.$view.'"><img align="absbottom" src="../img/csv.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>' : ''; echo (isset($_GET['display']) && $_GET['display'] == 'useroverview')? '<a href="'.api_get_self().'?display=useroverview&export=csv&view='.$view.'"><img align="absbottom" src="../img/csv.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>' : '';
} else { } else {
@ -172,8 +178,9 @@ if ($view == 'admin') {
echo '</div>'; echo '</div>';
echo '<h4>'.$title.'</h4>'; echo '<h4>'.$title.'</h4>';
if ($_user['status'] == DRH && $view == 'drh') { if (api_is_drh() && $view == 'drh_students') {
$students = Tracking :: get_student_followed_by_drh($_user['user_id']); // get data for human resources manager
$students = array_keys(UserManager::get_users_followed_by_drh($_user['user_id'], STUDENT));
$courses_of_the_platform = CourseManager :: get_real_course_list(); $courses_of_the_platform = CourseManager :: get_real_course_list();
foreach ($courses_of_the_platform as $course) { foreach ($courses_of_the_platform as $course) {
$courses[$course['code']] = $course['code']; $courses[$course['code']] = $course['code'];
@ -185,9 +192,9 @@ if ($is_coach && $view == 'coach') {
$courses = Tracking :: get_courses_followed_by_coach($_user['user_id']); $courses = Tracking :: get_courses_followed_by_coach($_user['user_id']);
} }
if ($view == 'coach' || $view == 'drh') { if ($view == 'coach' || $view == 'drh_students') {
$nb_students = count($students);
$nb_students = count($students);
$total_time_spent = 0; $total_time_spent = 0;
$total_courses = 0; $total_courses = 0;
$avg_total_progress = 0; $avg_total_progress = 0;
@ -335,11 +342,12 @@ if ($view == 'coach' || $view == 'drh') {
'.(is_null($nb_assignments) ? '' : round($nb_assignments, 2)).' '.(is_null($nb_assignments) ? '' : round($nb_assignments, 2)).'
</td> </td>
</tr> </tr>
</table> </table><br />
<a href="student.php">'.get_lang('SeeStudentList').'</a> <a href="student.php">'.get_lang('SeeStudentList').'</a>
</div>'; </div>';
} }
} }
if ($view == 'coach') { if ($view == 'coach') {
/**************************************** /****************************************
* Infos about sessions of the coach * Infos about sessions of the coach

@ -17,6 +17,7 @@ require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'course.lib.php'; require_once api_get_path(LIBRARY_PATH).'course.lib.php';
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php'; require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php';
require_once api_get_path(SYS_CODE_PATH).'mySpace/myspace.lib.php'; require_once api_get_path(SYS_CODE_PATH).'mySpace/myspace.lib.php';
require_once api_get_path(LIBRARY_PATH).'attendance.lib.php';
$htmlHeadXtra[] = '<script type="text/javascript"> $htmlHeadXtra[] = '<script type="text/javascript">
@ -111,6 +112,7 @@ if (isset ($_GET['details'])) {
} }
$nameTools = get_lang("DetailsStudentInCourse"); $nameTools = get_lang("DetailsStudentInCourse");
} else { } else {
if (!empty ($_GET['origin']) && $_GET['origin'] == 'resume_session') { if (!empty ($_GET['origin']) && $_GET['origin'] == 'resume_session') {
$interbreadcrumb[] = array ( $interbreadcrumb[] = array (
'url' => '../admin/index.php', 'url' => '../admin/index.php',
@ -447,7 +449,7 @@ if (!empty ($_GET['student'])) {
<?php echo get_lang('TimeSpentInTheCourse') ?> <?php echo get_lang('TimeSpentInTheCourse') ?>
</td> </td>
<td align="left"> <td align="left">
<?php echo $time_spent_on_the_course ?> <?php echo $time_spent_on_the_course ?>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -1049,6 +1051,9 @@ if (!empty ($_GET['student'])) {
<th> <th>
<?php echo get_lang('Time'); ?> <?php echo get_lang('Time'); ?>
</th> </th>
<th>
<?php echo get_lang('AttendanceFaults'); ?>
</th>
<th> <th>
<?php echo get_lang('Progress'); ?> <?php echo get_lang('Progress'); ?>
</th> </th>
@ -1074,13 +1079,26 @@ if (!empty ($_GET['student'])) {
$csv_content[] = array ( $csv_content[] = array (
get_lang('Course', ''), get_lang('Course', ''),
get_lang('Time', ''), get_lang('Time', ''),
get_lang('AttendanceFaults', ''),
get_lang('Progress', ''), get_lang('Progress', ''),
get_lang('Score', '') get_lang('Score', '')
); );
$attendance = new Attendance();
foreach ($courses as $course_code) { foreach ($courses as $course_code) {
if (CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) { if (CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) {
$course_info = CourseManager :: get_course_information($course_code); $course_info = CourseManager :: get_course_information($course_code);
$time_spent_on_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($info_user['user_id'], $course_code)); $time_spent_on_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($info_user['user_id'], $course_code));
// get average of faults in attendances by student
$results_faults_avg = $attendance->get_faults_average_by_course($student_id, $course_code);
if (!empty($results_faults_avg)) {
$attendances_faults_avg = '<a title="'.get_lang('GoAttendance').'" href="'.api_get_path(WEB_CODE_PATH).'attendance/index.php?cidReq='.$course_code.'&student_id='.$student_id.'">'.$results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)</a>';
} else {
$attendances_faults_avg = '0%';
}
$progress = Tracking :: get_avg_student_progress($info_user['user_id'], $course_code); $progress = Tracking :: get_avg_student_progress($info_user['user_id'], $course_code);
$score = Tracking :: get_avg_student_score($info_user['user_id'], $course_code); $score = Tracking :: get_avg_student_score($info_user['user_id'], $course_code);
$progress = empty($progress) ? '0%' : $progress.'%'; $progress = empty($progress) ? '0%' : $progress.'%';
@ -1099,6 +1117,9 @@ if (!empty ($_GET['student'])) {
<td align="right"> <td align="right">
' . $time_spent_on_course . ' ' . $time_spent_on_course . '
</td> </td>
<td align="right">
'. $attendances_faults_avg . '
</td>
<td align="right"> <td align="right">
' . $progress . ' ' . $progress . '
</td> </td>

@ -12,6 +12,7 @@ $cidReset = true;
require '../inc/global.inc.php'; require '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'tracking.lib.php'; require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
require_once api_get_path(LIBRARY_PATH).'sessionmanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php'; require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
api_block_anonymous_users(); api_block_anonymous_users();
@ -77,7 +78,35 @@ if (isset($_GET['id_coach']) && $_GET['id_coach'] != '') {
$id_coach = $_user['user_id']; $id_coach = $_user['user_id'];
} }
$a_sessions = Tracking :: get_sessions_coached_by_user($id_coach); if (api_is_drh()) {
$a_sessions = SessionManager::get_sessions_followed_by_drh($_user['user_id']);
$menu_items[] = '<a href="index.php?view=drh_students">'.get_lang('Learners').'</a>';
$menu_items[] = '<a href="teachers.php">'.get_lang('Trainers').'</a>';
$menu_items[] = '<a href="course.php">'.get_lang('Trainings').'</a>';
$menu_items[] = get_lang('Sessions');
echo '<div class="actions-title" style ="font-size:10pt;">';
$nb_menu_items = count($menu_items);
if ($nb_menu_items > 1) {
foreach ($menu_items as $key => $item) {
echo $item;
if ($key != $nb_menu_items - 1) {
echo '&nbsp;|&nbsp;';
}
}
}
if (count($a_sessions) > 0) {
echo '&nbsp;&nbsp;<a href="javascript: void(0);" onclick="javascript: window.print()"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a> ';
echo '<a href="'.api_get_self().'?export=csv"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>';
}
echo '</div>';
} else {
$a_sessions = Tracking :: get_sessions_coached_by_user($id_coach);
}
$nb_sessions = count($a_sessions); $nb_sessions = count($a_sessions);
if ($export_csv) { if ($export_csv) {
@ -85,21 +114,24 @@ if ($export_csv) {
} }
if ($nb_sessions > 0) { if ($nb_sessions > 0) {
echo '<div align="right">
<a href="javascript: void(0);" onclick="javascript: window.print();"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a> if (!api_is_drh()) {
<a href="'.api_get_self().'?export=csv"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a> echo '<div align="right">
</div>'; <a href="javascript: void(0);" onclick="javascript: window.print();"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a>
<a href="'.api_get_self().'?export=csv"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>
</div>';
}
$table = new SortableTable('tracking', 'count_sessions_coached'); $table = new SortableTable('tracking', 'count_sessions_coached');
$table -> set_header(0, get_lang('Title')); $table -> set_header(0, get_lang('Title'));
$table -> set_header(1, get_lang('Status')); //$table -> set_header(1, get_lang('Status'));
$table -> set_header(2, get_lang('Date')); $table -> set_header(1, get_lang('Date'));
$table -> set_header(3, get_lang('Details'), false); $table -> set_header(2, get_lang('Details'), false);
$all_data = array(); $all_data = array();
foreach ($a_sessions as $session) { foreach ($a_sessions as $session) {
$row = array(); $row = array();
$row[] = $session['name']; $row[] = $session['name'];
$row[] = $session['status']; //$row[] = $session['status'];
if ($session['date_start'] != '0000-00-00' && $session['date_end'] != '0000-00-00') { if ($session['date_start'] != '0000-00-00' && $session['date_end'] != '0000-00-00') {
$row[] = get_lang('From').' '.format_locale_date(get_lang('DateFormatLongWithoutDay'), strtotime($session['date_start'])).' '.get_lang('To').' '.format_locale_date(get_lang('DateFormatLongWithoutDay'), strtotime($session['date_end'])); $row[] = get_lang('From').' '.format_locale_date(get_lang('DateFormatLongWithoutDay'), strtotime($session['date_start'])).' '.get_lang('To').' '.format_locale_date(get_lang('DateFormatLongWithoutDay'), strtotime($session['date_end']));
@ -137,7 +169,7 @@ if ($nb_sessions > 0) {
$table -> addRow($row); $table -> addRow($row);
} }
$table -> setColAttributes(3, array('align' => 'center')); $table -> setColAttributes(2, array('align' => 'center'));
$table -> display(); $table -> display();
if ($export_csv) { if ($export_csv) {

@ -95,7 +95,7 @@ function rsort_users($a, $b)
=============================================================================== ===============================================================================
*/ */
if ($isCoach || api_is_platform_admin() || $_user['status'] == DRH) { if ($isCoach || api_is_platform_admin() || api_is_drh()) {
if ($export_csv) { if ($export_csv) {
$is_western_name_order = api_is_western_name_order(PERSON_NAME_DATA_EXPORT); $is_western_name_order = api_is_western_name_order(PERSON_NAME_DATA_EXPORT);
@ -104,11 +104,43 @@ if ($isCoach || api_is_platform_admin() || $_user['status'] == DRH) {
} }
$sort_by_first_name = api_sort_by_first_name(); $sort_by_first_name = api_sort_by_first_name();
echo '<div align="left" style="float:left"><h4>'.$title.'</h4></div> if (api_is_drh()) {
<div align="right">
<a href="javascript: void(0);" onclick="javascript: window.print();"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a> if (!isset($_GET['id_session'])) {
<a href="'.api_get_self().'?export=csv"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a> $students = array_keys(UserManager::get_users_followed_by_drh($_user['user_id'], STUDENT));
</div><div class="clear"></div>'; $courses_of_the_platform = CourseManager :: get_real_course_list();
foreach ($courses_of_the_platform as $course) {
$courses[$course['code']] = $course['code'];
}
}
$menu_items[] = get_lang('Learners');
$menu_items[] = '<a href="teachers.php">'.get_lang('Trainers').'</a>';
$menu_items[] = '<a href="course.php">'.get_lang('Trainings').'</a>';
$menu_items[] = '<a href="session.php">'.get_lang('Sessions').'</a>';
echo '<div class="actions-title" style ="font-size:10pt;">';
$nb_menu_items = count($menu_items);
if ($nb_menu_items > 1) {
foreach ($menu_items as $key => $item) {
echo $item;
if ($key != $nb_menu_items - 1) {
echo '&nbsp;|&nbsp;';
}
}
}
if (count($students) > 0) {
echo '&nbsp;&nbsp;<a href="javascript: void(0);" onclick="javascript: window.print()"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a> ';
echo '<a href="'.api_get_self().'?export=csv"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>';
}
echo '</div>';
} else {
echo '<div align="left" style="float:left"><h4>'.$title.'</h4></div>
<div align="right">
<a href="javascript: void(0);" onclick="javascript: window.print();"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a>
<a href="'.api_get_self().'?export=csv"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>
</div><div class="clear"></div>';
}
if (isset($_GET['id_coach'])) { if (isset($_GET['id_coach'])) {
$coach_id = intval($_GET['id_coach']); $coach_id = intval($_GET['id_coach']);
@ -121,13 +153,6 @@ if ($isCoach || api_is_platform_admin() || $_user['status'] == DRH) {
$courses = Tracking :: get_courses_followed_by_coach($coach_id); $courses = Tracking :: get_courses_followed_by_coach($coach_id);
$students = Tracking :: get_student_followed_by_coach($coach_id); $students = Tracking :: get_student_followed_by_coach($coach_id);
} }
elseif ($_user['status'] == DRH) {
$students = Tracking :: get_student_followed_by_drh($_user['user_id']);
$courses_of_the_platform = CourseManager :: get_real_course_list();
foreach ($courses_of_the_platform as $course) {
$courses[$course['code']] = $course['code'];
}
}
} else { } else {
$students = Tracking :: get_student_followed_by_coach_in_a_session($_GET['id_session'], $coach_id); $students = Tracking :: get_student_followed_by_coach_in_a_session($_GET['id_session'], $coach_id);
} }
@ -264,7 +289,7 @@ if ($isCoach || api_is_platform_admin() || $_user['status'] == DRH) {
$table -> setColAttributes(9, array('align' => 'center')); $table -> setColAttributes(9, array('align' => 'center'));
$table -> display(); $table -> display();
} else { } else {
echo get_lang('NoStudent'); echo '<p>'.get_lang('NoStudent').'</p>';
} }
// send the csv file if asked // send the csv file if asked

@ -12,6 +12,7 @@ $cidReset = true;
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
require_once api_get_path(SYS_CODE_PATH).'mySpace/myspace.lib.php'; require_once api_get_path(SYS_CODE_PATH).'mySpace/myspace.lib.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
$this_section = "session_my_space"; $this_section = "session_my_space";
@ -21,7 +22,38 @@ api_block_anonymous_users();
$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace')); $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
Display :: display_header($nameTools); Display :: display_header($nameTools);
api_display_tool_title($nameTools); $formateurs = array();
if (api_is_drh()) {
// followed teachers by drh
$formateurs = UserManager::get_users_followed_by_drh($_user['user_id'], COURSEMANAGER);
$menu_items[] = '<a href="index.php?view=drh_students">'.get_lang('Learners').'</a>';
$menu_items[] = get_lang('Trainers');
$menu_items[] = '<a href="course.php">'.get_lang('Trainings').'</a>';
$menu_items[] = '<a href="session.php">'.get_lang('Sessions').'</a>';
echo '<div class="actions-title" style ="font-size:10pt;">';
$nb_menu_items = count($menu_items);
if ($nb_menu_items > 1) {
foreach ($menu_items as $key => $item) {
echo $item;
if ($key != $nb_menu_items - 1) {
echo '&nbsp;|&nbsp;';
}
}
}
if (count($formateurs) > 0) {
echo '&nbsp;&nbsp;<a href="javascript: void(0);" onclick="javascript: window.print()"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a> ';
echo '<a href="'.api_get_self().'?export=xls"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsXLS').'</a>';
}
echo '</div>';
echo '<br />';
}
if (!api_is_drh()) {
api_display_tool_title($nameTools);
}
// Database Table Definitions // Database Table Definitions
$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE); $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
@ -42,19 +74,26 @@ if (isset($_POST['export'])) {
} }
$sort_by_first_name = api_sort_by_first_name(); $sort_by_first_name = api_sort_by_first_name();
$order_clause = $sort_by_first_name ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname'; if (!api_is_drh()) {
if (isset($_GET["teacher_id"]) && $_GET["teacher_id"] != 0) { $order_clause = $sort_by_first_name ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
$teacher_id = intval($_GET["teacher_id"]); if (isset($_GET["teacher_id"]) && $_GET["teacher_id"] != 0) {
$sql_formateurs = "SELECT user_id,lastname,firstname,email $teacher_id = intval($_GET["teacher_id"]);
FROM $tbl_user $sql_formateurs = "SELECT user_id,lastname,firstname,email
WHERE user_id='$teacher_id'".$order_clause; FROM $tbl_user
} else { WHERE user_id='$teacher_id'".$order_clause;
$sql_formateurs = "SELECT user_id,lastname,firstname,email } else {
FROM $tbl_user $sql_formateurs = "SELECT user_id,lastname,firstname,email
WHERE status = 1".$order_clause; FROM $tbl_user
} WHERE status = 1".$order_clause;
}
$result_formateurs = Database::query($sql_formateurs); $result_formateurs = Database::query($sql_formateurs);
if (Database::num_rows($result_formateurs) > 0) {
while ($row_formateurs = Database::fetch_array($result_formateurs)) {
$formateurs[] = $row_formateurs;
}
}
}
if ($is_western_name_order) { if ($is_western_name_order) {
echo '<table class="data_table"><tr><th>'.get_lang('FirstName').'</th><th>'.get_lang('LastName').'</th><th>'.get_lang('Email').'</th><th>'.get_lang('AdminCourses').'</th><th>'.get_lang('Students').'</th></tr>'; echo '<table class="data_table"><tr><th>'.get_lang('FirstName').'</th><th>'.get_lang('LastName').'</th><th>'.get_lang('Email').'</th><th>'.get_lang('AdminCourses').'</th><th>'.get_lang('Students').'</th></tr>';
@ -73,15 +112,14 @@ $header[] = get_lang('Email', '');
$data = array(); $data = array();
if (Database::num_rows($result_formateurs) > 0) { if (count($formateurs) > 0) {
$i = 1; $i = 1;
while ($formateurs = Database::fetch_array($result_formateurs)) { foreach ($formateurs as $formateur) {
$user_id = $formateur["user_id"];
$user_id = $formateurs["user_id"]; $lastname = $formateur["lastname"];
$lastname = $formateurs["lastname"]; $firstname = $formateur["firstname"];
$firstname = $formateurs["firstname"]; $email = $formateur["email"];
$email = $formateurs["email"];
if ($i % 2 == 0) { if ($i % 2 == 0) {
$css_class = "row_odd"; $css_class = "row_odd";
@ -120,12 +158,14 @@ if (Database::num_rows($result_formateurs) > 0) {
} }
echo '</table>'; echo '</table>';
if (isset($_POST['export'])) { if (isset($_POST['export']) || (api_is_drh() && isset($_GET['export']))) {
export_csv($header, $data, 'teachers.csv'); export_csv($header, $data, 'teachers.csv');
} }
echo "<br /><br />"; echo "<br /><br />";
echo "<form method='post' action='teachers.php'><input type='submit' name='export' value='".get_lang('exportExcel')."'/><form>"; if (!api_is_drh()) {
echo "<form method='post' action='teachers.php'><input type='submit' name='export' value='".get_lang('exportExcel')."'/><form>";
}
/* /*
============================================================================== ==============================================================================

@ -35,7 +35,7 @@ if (isset($_GET['from']) && $_GET['from'] == 'myspace') {
} }
// access restrictions // access restrictions
$is_allowedToTrack = $is_courseAdmin || $is_platformAdmin || $is_courseCoach || $is_sessionAdmin; $is_allowedToTrack = $is_courseAdmin || $is_platformAdmin || $is_courseCoach || $is_sessionAdmin || api_is_drh();
if (!$is_allowedToTrack) { if (!$is_allowedToTrack) {
Display :: display_header(null); Display :: display_header(null);

@ -105,7 +105,7 @@ $interbreadcrumb[] = array ("url" => api_get_self()."?view=0000000", "name" => g
include(api_get_path(LIBRARY_PATH)."statsUtils.lib.inc.php"); include(api_get_path(LIBRARY_PATH)."statsUtils.lib.inc.php");
include("../resourcelinker/resourcelinker.inc.php"); include("../resourcelinker/resourcelinker.inc.php");
$is_allowedToTrack = $is_courseAdmin || $is_platformAdmin; $is_allowedToTrack = $is_courseAdmin || $is_platformAdmin || api_is_drh();
/* /*
============================================================================== ==============================================================================

@ -29,7 +29,11 @@ class BlockCourse extends Block {
*/ */
public function __construct ($user_id) { public function __construct ($user_id) {
$this->user_id = $user_id; $this->user_id = $user_id;
$this->courses = CourseManager::get_assigned_courses_to_hr_manager($user_id); if (api_is_platform_admin()) {
$this->courses = CourseManager::get_real_course_list();
} else if (api_is_drh()) {
$this->courses = CourseManager::get_courses_followed_by_drh($user_id);
}
$this->path = 'block_course'; $this->path = 'block_course';
} }
@ -71,16 +75,14 @@ class BlockCourse extends Block {
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 = ''; $content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourCourseList').'</font></h3>';
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="10%">'.get_lang('NbStudents').'</th> <th width="10%">'.get_lang('NbStudents').'</th>
<th width="10%">'.get_lang('AvgTimeSpentInTheCourse').'</th> <th width="10%">'.get_lang('AvgTimeSpentInTheCourse').'</th>
<th width="10%">'.get_lang('AvgStudentsProgress').'</th>
<th width="10%">'.get_lang('AvgCourseScore').'</th>
<th width="10%">'.get_lang('AvgExercisesScore').'</th>
<th width="10%">'.get_lang('ThematicAdvance').'</th> <th width="10%">'.get_lang('ThematicAdvance').'</th>
</tr>'; </tr>';
$i = 1; $i = 1;
@ -98,11 +100,9 @@ class BlockCourse extends Block {
} else { } else {
$data_table .= get_lang('ThereAreNoInformationsAboutYoursCourses'); $data_table .= get_lang('ThereAreNoInformationsAboutYoursCourses');
} }
$content .= '<div style="margin:15px;"><h3>'.get_lang('YourCourseList').'</h3>';
$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="#">'.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>';
@ -128,6 +128,7 @@ class BlockCourse extends Block {
$a_course_students = array(); $a_course_students = array();
$course_data = array(); $course_data = array();
$courses = $this->courses; $courses = $this->courses;
$course_description = new CourseDescription();
foreach ($courses as $row_course) { foreach ($courses as $row_course) {
@ -144,38 +145,25 @@ 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 = Tracking::get_time_spent_on_the_course($users, $course_code); $avg_time_spent_in_course = Tracking::get_time_spent_on_the_course($users, $course_code);
$avg_progress_in_course = Tracking::get_avg_student_progress($users, $course_code);
$avg_score_in_course = Tracking :: get_avg_student_score($users, $course_code);
$avg_score_in_exercise = Tracking::get_avg_student_exercise_score($users, $course_code);
$avg_time_spent_in_course = api_time_to_hms($avg_time_spent_in_course / $nb_students_in_course);
$avg_progress_in_course = round($avg_progress_in_course / $nb_students_in_course, 2);
$avg_score_in_course = round($avg_score_in_course / $nb_students_in_course, 2);
$avg_score_in_exercise = round($avg_score_in_exercise / $nb_students_in_course, 2);
} else { } else {
$avg_time_spent_in_course = null; $avg_time_spent_in_course = null;
$avg_progress_in_course = null;
$avg_score_in_course = null;
$avg_score_in_exercise = null;
} }
$tematic_advance_progress = 0; $tematic_advance_progress = 0;
$course_description = new CourseDescription();
$course_description->set_session_id(0); $course_description->set_session_id(0);
$tematic_advance = $course_description->get_data_by_description_type(8, $course_code); $tematic_advance = $course_description->get_data_by_description_type(8, $course_code);
if (!empty($tematic_advance)) { if (!empty($tematic_advance)) {
$tematic_advance_progress = $tematic_advance['progress']; $tematic_advance_progress = '<a title="'.get_lang('GoToThematicAdvance').'" href="'.api_get_path(WEB_CODE_PATH).'course_description/?cidReq='.$course_code.'#thematic_advance">'.$tematic_advance['progress'].'%</a>';
} else {
$tematic_advance_progress = '0%';
} }
$table_row = array(); $table_row = array();
$table_row[] = $row_course['title']; $table_row[] = $row_course['title'];
$table_row[] = $nb_students_in_course; $table_row[] = $nb_students_in_course;
$table_row[] = $avg_time_spent_in_course; $table_row[] = $avg_time_spent_in_course;
$table_row[] = is_null($avg_progress_in_course) ? '' : $avg_progress_in_course.'%'; $table_row[] = $tematic_advance_progress;
$table_row[] = is_null($avg_score_in_course) ? '' : $avg_score_in_course.'%';
$table_row[] = is_null($avg_score_in_exercise) ? '' : $avg_score_in_exercise.'%';
$table_row[] = $tematic_advance_progress.'%';
$course_data[] = $table_row; $course_data[] = $table_row;
} }

@ -30,8 +30,12 @@ class BlockSession extends Block {
*/ */
public function __construct ($user_id) { public function __construct ($user_id) {
$this->user_id = $user_id; $this->user_id = $user_id;
$this->sessions = SessionManager::get_assigned_sessions_to_hr_manager($user_id); if (api_is_platform_admin()) {
$this->path = 'block_session'; $this->sessions = SessionManager::get_sessions_list();
} else if (api_is_drh()) {
$this->sessions = SessionManager::get_sessions_followed_by_drh($user_id);
}
$this->path = 'block_session';
} }
/** /**
@ -54,7 +58,6 @@ class BlockSession extends Block {
<h3>'.get_lang('SessionsInformation').'</h3> <h3>'.get_lang('SessionsInformation').'</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.'
</div> </div>
@ -77,80 +80,42 @@ class BlockSession extends Block {
$sessions = $this->sessions; $sessions = $this->sessions;
$content = '<div style="margin:10px;">'; $content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourTrainingsSessionList').'</font></h3>'; $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>
<th >'.get_lang('Title').'</th>
<th >'.get_lang('Date').'</th>
</tr>';
$i = 1;
foreach ($sessions as $session) { foreach ($sessions as $session) {
$session_id = intval($session['id']); $session_id = intval($session['id']);
$content .= '<div style="margin-top:10px;"><strong>'.$session['name'].'</strong> - '.get_lang('From').' '.$session['date_start'].' '.get_lang('To').' '.$session['date_end'].'</div>'; $title = $session['name'];
$courses = Tracking ::get_courses_list_from_session($session_id); if ($session['date_start'] != '0000-00-00' && $session['date_end'] != '0000-00-00') {
$date = get_lang('From').' '.format_locale_date(get_lang('DateFormatLongWithoutDay'), strtotime($session['date_start'])).' '.get_lang('To').' '.format_locale_date(get_lang('DateFormatLongWithoutDay'), strtotime($session['date_end']));
$courses_table = '';
if (count($courses)) {
$courses_table = '<div style="margin:10px;margin-bottom:20px;"><table class="data_table" width:"95%">';
$courses_table .= '<tr>
<th>'.get_lang('Course').'</th>
<th width="10%">'.get_lang('Time').'</th>
<th width="10%">'.get_lang('Progress').'</th>
<th width="10%">'.get_lang('Score').'</th>
<th width="10%">'.get_lang('TematicAdvance').'</th>
</tr>';
$i = 1;
foreach ($courses as $course) {
$course_code = Database::escape_string($course['course_code']);
$course_info = CourseManager :: get_course_information($course_code);
$tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
// students directly subscribed to the course
$sql = "SELECT id_user FROM $tbl_session_course_user srcu WHERE srcu. course_code='$course_code'";
$rs = Database::query($sql);
$users = array();
while ($row = Database::fetch_array($rs)) {
$users[] = $row['id_user'];
}
$time_spent_on_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($users, $course_code));
$progress = Tracking :: get_avg_student_progress($users, $course_code);
$score = Tracking :: get_avg_student_score($users, $course_code);
$progress = empty($progress) ? '0%' : $progress.'%';
$score = empty($score) ? '0%' : $score.'%';
$tematic_advance_progress = 0;
$course_description = new CourseDescription();
$course_description->set_session_id($session_id);
$tematic_advance = $course_description->get_data_by_description_type(8, $course_code);
if (!empty($tematic_advance)) {
$tematic_advance_progress = $tematic_advance['progress'];
}
if ($i%2 == 0) $class_tr = 'row_odd';
else $class_tr = 'row_even';
$courses_table .= '<tr class="'.$class_tr.'">
<td align="right">'.$course_info['title'].'</td>
<td align="right">'.$time_spent_on_course.'</td>
<td align="right">'.$progress.'</td>
<td align="right">'.$score.'</td>
<td align="right">'.$tematic_advance_progress.'%</td>
</tr>';
$i++;
}
$courses_table .= '</table></div>';
} else { } else {
$courses_table .= '<div style="margin:10px;">'.get_lang('ThereAreNoCoursesInformationsInsideThisSession').'</div>'; $date = ' - ';
} }
$content .= $courses_table;
if ($i%2 == 0) $class_tr = 'row_odd';
else $class_tr = 'row_even';
$sessions_table .= '<tr class="'.$class_tr.'">
<td align="right">'.$title.'</td>
<td align="right">'.$date.'</td>
</tr>';
$i++;
} }
$sessions_table .= '</table>';
$content .= $sessions_table;
} else { } else {
$content .= '<div style="margin:20px;">'.get_lang('ThereAreNoInformationsAboutYoursSessions').'</div>'; $content .= get_lang('ThereAreNoInformationsAboutYoursSessions');
} }
if (count($sessions) > 0) { if (count($sessions) > 0) {
$content .= '<div style="text-align:right;margin-top:10px;"><a href="#">'.get_lang('SeeMore').'</a></div>'; $content .= '<div style="text-align:right;margin-top:10px;"><a href="'.api_get_path(WEB_CODE_PATH).'mySpace/session.php">'.get_lang('SeeMore').'</a></div>';
} }
$content .= '</div>'; $content .= '</div>';

@ -12,6 +12,7 @@
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'course.lib.php'; require_once api_get_path(LIBRARY_PATH).'course.lib.php';
require_once api_get_path(LIBRARY_PATH).'tracking.lib.php'; require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
require_once api_get_path(LIBRARY_PATH).'attendance.lib.php';
/** /**
* This class is used like controller for student block plugin, * This class is used like controller for student block plugin,
@ -29,7 +30,11 @@ class BlockStudent extends Block {
*/ */
public function __construct ($user_id) { public function __construct ($user_id) {
$this->user_id = $user_id; $this->user_id = $user_id;
$this->students = UserManager::get_assigned_users_to_hr_manager($user_id, STUDENT); 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->path = 'block_student'; $this->path = 'block_student';
} }
@ -45,7 +50,11 @@ class BlockStudent extends Block {
$column = 1; $column = 1;
$data = array(); $data = array();
$student_content_html = $this->get_students_content_html(); if (api_is_platform_admin()) {
$student_content_html = $this->get_students_content_html_for_platform_admin();
} else if (api_is_drh()) {
$student_content_html = $this->get_students_content_html_for_drh();
}
$html = ' $html = '
<li class="widget color-blue" id="intro"> <li class="widget color-blue" id="intro">
@ -70,26 +79,24 @@ 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() { public function get_students_content_html_for_platform_admin() {
$students = $this->students; $students = $this->students;
$content = ''; $content = '';
$content = '<div style="margin:20px;margin-right:30px;">'; $content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('StudentsOverview').'</font></h3>'; $content .= '<h3><font color="#000">'.get_lang('YourStudents').'</font></h3>';
if (count($students) > 0) { if (count($students) > 0) {
$students_table = '<div style="margin:10px;width:100%"><table class="data_table" width:"90%">'; $students_table = '<table class="data_table" width:"95%">';
$students_table .= ' $students_table .= '
<tr> <tr>
<th width="10%" rowspan="2">'.get_lang('FirtName').'</th> <th width="10%" rowspan="2">'.get_lang('FirtName').'</th>
<th width="10%" rowspan="2">'.get_lang('LastName').'</th> <th width="10%" rowspan="2">'.get_lang('LastName').'</th>
<th width="30%" colspan="4">'.get_lang('TrainingInformations').'</th> <th width="30%" colspan="2">'.get_lang('TrainingInformations').'</th>
</tr> </tr>
<tr> <tr>
<th width="10%">'.get_lang('Training').'</th> <th width="10%">'.get_lang('Training').'</th>
<th width="10%">'.get_lang('Time').'</th> <th width="10%">'.get_lang('Time').'</th>
<th width="10%">'.get_lang('Progress').'</th>
<th width="10%">'.get_lang('Score').'</th>
</tr> </tr>
'; ';
@ -111,34 +118,87 @@ class BlockStudent extends Block {
$course_code = $course['code']; $course_code = $course['code'];
$course_title = $course['title']; $course_title = $course['title'];
$time = api_time_to_hms(Tracking :: get_time_spent_on_the_course($student['user_id'], $course_code)); $time = api_time_to_hms(Tracking :: get_time_spent_on_the_course($student['user_id'], $course_code));
$progress = round(Tracking :: get_avg_student_progress($student['user_id'], $course_code), 2);
$score = round(Tracking :: get_avg_student_score($student['user_id'], $course_code), 2);
$students_table .= '<tr '.$style.'> $students_table .= '<tr '.$style.'>
<td>'.$course_title.'</td> <td>'.$course_title.'</td>
<td>'.$time.'</td> <td>'.$time.'</td>
<td>'.$progress.'</td>
<td>'.$score.'</td>
</tr>'; </tr>';
} }
$i++; $i++;
} }
$students_table .= '</table></div>'; $students_table .= '</table>';
} else { } else {
$students_table .= '<div style="margin:20px">'.get_lang('ThereAreNoInformationAboutStudents').'</div>'; $students_table .= get_lang('ThereAreNoInformationAboutStudents');
} }
$content .= $students_table; $content .= $students_table;
if (count($students) > 0) { if (count($students) > 0) {
$content .= '<div style="text-align:right;margin:10px;"><a href="#">'.get_lang('SeeMore').'</a></div>'; $content .= '<div style="text-align:right;margin:10px;"><a href="'.api_get_path(WEB_CODE_PATH).'mySpace/student.php">'.get_lang('SeeMore').'</a></div>';
} }
$content .= '</div>'; $content .= '</div>';
return $content; return $content;
} }
public function get_students_content_html_for_drh() {
$attendance = new Attendance();
$students = $this->students;
$content = '';
$content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourStudents').'</font></h3>';
if (count($students) > 0) {
$students_table = '<table class="data_table" width:"95%">';
$students_table .= '
<tr>
<th>'.get_lang('FirtName').'</th>
<th>'.get_lang('LastName').'</th>
<th>'.get_lang('AttendancesFaults').'</th>
<th>'.get_lang('Evaluations').'</th>
</tr>
';
$i = 1;
foreach ($students as $student) {
$student_id = $student['user_id'];
$firstname = $student['firstname'];
$lastname = $student['lastname'];
$evaluations_avg = 0;
// 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 = '<a title="'.get_lang('GoToStudentDetails').'" href="'.api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?student='.$student_id.'">'.$results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)</a>';
} else {
$attendances_faults_avg = '0%';
}
if ($i%2 == 0) $class_tr = 'row_odd';
else $class_tr = 'row_even';
$students_table .= '<tr class="'.$class_tr.'">
<td>'.$firstname.'</td>
<td>'.$lastname.'</td>
<td align="right">'.$attendances_faults_avg.'</td>
<td align="right">'.$evaluations_avg.'%</td>
</tr>';
$i++;
}
$students_table .= '</table>';
} else {
$students_table .= get_lang('ThereAreNoInformationAboutStudents');
}
$content .= $students_table;
if (count($students) > 0) {
$content .= '<div style="text-align:right;margin:10px;"><a href="'.api_get_path(WEB_CODE_PATH).'mySpace/index.php?view=admin&display=useroverview">'.get_lang('SeeMore').'</a></div>';
}
$content .= '</div>';
return $content;
}
/** /**
* Get number of sessions * Get number of sessions
* @return int * @return int

@ -29,7 +29,11 @@ class BlockTeacher extends Block {
*/ */
public function __construct ($user_id) { public function __construct ($user_id) {
$this->user_id = $user_id; $this->user_id = $user_id;
$this->teachers = UserManager::get_assigned_users_to_hr_manager($user_id, COURSEMANAGER); if (api_is_platform_admin()) {
$this->teachers = UserManager::get_user_list(array('status' => COURSEMANAGER));
} else if (api_is_drh()) {
$this->teachers = UserManager::get_users_followed_by_drh($user_id, COURSEMANAGER);
}
$this->path = 'block_teacher'; $this->path = 'block_teacher';
} }
@ -45,7 +49,11 @@ class BlockTeacher extends Block {
$column = 1; $column = 1;
$data = array(); $data = array();
$teacher_content_html = $this->get_teachers_content_html(); 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 = ' $html = '
<li class="widget color-blue" id="intro"> <li class="widget color-blue" id="intro">
@ -70,24 +78,21 @@ 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() { public function get_teachers_content_html_for_platform_admin() {
$teachers = $this->teachers; $teachers = $this->teachers;
$content = ''; $content = '';
$content = '<div style="margin:10px;">'; $content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('TeachersOverview').'</font></h3>'; $content .= '<h3><font color="#000">'.get_lang('YourTeachers').'</font></h3>';
if (count($teachers) > 0) { if (count($teachers) > 0) {
$teachers_table = '<div style="margin:10px;margin-bottom:20px;"><table class="data_table" width:"80%">'; $teachers_table = '<table class="data_table" width:"95%">';
$teachers_table .= ' $teachers_table .= '
<tr> <tr>
<th>'.get_lang('FirtName').'</th> <th>'.get_lang('FirtName').'</th>
<th>'.get_lang('LastName').'</th> <th>'.get_lang('LastName').'</th>
<th>'.get_lang('TimeSpentOnThePlatform').'</th> <th>'.get_lang('TimeSpentOnThePlatform').'</th>
<th>'.get_lang('LastConnexion').'</th> <th>'.get_lang('LastConnexion').'</th>
<th>'.get_lang('NbStudents').'</th>
<th>'.get_lang('CountCours').'</th>
<th>'.get_lang('NumberOfSessions').'</th>
</tr> </tr>
'; ';
@ -99,9 +104,6 @@ class BlockTeacher extends Block {
$lastname = $teacher['lastname']; $lastname = $teacher['lastname'];
$time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($teacher_id)); $time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($teacher_id));
$last_connection = Tracking :: get_last_connection_date($teacher_id); $last_connection = Tracking :: get_last_connection_date($teacher_id);
$nb_students = count(Tracking :: get_student_followed_by_coach($teacher_id));
$nb_courses = count(Tracking :: get_courses_followed_by_coach($teacher_id));
$nb_sessions = count(Tracking :: get_sessions_coached_by_user($teacher_id));
if ($i%2 == 0) $class_tr = 'row_odd'; if ($i%2 == 0) $class_tr = 'row_odd';
else $class_tr = 'row_even'; else $class_tr = 'row_even';
@ -112,23 +114,20 @@ class BlockTeacher extends Block {
<td>'.$lastname.'</td> <td>'.$lastname.'</td>
<td>'.$time_on_platform.'</td> <td>'.$time_on_platform.'</td>
<td>'.$last_connection.'</td> <td>'.$last_connection.'</td>
<td>'.$nb_students.'</td>
<td>'.$nb_courses.'</td>
<td>'.$nb_sessions.'</td>
</tr> </tr>
'; ';
$i++; $i++;
} }
$teachers_table .= '</table></div>'; $teachers_table .= '</table>';
} else { } else {
$teachers_table .= '<div style="margin:20px">'.get_lang('ThereAreNoInformationAboutTeachers').'</div>'; $teachers_table .= get_lang('ThereAreNoInformationAboutTeachers');
} }
$content .= $teachers_table; $content .= $teachers_table;
if (count($teachers) > 0) { if (count($teachers) > 0) {
$content .= '<div style="text-align:right;margin:10px;"><a href="#">'.get_lang('SeeMore').'</a></div>'; $content .= '<div style="text-align:right;margin:10px;"><a href="'.api_get_path(WEB_CODE_PATH).'mySpace/index.php?view=admin">'.get_lang('SeeMore').'</a></div>';
} }
$content .= '</div>'; $content .= '</div>';
@ -137,6 +136,60 @@ class BlockTeacher extends Block {
} }
public function get_teachers_content_html_for_drh() {
$teachers = $this->teachers;
$content = '';
$content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">'.get_lang('YourTeachers').'</font></h3>';
if (count($teachers) > 0) {
$teachers_table = '<table class="data_table" width:"95%">';
$teachers_table .= '
<tr>
<th>'.get_lang('FirtName').'</th>
<th>'.get_lang('LastName').'</th>
<th>'.get_lang('Time').'</th>
<th>'.get_lang('Email').'</th>
</tr>
';
$i = 1;
foreach ($teachers as $teacher) {
$teacher_id = $teacher['user_id'];
$firstname = $teacher['firstname'];
$lastname = $teacher['lastname'];
$time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($teacher_id));
$email = $teacher['email'];
if ($i%2 == 0) $class_tr = 'row_odd';
else $class_tr = 'row_even';
$teachers_table .= '<tr class="'.$class_tr.'">
<td>'.$firstname.'</td>
<td>'.$lastname.'</td>
<td>'.$time_on_platform.'</td>
<td>'.$email.'</td>
</tr>';
$i++;
}
$teachers_table .= '</table>';
} else {
$teachers_table .= get_lang('ThereAreNoInformationAboutTeachers');
}
$content .= $teachers_table;
if (count($teachers) > 0) {
$content .= '<div style="text-align:right;margin:10px;"><a href="'.api_get_path(WEB_CODE_PATH).'mySpace/teachers.php">'.get_lang('SeeMore').'</a></div>';
}
$content .= '</div>';
return $content;
}
/** /**
* Get number of sessions * Get number of sessions
* @return int * @return int

Loading…
Cancel
Save