Some more cleaning

skala
Julio Montoya 16 years ago
parent 74f90fb13d
commit a9ac9bd86f
  1. 7
      main/exercice/addlimits.php
  2. 34
      main/exercice/exercice.php
  3. 20
      main/exercice/exercise_show.php

@ -123,13 +123,10 @@ $interbreadcrumb[]=array("url" => "exercice.php","name" => get_lang('Exercices')
Display::display_header($nameTools,"Exercise");
/*
-----------------------------------------------------------
Action handling
-----------------------------------------------------------
*/
include('../inc/global.inc.php');
if (isset($_POST['ok']))
{
require_once '../inc/global.inc.php';
if (isset($_POST['ok'])) {
$message = get_lang('TestLimitsAdded');
Display::display_normal_message($message);
}

@ -38,9 +38,7 @@ require_once api_get_path(LIBRARY_PATH) . 'mail.lib.inc.php';
require_once api_get_path(LIBRARY_PATH) . 'usermanager.lib.php';
/*
-----------------------------------------------------------
Constants and variables
-----------------------------------------------------------
*/
$is_allowedToEdit = api_is_allowed_to_edit(null,true);
$is_tutor = api_is_allowed_to_edit(true);
@ -130,7 +128,7 @@ if ($_GET['delete'] == 'delete' && ($is_allowedToEdit || api_is_coach()) && !emp
}
if ($show == 'result' && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit || $is_tutor) && $_GET['exeid']== strval(intval($_GET['exeid']))) {
$id = $_GET['exeid']; //filtered by post-condition
$id = intval($_GET['exeid']); //filtered by post-condition
$emailid = $_GET['emailid'];
$test = $_GET['test'];
$from = $_SESSION['_user']['mail'];
@ -181,16 +179,15 @@ if ($show == 'result' && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit
Database::query($query);
$qry = 'SELECT sum(marks) as tot
FROM '.$TBL_TRACK_ATTEMPT.' WHERE exe_id = '.intval($id).'
FROM '.$TBL_TRACK_ATTEMPT.' WHERE exe_id = '.$id.'
GROUP BY question_id';
$res = Database::query($qry);
$tot = Database::result($res,0,'tot');
//updating also the total weight
$totquery = "UPDATE $TBL_TRACK_EXERCICES SET exe_result = '".Database::escape_string($tot)."', exe_weighting = '".Database::escape_string($total_weighting)."'
WHERE exe_Id='".Database::escape_string($id)."'";
WHERE exe_Id='".$id."'";
Database::query($totquery);
$recording_changes = 'INSERT INTO '.$TBL_RECORDING.' ' .
'(exe_id,
@ -341,10 +338,8 @@ if ($show == 'result' && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit
//mail($emailid, $subject, $mess,$headers);
@api_mail_html($emailid, $emailid, $subject, $mess, $from_name, $from);
if (in_array($origin, array (
'tracking_course',
'user_course'
))) {
if (in_array($origin, array ('tracking_course','user_course'))) {
if (isset ($_POST['lp_item_id']) && isset ($_POST['lp_item_view_id']) && isset ($_POST['student_id']) && isset ($_POST['total_score']) && isset ($_POST['total_time']) && isset ($_POST['totalWeighting'])) {
$lp_item_id = $_POST['lp_item_id'];
$lp_item_view_id = $_POST['lp_item_view_id'];
@ -985,12 +980,11 @@ if ($show == 'test') {
<?php
}
// export qti ...
echo '<a href="exercice.php?choice=exportqti2&exerciseId='.$row['id'].'"><img src="../img/export.png" border="0" title="IMS/QTI" /></a>';
echo "</td>";
echo "</tr>\n";
echo "</tr>";
} else { // student only
?>
<tr>
@ -1043,10 +1037,7 @@ if ($show == 'test') {
} else {
echo get_lang('CantShowResults');
}
?></td>
</tr>
<?php
echo '</td></tr>';
}
// skips the last exercise, that is only used to know if we have or not to create a link "Next page"
if ($i == $limitExPage) {
@ -1105,7 +1096,6 @@ if ($show == 'test') {
}
// prof only
if ($is_allowedToEdit) {
/************/
?>
<tr>
@ -1151,9 +1141,6 @@ if ($show == 'test') {
}
}
?>
<?php
if ($ind == $limitExPage) {
break;
}
@ -1168,15 +1155,10 @@ if ($show == 'test') {
}
} //end if ($origin != 'learnpath') {
?>
</table>
<?php
echo '</table>';
}
/*****************************************/
/* Exercise Results (uses tracking tool) */
/*****************************************/
// if tracking is enabled
if ($_configuration['tracking_enabled'] && ($show == 'result')) {

@ -1,13 +1,11 @@
<?php //$id: $
/* For licensing terms, see /license.txt */
/**
*
* @package chamilo.exercise
** @package chamilo.exercise
* @author Julio Montoya Armas Added switchable fill in blank option added
* @version $Id: exercise_show.php 22256 2009-07-20 17:40:20Z ivantcholakov $
* @package chamilo.exercise
* @todo remove the debug code and use the general debug library
* @todo use the Database:: functions
* @todo small letters for table variables
*/
@ -228,16 +226,8 @@ function getFCK(vals,marksid)
</script>
<?php
/*
==============================================================================
MAIN CODE
==============================================================================
*/
// Email configuration settings
@ -330,14 +320,14 @@ if ($show_results == true ) {
<td style="font-weight:bold" width="10%"><div class="actions-message"><?php echo '&nbsp;'.get_lang('User')?> : </div></td>
<td><div class="actions-message" width="90%"><?php
if (isset($_GET['cidReq'])) {
$course_code=Security::remove_XSS($_GET['cidReq']);
$course_code = Security::remove_XSS($_GET['cidReq']);
} else {
$course_code=api_get_course_id();
$course_code = api_get_course_id();
}
if (isset($_GET['student'])) {
$user_id=Security::remove_XSS($_GET['student']);
$user_id = Security::remove_XSS($_GET['student']);
}else {
$user_id=api_get_user_id();
$user_id = api_get_user_id();
}
$status_info=CourseManager::get_user_in_course_status($user_id,$course_code);

Loading…
Cancel
Save