Adding exercise overview ... (partial commit not finished yet) see BT#2804

skala
Julio Montoya 14 years ago
parent 64f48af489
commit 7917d7ef9b
  1. 2
      main/admin/access_urls.php
  2. 1
      main/admin/class_list.php
  3. 5
      main/exercice/exercice.php
  4. 43
      main/exercice/exercise.class.php
  5. 5
      main/exercice/exercise_show.php
  6. 159
      main/exercice/overview.php
  7. 374
      main/exercice/result.php
  8. BIN
      main/img/icons/22/quiz.png
  9. BIN
      main/img/icons/22/quiz_na.png
  10. 1
      main/inc/course_document.inc.php
  11. 6
      main/inc/global.inc.php
  12. 1
      main/inc/header.inc.php
  13. 14
      main/inc/lib/banner.lib.php
  14. 4
      main/inc/lib/course_home.lib.php
  15. 9
      main/inc/lib/display.lib.php
  16. 64
      main/inc/lib/events.lib.inc.php
  17. 2
      main/inc/lib/exercise_show_functions.lib.php
  18. 2
      main/inc/lib/message.lib.php
  19. 2
      main/inc/lib/social.lib.php
  20. 2
      main/inc/lib/system_announcements.lib.php
  21. 2
      main/inc/lib/tracking.lib.php
  22. 2
      main/session/index.php
  23. 1
      main/tracking/courseLog.php

