skala
Juan Carlos Raña 16 years ago
commit fbd4d0d650
  1. 4
      main/conference/index.php
  2. 40
      main/exercice/answer.class.php
  3. 312
      main/exercice/exercice.php
  4. 32
      main/exercice/exercise.class.php
  5. 18
      main/exercice/question.class.php
  6. 2
      main/inc/lib/main_api.lib.php
  7. 28
      main/link/link.php
  8. 48
      main/link/linkfunctions.php

@ -5,8 +5,8 @@
*/
require_once '../inc/global.inc.php';
api_protect_course_script();
//Not sure what values can be set here I just found that $_SESSION["roomType"] could be the string "conference"
if ($_GET['type'] == 'conference') {
// Only allow conference or classroom modes. Others are likely to be attacks
if ($_GET['type'] == 'conference' or $_GET['type'] == 'classroom') {
$_SESSION["roomType"] = $_GET['type'];
}
?>

@ -13,31 +13,31 @@ if(!class_exists('Answer')):
class Answer
{
var $questionId;
public $questionId;
// these are arrays
var $answer;
var $correct;
var $comment;
var $weighting;
var $position;
var $hotspot_coordinates;
var $hotspot_type;
var $destination;
public $answer;
public $correct;
public $comment;
public $weighting;
public $position;
public $hotspot_coordinates;
public $hotspot_type;
public $destination;
// these arrays are used to save temporarily new answers
// then they are moved into the arrays above or deleted in the event of cancellation
var $new_answer;
var $new_correct;
var $new_comment;
var $new_weighting;
var $new_position;
var $new_hotspot_coordinates;
var $new_hotspot_type;
var $nbrAnswers;
var $new_nbrAnswers;
var $new_destination; // id of the next question if feedback option is set to Directfeedback
public $new_answer;
public $new_correct;
public $new_comment;
public $new_weighting;
public $new_position;
public $new_hotspot_coordinates;
public $new_hotspot_type;
public $nbrAnswers;
public $new_nbrAnswers;
public $new_destination; // id of the next question if feedback option is set to Directfeedback
/**
* constructor of the class

@ -643,9 +643,6 @@ if ($is_allowedToEdit) {
$res = Database::query($query);
$row = Database :: fetch_array($res, 'ASSOC');
api_item_property_update($_course, TOOL_DOCUMENT, $row['id'], 'invisible', $_user['user_id']);
#$query = "UPDATE $TBL_DOCUMENT SET visibility='$newVisibilityStatus' WHERE path=\"".$file."\""; //added by Toon
#Database::query($query);
//$dialogBox = get_lang('ViMod');
break;
default :
break;
@ -675,7 +672,7 @@ HotPotGCt($documentPath, 1, $_user['user_id']);
//condition for the session
$session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id);
$condition_session = api_get_session_condition($session_id,true,true);
// only for administrator
if ($is_allowedToEdit) {
@ -686,7 +683,6 @@ if ($is_allowedToEdit) {
}
elseif ($show == 'test') { // only for students
$sql = "SELECT id, title, type, description, results_disabled, session_id, start_time FROM $TBL_EXERCICES WHERE active='1' $condition_session ORDER BY title LIMIT " . (int) $from . "," . (int) ($limitExPage +1);
$result = Database::query($sql);
}
if ($show == 'test') {
@ -757,7 +753,6 @@ if (($is_allowedToEdit) and ($origin != 'learnpath')) {
echo '<a href="' . api_add_url_param($_SERVER['REQUEST_URI'], 'show=test') . '">' . Display :: return_icon('back.png', get_lang('GoBackToQuestionList')) . get_lang('GoBackToQuestionList') . '</a>';
echo '<a href="javascript: void(0);" onclick="javascript: document.form1a.submit();">'.Display::return_icon('csv.gif',get_lang('ExportAsCSV')).get_lang('ExportAsCSV').'</a>';
echo '<a href="javascript: void(0);" onclick="javascript: document.form1b.submit();">' . Display :: return_icon('excel.gif', get_lang('ExportAsXLS')) . get_lang('ExportAsXLS') . '</a>';
//echo '<a href="javascript: void(0);" onclick="javascript: document.form1c.submit();">'.Display::return_icon('synthese_view.gif',$alt).$alt.'</a>';
echo '<form id="form1a" name="form1a" method="post" action="' . api_get_self() . '?show=' . Security :: remove_XSS($_GET['show']) . '" style="display:inline">';
echo '<input type="hidden" name="export_report" value="export_report">';
echo '<input type="hidden" name="export_format" value="csv">';
@ -768,9 +763,6 @@ if (($is_allowedToEdit) and ($origin != 'learnpath')) {
echo '<input type="hidden" name="export_filter" value="'.(empty($filter)?1:intval($filter)).'">';
echo '<input type="hidden" name="export_format" value="xls">';
echo '</form>';
//echo '<form id="form1c" name="form1c" method="post" action="'.api_get_self().'?show='.Security::remove_XSS($_GET['show']).'">';
//echo $extra_user_fields;
//echo '</form>';
}
}
} else {
@ -783,35 +775,6 @@ if (($is_allowedToEdit) and ($origin != 'learnpath')) {
}
if ($_configuration['tracking_enabled']) {
if ($show == 'result') {
/*if (!function_exists('make_select'))
{
function make_select($name,$values,$checked='')
{
$output .= '<select name="'.$name.'" >';
foreach($values as $key => $value)
{
//$output .= '<option value="'.$key.'" '.(($checked==$key)?'selected="selected"':'').'>'.$value.'</option>';
}
$output .= '</select>';
return $output;
}
}*/
/*if (!function_exists('make_select_users'))
{
function make_select_users($name,$values,$checked='')
{
$output .= '<select name="'.$name.'" >';
$output .= '<option value="all">'.get_lang('EveryBody').'</option>';
foreach($values as $key => $value)
{
$output .= '<option value="'.$key.'" '.(($checked==$key)?'selected="selected"':'').'>'.$value.'</option>';
}
$output .= '</select>';
return $output;
}
}*/
if (api_is_allowed_to_edit(null,true)) {
if (!$_GET['filter']) {
$filter_by_not_revised = true;
@ -836,27 +799,9 @@ if ($_configuration['tracking_enabled']) {
} else {
$view_result = '<a href="' .api_get_self() . '?cidReq=' . api_get_course_id() . '&show=result&filter=1&gradebook='.$gradebook.'" >'.Display :: return_icon('un_check.gif', get_lang('ShowUnCorrectedOnly')).get_lang('ShowUnCorrectedOnly').'</a>';
}
//$form_filter = '<form method="post" action="'.api_get_self().'?cidReq='.api_get_course_id().'&show=result">';
//$form_filter .= make_select('filter',array(1=>get_lang('FilterByNotRevised'),2=>get_lang('FilterByRevised')),$filter);
//$form_filter .= '<button class="save" type="submit">'.get_lang('FilterExercices').'</button></form>';
echo $view_result;
}
}
/*if (api_is_allowed_to_edit())
{
$user_count = count($user_list_name);
if ($user_count >0 ) {
$form_filter = '<form method="post" action="'.api_get_self().'?cidReq='.api_get_course_id().'&show=result">';
$user_list_for_select =array();
for ($i=0;$i<$user_count;$i++) {
$user_list_for_select[$user_list_id[$i]]=$user_list_name[$i];
}
$form_filter .= make_select_users('filter_by_user',$user_list_for_select,(int)$_REQUEST['filter_by_user']);
$form_filter .= '<input type="hidden" name="filter" value="'.$filter.'">';
$form_filter .= '<input type="submit" value="'.get_lang('FilterExercicesByUsers').'"></form>';
echo $form_filter;
}
} */
}
echo '</div>'; // closing the actions div
@ -870,9 +815,6 @@ if ($show == 'test') {
<tr class="row_odd">
<th colspan="3"><?php echo get_lang('ExerciseName');?></th>
<th><?php echo get_lang('QuantityQuestions');?></th>
<!--<th>--><?php
?>
<!--</th>-->
<th><?php echo get_lang('Modify');?></th>
</tr>
<?php
@ -896,9 +838,7 @@ if ($show == 'test') {
$i = 1;
/*
*
* Listing exercises
*
*/
if ($origin != 'learnpath') {
//avoid sending empty parameters
@ -911,8 +851,8 @@ if ($show == 'test') {
//validacion when belongs to a session
$session_img = api_get_session_image($row['session_id'], $_user['status']);
// check if start time ...
$is_actived_time = true;
// check if start time
$is_actived_time = true;
if ($row['start_time'] != '0000-00-00 00:00:00' && api_strtotime($row['start_time']) > time()) {
$is_actived_time = false;
}
@ -943,138 +883,113 @@ if ($show == 'test') {
echo '</td>';
echo '<td align="center">';
$exid = $row['id'];
//count number exercice - teacher
$sqlquery = "SELECT count(*) FROM $TBL_EXERCICE_QUESTION WHERE exercice_id = '" . Database :: escape_string($exid) . "'";
$sqlresult = Database::query($sqlquery);
$rowi = Database :: result($sqlresult, 0);
//count number random exercice - teacher
$sql_random_query = 'SELECT type,random,active,results_disabled,max_attempt FROM ' . $TBL_EXERCICES . ' WHERE id="' . Database :: escape_string($exid) . '" ';
$rs_random = Database::query($sql_random_query);
$row_random = Database :: fetch_array($rs_random);
if ($row_random['random'] > 0) {
echo $row_random['random'] . ' ' . api_strtolower(get_lang(($row_random['random'] > 1 ? 'Questions' : 'Question'))) . '</td>';
} else {
echo $rowi . ' ' . api_strtolower(get_lang(($rowi > 1 ? 'Questions' : 'Question'))) . '</td>';
}
?>
<td>
<a href="admin.php?<?php echo api_get_cidreq()?>&amp;exerciseId=<?php echo $row['id']; ?>"><img src="../img/wizard_small.gif" border="0" title="<?php echo api_htmlentities(get_lang('Edit'),ENT_QUOTES,$charset); ?>" alt="<?php echo api_htmlentities(get_lang('Edit'),ENT_QUOTES,$charset); ?>" /></a>
<a href="exercice.php?<?php echo api_get_cidreq()?>&amp;choice=copy_exercise&amp;sec_token=<?php echo $token; ?>&amp;exerciseId=<?php echo $row['id']; ?>" onclick="javascript:if(!confirm('<?php echo addslashes(api_htmlentities(get_lang('AreYouSureToCopy'),ENT_QUOTES,$charset)); echo " ".addslashes($row['title']); echo "?"; ?>')) return false;"><img width="16" src="../img/cd.gif" border="0" title="<?php echo api_htmlentities(get_lang('CopyExercise'),ENT_QUOTES,$charset); ?>" alt="<?php echo api_htmlentities(get_lang('CopyExercise'),ENT_QUOTES,$charset); ?>" /></a>
<a href="exercice.php?<?php echo api_get_cidreq()?>&amp;choice=clean_results&amp;sec_token=<?php echo $token; ?>&amp;exerciseId=<?php echo $row['id']; ?>" onclick="javascript:if(!confirm('<?php echo addslashes(api_htmlentities(get_lang('AreYouSureToDeleteResults'),ENT_QUOTES,$charset)); echo " ".addslashes($row['title']); echo "?"; ?>')) return false;" ><img width="16" src="../img/clean_group.gif" border="0" title="<?php echo api_htmlentities(get_lang('CleanStudentResults'),ENT_QUOTES,$charset); ?>" alt="<?php echo api_htmlentities(get_lang('CleanStudentResults'),ENT_QUOTES,$charset); ?>" /></a>
<?php
if ($row['results_disabled']) {
//echo '<a href="exercice.php?choice=enable_results&page='.$page.'&exerciseId='.$row['id'].'" title="'.get_lang('EnableResults').'" alt="'.get_lang('EnableResults').'"><img src="../img/lp_quiz_na.gif" border="0" alt="'.api_htmlentities(get_lang('EnableResults'),ENT_QUOTES,$charset).'" /></a>';
} else {
//echo '<a href="exercice.php?choice=disable_results&page='.$page.'&exerciseId='.$row['id'].'" title="'.get_lang('DisableResults').'" alt="'.get_lang('DisableResults').'"><img src="../img/lp_quiz.gif" border="0" alt="'.api_htmlentities(get_lang('DisableResults'),ENT_QUOTES,$charset).'" /></a>';
}
?>
<!--<a href="exercise_admin.php?modifyExercise=yes&exerciseId=--><?php
?>
<!--"> <img src="../img/edit.gif" border="0" title="--><?php
?>
<!--" alt="--><?php
?>
<!--" /></a>-->
<a href="exercice.php?<?php echo api_get_cidreq() ?>&choice=delete&sec_token=<?php echo$token; ?>&amp;exerciseId=<?php echo $row['id']; ?>" onclick="javascript:if(!confirm('<?php echo addslashes(api_htmlentities(get_lang('AreYouSureToDelete'),ENT_QUOTES,$charset)); echo " ".addslashes($row['title']); echo "?"; ?>')) return false;"> <img src="../img/delete.gif" border="0" title="<?php echo get_lang('Delete'); ?>" alt="<?php echo api_htmlentities(get_lang('Delete'),ENT_QUOTES,$charset); ?>" /></a>
<?php
//if active
if ($row['active']) {
?>
<a href="exercice.php?<?php echo api_get_cidreq() ?>&choice=disable&sec_token=<?php echo$token; ?>&amp;page=<?php echo $page; ?>&exerciseId=<?php echo $row['id']; ?>"> <img src="../img/visible.gif" border="0" title="<?php echo get_lang('Deactivate'); ?>" alt="<?php echo api_htmlentities(get_lang('Deactivate'),ENT_QUOTES,$charset); ?>" /></a>
<?php
} else {
// else if not active
?>
<a href="exercice.php?<?php echo api_get_cidreq() ?>&choice=enable&sec_token=<?php echo$token; ?>&amp;page=<?php echo $page; ?>&exerciseId=<?php echo $row['id']; ?>"> <img src="../img/invisible.gif" border="0" title="<?php echo get_lang('Activate'); ?>" alt="<?php echo api_htmlentities(get_lang('Activate'),ENT_QUOTES,$charset); ?>" /></a>
<?php
}
// Export qti ...
echo '<a href="exercice.php?choice=exportqti2&exerciseId='.$row['id'].'"><img src="../img/export_db.png" border="0" title="IMS/QTI" /></a>';
echo "</td>";
echo "</tr>";
} else { // student only
?>
<tr>
<td><?php echo ($i+($page*$limitExPage)).'.'; ?></td>
<?php $row['title']=api_parse_tex($row['title']);?>
<td>
<?php
// if time is actived show link to exercise
if ($is_actived_time) { ?>
<a href="exercice_submit.php?<?php echo api_get_cidreq().$myorigin.$mylpid.$myllpitemid; ?>&exerciseId=<?php echo $row['id']; ?>"><?php echo $row['title']; ?></a>
<?php
} else {
echo $row['title'];
}
?>
</td>
<td align="center"> <?php
$exid = $row['id'];
//count number exercise questions
$sqlquery = "SELECT count(*) FROM $TBL_EXERCICE_QUESTION WHERE exercice_id = '" . Database :: escape_string($exid) . "'";
$sqlresult = Database::query($sqlquery);
$rowi = Database :: result($sqlresult, 0);
//count number random exercice
$sql_random_query = 'SELECT type,random,active,results_disabled,max_attempt FROM ' . $TBL_EXERCICES . ' WHERE id="' . Database :: escape_string($exid) . '" ';
$rs_random = Database::query($sql_random_query);
$row_random = Database :: fetch_array($rs_random);
if ($row_random['random'] > 0) {
echo $row_random['random'] . ' ' . api_strtolower(get_lang(($row_random['random'] > 1 ? 'Questions' : 'Question')));
} else {
//show results student
echo $rowi . ' ' . api_strtolower(get_lang(($rowi > 1 ? 'Questions' : 'Question')));
}
echo '</td>';
echo '<td align="center">';
$eid = $row['id'];
$uid = api_get_user_id();
//this query might be improved later on by ordering by the new "tms" field rather than by exe_id
$qry = "SELECT * FROM $TBL_TRACK_EXERCICES
WHERE exe_exo_id = '" . Database :: escape_string($eid) . "' and exe_user_id = '" . Database :: escape_string($uid) . "' AND exe_cours_id = '" . api_get_course_id() . "' AND status <>'incomplete' AND orig_lp_id = 0 AND orig_lp_item_id = 0 AND session_id = '" . api_get_session_id() . "'
ORDER BY exe_id DESC";
$qryres = Database::query($qry);
$num = Database :: num_rows($qryres);
//hide the results
if (!$is_actived_time) {
$my_result_disabled = $row['results_disabled'];
if ($my_result_disabled == 0) {
if ($num > 0) {
$row = Database :: fetch_array($qryres);
$percentage = 0;
if ($row['exe_weighting'] != 0) {
$percentage = ($row['exe_result'] / $row['exe_weighting']) * 100;
$exid = $row['id'];
//count number exercice - teacher
$sqlquery = "SELECT count(*) FROM $TBL_EXERCICE_QUESTION WHERE exercice_id = '" . Database :: escape_string($exid) . "'";
$sqlresult = Database::query($sqlquery);
$rowi = Database :: result($sqlresult, 0);
//count number random exercice - teacher
$sql_random_query = 'SELECT type,random,active,results_disabled,max_attempt FROM ' . $TBL_EXERCICES . ' WHERE id="' . Database :: escape_string($exid) . '" ';
$rs_random = Database::query($sql_random_query);
$row_random = Database :: fetch_array($rs_random);
if ($row_random['random'] > 0) {
echo $row_random['random'] . ' ' . api_strtolower(get_lang(($row_random['random'] > 1 ? 'Questions' : 'Question'))) . '</td>';
} else {
echo $rowi . ' ' . api_strtolower(get_lang(($rowi > 1 ? 'Questions' : 'Question'))) . '</td>';
}
echo '<td align="center">';
if ($session_id == $row['session_id']) {
?>
<a href="admin.php?<?php echo api_get_cidreq()?>&amp;exerciseId=<?php echo $row['id']; ?>"><img src="../img/wizard_small.gif" border="0" title="<?php echo api_htmlentities(get_lang('Edit'),ENT_QUOTES,$charset); ?>" alt="<?php echo api_htmlentities(get_lang('Edit'),ENT_QUOTES,$charset); ?>" /></a>
<a href="exercice.php?<?php echo api_get_cidreq()?>&amp;choice=copy_exercise&amp;sec_token=<?php echo $token; ?>&amp;exerciseId=<?php echo $row['id']; ?>" onclick="javascript:if(!confirm('<?php echo addslashes(api_htmlentities(get_lang('AreYouSureToCopy'),ENT_QUOTES,$charset)); echo " ".addslashes($row['title']); echo "?"; ?>')) return false;"><img width="16" src="../img/cd.gif" border="0" title="<?php echo api_htmlentities(get_lang('CopyExercise'),ENT_QUOTES,$charset); ?>" alt="<?php echo api_htmlentities(get_lang('CopyExercise'),ENT_QUOTES,$charset); ?>" /></a>
<a href="exercice.php?<?php echo api_get_cidreq()?>&amp;choice=clean_results&amp;sec_token=<?php echo $token; ?>&amp;exerciseId=<?php echo $row['id']; ?>" onclick="javascript:if(!confirm('<?php echo addslashes(api_htmlentities(get_lang('AreYouSureToDeleteResults'),ENT_QUOTES,$charset)); echo " ".addslashes($row['title']); echo "?"; ?>')) return false;" ><img width="16" src="../img/clean_group.gif" border="0" title="<?php echo api_htmlentities(get_lang('CleanStudentResults'),ENT_QUOTES,$charset); ?>" alt="<?php echo api_htmlentities(get_lang('CleanStudentResults'),ENT_QUOTES,$charset); ?>" /></a>
<a href="exercice.php?<?php echo api_get_cidreq() ?>&choice=delete&sec_token=<?php echo$token; ?>&amp;exerciseId=<?php echo $row['id']; ?>" onclick="javascript:if(!confirm('<?php echo addslashes(api_htmlentities(get_lang('AreYouSureToDelete'),ENT_QUOTES,$charset)); echo " ".addslashes($row['title']); echo "?"; ?>')) return false;"> <img src="../img/delete.gif" border="0" title="<?php echo get_lang('Delete'); ?>" alt="<?php echo api_htmlentities(get_lang('Delete'),ENT_QUOTES,$charset); ?>" /></a>
<?php
//if active
if ($row['active']) {
?>
<a href="exercice.php?<?php echo api_get_cidreq() ?>&choice=disable&sec_token=<?php echo$token; ?>&amp;page=<?php echo $page; ?>&exerciseId=<?php echo $row['id']; ?>"> <img src="../img/visible.gif" border="0" title="<?php echo get_lang('Deactivate'); ?>" alt="<?php echo api_htmlentities(get_lang('Deactivate'),ENT_QUOTES,$charset); ?>" /></a>
<?php
} else { // else if not active
?>
<a href="exercice.php?<?php echo api_get_cidreq() ?>&choice=enable&sec_token=<?php echo$token; ?>&amp;page=<?php echo $page; ?>&exerciseId=<?php echo $row['id']; ?>"> <img src="../img/invisible.gif" border="0" title="<?php echo get_lang('Activate'); ?>" alt="<?php echo api_htmlentities(get_lang('Activate'),ENT_QUOTES,$charset); ?>" /></a>
<?php
}
// Export qti ...
echo '<a href="exercice.php?choice=exportqti2&exerciseId='.$row['id'].'"><img src="../img/export_db.png" border="0" title="IMS/QTI" /></a>';
} else { // not session resource
echo get_lang('ExerciseEditionNotAvailableInSession');
}
echo "</td>";
echo "</tr>";
} else { // student only
?>
<tr>
<td><?php echo ($i+($page*$limitExPage)).'.'; ?></td>
<?php $row['title']=api_parse_tex($row['title']);?>
<td>
<?php
// if time is actived show link to exercise
if ($is_actived_time) { ?>
<a href="exercice_submit.php?<?php echo api_get_cidreq().$myorigin.$mylpid.$myllpitemid; ?>&exerciseId=<?php echo $row['id']; ?>"><?php echo $row['title']; ?></a>
<?php
} else {
echo $row['title'];
}
echo '</td><td align="center">';
$exid = $row['id'];
//count number exercise questions
$sqlquery = "SELECT count(*) FROM $TBL_EXERCICE_QUESTION WHERE exercice_id = '" . Database :: escape_string($exid) . "'";
$sqlresult = Database::query($sqlquery);
$rowi = Database :: result($sqlresult, 0);
//count number random exercice
$sql_random_query = 'SELECT type,random,active,results_disabled,max_attempt FROM ' . $TBL_EXERCICES . ' WHERE id="' . Database :: escape_string($exid) . '" ';
$rs_random = Database::query($sql_random_query);
$row_random = Database :: fetch_array($rs_random);
if ($row_random['random'] > 0) {
echo $row_random['random'] . ' ' . api_strtolower(get_lang(($row_random['random'] > 1 ? 'Questions' : 'Question')));
} else {
//show results student
echo $rowi . ' ' . api_strtolower(get_lang(($rowi > 1 ? 'Questions' : 'Question')));
}
echo '</td>';
echo '<td align="center">';
$eid = $row['id'];
$uid = api_get_user_id();
//this query might be improved later on by ordering by the new "tms" field rather than by exe_id
$qry = "SELECT * FROM $TBL_TRACK_EXERCICES
WHERE exe_exo_id = '" . Database :: escape_string($eid) . "' and exe_user_id = '" . Database :: escape_string($uid) . "' AND exe_cours_id = '" . api_get_course_id() . "' AND status <>'incomplete' AND orig_lp_id = 0 AND orig_lp_item_id = 0 AND session_id = '" . api_get_session_id() . "'
ORDER BY exe_id DESC";
$qryres = Database::query($qry);
$num = Database :: num_rows($qryres);
//hide the results
if (!$is_actived_time) {
$my_result_disabled = $row['results_disabled'];
if ($my_result_disabled == 0) {
if ($num > 0) {
$row = Database :: fetch_array($qryres);
$percentage = 0;
if ($row['exe_weighting'] != 0) {
$percentage = ($row['exe_result'] / $row['exe_weighting']) * 100;
}
echo get_lang('Attempted') . ' (' . get_lang('Score') . ': ';
printf("%1.2f\n", $percentage);
echo " %)";
} else {
echo get_lang('WillBeActivated' .' '. $row['start_time']);
}
echo get_lang('Attempted') . ' (' . get_lang('Score') . ': ';
printf("%1.2f\n", $percentage);
echo " %)";
} else {
echo get_lang('WillBeActivated' .' '. $row['start_time']);
echo get_lang('CantShowResults');
}
echo '</td></tr>';
} else {
echo get_lang('CantShowResults');
echo get_lang('NotAttempted');
}
echo '</td></tr>';
} else {
echo get_lang('NotAttempted');
}
}
// skips the last exercise, that is only used to know if we have or not to create a link "Next page"
if ($i == $limitExPage) {
break;
@ -1154,12 +1069,9 @@ if ($show == 'test') {
<a href="<?php echo $exercicePath; ?>?<?php echo api_get_cidreq() ?>&hpchoice=enable&amp;page=<?php echo $page; ?>&amp;file=<?php echo $path; ?>"><img src="../img/invisible.gif" border="0" title="<?php echo get_lang('Activate'); ?>" alt="<?php echo api_htmlentities(get_lang('Activate'),ENT_QUOTES,$charset); ?>" /></a>
<?php
}?>
<img src="../img/lp_quiz_na.gif" border="0" title="<?php echo get_lang('NotMarkActivity')?>" alt="" />
<?php/****************/
?></td>
<?php
}
echo '<img src="../img/lp_quiz_na.gif" border="0" title="'.get_lang('NotMarkActivity').'" alt="" />';
echo '</td>';
} else { // student only
if ($active == 1) {
$nbrActiveTests = $nbrActiveTests +1;
@ -1305,21 +1217,11 @@ if ($_configuration['tracking_enabled'] && ($show == 'result')) {
$result_disabled = 0;
if ($result_disabled == 0) {
//echo '<tr';
//if ($i % 2 == 0) {
//echo 'class="row_odd"';
//} else {
//echo 'class="row_even"';
//}
//echo '>';
$add_start_date = $lang_nostartdate;
if ($is_allowedToEdit || $is_tutor) {
$user = $results[$i][0];
//echo '<td>' . $user . ' </td>';
}
//echo '<td>' . $test . '</td>';
//echo '<td>';
if ($results[$i][7] != "0000-00-00 00:00:00") {
//echo ceil((($results[$i][4] - $results[$i][7]) / 60)) . ' ' . get_lang('MinMinutes');
$exe_date_timestamp = api_strtotime($results[$i][4], date_default_timezone_get());

@ -18,22 +18,22 @@ if(!class_exists('Exercise')):
class Exercise
{
var $id;
var $exercise;
var $description;
var $sound;
var $type;
var $random;
var $random_answers;
var $active;
var $timeLimit;
var $attempts;
var $feedbacktype;
var $end_time;
var $start_time;
var $questionList; // array with the list of this exercise's questions
var $results_disabled;
var $expired_time;
public $id;
public $exercise;
public $description;
public $sound;
public $type;
public $random;
public $random_answers;
public $active;
public $timeLimit;
public $attempts;
public $feedbacktype;
public $end_time;
public $start_time;
public $questionList; // array with the list of this exercise's questions
public $results_disabled;
public $expired_time;
/**
* constructor of the class
*

@ -32,15 +32,15 @@ define('MULTIPLE_ANSWER_COMBINATION', 9);
*/
abstract class Question
{
var $id;
var $question;
var $description;
var $weighting;
var $position;
var $type;
var $level;
var $picture;
var $exerciseList; // array with the list of exercises which this question is in
public $id;
public $question;
public $description;
public $weighting;
public $position;
public $type;
public $level;
public $picture;
public $exerciseList; // array with the list of exercises which this question is in
private $isContent;
static $typePicture = 'new_question.png';

@ -1573,7 +1573,7 @@ function api_get_session_image($session_id, $status_id) {
$session_img = '';
if ((int)$status_id != 5) { //check whether is not a student
if ($session_id > 0) {
$session_img = "&nbsp;".Display::return_icon('star.png', get_lang('ResourceSession'), array('align' => 'absmiddle'));
$session_img = "&nbsp;".Display::return_icon('star.png', get_lang('SessionSpecificResource'), array('align' => 'absmiddle'));
}
}
return $session_img;

@ -88,7 +88,7 @@ $nameTools = get_lang('Links');
// Condition for the session
$session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id, false);
$condition_session = api_get_session_condition($session_id, false, true);
if (isset($_GET['action']) && $_GET['action'] == 'addlink') {
$nameTools = '';
@ -306,7 +306,7 @@ if (api_is_allowed_to_edit(null, true) && isset($_GET['action'])) {
// Author : <input name="A" type="text" />
$default_values = '';
if ($_GET['action'] == 'editlink') {
if ($_GET['action'] == 'editlink') {
$filter = array('course_code'=> "'". api_get_course_id() ."'", 'field_id' => $specific_field['id'], 'ref_id' => Security::remove_XSS($_GET['id']), 'tool_id' => '\''. TOOL_LINK .'\'');
$values = get_specific_field_values_list($filter, array('value'));
if (!empty($values)) {
@ -382,15 +382,6 @@ if (api_is_allowed_to_edit(null, true) && isset($_GET['action'])) {
echo "</form>";
}
/*elseif(($_GET['action'] == 'importcsv') and !$submit_import) {
echo "<h4>", get_lang('CsvImport'), "</h4>\n\n",
"<form method=\"post\" action=\"".api_get_self()."?action=".$_GET['action']."&amp;urlview=".$urlview."\" enctype=\"multipart/form-data\">",
// uncomment if you want to set a limit: '<input type="hidden" name="MAX_FILE_SIZE" value="32768">', "\n",
'<input type="file" name="import_file" size="30">', "\n",
"<input type=\"Submit\" name=\"submitImport\" value=\"".get_lang('Ok')."\">",
"</form>";
echo get_lang('CsvExplain');
}*/
}
if (!empty($down)) {
@ -478,13 +469,16 @@ if (empty($_GET['action']) || ($_GET['action'] != 'editlink' && $_GET['action']
echo '<th width="81%" style="font-weight: bold; text-align:left;padding-left: 5px;">';
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;urlview='.Security::remove_XSS($newurlview).'">';
echo '<img src="../img/remove.gif" />&nbsp;&nbsp;'.Security::remove_XSS($myrow['category_title']).'</a><br />&nbsp;&nbsp;&nbsp;'.$myrow['description'];
echo '</th>';
if (api_is_allowed_to_edit(null, true)) {
echo '<th>';
showcategoryadmintools($myrow['id']);
echo '</th>';
if ($session_id == $myrow['session_id']) {
echo '<th>';
showcategoryadmintools($myrow['id']);
echo '</th>';
} else {
echo '<th>'.get_lang('EditionNotAvailableFromSession');
}
}
echo '</th>';
echo '</tr>';
echo '</table>';
echo showlinksofcategory($myrow['id']);
@ -515,4 +509,4 @@ if (empty($_GET['action']) || ($_GET['action'] != 'editlink' && $_GET['action']
echo '</table>';
}
Display::display_footer();
Display::display_footer();

@ -505,7 +505,7 @@ function showlinksofcategory($catid) {
// Condition for the session
$session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id);
$condition_session = api_get_session_condition($session_id, true, true);
$sqlLinks = "SELECT * FROM ".$tbl_link." link, ".$TABLE_ITEM_PROPERTY." itemproperties WHERE itemproperties.tool='".TOOL_LINK."' AND link.id=itemproperties.ref AND link.category_id='".$catid."' AND (itemproperties.visibility='0' OR itemproperties.visibility='1') $condition_session ORDER BY link.display_order DESC";
$result = Database::query($sqlLinks);
@ -531,28 +531,32 @@ function showlinksofcategory($catid) {
echo '<td style="text-align:center;">';
if (api_is_allowed_to_edit(null, true)) {
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=editlink&amp;category='.(!empty($category) ? $category : '').'&amp;id='.$myrow[0].'&amp;urlview='.$urlview.'" title="'.get_lang('Modify').'"><img src="../img/edit.gif" border="0" alt="', get_lang('Modify'), '" /></a>';
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=deletelink&amp;id=', $myrow[0], '&amp;urlview=', $urlview, "\" onclick=\"javascript: if(!confirm('".get_lang('LinkDelconfirm')."')) return false;\" title=\"".get_lang('Delete').'"><img src="../img/delete.gif" border="0" alt="', get_lang('Delete'), '" /></a>';
// DISPLAY MOVE UP COMMAND only if it is not the top link
if ($i != 1) {
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;urlview='.$urlview.'&amp;up=', $myrow[0], '" title="'.get_lang('Up').'"><img src="../img/up.gif" border="0" alt="'.get_lang('Up').'"/>', "</a>\n";
} else {
echo '<img src="'.api_get_path(WEB_IMG_PATH).'up_na.gif" border="0" alt="'.get_lang('Up').'"/>';
}
// DISPLAY MOVE DOWN COMMAND only if it is not the bottom link
if ($i < $numberoflinks) {
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;urlview='.$urlview.'&amp;down='.$myrow[0].'" title="'.get_lang('Down').'"><img src="../img/down.gif" border="0" alt="'.get_lang('Down').'"/>', "</a>\n";
if ($session_id == $myrow['session_id']) {
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=editlink&amp;category='.(!empty($category) ? $category : '').'&amp;id='.$myrow[0].'&amp;urlview='.$urlview.'" title="'.get_lang('Modify').'"><img src="../img/edit.gif" border="0" alt="', get_lang('Modify'), '" /></a>';
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=deletelink&amp;id=', $myrow[0], '&amp;urlview=', $urlview, "\" onclick=\"javascript: if(!confirm('".get_lang('LinkDelconfirm')."')) return false;\" title=\"".get_lang('Delete').'"><img src="../img/delete.gif" border="0" alt="', get_lang('Delete'), '" /></a>';
// DISPLAY MOVE UP COMMAND only if it is not the top link
if ($i != 1) {
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;urlview='.$urlview.'&amp;up=', $myrow[0], '" title="'.get_lang('Up').'"><img src="../img/up.gif" border="0" alt="'.get_lang('Up').'"/>', "</a>\n";
} else {
echo '<img src="'.api_get_path(WEB_IMG_PATH).'up_na.gif" border="0" alt="'.get_lang('Up').'"/>';
}
// DISPLAY MOVE DOWN COMMAND only if it is not the bottom link
if ($i < $numberoflinks) {
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;urlview='.$urlview.'&amp;down='.$myrow[0].'" title="'.get_lang('Down').'"><img src="../img/down.gif" border="0" alt="'.get_lang('Down').'"/>', "</a>\n";
} else {
echo '<img src="'.api_get_path(WEB_IMG_PATH).'down_na.gif" border="0" alt="'.get_lang('Down').'"/>';
}
if ($myrow['visibility'] == '1') {
echo '<a href="link.php?'.api_get_cidreq().'&amp;action=invisible&amp;id='.$myrow[0].'&amp;scope=link&amp;urlview='.$urlview.'" title="'.get_lang('Hide').'"><img src="../img/visible.gif" border="0" /></a>';
}
if ($myrow['visibility'] == '0') {
echo '<a href="link.php?'.api_get_cidreq().'&amp;action=visible&amp;id='.$myrow[0].'&amp;scope=link&amp;urlview='.$urlview.'" title="'.get_lang('Show').'"><img src="../img/invisible.gif" border="0" /></a>';
}
} else {
echo '<img src="'.api_get_path(WEB_IMG_PATH).'down_na.gif" border="0" alt="'.get_lang('Down').'"/>';
}
if ($myrow['visibility'] == '1') {
echo '<a href="link.php?'.api_get_cidreq().'&amp;action=invisible&amp;id='.$myrow[0].'&amp;scope=link&amp;urlview='.$urlview.'" title="'.get_lang('Hide').'"><img src="../img/visible.gif" border="0" /></a>';
}
if ($myrow['visibility'] == '0') {
echo '<a href="link.php?'.api_get_cidreq().'&amp;action=visible&amp;id='.$myrow[0].'&amp;scope=link&amp;urlview='.$urlview.'" title="'.get_lang('Show').'"><img src="../img/invisible.gif" border="0" /></a>';
echo get_lang('EditionNotAvailableFromSession');
}
}
echo '</td></tr>';

Loading…
Cancel
Save