PageRenderTime 59ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/da_catalog_edit.php

https://github.com/jmjamison/da_catalog_maintenance
PHP | 781 lines | 447 code | 213 blank | 121 comment | 79 complexity | cee5607a50f2a62c1a27c1e9082e994f MD5 | raw file
  1. <html>
  2. <head><title>Data Archive Catalog: Edit</title>
  3. <link rel="stylesheet" href="2col_leftNav.css" type="text/css">
  4. <!-- Javascript(s) to 1) paste PI names into text field, 2) clear the text fiels -->
  5. <script language="JavaScript" src="da_catalog.js" type="text/javascript"><!-- da_catalog scripts //--></script>
  6. <!-- end Javascript PI paste and clear -->
  7. </head>
  8. <body>
  9. <?php
  10. $sscnetHTTP = "http://www.sscnet.ucla.edu/issr/da/da_catalog/";
  11. $sscnetHTTP_maintenance_test = "http://www.sscnet.ucla.edu/issr/da/da_catalog_maintenance_test/";
  12. $sscnetHTTP_maintenance_live = "http://www.sscnet.ucla.edu/issr/da/da_catalog_maintenance/";
  13. $mydestopHTTP = "http://localhost/da_catalog/";
  14. $currentHTTP = $sscnetHTTP_maintenance_live;
  15. $sscnetInclude = "ISSRDA_login.php";
  16. $currentInclude = $sscnetInclude;
  17. include($currentInclude);
  18. // for desktop test system
  19. //$db_name = "da_catalog";
  20. if (!empty($_POST['studynumber'])) {
  21. //echo "studynumber: " . $studynumber;
  22. $_SESSION['studynumber'] = $_POST['studynumber'];
  23. // something is selected
  24. $queryGetBaseRecord = "SELECT title.*, picode.ID as picode_id, picode.picode, picode.tisubsort, pifull.*, shcode.ID as shcode_id, shcode.subjectcode, shcode.subsort as subject_subsort, shfull.*, wwwlink_pi.wwwlink AS wwwlink_pi, wwwlink_pi.wwwtext AS wwwtext_pi, wwwlink_subject.wwwlink AS wwwlink_subject, wwwlink_subject.wwwtext AS wwwtext_subject, cite.ID as citeID, cite.cite, cite.subsort, pifull.picode FROM cite RIGHT JOIN ((((((title LEFT JOIN picode ON title.tisort = picode.tisort) LEFT JOIN pifull ON picode.picode = pifull.picode) LEFT JOIN shcode ON title.tisort = shcode.tisort) LEFT JOIN shfull ON shcode.subjectcode = shfull.subjectcode) LEFT JOIN wwwlink AS wwwlink_subject ON shfull.subjectcode = wwwlink_subject.subjectcode) LEFT JOIN wwwlink AS wwwlink_pi ON pifull.picode = wwwlink_pi.picode) ON cite.citenum = title.Cite WHERE (((title.StudyNum)='" . $studynumber ."'))";
  25. //echo "<br>" . $queryGetBaseRecord . "<br>";
  26. // PDO connect
  27. $PDO_string = "mysql:host=" . $db_host . ";port=" . $db_port . ";dbname=" . $db_name ;
  28. // echo "<br>" . $queryGetBaseRecord . "<br>";
  29. try {
  30. $PDO_connection = new PDO($PDO_string, $db_username, $db_password);
  31. } catch(PDOException $e) {
  32. echo "Could not connect to the database because: ". $e->getMessage()."<br>";
  33. die();
  34. }
  35. // PDO - create prepared statement: get the table.pifull
  36. // --------------------------------------------------------
  37. $PDO_query = $PDO_connection->prepare($queryGetBaseRecord);
  38. // PDO - execute the query
  39. $result = $PDO_query->execute();
  40. if (!$result) {
  41. die ("Could not query the database: <br />". mysql_error());
  42. }
  43. // complete record info
  44. $titleRecord = array(); // record - the title, sub# and restricted y/n
  45. // list of pi(s)
  46. $piList = array(); // list of pi(s)
  47. $piListFull = array();
  48. $current_pi = null;
  49. $temp = "";
  50. $subjectList = array(); // list of subjects
  51. $subjectListFull = array();
  52. $current_subject = null;
  53. $usefulLinks = array(); // linklist
  54. $row_index = 0;
  55. while ($row = $PDO_query->fetch(PDO::FETCH_ASSOC)) {
  56. //----------------------------------------------------------------------------------------------------------------------------
  57. //
  58. // there will only be one title record. these are essentially the fields from the title table
  59. // because the query grabs everything in one big swoop the title record items will appear more than once even though there can only be
  60. // one title record - the title record is the base record
  61. //
  62. // on the otherhand there can be multiple PIs, Subjects/Keywords and links. Those are handled separated. This note referes specifically to
  63. // the title record
  64. //
  65. //---------------------------------------------------------------------------------------------------------------------------
  66. // relevant fields from the title and cite tables
  67. $_SESSION['title'] = $row["Title"];
  68. $_SESSION['tisort'] = $row["tisort"]; // ID for title table, connecting field to the picode and shcode tables
  69. $_SESSION['restricted'] = $row[ "Restricted" ];
  70. $_SESSION['www'] = $row[ "WWW" ];
  71. $_SESSION['citeID'] = $row[ "citeID"];
  72. $_SESSION['cite_text'] = $row[ "cite"];
  73. $_SESSION['cite_subsort'] = $row["subsort"];
  74. if ($_SESSION['cite_subsort'] <= 1) { $_SESSION['cite_subsort'] = 1; } // in the event that subsort is 0/not set, reset it to 1
  75. $_SESSION['sda'] = $row["SDA"];
  76. $_SESSION['varsrch'] = $row["Varsrch"];
  77. $_SESSION['justonCD'] = $row["JustOnCD"];
  78. $_SESSION['mobilityData'] = $row["mobilityData"];
  79. $_SESSION['eveFielderCollection'] = $row["eveFielderCollection"];
  80. $piList[$row_index] = $row[ "pi"];
  81. $temp_pi = $row["pi"];
  82. if ($temp_pi != $current_pi) {
  83. $piListFull[$row_index]["picode_id"] = $row["picode_id"];
  84. $piListFull[$row_index]["pi_tisubsort"] = $row["tisubsort"];
  85. $piListFull[$row_index]["pi"] = $temp_pi;
  86. $piListFull[$row_index]["picode"] = $row["picode"];
  87. $current_pi = $temp_pi;
  88. //echo "<br>" . $temp_pi . "<br>";
  89. }
  90. $subjectList[$row_index] = $row[ "subject"];
  91. $temp_subject = $row["subject"];
  92. if ($temp_subject != $current_subject) {
  93. $subjectListFull[$row_index]["shcode_id"] = $row["shcode_id"];
  94. $subjectListFull[$row_index]["subject_subsort"] = $row["subject_subsort"];
  95. $subjectListFull[$row_index]["subject"] = $temp_subject;
  96. $subjectListFull[$row_index]["subjectcode"] = $row["subjectcode"];
  97. $current_subject = $temp_subject;
  98. //echo "<br>" . $temp_subject . "<br>";
  99. }
  100. $row_index++;
  101. }
  102. //print_r($subjectListFull);
  103. //echo "<br>";
  104. sort($piListFull); // this will sort and re-number
  105. sort($subjectListFull);
  106. //print_r($piListFull);
  107. //echo "<br><br>";
  108. $piListFullCount = count($piListFull);
  109. $subjectListFullCount = count($subjectListFull);
  110. $piList = array_unique($piList);
  111. sort($piList);
  112. $piListCount = count($piList);
  113. //echo "<br>unique pi rows: " . $piListCount;
  114. //print_r($piList);
  115. if ($piListCount <= 1) { // just one pi
  116. $row_index = 0;
  117. $pi = $piList[$row_index];
  118. // I'm still using both of these
  119. $piTempList = $piList[$row_index];
  120. $_SESSION['pi'] = $piList[$row_index];
  121. } elseif ($piListCount > 1) { // there will be a list of PIs
  122. $piTempList = "";
  123. for ($row_index = 0; $row_index < $piListCount-1; $row_index++) { // minus 1 so the last item won't have a ;
  124. $piTempList .= $piList[$row_index] . "; ";
  125. }
  126. $piTempList .= $piList[$row_index];
  127. //echo $piTempList . "<br>";
  128. $_SESSION["pi"] = $piTempList;
  129. }
  130. //echo $piTempList . "<br>";
  131. //$subjectListCount = count($piList);
  132. $subjectList = array_unique($subjectList);
  133. sort($subjectList);
  134. $subjectListCount = count($subjectList);
  135. if ($subjectListCount <= 1) { // just one subject/keyword
  136. $row_index = 0;
  137. $_SESSION['subject'] = $subjectList[$row_index];
  138. } elseif ($subjectListCount > 1) { // there will be a list of PIs
  139. $subjectTempList = "";
  140. for ($row_index = 0; $row_index < $subjectListCount-1; $row_index++) { // minus 1 so the last item won't have a ;
  141. $subjectTempList .= $subjectList[$row_index] . "; ";
  142. }
  143. $subjectTempList .= $subjectList[$row_index];
  144. //echo $subjectTempList . "<br>";
  145. $_SESSION["subject"] = $subjectTempList;
  146. }
  147. //echo "<br>" . $subjectTempList . "<br>";
  148. // close connection
  149. $PDO_connection = null;
  150. //
  151. } else
  152. $studynumber = '';
  153. // add session variables so the pages stays populated
  154. //session_start();
  155. if (isset($_SESSION['studynumber']))
  156. $studynumber = $_SESSION['studynumber'];
  157. else
  158. $studynumber = '';
  159. if (isset($_SESSION['title']))
  160. $title = $_SESSION['title'];
  161. else
  162. $title = '';
  163. if (isset($_SESSION['tisort']))
  164. $tisort = $_SESSION['tisort'];
  165. else
  166. $tisort = '';
  167. if (isset($_SESSION['pi']))
  168. $pi = $_SESSION['pi'];
  169. else
  170. $pi = '';
  171. if (isset($_SESSION['subject']))
  172. $subject = $_SESSION['subject'];
  173. else
  174. $subject = '';
  175. if (isset($_SESSION['citeID']))
  176. $citeID = $_SESSION['citeID'];
  177. else
  178. $citeID = '';
  179. if (isset($_SESSION['cite_text']))
  180. $cite_text = $_SESSION['cite_text'];
  181. else
  182. $cite_text = '';
  183. if (isset($_SESSION['cite_subsort']))
  184. $cite_subsort = $_SESSION['cite_subsort'];
  185. else
  186. $cite_subsort = '';
  187. if (isset($_SESSION['wwwtext']))
  188. $wwwtext = $_SESSION['wwwtext'];
  189. else
  190. $wwwtext = '';
  191. if (isset($_SESSION['wwwlink']))
  192. $wwwlink = $_SESSION['wwwlink'];
  193. else
  194. $wwwlink = '';
  195. if (isset($_SESSION['sda']))
  196. $sda = $_SESSION['sda'];
  197. else
  198. $sda = '';
  199. if (isset($_SESSION['varsrch']))
  200. $varsrch = $_SESSION['varsrch'];
  201. else
  202. $varsrch = '';
  203. if (isset($_SESSION['restricted']))
  204. $restricted = $_SESSION['restricted'];
  205. else
  206. $restricted = '';
  207. if (isset($_SESSION['justonCD']))
  208. $justonCD = $_SESSION['justonCD'];
  209. else
  210. $justonCD = '';
  211. if (isset($_SESSION['mobilityData']))
  212. $mobilityData = $_SESSION['mobilityData'];
  213. else
  214. $mobilityData = '';
  215. if (isset($_SESSION['eveFielderCollection']))
  216. $eveFielderCollection = $_SESSION['eveFielderCollection'];
  217. else
  218. $eveFielderCollection = '';
  219. //echo "<br>" . $title . ", " . $sda . ", " . $justonCD . ", " . $varsrch . ", " . $mobilityData . ", " . $eveFielderCollection . "<br>";
  220. //$queryFileTypes = "SELECT distinct FileType FROM fileinfo where FileType != '' ORDER BY FileType";
  221. $queryFileTypes = "SELECT DISTINCT fileinfo.FileType FROM fileinfo WHERE ((Not (fileinfo.FileType)='')) OR (((fileinfo.FileType) Is Not Null)) ORDER BY fileinfo.FileType";
  222. $queryTitleStudyNumFileType = "SELECT title.StudyNum, fileinfo.FileType, fileinfo.DTAfile FROM title LEFT JOIN fileinfo ON title.StudyNum = fileinfo.StudyNum ORDER BY title.StudyNum";
  223. // PDO connect
  224. $PDO_string = "mysql:host=" . $db_host . ";port=" . $db_port . ";dbname=" . $db_name ;
  225. try {
  226. $PDO_connection = new PDO($PDO_string, $db_username, $db_password);
  227. } catch(PDOException $e) {
  228. echo "Could not connect to the database because: ". $e->getMessage()."<br>";
  229. die();
  230. }
  231. // PDO - create prepared statement: get the table.pifull
  232. // --------------------------------------------------------
  233. $PDO_query = $PDO_connection->prepare($queryTitleStudyNumFileType);
  234. // PDO - execute the query
  235. $result = $PDO_query->execute();
  236. if (!$result) {
  237. die ("Could not query the database: <br />". mysql_error());
  238. }
  239. $fileTypeList = array();
  240. $studynumberList = array();
  241. $titleList = array();
  242. $dtafileList = array();
  243. $result = $PDO_query->fetch(PDO::FETCH_ASSOC);
  244. $row_index = 0;
  245. while ($row = $PDO_query->fetch(PDO::FETCH_ASSOC)) {
  246. $studynumberList[$row_index] = $row["StudyNum"];
  247. if (!is_null($row["FileType"])) { $fileTypeList[$row_index] = $row["FileType"]; } // others won't have nulls
  248. $dtafileList[$row_index] = $row["DTAfile"];
  249. $row_index++;
  250. }
  251. $fileTypeList = array_unique($fileTypeList);
  252. sort($fileTypeList);
  253. $fileTypeTotal = count($fileTypeList);
  254. $dtafileList = array_unique($dtafileList);
  255. sort($dtafileList);
  256. $studynumberList = array_unique($studynumberList);
  257. sort($studynumberList);
  258. $studynumberListTotal = count($studynumberList);
  259. $fileTypeListText = implode("','", $fileTypeList);
  260. $fileTypeListText = "'" . $fileTypeListText . "'";
  261. //--------------------------------------------------------------------
  262. // Section: populate the PI listbox
  263. // used for authority control, javascript select_PIs will paste in selected fields
  264. //----------------------------------------------------------------------
  265. $queryPI_list = "SELECT DISTINCT pi FROM pifull ORDER BY pi";
  266. // echo text for debugging purposes only
  267. // PDO connect
  268. $PDO_string = "mysql:host=" . $db_host . ";port=" . $db_port . ";dbname=" . $db_name ;
  269. try {
  270. $PDO_connection = new PDO($PDO_string, $db_username, $db_password);
  271. } catch(PDOException $e) {
  272. echo "Could not connect to the database because: ". $e->getMessage()."<br>";
  273. die();
  274. }
  275. // PDO - create prepared statement: get the table.pifull
  276. // --------------------------------------------------------
  277. $PDO_query = $PDO_connection->prepare($queryPI_list);
  278. // PDO - execute the query
  279. $result = $PDO_query->execute();
  280. if (!$result) {
  281. die ("Could not query the database: <br />". mysql_error());
  282. }
  283. $PI_list = array();
  284. $result = $PDO_query->fetch(PDO::FETCH_ASSOC);
  285. $row_index = 0;
  286. while ($row = $PDO_query->fetch(PDO::FETCH_ASSOC)) {
  287. //$PI_list[$row_index]["picode"] = $row["picode"];
  288. $PI_list[$row_index]["pi"] = $row["pi"];
  289. $row_index++;
  290. }
  291. $PI_list_count = count($PI_list);
  292. // debugging purposes only
  293. //echo "PI count: " . $PI_list_count . " "; /
  294. //--------------------------------------------------------------
  295. // end populate PI section
  296. //-------------------------------------------------------------
  297. //--------------------------------------------------------------------
  298. // Section: populate the Subject/Index-term listbox
  299. // used for authority control, javascript to copy and paste in selected fields
  300. //----------------------------------------------------------------------
  301. $querySubject_list = "SELECT DISTINCT subject FROM shfull ORDER BY subject";
  302. // echo for debugging purposes only
  303. // PDO connect
  304. $PDO_string = "mysql:host=" . $db_host . ";port=" . $db_port . ";dbname=" . $db_name ;
  305. try {
  306. $PDO_connection = new PDO($PDO_string, $db_username, $db_password);
  307. } catch(PDOException $e) {
  308. echo "Could not connect to the database because: ". $e->getMessage()."<br>";
  309. die();
  310. }
  311. // PDO - create prepared statement: get the table.pifull
  312. // --------------------------------------------------------
  313. $PDO_query = $PDO_connection->prepare($querySubject_list);
  314. // PDO - execute the query
  315. $result = $PDO_query->execute();
  316. if (!$result) {
  317. die ("Could not query the database: <br />". mysql_error());
  318. }
  319. $Subject_list = array();
  320. $result = $PDO_query->fetch(PDO::FETCH_ASSOC);
  321. $row_index = 0;
  322. while ($row = $PDO_query->fetch(PDO::FETCH_ASSOC)) {
  323. $Subject_list[$row_index]["subject"] = $row["subject"];
  324. $row_index++;
  325. }
  326. $Subject_list_count = count($Subject_list);
  327. // debugging purposes only
  328. //echo "Subject count: " . $Subject_list_count . "<br>";
  329. //--------------------------------------------------------------
  330. // end populate Subject section
  331. //-------------------------------------------------------------
  332. ?>
  333. <div id="masthead">
  334. <h1 id="siteName">UCLA Institute for Social Research Data Archives</h1>
  335. <h2 id="siteName"><a href="index.php" target="_self">Maintenance Menu</a>&nbsp;/&nbsp;Edit Base Record</h2>
  336. </div> <!--end masthead--><!--end masthead-->
  337. <div style="margin: 1% 5% 2% 2%;line-height: 1.5; ">
  338. <form <?php
  339. if (isset($_SESSION['studynumber'])) { // a study has been chose so post means go to updateCheck
  340. echo " action='da_catalog_updateCheck.php'";
  341. } else { // a study HAS NOT been chosen so post the study info back to the input page when you do choose a study
  342. echo " action=''";
  343. }
  344. ?> method="post" name="updateRecord" target="_self">
  345. <p><label>Studynumber:
  346. <?php
  347. if (isset($_SESSION['studynumber'])) {
  348. $studynumber = $_SESSION['studynumber'];
  349. echo '<input name="studynumber" type="text" id="studynumber" value="' . $studynumber . '" size="30" maxlength="255">';
  350. echo '</select>';
  351. } else {
  352. echo '<select name="studynumber" id="studynumber">';
  353. echo '<option value="">choose studynumber</option>';
  354. foreach ($studynumberList as $key => $value) {
  355. echo '<option value="' . $value . '">' . $value;
  356. }
  357. echo " <input name='getbaserecord' type='submit' id='getbaserecord' value='Get this Studynumber'>";
  358. }
  359. ?></label>
  360. <input name="updateTitle" type="submit" id="updateTitle" value="save/update record">
  361. <input name="reset form" type="reset" value="reset">
  362. <input type="button" onClick="history.go(0)" value="Reload page">
  363. <br><br>
  364. <input name="title" type="hidden" value="title">
  365. <label>Title: <input name="title" type="text" value="<?php echo $title ?>" size="100" maxlength="225">
  366. </label><input name="tisubsort" type="hidden" value="1">
  367. <br><br>
  368. <label>Title level citation: (Subsort number: <?php echo $cite_subsort ?>) citeID: <input name="cite_subsort" type="hidden" value="<?php echo $citeID ?>"><?php echo $citeID ?><br>
  369. <textarea name="cite_text" type="text" cols="150"><?php echo $cite_text ?></textarea></label>
  370. <input name="cite_subsort" type="hidden" value="<?php echo $cite_subsort ?>">
  371. <label>Restricted:<input name="restricted" type="checkbox" value="*" <?php if ($restricted == "*") { echo "CHECKED"; } ?> >
  372. </label>
  373. <label>SDA:<input name="sda" type="checkbox" value="*" <?php if ($sda == "*") { echo "CHECKED"; } ?> >
  374. </label>
  375. &nbsp;&nbsp;
  376. <label>Varsrch:<input name="varsrch" type="checkbox" value="*" <?php if ($varsrch == "*") { echo "CHECKED"; } ?> >
  377. </label>
  378. &nbsp;&nbsp;
  379. <label>CD Only:
  380. <input name="justonCD" type="checkbox" id="justonCD" value="*" <?php if ($justonCD == "*") { echo "CHECKED"; } ?> >
  381. </label>
  382. &nbsp;&nbsp;
  383. <label>
  384. <input name="article" type="hidden" value="">
  385. </label>
  386. &nbsp;&nbsp;
  387. <label>Mobility Data:<input name="mobilityData" type="checkbox" id="mobilityData" value="*" <?php if ($mobilityData == "*") { echo "CHECKED"; } ?> >
  388. </label> <label>Eve Fielder Collection:<input name="eveFielderCollection" type="checkbox" id="eveFielderCollection" value="*" <?php if ($eveFielderCollection == "*") { echo "CHECKED"; } ?> >
  389. </label></p>
  390. <hr>
  391. </form><br>
  392. <form action="" method="post" name="editPI_LIST">
  393. <label>Principal Investigators currently available</label><br>
  394. <!-- 23-March-2010/jmj commenting out the clear field button, once cleared cant be reloaded with out going back reselecting page -->
  395. <!-- <input name="clearOutPI_list" type="button" id="clearOutPI_list" onClick="clearoutPI_list('editPI_LIST', 'pi')" value="clear out PI list"> -->
  396. <select name="pi_list" size="10" multiple id="pi_list">
  397. <!--
  398. //--------------------------------------------------------------------------
  399. // dropdown box that is populated with PI names
  400. // used as authority control
  401. // pick from list and paste into text box/pi with javscript/select_pi
  402. //--------------------------------------------------------------------------
  403. -->
  404. <?php
  405. for ($row_index=0; $row_index < $PI_list_count; $row_index++) {
  406. //$picode = $PI_list[$row_index]["picode"];
  407. $pi = $PI_list[$row_index]["pi"];
  408. echo '<option value="' . $pi . '">' .$pi;
  409. }
  410. ?>
  411. <!--
  412. //---------------------------------------------------------------------------------
  413. // end of pi list box
  414. //------------------------------------------------
  415. -->
  416. </select>
  417. </form>
  418. <form action='da_catalog_processFormCheck.php' method='post' name='editPI'>
  419. <!-- more decluttering of code and interface
  420. <label>Principal Investigators (PIs) currently linked to <?php echo $studynumber; ?></label> -->
  421. <?php if (isset($_SESSION['studynumber'])) {
  422. //echo "<br>";
  423. $studynumber = $_SESSION['studynumber'];
  424. sort($piList);
  425. $piListCount = count($piList);
  426. //echo "<br>unique pi rows: " . $piListCount . "<br>";
  427. for ($row_index = 0; $row_index < $piListFullCount; $row_index++) {
  428. $pi = $piListFull[$row_index]["pi"];
  429. $picode = $piListFull[$row_index]["picode"];
  430. $picode_id = $piListFull[$row_index]["picode_id"];
  431. $pi_tisubsort = $piListFull[$row_index]["pi_tisubsort"];
  432. //echo "<form action='da_catalog_processFormCheck.php' method='post' name='editPI'>";
  433. echo "<input name='pi' type='text' value='" . $pi . "' size='100' maxlength='255'>";
  434. echo "<input name='studynumber' type='hidden' value='" . $studynumber . "' >";
  435. echo "<input name='picode' type='text' value='picode: " . $picode . "' >";
  436. echo "<input name='picode_id' type='text' value='picode ID: " . $picode_id . "' >";
  437. echo "<input name='item_id' type='hidden' value='" . $picode_id . "' >";
  438. echo "<input name='tisort' type='hidden' value='" . $tisort . "' >";
  439. echo "<input name='requestCategory' type='hidden' value='pi'>";
  440. // the name below is the connecting table for pi
  441. echo "<input name='table_name' type='hidden' value='picode'>";
  442. //
  443. echo "<input name='pi_tisubsort' type='hidden' value='" . $pi_tisubsort . "' size='3' maxlength='3'>";
  444. echo "<input name='item_subsort' type='text' value='" . $pi_tisubsort . "' size='3' maxlength='3'>";
  445. echo "<input name='item_subsort_fieldname' type='hidden' value='tisubsort'>";
  446. //
  447. echo "<input name='requestType' type='submit' value='Update sort number'> <input name='requestType' type='submit' value='Delete link'><br>";
  448. //echo " </form>";
  449. //onclick='" . deleteThing('picode', $picode_id) . "'
  450. }
  451. }
  452. ?></form>
  453. <form action="da_catalog_insertPICheck.php" method="post" name="addPI">
  454. <p>
  455. <label>Add [One] Principal Investigator (PI): </label>
  456. <input name='pickPIs' type='button' id='pickPIs' onClick="selectPasteCopy('editPI_LIST', 'pi_list', 'pi_new', 'addPI')" value='Select and Paste a SINGLE PI in text box below'>
  457. <input name='addPI' type='submit' value='Add A Single New Principle Investigator (PI)'>
  458. <?php if (isset($_SESSION['studynumber'])) {
  459. echo "<br>";
  460. $studynumber = $_SESSION['studynumber'];
  461. echo "<input name='studynumber' type='hidden' value='" . $studynumber . "' > ";
  462. }
  463. ?>
  464. <input name='tisort' type='hidden' value='" . $tisort . "' >
  465. <input name='pi_new' type='text' value='' size='200' maxlength='255'>
  466. </p>
  467. <hr>
  468. </form>
  469. <br>
  470. <form action="da_catalog_processFormCheck.php" method="post" name="editSubject" >
  471. <label>Subject/Index or Keyword Terms currently used</label>
  472. <!-- remove the listing to declutter the input
  473. <input name='subjectList' type='text' value='' size='200' maxlength='255'> -->
  474. <!-- <br>
  475. <input name='subject_new' type='text' value='' size='200' maxlength='255'> -->
  476. <!-- <input name="pickSubjects" type="button" onClick="selectPasteCopy('editSubject', 'subject_list', 'subjectList')" value="Select and Paste to Subject List"><br> -->
  477. <!-- <input name='pickSubjects2' type='button' onClick="selectPasteCopy('editSubject', 'subject_list', 'subject_new')" value='Select and Paste a SINGLE Subject/Keyword in text box below'> --><br>
  478. <!--<label>Select Term(s) from list:</label><br>
  479. <strong>Note</strong>: It is possible to select <em>MULTIPLE</em> subject/keyword terms but in order to add terms in a <strong>specific order</strong>, select and paste <em>each term Individually</em>. <br> -->
  480. <!--
  481. //--------------------------------------------------------------------------
  482. // dropdown box that is populated with Subject/Keyword terms
  483. // used as authority control
  484. // pick from list and paste into text box/pi with javscript (da_catalog.js library) selectPasteCopy and clearoutTextElement scripts functions
  485. //--------------------------------------------------------------------------
  486. -->
  487. <select name="subject_list" size="10" multiple id="subject_list">
  488. <?php
  489. for ($row_index=0; $row_index < $Subject_list_count; $row_index++) {
  490. $subject = $Subject_list[$row_index]["subject"];
  491. echo '<option value="' . $subject . '">' . $subject;
  492. }
  493. ?>
  494. </select>
  495. <!--
  496. //---------------------------------------------------------------------------------
  497. // end of suybject list box
  498. //------------------------------------------------
  499. -->
  500. <p></p>
  501. <?php if (isset($_SESSION['studynumber'])) {
  502. //echo "<br>";
  503. $studynumber = $_SESSION['studynumber'];
  504. //sort($subjectListFull);
  505. //$subjectListFull = array_unique($subjectListFull);
  506. sort($subjectListFull);
  507. $subjectListFullCount = count($subjectListFull);
  508. //echo "<br>unique subject rows: " . $subjectListFullCount . "<br>";
  509. for ($row_index = 0; $row_index < $subjectListFullCount; $row_index++) {
  510. $subject = $subjectListFull[$row_index]["subject"];
  511. $shcode_id = $subjectListFull[$row_index]["shcode_id"];
  512. $subjectcode = $subjectListFull[$row_index]["subjectcode"];
  513. $subject_subsort = $subjectListFull[$row_index]["subject_subsort"];
  514. $currentSubject = null;
  515. if ($subjectcode != $currentSubjectCode) {
  516. echo "<input name='subject' type='text' value='" . $subject . "' size='100' maxlength='255'>";
  517. echo "<input name='studynumber' type='hidden' value='" . $studynumber . "' >";
  518. echo "<input name='tisort' type='hidden' value='" . $tisort . "' >";
  519. echo "<input name='subjectcode' type='text' value='subjectcode: " . $subjectcode . "' >";
  520. echo "<input name='shcode_id' type='text' value='shcode_id: " . $shcode_id . "' >";
  521. echo "<input name='item_id' type='hidden' value='" . $shcode_id . "' >";
  522. echo "<input name='requestCategory' type='hidden' value='subject'>";
  523. // name below is the connecting table for the subjects
  524. //
  525. echo "<input name='subject_subsort' type='hidden' value='" . $subject_subsort . "' size='3' maxlength='3'>";
  526. echo "<input name='item_subsort' type='text' value='" . $subject_subsort . "' size='3' maxlength='3'>";
  527. //
  528. echo "<input name='table_name' type='hidden' value='shcode'>";
  529. echo "<input name='item_subsort_fieldname' type='hidden' value='subsort'>";
  530. echo "<input name='requestType' type='submit' value='Update sort number'> <input name='requestType' type='submit' value='Delete link'>";
  531. //echo " " . $row_index;
  532. $currentSubjectCode = $subjectcode;
  533. }
  534. }
  535. }
  536. ?>
  537. </form>
  538. <br>
  539. <form action="da_catalog_insertSubjectCheck.php" method="post" name="addSubject" target="_self">
  540. <label>Add [One] Subject/Keyword to <?php echo $studynumber; ?></label>
  541. <input name='pickSubjects2' type='button' onClick="selectPasteCopy('editSubject', 'subject_list', 'subject_new', 'addSubject')" value='Select and Paste a SINGLE Subject/Keyword in text box below'>
  542. <input name='addSubject' type='submit' value='Add New Subject/Keyword'>
  543. <input name='subject_new' type='text' value='' size='200' maxlength='255'>
  544. <?php if (isset($_SESSION['studynumber'])) {
  545. echo "<br>";
  546. $studynumber = $_SESSION['studynumber'];
  547. //$subjectList = array_unique($subjectList);
  548. //sort($subjectList);
  549. //$subjectListCount = count($subjectList);
  550. //print_r($piList);
  551. //echo "<h4>";
  552. //for ($row_index = 0; $row_index < $piListCount-1; $row_index++) { // minus 1 so the last item won't have a ;
  553. //foreach ($subjectList as $key => $value) {
  554. //echo $value . " <a href='' >edit</a> <a href='' >delete</a><br>";
  555. //}
  556. echo "<input name='studynumber' type='hidden' value='" . $studynumber . "' > ";
  557. echo "<input name='tisort' type='hidden' value='" . $tisort . "' >"; // the connecting field for title/picode/pifull
  558. //echo "</h4>";
  559. }
  560. ?>
  561. </form>
  562. <?php
  563. // close the connection
  564. // mysql_close($connection);
  565. $PDO_connection = null;
  566. ?>
  567. </div> <!-- end content-->
  568. </body></html>