Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFQC committed Dec 27, 2023
2 parents 9956332 + 7164055 commit 80e0497
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 117 deletions.
2 changes: 1 addition & 1 deletion public/main/inc/lib/display.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2220,7 +2220,7 @@ public static function toolbarGradeAction($content, $colsWidth = [])
return $html;
}

public static function getMdiIcon(string|ActionIcon|ToolIcon $name, string $additionalClass = null, string $style = null, int $pixelSize = null, string $title = null, array $additionalAttributes = null): string
public static function getMdiIcon(string|ActionIcon|ToolIcon|ObjectIcon|StateIcon $name, string $additionalClass = null, string $style = null, int $pixelSize = null, string $title = null, array $additionalAttributes = null): string

Check failure on line 2223 in public/main/inc/lib/display.lib.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 Test on ubuntu-latest

UndefinedClass

public/main/inc/lib/display.lib.php:2223:39: UndefinedClass: Class, interface or enum named StateIcon does not exist (see https://psalm.dev/019)

Check failure on line 2223 in public/main/inc/lib/display.lib.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 Test on ubuntu-latest

UndefinedClass

public/main/inc/lib/display.lib.php:2223:39: UndefinedClass: Class, interface or enum named ObjectIcon does not exist (see https://psalm.dev/019)
{
$sizeString = '';
if (!empty($pixelSize)) {
Expand Down
57 changes: 20 additions & 37 deletions public/main/tracking/courseLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CQuiz;
use ChamiloSession as Session;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
use Chamilo\CoreBundle\Component\Utils\ObjectIcon;
use Chamilo\CoreBundle\Component\Utils\StateIcon;

require_once __DIR__.'/../inc/global.inc.php';

Expand Down Expand Up @@ -97,7 +100,7 @@
function foldup(id) {
var show = function () {\$(this).css('outline', '1px solid red')};
var hide = function () {\$(this).css('outline', '1px solid gree')};
$('#reporting_table .data_table tr td:nth-child(' + (id + 1) + ')').toggle();
$('#reporting_table .data_table tr th:nth-child(' + (id + 1) + ')').toggle();
$('div#unhideButtons a:nth-child(' + (id + 1) + ')').toggle();
Expand All @@ -108,12 +111,7 @@ function init_hide() {
$('#reporting_table .data_table tr th').each(
function(index) {
$(this).prepend(
'<div style=\"cursor:pointer\" onclick=\"foldup(' + index + ')\">".Display::return_icon(
'visible.png',
get_lang('Hide column'),
['align' => 'absmiddle', 'hspace' => '3px'],
ICON_SIZE_SMALL
)."</div>'
'<div style=\"cursor:pointer\" onclick=\"foldup(' + index + ')\">".Display::getMdiIcon(StateIcon::ACTIVE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Hide column'))."</div>'
);
}
);
Expand Down Expand Up @@ -202,7 +200,7 @@ function(index) {
$actionsLeft = TrackingCourseLog::actionsLeft('users', $sessionId, false);

$actionsRight = '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
Display::getMdiIcon(ActionIcon::PRINT, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Print')).'</a>';

$additionalParams = '';
if (isset($_GET['additional_profile_field'])) {
Expand All @@ -218,7 +216,7 @@ function(index) {

$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>';
'.Display::getMdiIcon(ActionIcon::EXPORT_CSV, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('CSV export')).'</a>';
// Create a search-box.
$form_search = new FormValidator(
'search_simple',
Expand All @@ -244,25 +242,10 @@ function(index) {
$course_name = get_lang('Course').' '.$course->getTitle();

if ($sessionId) {
$titleSession = Display::return_icon(
'session.png',
get_lang('Session'),
[],
ICON_SIZE_SMALL
).' '.api_get_session_name($sessionId);
$titleCourse = Display::return_icon(
'course.png',
get_lang('Course'),
[],
ICON_SIZE_SMALL
).' '.$course_name;
$titleSession = Display::getMdiIcon(ObjectIcon::SESSION, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Session')).' '.api_get_session_name($sessionId);
$titleCourse = Display::getMdiIcon(ObjectIcon::COURSE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Course')).' '.$course_name;
} else {
$titleSession = Display::return_icon(
'course.png',
get_lang('Course'),
[],
ICON_SIZE_SMALL
).' '.$course->getTitle();
$titleSession = Display::getMdiIcon(ObjectAction::COURSE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Course')).' '.$course->getTitle();

Check failure on line 248 in public/main/tracking/courseLog.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 Test on ubuntu-latest

UndefinedClass

public/main/tracking/courseLog.php:248:41: UndefinedClass: Class, interface or enum named ObjectAction does not exist (see https://psalm.dev/019)
}

$teacherList = CourseManager::getTeacherListFromCourseCodeToString(
Expand Down Expand Up @@ -298,9 +281,9 @@ function(index) {
$sessionList = SessionManager::get_session_by_course($courseId);
if (!empty($sessionList)) {
$html .= Display::page_subheader2(get_lang('Session list'));
$icon = Display::return_icon(
'session.png',
null,
$icon = Display::getMdiIcon(
ObjectIcon::SESSION,
'ch-tool-icon',
null,
ICON_SIZE_TINY
);
Expand Down Expand Up @@ -584,7 +567,7 @@ function(index) {
];
$el = $form->addSelect(
'since',
Display::getMdiIcon('alert').get_lang('Remind learners inactive since'),
Display::getMdiIcon(StateIcon::WARNING, 'ch-tool-icon', null, ICON_SIZE_SMALL).get_lang('Remind learners inactive since'),
$options,
['disable_js' => true, 'class' => 'col-sm-3']
);
Expand Down Expand Up @@ -655,43 +638,43 @@ function(index) {
$table->set_header(
$headerCounter++,
get_lang('Time').'&nbsp;'.
Display::return_icon('info3.gif', get_lang('Time spent in the course'), [], ICON_SIZE_TINY),
Display::getMdiIcon('clock-outline', 'ch-tool-icon', null, ICON_SIZE_TINY, get_lang('Time spent in the course')),
false
);
$headers['training_time'] = get_lang('Time');
$table->set_header(
$headerCounter++,
get_lang('Progress').'&nbsp;'.
Display::return_icon('info3.gif', get_lang('Average progress in courses'), [], ICON_SIZE_TINY),
Display::getMdiIcon(ObjectIcon::COURSE_PROGRESS, 'ch-tool-icon', null, ICON_SIZE_TINY, get_lang('Average progress in courses')),
false
);
$headers['course_progress'] = get_lang('Course progress');

$table->set_header(
$headerCounter++,
get_lang('Exercise progress').'&nbsp;'.
Display::return_icon('info3.gif', get_lang('Progress of exercises taken by the student'), [], ICON_SIZE_TINY),
Display::getMdiIcon(ObjectIcon::COURSE_PROGRESS, 'ch-tool-icon', null, ICON_SIZE_TINY, get_lang('Progress of exercises taken by the student')),
false
);
$headers['exercise_progress'] = get_lang('Exercise progress');
$table->set_header(
$headerCounter++,
get_lang('Exercise average').'&nbsp;'.
Display::return_icon('info3.gif', get_lang('Average of best grades of each exercise attempt'), [], ICON_SIZE_TINY),
Display::getMdiIcon('format-annotation-plus', 'ch-tool-icon', null, ICON_SIZE_TINY, get_lang('Average of best grades of each exercise attempt')),
false
);
$headers['exercise_average'] = get_lang('Exercise average');
$table->set_header(
$headerCounter++,
get_lang('Score').'&nbsp;'.
Display::return_icon('info3.gif', get_lang('Average of tests in Learning Paths'), [], ICON_SIZE_TINY),
Display::getMdiIcon('format-annotation-plus', 'ch-tool-icon', null, ICON_SIZE_TINY, get_lang('Average of tests in Learning Paths')),
false
);
$headers['score'] = get_lang('Score');
$table->set_header(
$headerCounter++,
$bestScoreLabel.'&nbsp;'.
Display::return_icon('info3.gif', get_lang('Average of tests in Learning Paths'), [], ICON_SIZE_TINY),
Display::getMdiIcon('format-annotation-plus', 'ch-tool-icon', null, ICON_SIZE_TINY, get_lang('Average of tests in Learning Paths')),
false
);
$headers['score_best'] = $bestScoreLabel;
Expand Down
2 changes: 1 addition & 1 deletion public/main/tracking/course_log_groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@

$action_links = '
function action_formatter(cellvalue, options, rowObject) {
return \'<a href="course_log_tools.php?id_session=0&cid='.$course_id.'&gid=\'+options.rowId+\'">'.Display::return_icon('2rightarrow.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'.
return \'<a href="course_log_tools.php?id_session=0&cid='.$course_id.'&gid=\'+options.rowId+\'">'.Display::getMdiIcon('chevron-double-right', 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit')).'</a>'.
'\';
}';

Expand Down
8 changes: 5 additions & 3 deletions public/main/tracking/course_log_resources.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

/* For licensing terms, see /license.txt */

use Chamilo\CoreBundle\Component\Utils\ActionIcon;

require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_TRACKING;

Expand Down Expand Up @@ -95,7 +97,7 @@ function (&$item) {

$left = TrackingCourseLog::actionsLeft('resources', api_get_session_id(), false);
$right = '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).
Display::getMdiIcon(ActionIcon::PRINT, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Print')).
'</a>';

$addional_param = '';
Expand All @@ -109,9 +111,9 @@ function (&$item) {
}

$right .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&export=csv&'.$addional_param.$users_tracking_per_page.'">
'.Display::return_icon('export_csv.png', get_lang('CSV export'), '', ICON_SIZE_MEDIUM).'</a>';
'.Display::getMdiIcon(ActionIcon::EXPORT_CSV, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('CSV export')).'</a>';
$right .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&export=xls&'.$addional_param.$users_tracking_per_page.'">
'.Display::return_icon('export_excel.png', get_lang('Excel export'), '', ICON_SIZE_MEDIUM).'</a>';
'.Display::getMdiIcon(ActionIcon::EXPORT_SPREADSHEET, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Excel export')).'</a>';

echo Display::toolbarAction('log_resource', [$left, $right]);

Expand Down
31 changes: 12 additions & 19 deletions public/main/tracking/course_log_tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CQuiz;
use ChamiloSession as Session;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
use Chamilo\CoreBundle\Component\Utils\ToolIcon;
use Chamilo\CoreBundle\Component\Utils\ObjectIcon;

require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_TRACKING;
Expand Down Expand Up @@ -103,10 +106,10 @@
$left = TrackingCourseLog::actionsLeft('courses', api_get_session_id(), false);

$right = '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
Display::getMdiIcon(ActionIcon::PRINT, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Print')).'</a>';

$right .= '<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>';
'.Display::getMdiIcon(ActionIcon::EXPORT_CSV, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('CSV export')).'</a>';
$right .= '</span>';

echo Display::toolbarAction('tools', [$left, $right]);
Expand All @@ -122,9 +125,7 @@
// learning path tracking
echo '<div class="report_section">';
echo Display::page_subheader(
Display::return_icon(
'scorms.gif',
get_lang('Progress in courses')
Display::getMdiIcon(ObjectIcon::COURSE_PROGRESS, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Progress in courses')
).' '.get_lang('Progress in courses')
);
echo '<table class="data_table">';
Expand Down Expand Up @@ -176,9 +177,7 @@
// Exercises tracking.
echo '<div class="report_section">';
echo Display::page_subheader(
Display::return_icon(
'quiz.png',
get_lang('Tests score')
Display::getMdiIcon(ToolIcon::QUIZ, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Tests score')
).' '.get_lang('Tests score')
);
echo '<table class="data_table">';
Expand Down Expand Up @@ -275,7 +274,7 @@
// Forums tracking.
echo '<div class="report_section">';
echo Display::page_subheader(
Display::return_icon('forum.gif', get_lang('Forum')).' '.
Display::getMdiIcon(ToolIcon::QUIZ, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Forum')).' '.
get_lang('Forum').'&nbsp;-&nbsp;<a href="../forum/index.php?'.api_get_cidreq().'">'.
get_lang('See detail').'</a>'
);
Expand All @@ -290,7 +289,7 @@
if ($showChatReporting) {
echo '<div class="report_section">';
echo Display::page_subheader(
Display::return_icon('chat.gif', get_lang('Chat')).' '.get_lang('Chat')
Display::getMdiIcon(ToolIcon::CHAT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Chat')).' '.get_lang('Chat')
);

echo '<table class="data_table">';
Expand Down Expand Up @@ -324,9 +323,7 @@
if ($showTrackingReporting) {
echo '<div class="report_section">';
echo Display::page_subheader(
Display::return_icon(
'acces_tool.gif',
get_lang('Tools most used')
Display::getMdiIcon(ToolIcon::TRACKING, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Tools most used')
).' '.get_lang('Tools most used')
);
echo '<table class="table table-hover table-striped data_table">';
Expand Down Expand Up @@ -373,9 +370,7 @@

echo '<a name="documents_tracking" id="a"></a><div class="report_section">';
echo Display::page_subheader(
Display::return_icon(
'documents.gif',
get_lang('Documents most downloaded')
Display::getMdiIcon(ToolIcon::DOCUMENT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Documents most downloaded')
).'&nbsp;'.get_lang('Documents most downloaded').$link
);

Expand Down Expand Up @@ -428,9 +423,7 @@
// links tracking
echo '<div class="report_section">';
echo Display::page_subheader(
Display::return_icon(
'link.gif',
get_lang('Links most visited')
Display::getMdiIcon(ToolIcon::LINK, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Links most visited')
).'&nbsp;'.get_lang('Links most visited')
);
echo '<table class="table table-hover table-striped data_table">';
Expand Down
21 changes: 12 additions & 9 deletions public/main/tracking/exams.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CQuiz;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
use Chamilo\CoreBundle\Component\Utils\ToolIcon;
use Chamilo\CoreBundle\Component\Utils\ObjectIcon;

require_once __DIR__.'/../inc/global.inc.php';

Expand Down Expand Up @@ -99,30 +102,30 @@
$actionsLeft = $actionsRight = '';
if ($global) {
$actionsLeft .= '<a href="'.api_get_path(WEB_CODE_PATH).'auth/my_progress.php">'.
Display::return_icon('statistics.png', get_lang('View my progress'), '', ICON_SIZE_MEDIUM);
Display::getMdiIcon(ToolIcon::TRACKING, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('View my progress'));
$actionsLeft .= '</a>';

$actionsRight .= '<a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exerciseId.'">'.
Display::return_icon('export_excel.png', get_lang('Excel export'), '', ICON_SIZE_MEDIUM).'</a>';
Display::getMdiIcon(ActionIcon::EXPORT_SPREADSHEET, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Excel export')).'</a>';
$actionsRight .= '<a href="javascript: void(0);" onclick="javascript: window.print()">'.
Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
Display::getMdiIcon(ActionIcon::PRINT, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Print')).'</a>';

$menuItems[] = Display::url(
Display::return_icon('teacher.png', get_lang('Trainer View'), [], 32),
Display::getMdiIcon(ObjectIcon::TEACHER, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Trainer View')),
api_get_path(WEB_CODE_PATH).'my_space/index.php?view=teacher'
);
if (api_is_platform_admin()) {
$menuItems[] = Display::url(
Display::return_icon('star.png', get_lang('Admin view'), [], 32),
Display::getMdiIcon(ObjectIcon::STAR, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Admin view')),
api_get_path(WEB_CODE_PATH).'my_space/admin_view.php'
);
} else {
$menuItems[] = Display::url(
Display::return_icon('star.png', get_lang('Coach interface'), [], 32),
Display::getMdiIcon(ObjectIcon::STAR, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Coach interface')),
api_get_path(WEB_CODE_PATH).'my_space/index.php?view=coach'
);
}
$menuItems[] = '<a href="#">'.Display::return_icon('quiz_na.png', get_lang('Exam tracking'), [], 32).'</a>';
$menuItems[] = '<a href="#">'.Display::getMdiIcon(ToolIcon::QUIZ, 'ch-tool-icon-disabled', null, ICON_SIZE_MEDIUM, get_lang('Exam tracking')).'</a>';

$nb_menu_items = count($menuItems);
if ($nb_menu_items > 1) {
Expand All @@ -134,7 +137,7 @@
} else {
$actionsLeft = TrackingCourseLog::actionsLeft('exams', api_get_session_id(), false);
$actionsRight .= Display::url(
Display::return_icon('export_excel.png', get_lang('Excel export'), [], 32),
Display::getMdiIcon(ActionIcon::EXPORT_SPREADSHEET, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Excel export')),
api_get_self().'?'.api_get_cidreq().'&export=1&score='.$filter_score.'&exercise_id='.$exerciseId
);
}
Expand Down Expand Up @@ -529,7 +532,7 @@ function processStudentList($filter_score, $global, Cquiz $exercise, $courseInfo

if ($global && !empty($sessionId)) {
$sessionName = isset($newSessionList[$sessionId]) ? $newSessionList[$sessionId] : null;
$html .= Display::return_icon('star.png', get_lang('Session')).' ('.$sessionName.')';
$html .= Display::getMdiIcon(ObjectIcon::STAR, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Session')).' ('.$sessionName.')';
}

$html .= '</td>';
Expand Down
3 changes: 2 additions & 1 deletion public/main/tracking/lp_report.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CLp;
use ChamiloSession as Session;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;

require_once __DIR__.'/../inc/global.inc.php';

Expand Down Expand Up @@ -426,7 +427,7 @@ function getData($from, $numberOfItems, $column, $direction, $params)
$actionsLeft = TrackingCourseLog::actionsLeft('lp', api_get_session_id(), false);
$actionsCenter = '';
$actionsRight = Display::url(
Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), null, ICON_SIZE_MEDIUM),
Display::getMdiIcon(ActionIcon::EXPORT_SPREADSHEET, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('ExportAsXLS')),
api_get_self().'?action=export&'.api_get_cidreq()
);

Expand Down
Loading

0 comments on commit 80e0497

Please # to comment.