WIP: Improve left navigation bar see #2215

- Left menu code centralized in one function.
- New language translation added "EventsReport"
- @todo missing icon.
pull/2487/head
jmontoyaa 7 years ago
parent c60cbcdaa9
commit 7518a6ba49
  1. 111
      main/inc/lib/tracking.lib.php
  2. 36
      main/tracking/courseLog.php
  3. 15
      main/tracking/course_log_events.php
  4. 14
      main/tracking/course_log_groups.php
  5. 17
      main/tracking/course_log_resources.php
  6. 30
      main/tracking/course_log_tools.php
  7. 29
      main/tracking/exams.php
  8. 3
      main/tracking/total_time.php

@ -7566,4 +7566,115 @@ class TrackingCourseLog
return $users;
}
/**
* @param string $current
*/
public static function actionsLeft($current, $sessionId = 0)
{
$usersLink = Display::url(
Display::return_icon('user.png', get_lang('StudentsTracking'), array(), ICON_SIZE_MEDIUM),
'courseLog.php?'.api_get_cidreq(true, false)
);
$groupsLink = Display::url(
Display::return_icon('group.png', get_lang('GroupReporting'), array(), ICON_SIZE_MEDIUM),
'course_log_groups.php?'.api_get_cidreq()
);
$resourcesLink = Display::url(
Display::return_icon('tools.png', get_lang('ResourcesTracking'), array(), ICON_SIZE_MEDIUM),
'course_log_resources.php?'.api_get_cidreq(true, false)
);
$courseLink = Display::url(
Display::return_icon('course.png', get_lang('CourseTracking'), array(), ICON_SIZE_MEDIUM),
'course_log_tools.php?'.api_get_cidreq(true, false)
);
$examLink = Display::url(
Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH).'tracking/exams.php?'.api_get_cidreq()
);
$eventsLink = Display::url(
Display::return_icon('changeme.png', get_lang('EventsReport'), array(), ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH).'tracking/course_log_events.php?'.api_get_cidreq()
);
$attendanceLink = '';
if (!empty($sessionId)) {
$attendanceLink = Display::url(
Display::return_icon('attendance_list.png', get_lang('Logins'), '', ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH).'attendance/index.php?'.api_get_cidreq().'&action=calendar_logins'
);
}
switch ($current) {
case 'users':
$usersLink = Display::url(
Display::return_icon(
'user_na.png',
get_lang('StudentsTracking'),
array(),
ICON_SIZE_MEDIUM
),
'#'
);
break;
case 'groups':
$groupsLink = Display::url(
Display::return_icon('group_na.png', get_lang('GroupReporting'), array(), ICON_SIZE_MEDIUM),
'#'
);
break;
case 'courses':
$courseLink = Display::url(
Display::return_icon('course_na.png', get_lang('CourseTracking'), array(), ICON_SIZE_MEDIUM),
'#'
);
break;
case 'resources':
$resourcesLink = Display::url(
Display::return_icon(
'tools_na.png',
get_lang('ResourcesTracking'),
array(),
ICON_SIZE_MEDIUM
), '#'
);
break;
case 'exams':
$examLink = Display::url(
Display::return_icon('quiz_na.png', get_lang('ExamTracking'), array(), ICON_SIZE_MEDIUM),
'#'
);
break;
case 'logs':
$eventsLink = Display::url(
Display::return_icon('changeme_na.png', get_lang('EventsReport'), array(), ICON_SIZE_MEDIUM),
'#'
);
break;
case 'attendance':
if (!empty($sessionId)) {
$attendanceLink = Display::url(
Display::return_icon('attendance_list.png', get_lang('Logins'), '', ICON_SIZE_MEDIUM),
'#'
);
}
break;
}
$items = [
$usersLink,
$groupsLink,
$courseLink,
$resourcesLink,
$examLink,
$eventsLink,
$attendanceLink
];
return implode('', $items).' ';
}
}

