Browse Source

Fixing question edition

Julio Montoya 12 years ago
parent
commit
3b38a68604

+ 2 - 2
main/exercice/question.class.php

@@ -1540,7 +1540,7 @@ abstract class Question
             $form->addElement('html', '</div>');
         }
 
-
+        //@todo why we need this condition??
         if (!isset($_GET['fromExercise'])) {
             switch ($answerType) {
                 case 1:
@@ -1564,9 +1564,9 @@ abstract class Question
             }
         }
 
-
         // default values
         $defaults                        = array();
+
         $defaults['questionName']        = $this->question;
         $defaults['questionDescription'] = $this->description;
         $defaults['questionLevel']       = $this->level;

+ 1 - 1
main/exercice/question_list_admin.inc.php

@@ -173,7 +173,7 @@ if (!$inATest) {
 				$question_class = get_class($objQuestionTmp);
 
 				$clone_link = '<a href="'.api_get_self().'?'.api_get_cidreq().'&clone_question='.$id.'">'.Display::return_icon('cd.gif',get_lang('Copy'), array(), ICON_SIZE_SMALL).'</a>';
-				$edit_link  = '<a href="'.api_get_self().'?'.api_get_cidreq().'&type='.$objQuestionTmp->selectType().'&myid=1&editQuestion='.$id.'">'.Display::return_icon('edit.png',get_lang('Modify'), array(), ICON_SIZE_SMALL).'</a>';
+				$edit_link  = '<a href="'.api_get_self().'?'.api_get_cidreq().'&fromExercise='.$exerciseId.'&type='.$objQuestionTmp->selectType().'&myid=1&editQuestion='.$id.'">'.Display::return_icon('edit.png',get_lang('Modify'), array(), ICON_SIZE_SMALL).'</a>';
 				if ($objExercise->edit_exercise_in_lp == true) {
 				     $delete_link = '<a id="delete_'.$id.'" class="opener"  href="'.api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId.'&deleteQuestion='.$id.'" >'.Display::return_icon('delete.png',get_lang('RemoveFromTest'), array(), ICON_SIZE_SMALL).'</a>';
 				}

+ 1 - 1
main/exercice/question_list_pagination_admin.inc.php

@@ -91,7 +91,7 @@ if ($objExercise->edit_exercise_in_lp == true) {
 }
 //With this function we can add actions to the jgrid (edit, delete, etc)
 $action_links = 'function action_formatter(cellvalue, options, rowObject) {
-    return \'<a href="?myid=1&cidReq='.$courseCode.'&editQuestion=\'+options.rowId+\'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'.
+    return \'<a href="?fromExercise='.$exerciseId.'&myid=1&cidReq='.$courseCode.'&editQuestion=\'+options.rowId+\'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'.
     '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."\'".')) return false;" href="?cidReq='.$courseCode.'&sec_token='.$token.'&clone_question=\'+options.rowId+\'">'.Display::return_icon('cd.gif',get_lang('Copy'), '',ICON_SIZE_SMALL).'</a>'.
     $delete_link.'\';
 }';