admin.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  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. require_once 'exercise.lib.php';
  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. if (empty($clone_question)) {
  99. $clone_question = isset($_GET['clone_question'])?$_GET['clone_question']:0;
  100. }
  101. if (empty($questionId)) {
  102. $questionId = isset($_SESSION['questionId'])?$_SESSION['questionId']:0;
  103. }
  104. if (empty($modifyExercise)) {
  105. $modifyExercise = isset($_GET['modifyExercise'])?$_GET['modifyExercise']:0;
  106. }
  107. //Cleaning all incomplete attempts of the admin/teacher to avoid weird problems when changing the exercise settings, number of questions, etc
  108. delete_all_incomplete_attempts(api_get_user_id(), $exerciseId, api_get_course_int_id(), api_get_session_id());
  109. // get from session
  110. $objExercise = isset($_SESSION['objExercise'])?$_SESSION['objExercise']:0;
  111. $objQuestion = isset($_SESSION['objQuestion'])?$_SESSION['objQuestion']:0;
  112. $objAnswer = isset($_SESSION['objAnswer'])?$_SESSION['objAnswer']:0;
  113. // document path
  114. $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
  115. // picture path
  116. $picturePath = $documentPath.'/images';
  117. // audio path
  118. $audioPath = $documentPath.'/audio';
  119. // the 5 types of answers
  120. $aType = array(
  121. get_lang('UniqueSelect'),
  122. get_lang('MultipleSelect'),
  123. get_lang('FillBlanks'),
  124. get_lang('Matching'),
  125. get_lang('FreeAnswer')
  126. );
  127. $fastEdition = api_get_course_setting('allow_fast_exercise_edition') == 1 ? true : false;
  128. //$fastEdition = false;
  129. if ($fastEdition) {
  130. $htmlHeadXtra[] = api_get_jqgrid_js();
  131. }
  132. // tables used in the exercise tool
  133. if (!empty($_GET['action']) && $_GET['action'] == 'exportqti2' && !empty($_GET['questionId'])) {
  134. require_once 'export/qti2/qti2_export.php';
  135. $export = export_question($_GET['questionId'], true);
  136. $qid = (int)$_GET['questionId'];
  137. $archive_path = api_get_path(SYS_ARCHIVE_PATH);
  138. $temp_dir_short = uniqid();
  139. $temp_zip_dir = $archive_path."/".$temp_dir_short;
  140. if (!is_dir($temp_zip_dir)) {
  141. mkdir($temp_zip_dir, api_get_permissions_for_new_directories());
  142. }
  143. $temp_zip_file = $temp_zip_dir."/".api_get_unique_id().".zip";
  144. $temp_xml_file = $temp_zip_dir."/qti2export_".$qid.'.xml';
  145. file_put_contents($temp_xml_file, $export);
  146. $zip_folder = new PclZip($temp_zip_file);
  147. $zip_folder->add($temp_xml_file, PCLZIP_OPT_REMOVE_ALL_PATH);
  148. $name = 'qti2_export_'.$qid.'.zip';
  149. DocumentManager::file_send_for_download($temp_zip_file, true, $name);
  150. unlink($temp_zip_file);
  151. unlink($temp_xml_file);
  152. rmdir($temp_zip_dir);
  153. //DocumentManager::string_send_for_download($export,true,'qti2export_q'.$_GET['questionId'].'.xml');
  154. exit; //otherwise following clicks may become buggy
  155. }
  156. // intializes the Exercise object
  157. if (!is_object($objExercise)) {
  158. // construction of the Exercise object
  159. $objExercise = new Exercise();
  160. // creation of a new exercise if wrong or not specified exercise ID
  161. if ($exerciseId) {
  162. $objExercise->read($exerciseId);
  163. }
  164. // saves the object into the session
  165. Session::write('objExercise', $objExercise);
  166. }
  167. // doesn't select the exercise ID if we come from the question pool
  168. if (!isset($fromExercise) or !$fromExercise) {
  169. // gets the right exercise ID, and if 0 creates a new exercise
  170. if (!$exerciseId = $objExercise->selectId()) {
  171. $modifyExercise = 'yes';
  172. }
  173. }
  174. $nbrQuestions = $objExercise->selectNbrQuestions();
  175. // intializes the Question object
  176. if ($editQuestion || $newQuestion || $modifyQuestion || $modifyAnswers) {
  177. if ($editQuestion || $newQuestion) {
  178. // reads question data
  179. if ($editQuestion) {
  180. // question not found
  181. if (!$objQuestion = Question::read($editQuestion)) {
  182. api_not_allowed();
  183. }
  184. // saves the object into the session
  185. Session::write('objQuestion', $objQuestion);
  186. }
  187. }
  188. // checks if the object exists
  189. if (is_object($objQuestion)) {
  190. // gets the question ID
  191. $questionId = $objQuestion->selectId();
  192. }
  193. }
  194. // if cancelling an exercise
  195. if (!empty($cancelExercise)) {
  196. // existing exercise
  197. if ($exerciseId) {
  198. unset($modifyExercise);
  199. } else {
  200. // new exercise
  201. // goes back to the exercise list
  202. header('Location: exercice.php');
  203. exit();
  204. }
  205. }
  206. // if cancelling question creation/modification
  207. if (!empty($cancelQuestion)) {
  208. // if we are creating a new question from the question pool
  209. if (!$exerciseId && !$questionId) {
  210. // goes back to the question pool
  211. header('Location: question_pool.php');
  212. exit();
  213. } else {
  214. // goes back to the question viewing
  215. $editQuestion = $modifyQuestion;
  216. unset($newQuestion, $modifyQuestion);
  217. }
  218. }
  219. if (!empty($clone_question) && !empty($objExercise->id)) {
  220. $old_question_obj = Question::read($clone_question, api_get_course_int_id());
  221. $old_question_obj->question = $old_question_obj->question.' - '.get_lang('Copy');
  222. $new_id = $old_question_obj->duplicate();
  223. $new_question_obj = Question::read($new_id, api_get_course_int_id());
  224. $new_question_obj->addToList($exerciseId);
  225. // This should be moved to the duplicate function
  226. $new_answer_obj = new Answer($clone_question);
  227. $new_answer_obj->read();
  228. $new_answer_obj->duplicate($new_id);
  229. //Reloading tne $objExercise obj
  230. $objExercise->read($objExercise->id);
  231. header('Location: admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id);
  232. exit;
  233. }
  234. // if cancelling answer creation/modification
  235. if (!empty($cancelAnswers)) {
  236. // goes back to the question viewing
  237. $editQuestion = $modifyAnswers;
  238. unset($modifyAnswers);
  239. }
  240. $nameTools = get_lang('ExerciseManagement');
  241. // modifies the query string that is used in the link of tool name
  242. if ($editQuestion || $modifyQuestion || $newQuestion || $modifyAnswers) {
  243. $nameTools = get_lang('QuestionManagement');
  244. }
  245. if (isset($_SESSION['gradebook'])) {
  246. $gradebook = $_SESSION['gradebook'];
  247. }
  248. if (!empty($gradebook) && $gradebook == 'view') {
  249. $interbreadcrumb[] = array(
  250. 'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
  251. 'name' => get_lang('ToolGradebook')
  252. );
  253. }
  254. $interbreadcrumb[] = array("url" => "exercice.php", "name" => get_lang('Exercices'));
  255. if (isset($_GET['newQuestion']) || isset($_GET['editQuestion'])) {
  256. $interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$objExercise->id, "name" => $objExercise->name);
  257. } else {
  258. $interbreadcrumb[] = array("url" => "#", "name" => $objExercise->name);
  259. }
  260. // shows a link to go back to the question pool
  261. if (!$exerciseId && $nameTools != get_lang('ExerciseManagement')) {
  262. $interbreadcrumb[] = array(
  263. "url" => "question_pool.php?fromExercise=$fromExercise",
  264. "name" => get_lang('QuestionPool')
  265. );
  266. }
  267. // if the question is duplicated, disable the link of tool name
  268. if (!empty($modifyIn) && $modifyIn == 'thisExercise') {
  269. if ($buttonBack) {
  270. $modifyIn = 'allExercises';
  271. } else {
  272. $noPHP_SELF = true;
  273. }
  274. }
  275. $htmlHeadXtra[] = '<script>
  276. function multiple_answer_true_false_onchange(variable) {
  277. var result = variable.checked;
  278. var id = variable.id;
  279. var weight_id = "weighting_" + id;
  280. var array_result=new Array(); array_result[1]="1"; array_result[0]= "-0.50"; array_result[-1]= "0";
  281. if (result) {
  282. result = 1;
  283. } else {
  284. result = 0;
  285. }
  286. document.getElementById(weight_id).value = array_result[result];
  287. }
  288. </script>';
  289. $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/jquery.fcbkcomplete.js" type="text/javascript" language="javascript"></script>';
  290. $htmlHeadXtra[] = '<link href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/style.css" rel="stylesheet" type="text/css" />';
  291. $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_CODE_PATH).'plugin/hotspot/JavaScriptFlashGateway.js"></script>';
  292. $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_CODE_PATH).'plugin/hotspot/hotspot.js"></script>';
  293. $htmlHeadXtra[] = "<script>
  294. <!--
  295. // Globals
  296. // Major version of Flash required
  297. var requiredMajorVersion = 7;
  298. // Minor version of Flash required
  299. var requiredMinorVersion = 0;
  300. // Minor version of Flash required
  301. var requiredRevision = 0;
  302. // the version of javascript supported
  303. var jsVersion = 1.0;
  304. // -->
  305. </script>
  306. <script language=\"VBScript\" type=\"text/vbscript\">
  307. <!-- // Visual basic helper required to detect Flash Player ActiveX control version information
  308. Function VBGetSwfVer(i)
  309. on error resume next
  310. Dim swControl, swVersion
  311. swVersion = 0
  312. set swControl = CreateObject(\"ShockwaveFlash.ShockwaveFlash.\" + CStr(i))
  313. if (IsObject(swControl)) then
  314. swVersion = swControl.GetVariable(\"\$version\")
  315. end if
  316. VBGetSwfVer = swVersion
  317. End Function
  318. // -->
  319. </script>
  320. <script language=\"JavaScript1.1\" type=\"text/javascript\">
  321. <!-- // Detect Client Browser type
  322. var isIE = (navigator.appVersion.indexOf(\"MSIE\") != -1) ? true : false;
  323. var isWin = (navigator.appVersion.toLowerCase().indexOf(\"win\") != -1) ? true : false;
  324. var isOpera = (navigator.userAgent.indexOf(\"Opera\") != -1) ? true : false;
  325. jsVersion = 1.1;
  326. // JavaScript helper required to detect Flash Player PlugIn version information
  327. function JSGetSwfVer(i){
  328. // NS/Opera version >= 3 check for Flash plugin in plugin array
  329. if (navigator.plugins != null && navigator.plugins.length > 0) {
  330. if (navigator.plugins[\"Shockwave Flash 2.0\"] || navigator.plugins[\"Shockwave Flash\"]) {
  331. var swVer2 = navigator.plugins[\"Shockwave Flash 2.0\"] ? \" 2.0\" : \"\";
  332. var flashDescription = navigator.plugins[\"Shockwave Flash\" + swVer2].description;
  333. descArray = flashDescription.split(\" \");
  334. tempArrayMajor = descArray[2].split(\".\");
  335. versionMajor = tempArrayMajor[0];
  336. versionMinor = tempArrayMajor[1];
  337. if ( descArray[3] != \"\" ) {
  338. tempArrayMinor = descArray[3].split(\"r\");
  339. } else {
  340. tempArrayMinor = descArray[4].split(\"r\");
  341. }
  342. versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
  343. flashVer = versionMajor + \".\" + versionMinor + \".\" + versionRevision;
  344. } else {
  345. flashVer = -1;
  346. }
  347. }
  348. // MSN/WebTV 2.6 supports Flash 4
  349. else if (navigator.userAgent.toLowerCase().indexOf(\"webtv/2.6\") != -1) flashVer = 4;
  350. // WebTV 2.5 supports Flash 3
  351. else if (navigator.userAgent.toLowerCase().indexOf(\"webtv/2.5\") != -1) flashVer = 3;
  352. // older WebTV supports Flash 2
  353. else if (navigator.userAgent.toLowerCase().indexOf(\"webtv\") != -1) flashVer = 2;
  354. // Can't detect in all other cases
  355. else {
  356. flashVer = -1;
  357. }
  358. return flashVer;
  359. }
  360. // When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
  361. function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
  362. {
  363. reqVer = parseFloat(reqMajorVer + \".\" + reqRevision);
  364. // loop backwards through the versions until we find the newest version
  365. for (i=25;i>0;i--) {
  366. if (isIE && isWin && !isOpera) {
  367. versionStr = VBGetSwfVer(i);
  368. } else {
  369. versionStr = JSGetSwfVer(i);
  370. }
  371. if (versionStr == -1 ) {
  372. return false;
  373. } else if (versionStr != 0) {
  374. if(isIE && isWin && !isOpera) {
  375. tempArray = versionStr.split(\" \");
  376. tempString = tempArray[1];
  377. versionArray = tempString .split(\",\");
  378. } else {
  379. versionArray = versionStr.split(\".\");
  380. }
  381. versionMajor = versionArray[0];
  382. versionMinor = versionArray[1];
  383. versionRevision = versionArray[2];
  384. versionString = versionMajor + \".\" + versionRevision; // 7.0r24 == 7.24
  385. versionNum = parseFloat(versionString);
  386. // is the major.revision >= requested major.revision AND the minor version >= requested minor
  387. if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {
  388. return true;
  389. } else {
  390. return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );
  391. }
  392. }
  393. }
  394. }
  395. // -->
  396. </script>";
  397. Display::display_header($nameTools, 'Exercise');
  398. if ($objExercise->exercise_was_added_in_lp) {
  399. if ($objExercise->force_edit_exercise_in_lp == true) {
  400. Display::display_warning_message(get_lang('ForceEditingExerciseInLPWarning'));
  401. } else {
  402. Display::display_warning_message(get_lang('EditingExerciseCauseProblemsInLP'));
  403. }
  404. }
  405. // If we are in a test
  406. $inATest = isset($exerciseId) && $exerciseId > 0;
  407. if ($inATest) {
  408. echo '<div class="actions">';
  409. if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid'])) {
  410. echo '<a href="admin.php?exerciseId='.$exerciseId.'">'.Display::return_icon(
  411. 'back.png',
  412. get_lang('GoBackToQuestionList'),
  413. '',
  414. ICON_SIZE_MEDIUM
  415. ).'</a>';
  416. }
  417. if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) && !isset($_GET['editQuestion'])) {
  418. echo '<a href="exercice.php?'.api_get_cidReq().'">'.Display::return_icon(
  419. 'back.png',
  420. get_lang('BackToExercisesList'),
  421. '',
  422. ICON_SIZE_MEDIUM
  423. ).'</a>';
  424. }
  425. echo '<a href="overview.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'&preview=1">'.Display::return_icon(
  426. 'preview_view.png',
  427. get_lang('Preview'),
  428. '',
  429. ICON_SIZE_MEDIUM
  430. ).'</a>';
  431. echo Display::url(
  432. Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_MEDIUM),
  433. 'exercise_report.php?'.api_get_cidReq().'&exerciseId='.$objExercise->id
  434. );
  435. if ($objExercise->edit_exercise_in_lp == false) {
  436. echo '<a href="">'.Display::return_icon(
  437. 'settings_na.png',
  438. get_lang('ModifyExercise'),
  439. '',
  440. ICON_SIZE_MEDIUM
  441. ).'</a>';
  442. } else {
  443. echo '<a href="exercise_admin.php?'.api_get_cidreq(
  444. ).'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'.Display::return_icon(
  445. 'settings.png',
  446. get_lang('ModifyExercise'),
  447. '',
  448. ICON_SIZE_MEDIUM
  449. ).'</a>';
  450. }
  451. $maxScoreAllQuestions = 0;
  452. if (!empty($objExercise->questionList)) {
  453. foreach ($objExercise->questionList as $q) {
  454. $question = Question::read($q);
  455. if ($question) {
  456. $maxScoreAllQuestions += $question->selectWeighting();
  457. }
  458. }
  459. }
  460. echo '<span style="float:right">'.sprintf(
  461. get_lang('XQuestionsWithTotalScoreY'),
  462. $objExercise->selectNbrQuestions(),
  463. $maxScoreAllQuestions
  464. ).'</span>';
  465. echo '</div>';
  466. } else {
  467. if (isset($_GET['newQuestion'])) {
  468. // we are in create a new question from question pool not in a test
  469. echo '<div class="actions">';
  470. echo '<a href="admin.php?'.api_get_cidreq().'">.'.Display::return_icon(
  471. 'back.png',
  472. get_lang('GoBackToQuestionList'),
  473. '',
  474. ICON_SIZE_MEDIUM
  475. ).'</a>';
  476. echo '</div>';
  477. } else {
  478. // If we are in question_poolbut not in an test, go back to question create in pool
  479. echo '<div class="actions">';
  480. echo '<a href="question_pool.php">'.Display::return_icon(
  481. 'back.png',
  482. get_lang('GoBackToQuestionList'),
  483. '',
  484. ICON_SIZE_MEDIUM
  485. ).'</a>';
  486. echo '</div>';
  487. }
  488. }
  489. if (isset($_GET['message'])) {
  490. if (in_array($_GET['message'], array('ExerciseStored', 'ItemUpdated', 'ItemAdded'))) {
  491. Display::display_confirmation_message(get_lang($_GET['message']));
  492. }
  493. }
  494. if ($newQuestion || $editQuestion) {
  495. // statement management
  496. if ($editQuestion) {
  497. $type = $objQuestion->selectType();
  498. } else {
  499. $type = Security::remove_XSS($_REQUEST['answerType']);
  500. }
  501. echo '<input type="hidden" name="Type" value="'.$type.'" />';
  502. //Create/Edit question
  503. require 'question_admin.inc.php';
  504. }
  505. if (isset($_GET['hotspotadmin'])) {
  506. if (!is_object($objQuestion)) {
  507. $objQuestion = Question :: read($_GET['hotspotadmin']);
  508. }
  509. if (!$objQuestion) {
  510. api_not_allowed();
  511. }
  512. require 'hotspot_admin.inc.php';
  513. }
  514. if (!$newQuestion && !$modifyQuestion && !$editQuestion && !isset($_GET['hotspotadmin'])) {
  515. // Question list (drag n drop view)
  516. if ($fastEdition) {
  517. require 'question_list_pagination_admin.inc.php';
  518. } else {
  519. require 'question_list_admin.inc.php';
  520. }
  521. }
  522. Session::write('objExercise', $objExercise);
  523. Session::write('objQuestion', $objQuestion);
  524. Session::write('objAnswer', $objAnswer);
  525. Display::display_footer();