@ -7,9 +7,6 @@ use ChamiloSession as Session;
* @package chamilo.tracking
*/
$pathopen = isset($_REQUEST['pathopen']) ? $_REQUEST['pathopen'] : null;
// Including the global initialization file
require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_TRACKING;
@ -219,36 +216,7 @@ Display::display_header($nameTools, 'Tracking');
/* MAIN CODE */
$actionsLeft = Display::return_icon(
'user_na.png',
get_lang('StudentsTracking'),
array(),
ICON_SIZE_MEDIUM
);
$actionsLeft .= Display::url(
Display::return_icon('group.png', get_lang('GroupReporting'), array(), ICON_SIZE_MEDIUM),
'course_log_groups.php?'.api_get_cidreq()
);
$actionsLeft .= Display::url(
Display::return_icon('course.png', get_lang('CourseTracking'), array(), ICON_SIZE_MEDIUM),
'course_log_tools.php?'.api_get_cidreq()
);
$actionsLeft .= Display::url(
Display::return_icon('tools.png', get_lang('ResourcesTracking'), array(), ICON_SIZE_MEDIUM),
'course_log_resources.php?'.api_get_cidreq()
);
$actionsLeft .= Display::url(
Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH).'tracking/exams.php?'.api_get_cidreq()
);
if (!empty($sessionId)) {
$actionsLeft .= Display::url(
Display::return_icon('attendance_list.png', get_lang('Logins'), '', ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH).'attendance/index.php?'.api_get_cidreq().'&action=calendar_logins'
);
}
$actionsLeft = TrackingCourseLog::actionsLeft('users', $sessionId);
$actionsRight = '<div class="pull-right">';
$actionsRight .= '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
@ -309,6 +277,7 @@ if ($session_id) {
ICON_SIZE_SMALL
).' '.$courseInfo['name'];
}
$teacherList = CourseManager::getTeacherListFromCourseCodeToString(
$courseInfo['code'],
',',
@ -542,6 +511,7 @@ if (count($a_students) > 0) {
}
echo Display::panel($html, $titleSession);
// Send the csv file if asked.
if ($export_csv) {
$csv_headers = [];

@ -128,19 +128,8 @@ $(function() {
Display::display_header();
echo '<div class="actions">';
echo Display::url(
Display::return_icon('user.png', get_lang('StudentsTracking'), array(), ICON_SIZE_MEDIUM),
'courseLog.php?'.api_get_cidreq(true, false)
);
echo Display::url(Display::return_icon('group.png', get_lang('GroupReporting'), array(), ICON_SIZE_MEDIUM), '#');
echo Display::url(
Display::return_icon('course.png', get_lang('CourseTracking'), array(), ICON_SIZE_MEDIUM),
'course_log_tools.php?'.api_get_cidreq(true, false)
);
echo Display::url(
Display::return_icon('tools.png', get_lang('ResourcesTracking'), array(), ICON_SIZE_MEDIUM),
'course_log_resources.php?'.api_get_cidreq(true, false)
);
echo TrackingCourseLog::actionsLeft('logs', api_get_session_id());
echo '</div>';
$form = new FormValidator(

@ -125,19 +125,7 @@ $(function() {
Display::display_header();
echo '<div class="actions">';
echo Display::url(
Display::return_icon('user.png', get_lang('StudentsTracking'), array(), ICON_SIZE_MEDIUM),
'courseLog.php?'.api_get_cidreq(true, false)
);
echo Display::url(Display::return_icon('group_na.png', get_lang('GroupReporting'), array(), ICON_SIZE_MEDIUM), '#');
echo Display::url(
Display::return_icon('course.png', get_lang('CourseTracking'), array(), ICON_SIZE_MEDIUM),
'course_log_tools.php?'.api_get_cidreq(true, false)
);
echo Display::url(
Display::return_icon('tools.png', get_lang('ResourcesTracking'), array(), ICON_SIZE_MEDIUM),
'course_log_resources.php?'.api_get_cidreq(true, false)
);
echo TrackingCourseLog::actionsLeft('groups', $sessionId);
echo '</div>';
echo Display::grid_html('group_users');

@ -99,22 +99,7 @@ $nameTools = get_lang('Tracking');
Display::display_header($nameTools, 'Tracking');
echo '<div class="actions">';
echo Display::url(
Display::return_icon('user.png', get_lang('StudentsTracking'), array(), ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH).'tracking/courseLog.php?'.api_get_cidreq()
);
echo Display::url(
Display::return_icon('group.png', get_lang('GroupReporting'), array(), ICON_SIZE_MEDIUM),
'course_log_groups.php?'.api_get_cidreq(true, false)
);
echo Display::url(
Display::return_icon('course.png', get_lang('CourseTracking'), array(), ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH).'tracking/course_log_tools.php?'.api_get_cidreq()
);
echo Display::return_icon('tools_na.png', get_lang('ResourcesTracking'), array(), ICON_SIZE_MEDIUM);
echo TrackingCourseLog::actionsLeft('resources', api_get_session_id());
echo '<span style="float:right; padding-top:0px;">';
echo '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).

@ -105,35 +105,7 @@ $studentCount = count($student_ids);
echo '<div class="actions">';
echo Display::url(
Display::return_icon('user.png', get_lang('StudentsTracking'), array(), ICON_SIZE_MEDIUM),
'courseLog.php?'.api_get_cidreq()
);
if (empty($groupId)) {
echo Display::url(
Display::return_icon('group.png', get_lang('GroupReporting'), array(), ICON_SIZE_MEDIUM),
'course_log_groups.php?'.api_get_cidreq()
);
echo Display::url(
Display::return_icon('course_na.png', get_lang('CourseTracking'), array(), ICON_SIZE_MEDIUM),
'#'
);
} else {
echo Display::url(
Display::return_icon('group_na.png', get_lang('GroupReporting'), array(), ICON_SIZE_MEDIUM),
'#'
);
echo Display::url(
Display::return_icon('course.png', get_lang('CourseTracking'), array(), ICON_SIZE_MEDIUM),
'course_log_tools.php?'.api_get_cidreq(true, false).'&gidReq=0'
);
}
echo Display::url(
Display::return_icon('tools.png', get_lang('ResourcesTracking'), array(), ICON_SIZE_MEDIUM),
'course_log_resources.php?'.api_get_cidreq()
);
echo TrackingCourseLog::actionsLeft('courses', api_get_session_id());
echo '<span style="float:right; padding-top:0px;">';
echo '<a href="javascript: void(0);" onclick="javascript: window.print();">'.

@ -116,18 +116,8 @@ if (!$exportToXLS) {
}
}
} else {
$actionsLeft .= Display::url(
Display::return_icon('user.png', get_lang('StudentsTracking'), array(), 32),
'courseLog.php?'.api_get_cidreq().'&studentlist=true'
);
$actionsLeft .= Display::url(
Display::return_icon('course.png', get_lang('CourseTracking'), array(), 32),
'courseLog.php?'.api_get_cidreq().'&studentlist=false'
);
$actionsLeft .= Display::url(
Display::return_icon('tools.png', get_lang('ResourcesTracking'), array(), 32),
'courseLog.php?'.api_get_cidreq().'&studentlist=resouces'
);
$actionsLeft = TrackingCourseLog::actionsLeft('exams', api_get_session_id());
$actionsLeft .= Display::url(
Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), array(), 32),
api_get_self().'?'.api_get_cidreq().'&export=1&score='.$filter_score.'&exercise_id='.$exerciseId
@ -290,10 +280,12 @@ if (!empty($courseList) && is_array($courseList)) {
);
$html .= $result['html'];
$export_array_global = array_merge(
$export_array_global,
$result['export_array_global']
);
if (is_array($result['export_array_global'])) {
$export_array_global = array_merge(
$export_array_global,
$result['export_array_global']
);
}
} else {
$result = processStudentList(
$filter_score,
@ -542,8 +534,9 @@ function processStudentList($filter_score, $global, $exercise, $courseInfo, $ses
$total_with_parameter_score = 0;
$taken = 0;
$export_array_global = array();
$studentResult = array();
$export_array_global = [];
$studentResult = [];
$export_array = [];
foreach ($students as $student) {
$studentId = isset($student['user_id']) ? $student['user_id'] : $student['id_user'];

@ -7,9 +7,6 @@ use ChamiloSession as Session;
* @package chamilo.tracking
*/
$pathopen = isset($_REQUEST['pathopen']) ? $_REQUEST['pathopen'] : null;
// Including the global initialization file
require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_TRACKING;

Loading…
Cancel
Save