[svn r18637] Logic changes - Fixed time about an exercise into learning path details - see FS#3685

skala
Cristian Fasanando 16 years ago
parent 7bf9a27a19
commit 27a0fabe26
  1. 9
      main/exercice/exercice.php
  2. 4
      main/exercice/exercise_result.php
  3. 7
      main/exercice/exercise_show.php
  4. 23
      main/newscorm/learnpathItem.class.php
  5. 13
      main/newscorm/lp_stats.php

@ -1,4 +1,4 @@
<?php // $Id: exercice.php 18542 2009-02-17 14:58:33Z cfasanando $
<?php // $Id: exercice.php 18637 2009-02-23 21:29:20Z cfasanando $
/*
==============================================================================
@ -272,13 +272,14 @@ api_mail_html($emailid, $emailid, $subject, $mess, $from_name, $from);
if (in_array($origin, array('tracking_course','user_course'))){
// update score when you qualify the exercises in Learning path detail
if (isset($_REQUEST['lp_item_id']) && isset($_REQUEST['lp_item_view_id']) && isset($_REQUEST['student_id']) && isset($_REQUEST['total_score'])) {
if (isset($_REQUEST['lp_item_id']) && isset($_REQUEST['lp_item_view_id']) && isset($_REQUEST['student_id']) && isset($_REQUEST['total_score']) && isset($_REQUEST['total_time'])) {
$lp_item_id = $_REQUEST['lp_item_id'];
$lp_item_view_id = $_REQUEST['lp_item_view_id'];
$student_id = $_REQUEST['student_id'];
if ($lp_item_id == strval(intval($lp_item_id)) && $lp_item_view_id == strval(intval($lp_item_view_id)) && $student_id == strval(intval($student_id))) {
$score = (float)$_REQUEST['total_score'];
$sql_update_score = "UPDATE $TBL_LP_ITEM_VIEW SET score = $score WHERE lp_item_id = '".(int)$lp_item_view_id."'
$score = (float)$_REQUEST['total_score'];
$total_time = (int)$_REQUEST['total_time'];
$sql_update_score = "UPDATE $TBL_LP_ITEM_VIEW SET score = $score,total_time = $total_time WHERE lp_item_id = '".(int)$lp_item_view_id."'
AND lp_view_id = (SELECT id from $TBL_LP_VIEW WHERE user_id = '".(int)$student_id."' and lp_id='".(int)$lp_item_id."')";
api_sql_query($sql_update_score,__FILE__,__LINE__);
}

@ -29,7 +29,7 @@
* @author Olivier Brouckaert, main author
* @author Roan Embrechts, some refactoring
* @author Julio Montoya Armas switchable fill in blank option added
* @version $Id: exercise_result.php 18623 2009-02-20 17:49:23Z cfasanando $
* @version $Id: exercise_result.php 18637 2009-02-23 21:29:20Z cfasanando $
*
* @todo split more code up in functions, move functions to library?
*/
@ -1050,7 +1050,7 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
<?php
} else {
?>
<button type="button" class="save" onclick="top.location.href='../newscorm/lp_controller.php?cidReq=<?php echo api_get_course_id()?>&amp;action=view&amp;lp_id=<?php echo $learnpath_id ?>&amp;lp_item_id=<?php echo $learnpath_item_id ?>'" value="<?php echo get_lang('Finish'); ?>"><?php echo get_lang('Finish');?></button>
<button type="button" class="save" onclick="top.location.href='../newscorm/lp_controller.php?cidReq=<?php echo api_get_course_id()?>&amp;action=view&amp;lp_id=<?php echo $learnpath_id ?>&amp;lp_item_id=<?php echo $learnpath_item_id ?>&amp;exeId=<?php echo $exeId ?>';" value="<?php echo get_lang('Finish'); ?>"><?php echo get_lang('Finish');?></button>
<?php }?>
</td>
</tr>

@ -105,6 +105,10 @@ if ( empty ( $questionList ) ) {
if ( empty ( $objExercise ) ) {
$objExercise = $_SESSION['objExercise'];
}
if ( empty ( $exeId ) ) {
$exeId = $_REQUEST['id'];
}
$is_allowedToEdit=api_is_allowed_to_edit() || $is_courseTutor;
$nameTools=get_lang('CorrectTest');
@ -1034,6 +1038,7 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
<input type = "hidden" name="lp_item_view_id" value="<?php echo Security::remove_XSS($_GET['my_lp_id']); ?>">
<input type = "hidden" name="student_id" value="<?php echo Security::remove_XSS($_GET['student']);?>">
<input type = "hidden" name="total_score" value="<?php echo $totalScore; ?>">
<input type = "hidden" name="total_time" value="<?php echo Security::remove_XSS($_GET['total_time']);?>">
<?php
}
} else {
@ -1048,7 +1053,7 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
}
if ($origin=='learnpath' || $origin=='student_progress') {?>
<button type="button" class="save" onclick="top.location.href='../newscorm/lp_controller.php?cidReq=<?php echo api_get_course_id()?>&amp;action=view&amp;lp_id=<?php echo $learnpath_id ?>&amp;lp_item_id=<?php echo $learnpath_item_id ?>'" value="<?php echo get_lang('Finish'); ?>" ><?php echo get_lang('Finish');?></button>
<button type="button" class="save" onclick="top.location.href='../newscorm/lp_controller.php?cidReq=<?php echo api_get_course_id()?>&amp;action=view&amp;lp_id=<?php echo $learnpath_id ?>&amp;lp_item_id=<?php echo $learnpath_item_id ?>&amp;exeId=<?php echo $exeId ?>'" value="<?php echo get_lang('Finish'); ?>" ><?php echo get_lang('Finish');?></button>
<?php } else if($origin=='myprogress') {?>
<button type="button" class="save" onclick="top.location.href='../auth/my_progress.php?course=<?php echo api_get_course_id()?>'" value="<?php echo get_lang('Finish'); ?>" ><?php echo get_lang('Finish');?></button>
<?php }?>

