Skip to content

Commit

Permalink
Improve headers in tracking page - refs BT#18671
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFQC committed Apr 28, 2021
1 parent a3fba7f commit 0a4e75d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 22 deletions.
4 changes: 2 additions & 2 deletions main/inc/lib/display.lib.php
Expand Up @@ -1886,9 +1886,9 @@ public static function page_subheader($title, $second_title = null, $size = 'h3'
$second_title = Security::remove_XSS($second_title);
$title .= "<small> $second_title<small>";
}
$subTitle = self::tag($size, Security::remove_XSS($title), $attributes);
$attributes['class'] = 'page-header';

return $subTitle;
return self::tag($size, Security::remove_XSS($title), $attributes);
}

public static function page_subheader2($title, $second_title = null)
Expand Down
13 changes: 6 additions & 7 deletions main/inc/lib/skill.lib.php
Expand Up @@ -257,7 +257,7 @@ public function getSkillParents($skillId, $add_child_info = true)
public function getDirectParents($skillId)
{
$skillId = (int) $skillId;
$sql = 'SELECT parent_id as skill_id
$sql = 'SELECT parent_id as skill_id
FROM '.$this->table.'
WHERE skill_id = '.$skillId;
$result = Database::query($sql);
Expand Down Expand Up @@ -1458,9 +1458,8 @@ public function getUserSkillsTable($userId, $courseId = 0, $sessionId = 0, $addT
}

if ($addTitle) {
$tableResult .= '<h3 class="section-title">'.get_lang('AchievedSkills').'</h3>
<div class="skills-badges">
';
$tableResult .= Display::page_subheader2(get_lang('AchievedSkills'));
$tableResult .= '<div class="skills-badges">';
}

if (!empty($skillParents)) {
Expand Down Expand Up @@ -1823,7 +1822,7 @@ public function getSkillToJson($subtree, $depth = 1, $max_depth = 2)
public function getUserSkillRanking($user_id)
{
$user_id = (int) $user_id;
$sql = "SELECT count(skill_id) count
$sql = "SELECT count(skill_id) count
FROM {$this->table} s
INNER JOIN {$this->table_skill_rel_user} su
ON (s.id = su.skill_id)
Expand Down Expand Up @@ -2569,8 +2568,8 @@ public static function addSkillsToUserForm(FormValidator $form, $typeId, $itemId
success: function(result) {
$("#" +skillId+ ".user_skill").html(result);
}
});
});
});
});
});
</script>
';
Expand Down
20 changes: 7 additions & 13 deletions main/inc/lib/tracking.lib.php
Expand Up @@ -4852,7 +4852,7 @@ public static function show_user_progress(
// Course list
if ($show_courses) {
if (!empty($courses)) {
$html .= Display::page_subheader(
$html .= Display::page_header(
Display::return_icon('course.png', get_lang('MyCourses')).PHP_EOL.get_lang('MyCourses')
);

Expand Down Expand Up @@ -5103,16 +5103,11 @@ function ($data, $columnKey) {
.'</div></div>';
}

$sessionIcon = Display::return_icon(
'session.png',
get_lang('Sessions'),
[],
ICON_SIZE_SMALL
);
$sessionIcon = Display::return_icon('session.png', get_lang('Sessions'));

$anchor = Display::url('', '', ['name' => 'course_session_header']);
$html .= $anchor.Display::page_subheader(
$sessionIcon.' '.get_lang('Sessions')
$html .= $anchor.Display::page_header(
$sessionIcon.PHP_EOL.get_lang('Sessions')
);

$sessionsTable = new SortableTableFromArray([], 0, 0, 'sessions');
Expand Down Expand Up @@ -5220,10 +5215,8 @@ function ($data, $columnKey) {
$session_data = $course_in_session[$session_id_from_get];
$course_list = $session_data['course_list'];

$sessionCoursesTable = new SortableTableFromArray([], 0, 0, 'session_courses');

$html .= '<a name="course_session_list"></a>';
$html .= Display::tag('h3', $session_data['name'].' - '.get_lang('CourseList'));
$html .= Display::page_subheader($session_data['name'], get_lang('CourseList'));

$columnHeaders = array_filter(
[
Expand Down Expand Up @@ -5253,6 +5246,7 @@ function ($column, $key) use ($trackingColumns) {
ARRAY_FILTER_USE_BOTH
);

$sessionCoursesTable = new SortableTableFromArray([], 0, 0, 'session_courses');
$sessionCoursesTable->setHeaders($columnHeaders);

foreach ($course_list as $course_data) {
Expand Down Expand Up @@ -5455,7 +5449,7 @@ public static function show_course_detail($user_id, $course_code, $session_id)
}

$html .= '<a name="course_session_data"></a>';
$html .= Display::page_subheader($course_info['title']);
$html .= Display::page_subheader2($course_info['title']);

// Course details

Expand Down

0 comments on commit 0a4e75d

Please sign in to comment.