|
|
|
|
@ -22,7 +22,7 @@ |
|
|
|
|
if(!defined('ALLOWED_TO_INCLUDE')) { |
|
|
|
|
exit(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
// moves a question up in the list |
|
|
|
|
if(isset($_GET['moveUp'])) { |
|
|
|
|
$check = Security::get_token('get'); |
|
|
|
|
@ -42,7 +42,7 @@ if(isset($_GET['moveDown'])) { |
|
|
|
|
} |
|
|
|
|
Security::clear_token(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
*/ |
|
|
|
|
// deletes a question from the exercise (not from the data base) |
|
|
|
|
if($deleteQuestion) { |
|
|
|
|
|
|
|
|
|
@ -55,55 +55,97 @@ if($deleteQuestion) { |
|
|
|
|
$nbrQuestions--; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// destruction of the Question object |
|
|
|
|
unset($objQuestionTmp); |
|
|
|
|
} |
|
|
|
|
echo '<div class="actionsbig">'; |
|
|
|
|
//we filter the type of questions we can add |
|
|
|
|
Question :: display_type_menu ($objExercise->feedbacktype); |
|
|
|
|
echo '</div>'; |
|
|
|
|
?> |
|
|
|
|
<style> |
|
|
|
|
.ui-state-highlight { height: 30px; line-height: 1.2em; } |
|
|
|
|
</style> |
|
|
|
|
<script> |
|
|
|
|
$(function() { |
|
|
|
|
var stop = false; |
|
|
|
|
$( "#question_list h3" ).click(function( event ) { |
|
|
|
|
if ( stop ) { |
|
|
|
|
event.stopImmediatePropagation(); |
|
|
|
|
event.preventDefault(); |
|
|
|
|
stop = false; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$( "#question_list" ) |
|
|
|
|
.accordion({ |
|
|
|
|
autoHeight: false, |
|
|
|
|
active: false, // all items closed by default |
|
|
|
|
collapsible: true , |
|
|
|
|
header: "> div > h3" |
|
|
|
|
}) |
|
|
|
|
.sortable({ |
|
|
|
|
cursor: "move", // works? |
|
|
|
|
update: function(event, ui) { |
|
|
|
|
var order = $(this).sortable("serialize") + "&a=update_question_order"; |
|
|
|
|
$.post("<?php echo api_get_path(WEB_AJAX_PATH)?>exercise.ajax.php", order, function(reponse){
|
|
|
|
|
$("#message").html(reponse); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
axis: "y", |
|
|
|
|
placeholder: "ui-state-highlight", //defines the yellow highlight |
|
|
|
|
handle: "h3", |
|
|
|
|
stop: function() { |
|
|
|
|
stop = true; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
</script> |
|
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
<div class="content_table"><table class="data_table"> |
|
|
|
|
<span class="row_odd"> |
|
|
|
|
<th><?php echo get_lang('Question'); ?></th>
|
|
|
|
|
<th><?php echo get_lang('Type');?></th>
|
|
|
|
|
<th><?php echo get_lang('Difficulty'); ?></th>
|
|
|
|
|
<!--<th><?php //echo get_lang('Export'); ?></th>-->
|
|
|
|
|
<th><?php echo get_lang('Modify'); ?></th>
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
|
|
<?php |
|
|
|
|
echo '<div class="actionsbig">'; |
|
|
|
|
//we filter the type of questions we can add |
|
|
|
|
Question :: display_type_menu ($objExercise->feedbacktype); |
|
|
|
|
echo '</div><div style="clear:both;">'; |
|
|
|
|
echo '<div id="message">ddddddddd</div>'; |
|
|
|
|
$token = Security::get_token(); |
|
|
|
|
|
|
|
|
|
if($nbrQuestions) { |
|
|
|
|
$questionList=$objExercise->selectQuestionList(); |
|
|
|
|
if ($nbrQuestions) { |
|
|
|
|
$my_exercise = new Exercise(); |
|
|
|
|
//forces the query to the database |
|
|
|
|
$my_exercise->read($_GET['exerciseId']); |
|
|
|
|
$questionList=$my_exercise->selectQuestionList(); |
|
|
|
|
|
|
|
|
|
$i=1; |
|
|
|
|
if (is_array($questionList)) { |
|
|
|
|
if (is_array($questionList)) { |
|
|
|
|
echo '<div id="question_list">'; |
|
|
|
|
foreach($questionList as $id) { |
|
|
|
|
//To avoid warning messages |
|
|
|
|
if (!is_numeric($id)) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$objQuestionTmp = Question :: read($id); |
|
|
|
|
|
|
|
|
|
//showQuestion($id); |
|
|
|
|
?> |
|
|
|
|
<tr <?php if($i%2==0) echo 'class="row_odd"'; else echo 'class="row_even"'; ?>>
|
|
|
|
|
<td><?php echo "$i. ".$objQuestionTmp->selectTitle(); ?></td>
|
|
|
|
|
<td><?php eval('echo get_lang('.get_class($objQuestionTmp).'::$explanationLangVar);'); ?></td>
|
|
|
|
|
<td align="center"><?php echo $objQuestionTmp->selectLevel(); ?></td>
|
|
|
|
|
<td> |
|
|
|
|
<a href="<?php echo api_get_self(); ?>?<?php echo api_get_cidreq() ?>&type=<?php echo $objQuestionTmp->selectType(); ?>&myid=1&editQuestion=<?php echo $id; ?>"><img src="../img/edit.gif" border="0" alt="<?php echo get_lang('Modify'); ?>" /></a>
|
|
|
|
|
<?php |
|
|
|
|
// this variable $show_quiz_edition comes from admin.php blocks the exercise/quiz modifications |
|
|
|
|
if ($show_quiz_edition) { ?> |
|
|
|
|
|
|
|
|
|
<a href="<?php echo api_get_self(); ?>?<?php echo api_get_cidreq() ?>&deleteQuestion=<?php echo $id; ?>" onclick="javascript:if(!confirm('<?php echo addslashes(api_htmlentities(get_lang('ConfirmYourChoice'))); ?>')) return false;"><img src="../img/delete.gif" border="0" alt="<?php echo get_lang('Delete'); ?>" /></a>
|
|
|
|
|
$question_class = get_class($objQuestionTmp); |
|
|
|
|
$label = $question_class->$explanationLangVar; |
|
|
|
|
|
|
|
|
|
//echo get_lang($question_class.$label); |
|
|
|
|
echo '<div id="question_id_list_'.$id.'">'; |
|
|
|
|
echo '<h3><a href="#">'.$objQuestionTmp->selectTitle().'</a></h3>'; |
|
|
|
|
echo '<div>'; |
|
|
|
|
echo '<p>'; |
|
|
|
|
|
|
|
|
|
//echo $objQuestionTmp->selectLevel(); |
|
|
|
|
|
|
|
|
|
echo $edit_link = '<a href="'.api_get_self().'?'.api_get_cidreq().'&type='.$objQuestionTmp->selectType().'&myid=1&editQuestion='.$id.'"><img src="../img/edit.gif" border="0" alt="'.get_lang('Modify').'" /></a>'; |
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
// this variable $show_quiz_edition comes from admin.php blocks the exercise/quiz modifications |
|
|
|
|
if ($show_quiz_edition) { |
|
|
|
|
echo $delete_link = '<a href="'.api_get_self().'?'.api_get_cidreq().' &deleteQuestion='.$id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'))).' \')) return false;"><img src="../img/delete.gif" border="0" alt="'.get_lang('Delete').'" /></a>'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
showQuestion($id, false, '', '',false); |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
if($i != 1) { ?> |
|
|
|
|
<a href="<?php echo api_get_self(); ?>?<?php echo api_get_cidreq() ?>&moveUp=<?php echo $id; ?>&token=<?php echo $token; ?>"><img src="../img/up.gif" border="0" alt="<?php echo get_lang('MoveUp'); ?>"></a>
|
|
|
|
|
<?php if($i == $nbrQuestions) { |
|
|
|
|
@ -117,14 +159,18 @@ if($nbrQuestions) { |
|
|
|
|
?> |
|
|
|
|
<a href="<?php echo api_get_self(); ?>?<?php echo api_get_cidreq() ?>&moveDown=<?php echo $id; ?>&token=<?php echo $token; ?>"><img src="../img/down.gif" border="0" alt="<?php echo get_lang('MoveDown'); ?>"></a>
|
|
|
|
|
<?php } ?> |
|
|
|
|
</td> |
|
|
|
|
|
|
|
|
|
<?php |
|
|
|
|
$i++; |
|
|
|
|
unset($objQuestionTmp); |
|
|
|
|
?> |
|
|
|
|
</tr> |
|
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
echo '</p>'; |
|
|
|
|
echo '</div>'; |
|
|
|
|
echo '</div>'; |
|
|
|
|
unset($objQuestionTmp); |
|
|
|
|
} |
|
|
|
|
echo '</div>'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
?> |
|
|
|
|
|