admin.php 20 KB

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