@ -9,7 +9,6 @@
$language_file = 'admin';
$cidReset = true;
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'sortabletable.class.php';
$this_section = SECTION_PLATFORM_ADMIN;
//api_protect_admin_script();
@ -24,7 +23,6 @@ $interbreadcrumb[] = array ("url" => 'index.php', 'name' => get_lang('PlatformAd
$tool_name = get_lang('MultipleAccessURLs');
Display :: display_header($tool_name);
require_once api_get_path(LIBRARY_PATH).'sortabletable.class.php';
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once api_get_path(LIBRARY_PATH).'security.lib.php';
require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';

@ -10,7 +10,6 @@ $language_file = 'admin';
$cidReset = true;
require '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'sortabletable.class.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();

@ -806,14 +806,13 @@ if ($show == 'test') {
//Settings
//echo Display::url(Display::return_icon('settings.png',get_lang('Edit'), array('width'=>'22px'))." ".get_lang('Edit'), 'exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$row['id']);
}
//echo '<p>';
//echo $session_img;
if ($row['active'] == 0) {
$title = Display::tag('font', $row['title'], array('style'=>'color:grey'));
} else {
$title = $row['title'];
}
$url = '<a href="exercise_submit.php?'.api_get_cidreq().$myorigin.$mylpid.$mylpitemid.'&exerciseId='.$row['id'].'"><img src="../img/quiz.gif" /> '.$title.' </a>'.$lp_blocked;
$url = '<a href="overview.php?'.api_get_cidreq().$myorigin.$mylpid.$mylpitemid.'&exerciseId='.$row['id'].'"><img src="../img/quiz.gif" /> '.$title.' </a>'.$lp_blocked;
$item = Display::tag('td', $url.' '.$session_img);
$exid = $row['id'];

@ -114,10 +114,10 @@ class Exercise {
$this->propagate_neg = $object->propagate_neg;
if ($object->end_time != '0000-00-00 00:00:00') {
$this->end_time = api_get_local_time($object->end_time);
$this->end_time = api_get_local_time($object->end_time);
}
if ($object->start_time != '0000-00-00 00:00:00') {
$this->start_time = api_get_local_time($object->start_time);
$this->start_time = api_get_local_time($object->start_time);
}
$this->expired_time = $object->expired_time; //control time
@ -2977,7 +2977,7 @@ class Exercise {
$sql_update = 'UPDATE ' . $stat_table . ' SET exe_result = exe_result + ' . floatval($questionScore) . ' WHERE exe_id = ' . $exeId;
if ($debug) error_log($sql_update);
Database::query($sql_update);
}
}
$return_array = array('score'=>$questionScore, 'weight'=>$questionWeighting,'extra'=>$extra_data);
return $return_array;
} //End function
@ -3237,27 +3237,40 @@ class Exercise {
return $result;
}
public function is_visible() {
/**
*
* Checks if the exercise is visible due a lot of conditions - visibility, time limits, student attempts
* @return bool true if is active
*/
public function is_visible($lp_id = 0, $lp_item_id = 0 , $lp_item_view_id = 0) {
//1. By default the exercise is visible
$is_visible = true;
//$this->id;
//1.1 Admins and teachers can access to the exercise
if (api_is_platform_admin() || api_is_course_admin()) {
return true;
}
//2. If the exercise is not active
if ($this->active == 0) {
return false;
}
//3. We check if the time limits are on
$limit_time_exists = ((!empty($this->start_time) && $this->start_time != '0000-00-00 00:00:00') || (!empty($this->end_time) && $this->end_time != '0000-00-00 00:00:00')) ? true : false;
if ($limit_time_exists) {
if ($limit_time_exists) {
$time_now = time();
if ($this->start_time != '0000-00-00 00:00:00') {
$permission_to_start = (($time_now - $this->start_time) > 0) ? true : false;
if (!empty($this->start_time) && $this->start_time != '0000-00-00 00:00:00') {
$permission_to_start = (($time_now - api_strtotime($this->start_time, 'UTC')) > 0) ? true : false;
} else {
$permission_to_start = true;
}
if ($this->end_time != '0000-00-00 00:00:00') {
$exercise_timeover = (($time_now - $this->end_time) > 0) ? true : false;
$exercise_timeover = (($time_now - api_strtotime($this->end_time, 'UTC')) > 0) ? true : false;
} else {
$exercise_timeover = false;
}
@ -3266,9 +3279,19 @@ class Exercise {
$is_visible = false;
}
}
return $is_visible;
// 4. We check if the student have attempts
if ($is_visible) {
if ($this->selectAttempts()) {
$attempt_count = get_attempt_count(api_get_user_id(), $this->id, $lp_id, $lp_item_id, $lp_item_view_id);
if ($attempt_count >= $this->selectAttempts()) {
//Display :: display_warning_message(sprintf(get_lang('ReachedMaxAttempts'), $exerciseTitle, $objExercise->selectAttempts()), false);
$is_visible = false;
}
}
}
return $is_visible;
}
}
endif;

@ -274,6 +274,7 @@ if (!empty($track_exercise_info['data_tracking']) && !empty($track_exercise_info
}
// for each question
$counter=0;
$total_weighting = 0;
foreach ($questionList as $questionId) {
$objQuestionTmp = Question::read($questionId);
@ -282,8 +283,8 @@ foreach ($questionList as $questionId) {
$counter = 1;
foreach ($questionList as $questionId) {
$choice=$exerciseResult[$questionId];
$counter++;
$choice = $exerciseResult[$questionId];
// destruction of the Question object
unset($objQuestionTmp);

@ -0,0 +1,159 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Exercise preview
*
* @package chamilo.exercise
* @author Julio Montoya <gugli100@gmail.com>
*/
/**
* Code
*/
require_once 'exercise.class.php';
require_once 'exercise.lib.php';
$language_file = 'exercice';
require_once '../inc/global.inc.php';
$this_section = SECTION_COURSES;
// Notice for unauthorized people.
api_protect_course_script(true);
if (empty ($exerciseId)) {
$exercise_id = intval($_REQUEST['exerciseId']);
}
$objExercise = new Exercise();
$result = $objExercise->read($exercise_id);
if (!$result) {
api_not_allowed(true);
}
$gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
$learnpath_id = isset($_REQUEST['learnpath_id']) ? intval($_REQUEST['learnpath_id']) : null;
$learnpath_item_id = isset($_REQUEST['learnpath_item_id']) ? intval($_REQUEST['learnpath_item_id']) : null;
$origin = isset($_REQUEST['origin']) ? Security::remove_XSS($_REQUEST['origin']) : null;
$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 {
Display::display_reduced_header();
}
$html = '';
$is_allowed_to_edit = api_is_allowed_to_edit(null,true);
$html .= Display::tag('h1', $objExercise->name);
$html .= Display::div($objExercise->description, array('class'=>'exercise_description'));
//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'));
if (!$objExercise->is_visible()) {
$exercise_url = Display::url(get_lang('TakeTheExam'), '#', array('class'=>'a_button white big round'));
}
$options = Display::div($exercise_url, array('class'=>'left_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);
$my_attempt_array = array();
$counter = 0;
$table_content = '';
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'));
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,
);
}
$table = new HTML_Table(array('class' => 'data_table'));
$header_names = array(get_lang('Attempt'), get_lang('Date'), get_lang('Score'), get_lang('Details'));
$row = 0;
$column = 0;
foreach ($header_names as $item) {
$table->setHeaderContents($row, $column, $item);
$column++;
}
$row = 1;
if (!empty($my_attempt_array)) {
foreach ($my_attempt_array as $data) {
$column = 0;
$table->setCellContents($row, $column, $data);
$class = 'class="row_odd"';
if($row % 2) {
$class = 'class="row_even"';
}
$table->setRowAttributes($row, $class, true);
$column++;
$row++;
}
}
$table_content = $table->toHtml();
}
if ($objExercise->selectAttempts()) {
if ($is_allowed_to_edit) {
$options.= Display::div(get_lang('MaxAttempts').' '.$objExercise->selectAttempts(), array('class'=>'right_option'));
} else {
$options.= Display::div(get_lang('AttemptsLeft').' '.$counter.' / '.$objExercise->selectAttempts(), array('class'=>'right_option'));
}
}
$html.= Display::div($options, array('class'=>'exercise_overview_options'));
$html .= $table_content;
echo Display::div($html, array('class'=>'rounded_div', 'style'=>'width:60%'));
if ($origin != 'learnpath') {
Display::display_footer();
}

@ -0,0 +1,374 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Shows the exercise results
*
* @author Julio Montoya Armas Simple exercise result page
*
*/
/**
* Code
*/
// name of the language file that needs to be included
$language_file = array('exercice');
// including additional libraries
require_once 'exercise.class.php';
require_once 'exercise.lib.php';
require_once 'question.class.php'; //also defines answer type constants
require_once 'answer.class.php';
require_once '../inc/global.inc.php';
if (empty($origin) ) {
$origin = $_REQUEST['origin'];
}
api_protect_course_script();
if ( empty ( $exeId ) ) { $exeId = $_REQUEST['id'];}
//$emailId = $_REQUEST['email'];
$id = intval($_REQUEST['id']); //exe id
$current_time = time();
if (empty($id)) {
api_not_allowed();
}
$is_allowedToEdit = api_is_allowed_to_edit(null,true) || $is_courseTutor;
//Getting results from the exe_id. This variable also contain all the information about the exercise
$track_exercise_info = get_exercise_track_exercise_info($id);
//No track info
if (empty($track_exercise_info)) {
api_not_allowed(false);
}
$exercise_id = $track_exercise_info['id'];
$exercise_date = $track_exercise_info['exe_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'];
$lp_item_view_id = $track_exercise_info['orig_lp_item_view_id'];
$course_code = api_get_course_id();
$current_user_id = api_get_user_id();
if (empty($objExercise)) {
$objExercise = new Exercise();
$objExercise->read($exercise_id);
}
//Only users can see their own results
if (!$is_allowedToEdit) {
if ($student_id != $current_user_id) {
api_not_allowed();
}
}
Display::display_reduced_header();
$show_results = true;
$show_only_total_score = false;
// Avoiding the "Score 0/0" message when the exe_id is not set
if (!empty($track_exercise_info)) {
$exerciseTitle = $track_exercise_info['title'];
$exerciseDescription = $track_exercise_info['description'];
// if the results_disabled of the Quiz is 1 when block the script
$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) {
$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>';
}
}
}
} 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));
}
$i = $totalScore = $totalWeighting = 0;
$result = get_exercise_results_by_attempt($id);
$question_list = $result[$id]['question_list'];
// for each question
$total_weighting = 0;
foreach ($question_list as $question_item) {
$objQuestionTmp = Question::read($question_item['question_id']);
$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'];
$objQuestionTmp = Question::read($questionId);
$questionName = $objQuestionTmp->selectTitle();
$questionDescription= $objQuestionTmp->selectDescription();
$questionWeighting = $objQuestionTmp->selectWeighting();
$answerType = $objQuestionTmp->selectType();
$quesId = $objQuestionTmp->selectId();
if ($show_results) {
echo $objQuestionTmp->return_header($objExercise->feedbacktype, $counter);
}
$counter++;
if ($answerType == MULTIPLE_ANSWER || $answerType == MULTIPLE_ANSWER_TRUE_FALSE) {
$question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
} elseif ($answerType == MULTIPLE_ANSWER_COMBINATION || $answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) {
$choice = array();
$question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
} elseif ($answerType == UNIQUE_ANSWER || $answerType == UNIQUE_ANSWER_NO_OPTION) {
$question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
} elseif ($answerType == FILL_IN_BLANKS) {
$question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
} elseif ($answerType == FREE_ANSWER) {
$answer = $str;
$question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
} elseif ($answerType == MATCHING) {
$question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
} elseif ($answerType == HOT_SPOT) {
if ($show_results) {
echo '<table width="500" border="0"><tr>
<td valign="top" align="center" style="padding-left:0px;" >
<table border="1" bordercolor="#A4A4A4" style="border-collapse: collapse;" width="552">';
}
$question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
if ($show_results) {
echo '</table></td></tr>';
echo '<tr>
<td colspan="2">'.
'<object type="application/x-shockwave-flash" data="'.api_get_path(WEB_CODE_PATH).'plugin/hotspot/hotspot_solution.swf?modifyAnswers='.Security::remove_XSS($questionId).'&exe_id='.$id.'&from_db=1" width="552" height="352">
<param name="movie" value="../plugin/hotspot/hotspot_solution.swf?modifyAnswers='.Security::remove_XSS($questionId).'&exe_id='.$id.'&from_db=1" />
</object>
</td>
</tr>
</table><br/>';
}
} else if($answerType == HOT_SPOT_DELINEATION) {
$question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg(), 'database');
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
$final_overlap = $question_result['extra']['final_overlap'];
$final_missing = $question_result['extra']['final_missing'];
$final_excess = $question_result['extra']['final_excess'];
$overlap_color = $question_result['extra']['overlap_color'];
$missing_color = $question_result['extra']['missing_color'];
$excess_color = $question_result['extra']['excess_color'];
$threadhold1 = $question_result['extra']['threadhold1'];
$threadhold2 = $question_result['extra']['threadhold2'];
$threadhold3 = $question_result['extra']['threadhold3'];
if ($show_results) {
if ($overlap_color) {
$overlap_color='green';
} else {
$overlap_color='red';
}
if ($missing_color) {
$missing_color='green';
} else {
$missing_color='red';
}
if ($excess_color) {
$excess_color='green';
} else {
$excess_color='red';
}
if (!is_numeric($final_overlap)) {
$final_overlap = 0;
}
if (!is_numeric($final_missing)) {
$final_missing = 0;
}
if (!is_numeric($final_excess)) {
$final_excess = 0;
}
if ($final_excess>100) {
$final_excess = 100;
}
$table_resume='<table class="data_table">
<tr class="row_odd" >
<td></td>
<td ><b>'.get_lang('Requirements').'</b></td>
<td><b>'.get_lang('YourAnswer').'</b></td>
</tr>
<tr class="row_even">
<td><b>'.get_lang('Overlap').'</b></td>
<td>'.get_lang('Min').' '.$threadhold1.'</td>
<td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0)?0:intval($final_overlap)).'</div></td>
</tr>
<tr>
<td><b>'.get_lang('Excess').'</b></td>
<td>'.get_lang('Max').' '.$threadhold2.'</td>
<td><div style="color:'.$excess_color.'">'.(($final_excess < 0)?0:intval($final_excess)).'</div></td>
</tr>
<tr class="row_even">
<td><b>'.get_lang('Missing').'</b></td>
<td>'.get_lang('Max').' '.$threadhold3.'</td>
<td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td>
</tr></table>';
if ($answerType!= HOT_SPOT_DELINEATION) {
$item_list=explode('@@',$destination);
//print_R($item_list);
$try = $item_list[0];
$lp = $item_list[1];
$destinationid= $item_list[2];
$url=$item_list[3];
$table_resume='';
} else {
if ($next==0) {
$try = $try_hotspot;
$lp = $lp_hotspot;
$destinationid= $select_question_hotspot;
$url=$url_hotspot;
} else {
//show if no error
//echo 'no error';
$comment=$answerComment=$objAnswerTmp->selectComment($nbrAnswers);
$answerDestination=$objAnswerTmp->selectDestination($nbrAnswers);
}
}
echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>';
if ($answerType == HOT_SPOT_DELINEATION) {
if ($organs_at_risk_hit>0) {
$message='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
$message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>';
} else {
$message='<p>'.get_lang('YourDelineation').'</p>';
$message.=$table_resume;
$message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
}
$message.='<p>'.$comment.'</p>';
echo $message;
} else {
echo '<p>'.$comment.'</p>';
}
//showing the score
$queryfree = "select marks from ".$TBL_TRACK_ATTEMPT." where exe_id = '".Database::escape_string($id)."' and question_id= '".Database::escape_string($questionId)."'";
$resfree = Database::query($queryfree);
$questionScore= Database::result($resfree,0,"marks");
$totalScore+=$questionScore;
?>
</table>
</td></tr>
<?php
echo '<tr>
<td colspan="2">
<object type="application/x-shockwave-flash" data="../plugin/hotspot/hotspot_solution.swf?modifyAnswers='.$questionId.'&exe_id='.$id.'&from_db=1" width="556" height="350">
<param name="movie" value="../plugin/hotspot/hotspot_solution.swf?modifyAnswers='.$questionId.'&exe_id='.$id.'&from_db=1" />
</object>
</td>
</tr>
</table>';
}
}
if ($show_results) {
if ($answerType != HOT_SPOT) {
echo '</table>';
}
}
$my_total_score = $questionScore;
$my_total_weight = $questionWeighting;
if ($objExercise->selectPropagateNeg() == 0 && $my_total_score < 0) {
$my_total_score = 0;
}
if ($show_results) {
echo '<div id="question_score">';
echo get_lang('Score')." : ".show_score($my_total_score, $my_total_weight, false, false);
echo '</div>';
}
unset($objAnswerTmp);
$i++;
$totalWeighting += $questionWeighting;
} // end of large foreach on questions
//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) {
$my_total_score_temp = 0;
}
echo show_score($my_total_score_temp, $totalWeighting, false);
echo '</div>';
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 826 B

