Improving new overview exercise page

skala
Julio Montoya 14 years ago
parent c26dcd29b4
commit fa56ac9cf7
  1. 62
      main/css/base.css
  2. 12
      main/css/base_chamilo.css
  3. 5
      main/exercice/exercice.php
  4. 6
      main/exercice/exercise.class.php
  5. 2
      main/exercice/exercise_show.php
  6. 2
      main/exercice/exercise_submit.php
  7. 86
      main/exercice/overview.php
  8. 62
      main/exercice/result.php

@ -649,12 +649,15 @@ button:hover {
font: 14px/100% Arial, Helvetica, sans-serif;
padding: .5em 2em .55em;
text-shadow: 0 1px 1px rgba(0,0,0,.3);
-webkit-border-radius: .5em;
-moz-border-radius: .5em;
border-radius: .5em;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
box-shadow: 0 1px 2px rgba(0,0,0,.2);
-webkit-box-shadow : 0 1px 2px rgba(0,0,0,.2);
-moz-box-shadow : 0 1px 2px rgba(0,0,0,.2);
box-shadow : 0 1px 2px rgba(0,0,0,.2);
}
.a_button:hover {
text-decoration: none;
@ -670,8 +673,15 @@ button:hover {
border-radius: 1em;
}
.bigger {
font-size: 16px;
font-weight: bold;
padding: .8em 2em .62em;
}
.big {
font-size: 14px;
font-weight: bold;
padding: .8em 2em .62em;
}
.medium {
@ -683,6 +693,19 @@ button:hover {
padding: .2em 1em .275em;
}
.no_link {
cursor:default;
}
.no_link:hover {
cursor:default;
}
.no_link:active {
cursor:default;
}
/* white */
.a_button .white {
@ -2405,18 +2428,49 @@ div.admin_section h4 {
border-radius: 10px;
height: 40px;
margin: 5px;
/* margin: 5px; */
padding: 15px;
}
.exercise_overview_options .left_option {
float:left;
margin:12px 5px;
width:33%;
}
.exercise_overview_options .center_option {
float:left;
margin:15px 5px;
text-align: center;
width:33%;
}
.exercise_overview_options .right_option {
float:right;
margin:12px 5px;
text-align: right;
font-size : 14px;
}
.red_alert {
color:red;
font-weight: bold;
color:red;
}
#question_feedback {
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
background-color:#FCF7BA;
border:1px solid #EADC31;
color:#555;
font-size:12px;
font-weight:bold;
list-style-type:none;
margin-top:5px;
padding:5px;
}

@ -2134,16 +2134,7 @@ span.radio {
font-weight:bold;
font-size:130%;
}
#question_feedback {
background-color:#FCF7BA;
border:1px solid #CCCCCC;
color:#666666;
font-size:11px;
font-weight:bold;
list-style-type:none;
margin-top:5px;
padding:5px;
}
#exercise_close_link {
padding-left: 20px;
}
@ -2154,7 +2145,6 @@ span.radio {
/*****************************************************
* BUTTONS *
*****************************************************/
/* BUTTONS */
button {
margin:2px 5px 3px 3px !important;
background-color: #F5F5F5;

@ -16,7 +16,6 @@ $language_file = array('exercice','tracking');
// including the global library
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'sortabletable.class.php';
require_once '../gradebook/lib/be.inc.php';
// Setting the tabs
@ -873,12 +872,12 @@ if ($show == 'test') {
// if time is actived show link to exercise
if ($time_limits) {
if ($is_actived_time) {
$url = '<a href="exercise_submit.php?'.api_get_cidreq().$myorigin.$mylpid.$mylpitemid.'&exerciseId='.$row['id'].'">'.$row['title'].'</a>';
$url = '<a href="overview.php?'.api_get_cidreq().$myorigin.$mylpid.$mylpitemid.'&exerciseId='.$row['id'].'">'.$row['title'].'</a>';
} else {
$url = $row['title'];
}
} else {
$url = '<a href="exercise_submit.php?'.api_get_cidreq().$myorigin.$mylpid.$mylpitemid.'&exerciseId='.$row['id'].'">'.$row['title'].'</a>';
$url = '<a href="overview.php?'.api_get_cidreq().$myorigin.$mylpid.$mylpitemid.'&exerciseId='.$row['id'].'">'.$row['title'].'</a>';
}
//Link of the exercise

@ -12,9 +12,9 @@
define('ALL_ON_ONE_PAGE', 1);
define('ONE_PER_PAGE', 2);
define('EXERCISE_FEEDBACK_TYPE_END', 0); //Feedback
define('EXERCISE_FEEDBACK_TYPE_DIRECT', 1); //DirectFeedback
define('EXERCISE_FEEDBACK_TYPE_EXAM', 2); //NoFeedback
define('EXERCISE_FEEDBACK_TYPE_END', 0); //Feedback - show score and expected answers
define('EXERCISE_FEEDBACK_TYPE_DIRECT', 1); //DirectFeedback - Do not show score nor answers
define('EXERCISE_FEEDBACK_TYPE_EXAM', 2); //NoFeedback - Show score only
define('EXERCISE_MAX_NAME_SIZE', 80);

@ -81,7 +81,7 @@ if (empty($track_exercise_info)) {
}
$exercise_id = $track_exercise_info['id'];
$exercise_date = $track_exercise_info['exe_date'];
$exercise_date = $track_exercise_info['start_date'];
$student_id = $track_exercise_info['exe_user_id'];
$learnpath_id = $track_exercise_info['orig_lp_id'];
$learnpath_item_id = $track_exercise_info['orig_lp_item_id'];

@ -482,7 +482,7 @@ if (api_is_course_admin() && $origin != 'learnpath') {
}
$exerciseTitle = $objExercise->selectTitle();
echo Display::tag('h2', $exerciseTitle);
echo Display::tag('h1', $exerciseTitle);
$show_clock = true;
$user_id = api_get_user_id();
if ($objExercise->selectAttempts() > 0) {

@ -38,36 +38,6 @@ $origin = isset($_REQUEST['origin']) ? Security::remove_XSS($_REQUEST['or
$interbreadcrumb[] = array ("url" => "exercice.php?gradebook=$gradebook", "name" => get_lang('Exercices'));
$interbreadcrumb[] = array ("url" => "#","name" => $objExercise->name);
$htmlHeadXtra[] = api_get_jquery_ui_js();
$htmlHeadXtra[] = '<script language="javascript">
$(function() {
$(".exercise_opener").live("click", function() {
var url = this.href;
var dialog = $("#dialog");
if ($("#dialog").length == 0) {
dialog = $(\'<div id="dialog" style="display:hidden"></div> \').appendTo(\'body\');
}
// load remote content
dialog.load(
url,
{},
function(responseText, textStatus, XMLHttpRequest) {
dialog.dialog({
width: 720,
height: 550,
modal: true,
});
}
);
//prevent the browser to follow the link
return false;
});
});
</script>'; //jQuery
if ($origin != 'learnpath') {
Display::display_header();
} else {
@ -84,13 +54,14 @@ $html .= Display::div($objExercise->description, array('class'=>'exercise_descri
//Buttons
//Notice we not add there the lp_item_view__id because is not already generated
$exercise_url = api_get_path(WEB_CODE_PATH).'exercice/exercise_submit.php?'.api_get_cidreq().'&id_session='.api_get_session_id().'&exerciseId='.$objExercise->id.'&origin='.$origin.'&learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id;
$exercise_url = Display::url(get_lang('TakeTheExam'), $exercise_url, array('class'=>'a_button orange big round'));
$exercise_url = Display::url(get_lang('StartTest'), $exercise_url, array('class'=>'a_button orange bigger round'));
if (!$objExercise->is_visible()) {
$exercise_url = Display::url(get_lang('TakeTheExam'), '#', array('class'=>'a_button white big round'));
$exercise_url = Display::div(get_lang('StartTest'), array('class'=>'a_button white bigger round no_link'));
}
$options = Display::div($exercise_url, array('class'=>'left_option'));
$options = Display::div('', array('class'=>'left_option'));
$options .= Display::div($exercise_url, array('class'=>'center_option'));
$attempts = get_exercise_results_by_user(api_get_user_id(), $objExercise->id, api_get_course_id(), api_get_session_id(), $learnpath_id, $learnpath_item_id);
@ -102,21 +73,43 @@ if (!empty($attempts)) {
foreach($attempts as $attempt_result) {
$counter++;
$score = show_score($attempt_result['exe_result'], $attempt_result['exe_weighting']);
$attempt_url = api_get_path(WEB_CODE_PATH).'exercice/result.php?'.api_get_cidreq().'&id='.$attempt_result['exe_id'].'&id_session='.api_get_session_id();
$attempt_link = Display::url(Display::return_icon('quiz.png', get_lang('Result'), array(), 22), $attempt_url, array('class'=>'exercise_opener'));
$attempt_url = api_get_path(WEB_CODE_PATH).'exercice/result.php?'.api_get_cidreq().'&id='.$attempt_result['exe_id'].'&id_session='.api_get_session_id().'&height=500&width=750';
$attempt_link = Display::url(Display::return_icon('quiz.png', get_lang('Result'), array(), 22), $attempt_url, array('class'=>'thickbox'));
if (!$is_allowed_to_edit && $attempt_result['attempt_revised'] == 0) {
$attempt_link = get_lang('NoResult');
$attempt_link = Display::return_icon('quiz_na.png', get_lang('NoResult'), array(), 22);
}
$my_attempt_array[] = array('count' => $counter,
'date' => api_convert_and_format_date($attempt_result['start_date'], DATE_TIME_FORMAT_LONG),
'result' => $score,
'attempt_link' => $attempt_link,
);
$row = array('count' => $counter,
'date' => api_convert_and_format_date($attempt_result['start_date'], DATE_TIME_FORMAT_LONG)
);
if ($objExercise->results_disabled == EXERCISE_FEEDBACK_TYPE_END || $objExercise->results_disabled == EXERCISE_FEEDBACK_TYPE_EXAM) {
$row['result'] = $score;
}
if ($objExercise->results_disabled == EXERCISE_FEEDBACK_TYPE_END) {
$row['attempt_link'] = $attempt_link;
}
$my_attempt_array[] = $row;
}
$table = new HTML_Table(array('class' => 'data_table'));
$header_names = array(get_lang('Attempt'), get_lang('Date'), get_lang('Score'), get_lang('Details'));
//Hiding score and answer
switch($objExercise->results_disabled) {
case EXERCISE_FEEDBACK_TYPE_END:
$header_names = array(get_lang('Attempt'), get_lang('Date'), get_lang('Score'), get_lang('Details'));
break;
case EXERCISE_FEEDBACK_TYPE_DIRECT:
$header_names = array(get_lang('Attempt'), get_lang('Date'));
break;
case EXERCISE_FEEDBACK_TYPE_EXAM:
$header_names = array(get_lang('Attempt'), get_lang('Date'), get_lang('Score'));
break;
}
$row = 0;
$column = 0;
foreach ($header_names as $item) {
@ -128,6 +121,7 @@ if (!empty($attempts)) {
foreach ($my_attempt_array 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"';
@ -143,16 +137,20 @@ if (!empty($attempts)) {
if ($objExercise->selectAttempts()) {
if ($is_allowed_to_edit) {
$options.= Display::div(get_lang('MaxAttempts').' '.$objExercise->selectAttempts(), array('class'=>'right_option'));
$options.= Display::div(get_lang('ExerciseAttempts').' '.$objExercise->selectAttempts(), array('class'=>'right_option'));
} else {
$options.= Display::div(get_lang('AttemptsLeft').' '.$counter.' / '.$objExercise->selectAttempts(), array('class'=>'right_option'));
$red_class = '';
if ($counter == $objExercise->selectAttempts()) {
$class = 'red_alert';
}
$options.= Display::div(get_lang('Attempts').' '.$counter.' / '.$objExercise->selectAttempts(), array('class'=>"right_option $class"));
}
}
$html.= Display::div($options, array('class'=>'exercise_overview_options'));
$html .= $table_content;
echo Display::div($html, array('class'=>'rounded_div', 'style'=>'width:60%'));
echo Display::div($html, array('class'=>'rounded_div', 'style'=>'width:92%'));
if ($origin != 'learnpath') {
Display::display_footer();

@ -3,7 +3,7 @@
/**
* Shows the exercise results
*
* @author Julio Montoya Armas Simple exercise result page
* @author Julio Montoya Armas - Simple exercise result page
*
*/
@ -27,9 +27,6 @@ if (empty($origin) ) {
api_protect_course_script();
if ( empty ( $exeId ) ) { $exeId = $_REQUEST['id'];}
//$emailId = $_REQUEST['email'];
$id = intval($_REQUEST['id']); //exe id
$current_time = time();
@ -46,9 +43,8 @@ $track_exercise_info = get_exercise_track_exercise_info($id);
if (empty($track_exercise_info)) {
api_not_allowed(false);
}
$exercise_id = $track_exercise_info['id'];
$exercise_date = $track_exercise_info['exe_date'];
$exercise_date = $track_exercise_info['start_date'];
$student_id = $track_exercise_info['exe_user_id'];
$learnpath_id = $track_exercise_info['orig_lp_id'];
$learnpath_item_id = $track_exercise_info['orig_lp_item_id'];
@ -81,43 +77,22 @@ if (!empty($track_exercise_info)) {
$result_disabled = $track_exercise_info['results_disabled'];
if (!(api_is_platform_admin() || api_is_course_admin()) ) {
if ($result_disabled == 1) {
//api_not_allowed();
$show_results = false;
//Display::display_warning_message(get_lang('CantViewResults'));
if ($origin != 'learnpath') {
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2">';
Display::display_warning_message(get_lang('ThankYouForPassingTheTest').'<br /><br /><a href="exercice.php">'.(get_lang('BackToExercisesList')).'</a>', false);
echo '</td>
</tr>
</table>';
}
} elseif ($result_disabled == 2) {
if ($result_disabled == EXERCISE_FEEDBACK_TYPE_DIRECT) {
$show_results = false;
Display::display_warning_message(get_lang('CantViewResults'));
} elseif ($result_disabled == EXERCISE_FEEDBACK_TYPE_EXAM) {
$show_results = false;
$show_only_total_score = true;
if ($origin != 'learnpath') {
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2">';
Display::display_warning_message(get_lang('ThankYouForPassingTheTest'), false);
echo '</td>
</tr>
</table>';
}
$show_only_total_score = true;
}
}
} else {
Display::display_warning_message(get_lang('CantViewResults'));
$show_results = false;
}
$html = '';
if ($show_results || $show_only_total_score) {
$user_info = api_get_user_info($student_id);
//Shows exercise header
echo $objExercise->show_exercise_result_header(api_get_person_name($user_info['firstName'], $user_info['lastName']), api_convert_and_format_date($exercise_date));
$objExercise->description = '';
echo $objExercise->show_exercise_result_header(api_get_person_name($user_info['firstName'], $user_info['lastName']), api_convert_and_format_date($exercise_date, DATE_TIME_FORMAT_LONG));
}
$i = $totalScore = $totalWeighting = 0;
@ -129,17 +104,15 @@ $question_list = $result[$id]['question_list'];
$total_weighting = 0;
foreach ($question_list as $question_item) {
$objQuestionTmp = Question::read($question_item['question_id']);
$total_weighting +=$objQuestionTmp->selectWeighting();
$total_weighting += $objQuestionTmp->selectWeighting();
}
$counter = 1;
foreach ($question_list as $question_item) {
$choice = $question_item['answer'];
// destruction of the Question object
unset($objQuestionTmp);
// creates a temporary Question object
$questionId = $question_item['question_id'];
$questionId = $question_item['question_id'];
$objQuestionTmp = Question::read($questionId);
$questionName = $objQuestionTmp->selectTitle();
@ -342,8 +315,17 @@ foreach ($question_list as $question_item) {
if ($answerType != HOT_SPOT) {
echo '</table>';
}
}
if ($show_results) {
$comnt = get_comments($id, $questionId);
if (!empty($comnt)) {
echo '<b>'.get_lang('Feedback').'</b>';
echo '<div id="question_feedback">'.$comnt.'</div>';
}
}
$my_total_score = $questionScore;
$my_total_weight = $questionWeighting;
@ -356,14 +338,14 @@ foreach ($question_list as $question_item) {
echo '</div>';
}
unset($objAnswerTmp);
unset($objQuestionTmp);
$i++;
$totalWeighting += $questionWeighting;
} // end of large foreach on questions
//Total score
if ($show_results || $show_only_total_score ) {
if ($show_results || $show_only_total_score) {
echo '<div id="question_score">'.get_lang('YourTotalScore').": ";
$my_total_score_temp = $totalScore;
if ($objExercise->selectPropagateNeg() == 0 && $my_total_score_temp < 0) {

Loading…
Cancel
Save