Minor - format code + fix variable name

pull/2487/head
jmontoyaa 9 years ago
parent 76c9db0d80
commit 4f9f410ded
  1. 2
      main/exercise/oral_expression.class.php
  2. 75
      main/exercise/stats.php

@ -36,7 +36,7 @@ class OralExpression extends Question
* function which redefine Question::createAnswersForm
* @param FormValidator $form
*/
function createAnswersForm($form)
public function createAnswersForm($form)
{
$form->addText(
'weighting',

@ -19,9 +19,16 @@ $sessionId = api_get_session_id();
$courseCode = api_get_course_id();
if (empty($sessionId)) {
$students = CourseManager :: get_student_list_from_course_code($courseCode, false);
$students = CourseManager:: get_student_list_from_course_code(
$courseCode,
false
);
} else {
$students = CourseManager :: get_student_list_from_course_code($courseCode, true, $sessionId);
$students = CourseManager:: get_student_list_from_course_code(
$courseCode,
true,
$sessionId
);
}
$count_students = count($students);
$question_list = $objExercise->get_validated_question_list();
@ -35,7 +42,7 @@ $headers = array(
get_lang('LowestScore'),
get_lang('AverageScore'),
get_lang('HighestScore'),
get_lang('Weighting')
get_lang('Weighting'),
);
if (!empty($question_list)) {
@ -148,17 +155,20 @@ if (!empty($question_list)) {
$answer_item = api_substr($answer_item, 0, api_strlen($answer_item) -1);
$data[$id]['answer'] = $answer_item;
$data[$id]['correct'] = '-';
$count = ExerciseLib::getNumberStudentsFillBlanksAnwserCount($question_id, $exercise_id);
$count = $count[$counter];
$count = isset($count[$counter]) ? $count[$counter] : 0;
$percentange = 0;
$percentage = 0;
if (!empty($count_students)) {
$percentange = $count/$count_students*100;
$percentage = $count/$count_students*100;
}
$data[$id]['attempts'] = Display::bar_progress($percentange, false, $count .' / '.$count_students);
$data[$id]['attempts'] = Display::bar_progress(
$percentage,
false,
$count.' / '.$count_students
);
$id++;
$counter++;
}
@ -173,7 +183,6 @@ if (!empty($question_list)) {
$data[$id]['name'] = '-';
}
$correct = '';
for ($i = 1; $i <= $answer_count; $i++) {
$is_correct_i = $answer->isCorrect($i);
if ($is_correct_i != 0 && $is_correct_i == $answer_id) {
@ -192,11 +201,15 @@ if (!empty($question_list)) {
$sessionId,
MATCHING
);
$percentange = 0;
$percentage = 0;
if (!empty($count_students)) {
$percentange = $count/$count_students*100;
$percentage = $count/$count_students*100;
}
$data[$id]['attempts'] = Display::bar_progress($percentange, false, $count .' / '.$count_students);
$data[$id]['attempts'] = Display::bar_progress(
$percentage,
false,
$count.' / '.$count_students
);
}
break;
case HOT_SPOT:
@ -215,11 +228,15 @@ if (!empty($question_list)) {
$courseCode,
$sessionId
);
$percentange = 0;
$percentage = 0;
if (!empty($count_students)) {
$percentange = $count/$count_students*100;
$percentage = $count/$count_students*100;
}
$data[$id]['attempts'] = Display::bar_progress($percentange, false, $count .' / '.$count_students);
$data[$id]['attempts'] = Display::bar_progress(
$percentage,
false,
$count.' / '.$count_students
);
break;
default:
if ($answer_id == 1) {
@ -237,11 +254,15 @@ if (!empty($question_list)) {
$courseCode,
$sessionId
);
$percentange = 0;
$percentage = 0;
if (!empty($count_students)) {
$percentange = $count/$count_students*100;
$percentage = $count/$count_students*100;
}
$data[$id]['attempts'] = Display::bar_progress($percentange, false, $count .' / '.$count_students);
$data[$id]['attempts'] = Display::bar_progress(
$percentage,
false,
$count.' / '.$count_students
);
}
$id++;
}
@ -269,12 +290,24 @@ foreach ($data as $row_table) {
}
$content .= $table->toHtml();
$interbreadcrumb[] = array("url" => "exercise.php?gradebook=$gradebook&".api_get_cidreq(), "name" => get_lang('Exercises'));
$interbreadcrumb[] = array("url" => "admin.php?exerciseId=$exercise_id&".api_get_cidreq(), "name" => $objExercise->name);
$interbreadcrumb[] = array(
"url" => "exercise.php?gradebook=$gradebook&".api_get_cidreq(),
"name" => get_lang('Exercises'),
);
$interbreadcrumb[] = array(
"url" => "admin.php?exerciseId=$exercise_id&".api_get_cidreq(),
"name" => $objExercise->name,
);
$tpl = new Template(get_lang('ReportByQuestion'));
$actions = '<a href="exercise_report.php?exerciseId='.intval($_GET['exerciseId']).'&'.api_get_cidreq().'">' .
Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
Display:: return_icon(
'back.png',
get_lang('GoBackToQuestionList'),
'',
ICON_SIZE_MEDIUM
)
.'</a>';
$actions = Display::div($actions, array('class'=> 'actions'));
$content = $actions.$content;
$tpl->assign('content', $content);

Loading…
Cancel
Save