Fix PHP errors

pull/3890/head
Julio Montoya 5 years ago
parent 2d4f800f02
commit 1d6bd0b198
  1. 3
      public/main/exercise/tests_category.php
  2. 3
      public/main/inc/lib/groupmanager.lib.php
  3. 8
      public/main/inc/lib/sortable_table.class.php
  4. 23
      public/main/inc/lib/tracking.lib.php
  5. 28
      public/main/mySpace/myStudents.php
  6. 2
      public/main/session/resume_session.php
  7. 4
      public/main/tracking/courseLog.php
  8. 9
      public/main/tracking/course_log_groups.php
  9. 14
      public/main/tracking/course_log_tools.php
  10. 5
      public/main/tracking/lp_report.php

@ -270,6 +270,5 @@ function displayActionBar()
);
echo Display::toolbarAction('toolbar', [$actions]);
echo '<fieldset><legend>'.get_lang('Questions category').'</legend></fieldset>';
echo Display::page_header(get_lang('Questions category'));
}

@ -102,8 +102,9 @@ class GroupManager
* @param int $sessionId
* @param bool $getCount
* @param bool $notInGroup Get groups not in a category
* @param bool $returnEntityList
*
* @return array an array with all information about the groups
* @return array|CGroup[] an array with all information about the groups
*/
public static function get_group_list(
$categoryId = null,

@ -144,8 +144,8 @@ class SortableTable extends HTML_Table
if (empty($attributes)) {
$attributes = [];
//$attributes['class'] = 'table table-hover table-striped table-bordered data_table';
$attributes['class'] = 'q-table';
$attributes['class'] = 'table table-hover table-striped table-bordered data_table';
//$attributes['class'] = 'q-table';
$attributes['id'] = $table_id;
}
@ -425,8 +425,8 @@ class SortableTable extends HTML_Table
}
//$html .= '<div class="table-responsive">'.$content.'</div>';
$html .= '<div class="q-table__container q-table--horizontal-separator column no-wrap q-table__card q-table--no-wrap">'.
$content.'</div>';
$html .= '<div class="">';
$html .= $content.'</div>';
if (!empty($this->additional_parameters)) {
foreach ($this->additional_parameters as $key => $value) {

@ -56,18 +56,17 @@ class Tracking
return null;
}
$course = api_get_course_entity($courseId);
$courseCode = $course->getCode();
$session = api_get_session_entity($sessionId);
if ('count' === $type) {
return GroupManager::get_group_list(null, $course, null, $sessionId, true);
}
$groupList = GroupManager::get_group_list(null, $course, null, $sessionId);
$groupList = GroupManager::get_group_list(null, $course, null, $sessionId, false, null, true);
$parsedResult = [];
if (!empty($groupList)) {
foreach ($groupList as $group) {
$users = GroupManager::get_users($group['iid'], true, null, null, false, $courseId);
$users = GroupManager::get_users($group->getIid(), true, null, null, false, $courseId);
$time = 0;
$avg_student_score = 0;
$avg_student_progress = 0;
@ -108,8 +107,8 @@ class Tracking
$averageScore = empty($countUsers) ? 0 : round($avg_student_score / $countUsers, 2);
$groupItem = [
'id' => $group['id'],
'name' => $group['name'],
'id' => $group->getIid(),
'name' => $group->getName(),
'time' => api_time_to_hms($time),
'progress' => $averageProgress,
'score' => $averageScore,
@ -3179,7 +3178,7 @@ class Tracking
if (!empty($course_code)) {
$course = api_get_course_info($course_code);
$courseId = $course['real_id'];
$conditions[] = " lp.c_id = $courseId";
//$conditions[] = " lp.c_id = $courseId";
}
// Get course tables names
@ -3213,13 +3212,12 @@ class Tracking
SUM(lp_i.max_score) sum_max_score
FROM $lp_table as lp
INNER JOIN $lp_item_table as lp_i
ON lp.iid = lp_id AND lp.c_id = lp_i.c_id
ON lp.iid = lp_i.lp_id
INNER JOIN $lp_view_table as lp_view
ON lp_view.lp_id = lp_i.lp_id AND lp_view.c_id = lp_i.c_id
ON lp_view.lp_id = lp_i.lp_id
INNER JOIN $lp_item_view_table as lp_iv
ON
lp_i.iid = lp_iv.lp_item_id AND
lp_view.c_id = lp_iv.c_id AND
lp_iv.lp_view_id = lp_view.iid
WHERE (lp_i.item_type='sco' OR lp_i.item_type='".TOOL_QUIZ."') AND
$conditionsToString
@ -3495,7 +3493,7 @@ class Tracking
// Check the real number of LPs corresponding to the filter in the
// database (and if no list was given, get them all)
$sql = "SELECT iid FROM $lp_table
WHERE c_id = $courseId AND iid = $lp_id ";
WHERE iid = $lp_id ";
$row = Database::query($sql);
$count = Database::num_rows($row);
@ -3504,10 +3502,9 @@ class Tracking
$sql = 'SELECT MIN(start_time)
FROM '.$t_lpiv.' AS item_view
INNER JOIN '.$t_lpv.' AS view
ON (item_view.lp_view_id = view.iid AND item_view.c_id = view.c_id)
ON (item_view.lp_view_id = view.iid)
WHERE
status != "not attempted" AND
item_view.c_id = '.$courseId.' AND
view.c_id = '.$courseId.' AND
view.lp_id = '.$lp_id.' AND
view.user_id = '.$student_id.' AND
@ -8911,6 +8908,6 @@ class TrackingCourseLog
$attendanceLink,
];
return implode('', $items).'&nbsp;';
return Display::toolbarAction('tracking', $items);
}
}

@ -678,20 +678,19 @@ Display::display_header($nameTools);
$token = Security::get_token();
// Actions bar
echo '<div class="actions">';
echo '<a href="javascript: window.history.go(-1);">'
$actions = '<a href="javascript: window.history.go(-1);">'
.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="javascript: void(0);" onclick="javascript: window.print();">'
$actions .= '<a href="javascript: void(0);" onclick="javascript: window.print();">'
.Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="'.api_get_self().'?'.Security::remove_XSS($_SERVER['QUERY_STRING']).'&export=csv">'
$actions .= '<a href="'.api_get_self().'?'.Security::remove_XSS($_SERVER['QUERY_STRING']).'&export=csv">'
.Display::return_icon('export_csv.png', get_lang('CSV export'), '', ICON_SIZE_MEDIUM).'</a> ';
echo '<a href="'.api_get_self().'?'.Security::remove_XSS($_SERVER['QUERY_STRING']).'&export=xls">'
$actions .= '<a href="'.api_get_self().'?'.Security::remove_XSS($_SERVER['QUERY_STRING']).'&export=xls">'
.Display::return_icon('export_excel.png', get_lang('Excel export'), '', ICON_SIZE_MEDIUM).'</a> ';
echo Display::url(
$actions .= Display::url(
Display::return_icon('attendance.png', get_lang('Access details'), '', ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH).'mySpace/access_details_session.php?user_id='.$studentId
);
@ -702,10 +701,10 @@ if (!empty($email)) {
} else {
$send_mail = Display::return_icon('mail_send_na.png', get_lang('Send message mail'), '', ICON_SIZE_MEDIUM);
}
echo $send_mail;
$actions .= $send_mail;
if (!empty($studentId) && !empty($courseCode)) {
// Only show link to connection details if course and student were defined in the URL
echo '<a href="access_details.php?student='.$studentId.'&course='.$courseCode.'&origin='.$origin.'&cid='
$actions .= '<a href="access_details.php?student='.$studentId.'&course='.$courseCode.'&origin='.$origin.'&cid='
.$courseId.'&id_session='.$sessionId.'">'
.Display::return_icon('statistics.png', get_lang('Access details'), '', ICON_SIZE_MEDIUM)
.'</a>';
@ -715,19 +714,19 @@ $notebookTeacherEnable = 'true' === api_get_plugin_setting('notebookteacher', 'e
if ($notebookTeacherEnable && !empty($studentId) && !empty($courseCode)) {
// link notebookteacher
$optionsLink = 'student_id='.$studentId.'&origin='.$origin.'&cid='.$courseId.'&id_session='.$sessionId;
echo '<a href="'.api_get_path(WEB_PLUGIN_PATH).'notebookteacher/src/index.php?'.$optionsLink.'">'
$actions .= '<a href="'.api_get_path(WEB_PLUGIN_PATH).'notebookteacher/src/index.php?'.$optionsLink.'">'
.Display::return_icon('notebookteacher.png', get_lang('Notebook'), '', ICON_SIZE_MEDIUM)
.'</a>';
}
if (api_can_login_as($studentId)) {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_list.php?action=login_as&user_id='.$studentId
$actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_list.php?action=login_as&user_id='.$studentId
.'&sec_token='.$token.'">'
.Display::return_icon('login_as.png', get_lang('Login as'), null, ICON_SIZE_MEDIUM).'</a>&nbsp;&nbsp;';
}
if (Skill::isAllowed($studentId, false)) {
echo Display::url(
$actions .= Display::url(
Display::return_icon(
'skill-badges.png',
get_lang('Assign skill'),
@ -739,7 +738,7 @@ if (Skill::isAllowed($studentId, false)) {
}
if (Skill::isAllowed($studentId, false)) {
echo Display::url(
$actions .= Display::url(
Display::return_icon(
'attendance.png',
get_lang('CountDoneAttendance'),
@ -757,7 +756,7 @@ $permissions = StudentFollowUpPlugin::getPermissions(
$isAllow = $permissions['is_allow'];
if ($isAllow) {
echo Display::url(
$actions .= Display::url(
Display::return_icon(
'blog.png',
get_lang('Blog'),
@ -767,7 +766,8 @@ if ($isAllow) {
api_get_path(WEB_PLUGIN_PATH).'studentfollowup/posts.php?student_id='.$studentId
);
}
echo '</div>';
echo Display::toolbarAction('my_students', [$actions]);
// is the user online ?
$online = get_lang('No');

@ -193,7 +193,7 @@ if (0 === $session->getNbrCourses()) {
);
}
$courseUrl = api_get_course_url($courseCode, $sessionId);
$courseUrl = api_get_course_url($courseId, $sessionId);
// hide_course_breadcrumb the parameter has been added to hide the name
// of the course, that appeared in the default $interbreadcrumb

@ -198,8 +198,7 @@ Display::display_header($nameTools, 'Tracking');
$actionsLeft = TrackingCourseLog::actionsLeft('users', $sessionId);
$actionsRight = '<div class="pull-right">';
$actionsRight .= '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
$actionsRight = '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
$additionalParams = '';
@ -217,7 +216,6 @@ if (isset($_GET['users_tracking_per_page'])) {
$actionsRight .= '<a
href="'.api_get_self().'?'.api_get_cidreq().'&export=csv&'.$additionalParams.$users_tracking_per_page.'">
'.Display::return_icon('export_csv.png', get_lang('CSV export'), '', ICON_SIZE_MEDIUM).'</a>';
$actionsRight .= '</div>';
// Create a search-box.
$form_search = new FormValidator(
'search_simple',

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
require_once __DIR__.'/../inc/global.inc.php';
@ -11,7 +12,7 @@ $course_code = api_get_course_id();
$sessionId = api_get_session_id();
$this_section = SECTION_COURSES;
if ('myspace' == $from) {
if ('myspace' === $from) {
$from_myspace = true;
$this_section = "session_my_space";
}
@ -91,9 +92,7 @@ $column_model = [
],
];
// Autowidth
$extra_params['autowidth'] = 'true';
// height auto
$extra_params['height'] = 'auto';
$action_links = '
@ -121,11 +120,7 @@ $(function() {
</script>';
Display::display_header();
echo '<div class="actions">';
echo TrackingCourseLog::actionsLeft('groups', $sessionId);
echo '</div>';
echo Display::grid_html('group_users');
Display::display_footer();

@ -100,19 +100,15 @@ $nbStudents = count($a_students);
$student_ids = array_keys($a_students);
$studentCount = count($student_ids);
/* MAIN CODE */
echo '<div class="actions">';
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();">'.
Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&id_session='.api_get_session_id().'&export=csv">
'.Display::return_icon('export_csv.png', get_lang('CSV export'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</span>';
echo '</div>';
$course_code = api_get_course_id();
$course_id = api_get_course_int_id();
@ -132,7 +128,7 @@ if ($lpReporting) {
);
echo '<table class="data_table">';
if ($export_csv) {
$temp = [get_lang('Progress in courses', ''), ''];
$temp = [get_lang('Progress in courses'), ''];
$csv_content[] = ['', ''];
$csv_content[] = $temp;
}
@ -143,9 +139,9 @@ if ($lpReporting) {
// get the progress in learning pathes
$lp_avg_progress += Tracking::get_avg_student_progress(
$student_id,
$course_code,
$course,
[$lp_id],
$session_id
$session
);
}
@ -169,7 +165,7 @@ if ($lpReporting) {
echo '</table></div>';
} else {
if ($export_csv) {
$temp = [get_lang('NoLearningPath', ''), ''];
$temp = [get_lang('NoLearningPath'), ''];
$csv_content[] = $temp;
}
}

@ -273,6 +273,7 @@ function getData($from, $numberOfItems, $column, $direction, $params)
$courseCode = api_get_course_id();
$courseId = api_get_course_int_id();
$course = api_get_course_entity();
$session = api_get_session_entity();
/** @var CLp[] $lps */
$lps = $params['lps'];
@ -327,7 +328,7 @@ function getData($from, $numberOfItems, $column, $direction, $params)
$userId,
$course,
[$lpId],
$sessionId
$session
);
if ($useNewTable) {
@ -444,7 +445,7 @@ $table->setDataFunctionParams(['lps' => $lps]);
$table->set_additional_parameters($parameters);
$column = 0;
foreach ($headers as $header) {
$lpName = $lp['name'];
$lpName = $lp->getName();
$table->set_header($column++, $header, false);
}

Loading…
Cancel
Save