Nessuna descrizione

viewMoment.php 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. <?php
  2. // Description: EXTRACT MOMENT ID, AND IF VALID, DISPLAY ITS INFO
  3. require_once 'processes/config.php';
  4. require_once 'processes/dbh.inc.php';
  5. require_once 'processes/checkLogin.php';
  6. // IF VIEW VARIABLE NOT GIVEN, EXIT
  7. if(!isset($_GET['view'])) {
  8. exit();
  9. }
  10. // FETCH MOMENT
  11. $momentID = mysqli_real_escape_string($connection, trim($_GET['view']));
  12. $query1 = "SELECT * FROM subquestionnair WHERE id = '$momentID';";
  13. $result1 = mysqli_query($connection, $query1) or die("Error: ".mysqli_error($connection));
  14. $row1 = mysqli_fetch_array($result1);
  15. // IF MOMENT NOT IN DATABASE, EXIT
  16. if($result1->num_rows !== 1) {
  17. echo "Requested experience does not exist.";
  18. exit();
  19. }
  20. // IF MOMENT DOESN'T BELONG TO USER (WHO IS NOT AN ADMIN), EXIT
  21. if($_SESSION['dbUserData']['admin'] !== '1') {
  22. $queryCheckUser = "SELECT id FROM subquestionnair WHERE id = '$momentID' AND id IN (SELECT id_subquestionnair FROM experience_subquestionnair WHERE id_experience IN (SELECT id_experience FROM researcher_experience WHERE id_researcher = '" . $_SESSION['dbUserData']['id_researcher'] . "'));";
  23. if(mysqli_query($connection, $queryCheckUser)->num_rows === 0) {
  24. echo "You are not authorized to view this moment.";
  25. exit();
  26. }
  27. }
  28. // EXTRACT & DISPLAY THE NUMBER OF QUESTIONS IN THE MOMENT
  29. $queryNumQuestions = "SELECT * FROM question WHERE id IN (SELECT id_question FROM subquestionnair_question WHERE id_subquestionnair = '$momentID');";
  30. $resultNumQuestions = mysqli_query($connection, $queryNumQuestions);
  31. $numQuestions = $resultNumQuestions->num_rows;
  32. include_once 'header.php';
  33. ?>
  34. <!-- START OF viewMoment.php -->
  35. <body>
  36. <header id="main-header">
  37. <a id="logo" href=".">
  38. TANIA
  39. <img src="./img/pen_800x800.png" alt="tania logo pen" width="25" height="25">
  40. </a>
  41. <div id="account">
  42. <a class="nav-link" style="margin-right: 1rem;" href="javascript:history.go(-1)"><i class="fas fa-arrow-left"></i> Back</a>
  43. <a class="sign-out" href="./processes/logout.php">Sign Out</a>
  44. </div>
  45. </header>
  46. <div class="container" style="margin-top: 8rem; min-height: calc(100vh - 8rem - 10vh);">
  47. <div class="row">
  48. <div class="col-sm-8">
  49. <h2>Moment</h2>
  50. <p><font size='4'><b> Title: </b> <?php echo $row1['title']; ?></font></p>
  51. <p><font size='4'><b> Description: </b> <?php echo $row1['description']; ?></font></p>
  52. <p><font size='4'><b> Due Date: </b><?php echo date("M j, Y (g:i A)", strtotime($row1['date_to_administer'])); ?></font></p>
  53. <p><font size='4'><b> Amount of Questions: </b> <?php echo $numQuestions; ?></font></p>
  54. </div>
  55. <div class="col-sm-4">
  56. <div class="hidden-xs">
  57. <br><br><br>
  58. </div>
  59. <div id="view-experience-buttons" style="max-width: 18rem;">
  60. <div data-toggle="tooltip" data-placement="top" title="Add Existing Question" id="experience-pen" onclick="nextModal('#AddQuestion')">
  61. <span class="fas fa-plus"></span>
  62. </div>
  63. <div data-toggle="tooltip" data-placement="top" title="Edit Moment" id="experience-pen" onclick="nextModal('#Edit')">
  64. <span class="fas fa-pen"></span>
  65. </div>
  66. </div>
  67. </div>
  68. </div><!--row-->
  69. <br>
  70. <div class="row">
  71. <div class="col-sm-12">
  72. <?php if($numQuestions > 0): ?>
  73. <table class="table table-hover table-striped" id="tableEvaluations">
  74. <thead>
  75. <tr>
  76. <th><h4>#</h4></th>
  77. <th><h4>Premise</h4></th>
  78. </tr>
  79. </thead>
  80. <tbody>
  81. <?php
  82. $query2 = "SELECT * FROM question WHERE id IN (SELECT id_question FROM subquestionnair_question WHERE id_subquestionnair = '$momentID');";
  83. $result2 = mysqli_query($connection, $query2);
  84. $x = 1;
  85. while($row2 = mysqli_fetch_array($result2)):
  86. $queryMinText = "SELECT value FROM question_type WHERE label = 'min_texto' AND id_question = '" . $row2['id'] . "';";
  87. $resultMinText = mysqli_query($connection, $queryMinText);
  88. $rowMinText = mysqli_fetch_array($resultMinText);
  89. $queryMaxVal = "SELECT value FROM question_type WHERE label = 'max_val' AND id_question = '" . $row2['id']. "';";
  90. $resultMaxVal = mysqli_query($connection, $queryMaxVal);
  91. $rowMaxVal = mysqli_fetch_array($resultMaxVal);
  92. $queryMaxText = "SELECT value FROM question_type WHERE label = 'max_texto' AND id_question = '" . $row2['id']. "';";
  93. $resultMaxText = mysqli_query($connection, $queryMaxText);
  94. $rowMaxText = mysqli_fetch_array($resultMaxText);
  95. ?>
  96. <tr style="cursor: pointer;" data-toggle="modal" data-target="#EditQuestion" data-question-number="<?php echo $x; ?>" data-question-id="<?php echo $row2['id']; ?>" data-premise="<?php echo $row2['premise']; ?>" data-type="<?php echo $row2['id_type']; ?>" data-min_text="<?php echo $rowMinText['value']; ?>" data-max_val="<?php echo $rowMaxVal['value']; ?>" data-max_text="<?php echo $rowMaxText['value']; ?>" data-categoryid="<?php echo $row2['id_category']; ?>" data-subcategoryid="<?php echo $row2['id_subcategory']; ?>">
  97. <th><?php echo $x; ?></th>
  98. <td><p><?php echo $row2['premise']; ?></p></td>
  99. <!-- confirmDeleteQuestionSubquestionnaire.php?del=<?php echo $row2['id']; ?>&quest=<?php echo $momentID; ?> -->
  100. </tr>
  101. <?php $x++; endwhile; ?>
  102. </tbody>
  103. </table>
  104. <?php else: ?>
  105. <h3 class="text-center"><small>It seems you haven't added any questions to this moment...</small></h3>
  106. <?php endif; ?>
  107. </div><!-- col -->
  108. </div><!-- row -->
  109. <br>
  110. <div class="row">
  111. <div class="col-sm-2 col-sm-offset-5">
  112. <div data-toggle="tooltip" data-placement="top" title="Add Existing Question" id="experience-pen" onclick="nextModal('#AddQuestion')" style="padding: 0.5em; margin: 0 auto; width: 60px;">
  113. <span class="fas fa-plus"></span>
  114. </div>
  115. </div>
  116. </div>
  117. <br><br>
  118. </div><!-- container -->
  119. <!-- POPUP FOR EDIT MOMENT -->
  120. <form id="updateMoment" class="form-horizontal">
  121. <div class="modal fade" id="Edit" tabindex="-1" role="dialog" aria-labelledby="EditLabel" aria-hidden="true">
  122. <div class="modal-dialog" role="document">
  123. <div class="modal-content">
  124. <div class="modal-header">
  125. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  126. <span aria-hidden="true">&times;</span>
  127. </button>
  128. <h3 class="modal-title" id="EditLabel">Edit Moment</h3>
  129. </div>
  130. <div class="modal-body">
  131. <!-- ID -->
  132. <input type="hidden" name="momentID" value="<?php echo $momentID; ?>">
  133. <!-- TITLE -->
  134. <br>
  135. <div class="form-group">
  136. <label class="col-sm-offset-1 control-label col-sm-2" for="newTitle">Title:</label>
  137. <div class="col-sm-7">
  138. <input type="text" class='form-control text-center' id="newTitle" name="newTitle" value="<?php echo $row1['title']; ?>">
  139. </div>
  140. </div>
  141. <!-- DESCRIPTION -->
  142. <div class="form-group">
  143. <label class="col-sm-offset-1 control-label col-sm-2" for="newDescription">Description:</label>
  144. <div class="col-sm-7">
  145. <textarea class="form-control text-center" id="newDescription" name="newDescription" rows="2"><?php echo $row1['description']; ?></textarea>
  146. </div>
  147. </div>
  148. <!-- DATE TO ADMINISTER -->
  149. <div class="form-group">
  150. <label class="control-label col-sm-2 col-sm-offset-1">Date to Administer:</label>
  151. <div class="col-sm-7">
  152. <input type="datetime-local" class="form-control text-center" name="newDate" value="<?php echo substr($row1['date_to_administer'], 0, -3); ?>" placeholder="YYYY-MM-DDThh:mm" required>
  153. </div>
  154. </div>
  155. <br>
  156. <!-- ERROR ALERT FOR USER -->
  157. <div id="error-updateMoment" class="row" style="display: none;">
  158. <div class="col-sm-12">
  159. <div class="alert alert-danger mb-1" role="alert">
  160. <h4 class="error-lead">Error!</h4>
  161. <p class="error-description"></p>
  162. </div>
  163. </div>
  164. </div>
  165. </div><!--modal-body-->
  166. <!-- SUBMIT OR CANCEL -->
  167. <div class="modal-footer">
  168. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  169. <button type="button" class="btn btn-danger" data-dismiss="modal" onclick="nextModal('#DeleteMoment')">Delete</button>
  170. <button type="submit" class="btn btn-primary" name="updateMoment">Save Changes</button>
  171. </div>
  172. </div><!--modal-content-->
  173. </div><!--modal-dialog-->
  174. </div><!--modal-->
  175. </form>
  176. <!-- POPUP FOR DELETE MOMENT -->
  177. <form id="deleteMoment">
  178. <div class='modal fade' id='DeleteMoment' tabindex='-1' role='dialog' aria-labelledby='DeleteMomentLabel' aria-hidden='true'>
  179. <div class='modal-dialog modal-dialog-centered' role='document'>
  180. <div class='modal-content'>
  181. <div class='modal-header'>
  182. <h3 class='modal-title' id='DeleteMomentLabel'>Delete Question<button type='button' class='close' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>&times;</span></button></h3>
  183. </div>
  184. <div class='modal-body'>
  185. <!-- QUESTIONNAIRE ID -->
  186. <input type='hidden' name='momentID' value="<?php echo $momentID; ?>">
  187. <span class='text-center'>
  188. <h3>Are you sure you want to delete this Moment?</h3>
  189. <!-- <h3 id="deletePremise" style='color:#ff8f00;'></h3> -->
  190. </span>
  191. <br>
  192. <p class='alert alert-warning text-justify'>This action will delete the moment. If you have any problems, contact technical support at: <a class='alert-link' href='#'>support@tania.uprrp.edu</a>.</p>
  193. <br>
  194. <!--You should be aware of this and opt to edit manually any affected moments and experiences in the following pages: <a class='alert-link' href='#'>experience</a>.-->
  195. <!-- ERROR ALERT FOR USER -->
  196. <div id="error-deleteMoment" class="row" style="display: none;">
  197. <div class="col-sm-12">
  198. <div class="alert alert-danger mb-1" role="alert">
  199. <h4 class="error-lead">Error!</h4>
  200. <p class="error-description"></p>
  201. </div>
  202. </div>
  203. </div>
  204. </div><!--modal-body-->
  205. <!-- SUBMIT OR CANCEL -->
  206. <div class='modal-footer'>
  207. <button type='button' class='btn btn-default' data-dismiss='modal'>Cancel</button>
  208. <button type='submit' class='btn btn-danger' name='deleteMoment'>Delete Anyway</button>
  209. </div>
  210. </div><!--modal-content-->
  211. </div><!--modal-dialog-->
  212. </div><!--modal-->
  213. </form>
  214. <!-- POPUP FOR ADDING QUESTION TO MOMENT -->
  215. <form id="addExistingQuestionToMoment">
  216. <div class="modal fade" id="AddQuestion" tabindex="-1" role="dialog" aria-labelledby="AddQuestionLabel" aria-hidden="true">
  217. <div class="modal-dialog" role="document">
  218. <div class="modal-content">
  219. <div class="modal-header">
  220. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  221. <span aria-hidden="true">&times;</span>
  222. </button>
  223. <h3 class="modal-title" id="AddQuestionLabel">Add Question</h3>
  224. </div>
  225. <div class="modal-body">
  226. <!-- MOMENT ID -->
  227. <input type="hidden" name="momentID" value="<?php echo $momentID; ?>">
  228. <div class="row">
  229. <div class="col-sm-12 col-sm-offset-1">
  230. <h4>Choose Existing Question</h4>
  231. </div>
  232. </div>
  233. <!-- QUESTION ID -->
  234. <div class="form-horizontal">
  235. <div class="form-group">
  236. <div class='col-sm-offset-2 col-sm-9'>
  237. <select class="form-control" id="questionID" name="questionID" style="width:100%; text-align-last:center;" required>
  238. <!-- <option disabled selected value>Select Question</option> -->
  239. <?php
  240. $queryQuestions = "SELECT * FROM `question` WHERE `id` IN (SELECT `id_question` FROM `questionnair_question` WHERE `id_questionnair` = (SELECT id_questionnair FROM subquestionnair WHERE id = '$momentID'));";
  241. $resultQuestions = mysqli_query($connection, $queryQuestions);
  242. while($rowQuestions = mysqli_fetch_assoc($resultQuestions)):
  243. ?>
  244. <option value="<?php echo $rowQuestions['id']; ?>"><?php echo $rowQuestions['premise']; ?></option>
  245. <?php endwhile; ?>
  246. </select>
  247. </div>
  248. </div>
  249. </div>
  250. <!-- ERROR ALERT FOR USER -->
  251. <div id="error-addExistingQuestionToMoment" class="row" style="display: none;">
  252. <div class="col-sm-12">
  253. <div class="alert alert-danger mb-1" role="alert">
  254. <h4 class="error-lead">Error!</h4>
  255. <p class="error-description"></p>
  256. </div>
  257. </div>
  258. </div>
  259. </div><!--modal-body-->
  260. <!-- SUBMIT OR CANCEL -->
  261. <div class="modal-footer">
  262. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  263. <button type="submit" class="btn btn-primary" name="addExistingQuestionToMoment">Add</button>
  264. </div>
  265. </div><!--modal-content-->
  266. </div><!--modal-dialog-->
  267. </div><!--modal-->
  268. </form>
  269. <!-- POPUP FOR EDIT QUESTION FROM MOMENT -->
  270. <form id="updateQuestion">
  271. <div class='modal fade' id='EditQuestion' tabindex='-1' role='dialog' aria-labelledby='EditQuestionLabel' aria-hidden='true'>
  272. <div class='modal-dialog modal-lg' role='document'>
  273. <div class='modal-content'>
  274. <div class='modal-header'>
  275. <h3 class='modal-title' id='EditQuestionLabel'>Edit Question<button type='button' class='close' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>&times;</span></button></h3>
  276. </div>
  277. <div class='modal-body'>
  278. <!-- QUESTIONNAIRE ID -->
  279. <!-- <input type='hidden' name='questionnaireID'> -->
  280. <!-- QUESTION ID -->
  281. <input type='hidden' name='questionID'>
  282. <br>
  283. <div class="row">
  284. <div class="col-sm-12 col-sm-offset-1">
  285. <h4>Question <span class="question-number"></span></h4>
  286. </div>
  287. </div>
  288. <div class="form-horizontal">
  289. <!-- PREMISE -->
  290. <div class="form-group">
  291. <label class='col-sm-offset-1 control-label col-sm-2'>Premise:</label>
  292. <div class='col-sm-8'>
  293. <input id="update_q_premise" type="text" class="form-control text-center" name="update_q_premise" placeholder="Premise" maxlength="600" required>
  294. </div>
  295. </div>
  296. <!-- TYPE -->
  297. <div class="form-group">
  298. <label class='col-sm-offset-1 control-label col-sm-2'>Question Type:</label>
  299. <div class='col-sm-8'>
  300. <select class="form-control text-center" id="update_q_type" name="update_q_type" style="width:100%; text-align-last:center;" onchange="newThing(event)" required>
  301. <!-- <option disabled selected value="">Type</option> -->
  302. <option value="1">Scaled</option>
  303. <option value="2">Open Answer</option>
  304. </select>
  305. </div>
  306. </div>
  307. </div>
  308. <!-- MIN/MAX VALUES/TEXT (OPTIONAL) -->
  309. <div class="range">
  310. <div class="form-inline col col-sm-offset-2">
  311. <div class="form-group">
  312. <label class='control-label col-sm-2'>Min. Value:</label>
  313. <div class="col-sm-8">
  314. <input type="number" class="form-control text-center" id="update_min_val" name="update_min_val" value="1" readonly>
  315. </div>
  316. </div>
  317. <div class="form-group">
  318. <label class='control-label col-sm-2'>Min. Text:</label>
  319. <div class="col-sm-8">
  320. <input type="text" class="form-control text-center" id="update_min_text" name="update_min_text" maxlength="40" placeholder="Very Dissatisfied">
  321. </div>
  322. </div>
  323. </div>
  324. <div class="form-inline col col-sm-offset-2">
  325. <div class="form-group">
  326. <label class='control-label col-sm-2'>Max. Value:</label>
  327. <div class="col-sm-1">
  328. <input type="number" class="form-control text-center" id="update_max_val" name="update_max_val" value="5" min="2">
  329. </div>
  330. </div>
  331. <div class="form-group">
  332. <label class='control-label col-sm-2'>Max. Text:</label>
  333. <div class="col-sm-1">
  334. <input type="text" class="form-control text-center" id="update_max_text" name="update_max_text" maxlength="40" placeholder="Very Satisfied">
  335. </div>
  336. </div>
  337. </div>
  338. <br>
  339. </div>
  340. <div class="form-horizontal">
  341. <!-- CORRESPONDING CATEGORY -->
  342. <div class="form-group">
  343. <label class='col-sm-offset-1 control-label col-sm-2'>Category:</label>
  344. <div class='col-sm-8'>
  345. <select class="form-control text-center" id="update_q_category" name="update_q_category" style="width: 100%; text-align-last:center;" required>
  346. <!-- <option disabled selected value="">Category</option> -->
  347. <?php
  348. $queryCategories = "SELECT * FROM category WHERE id IN (SELECT id_category FROM question WHERE id IN (SELECT id_question FROM subquestionnair_question WHERE id_subquestionnair = '$momentID'));";
  349. $resultCategories = mysqli_query($connection, $queryCategories);
  350. while($rowCategories = mysqli_fetch_array($resultCategories)):
  351. ?>
  352. <option value="<?php echo $rowCategories['id']; ?>"><?php echo $rowCategories['categoria']; ?></option>
  353. <?php endwhile; ?>
  354. </select>
  355. </div>
  356. </div>
  357. <!-- CORRESPONDING SUBCATEGORY -->
  358. <div class="form-group">
  359. <label class='col-sm-offset-1 control-label col-sm-2'>Subcategory:</label>
  360. <div class='col-sm-8'>
  361. <select class="form-control text-center" id="update_q_subcategory" name="update_q_subcategory" style="width: 100%; text-align-last:center;" required>
  362. <!-- <option disabled selected value="">Subcategory</option> -->
  363. <?php
  364. $querySubcategories = "SELECT * FROM subcategory WHERE id IN (SELECT id_subcategory FROM question WHERE id IN (SELECT id_question FROM subquestionnair_question WHERE id_subquestionnair = '$momentID'));";
  365. $resultSubcategories = mysqli_query($connection, $querySubcategories);
  366. while($rowSubcategories = mysqli_fetch_array($resultSubcategories)):
  367. ?>
  368. <option value="<?php echo $rowSubcategories['id']; ?>"><?php echo $rowSubcategories['subcategoria']; ?></option>
  369. <?php endwhile; ?>
  370. </select>
  371. </div>
  372. </div>
  373. </div>
  374. <br>
  375. <!-- ERROR ALERT FOR USER -->
  376. <div id="error-updateQuestion" class="row" style="display: none;">
  377. <div class="col-sm-12">
  378. <div class="alert alert-danger mb-1" role="alert">
  379. <h4 class="error-lead">Error!</h4>
  380. <p class="error-description"></p>
  381. </div>
  382. </div>
  383. </div>
  384. </div><!--modal-body-->
  385. <!-- SUBMIT OR CANCEL -->
  386. <div class='modal-footer'>
  387. <button type='button' class='btn btn-default' data-dismiss='modal'>Cancel</button>
  388. <button type='button' class='btn btn-danger' data-dismiss='modal' onclick="nextModal('#Delete')">Remove</button>
  389. <button type='submit' class='btn btn-primary' name='updateQuestion'>Save Changes</button>
  390. </div>
  391. </div><!--modal-content-->
  392. </div><!--modal-dialog-->
  393. </div><!--modal-->
  394. </form>
  395. <!-- POPUP FOR REMOVE QUESTION FROM MOMENT -->
  396. <form id="removeQuestionFromMoment">
  397. <div class='modal fade' id='Delete' tabindex='-1' role='dialog' aria-labelledby='DeleteLabel' aria-hidden='true'>
  398. <div class='modal-dialog modal-dialog-centered' role='document'>
  399. <div class='modal-content'>
  400. <div class='modal-header'>
  401. <h3 class='modal-title' id='DeleteLabel'>Remove Question<button type='button' class='close' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>&times;</span></button></h3>
  402. </div>
  403. <div class='modal-body'>
  404. <!-- MOMENT ID -->
  405. <input type='hidden' name='momentID' value="<?php echo $momentID; ?>">
  406. <!-- QUESTION ID -->
  407. <input type='hidden' name='questionID'>
  408. <span class='text-center'>
  409. <h3>Are you sure you want to remove Question <span class="question-number"></span>?</h3>
  410. <!-- <h3 id="deletePremise" style='color:#ff8f00;'></h3> -->
  411. </span>
  412. <br>
  413. <p class='alert alert-warning text-justify'>This action will remove the question from this moment. If you have any problems, contact technical support at: <a class='alert-link' href='#'>support@tania.uprrp.edu</a>.</p>
  414. <br>
  415. <!-- ERROR ALERT FOR USER -->
  416. <div id="error-removeQuestionFromMoment" class="row" style="display: none;">
  417. <div class="col-sm-12">
  418. <div class="alert alert-danger mb-1" role="alert">
  419. <h4 class="error-lead">Error!</h4>
  420. <p class="error-description"></p>
  421. </div>
  422. </div>
  423. </div>
  424. </div><!--modal-body-->
  425. <!-- SUBMIT OR CANCEL -->
  426. <div class='modal-footer'>
  427. <button type='button' class='btn btn-default' data-dismiss='modal'>Cancel</button>
  428. <button type='submit' class='btn btn-danger' name='removeQuestionFromMoment'>Remove Anyway</button>
  429. </div>
  430. </div><!--modal-content-->
  431. </div><!--modal-dialog-->
  432. </div><!--modal-->
  433. </form>
  434. <script src="js/viewMoment.js"></script>
  435. <script src="js/handleSubmit.js"></script>
  436. <script src="js/editQuestion.js"></script>
  437. <script>
  438. ["updateMoment", "removeQuestionFromMoment", "addExistingQuestionToMoment", "updateQuestion", "deleteMoment"].forEach(function(formName) {
  439. var form = document.getElementById(formName);
  440. if(form) {
  441. form.addEventListener('submit', function(e) {
  442. handleSubmit(e, formName);
  443. });
  444. }
  445. });
  446. </script>
  447. <!-- END OF viewMoment.php -->
  448. <?php include_once 'footer.php'; ?>