Adding survey list in student reporting page (only for courses) see BT#3139

skala
Julio Montoya 13 years ago
parent e60da24ebd
commit f51bfa9497
  1. 19
      main/mySpace/index.php
  2. 500
      main/mySpace/myStudents.php
  3. 4
      main/mySpace/myspace.lib.php
  4. 28
      main/survey/survey.lib.php

@ -25,6 +25,9 @@ $nameTools = get_lang('MySpace');
$user_id = api_get_user_id(); $user_id = api_get_user_id();
$is_coach = api_is_coach($_GET['session_id']); // This is used? $is_coach = api_is_coach($_GET['session_id']); // This is used?
$session_id = isset($_GET['session_id']) ? intval($_GET['session_id']) : 0;
$is_platform_admin = api_is_platform_admin(); $is_platform_admin = api_is_platform_admin();
$is_drh = api_is_drh(); $is_drh = api_is_drh();
$is_session_admin = api_is_session_admin(); $is_session_admin = api_is_session_admin();
@ -122,13 +125,8 @@ if ($is_platform_admin) {
$title = get_lang('CoachList'); $title = get_lang('CoachList');
$menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('TeacherInterface'), array(), 32), api_get_self().'?view=teacher'); $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('TeacherInterface'), array(), 32), api_get_self().'?view=teacher');
$menu_items[] = Display::url(Display::return_icon('star_na.png', get_lang('AdminInterface'), array(), 32), api_get_self().'?view=admin'); $menu_items[] = Display::url(Display::return_icon('star_na.png', get_lang('AdminInterface'), array(), 32), api_get_self().'?view=admin');
$menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32), api_get_path(WEB_CODE_PATH).'tracking/exams.php'); $menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32), api_get_path(WEB_CODE_PATH).'tracking/exams.php');
//$menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('CurrentCoursesReport'), array(), 32), api_get_path(WEB_CODE_PATH).'mySpace/current_courses.php');
//$menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('CurrentCoursesReport'), array(), 32), api_get_path(WEB_CODE_PATH).'mySpace/current_courses.php');
} else { } else {
$menu_items[] = Display::return_icon('teacher_na.png', get_lang('TeacherInterface'), array(), 32); $menu_items[] = Display::return_icon('teacher_na.png', get_lang('TeacherInterface'), array(), 32);
$menu_items[] = Display::url(Display::return_icon('star.png', get_lang('AdminInterface'), array(), 32), api_get_self().'?view=admin'); $menu_items[] = Display::url(Display::return_icon('star.png', get_lang('AdminInterface'), array(), 32), api_get_self().'?view=admin');
@ -334,11 +332,12 @@ if (empty($session_id)) {
$nb_posts = null; $nb_posts = null;
} }
} else { } else {
$courses = Tracking::get_courses_followed_by_coach($user_id, $session_id); $courses = Tracking::get_courses_followed_by_coach($user_id, $session_id);
//Courses for the user
$count_courses = count($courses);
} }
if ($count_courses || $count_sessions) { if ($count_courses || $count_sessions) {
//If we are in course //If we are in course
if (empty($session_id)) { if (empty($session_id)) {

@ -6,7 +6,7 @@
*/ */
// name of the language file that needs to be included // name of the language file that needs to be included
$language_file = array('registration', 'index', 'tracking', 'exercice', 'admin', 'gradebook'); $language_file = array('registration', 'index', 'tracking', 'exercice', 'admin', 'gradebook', 'survey');
$cidReset = true; $cidReset = true;
@ -21,6 +21,8 @@ require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/linkfactory.class.php
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php'; require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php';
require_once api_get_path(LIBRARY_PATH).'attendance.lib.php'; require_once api_get_path(LIBRARY_PATH).'attendance.lib.php';
require_once api_get_path(SYS_CODE_PATH).'survey/survey.lib.php';
$htmlHeadXtra[] = '<script type="text/javascript"> $htmlHeadXtra[] = '<script type="text/javascript">
function show_image(image,width,height) { function show_image(image,width,height) {
@ -560,7 +562,7 @@ if (empty($_GET['details'])) {
$attendance = new Attendance(); $attendance = new Attendance();
foreach ($courses_in_session as $key => $courses) { foreach ($courses_in_session as $key => $courses) {
$session_id = $key; $session_id = $key;
$session_info = api_get_session_info($session_id); $session_info = api_get_session_info($session_id);
$session_name = $session_info['name']; $session_name = $session_info['name'];
$date_start = ''; $date_start = '';
@ -598,71 +600,72 @@ if (empty($_GET['details'])) {
<th>'.get_lang('Details').'</th> <th>'.get_lang('Details').'</th>
</tr>'; </tr>';
if (!empty($courses)) { if (!empty($courses)) {
foreach ($courses as $course_code) { foreach ($courses as $course_code) {
if (CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) {
$course_info = CourseManager :: get_course_information($course_code); if (CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) {
$course_info = CourseManager :: get_course_information($course_code);
$time_spent_on_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($info_user['user_id'], $course_code, $session_id));
$time_spent_on_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($info_user['user_id'], $course_code, $session_id));
// get average of faults in attendances by student
$results_faults_avg = $attendance->get_faults_average_by_course($student_id, $course_code, $session_id); // get average of faults in attendances by student
if (!empty($results_faults_avg['total'])) { $results_faults_avg = $attendance->get_faults_average_by_course($student_id, $course_code, $session_id);
if (api_is_drh()) { if (!empty($results_faults_avg['total'])) {
$attendances_faults_avg = '<a title="'.get_lang('GoAttendance').'" href="'.api_get_path(WEB_CODE_PATH).'attendance/index.php?cidReq='.$course_code.'&id_session='.$session_id.'&student_id='.$student_id.'">'.$results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)</a>'; if (api_is_drh()) {
} else { $attendances_faults_avg = '<a title="'.get_lang('GoAttendance').'" href="'.api_get_path(WEB_CODE_PATH).'attendance/index.php?cidReq='.$course_code.'&id_session='.$session_id.'&student_id='.$student_id.'">'.$results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)</a>';
$attendances_faults_avg = $results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)'; } else {
} $attendances_faults_avg = $results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)';
} else { }
$attendances_faults_avg = '0/0 (0%)'; } else {
} $attendances_faults_avg = '0/0 (0%)';
}
// get evaluatios by student
// get evaluatios by student
$cats = Category::load(null, null, $course_code, null, null, $session_id);
$cats = Category::load(null, null, $course_code, null, null, $session_id);
$scoretotal = array();
if (isset($cats) && isset($cats[0])) { $scoretotal = array();
if (!empty($session_id)) { if (isset($cats) && isset($cats[0])) {
$scoretotal= $cats[0]->calc_score($student_id, $course_code, $session_id); if (!empty($session_id)) {
} else { $scoretotal= $cats[0]->calc_score($student_id, $course_code, $session_id);
$scoretotal= $cats[0]->calc_score($student_id, $course_code); } else {
} $scoretotal= $cats[0]->calc_score($student_id, $course_code);
} }
}
$scoretotal_display = '0/0 (0%)';
if (!empty($scoretotal)) { $scoretotal_display = '0/0 (0%)';
$scoretotal_display = round($scoretotal[0],2).'/'.round($scoretotal[1],2).'('.round(($scoretotal[0] / $scoretotal[1]) * 100,2) . ' %)'; if (!empty($scoretotal)) {
} $scoretotal_display = round($scoretotal[0],2).'/'.round($scoretotal[1],2).'('.round(($scoretotal[0] / $scoretotal[1]) * 100,2) . ' %)';
}
$progress = Tracking::get_avg_student_progress($info_user['user_id'], $course_code, null, $session_id);
$score = Tracking :: get_avg_student_score($info_user['user_id'], $course_code, null, $session_id); $progress = Tracking::get_avg_student_progress($info_user['user_id'], $course_code, null, $session_id);
$progress = empty($progress) ? '0%' : $progress.'%'; $score = Tracking :: get_avg_student_score($info_user['user_id'], $course_code, null, $session_id);
$score = empty($score) ? '0%' : $score.'%'; $progress = empty($progress) ? '0%' : $progress.'%';
$score = empty($score) ? '0%' : $score.'%';
$csv_content[] = array (
$session_name, $csv_content[] = array (
$course_info['title'], $session_name,
$time_spent_on_course, $course_info['title'],
$progress, $time_spent_on_course,
$score, $progress,
$attendances_faults_avg, $score,
$scoretotal_display $attendances_faults_avg,
); $scoretotal_display
);
echo '<tr>
<td align="right">'.$course_info['title'].'</td> echo '<tr>
<td align="right">'.$time_spent_on_course .'</td> <td align="right">'.$course_info['title'].'</td>
<td align="right">'.$progress.'</td> <td align="right">'.$time_spent_on_course .'</td>
<td align="right">'.$score.'</td> <td align="right">'.$progress.'</td>
<td align="right">'.$attendances_faults_avg.'</td> <td align="right">'.$score.'</td>
<td align="right">'.$scoretotal_display.'</td>'; <td align="right">'.$attendances_faults_avg.'</td>
<td align="right">'.$scoretotal_display.'</td>';
if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
echo '<td align="center" width="10"><a href="'.api_get_self().'?student='.$info_user['user_id'].'&details=true&course='.$course_info['code'].'&id_coach='.Security::remove_XSS($_GET['id_coach']).'&origin='.Security::remove_XSS($_GET['origin']).'&id_session='.$session_id.'#infosStudent"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a></td>'; if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
} else { echo '<td align="center" width="10"><a href="'.api_get_self().'?student='.$info_user['user_id'].'&details=true&course='.$course_info['code'].'&id_coach='.Security::remove_XSS($_GET['id_coach']).'&origin='.Security::remove_XSS($_GET['origin']).'&id_session='.$session_id.'#infosStudent"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a></td>';
echo '<td align="center" width="10"><a href="'.api_get_self().'?student='.$info_user['user_id'].'&details=true&course='.$course_info['code'].'&origin='.Security::remove_XSS($_GET['origin']).'&id_session='.$session_id.'#infosStudent"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a></td>'; } else {
} echo '<td align="center" width="10"><a href="'.api_get_self().'?student='.$info_user['user_id'].'&details=true&course='.$course_info['code'].'&origin='.Security::remove_XSS($_GET['origin']).'&id_session='.$session_id.'#infosStudent"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a></td>';
}
echo '</tr>'; echo '</tr>';
} }
} }
@ -675,164 +678,164 @@ if (empty($_GET['details'])) {
$csv_content[] = array (); $csv_content[] = array ();
$csv_content[] = array (str_replace('&nbsp;', '', $table_title)); $csv_content[] = array (str_replace('&nbsp;', '', $table_title));
?> ?>
<br /> <br />
<!-- LPs--> <!-- LPs-->
<table class="data_table"> <table class="data_table">
<tr> <tr>
<th><?php echo get_lang('Learnpaths');?></th> <th><?php echo get_lang('Learnpaths');?></th>
<th><?php echo get_lang('Time'); Display :: display_icon('info3.gif', get_lang('TotalTimeByCourse'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?></th> <th><?php echo get_lang('Time'); Display :: display_icon('info3.gif', get_lang('TotalTimeByCourse'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?></th>
<th><?php echo get_lang('AverageScore'); Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInAllAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th> <th><?php echo get_lang('AverageScore'); Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInAllAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th>
<th><?php echo get_lang('LatestAttemptAverageScore'); Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInTheLatestAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th> <th><?php echo get_lang('LatestAttemptAverageScore'); Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInTheLatestAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th>
<th><?php echo get_lang('Progress'); Display :: display_icon('info3.gif', get_lang('LPProgressScore'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th> <th><?php echo get_lang('Progress'); Display :: display_icon('info3.gif', get_lang('LPProgressScore'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
<th><?php echo get_lang('LastConnexion'); Display :: display_icon('info3.gif', get_lang('LastTimeTheCourseWasUsed'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th> <th><?php echo get_lang('LastConnexion'); Display :: display_icon('info3.gif', get_lang('LastTimeTheCourseWasUsed'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
<?php <?php
echo '<th>'.get_lang('Details').'</th>'; echo '<th>'.get_lang('Details').'</th>';
if (api_is_course_admin()) { if (api_is_course_admin()) {
echo '<th>'.get_lang('ResetLP').'</th>'; echo '<th>'.get_lang('ResetLP').'</th>';
} }
?> ?>
</tr> </tr>
<?php <?php
$headerLearnpath = array ( $headerLearnpath = array (
get_lang('Learnpath'), get_lang('Learnpath'),
get_lang('Time'), get_lang('Time'),
get_lang('Progress'), get_lang('Progress'),
get_lang('LastConnexion') get_lang('LastConnexion')
); );
$t_lp = Database :: get_course_table(TABLE_LP_MAIN, $info_course['db_name']); $t_lp = Database :: get_course_table(TABLE_LP_MAIN, $info_course['db_name']);
// csv export headers // csv export headers
$csv_content[] = array (); $csv_content[] = array ();
$csv_content[] = array ( $csv_content[] = array (
get_lang('Learnpath', ''), get_lang('Learnpath', ''),
get_lang('Time', ''), get_lang('Time', ''),
get_lang('AverageScore', ''), get_lang('AverageScore', ''),
get_lang('LatestScore', ''), get_lang('LatestScore', ''),
get_lang('Progress', ''), get_lang('Progress', ''),
get_lang('LastConnexion', '') get_lang('LastConnexion', '')
); );
if (empty($session_id)) { if (empty($session_id)) {
$sql_lp = " SELECT lp.name, lp.id FROM $t_lp lp WHERE session_id = 0 AND c_id = {$info_course['real_id']} ORDER BY lp.display_order"; $sql_lp = " SELECT lp.name, lp.id FROM $t_lp lp WHERE session_id = 0 AND c_id = {$info_course['real_id']} ORDER BY lp.display_order";
} else { } else {
$sql_lp = " SELECT lp.name, lp.id FROM $t_lp lp WHERE c_id = {$info_course['real_id']} ORDER BY lp.display_order"; $sql_lp = " SELECT lp.name, lp.id FROM $t_lp lp WHERE c_id = {$info_course['real_id']} ORDER BY lp.display_order";
} }
$rs_lp = Database::query($sql_lp); $rs_lp = Database::query($sql_lp);
$token = Security::get_token(); $token = Security::get_token();
if (Database :: num_rows($rs_lp) > 0) { if (Database :: num_rows($rs_lp) > 0) {
$i = 0; $i = 0;
while ($learnpath = Database :: fetch_array($rs_lp)) { while ($learnpath = Database :: fetch_array($rs_lp)) {
$lp_id = intval($learnpath['id']); $lp_id = intval($learnpath['id']);
$lp_name = $learnpath['name']; $lp_name = $learnpath['name'];
$any_result = false; $any_result = false;
// Get progress in lp // Get progress in lp
$progress = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id); $progress = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id);
if ($progress === null) { if ($progress === null) {
$progress = '0%'; $progress = '0%';
} else { } else {
$any_result = true; $any_result = true;
} }
// Get time in lp // Get time in lp
$total_time = Tracking::get_time_spent_in_lp($student_id, $course_code, array($lp_id),$session_id); $total_time = Tracking::get_time_spent_in_lp($student_id, $course_code, array($lp_id),$session_id);
if (!empty($total_time)) $any_result = true; if (!empty($total_time)) $any_result = true;
// Get last connection time in lp // Get last connection time in lp
$start_time = Tracking::get_last_connection_time_in_lp($student_id, $course_code, $lp_id, $session_id); $start_time = Tracking::get_last_connection_time_in_lp($student_id, $course_code, $lp_id, $session_id);
if (!empty($start_time)) { if (!empty($start_time)) {
$start_time = api_convert_and_format_date($start_time, DATE_TIME_FORMAT_LONG); $start_time = api_convert_and_format_date($start_time, DATE_TIME_FORMAT_LONG);
} else { } else {
$start_time = '-'; $start_time = '-';
}
if (!empty($total_time)) $any_result = true;
// Quizz in lp
$score = Tracking::get_avg_student_score($student_id, $course_code, array($lp_id),$session_id);
// Latest exercise results in a LP
$score_latest = Tracking :: get_avg_student_score($student_id, $course_code, array($lp_id),$session_id, false, true);
if ($i % 2 == 0) $css_class = "row_even";
else $css_class = "row_odd";
$i++;
// csv export content
$csv_content[] = array (
api_html_entity_decode(stripslashes($lp_name), ENT_QUOTES, $charset),
api_time_to_hms($total_time),
$score . '%',
$score_latest . '%',
$progress.'%',
$start_time
);
echo '<tr class="'.$css_class.'">';
echo Display::tag('td', stripslashes($lp_name));
echo Display::tag('td', api_time_to_hms($total_time), array('align'=>'center'));
if (!is_null($score)) {
if (is_numeric($score)) {
$score = $score.'%';
} }
}
if (!empty($total_time)) $any_result = true; echo Display::tag('td', $score, array('align'=>'center'));
// Quizz in lp if (!is_null($score_latest)) {
$score = Tracking::get_avg_student_score($student_id, $course_code, array($lp_id),$session_id); if (is_numeric($score_latest)) {
$score_latest = $score_latest.'%';
// Latest exercise results in a LP }
$score_latest = Tracking :: get_avg_student_score($student_id, $course_code, array($lp_id),$session_id, false, true); }
echo Display::tag('td', $score_latest, array('align'=>'center'));
if ($i % 2 == 0) $css_class = "row_even";
else $css_class = "row_odd"; if (is_numeric($progress)) {
$progress = $progress.'%';
$i++; } else {
$progress = '-';
// csv export content }
$csv_content[] = array (
api_html_entity_decode(stripslashes($lp_name), ENT_QUOTES, $charset), echo Display::tag('td', $progress, array('align'=>'center'));
api_time_to_hms($total_time), //Do not change with api_convert_and_format_date, because this value came from the lp_item_view table
$score . '%', //which implies several other changes not a priority right now
$score_latest . '%', echo Display::tag('td', $start_time, array('align'=>'center'));
$progress.'%',
$start_time
); if ($any_result === true) {
$from = '';
echo '<tr class="'.$css_class.'">'; if ($from_myspace) {
$from ='&from=myspace';
echo Display::tag('td', stripslashes($lp_name)); }
echo Display::tag('td', api_time_to_hms($total_time), array('align'=>'center')); $link = Display::url('<img src="../img/2rightarrow.gif" border="0" />','lp_tracking.php?course='.Security::remove_XSS($_GET['course']).$from.'&origin='.Security::remove_XSS($_GET['origin']).'&lp_id='.$learnpath['id'].'&student_id='.$info_user['user_id'].'&id_session='.$session_id);
echo Display::tag('td', $link, array('align'=>'center'));
if (!is_null($score)) { }
if (is_numeric($score)) {
$score = $score.'%'; if (api_is_course_admin()) {
} echo '<td align="center">';
} if($any_result === true) {
echo Display::tag('td', $score, array('align'=>'center')); echo '<a href="myStudents.php?action=reset_lp&sec_token='.$token.'&course='.Security::remove_XSS($_GET['course']).'&details='.Security::remove_XSS($_GET['details']).'&origin='.Security::remove_XSS($_GET['origin']).'&lp_id='.$learnpath['id'].'&student='.$info_user['user_id'].'&details=true&id_session='.Security::remove_XSS($_GET['id_session']).'">';
echo Display::return_icon('clean.png',get_lang('Clean'),'','22').'</a>';
if (!is_null($score_latest)) { echo '</a>';
if (is_numeric($score_latest)) { }
$score_latest = $score_latest.'%'; echo '</td>';
} echo '</tr>';
} }
echo Display::tag('td', $score_latest, array('align'=>'center')); $data_learnpath[$i][] = $lp_name;
$data_learnpath[$i][] = $progress . '%';
if (is_numeric($progress)) { }
$progress = $progress.'%'; } else {
} else { echo '<tr><td colspan="6">'.get_lang('NoLearnpath').'</td></tr>';
$progress = '-'; }
} ?>
echo Display::tag('td', $progress, array('align'=>'center'));
//Do not change with api_convert_and_format_date, because this value came from the lp_item_view table
//which implies several other changes not a priority right now
echo Display::tag('td', $start_time, array('align'=>'center'));
if ($any_result === true) {
$from = '';
if ($from_myspace) {
$from ='&from=myspace';
}
$link = Display::url('<img src="../img/2rightarrow.gif" border="0" />','lp_tracking.php?course='.Security::remove_XSS($_GET['course']).$from.'&origin='.Security::remove_XSS($_GET['origin']).'&lp_id='.$learnpath['id'].'&student_id='.$info_user['user_id'].'&id_session='.$session_id);
echo Display::tag('td', $link, array('align'=>'center'));
}
if (api_is_course_admin()) {
echo '<td align="center">';
if($any_result === true) {
echo '<a href="myStudents.php?action=reset_lp&sec_token='.$token.'&course='.Security::remove_XSS($_GET['course']).'&details='.Security::remove_XSS($_GET['details']).'&origin='.Security::remove_XSS($_GET['origin']).'&lp_id='.$learnpath['id'].'&student='.$info_user['user_id'].'&details=true&id_session='.Security::remove_XSS($_GET['id_session']).'">';
echo Display::return_icon('clean.png',get_lang('Clean'),'','22').'</a>';
echo '</a>';
}
echo '</td>';
echo '</tr>';
}
$data_learnpath[$i][] = $lp_name;
$data_learnpath[$i][] = $progress . '%';
}
} else {
echo '<tr><td colspan="6">'.get_lang('NoLearnpath').'</td></tr>';
}
?>
</table> </table>
<!-- line about exercises --> <!-- line about exercises -->
@ -853,7 +856,7 @@ if (empty($_GET['details'])) {
get_lang('Attempts') get_lang('Attempts')
); );
$t_quiz = Database :: get_course_table(TABLE_QUIZ_TEST, $info_course['db_name']); $t_quiz = Database :: get_course_table(TABLE_QUIZ_TEST);
$sql_exercices = "SELECT quiz.title, id FROM " . $t_quiz . " AS quiz $sql_exercices = "SELECT quiz.title, id FROM " . $t_quiz . " AS quiz
WHERE quiz.c_id = ".$info_course['real_id']." AND WHERE quiz.c_id = ".$info_course['real_id']." AND
active='1' AND active='1' AND
@ -917,7 +920,52 @@ if (empty($_GET['details'])) {
echo '<tr><td colspan="6">'.get_lang('NoExercise').'</td></tr>'; echo '<tr><td colspan="6">'.get_lang('NoExercise').'</td></tr>';
} }
echo '</table>'; echo '</table>';
//@when using sessions we do not show the survey list
if (empty($session_id)) {
$survey_list = survey_manager::get_surveys($course_code, $session_id);
$survey_data = array();
foreach($survey_list as $survey) {
$user_list = survey_manager::get_people_who_filled_survey($survey['survey_id'], false, $info_course['real_id']);
$survey_done = Display::return_icon("accept_na.png", get_lang('NoAnswer'), array(), 22);
if (in_array($student_id, $user_list)) {
$survey_done = Display::return_icon("accept.png", get_lang('Answered'), array(), 22);
}
$data = array('title' => $survey['title'], 'done' => $survey_done);
$survey_data[] = $data;
}
if (!empty($survey_list)) {
$table = new HTML_Table(array('class' => 'data_table'));
$header_names = array(get_lang('Survey'), get_lang('Answered'));
$row = 0;
$column = 0;
foreach ($header_names as $item) {
$table->setHeaderContents($row, $column, $item);
$column++;
}
$row = 1;
if (!empty($survey_data)) {
foreach ($survey_data as $data) {
$column = 0;
$table->setCellContents($row, $column, $data);
//$table->setRowAttributes($row, 'style="text-align:center"');
$class = 'class="row_odd"';
if($row % 2) {
$class = 'class="row_even"';
}
$table->setRowAttributes($row, $class, true);
$column++;
$row++;
}
}
echo $table->toHtml();
}
}
// line about other tools // line about other tools
echo '<table class="data_table">'; echo '<table class="data_table">';

@ -1301,7 +1301,9 @@ class MySpace {
$table_row[] = $avg_assignments_in_course; $table_row[] = $avg_assignments_in_course;
//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.'&studentlist=true&from=myspace&id_session='.$session_id.'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a></center>'; $table_row[] = '<center><a href="../tracking/courseLog.php?cidReq='.$course_code.'&studentlist=true&from=myspace&id_session='.$session_id.'">
<img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>
</center>';
$csv_content[] = array( $csv_content[] = array(
api_html_entity_decode($row_course[1], ENT_QUOTES, $charset), api_html_entity_decode($row_course[1], ENT_QUOTES, $charset),
$nb_students_in_course, $nb_students_in_course,

@ -26,6 +26,17 @@ $htmlHeadXtra[] = '<script type="text/javascript" language="javascript">
* @package chamilo.survey * @package chamilo.survey
*/ */
class survey_manager { class survey_manager {
function get_surveys($course_code, $session_id = 0) {
$table_survey = Database :: get_course_table(TABLE_SURVEY);
$course_info = api_get_course_info($course_code);
$session_condition = api_get_session_condition($session_id, true, true);
$sql = "SELECT * FROM $table_survey WHERE c_id = {$course_info['real_id']} $session_condition ";
$result = Database::query($sql);
$result = Database::store_result($result, 'ASSOC');
return $result;
}
/*** /***
* SYRVEY FUNCTIONS * SYRVEY FUNCTIONS
@ -1170,7 +1181,7 @@ class survey_manager {
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version February 2007 * @version February 2007
*/ */
function get_people_who_filled_survey($survey_id, $all_user_info = false) { function get_people_who_filled_survey($survey_id, $all_user_info = false, $course_id = null) {
global $_course; global $_course;
// Database table definition // Database table definition
@ -1182,19 +1193,23 @@ class survey_manager {
// Getting the survey information // Getting the survey information
$survey_data = survey_manager::get_survey($survey_id); $survey_data = survey_manager::get_survey($survey_id);
if (empty($course_id)) {
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
} else {
$course_id = intval($course_id);
}
if ($all_user_info) { if ($all_user_info) {
$order_clause = api_sort_by_first_name() ? ' ORDER BY user.firstname, user.lastname' : ' ORDER BY user.lastname, user.firstname'; $order_clause = api_sort_by_first_name() ? ' ORDER BY user.firstname, user.lastname' : ' ORDER BY user.lastname, user.firstname';
$sql = "SELECT DISTINCT answered_user.user as invited_user, user.firstname, user.lastname, user.user_id $sql = "SELECT DISTINCT answered_user.user as invited_user, user.firstname, user.lastname, user.user_id
FROM $table_survey_answer answered_user FROM $table_survey_answer answered_user
LEFT JOIN $table_user as user ON answered_user.user = user.user_id LEFT JOIN $table_user as user ON answered_user.user = user.user_id
WHERE answered_user.c_id = $course_id AND WHERE answered_user.c_id = $course_id AND
survey_id= '".Database::escape_string($survey_data['survey_id'])."'". survey_id= '".Database::escape_string($survey_data['survey_id'])."' ".
$order_clause; $order_clause;
} else { } else {
$sql = "SELECT DISTINCT user FROM $table_survey_answer WHERE survey_id= '".Database::escape_string($survey_data['survey_id'])."'"; $sql = "SELECT DISTINCT user FROM $table_survey_answer
WHERE c_id = $course_id AND survey_id= '".Database::escape_string($survey_data['survey_id'])."' ";
} }
$res = Database::query($sql); $res = Database::query($sql);
@ -2570,7 +2585,6 @@ class SurveyUtil {
echo get_lang('NextQuestion').' '.Display::return_icon('action_next.png', get_lang('NextQuestion'), array('align' => 'middle')); echo get_lang('NextQuestion').' '.Display::return_icon('action_next.png', get_lang('NextQuestion'), array('align' => 'middle'));
} }
} }
echo $question['survey_question']; echo $question['survey_question'];

Loading…
Cancel
Save