@ -2242,12 +2242,29 @@ function get_terms()
else
{ //for all other content types...
if ($this->type=='quiz') {
$my_status = ' ';
$my_status = ' ';
$total_time = ' ';
if (!empty($_REQUEST['exeId'])) {
$TBL_TRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
require_once ('../reservation/rsys.php');
$safe_exe_id = Database::escape_string($_REQUEST['exeId']);
$sql = 'SELECT start_date,exe_date FROM ' . $TBL_TRACK_EXERCICES . ' WHERE exe_id = '.(int)$safe_exe_id;
$res = api_sql_query($sql,__FILE__,__LINE__);
$row_dates = Database::fetch_array($res);
$rsys = new Rsys();
$time_start_date = $rsys->mysql_datetime_to_timestamp($row_dates['start_date']);
$time_exe_date = $rsys->mysql_datetime_to_timestamp($row_dates['exe_date']);
$mytime = ((int)$time_exe_date-(int)$time_start_date);
$total_time =" total_time = ".$mytime.", ";
}
}else {
$my_status = " status = '".$this->get_status(false)."' ,";
$my_status = " status = '".$this->get_status(false)."' ,";
$total_time =" total_time = ".$this->get_total_time().", ";
}
$sql = "UPDATE $item_view_table " .
"SET total_time = ".$this->get_total_time().", " .
"SET " .$total_time.
" start_time = ".$this->get_current_start_time().", " .
" score = ".$this->get_score().", " .
$my_status.

@ -33,6 +33,7 @@ require_once('learnpath.class.php');
require_once ('resourcelinker.inc.php');
require_once ('../inc/lib/tracking.lib.php');
require_once ('../inc/lib/course.lib.php');
require_once ('../reservation/rsys.php');
if(empty($_SESSION['_course']['id']) && isset($_GET['course']))
@ -360,13 +361,19 @@ foreach ($list as $my_item_id) {
$my_maxscore = $row_attempts['exe_weighting'];
$my_exe_id = $row_attempts['exe_id'];
$my_orig_lp = $row_attempts['orig_lp_id'];
$my_orig_lp_item = $row_attempts['orig_lp_item_id'];
$my_orig_lp_item = $row_attempts['orig_lp_item_id'];
$rsys = new Rsys();
$mktime_start_date = $rsys->mysql_datetime_to_timestamp($row_attempts['start_date']);
$mktime_exe_date = $rsys->mysql_datetime_to_timestamp($row_attempts['exe_date']);
$mytime = ((int)$mktime_start_date-(int)$mktime_start_date);
$time_attemp = learnpathItem :: get_scorm_time('js', $mytime);
$time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp);
$output .= '<tr class="'.$oddclass.'"><td>&nbsp;</td><td>'.$extend_attempt_link.'</td><td colspan="3">' . htmlentities(get_lang('Attempt'), ENT_QUOTES, $dokeos_charset) . ' ' . $n . '</td>'
. '<td colspan="2"><font color="' . $color . '"><div class="mystatus">' . $my_lesson_status . '</div></font></td><td colspan="2"><div class="mystatus" align="center">' . ($my_score == 0 ? '-' : ($my_maxscore == 0 ? $my_score : $my_score . '/' . $my_maxscore)) . '</div></td><td colspan="2"><div class="mystatus">' . $time . '</div></td>';
. '<td colspan="2"><font color="' . $color . '"><div class="mystatus">' . $my_lesson_status . '</div></font></td><td colspan="2"><div class="mystatus" align="center">' . ($my_score == 0 ? '0.00/'.$my_maxscore : ($my_maxscore == 0 ? $my_score : $my_score . '/' . $my_maxscore)) . '</div></td><td colspan="2"><div class="mystatus">' . $time_attemp . '</div></td>';
if ($origin != 'tracking') {
$output .= '<td><a href="../exercice/exercise_show.php?origin=student_progress&myid='.$my_orig_lp.'&my_lp_id='.$my_orig_lp_item.'&id=' . $my_exe_id . '&cidReq=' . $course_code . '&student=' . $_GET['student_id'] . '" target="_parent"><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" title="'.get_lang('ShowAttempt').'"></a></td>';
} else {
$output .= '<td><a href="../exercice/exercise_show.php?origin=tracking_course&myid='.$my_orig_lp.'&my_lp_id='.$my_orig_lp_item.'&id=' . $my_exe_id . '&cidReq=' . $course_code . '&student=' . $_GET['student_id'] . '" target="_parent"><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" title="'.get_lang('ShowAndQualifyAttempt').'"></a></td>';
$output .= '<td><a href="../exercice/exercise_show.php?origin=tracking_course&myid='.$my_orig_lp.'&my_lp_id='.$my_orig_lp_item.'&id=' . $my_exe_id . '&cidReq=' . $course_code . '&student=' . $_GET['student_id'] . '&total_time='.$mytime.'" target="_parent"><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" title="'.get_lang('ShowAndQualifyAttempt').'"></a></td>';
}
$output .= '</tr>';
$n++;

Loading…
Cancel
Save