123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- <?php
- if(!defined('ALLOWED_TO_INCLUDE')) {
- exit();
- }
- if($deleteQuestion) {
-
- if($objQuestionTmp = Question::read($deleteQuestion)) {
- $objQuestionTmp->delete($exerciseId);
-
- if($objExercise->removeFromList($deleteQuestion)) {
- $nbrQuestions--;
- }
- }
-
- unset($objQuestionTmp);
- }
- ?>
- <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,
- collapsible: true,
- header: "> div > h3"
- })
-
- .sortable({
- cursor: "move",
- 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",
- handle: ".moved",
- stop: function() {
- stop = true;
- }
- });
-
-
- });
- </script>
- <?php
- echo '<div class="actionsbig">';
- Question :: display_type_menu ($objExercise->feedbacktype);
- echo '</div><div style="clear:both;">';
- echo '<div id="message"></div>';
- $token = Security::get_token();
- if ($nbrQuestions) {
- $my_exercise = new Exercise();
-
- $my_exercise->read($_GET['exerciseId']);
- $questionList=$my_exercise->selectQuestionList();
-
- $i=1;
-
- if (is_array($questionList)) {
- echo '<div id="question_list">';
- foreach($questionList as $id) {
-
- if (!is_numeric($id)) {
- continue;
- }
- $objQuestionTmp = Question :: read($id);
- $question_class = get_class($objQuestionTmp);
- $label = $question_class->$explanationLangVar;
-
- $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>';
-
- if ($show_quiz_edition) {
- $delete_link = '<a href="'.api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId.'&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>';
- }
- $actions = Display::tag('div',$edit_link.$delete_link, array('style'=>'float:right'));
- echo '<div id="question_id_list_'.$id.'" >';
- $move = Display::return_icon('move.png',get_lang('Move'), array('class'=>'moved'));
- echo Display::tag('h3','<a href="#">'.$move.' '.$objQuestionTmp->selectTitle().'</a>');
- echo '<div>';
-
- echo '<p>';
- echo $actions;
- echo get_lang($question_class.$label);
- echo '<br />';
- echo get_lang('Level').': '.$objQuestionTmp->selectLevel();
- echo '<br />';
- showQuestion($id, false, '', '',false, true);
- echo '</p>';
-
- echo '</div>';
- echo '</div>';
- unset($objQuestionTmp);
- }
- echo '</div>';
- }
- }
- ?>
- </table></div>
- <table border="0" align="center" cellpadding="2" cellspacing="2" width="100%">
- <?php
- if(!$i) {
- ?>
- <tr>
- <td><?php echo get_lang('NoQuestion'); ?></td>
- </tr>
- <?php
- }
- ?>
- </table>
|