Add Classes to Reporting fields - refs BT#11073

1.10.x
Angel Fernando Quiroz Campos 9 years ago
parent 26639296e8
commit 06c15644a8
  1. 3
      main/inc/lib/tracking.lib.php
  2. 40
      main/inc/lib/usergroup.lib.php
  3. 4
      main/mySpace/myStudents.php
  4. 24
      main/tracking/courseLog.php

@ -6498,6 +6498,9 @@ class TrackingCourseLog
$user_row[]= $user['count_assignments'];
$user_row[]= $user['count_messages'];
$userGroupManager = new UserGroup();
$user_row[] = $userGroupManager->getLabelsFromNameList($user['user_id'], UserGroup::NORMAL_CLASS);
if (empty($session_id)) {
$user_row[]= $user['survey'];
}

@ -516,7 +516,7 @@ class UserGroup extends Model
* Get the group list for a user
* @param int $userId The user ID
* @param int $filterByType Optional. The type of group
* @return type
* @return array
*/
public function getUserGroupListByUser($userId, $filterByType = null)
{
@ -2356,5 +2356,43 @@ class UserGroup extends Model
$res = Database::query($sql);
return $res;
}
/**
* Filter the groups/classes info to get a name list only
* @param int $userId The user ID
* @param int $filterByType Optional. The type of group
* @return array
*/
public function getNameListByUser($userId, $filterByType = null)
{
$userClasses = $this->getUserGroupListByUser($userId, $filterByType);
return array_column($userClasses, 'name');
}
/**
* Get the HTML necessary for display the groups/classes name list
* @param int $userId The user ID
* @param int $filterByType Optional. The type of group
* @return string
*/
public function getLabelsFromNameList($userId, $filterByType = null)
{
$groupsNameListParsed = $this->getNameListByUser($userId, $filterByType);
if (empty($groupsNameListParsed)) {
return '';
}
$nameList = '<ul class="list-unstyled">';
foreach ($groupsNameListParsed as $name) {
$nameList .= '<li>' . Display::span($name, ['class' => 'label label-info']) . '</li>';
}
$nameList .= '</ul>';
return $nameList;
}
}

@ -463,7 +463,7 @@ if (!empty($student_id)) {
$userPicture = UserManager::getUserPicture($user_info['user_id']);
$userGroupManager = new UserGroup();
$userGroups = $userGroupManager->getUserGroupListByUser($user_info['user_id'], UserGroup::NORMAL_CLASS);
$userGroups = $userGroupManager->getNameListByUser($user_info['user_id'], UserGroup::NORMAL_CLASS);
?>
<img src="<?php echo $userPicture ?>">
<div class="row">
@ -592,7 +592,7 @@ if (!empty($student_id)) {
<tbody>
<?php foreach ($userGroups as $class) { ?>
<tr>
<td><?php echo $class['name'] ?></td>
<td><?php echo $class ?></td>
</tr>
<?php } ?>
</tbody>

@ -425,36 +425,38 @@ if (count($a_students) > 0) {
$headers['student_publication'] = get_lang('Student_publication');
$table->set_header(10, get_lang('Messages'), false);
$headers['messages'] = get_lang('Messages');
$table->set_header(11, get_lang('Classes'));
$headers['clasess'] = get_lang('Classes');
if (empty($session_id)) {
$table->set_header(11, get_lang('Survey'), false);
$table->set_header(12, get_lang('Survey'), false);
$headers['survey'] = get_lang('Survey');
$table->set_header(12, get_lang('FirstLoginInCourse'), false);
$table->set_header(13, get_lang('FirstLoginInCourse'), false);
$headers['first_login'] = get_lang('FirstLoginInCourse');
$table->set_header(13, get_lang('LatestLoginInCourse'), false);
$table->set_header(14, get_lang('LatestLoginInCourse'), false);
$headers['latest_login'] = get_lang('LatestLoginInCourse');
if (isset($_GET['additional_profile_field']) and is_numeric($_GET['additional_profile_field'])) {
$table->set_header(14, $extra_info['display_text'], false);
$table->set_header(15, $extra_info['display_text'], false);
$headers['display_text'] = $extra_info['display_text'];
$table->set_header(15, get_lang('Details'), false);
$table->set_header(16, get_lang('Details'), false);
$headers['details'] = get_lang('Details');
} else {
$table->set_header(14, get_lang('Details'), false);
$table->set_header(15, get_lang('Details'), false);
$headers['details'] = get_lang('Details');
}
} else {
$table->set_header(11, get_lang('FirstLoginInCourse'), false);
$table->set_header(12, get_lang('FirstLoginInCourse'), false);
$headers['first_login'] = get_lang('FirstLoginInCourse');
$table->set_header(12, get_lang('LatestLoginInCourse'), false);
$table->set_header(13, get_lang('LatestLoginInCourse'), false);
$headers['latest_login'] = get_lang('LatestLoginInCourse');
if (isset($_GET['additional_profile_field']) and is_numeric($_GET['additional_profile_field'])) {
$table->set_header(13, $extra_info['display_text'], false);
$table->set_header(14, $extra_info['display_text'], false);
$headers['display_text'] = $extra_info['display_text'];
$table->set_header(14, get_lang('Details'), false);
$table->set_header(15, get_lang('Details'), false);
$headers['Details'] = get_lang('Details');
} else {
$table->set_header(13, get_lang('Details'), false);
$table->set_header(14, get_lang('Details'), false);
$headers['Details'] = get_lang('Details');
}
}

Loading…
Cancel
Save