@ -8,7 +8,6 @@ require 'global.inc.php';
/* Libraries */
require_once api_get_path(LIBRARY_PATH).'sortabletable.class.php';
require_once api_get_path(LIBRARY_PATH).'course_document.lib.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/repository.php';
require_once api_get_path(SYS_CODE_PATH).'document/document.inc.php';

@ -100,7 +100,13 @@ require_once $lib_path.'array.lib.php';
require_once $lib_path.'security.lib.php';
require_once $lib_path.'events.lib.inc.php';
require_once $lib_path.'debug.lib.php';
require_once $lib_path.'usermanager.lib.php';
require_once $lib_path.'sortabletable.class.php';
require_once $lib_path.'message.lib.php';
require_once $lib_path.'social.lib.php';
/* DATABASE CONNECTION */

@ -197,5 +197,6 @@ if (defined('CHAMILO_HOMEPAGE') && CHAMILO_HOMEPAGE)
</ul>
</div>
<?php
// Banner
require_once api_get_path(INCLUDE_PATH).'banner.inc.php';

@ -4,6 +4,7 @@
* Code
* @package chamilo.include
*/
/**
* Determines the possible tabs (=sections) that are available.
* This function is used when creating the tabs in the third header line and
@ -66,14 +67,10 @@ function get_tabs() {
// Social
if (api_get_setting('allow_social_tool')=='true') {
$navigation['social']['url'] = api_get_path(WEB_CODE_PATH).'social/home.php';
require_once api_get_path(LIBRARY_PATH).'message.lib.php';
require_once api_get_path(LIBRARY_PATH).'social.lib.php';
// get count unread message and total invitations
$count_unread_message = MessageManager::get_number_of_messages(true);
$number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
$group_pending_invitations = GroupPortalManager::get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION,false);
$group_pending_invitations = 0;
@ -81,16 +78,15 @@ function get_tabs() {
$group_pending_invitations = count($group_pending_invitations);
}
$total_invitations = intval($number_of_new_messages_of_friend) + $group_pending_invitations + intval($count_unread_message);
$total_invitations = (!empty($total_invitations)?' ('.$total_invitations.')':'');
$total_invitations = (!empty($total_invitations)?' ('.$total_invitations.')':'');
$navigation['social']['title'] = get_lang('SocialNetwork'). $total_invitations;
}
// Dashboard
if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) {
$navigation['dashboard']['url'] = api_get_path(WEB_CODE_PATH).'dashboard/index.php';
$navigation['dashboard']['title'] = get_lang('Dashboard');
$navigation['dashboard']['url'] = api_get_path(WEB_CODE_PATH).'dashboard/index.php';
$navigation['dashboard']['title'] = get_lang('Dashboard');
}
// Platform administration

@ -9,9 +9,7 @@ class CourseHome {
* Gets the html content to show in the 3 column view
*/
public static function show_tool_3column($cat) {
if (!class_exists('HTML_Table')) {
require_once 'pear/HTML/Table.php';
}
global $_user;
$charset = api_get_system_encoding();
$TBL_ACCUEIL = Database :: get_course_table(TABLE_TOOL_LIST);

@ -170,9 +170,6 @@ class Display {
* @author bart.mollet@hogent.be
*/
public static function display_sortable_table($header, $content, $sorting_options = array(), $paging_options = array(), $query_vars = null, $form_actions = array(), $style = 'table') {
if (!class_exists('SortableTable')) {
require_once 'sortabletable.class.php';
}
global $origin;
$column = isset($sorting_options['column']) ? $sorting_options['column'] : 0;
$default_items_per_page = isset($paging_options['per_page']) ? $paging_options['per_page'] : 20;
@ -234,9 +231,6 @@ class Display {
* @return string html grid
*/
public static function return_sortable_grid($name, $header, $content, $paging_options = array(), $query_vars = null, $form_actions = array(), $visibility_options = true, $sort_data = true, $grid_class = array()) {
if (!class_exists('SortableTable')) {
require_once 'sortabletable.class.php';
}
global $origin;
$column = 0;
$default_items_per_page = isset($paging_options['per_page']) ? $paging_options['per_page'] : 20;
@ -275,9 +269,6 @@ class Display {
* @author Julio Montoya
*/
public static function display_sortable_config_table($table_name, $header, $content, $sorting_options = array(), $paging_options = array(), $query_vars = null, $column_show = array(), $column_order = array(), $form_actions = array()) {
if (!class_exists('SortableTable')) {
require_once 'sortabletable.class.php';
}
global $origin;
$column = isset($sorting_options['column']) ? $sorting_options['column'] : 0;
$default_items_per_page = isset($paging_options['per_page']) ? $paging_options['per_page'] : 20;

@ -753,6 +753,45 @@ function get_all_exercise_results_by_user($user_id, $course_code, $session_id =
/**
* Gets exercise results (NO Exercises in LPs) from a given exercise id, course, session
* @param int exercise id
* @param string course code
* @param int session id
* @return array with the results
*
*/
function get_exercise_results_by_attempt($exe_id) {
$table_track_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$table_track_attempt_recording = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
$exe_id = intval($exe_id);
$sql = "SELECT * FROM $table_track_exercises WHERE status = '' AND exe_id = $exe_id";
$res = Database::query($sql);
$list = array();
if (Database::num_rows($res)) {
$row = Database::fetch_array($res,'ASSOC');
//Checking if this attempt was revised by a teacher
$sql_revised = 'SELECT exe_id FROM ' . $table_track_attempt_recording . ' WHERE author != "" AND exe_id = '.$exe_id.' LIMIT 1';
$res_revised = Database::query($sql_revised);
$row['attempt_revised'] = 0;
if (Database::num_rows($res_revised) > 0) {
$row['attempt_revised'] = 1;
}
$list[$exe_id] = $row;
$sql = "SELECT * FROM $table_track_attempt WHERE exe_id = $exe_id";
$res_question = Database::query($sql);
while ($row_q = Database::fetch_array($res_question,'ASSOC')) {
$list[$exe_id]['question_list'][$row_q['question_id']] = $row_q;
}
}
//echo '<pre>'; print_r($list);
return $list;
}
/**
* Gets exercise results (NO Exercises in LPs) from a given exercise id, course, session
* @param int exercise id
@ -761,23 +800,34 @@ function get_all_exercise_results_by_user($user_id, $course_code, $session_id =
* @return array with the results
*
*/
function get_exercise_results_by_user($user_id, $exercise_id, $course_code, $session_id = 0) {
function get_exercise_results_by_user($user_id, $exercise_id, $course_code, $session_id = 0, $lp_id = 0, $lp_item_id = 0) {
$table_track_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$course_code = Database::escape_string($course_code);
$exercise_id = intval($exercise_id);
$session_id = intval($session_id);
$user_id = intval($user_id);
$table_track_attempt_recording = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
$course_code = Database::escape_string($course_code);
$exercise_id = intval($exercise_id);
$session_id = intval($session_id);
$user_id = intval($user_id);
$lp_id = intval($lp_id);
$lp_item_id = intval($lp_item_id);
$sql = "SELECT * FROM $table_track_exercises WHERE status = '' AND exe_user_id = $user_id AND exe_cours_id = '$course_code' AND exe_exo_id = $exercise_id AND session_id = $session_id AND orig_lp_id = 0 AND orig_lp_item_id = 0 ORDER by exe_id";
$sql = "SELECT * FROM $table_track_exercises
WHERE status = '' AND exe_user_id = $user_id AND exe_cours_id = '$course_code' AND exe_exo_id = $exercise_id AND session_id = $session_id AND orig_lp_id = $lp_id AND orig_lp_item_id = $lp_item_id ORDER by exe_id";
$res = Database::query($sql);
$list = array();
while($row = Database::fetch_array($res,'ASSOC')) {
//Checking if this attempt was revised by a teacher
$sql_revised = 'SELECT exe_id FROM ' . $table_track_attempt_recording . ' WHERE author != "" AND exe_id = '.$row['exe_id'].' LIMIT 1';
$res_revised = Database::query($sql_revised);
$row['attempt_revised'] = 0;
if (Database::num_rows($res_revised) > 0) {
$row['attempt_revised'] = 1;
}
$list[$row['exe_id']] = $row;
$sql = "SELECT * FROM $table_track_attempt WHERE exe_id = {$row['exe_id']}";
$res_question = Database::query($sql);
while($row_q = Database::fetch_array($res_question,'ASSOC')) {
while ($row_q = Database::fetch_array($res_question,'ASSOC')) {
$list[$row['exe_id']]['question_list'][$row_q['question_id']] = $row_q;
}
}

@ -207,7 +207,7 @@ class ExerciseShowFunctions {
<td>&nbsp;</td>
<?php } ?>
</tr>
<?php
<?php
}
/**

@ -12,9 +12,7 @@
require_once api_get_path(LIBRARY_PATH).'online.inc.php';
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
require_once api_get_path(LIBRARY_PATH).'sortabletable.class.php';
/*
* @todo use constants!

@ -17,8 +17,6 @@ define('SOCIAL_RIGHT_PLUGIN', 3);
define('CUT_GROUP_NAME', 50);
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'message.lib.php';
/**
*
* @package chamilo.social

@ -57,7 +57,7 @@ class SystemAnnouncementManager {
} else {
$show_url = 'news_list.php#'.$announcement->id;
}
$display_date = api_convert_and_format_date($announcement->display_date, DATE_FORMAT_LONG, date_default_timezone_get());
$display_date = api_convert_and_format_date($announcement->display_date, DATE_FORMAT_LONG);
echo '<a name="'.$announcement->id.'"></a>
<div class="system_announcement">
<div class="system_announcement_title"><a name="ann'.$announcement->id.'" href="'.$show_url.'">'.$announcement->title.'</a></div><div class="system_announcement_date">'.$display_date.'</div>

@ -2446,7 +2446,7 @@ class Tracking {
$to_graph_exercise_result[$exercices['id']] = array('title'=>$exercices['title'], 'data'=>$best_exercise_stats);
$html .= '<tr class="row_even">';
$url = api_get_path(WEB_CODE_PATH)."exercice/exercise_submit.php?cidReq={$course_info['code']}&id_session=$session_id&exerciseId={$exercices['id']}";
$url = api_get_path(WEB_CODE_PATH)."exercice/overview.php?cidReq={$course_info['code']}&id_session=$session_id&exerciseId={$exercices['id']}";
$exercices['title'] = Display::url($exercices['title'], $url, array('target'=>SESSION_LINK_TARGET));
$html .= Display::tag('td', $exercices['title']);

@ -198,7 +198,7 @@ foreach($final_array as $session_data) {
continue;
}
}
$exercise_info->exercise = Display::url($exercise_info->exercise, api_get_path(WEB_CODE_PATH)."exercice/exercise_submit.php?cidReq=$my_course_code&exerciseId={$exercise_info->id}&id_session=$session_id", array('target'=>SESSION_LINK_TARGET));
$exercise_info->exercise = Display::url($exercise_info->exercise, api_get_path(WEB_CODE_PATH)."exercice/overview.php?cidReq=$my_course_code&exerciseId={$exercise_info->id}&id_session=$session_id", array('target'=>SESSION_LINK_TARGET));
$new_exercises[]= array( //'date' => api_get_local_time($exercise_result['exe_date']),
'status' => Display::return_icon('star.png', get_lang('New'), array('width'=>'22')),
'date' => $start_date,

@ -251,7 +251,6 @@ if ($_GET['studentlist'] == 'false') {
echo '</table></div>';
echo '<div class="clear"></div>';
//hiding detail for exercises
//&nbsp;-&nbsp;<a href="../exercice/exercice.php?'.api_get_cidreq().'&show=result">'.get_lang('SeeDetail').'</a>
// Exercices tracking.
echo '<div class="report_section">
<h2>'.Display::return_icon('quiz.gif',get_lang('AverageResultsToTheExercices')).get_lang('AverageResultsToTheExercices').'</h2>

Loading…
Cancel
Save