Internal: Fix to several queries + switching to new icons theme

pull/4988/head
Yannick Warnier 2 years ago
parent 3a0bfb6c10
commit 207765f005
  1. 5
      public/main/inc/lib/events.lib.php
  2. 59
      public/main/inc/lib/myspace.lib.php
  3. 8
      public/main/my_space/admin_view.php
  4. 2
      public/main/tracking/course_session_report.php
  5. 2
      public/main/tracking/lp_results_by_user.php
  6. 5
      public/main/tracking/question_course_report.php

@ -1787,18 +1787,15 @@ class Event
* Get a list of all the exercises in a given learning path. * Get a list of all the exercises in a given learning path.
* *
* @param int $lp_id * @param int $lp_id
* @param int $course_id This parameter is probably deprecated as lp_id now is a global iid
* *
* @return array * @return array
*/ */
public static function get_all_exercises_from_lp($lp_id, $course_id) public static function get_all_exercises_from_lp($lp_id)
{ {
$lp_item_table = Database::get_course_table(TABLE_LP_ITEM); $lp_item_table = Database::get_course_table(TABLE_LP_ITEM);
$course_id = (int) $course_id;
$lp_id = (int) $lp_id; $lp_id = (int) $lp_id;
$sql = "SELECT * FROM $lp_item_table $sql = "SELECT * FROM $lp_item_table
WHERE WHERE
c_id = $course_id AND
lp_id = $lp_id AND lp_id = $lp_id AND
item_type = 'quiz' item_type = 'quiz'
ORDER BY parent_item_id, display_order"; ORDER BY parent_item_id, display_order";

@ -15,11 +15,10 @@ use CpChart\Image as pImage;
class MySpace class MySpace
{ {
/** /**
* Get admin actions. * Generate the list of admin actions to be shown
* * @return array
* @return string
*/ */
public static function getAdminActions() public static function generateAdminActionLinks(): array
{ {
$actions = [ $actions = [
[ [
@ -103,7 +102,16 @@ class MySpace
'content' => get_lang('LP item by author'), 'content' => get_lang('LP item by author'),
]; ];
} }
return $actions;
}
/**
* Get admin actions.
*
* @return string
*/
public static function getAdminActions(bool $display = false)
{
$actions = self::generateAdminActionLinks();
return Display::actions($actions); return Display::actions($actions);
} }
@ -114,40 +122,23 @@ class MySpace
{ {
$menuItems = []; $menuItems = [];
$menuItems[] = Display::url( $menuItems[] = Display::url(
Display::return_icon( Display::getMdiIcon('chart-box', 'ch-tool-icon', null, 32, get_lang('View my progress')),
'statistics.png',
get_lang('View my progress'),
'',
ICON_SIZE_MEDIUM
),
api_get_path(WEB_CODE_PATH).'auth/my_progress.php' api_get_path(WEB_CODE_PATH).'auth/my_progress.php'
); );
$menuItems[] = Display::url( $menuItems[] = Display::url(
Display::return_icon( Display::getMdiIcon('human-male-board', 'ch-tool-icon', null, 32, get_lang('Trainer View')),
'teacher.png',
get_lang('Trainer View'),
[],
32
),
api_get_path(WEB_CODE_PATH).'my_space/index.php?view=teacher' api_get_path(WEB_CODE_PATH).'my_space/index.php?view=teacher'
); );
$menuItems[] = Display::url( $menuItems[] = Display::url(
Display::return_icon( Display::getMdiIcon('star', 'ch-tool-icon', null, 32, get_lang('Admin view')),
'star_na.png',
get_lang('Admin view'),
[],
32
),
'#' '#'
); );
$menuItems[] = Display::url( $menuItems[] = Display::url(
Display::return_icon('quiz.png', get_lang('Exam tracking'), [], 32), Display::getMdiIcon('order-bool-ascending-variant', 'ch-tool-icon', null, 32, get_lang('Exam tracking')),
api_get_path(WEB_CODE_PATH).'tracking/exams.php' api_get_path(WEB_CODE_PATH).'tracking/exams.php'
); );
$menu = Display::toolbarAction('myspace', $menuItems); return Display::toolbarAction('myspace', $menuItems);
return $menu;
} }
/** /**
@ -628,7 +619,7 @@ class MySpace
$table_row[] = $nb_courses; $table_row[] = $nb_courses;
$table_row[] = $nb_sessions; $table_row[] = $nb_sessions;
$table_row[] = '<a href="session.php?id_coach='.$coaches['user_id'].'"> $table_row[] = '<a href="session.php?id_coach='.$coaches['user_id'].'">
'.Display::return_icon('2rightarrow.png', get_lang('Details')).' '.Display::getMdiIcon('arrow-left-bold-box', 'ch-tool-icon', null, 22, get_lang('Details')).'
</a>'; </a>';
$all_datas[] = $table_row; $all_datas[] = $table_row;
@ -1017,8 +1008,8 @@ class MySpace
"<tbody>"; "<tbody>";
$index = 0; $index = 0;
//icons for show and hode //icons for show and hode
$iconAdd = Display::return_icon('add.png', get_lang('ShowOrHide'), '', ICON_SIZE_SMALL); $iconAdd = Display::getMdiIcon('plus', 'ch-tool-icon', null, 22, get_lang('ShowOrHide'));
$iconRemove = Display::return_icon('error.png', get_lang('ShowOrHide'), '', ICON_SIZE_SMALL); $iconRemove = Display::getMdiIcon('delete', 'ch-tool-icon', null, 22, get_lang('ShowOrHide'));
$teacherNameTemp = ''; $teacherNameTemp = '';
foreach ($data as $teacherName => $reportData) { foreach ($data as $teacherName => $reportData) {
$lpCount = 0; $lpCount = 0;
@ -1042,7 +1033,7 @@ class MySpace
"<div id='$hiddenField' class='hidden'>"; "<div id='$hiddenField' class='hidden'>";
foreach ($row['studentList'] as $student) { foreach ($row['studentList'] as $student) {
$reportLink = Display::url( $reportLink = Display::url(
Display::return_icon('statistics.png', get_lang('Stats')), Display::getMdiIcon('chart-box', 'ch-tool-icon', null, 22, get_lang('Stats')),
api_get_path(WEB_CODE_PATH).'my_space/myStudents.php?details=true&student='. api_get_path(WEB_CODE_PATH).'my_space/myStudents.php?details=true&student='.
$student['id'] $student['id']
.'&id_session='.$lpInfo['session_id'] .'&id_session='.$lpInfo['session_id']
@ -1274,8 +1265,8 @@ class MySpace
"</thead>". "</thead>".
"<tbody>"; "<tbody>";
//Icon Constant //Icon Constant
$iconAdd = Display::return_icon('add.png', get_lang('ShowOrHide'), '', ICON_SIZE_SMALL); $iconAdd = Display::getMdiIcon('plus', 'ch-tool-icon', null, 22, get_lang('ShowOrHide'));
$iconRemove = Display::return_icon('error.png', get_lang('ShowOrHide'), '', ICON_SIZE_SMALL); $iconRemove = Display::getMdiIcon('delete', 'ch-tool-icon', null, 22, get_lang('ShowOrHide'));
$lastAuthor = ''; $lastAuthor = '';
$total = 0; $total = 0;
@ -2568,7 +2559,7 @@ class MySpace
//set the "from" value to know if I access the Reporting by the chamilo tab or the course link //set the "from" value to know if I access the Reporting by the chamilo tab or the course link
$table_row[] = '<center><a href="../../tracking/courseLog.php?cidReq='.$course_code.'&from=myspace&id_session='.$session_id.'"> $table_row[] = '<center><a href="../../tracking/courseLog.php?cidReq='.$course_code.'&from=myspace&id_session='.$session_id.'">
'.Display::return_icon('2rightarrow.png', get_lang('Details')).' '.Display::getMdiIcon('fast-forward-outline', 'ch-tool-icon', null, 22, get_lang('Details')).'
</a> </a>
</center>'; </center>';

@ -83,7 +83,13 @@ if ($exportCSV) {
Display::display_header($nameTools); Display::display_header($nameTools);
echo MySpace::getTopMenu(); echo MySpace::getTopMenu();
echo MySpace::getAdminActions(); $actions = MySpace::generateAdminActionLinks();
echo '<ul class="list-disc m-y-2">';
foreach ($actions as $action) {
echo '<li><a href="'.$action['url'].'">'.$action['content'].'</a></li>'.PHP_EOL;
}
echo '</ul>';
switch ($display) { switch ($display) {
case 'coaches': case 'coaches':

@ -99,7 +99,7 @@ foreach ($course_list as $current_course) {
// Looping LPs // Looping LPs
foreach ($lp_list as $lp_id => $lp) { foreach ($lp_list as $lp_id => $lp) {
$exercise_list = Event::get_all_exercises_from_lp($lp_id, $course_info['real_id']); $exercise_list = Event::get_all_exercises_from_lp($lp_id);
// Looping Chamilo Exercises in LP // Looping Chamilo Exercises in LP
foreach ($exercise_list as $exercise) { foreach ($exercise_list as $exercise) {
$exercise_stats = Event::get_all_exercise_event_from_lp( $exercise_stats = Event::get_all_exercise_event_from_lp(

@ -137,7 +137,7 @@ foreach ($course_list as $current_course) {
// Looping LPs // Looping LPs
$lps = []; $lps = [];
foreach ($lp_list as $lp_id => $lp) { foreach ($lp_list as $lp_id => $lp) {
$exercise_list = Event::get_all_exercises_from_lp($lp_id, $course_info['real_id']); $exercise_list = Event::get_all_exercises_from_lp($lp_id);
$attempt_result = []; $attempt_result = [];
// Looping Chamilo Exercises in LP // Looping Chamilo Exercises in LP
foreach ($exercise_list as $exercise) { foreach ($exercise_list as $exercise) {

@ -93,10 +93,7 @@ if (!empty($course_info)) {
$main_question_list = []; $main_question_list = [];
foreach ($lp_list as $lp_id => $lp) { foreach ($lp_list as $lp_id => $lp) {
$exercise_list = Event::get_all_exercises_from_lp( $exercise_list = Event::get_all_exercises_from_lp($lp_id);
$lp_id,
$course_info['real_id']
);
foreach ($exercise_list as $exercise) { foreach ($exercise_list as $exercise) {
$my_exercise = new Exercise($course_info['real_id']); $my_exercise = new Exercise($course_info['real_id']);

Loading…
Cancel
Save