Tracking: Fix php errors

pull/3989/head
Julio 4 years ago
parent 8b01a0339d
commit af2c736674
  1. 32
      public/main/inc/lib/myspace.lib.php
  2. 12
      public/main/mySpace/admin_view.php
  3. 4
      public/main/mySpace/course.php
  4. 2
      public/main/template/default/my_space/accessoverview.html.twig
  5. 32
      public/main/template/default/my_space/index.html.twig

@ -55,23 +55,23 @@ class MySpace
],
[
'url' => api_get_path(WEB_CODE_PATH).'mySpace/survey_report.php',
'content' => get_lang('SurveysReport'),
'content' => get_lang('Surveys report'),
],
[
'url' => api_get_path(WEB_CODE_PATH).'mySpace/tc_report.php',
'content' => get_lang('TCReport'),
'content' => get_lang("Student's superior follow up"),
],
[
'url' => api_get_path(WEB_CODE_PATH).'mySpace/ti_report.php',
'content' => get_lang('TIReport'),
'content' => get_lang('General Coaches planning'),
],
[
'url' => api_get_path(WEB_CODE_PATH).'mySpace/question_stats_global.php',
'content' => get_lang('QuestionStats'),
'content' => get_lang('Question stats'),
],
[
'url' => api_get_path(WEB_CODE_PATH).'mySpace/question_stats_global_detail.php',
'content' => get_lang('QuestionStatsDetailedReport'),
'content' => get_lang('Detailed questions stats'),
],
];
@ -81,7 +81,7 @@ class MySpace
$actions[] =
[
'url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=company',
'content' => get_lang('UserByEntityReport'),
'content' => get_lang('User by organization'),
];
}
$field = new ExtraField('lp');
@ -90,7 +90,7 @@ class MySpace
$actions[] =
[
'url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=learningPath',
'content' => get_lang('LpByAuthor'),
'content' => get_lang('Learning path by author'),
];
}
$field = new ExtraField('lp_item');
@ -99,11 +99,11 @@ class MySpace
$actions[] =
[
'url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=learningPathByItem',
'content' => get_lang('LearningPathItemByAuthor'),
'content' => get_lang('LP item by author'),
];
}
return Display::actions($actions, null);
return Display::actions($actions);
}
/**
@ -318,7 +318,7 @@ class MySpace
$courseId = $course->getId();
$courseCode = $course->getCode();
$avg_score = Tracking::get_avg_student_score($userId, $courseCode);
$avg_score = Tracking::get_avg_student_score($userId, $course);
if (is_numeric($avg_score)) {
$avg_score = round($avg_score, 2);
} else {
@ -1761,7 +1761,7 @@ class MySpace
$nb_progress_lp += $progress_tmp[1];
$score_tmp = Tracking::get_avg_student_score(
$userId,
$courseCode,
$course,
[],
null,
true
@ -1954,7 +1954,6 @@ class MySpace
public static function session_tracking_filter($session_id, $url_params, $row)
{
$sessionId = $row[0];
$url = api_get_url_entity();
$session = api_get_session_entity($sessionId);
// the table header
$return = '<table
@ -2003,7 +2002,7 @@ class MySpace
);
$progress += $progress_tmp[0];
$nb_progress_lp += $progress_tmp[1];
$score_tmp = Tracking::get_avg_student_score($row_user->user_id, $courseCode, [], $session_id, true);
$score_tmp = Tracking::get_avg_student_score($row_user->user_id, $course, [], $session_id, true);
if (is_array($score_tmp)) {
$score += $score_tmp[0];
$nb_score_lp += $score_tmp[1];
@ -2135,7 +2134,7 @@ class MySpace
$csv_content[] = $csv_row;
// the other lines (the data)
foreach ($session_data as $key => $session) {
foreach ($session_data as $session) {
$session_id = $session[0];
$session_title = $session[1];
@ -2147,7 +2146,8 @@ class MySpace
$result = Database::query($sql);
while ($row = Database::fetch_object($result)) {
$courseId = $row->c_id;
$courseInfo = api_get_course_info_by_id($courseId);
$courseInfo = ['real_id' => $courseId];
$course = api_get_course_entity($courseId);
$csv_row = [];
$csv_row[] = $session_title;
$csv_row[] = $row->title;
@ -2183,7 +2183,7 @@ class MySpace
$nb_progress_lp += $progress_tmp[1];
$score_tmp = Tracking::get_avg_student_score(
$row_user->user_id,
$row->code,
$course,
[],
$session_id,
true

@ -109,24 +109,24 @@ switch ($display) {
break;
case 'accessoverview':
$courseId = isset($_GET['course_id']) ? (int) $_GET['course_id'] : 0;
if (0 == $courseId && $_POST['course_id']) {
if (0 == $courseId && isset($_POST['course_id']) && $_POST['course_id']) {
$courseId = (int) $_POST['course_id'];
$_GET['course_id'] = $courseId;
}
$sessionId = isset($_GET['session_id']) ? (int) $_GET['session_id'] : 0;
if (0 == $sessionId && $_POST['session_id']) {
if (0 == $sessionId && isset($_POST['session_id']) && $_POST['session_id']) {
$sessionId = (int) $_POST['session_id'];
$_GET['session_id'] = $sessionId;
}
$studentId = isset($_GET['student_id']) ? (int) $_GET['student_id'] : 0;
if (0 == $studentId && $_POST['student_id']) {
if (0 == $studentId && isset($_POST['student_id']) && $_POST['student_id']) {
$studentId = (int) $_POST['student_id'];
$_GET['student_id'] = $studentId;
}
$perPage = isset($_GET['tracking_access_overview_per_page']) ? $_GET['tracking_access_overview_per_page'] : 20;
$perPage = $_GET['tracking_access_overview_per_page'] ?? 20;
$dates = isset($_GET['date']) ? $_GET['date'] : null;
if (null == $dates && $_POST['date']) {
$dates = $_GET['date'] ?? null;
if (null == $dates && isset($_POST['date']) && $_POST['date']) {
$dates = $_POST['date'];
$_GET['date'] = $dates;
}

@ -105,12 +105,12 @@ if (api_is_platform_admin(true, true)) {
api_get_path(WEB_CODE_PATH).'mySpace/session.php'
);
$menu_items[] = Display::url(
get_lang('QuestionStats'),
get_lang('Question stats'),
api_get_path(WEB_CODE_PATH).'mySpace/question_stats_global.php'
);
$menu_items[] = Display::url(
get_lang('QuestionStatsDetailedReport'),
get_lang('Detailed questions stats'),
api_get_path(WEB_CODE_PATH).'mySpace/question_stats_global_detail.php'
);
if (api_can_login_as($user_id)) {

@ -1,5 +1,5 @@
{% autoescape false %}
<h2 class="page-header">{{ 'DisplayAccessOverview'|get_lang }}</h2>
<h2 class="page-header">{{ 'Accesses by user overview'|get_lang }}</h2>
{{ form }}
<h3 class="page-header">{{ 'Results'|get_lang }}</h3>
{{ table }}

@ -17,7 +17,7 @@
<div class="content">
<div class="card-title">
<a href="{{ url('legacy_main', {'name' : 'mySpace/student.php'}) }}">
{{ 'FollowedStudents' | trans }}
{{ 'Followed students' | trans }}
</a>
</div>
<div class="row">
@ -40,7 +40,7 @@
<div class="content">
<div class="card-title">
<a href="{{ url('legacy_main', {'name' : 'mySpace/users.php'}) }}?status={{ studentboss }}">
{{ 'FollowedStudentBosses' | trans }}
{{ 'Followed student bosses' | trans }}
</a>
</div>
<div class="row">
@ -51,7 +51,6 @@
</div>
<div class="col-xs-7">
<div class="numbers">
<h2>{{ studentbosses }}</h2>
</div>
</div>
@ -64,7 +63,7 @@
<div class="content">
<div class="card-title">
<a href="{{ url('legacy_main', {'name' : 'mySpace/teachers.php'}) }}">
{{ 'FollowedTeachers' | trans }}
{{ 'Followed teachers' | trans }}
</a>
</div>
<div class="row">
@ -88,7 +87,7 @@
<div class="content">
<div class="card-title">
<a href="{{ url('legacy_main', {'name' : 'mySpace/users.php'}) }}?status={{ drh }}">
{{ 'FollowedHumanResources' | trans }}
{{ 'Followed HR directors' | trans }}
</a>
</div>
<div class="row">
@ -119,7 +118,7 @@
</div>
<div class="easypiechart-link">
<a class="btn btn-default" href="{{ url('legacy_main', {'name' : 'mySpace/users.php'}) }}">
{{ 'FollowedUsers' | trans }}
{{ 'Followed users' | trans }}
</a>
</div>
</div>
@ -142,7 +141,7 @@
<a class="btn btn-default"
href="{{ url('legacy_main', {'name' : 'mySpace/course.php'}) }}"
>
{{ 'AssignedCourses' | trans }}
{{ 'Assigned courses' | trans }}
</a>
</div>
</div>
@ -163,7 +162,7 @@
<a class="btn btn-default"
href="{{ url('legacy_main', {'name' : 'mySpace/course.php?follow'}) }}"
>
{{ 'FollowedCourses' | trans }}
{{ 'Followed courses' | trans }}
</a>
</div>
</div>
@ -184,7 +183,7 @@
<a class="btn btn-default"
href="{{ url('legacy_main', {'name' : 'mySpace/session.php'}) }}"
>
{{ 'FollowedSessions' | trans }}
{{ 'Followed sessions' | trans }}
</a>
</div>
</div>
@ -217,7 +216,7 @@
</div>
</div>
</div>
<p>{{ 'AverageCoursePerStudent' | trans }}</p>
<p>{{ 'Average number of courses to which my learners are subscribed' | trans }}</p>
</div>
</div>
<div class="col-lg-3 col-sm-3">
@ -229,7 +228,7 @@
</div>
</div>
</div>
<p>{{ 'InactivesStudents' | trans }}</p>
<p>{{ 'Learners not connected for a week or more' | trans }}</p>
</div>
</div>
<div class="col-lg-3 col-sm-3">
@ -241,7 +240,7 @@
</div>
</div>
</div>
<p>{{ 'AverageTimeSpentOnThePlatform' | trans }}</p>
<p>{{ 'Time spent on portal' | trans }}</p>
</div>
</div>
<div class="col-lg-3 col-sm-3">
@ -253,7 +252,7 @@
</div>
</div>
</div>
<p>{{ 'AverageProgressInLearnpath' | trans }}</p>
<p>{{ 'Progress in courses' | trans }}</p>
</div>
</div>
<div class="col-lg-3 col-sm-3">
@ -266,7 +265,7 @@
</div>
</div>
<p>{{ 'AvgCourseScore' | trans }}</p>
<p>{{ 'Average score in learning paths' | trans }}</p>
</div>
</div>
<div class="col-lg-3 col-sm-3">
@ -279,7 +278,7 @@
</div>
</div>
<p> {{ 'AveragePostsInForum' | trans }}</p>
<p> {{ 'Posts in forum' | trans }}</p>
</div>
</div>
<div class="col-lg-3 col-sm-3">
@ -289,10 +288,9 @@
<div class="item-report-number">
{{ report.AverageAssignments }}
</div>
</div>
</div>
<p> {{ 'AverageAssignments' | trans }}</p>
<p> {{ 'Average assignments per learner' | trans }}</p>
</div>
</div>
</div>

Loading…
Cancel
Save