admin.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Exercise administration
  5. * This script allows to manage (create, modify) an exercise and its questions
  6. *
  7. * Following scripts are includes for a best code understanding :
  8. *
  9. * - exercise.class.php : for the creation of an Exercise object
  10. * - question.class.php : for the creation of a Question object
  11. * - answer.class.php : for the creation of an Answer object
  12. * - exercise.lib.php : functions used in the exercise tool
  13. * - exercise_admin.inc.php : management of the exercise
  14. * - question_admin.inc.php : management of a question (statement & answers)
  15. * - statement_admin.inc.php : management of a statement
  16. * - answer_admin.inc.php : management of answers
  17. * - question_list_admin.inc.php : management of the question list
  18. *
  19. * Main variables used in this script :
  20. *
  21. * - $is_allowedToEdit : set to 1 if the user is allowed to manage the exercise
  22. * - $objExercise : exercise object
  23. * - $objQuestion : question object
  24. * - $objAnswer : answer object
  25. * - $aType : array with answer types
  26. * - $exerciseId : the exercise ID
  27. * - $picturePath : the path of question pictures
  28. * - $newQuestion : ask to create a new question
  29. * - $modifyQuestion : ID of the question to modify
  30. * - $editQuestion : ID of the question to edit
  31. * - $submitQuestion : ask to save question modifications
  32. * - $cancelQuestion : ask to cancel question modifications
  33. * - $deleteQuestion : ID of the question to delete
  34. * - $moveUp : ID of the question to move up
  35. * - $moveDown : ID of the question to move down
  36. * - $modifyExercise : ID of the exercise to modify
  37. * - $submitExercise : ask to save exercise modifications
  38. * - $cancelExercise : ask to cancel exercise modifications
  39. * - $modifyAnswers : ID of the question which we want to modify answers for
  40. * - $cancelAnswers : ask to cancel answer modifications
  41. * - $buttonBack : ask to go back to the previous page in answers of type "Fill in blanks"
  42. *
  43. * @package chamilo.exercise
  44. * @author Olivier Brouckaert
  45. * Modified by Hubert Borderiou 21-10-2011 Question by category
  46. */
  47. /**
  48. * Code
  49. */
  50. use \ChamiloSession as Session;
  51. require_once 'exercise.class.php';
  52. require_once 'question.class.php';
  53. require_once 'answer.class.php';
  54. // Name of the language file that needs to be included
  55. $language_file = 'exercice';
  56. require_once '../inc/global.inc.php';
  57. $urlMainExercise = api_get_path(WEB_CODE_PATH).'exercice/';
  58. $current_course_tool = TOOL_QUIZ;
  59. $this_section = SECTION_COURSES;
  60. // Access control
  61. api_protect_course_script(true);
  62. $is_allowedToEdit = api_is_allowed_to_edit(null, true);
  63. if (!$is_allowedToEdit) {
  64. api_not_allowed(true);
  65. }
  66. /* stripslashes POST data */
  67. if ($_SERVER['REQUEST_METHOD'] == 'POST') {
  68. foreach ($_POST as $key => $val) {
  69. if (is_string($val)) {
  70. $_POST[$key] = stripslashes($val);
  71. } elseif (is_array($val)) {
  72. foreach ($val as $key2 => $val2) {
  73. $_POST[$key][$key2] = stripslashes($val2);
  74. }
  75. }
  76. $GLOBALS[$key] = $_POST[$key];
  77. }
  78. }
  79. // Get vars from GET
  80. if (empty($exerciseId)) {
  81. $exerciseId = isset($_GET['exerciseId']) ? intval($_GET['exerciseId']):'0';
  82. }
  83. if (empty($newQuestion)) {
  84. $newQuestion = isset($_GET['newQuestion']) ? $_GET['newQuestion'] : 0;
  85. }
  86. if (empty($modifyAnswers)) {
  87. $modifyAnswers = isset($_GET['modifyAnswers']) ? $_GET['modifyAnswers'] : 0;
  88. }
  89. if (empty($editQuestion)) {
  90. $editQuestion = isset($_GET['editQuestion']) ? $_GET['editQuestion'] : 0;
  91. }
  92. if (empty($modifyQuestion)) {
  93. $modifyQuestion = isset($_GET['modifyQuestion']) ? $_GET['modifyQuestion'] : 0;
  94. }
  95. if (empty($deleteQuestion)) {
  96. $deleteQuestion = isset($_GET['deleteQuestion']) ? $_GET['deleteQuestion'] : 0;
  97. }
  98. $clone_question = isset($_REQUEST['clone_question']) ? $_REQUEST['clone_question'] : 0;
  99. if (empty($questionId)) {
  100. $questionId = isset($_SESSION['questionId']) ? $_SESSION['questionId'] : 0;
  101. }
  102. /* Cleaning all incomplete attempts of the admin/teacher to avoid weird problems
  103. when changing the exercise settings, number of questions, etc */
  104. delete_all_incomplete_attempts(api_get_user_id(), $exerciseId, api_get_course_int_id(), api_get_session_id());
  105. /** @var Exercise $objExercise */
  106. $objExercise = Session::read('objExercise');
  107. /** @var Question $objQuestion */
  108. $objQuestion = Session::read('objQuestion');
  109. /** @var Answer $objAnswer */
  110. $objAnswer = Session::read('objAnswer');
  111. // document path
  112. $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
  113. // picture path
  114. $picturePath = $documentPath.'/images';
  115. // audio path
  116. $audioPath = $documentPath.'/audio';
  117. // the 5 types of answers
  118. $aType = array(
  119. get_lang('UniqueSelect'),
  120. get_lang('MultipleSelect'),
  121. get_lang('FillBlanks'),
  122. get_lang('Matching'),
  123. get_lang('FreeAnswer')
  124. );
  125. // tables used in the exercise tool
  126. if (!empty($_GET['action']) && $_GET['action'] == 'exportqti2' && !empty($_GET['questionId'])) {
  127. require_once 'export/qti2/qti2_export.php';
  128. $export = export_question($_GET['questionId'], true);
  129. $qid = (int)$_GET['questionId'];
  130. $archive_path = api_get_path(SYS_ARCHIVE_PATH);
  131. $temp_dir_short = uniqid();
  132. $temp_zip_dir = $archive_path."/".$temp_dir_short;
  133. if (!is_dir($temp_zip_dir)) {
  134. mkdir($temp_zip_dir, api_get_permissions_for_new_directories());
  135. }
  136. $temp_zip_file = $temp_zip_dir."/".api_get_unique_id().".zip";
  137. $temp_xml_file = $temp_zip_dir."/qti2export_".$qid.'.xml';
  138. file_put_contents($temp_xml_file, $export);
  139. $zip_folder = new PclZip($temp_zip_file);
  140. $zip_folder->add($temp_xml_file, PCLZIP_OPT_REMOVE_ALL_PATH);
  141. $name = 'qti2_export_'.$qid.'.zip';
  142. DocumentManager::file_send_for_download($temp_zip_file, true, $name);
  143. unlink($temp_zip_file);
  144. unlink($temp_xml_file);
  145. rmdir($temp_zip_dir);
  146. //DocumentManager::string_send_for_download($export,true,'qti2export_q'.$_GET['questionId'].'.xml');
  147. exit; //otherwise following clicks may become buggy
  148. }
  149. // Initializes the Exercise object.
  150. if (!is_object($objExercise)) {
  151. // construction of the Exercise object
  152. $objExercise = new Exercise();
  153. // creation of a new exercise if wrong or not specified exercise ID
  154. if ($exerciseId) {
  155. $objExercise->read($exerciseId, true);
  156. }
  157. // saves the object into the session
  158. Session::write('objExercise', $objExercise);
  159. }
  160. if ($objExercise->fastEdition) {
  161. $htmlHeadXtra[] = api_get_jqgrid_js();
  162. }
  163. $nbrQuestions = $objExercise->getQuestionCount();
  164. // Initializes the Question object
  165. if ($editQuestion || $newQuestion || $modifyQuestion || $modifyAnswers) {
  166. if ($editQuestion || $newQuestion) {
  167. // reads question data
  168. if ($editQuestion) {
  169. // question not found
  170. if (!$objQuestion = Question::read($editQuestion, null, $objExercise)) {
  171. api_not_allowed();
  172. }
  173. // saves the object into the session
  174. Session::write('objQuestion', $objQuestion);
  175. }
  176. }
  177. // Checks if the object exists.
  178. if (is_object($objQuestion)) {
  179. // gets the question ID
  180. $questionId = $objQuestion->selectId();
  181. }
  182. }
  183. // If cancelling an exercise.
  184. if (!empty($cancelExercise)) {
  185. // existing exercise
  186. if ($exerciseId) {
  187. unset($modifyExercise);
  188. } else {
  189. // new exercise
  190. // goes back to the exercise list
  191. header('Location: '.$urlMainExercise.'exercice.php');
  192. exit();
  193. }
  194. }
  195. // if cancelling question creation/modification
  196. if (!empty($cancelQuestion)) {
  197. // if we are creating a new question from the question pool
  198. if (!$exerciseId && !$questionId) {
  199. // goes back to the question pool
  200. header('Location: '.$urlMainExercise.'question_pool.php');
  201. exit();
  202. } else {
  203. // goes back to the question viewing
  204. $editQuestion = $modifyQuestion;
  205. unset($newQuestion, $modifyQuestion);
  206. }
  207. }
  208. if (!empty($clone_question) && !empty($objExercise->id)) {
  209. $old_question_obj = Question::read($clone_question, api_get_course_int_id());
  210. $old_question_obj->question = $old_question_obj->question.' - '.get_lang('Copy');
  211. $new_id = $old_question_obj->duplicate();
  212. $new_question_obj = Question::read($new_id, api_get_course_int_id());
  213. $new_question_obj->addToList($objExercise->id);
  214. // This should be moved to the duplicate function
  215. $new_answer_obj = new Answer($clone_question, null, $objExercise);
  216. $new_answer_obj->read();
  217. $new_answer_obj->duplicate($new_id);
  218. // Reloading tne $objExercise obj
  219. $objExercise->read($objExercise->id);
  220. header('Location: '.$urlMainExercise.'admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id);
  221. exit;
  222. }
  223. // if cancelling answer creation/modification
  224. if (!empty($cancelAnswers)) {
  225. // goes back to the question viewing
  226. $editQuestion = $modifyAnswers;
  227. unset($modifyAnswers);
  228. }
  229. $nameTools = get_lang('ExerciseManagement');
  230. // modifies the query string that is used in the link of tool name
  231. if ($editQuestion || $modifyQuestion || $newQuestion || $modifyAnswers) {
  232. $nameTools = get_lang('QuestionManagement');
  233. }
  234. if (isset($_SESSION['gradebook'])) {
  235. $gradebook = $_SESSION['gradebook'];
  236. }
  237. if (!empty($gradebook) && $gradebook == 'view') {
  238. $interbreadcrumb[] = array(
  239. 'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
  240. 'name' => get_lang('ToolGradebook')
  241. );
  242. }
  243. $interbreadcrumb[] = array("url" => $urlMainExercise."exercice.php", "name" => get_lang('Exercices'));
  244. if (isset($_GET['newQuestion']) || isset($_GET['editQuestion'])) {
  245. $interbreadcrumb[] = array("url" => $urlMainExercise."admin.php?exerciseId=".$objExercise->id, "name" => $objExercise->name);
  246. } else {
  247. $interbreadcrumb[] = array("url" => "#", "name" => $objExercise->name);
  248. }
  249. // if the question is duplicated, disable the link of tool name
  250. if (!empty($modifyIn) && $modifyIn == 'thisExercise') {
  251. if ($buttonBack) {
  252. $modifyIn = 'allExercises';
  253. } else {
  254. $noPHP_SELF = true;
  255. }
  256. }
  257. $htmlHeadXtra[] = '<script>
  258. function multiple_answer_true_false_onchange(variable) {
  259. var result = variable.checked;
  260. var id = variable.id;
  261. var weight_id = "weighting_" + id;
  262. var array_result=new Array();
  263. array_result[1]="1";
  264. array_result[0]= "-0.50";
  265. array_result[-1]= "0";
  266. if (result) {
  267. result = 1;
  268. } else {
  269. result = 0;
  270. }
  271. document.getElementById(weight_id).value = array_result[result];
  272. }
  273. $(function() {
  274. $( "#dialog:ui-dialog" ).dialog( "destroy" );
  275. $( "#dialog-confirm" ).dialog({
  276. autoOpen: false,
  277. show: "blind",
  278. resizable: false,
  279. height:150,
  280. modal: false
  281. });
  282. $(".opener").click(function() {
  283. var targetUrl = $(this).attr("href");
  284. $( "#dialog-confirm" ).dialog({
  285. modal: true,
  286. buttons: {
  287. "'.get_lang("Yes").'": function() {
  288. location.href = targetUrl;
  289. $( this ).dialog( "close" );
  290. },
  291. "'.get_lang("No").'": function() {
  292. $( this ).dialog( "close" );
  293. }
  294. }
  295. });
  296. $( "#dialog-confirm" ).dialog("open");
  297. return false;
  298. });
  299. });
  300. </script>';
  301. $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_CODE_PATH).'plugin/hotspot/JavaScriptFlashGateway.js"></script>';
  302. $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_CODE_PATH).'plugin/hotspot/hotspot.js"></script>';
  303. $htmlHeadXtra[] = "<script>
  304. <!--
  305. // Globals
  306. // Major version of Flash required
  307. var requiredMajorVersion = 7;
  308. // Minor version of Flash required
  309. var requiredMinorVersion = 0;
  310. // Minor version of Flash required
  311. var requiredRevision = 0;
  312. // the version of javascript supported
  313. var jsVersion = 1.0;
  314. // -->
  315. </script>
  316. <script language=\"VBScript\" type=\"text/vbscript\">
  317. <!-- // Visual basic helper required to detect Flash Player ActiveX control version information
  318. Function VBGetSwfVer(i)
  319. on error resume next
  320. Dim swControl, swVersion
  321. swVersion = 0
  322. set swControl = CreateObject(\"ShockwaveFlash.ShockwaveFlash.\" + CStr(i))
  323. if (IsObject(swControl)) then
  324. swVersion = swControl.GetVariable(\"\$version\")
  325. end if
  326. VBGetSwfVer = swVersion
  327. End Function
  328. // -->
  329. </script>
  330. <script language=\"JavaScript1.1\" type=\"text/javascript\">
  331. <!-- // Detect Client Browser type
  332. var isIE = (navigator.appVersion.indexOf(\"MSIE\") != -1) ? true : false;
  333. var isWin = (navigator.appVersion.toLowerCase().indexOf(\"win\") != -1) ? true : false;
  334. var isOpera = (navigator.userAgent.indexOf(\"Opera\") != -1) ? true : false;
  335. jsVersion = 1.1;
  336. // JavaScript helper required to detect Flash Player PlugIn version information
  337. function JSGetSwfVer(i){
  338. // NS/Opera version >= 3 check for Flash plugin in plugin array
  339. if (navigator.plugins != null && navigator.plugins.length > 0) {
  340. if (navigator.plugins[\"Shockwave Flash 2.0\"] || navigator.plugins[\"Shockwave Flash\"]) {
  341. var swVer2 = navigator.plugins[\"Shockwave Flash 2.0\"] ? \" 2.0\" : \"\";
  342. var flashDescription = navigator.plugins[\"Shockwave Flash\" + swVer2].description;
  343. descArray = flashDescription.split(\" \");
  344. tempArrayMajor = descArray[2].split(\".\");
  345. versionMajor = tempArrayMajor[0];
  346. versionMinor = tempArrayMajor[1];
  347. if ( descArray[3] != \"\" ) {
  348. tempArrayMinor = descArray[3].split(\"r\");
  349. } else {
  350. tempArrayMinor = descArray[4].split(\"r\");
  351. }
  352. versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
  353. flashVer = versionMajor + \".\" + versionMinor + \".\" + versionRevision;
  354. } else {
  355. flashVer = -1;
  356. }
  357. }
  358. // MSN/WebTV 2.6 supports Flash 4
  359. else if (navigator.userAgent.toLowerCase().indexOf(\"webtv/2.6\") != -1) flashVer = 4;
  360. // WebTV 2.5 supports Flash 3
  361. else if (navigator.userAgent.toLowerCase().indexOf(\"webtv/2.5\") != -1) flashVer = 3;
  362. // older WebTV supports Flash 2
  363. else if (navigator.userAgent.toLowerCase().indexOf(\"webtv\") != -1) flashVer = 2;
  364. // Can't detect in all other cases
  365. else {
  366. flashVer = -1;
  367. }
  368. return flashVer;
  369. }
  370. // When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
  371. function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
  372. {
  373. reqVer = parseFloat(reqMajorVer + \".\" + reqRevision);
  374. // loop backwards through the versions until we find the newest version
  375. for (i=25;i>0;i--) {
  376. if (isIE && isWin && !isOpera) {
  377. versionStr = VBGetSwfVer(i);
  378. } else {
  379. versionStr = JSGetSwfVer(i);
  380. }
  381. if (versionStr == -1 ) {
  382. return false;
  383. } else if (versionStr != 0) {
  384. if(isIE && isWin && !isOpera) {
  385. tempArray = versionStr.split(\" \");
  386. tempString = tempArray[1];
  387. versionArray = tempString .split(\",\");
  388. } else {
  389. versionArray = versionStr.split(\".\");
  390. }
  391. versionMajor = versionArray[0];
  392. versionMinor = versionArray[1];
  393. versionRevision = versionArray[2];
  394. versionString = versionMajor + \".\" + versionRevision; // 7.0r24 == 7.24
  395. versionNum = parseFloat(versionString);
  396. // is the major.revision >= requested major.revision AND the minor version >= requested minor
  397. if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {
  398. return true;
  399. } else {
  400. return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );
  401. }
  402. }
  403. }
  404. }
  405. // -->
  406. </script>";
  407. Display::display_header($nameTools, 'Exercise');
  408. if ($objExercise->exercise_was_added_in_lp) {
  409. if ($objExercise->force_edit_exercise_in_lp == true) {
  410. Display::display_warning_message(get_lang('ForceEditingExerciseInLPWarning'));
  411. } else {
  412. Display::display_warning_message(get_lang('EditingExerciseCauseProblemsInLP'));
  413. }
  414. }
  415. // If we are in a test
  416. $inATest = isset($exerciseId) && $exerciseId > 0;
  417. if ($inATest) {
  418. echo '<div class="actions">';
  419. if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid'])) {
  420. echo '<a href="'.$urlMainExercise.'admin.php?exerciseId='.$exerciseId.'">'.Display::return_icon(
  421. 'back.png',
  422. get_lang('GoBackToQuestionList'),
  423. '',
  424. ICON_SIZE_MEDIUM
  425. ).'</a>';
  426. }
  427. if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) && !isset($_GET['editQuestion'])) {
  428. echo '<a href="'.$urlMainExercise.'exercice.php?'.api_get_cidReq().'">'.Display::return_icon(
  429. 'back.png',
  430. get_lang('BackToExercisesList'),
  431. '',
  432. ICON_SIZE_MEDIUM
  433. ).'</a>';
  434. }
  435. echo '<a href="'.$urlMainExercise.'overview.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'&preview=1">'.Display::return_icon(
  436. 'preview_view.png',
  437. get_lang('Preview'),
  438. '',
  439. ICON_SIZE_MEDIUM
  440. ).'</a>';
  441. echo Display::url(
  442. Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_MEDIUM),
  443. $urlMainExercise.'exercise_report.php?'.api_get_cidReq().'&exerciseId='.$objExercise->id
  444. );
  445. if ($objExercise->edit_exercise_in_lp == false) {
  446. echo '<a href="">'.Display::return_icon(
  447. 'settings_na.png',
  448. get_lang('ModifyExercise'),
  449. '',
  450. ICON_SIZE_MEDIUM
  451. ).'</a>';
  452. } else {
  453. echo '<a href="'.$urlMainExercise.'exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'.
  454. Display::return_icon('settings.png', get_lang('ModifyExercise'), '', ICON_SIZE_MEDIUM ).'</a>';
  455. }
  456. // @todo if you have 5000 questions this will slow down everything
  457. /*
  458. $maxScoreAllQuestions = 0;
  459. if (!empty($objExercise->questionList)) {
  460. foreach ($objExercise->questionList as $q) {
  461. $question = Question::read($q);
  462. if ($question) {
  463. $maxScoreAllQuestions += $question->selectWeighting();
  464. }
  465. }
  466. }
  467. echo '<span style="float:right">'.sprintf(get_lang('XQuestionsWithTotalScoreY'), $objExercise->selectNbrQuestions(), $maxScoreAllQuestions ).'</span>';*/
  468. echo '</div>';
  469. } else {
  470. // we are in create a new question from question pool not in a test
  471. echo '<div class="actions">';
  472. echo '<a href="'.$urlMainExercise.'admin.php?exerciseId='.$objExercise->id.'&'.api_get_cidreq().'">'.
  473. Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'', ICON_SIZE_MEDIUM ).'</a>';
  474. echo '</div>';
  475. }
  476. if (isset($_GET['message'])) {
  477. if (in_array($_GET['message'], array('ExerciseStored', 'ItemUpdated', 'ItemAdded'))) {
  478. Display::display_confirmation_message(get_lang($_GET['message']));
  479. }
  480. }
  481. if ($newQuestion || $editQuestion) {
  482. // statement management
  483. if ($editQuestion) {
  484. $type = $objQuestion->selectType();
  485. } else {
  486. $type = Security::remove_XSS($_REQUEST['answerType']);
  487. }
  488. echo '<input type="hidden" name="Type" value="'.$type.'" />';
  489. // Create/Edit question.
  490. require 'question_admin.inc.php';
  491. }
  492. if (isset($_GET['hotspotadmin'])) {
  493. if (!is_object($objQuestion)) {
  494. $objQuestion = Question :: read($_GET['hotspotadmin']);
  495. }
  496. if (!$objQuestion) {
  497. api_not_allowed();
  498. }
  499. require 'hotspot_admin.inc.php';
  500. }
  501. if (!$newQuestion && !$modifyQuestion && !$editQuestion && !isset($_GET['hotspotadmin'])) {
  502. if ($objExercise->randomByCat == EXERCISE_CATEGORY_RANDOM_SHUFFLED || EXERCISE_CATEGORY_RANDOM_ORDERED) {
  503. Display::display_normal_message(get_lang('AllQuestionsMustHaveACategory'));
  504. }
  505. // Question list (drag n drop view)
  506. // @todo this bad do not require files like this
  507. if ($objExercise->fastEdition) {
  508. require 'question_list_pagination_admin.inc.php';
  509. } else {
  510. require 'question_list_admin.inc.php';
  511. }
  512. }
  513. Session::write('objExercise', $objExercise);
  514. Session::write('objQuestion', $objQuestion);
  515. Session::write('objAnswer', $objAnswer);
  516. Display::display_footer();