No Description

viewMoment.php 21KB

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