fix view tracking course BT#10290

1.10.x
aragonc 9 years ago
parent 6ba1a1cd7e
commit 9a165b16cd
  1. 43
      main/inc/lib/course.lib.php
  2. 27
      main/inc/lib/display.lib.php
  3. 96
      main/tracking/courseLog.php

@ -1828,11 +1828,12 @@ class CourseManager
public static function get_teacher_list_from_course_code_to_string(
$course_code,
$separator = self::USER_SEPARATOR,
$add_link_to_profile = false
) {
$add_link_to_profile = false,
$orderList = false
) {
$teacher_list = self::get_teacher_list_from_course_code($course_code);
$teacher_string = '';
$html = '';
$list = array();
if (!empty($teacher_list)) {
foreach ($teacher_list as $teacher) {
@ -1853,11 +1854,21 @@ class CourseManager
}
$list[] = $teacher_name;
}
if (!empty($list)) {
$teacher_string = array_to_string($list, $separator);
if ($orderList === true){
$html .= '<ul class="user-teacher">';
foreach ($list as $teacher){
$html .= Display::tag('li', Display::return_icon('teacher.png', $teacher, null, ICON_SIZE_TINY) . ' ' . $teacher);
}
$html .= '</ul>';
}else{
$html .= array_to_string($list, $separator);
}
}
}
return $teacher_string;
return $html;
}
/**
@ -1919,11 +1930,12 @@ class CourseManager
$session_id = 0,
$courseId = null,
$separator = self::USER_SEPARATOR,
$add_link_to_profile = false
$add_link_to_profile = false,
$orderList = false
) {
$coachs_course = self::get_coachs_from_course($session_id, $courseId);
$course_coachs = array();
$html = '';
if (is_array($coachs_course)) {
foreach ($coachs_course as $coach_course) {
$coach_name = api_get_person_name($coach_course['firstname'], $coach_course['lastname']);
@ -1942,10 +1954,21 @@ class CourseManager
}
}
$coaches_to_string = null;
if (is_array($course_coachs) && count($course_coachs) > 0) {
$coaches_to_string = array_to_string($course_coachs, $separator);
if (!empty($course_coachs)) {
if ($orderList === true){
$html .= '<ul class="user-coachs">';
foreach ($course_coachs as $coachs){
$html .= Display::tag('li', Display::return_icon('teacher.png', $coachs, null, ICON_SIZE_TINY) . ' ' . $coachs);
}
$html .= '</ul>';
} else {
$coaches_to_string = array_to_string($course_coachs, $separator);
}
}
return $coaches_to_string;
return $html;
}
/**

@ -2208,5 +2208,32 @@ class Display
return "$icon ";
}
public static function panelCollapse($title, $content, $id = null, $params = null, $idAccordion = null, $idCollpase = null)
{
if (!empty($idAccordion)) {
$html = null;
$html .= '<div class="panel-group" id="'.$idAccordion.'" role="tablist" aria-multiselectable="true">' . PHP_EOL;
$html .= '<div class="panel panel-default" id="'.$id.'">' . PHP_EOL;
$html .= '<div class="panel-heading" role="tab"><h4 class="panel-title">' . PHP_EOL;
$html .= '<a role="button" data-toggle="collapse" data-parent="#'.$idAccordion.'" href="#'.$idCollpase.'" aria-expanded="true" aria-controls="'.$idCollpase.'">'.$title.'</a>' . PHP_EOL;
$html .= '</h4></div>' . PHP_EOL;
$html .= '<div id="'.$idCollpase.'" class="panel-collapse collapse in" role="tabpanel">' . PHP_EOL;
$html .= '<div class="panel-body">'.$content.'</div>' . PHP_EOL;
$html .= '</div></div></div>' . PHP_EOL;
} else {
if (!empty($id)) {
$params['id'] = $id;
}
$params['class'] = 'panel panel-default';
$html = null;
if (!empty($title)) {
$html .= '<div class="panel-heading">'.$title.'</div>' . PHP_EOL;
}
$html.= '<div class="panel-body">'.$content.'</div>' . PHP_EOL;
$html = Display::div($html, $params);
}
return $html;
}
}

@ -216,36 +216,34 @@ Display::display_header($nameTools, 'Tracking');
/* MAIN CODE */
echo '<div class="actions">';
echo Display::return_icon('user_na.png', get_lang('StudentsTracking'), array(), ICON_SIZE_MEDIUM);
echo Display::url(
$actionsLeft = Display::return_icon('user_na.png', get_lang('StudentsTracking'), array(), ICON_SIZE_MEDIUM);
$actionsLeft .= Display::url(
Display::return_icon('group.png', get_lang('GroupReporting'), array(), ICON_SIZE_MEDIUM),
'course_log_groups.php?'.api_get_cidreq()
);
echo Display::url(
$actionsLeft .= Display::url(
Display::return_icon('course.png', get_lang('CourseTracking'), array(), ICON_SIZE_MEDIUM),
'course_log_tools.php?'.api_get_cidreq()
);
echo Display::url(
$actionsLeft .= Display::url(
Display::return_icon('tools.png', get_lang('ResourcesTracking'), array(), ICON_SIZE_MEDIUM),
'course_log_resources.php?'.api_get_cidreq()
);
echo Display::url(
$actionsLeft .= Display::url(
Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH).'tracking/exams.php?'.api_get_cidreq()
);
if (!empty($sessionId)) {
echo Display::url(
$actionsLeft .= Display::url(
Display::return_icon('attendance_list.png', get_lang('Logins'), '', ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH) . 'attendance/index.php?' . api_get_cidreq() . '&action=calendar_logins'
);
}
echo '<span style="float:right; padding-top:0px;">';
echo '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
$actionsRight = '<div class="pull-right">';
$actionsRight .= '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
Display::return_icon('printer.png', get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>';
$addional_param = '';
@ -256,14 +254,9 @@ $users_tracking_per_page = '';
if (isset($_GET['users_tracking_per_page'])) {
$users_tracking_per_page= '&users_tracking_per_page='.intval($_GET['users_tracking_per_page']);
}
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&export=csv&'.$addional_param.$users_tracking_per_page.'">
$actionsRight .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&export=csv&'.$addional_param.$users_tracking_per_page.'">
'.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</span>';
echo '</div>';
echo '<div class="actions">';
$actionsRight .= '</div>';
// Create a search-box.
$form_search = new FormValidator(
'search_simple',
@ -280,26 +273,26 @@ $form_search->addElement('hidden', 'session_id', $sessionId);
$form_search->addElement('hidden', 'id_session', $sessionId);
$form_search->addElement('text', 'user_keyword');
$form_search->addButtonSearch(get_lang('SearchUsers'));
$form_search->display();
echo '</div>';
echo Display::toolbarAction('toolbar-courselog', array( 0 => $actionsLeft, 1 => $form_search->returnForm(), 2 => $actionsRight ), 3);
$course_name = get_lang('Course').' '.$courseInfo['name'];
if ($session_id) {
echo Display::page_subheader(
Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.api_get_session_name($session_id).' '.
Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$course_name
);
$titleSession = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.api_get_session_name($session_id);
$titleCourse = Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$course_name;
} else {
echo Display::page_subheader(
Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$courseInfo['name']
);
$titleSession = Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$courseInfo['name'];
}
$teacherList = CourseManager::get_teacher_list_from_course_code_to_string(
$courseInfo['code'],
',',
false
false,
true
);
$coaches = null;
@ -308,32 +301,35 @@ if (!empty($session_id)) {
$session_id,
$courseInfo['real_id'],
',',
false
false,
true
);
}
$html = '';
if (!empty($teacherList)) {
echo Display::page_subheader2(get_lang('Teachers'));
echo $teacherList;
$html .= Display::page_subheader2(get_lang('Teachers'));
$html .= $teacherList;
}
if (!empty($coaches)) {
echo Display::page_subheader2(get_lang('Coaches'));
echo $coaches;
$html .= Display::page_subheader2(get_lang('Coaches'));
$html .= $coaches;
}
$sessionList = SessionManager::get_session_by_course($courseInfo['real_id']);
if (!empty($sessionList)) {
echo Display::page_subheader2(get_lang('SessionList'));
$sessionToShow = array();
$html .= Display::page_subheader2(get_lang('SessionList'));
$iconCourse = Display::return_icon('course.png', null, null, ICON_SIZE_TINY);
$html .= '<ul class="session-list">';
foreach ($sessionList as $session) {
$url = api_get_path(WEB_CODE_PATH).'mySpace/course.php?session_id='.$session['id'].'&cidReq='.$courseInfo['code'];
$sessionToShow[] = Display::url($session['name'], $url);
$html .= Display::tag('li', $iconCourse . ' ' . Display::url($session['name'], $url));
}
echo implode(', ', $sessionToShow);
$html .= '</ul>';
}
echo Display::page_subheader2(get_lang('StudentList'));
$html .= Display::page_subheader2(get_lang('StudentList'));
// PERSON_NAME_DATA_EXPORT is buggy
$is_western_name_order = api_is_western_name_order();
@ -355,14 +351,14 @@ if (count($a_students) > 0) {
30 => '30 '.get_lang('Days'),
'never' => get_lang('Never')
);
$el = $form->addElement(
$el = $form->addSelect('since', get_lang('RemindInactivesLearnersSince'), $options);
/* $el = $form->addElement(
'select',
'since',
'<img align="middle" src="'.api_get_path(WEB_IMG_PATH).'messagebox_warning.gif" border="0" />'.
get_lang('RemindInactivesLearnersSince'),
$options
);
); */
$el->setSelected(7);
$form->addElement('hidden', 'action', 'add');
@ -374,10 +370,10 @@ if (count($a_students) > 0) {
$extra_field_select = TrackingCourseLog::display_additional_profile_fields();
if (!empty($extra_field_select)) {
echo $extra_field_select;
$html .= $extra_field_select;
}
$form->display();
$html .= $form->return_form();
if ($export_csv) {
$csv_content = array();
@ -473,10 +469,10 @@ if (count($a_students) > 0) {
}
}
// display buttons to un hide hidden columns
echo "<br/><br/><div id='unhideButtons'>";
$html .= "<div id='unhideButtons'>";
$index = 0;
foreach ($headers as $header) {
echo "<span title='".get_lang('DisplayColumn')." ".$header."' class='unhide_button hide' onclick='foldup($index)'>".
$html .= "<span title='".get_lang('DisplayColumn')." ".$header."' class='unhide_button hide' onclick='foldup($index)'>".
Display :: return_icon(
'move.png',
get_lang('DisplayColumn'),
@ -485,15 +481,15 @@ if (count($a_students) > 0) {
)." ".$header."</span>";
$index++;
}
echo "</div>";
$html .= "</div>";
// Display the table
echo "<div id='reporting_table'>";
$table->display();
echo "</div>";
$html .= "<div id='reporting_table'>";
$html .= $table->return_table();
$html .= "</div>";
} else {
echo Display::display_warning_message(get_lang('NoUsersInCourse'));
$html .= Display::display_warning_message(get_lang('NoUsersInCourse'), true, true);
}
echo Display::panel($html, $titleSession);
// Send the csv file if asked.
if ($export_csv) {
$csv_headers = array();

Loading…
Cancel
Save