Merge pull request #395 from ilosada/7296

7296
1.9.x
Yannick Warnier 11 years ago
commit df6b3d242e
  1. 19
      main/inc/lib/course.lib.php
  2. 4
      main/inc/lib/main_api.lib.php
  3. 13
      main/inc/lib/tracking.lib.php
  4. 2
      main/lang/spanish/tracking.inc.php
  5. 4
      main/mySpace/course.php
  6. 24
      main/mySpace/index.php
  7. 2
      plugin/dashboard/block_course/block_course.class.php

@ -3162,12 +3162,17 @@ class CourseManager
/**
* get courses followed by user
* @param int $user_id
* @param int $from
* @param int $limit
* @param string $column
* @param string $direction
* @return array courses
* @param int $user_id
* @param int $status
* @param int $from
* @param int $limit
* @param string $column
* @param string $direction
* @param boolean $getCount
* @param string $keyword
* @param int $sessionId
* @param boolean $showAllAssignedCourses
* @return array courses
*/
public static function getCoursesFollowedByUser(
$user_id,
@ -3199,6 +3204,8 @@ class CourseManager
$whereConditions .= " AND cru.user_id = '$user_id'";
if (!$showAllAssignedCourses) {
$whereConditions .= " AND status = ".COURSEMANAGER;
} else {
$whereConditions .= " AND relation_type = ".COURSE_RELATION_TYPE_COURSE_MANAGER;
}
break;
case DRH:

@ -295,6 +295,10 @@ define('DRAWING_ASCIISVG', '{DRAWING_ASCIISVG}');
// Forcing PclZip library to use a custom temporary folder.
define('PCLZIP_TEMPORARY_DIR', api_get_path(SYS_ARCHIVE_PATH));
// Relations type with Course manager
define('COURSE_RELATION_TYPE_COURSE_MANAGER', 1);
define('SESSION_RELATION_TYPE_COURSE_MANAGER', 1);
// Relations type with Human resources manager
define('COURSE_RELATION_TYPE_RRHH', 1);
define('SESSION_RELATION_TYPE_RRHH', 1);

@ -19,6 +19,7 @@ class Tracking
*/
public static function getStats($userId)
{
$assignedCourses = array();
if (api_is_drh() && api_drh_can_access_all_session_content()) {
$studentList = SessionManager::getAllUsersFromCoursesFromAllSessionFromStatus(
'drh_all',
@ -168,6 +169,15 @@ class Tracking
null,
true
);
foreach ($platformCourses as $course) {
$assignedCourses[$course['code']] = $course['code'];
}
$platformCourses = CourseManager::getCoursesFollowedByUser(
$userId,
COURSEMANAGER
);
foreach ($platformCourses as $course) {
$courses[$course['code']] = $course['code'];
}
@ -183,7 +193,8 @@ class Tracking
'teachers' => $teachers,
'students' => $students,
'courses' => $courses,
'sessions' => $sessions
'sessions' => $sessions,
'assignedCourses' => $assignedCourses
);
}

@ -297,7 +297,7 @@ $DashboardBlocks = "Bloques del panel de control";
$DashboardList = "Lista del panel de control";
$YouHaveNotEnabledBlocks = "No ha habilitado ningún bloque";
$BlocksHaveBeenUpdatedSuccessfully = "Los bloques han sido actualizados";
$AttendanceSheetDescription = "Las listas de asistencia permiten registrar las faltas de asistencia de los estudiantes. En caso de ausencia de un estudiante, el profesor deberá registrarlo manualmente en la casilla correspondiente.
$AttendanceSheetDescription = "Las listas de asistencia permiten registrar las faltas de asistencia de los estudiantes. En caso de ausencia de un estudiante, el profesor deberá registrarlo manualmente en la casilla correspondiente.
Es posible crear más de una lista de asistencia por cada curso; así por ejemplo, podrá registrar separadamente la asistencia a las clases teóricas y prácticas.";
$AttendanceSheetReport = "Informe de hojas de asistencia";
$YouDoNotHaveDoneAttendances = "No tiene asistencias";

@ -197,6 +197,7 @@ function get_courses($from, $limit, $column, $direction)
$userId = api_get_user_id();
$sessionId = isset($_GET['session_id']) ? intval($_GET['session_id']) : 0;
$keyword = isset($_GET['keyword']) ? $_GET['keyword'] : null;
$follow = isset($_GET['follow']) ? true : false;
$drhLoaded = false;
if (api_is_drh()) {
if (api_drh_can_access_all_session_content()) {
@ -224,7 +225,8 @@ function get_courses($from, $limit, $column, $direction)
$direction,
false,
$keyword,
$sessionId
$sessionId,
$follow
);
}

@ -160,6 +160,7 @@ $stats = Tracking::getStats($userId);
$students = $stats['students'];
$teachers = $stats['teachers'];
$humanResourcesUsers = $stats['drh'];
$assignedCourses = $stats['assignedCourses'];
$courses = $stats['courses'];
$sessions = $stats['sessions'];
@ -171,6 +172,7 @@ if (!empty($sessions)) {
}
// Courses for the user
$countAssignedCourses = count($assignedCourses);
$count_courses = count($courses);
// Sessions for the user
@ -219,6 +221,7 @@ $nb_posts = $posts;
$avg_time_spent = $totalTimeSpent;
$linkAddUser = null;
$linkCourseDetailsAsTeacher = null;
$linkAddCourse = null;
$linkAddSession = null;
@ -228,9 +231,14 @@ if (api_is_platform_admin()) {
api_get_path(WEB_CODE_PATH).'admin/dashboard_add_users_to_user.php?user='.api_get_user_id(),
array('class' => '')
);
$linkCourseDetailsAsTeacher = ' '.Display::url(
Display::return_icon('2rightarrow.gif', get_lang('Details')),
api_get_path(WEB_CODE_PATH).'mySpace/course.php',
array('class' => '')
);
$linkAddCourse = ' '.Display::url(
Display::return_icon('add.png', get_lang('Add')),
api_get_path(WEB_CODE_PATH).'admin/dashboard_add_courses_to_user.php?user='.api_get_user_id(),
Display::return_icon('2rightarrow.gif', get_lang('Details')),
api_get_path(WEB_CODE_PATH).'mySpace/course.php?follow',
array('class' => '')
);
$linkAddSession = ' '.Display::url(
@ -276,11 +284,19 @@ echo '<div class="report_section">
</tr>
<tr>
<td>'.Display::url(
get_lang('FollowedCourses'),
get_lang('AssignedCourses'),
api_get_path(WEB_CODE_PATH).'mySpace/course.php'
).
'</td>
<td align="right">'.$count_courses.$linkAddCourse.'</td>
<td align="right">'.$count_courses.$linkCourseDetailsAsTeacher.'</td>
</tr>
<tr>
<td>'.Display::url(
get_lang('FollowedCourses'),
api_get_path(WEB_CODE_PATH).'mySpace/course.php?follow'
).
'</td>
<td align="right">'.$countAssignedCourses.$linkAddCourse.'</td>
</tr>
<tr>
<td>'.Display::url(

@ -130,7 +130,7 @@ class BlockCourse extends Block
}
$content .= $data_table;
if (!empty($course_data)) {
$content .= '<div style="text-align:right;margin-top:10px;"><a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/course.php">' . get_lang('SeeMore') . '</a></div>';
$content .= '<div style="text-align:right;margin-top:10px;"><a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/course.php?follow">' . get_lang('SeeMore') . '</a></div>';
}
$content .= '</div>';

Loading…
Cancel
Save