minor - changed some variables langs, fixed some warnings inside dashboard tool - partial CT#540

skala
Cristian Fasanando 15 years ago
parent a24b694346
commit fff0a48eea
  1. 4
      main/admin/dashboard_add_courses_to_user.php
  2. 6
      main/admin/dashboard_add_sessions_to_user.php
  3. 4
      main/admin/dashboard_add_users_to_user.php
  4. 4
      main/dashboard/dashboard.php
  5. 34
      main/dashboard/dashboard_controller.php
  6. 26
      main/inc/lib/usermanager.lib.php
  7. 4
      main/mySpace/course.php
  8. 4
      main/mySpace/index.php
  9. 4
      main/mySpace/myStudents.php
  10. 4
      main/mySpace/session.php
  11. 4
      main/mySpace/student.php
  12. 4
      main/mySpace/teachers.php
  13. 6
      plugin/dashboard/block_course/block_course.class.php
  14. 32
      plugin/dashboard/block_student/block_student.class.php
  15. 8
      plugin/dashboard/block_teacher/block_teacher.class.php

@ -166,7 +166,7 @@ Display::display_header($tool_name);
//echo '<div class="row"><div class="form_header">'.get_lang('AssignedCoursesTo').'&nbsp;'.api_get_person_name($hrm_info['firstname'], $hrm_info['lastname']).'</div></div><br />';
echo '<div class="actions" style="height:22px;">
<span style="float: right;margin:0px;padding:0px;">
<a href="dashboard_add_users_to_user.php?user='.$user_id.'">'.Display::return_icon('add_user_big.gif', get_lang('AssignUsers'), array('style'=>'vertical-align:middle')).' '.get_lang('AssignUsers').'</a>
<a href="dashboard_add_users_to_user.php?user='.$hrm_id.'">'.Display::return_icon('add_user_big.gif', get_lang('AssignUsers'), array('style'=>'vertical-align:middle')).' '.get_lang('AssignUsers').'</a>
<a href="dashboard_add_sessions_to_user.php?user='.$hrm_id.'">'.Display::return_icon('view_more_stats.gif', get_lang('AssignSessions'), array('style'=>'vertical-align:middle')).' '.get_lang('AssignSessions').'</a></span>
<span style="vertical-align:middle">'.get_lang('AssignedUsersTo').'&nbsp;'.api_get_person_name($hrm_info['firstname'], $hrm_info['lastname']).'</span></div>';
@ -255,7 +255,7 @@ if(!empty($msg)) {
?>
<br /><br /><br /><br /><br /><br />
<?php
echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('AssignCoursesToHumanResourceManager').'</button>';
echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('AssignCoursesToHumanResourcesManager').'</button>';
?>
</td>
<td width="45%" align="center">

@ -170,7 +170,7 @@ Display::display_header($tool_name);
echo '<div class="actions" style="height:22px;">
<span style="float: right;margin:0px;padding:0px;">
<a href="dashboard_add_users_to_user.php?user='.$user_id.'">'.Display::return_icon('add_user_big.gif', get_lang('AssignUsers'), array('style'=>'vertical-align:middle')).' '.get_lang('AssignUsers').'</a>
<a href="dashboard_add_users_to_user.php?user='.$hrm_id.'">'.Display::return_icon('add_user_big.gif', get_lang('AssignUsers'), array('style'=>'vertical-align:middle')).' '.get_lang('AssignUsers').'</a>
<a href="dashboard_add_courses_to_user.php?user='.$hrm_id.'">'.Display::return_icon('course_add.gif', get_lang('AssignCourses'), array('style'=>'vertical-align:middle')).' '.get_lang('AssignCourses').'</a></span>
<span style="vertical-align:middle">'.get_lang('AssignedUsersTo').'&nbsp;'.api_get_person_name($hrm_info['firstname'], $hrm_info['lastname']).'</span></div>';
@ -209,7 +209,7 @@ if(!empty($msg)) {
<tr>
<td width="45%" align="center"><b><?php echo get_lang('SessionsListInPlatform') ?> :</b></td>
<td width="10%">&nbsp;</td>
<td align="center" width="45%"><b><?php echo get_lang('AssignedSessionsListToHumanResourceManager') ?> :</b></td>
<td align="center" width="45%"><b><?php echo get_lang('AssignedSessionsListToHumanResourcesManager') ?> :</b></td>
</tr>
<?php if($add_type == 'multiple') { ?>
@ -254,7 +254,7 @@ if(!empty($msg)) {
?>
<br /><br /><br /><br /><br /><br />
<?php
echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('AssignSessionsToHumanResourceManager').'</button>';
echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('AssignSessionsToHumanResourcesManager').'</button>';
?>
</td>
<td width="45%" align="center">

@ -202,7 +202,7 @@ if(!empty($msg)) {
<tr>
<td width="45%" align="center"><b><?php echo get_lang('UserListInPlatform') ?> :</b></td>
<td width="10%">&nbsp;</td>
<td align="center" width="45%"><b><?php echo get_lang('AssignedUsersListToHumanResourceManager') ?> :</b></td>
<td align="center" width="45%"><b><?php echo get_lang('AssignedUsersListToHumanResourcesManager') ?> :</b></td>
</tr>
<?php if($add_type == 'multiple') { ?>
@ -248,7 +248,7 @@ if(!empty($msg)) {
?>
<br /><br /><br /><br /><br /><br />
<?php
echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('AssignUsersToHumanResourceManager').'</button>';
echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('AssignUsersToHumanResourcesManager').'</button>';
?>
</td>
<td width="45%" align="center">

@ -38,7 +38,7 @@ if($dashboard_view == 'blocks') {
if (count($blocks) > 0) {
$columns = array();
// group content html by number of column
if (is_array($blocks) && count($blocks) > 0) {
if (is_array($blocks)) {
$tmp_columns = array();
foreach ($blocks as $block) {
$tmp_columns[] = $block['column'];
@ -94,4 +94,4 @@ if($dashboard_view == 'blocks') {
}
?>
?>

@ -42,25 +42,27 @@ class DashboardController { // extends Controller {
$user_block_data = DashboardManager::get_user_block_data($user_id);
$user_blocks_id = array_keys($user_block_data);
foreach ($dashboard_blocks as $block) {
// display only user blocks
if (!in_array($block['id'], $user_blocks_id)) continue;
if (!empty($dashboard_blocks)) {
foreach ($dashboard_blocks as $block) {
// display only user blocks
if (!in_array($block['id'], $user_blocks_id)) continue;
$path = $block['path'];
$controller_class = $block['controller'];
$filename_controller = $path.'.class.php';
$dashboard_plugin_path = api_get_path(SYS_PLUGIN_PATH).'dashboard/'.$path.'/';
require_once $dashboard_plugin_path.$filename_controller;
$obj = new $controller_class($user_id);
$data_block[$path] = $obj->get_block();
// set user block column
$data_block[$path]['column'] = $user_block_data[$block['id']]['column'];
}
$path = $block['path'];
$controller_class = $block['controller'];
$filename_controller = $path.'.class.php';
$dashboard_plugin_path = api_get_path(SYS_PLUGIN_PATH).'dashboard/'.$path.'/';
require_once $dashboard_plugin_path.$filename_controller;
$obj = new $controller_class($user_id);
$data_block[$path] = $obj->get_block();
// set user block column
$data_block[$path]['column'] = $user_block_data[$block['id']]['column'];
$data['blocks'] = $data_block;
$data['dashboard_view'] = 'blocks';
}
$data['blocks'] = $data_block;
$data['dashboard_view'] = 'blocks';
if ($msg) {
$data['msg'] = $msg;
}

@ -2966,7 +2966,31 @@ class UserManager
return $affected_rows;
}
/**
* This function check if an user is followed by human resources manager
* @param int User id
* @param int Human resources manager
* @return bool
*/
public static function is_user_followed_by_drh($user_id, $hr_dept_id) {
// Database table and variables Definitions
$tbl_user_rel_user = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
$user_id = intval($user_id);
$hr_dept_id = intval($hr_dept_id);
$result = false;
$sql = "SELECT user_id FROM $tbl_user_rel_user WHERE user_id='$user_id' AND friend_user_id='$hr_dept_id' AND relation_type=".USER_RELATION_TYPE_RRHH." ";
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0) {
$result = true;
}
return $result;
}
}

@ -64,9 +64,9 @@ 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="index.php?view=drh_students">'.get_lang('Students').'</a>';
$menu_items[] = '<a href="teachers.php">'.get_lang('Teachers').'</a>';
$menu_items[] = get_lang('Trainings');
$menu_items[] = get_lang('Courses');
$menu_items[] = '<a href="session.php">'.get_lang('Sessions').'</a>';
echo '<div class="actions-title" style ="font-size:10pt;">';

@ -152,9 +152,9 @@ if ($is_platform_admin) {
if (api_is_drh()) {
$view = 'drh_students';
$menu_items[] = get_lang('Learners');
$menu_items[] = get_lang('Students');
$menu_items[] = '<a href="teachers.php">'.get_lang('Trainers').'</a>';
$menu_items[] = '<a href="course.php">'.get_lang('Trainings').'</a>';
$menu_items[] = '<a href="course.php">'.get_lang('Courses').'</a>';
$menu_items[] = '<a href="session.php">'.get_lang('Sessions').'</a>';
}

@ -154,7 +154,7 @@ if (isset ($_GET['details'])) {
api_block_anonymous_users();
if (!api_is_allowed_to_edit() && !api_is_coach() && $_user['status'] != DRH && $_user['status'] != SESSIONADMIN && !api_is_platform_admin(true)) {
if (!api_is_allowed_to_edit() && !api_is_coach() && !api_is_drh() && $_user['status'] != SESSIONADMIN && !api_is_platform_admin(true)) {
api_not_allowed(true);
}
@ -219,7 +219,7 @@ if (!empty ($_GET['student'])) {
// infos about user
$info_user = UserManager :: get_user_info_by_id($student_id);
if ($_user['status'] == DRH && $info_user['hr_dept_id'] != $_user['user_id']) {
if (api_is_drh() && !UserManager::is_user_followed_by_drh($student_id, $_user['user_id'])) {
api_not_allowed();
}

@ -82,9 +82,9 @@ 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="index.php?view=drh_students">'.get_lang('Students').'</a>';
$menu_items[] = '<a href="teachers.php">'.get_lang('Trainers').'</a>';
$menu_items[] = '<a href="course.php">'.get_lang('Trainings').'</a>';
$menu_items[] = '<a href="course.php">'.get_lang('Courses').'</a>';
$menu_items[] = get_lang('Sessions');
echo '<div class="actions-title" style ="font-size:10pt;">';

@ -114,9 +114,9 @@ if ($isCoach || api_is_platform_admin() || api_is_drh()) {
}
}
$menu_items[] = get_lang('Learners');
$menu_items[] = get_lang('Students');
$menu_items[] = '<a href="teachers.php">'.get_lang('Trainers').'</a>';
$menu_items[] = '<a href="course.php">'.get_lang('Trainings').'</a>';
$menu_items[] = '<a href="course.php">'.get_lang('Courses').'</a>';
$menu_items[] = '<a href="session.php">'.get_lang('Sessions').'</a>';
echo '<div class="actions-title" style ="font-size:10pt;">';

@ -29,9 +29,9 @@ 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[] = '<a href="index.php?view=drh_students">'.get_lang('Students').'</a>';
$menu_items[] = get_lang('Trainers');
$menu_items[] = '<a href="course.php">'.get_lang('Trainings').'</a>';
$menu_items[] = '<a href="course.php">'.get_lang('Courses').'</a>';
$menu_items[] = '<a href="session.php">'.get_lang('Sessions').'</a>';
echo '<div class="actions-title" style ="font-size:10pt;">';

@ -81,9 +81,9 @@ class BlockCourse extends Block {
$data_table = '<table class="data_table" width:"95%">';
$data_table .= '<tr>
<th>'.get_lang('CourseTitle').'</th>
<th width="10%">'.get_lang('NbStudents').'</th>
<th width="10%">'.get_lang('AvgTimeSpentInTheCourse').'</th>
<th width="10%">'.get_lang('ThematicAdvance').'</th>
<th width="20%">'.get_lang('NbStudents').'</th>
<th width="20%">'.get_lang('AvgTimeSpentInTheCourse').'</th>
<th width="20%">'.get_lang('ThematicAdvance').'</th>
</tr>';
$i = 1;
foreach ($course_data as $course) {

@ -90,12 +90,12 @@ class BlockStudent extends Block {
$students_table = '<table class="data_table" width:"95%">';
$students_table .= '
<tr>
<th width="10%" rowspan="2">'.get_lang('FirtName').'</th>
<th width="10%" rowspan="2">'.get_lang('FirstName').'</th>
<th width="10%" rowspan="2">'.get_lang('LastName').'</th>
<th width="30%" colspan="2">'.get_lang('TrainingInformations').'</th>
<th width="30%" colspan="2">'.get_lang('CourseInformation').'</th>
</tr>
<tr>
<th width="10%">'.get_lang('Training').'</th>
<th width="10%">'.get_lang('Courses').'</th>
<th width="10%">'.get_lang('Time').'</th>
</tr>
';
@ -109,18 +109,24 @@ class BlockStudent extends Block {
if ($i%2 == 0) $style = ' style="background-color:#F2F2F2" ';
else $style = ' style="background-color:#FFF" ';
$students_table .= '<tr '.$style.'>
<td rowspan="'.($count_courses+1).'">'.$student['firstname'].'</td>
<td rowspan="'.($count_courses+1).'">'.$student['lastname'].'</td>
<td rowspan="'.(count($students)).'">'.$student['firstname'].'</td>
<td rowspan="'.(count($students)).'">'.$student['lastname'].'</td>
</tr>';
// courses information about the student
foreach ($courses_by_user as $course) {
$course_code = $course['code'];
$course_title = $course['title'];
$time = api_time_to_hms(Tracking :: get_time_spent_on_the_course($student['user_id'], $course_code));
// courses information about the student
if (!empty($courses_by_user)) {
foreach ($courses_by_user as $course) {
$course_code = $course['code'];
$course_title = $course['title'];
$time = api_time_to_hms(Tracking :: get_time_spent_on_the_course($student['user_id'], $course_code));
$students_table .= '<tr '.$style.'>
<td align="right">'.$course_title.'</td>
<td align="right">'.$time.'</td>
</tr>';
}
} else {
$students_table .= '<tr '.$style.'>
<td>'.$course_title.'</td>
<td>'.$time.'</td>
<td align="center" colspan="2"><i>'.get_lang('Empty').'</i></td>
</tr>';
}
$i++;
@ -152,7 +158,7 @@ class BlockStudent extends Block {
$students_table = '<table class="data_table" width:"95%">';
$students_table .= '
<tr>
<th>'.get_lang('FirtName').'</th>
<th>'.get_lang('FirstName').'</th>
<th>'.get_lang('LastName').'</th>
<th>'.get_lang('AttendancesFaults').'</th>
<th>'.get_lang('Evaluations').'</th>

@ -89,7 +89,7 @@ class BlockTeacher extends Block {
$teachers_table = '<table class="data_table" width:"95%">';
$teachers_table .= '
<tr>
<th>'.get_lang('FirtName').'</th>
<th>'.get_lang('FirstName').'</th>
<th>'.get_lang('LastName').'</th>
<th>'.get_lang('TimeSpentOnThePlatform').'</th>
<th>'.get_lang('LastConnexion').'</th>
@ -112,8 +112,8 @@ class BlockTeacher extends Block {
<tr class="'.$class_tr.'">
<td>'.$firtname.'</td>
<td>'.$lastname.'</td>
<td>'.$time_on_platform.'</td>
<td>'.$last_connection.'</td>
<td align="right">'.$time_on_platform.'</td>
<td align="right">'.$last_connection.'</td>
</tr>
';
$i++;
@ -150,7 +150,7 @@ class BlockTeacher extends Block {
$teachers_table = '<table class="data_table" width:"95%">';
$teachers_table .= '
<tr>
<th>'.get_lang('FirtName').'</th>
<th>'.get_lang('FirstName').'</th>
<th>'.get_lang('LastName').'</th>
<th>'.get_lang('TimeSpentLastWeek').'<br />'.$last_week.'</th>
</tr>

Loading…
Cancel
Save