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();
$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_drh = api_is_drh();
$is_session_admin = api_is_session_admin();
@ -122,13 +125,8 @@ if ($is_platform_admin) {
$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('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('CurrentCoursesReport'), array(), 32), api_get_path(WEB_CODE_PATH).'mySpace/current_courses.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');
} else {
$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');
@ -334,11 +332,12 @@ if (empty($session_id)) {
$nb_posts = null;
}
} 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 we are in course
if (empty($session_id)) {

@ -6,7 +6,7 @@
*/
// 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;
@ -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(LIBRARY_PATH).'attendance.lib.php';
require_once api_get_path(SYS_CODE_PATH).'survey/survey.lib.php';
$htmlHeadXtra[] = '<script type="text/javascript">
function show_image(image,width,height) {
@ -560,7 +562,7 @@ if (empty($_GET['details'])) {
$attendance = new Attendance();
foreach ($courses_in_session as $key => $courses) {
$session_id = $key;
$session_id = $key;
$session_info = api_get_session_info($session_id);
$session_name = $session_info['name'];
$date_start = '';
@ -598,71 +600,72 @@ if (empty($_GET['details'])) {
<th>'.get_lang('Details').'</th>
</tr>';
if (!empty($courses)) {
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);
$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);
if (!empty($results_faults_avg['total'])) {
if (api_is_drh()) {
$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>';
} else {
$attendances_faults_avg = $results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)';
}
} else {
$attendances_faults_avg = '0/0 (0%)';
}
// get evaluatios by student
$cats = Category::load(null, null, $course_code, null, null, $session_id);
$scoretotal = array();
if (isset($cats) && isset($cats[0])) {
if (!empty($session_id)) {
$scoretotal= $cats[0]->calc_score($student_id, $course_code, $session_id);
} else {
$scoretotal= $cats[0]->calc_score($student_id, $course_code);
}
}
$scoretotal_display = '0/0 (0%)';
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 = empty($progress) ? '0%' : $progress.'%';
$score = empty($score) ? '0%' : $score.'%';
$csv_content[] = array (
$session_name,
$course_info['title'],
$time_spent_on_course,
$progress,
$score,
$attendances_faults_avg,
$scoretotal_display
);
echo '<tr>
<td align="right">'.$course_info['title'].'</td>
<td align="right">'.$time_spent_on_course .'</td>
<td align="right">'.$progress.'</td>
<td align="right">'.$score.'</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>';
} 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>';
}
if (!empty($courses)) {
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);
$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);
if (!empty($results_faults_avg['total'])) {
if (api_is_drh()) {
$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>';
} else {
$attendances_faults_avg = $results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)';
}
} else {
$attendances_faults_avg = '0/0 (0%)';
}
// get evaluatios by student
$cats = Category::load(null, null, $course_code, null, null, $session_id);
$scoretotal = array();
if (isset($cats) && isset($cats[0])) {
if (!empty($session_id)) {
$scoretotal= $cats[0]->calc_score($student_id, $course_code, $session_id);
} else {
$scoretotal= $cats[0]->calc_score($student_id, $course_code);
}
}
$scoretotal_display = '0/0 (0%)';
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 = empty($progress) ? '0%' : $progress.'%';
$score = empty($score) ? '0%' : $score.'%';
$csv_content[] = array (
$session_name,
$course_info['title'],
$time_spent_on_course,
$progress,
$score,
$attendances_faults_avg,
$scoretotal_display
);
echo '<tr>
<td align="right">'.$course_info['title'].'</td>
<td align="right">'.$time_spent_on_course .'</td>
<td align="right">'.$progress.'</td>
<td align="right">'.$score.'</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>';
} 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>';
}
}
@ -675,164 +678,164 @@ if (empty($_GET['details'])) {
$csv_content[] = array ();
$csv_content[] = array (str_replace('&nbsp;', '', $table_title));
?>
<br />
<!-- LPs-->
<table class="data_table">
<tr>
<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('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('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>
<?php
echo '<th>'.get_lang('Details').'</th>';
if (api_is_course_admin()) {
echo '<th>'.get_lang('ResetLP').'</th>';
}
?>
</tr>
<?php
$headerLearnpath = array (
get_lang('Learnpath'),
get_lang('Time'),
get_lang('Progress'),
get_lang('LastConnexion')
);
$t_lp = Database :: get_course_table(TABLE_LP_MAIN, $info_course['db_name']);
// csv export headers
$csv_content[] = array ();
$csv_content[] = array (
get_lang('Learnpath', ''),
get_lang('Time', ''),
get_lang('AverageScore', ''),
get_lang('LatestScore', ''),
get_lang('Progress', ''),
get_lang('LastConnexion', '')
);
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";
} else {
$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);
$token = Security::get_token();
if (Database :: num_rows($rs_lp) > 0) {
$i = 0;
while ($learnpath = Database :: fetch_array($rs_lp)) {
$lp_id = intval($learnpath['id']);
$lp_name = $learnpath['name'];
$any_result = false;
// Get progress in lp
$progress = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id);
if ($progress === null) {
$progress = '0%';
} else {
$any_result = true;
}
// Get time in lp
$total_time = Tracking::get_time_spent_in_lp($student_id, $course_code, array($lp_id),$session_id);
if (!empty($total_time)) $any_result = true;
// Get last connection time in lp
$start_time = Tracking::get_last_connection_time_in_lp($student_id, $course_code, $lp_id, $session_id);
if (!empty($start_time)) {
$start_time = api_convert_and_format_date($start_time, DATE_TIME_FORMAT_LONG);
} else {
$start_time = '-';
<br />
<!-- LPs-->
<table class="data_table">
<tr>
<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('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('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>
<?php
echo '<th>'.get_lang('Details').'</th>';
if (api_is_course_admin()) {
echo '<th>'.get_lang('ResetLP').'</th>';
}
?>
</tr>
<?php
$headerLearnpath = array (
get_lang('Learnpath'),
get_lang('Time'),
get_lang('Progress'),
get_lang('LastConnexion')
);
$t_lp = Database :: get_course_table(TABLE_LP_MAIN, $info_course['db_name']);
// csv export headers
$csv_content[] = array ();
$csv_content[] = array (
get_lang('Learnpath', ''),
get_lang('Time', ''),
get_lang('AverageScore', ''),
get_lang('LatestScore', ''),
get_lang('Progress', ''),
get_lang('LastConnexion', '')
);
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";
} else {
$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);
$token = Security::get_token();
if (Database :: num_rows($rs_lp) > 0) {
$i = 0;
while ($learnpath = Database :: fetch_array($rs_lp)) {
$lp_id = intval($learnpath['id']);
$lp_name = $learnpath['name'];
$any_result = false;
// Get progress in lp
$progress = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id);
if ($progress === null) {
$progress = '0%';
} else {
$any_result = true;
}
// Get time in lp
$total_time = Tracking::get_time_spent_in_lp($student_id, $course_code, array($lp_id),$session_id);
if (!empty($total_time)) $any_result = true;
// Get last connection time in lp
$start_time = Tracking::get_last_connection_time_in_lp($student_id, $course_code, $lp_id, $session_id);
if (!empty($start_time)) {
$start_time = api_convert_and_format_date($start_time, DATE_TIME_FORMAT_LONG);
} else {
$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;
// 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.'%';
}
}
echo Display::tag('td', $score, array('align'=>'center'));
if (!is_null($score_latest)) {
if (is_numeric($score_latest)) {
$score_latest = $score_latest.'%';
}
}
echo Display::tag('td', $score_latest, array('align'=>'center'));
if (is_numeric($progress)) {
$progress = $progress.'%';
} else {
$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>';
}
?>
}
echo Display::tag('td', $score, array('align'=>'center'));
if (!is_null($score_latest)) {
if (is_numeric($score_latest)) {
$score_latest = $score_latest.'%';
}
}
echo Display::tag('td', $score_latest, array('align'=>'center'));
if (is_numeric($progress)) {
$progress = $progress.'%';
} else {
$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>
<!-- line about exercises -->
@ -853,7 +856,7 @@ if (empty($_GET['details'])) {
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
WHERE quiz.c_id = ".$info_course['real_id']." AND
active='1' AND
@ -917,7 +920,52 @@ if (empty($_GET['details'])) {
echo '<tr><td colspan="6">'.get_lang('NoExercise').'</td></tr>';
}
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
echo '<table class="data_table">';

@ -1301,7 +1301,9 @@ class MySpace {
$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
$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(
api_html_entity_decode($row_course[1], ENT_QUOTES, $charset),
$nb_students_in_course,

@ -26,6 +26,17 @@ $htmlHeadXtra[] = '<script type="text/javascript" language="javascript">
* @package chamilo.survey
*/
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
@ -1170,7 +1181,7 @@ class survey_manager {
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @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;
// Database table definition
@ -1182,19 +1193,23 @@ class survey_manager {
// Getting the survey information
$survey_data = survey_manager::get_survey($survey_id);
$course_id = api_get_course_int_id();
if (empty($course_id)) {
$course_id = api_get_course_int_id();
} else {
$course_id = intval($course_id);
}
if ($all_user_info) {
$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
FROM $table_survey_answer answered_user
LEFT JOIN $table_user as user ON answered_user.user = user.user_id
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;
} 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);
@ -2570,7 +2585,6 @@ class SurveyUtil {
echo get_lang('NextQuestion').' '.Display::return_icon('action_next.png', get_lang('NextQuestion'), array('align' => 'middle'));
}
}
echo $question['survey_question'];

Loading…
Cancel
Save