da_catalog_maintenance /da_catalog_edit_testSection.php

Language PHP Lines 634
MD5 Hash 4208f476d982c584727f036ab848d2e8
Repository https://github.com/jmjamison/da_catalog_maintenance.git View Raw File
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
<html>
<head><title>Data Archive Catalog: Edit</title>
<link rel="stylesheet" href="2col_leftNav.css" type="text/css">
<!--  Javascript(s) to 1) paste PI names into text field, 2) clear the text fiels -->
<script language="JavaScript" src="da_catalog.js" type="text/javascript"><!--  da_catalog scripts //--></script>
<!-- end Javascript PI paste and clear -->

</head>
<body>
  <?php
		
	$sscnetHTTP = "http://www.sscnet.ucla.edu/issr/da/da_catalog/";
	$sscnetHTTP_maintenance_test = "http://www.sscnet.ucla.edu/issr/da/da_catalog_maintenance_test/";
	$sscnetHTTP_maintenance_live = "http://www.sscnet.ucla.edu/issr/da/da_catalog_maintenance/";
	$mydestopHTTP = "http://localhost/da_catalog/";
	$currentHTTP = $sscnetHTTP_maintenance_live;
	
	$sscnetInclude = "ISSRDATEST_login.php";
	$mydesktopInclude = "../db_login2.php";
	$currentInclude = $sscnetInclude;
	include($currentInclude); 
	
	// for desktop test system
	//$db_name = "da_catalog";	
	
	
	if (!empty($_POST['studynumber'])) {
		//echo "studynumber: " . $studynumber;
		$_SESSION['studynumber'] = $_POST['studynumber'];
		
			// something is selected
			$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.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 ."'))";
			
	//echo "<br>" . $queryGetBaseRecord . "<br>";
			
	// PDO connect  
		$PDO_string = "mysql:host=" . $db_host . ";port=" . $db_port . ";dbname=" . $db_name ;

	 
	//  echo "<br>" .  $queryGetBaseRecord . "<br>";
			try	{
				$PDO_connection = new PDO($PDO_string, $db_username, $db_password);
		
				} catch(PDOException $e)	{
					echo "Could not connect to the database because: ".	$e->getMessage()."<br>";
					die();
					}
	
			// PDO - create prepared statement: get the table.pifull
 			// --------------------------------------------------------
			$PDO_query = $PDO_connection->prepare($queryGetBaseRecord);
			// PDO - execute the query
			$result = $PDO_query->execute();
	  		if (!$result) {
				die ("Could not query the database: <br />". mysql_error());
				} 	
			// complete record info
			$titleRecord = array();  // record - the title, sub# and restricted y/n
			// list of pi(s)
			$piList = array();		// list of pi(s)
			$piListFull = array();
			$current_pi = null;
			$temp = "";
			
			$subjectList = array(); // list of subjects
			$subjectListFull = array();
			$current_subject = null;
			
			$usefulLinks = array();	// linklist
			
			$row_index = 0;   
			while ($row = $PDO_query->fetch(PDO::FETCH_ASSOC))  {
		
			//----------------------------------------------------------------------------------------------------------------------------
			//
			//  there will only be one title record. these are essentially the fields from the title table
			//     because the query grabs everything in one big swoop the title record items will appear more than once even though there can only be
			//     one title record - the title record is the base record
			//    
			//     on the otherhand there can be multiple PIs, Subjects/Keywords and links. Those are handled separated. This note referes specifically to
			//          the title record
			//
			//---------------------------------------------------------------------------------------------------------------------------
				
				// relevant fields from the title and cite tables
				
				$_SESSION['title'] = $row["Title"];
				$_SESSION['tisort'] = $row["tisort"];   // ID for title table, connecting field to the picode and shcode tables
				$_SESSION['restricted'] = $row[ "Restricted" ];
				$_SESSION['www'] = $row[ "WWW" ];
				$_SESSION['cite_title'] = $row[ "cite"];
				$_SESSION['cite_subsort'] = $row["subsort"];
				if ($_SESSION['cite_subsort'] <= 1) { $_SESSION['cite_subsort'] = 1; }    // in the event that subsort is 0/not set, reset it to 1
				$_SESSION['sda'] = $row["SDA"];
				$_SESSION['varsrch'] = $row["Varsrch"];
				$_SESSION['justonCD'] = $row["JustOnCD"];
				$_SESSION['mobilityData'] = $row["mobilityData"];
				$_SESSION['eveFielderCollection'] = $row["eveFielderCollection"];
			
				
				$piList[$row_index] = $row[ "pi"];
				
				
				$temp_pi = $row["pi"];
				if ($temp_pi != $current_pi) {
					
					$piListFull[$row_index]["picode_id"] = $row["picode_id"];
					$piListFull[$row_index]["pi_tisubsort"] = $row["tisubsort"];
					$piListFull[$row_index]["pi"] = $temp_pi;
					$piListFull[$row_index]["picode"] = $row["picode"];
					
					$current_pi = $temp_pi;	
					//echo "<br>" . $temp_pi . "<br>";
				}
				
				
			
				$subjectList[$row_index] = $row[ "subject"];
				
				$temp_subject = $row["subject"];
				if ($temp_subject != $current_subject) {
					
					$subjectListFull[$row_index]["shcode_id"] = $row["shcode_id"];
					$subjectListFull[$row_index]["subject_subsort"] = $row["subject_subsort"];
					$subjectListFull[$row_index]["subject"] = $temp_subject;
					$subjectListFull[$row_index]["subjectcode"] = $row["subjectcode"];
					
					$current_subject = $temp_subject;
					//echo "<br>" . $temp_subject . "<br>";
				}
			
				$row_index++;
				
			}
			//print_r($subjectListFull);
			//echo "<br>";
			
			sort($piListFull);   // this will sort and re-number
			sort($subjectListFull);
			//print_r($piListFull);
			//echo "<br><br>";
			$piListFullCount = count($piListFull);
			$subjectListFullCount = count($subjectListFull);
						
			$piList = array_unique($piList);
			sort($piList);
			$piListCount = count($piList);
			//echo "<br>unique pi rows: " . $piListCount;
			
			//print_r($piList);
			
			if ($piListCount <= 1) {   //  just one pi
			
				$row_index = 0;
				
				$pi = $piList[$row_index];
				// I'm still using both of these
				$piTempList = $piList[$row_index];
				
				$_SESSION['pi'] = $piList[$row_index];
				
			} elseif ($piListCount > 1) { // there will be a list of PIs
			
					$piTempList = "";
					
					for ($row_index = 0; $row_index < $piListCount-1; $row_index++) {  // minus 1 so the last item won't have a ;
						
						$piTempList .= $piList[$row_index] . "; ";
						
						}
						
						$piTempList .= $piList[$row_index];
						
						//echo $piTempList . "<br>";
						
						$_SESSION["pi"] = $piTempList;
					
			}
			//echo $piTempList . "<br>";
			//$subjectListCount = count($piList);
			$subjectList = array_unique($subjectList);
			sort($subjectList);
			$subjectListCount = count($subjectList);			
			
			if ($subjectListCount <= 1) {   //  just one subject/keyword
			
				$row_index = 0;
				$_SESSION['subject'] = $subjectList[$row_index];
				
			} elseif ($subjectListCount > 1) { // there will be a list of PIs
			
					$subjectTempList = "";
					
					for ($row_index = 0; $row_index < $subjectListCount-1; $row_index++) {  // minus 1 so the last item won't have a ;
						
						$subjectTempList .= $subjectList[$row_index] . "; ";
						
						}
						
						$subjectTempList .= $subjectList[$row_index];
						
						//echo $subjectTempList . "<br>";
						
						$_SESSION["subject"] = $subjectTempList;
					
			}
					
			//echo "<br>" . $subjectTempList . "<br>";
						
			// close connection
			$PDO_connection = null;
			
			//
			
		
		
		
	} else 
		
			$studynumber = '';  
	
	//  add session variables so the pages stays populated
	//session_start();
	
	if (isset($_SESSION['studynumber']))
			$studynumber = $_SESSION['studynumber'];
	else 
			$studynumber = ''; 
			
	if (isset($_SESSION['title']))
			$title = $_SESSION['title'];
	else 
			$title = '';
			
	if (isset($_SESSION['tisort']))
			$tisort = $_SESSION['tisort'];
	else 
			$tisort = '';
			
	if (isset($_SESSION['pi']))
			$pi = $_SESSION['pi'];
	else 
			$pi = '';
	
	if (isset($_SESSION['subject']))
			$subject = $_SESSION['subject'];
	else 
			$subject = '';
	
	if (isset($_SESSION['cite_title']))
			$cite_title = $_SESSION['cite_title'];
	else 
			$cite_title = '';
			
	if (isset($_SESSION['cite_subsort']))
			$cite_subsort = $_SESSION['cite_subsort'];
	else 
			$cite_subsort = '';
			
	if (isset($_SESSION['wwwtext']))
			$wwwtext = $_SESSION['wwwtext'];
	else 
			$wwwtext = '';
			
	if (isset($_SESSION['wwwlink']))
			$wwwlink = $_SESSION['wwwlink'];
	else 
			$wwwlink = '';
			
	if (isset($_SESSION['sda']))
			$sda = $_SESSION['sda'];
	else 
			$sda = '';
			
	if (isset($_SESSION['varsrch']))
			$varsrch = $_SESSION['varsrch'];
	else 
			$varsrch = '';
			
	if (isset($_SESSION['restricted']))
			$restricted = $_SESSION['restricted'];
	else 
			$restricted = '';
			
	if (isset($_SESSION['justonCD']))
			$justonCD = $_SESSION['justonCD'];
	else 
			$justonCD = '';
			
	if (isset($_SESSION['mobilityData']))
			$mobilityData = $_SESSION['mobilityData'];
	else 
			$mobilityData = '';
			
	if (isset($_SESSION['eveFielderCollection']))
			$eveFielderCollection = $_SESSION['eveFielderCollection'];
			
	else 
			$eveFielderCollection = '';
			
	
	//echo "<br>" . $title . ", " . $sda . ", " . $justonCD . ", " . $varsrch . ", " . $mobilityData . ", " . $eveFielderCollection . "<br>";
	
	//$queryFileTypes = "SELECT distinct FileType FROM fileinfo where FileType != '' ORDER BY FileType";
$queryFileTypes = "SELECT DISTINCT fileinfo.FileType FROM fileinfo WHERE ((Not (fileinfo.FileType)='')) OR (((fileinfo.FileType) Is Not Null)) ORDER BY fileinfo.FileType";
	
	$queryTitleStudyNumFileType = "SELECT title.StudyNum, fileinfo.FileType, fileinfo.DTAfile FROM title LEFT JOIN fileinfo ON title.StudyNum = fileinfo.StudyNum ORDER BY title.StudyNum";
	
	
	
	// PDO connect  
	$PDO_string = "mysql:host=" . $db_host . ";port=" . $db_port . ";dbname=" . $db_name ;
	
	try	{
		$PDO_connection = new PDO($PDO_string, $db_username, $db_password); 
		
		} catch(PDOException $e)	{
			echo "Could not connect to the database because: ".	$e->getMessage()."<br>";
			die();
			}
	
			// PDO - create prepared statement: get the table.pifull
 			// --------------------------------------------------------
			$PDO_query = $PDO_connection->prepare($queryTitleStudyNumFileType);
			// PDO - execute the query
			$result = $PDO_query->execute();
	  		if (!$result) {
				die ("Could not query the database: <br />". mysql_error());
				} 	
			$fileTypeList = array();
			$studynumberList = array();
			$titleList = array();
			$dtafileList = array();
			
			$result = $PDO_query->fetch(PDO::FETCH_ASSOC); 
			$row_index = 0;   
			while ($row = $PDO_query->fetch(PDO::FETCH_ASSOC))  {
					
					$studynumberList[$row_index] = $row["StudyNum"];
					if (!is_null($row["FileType"])) { $fileTypeList[$row_index] = $row["FileType"];  }  // others won't have nulls
					$dtafileList[$row_index] = $row["DTAfile"];
					
					
					$row_index++;
			}
			
			$fileTypeList = array_unique($fileTypeList);
			sort($fileTypeList);
			$fileTypeTotal = count($fileTypeList);
			
			$dtafileList = array_unique($dtafileList);
			sort($dtafileList);
			
			
			$studynumberList = array_unique($studynumberList);
			sort($studynumberList);
			$studynumberListTotal = count($studynumberList);
			
			
			$fileTypeListText = implode("','", $fileTypeList);
			$fileTypeListText = "'" . $fileTypeListText . "'";
			
			
//--------------------------------------------------------------------
//  Section: populate the PI listbox
//      used for authority control, javascript select_PIs will paste in selected fields
//----------------------------------------------------------------------
$queryPI_list = "SELECT DISTINCT * FROM pifull ORDER BY pi";
// echo text for debugging purposes only
	
	// PDO connect  
	$PDO_string = "mysql:host=" . $db_host . ";port=" . $db_port . ";dbname=" . $db_name ;
	
	try	{
		$PDO_connection = new PDO($PDO_string, $db_username, $db_password); 
		
		} catch(PDOException $e)	{
			echo "Could not connect to the database because: ".	$e->getMessage()."<br>";
			die();
			}
	
			// PDO - create prepared statement: get the table.pifull
 			// --------------------------------------------------------
			$PDO_query = $PDO_connection->prepare($queryPI_list);
			// PDO - execute the query
			$result = $PDO_query->execute();
	  		if (!$result) {
				die ("Could not query the database: <br />". mysql_error());
				} 	
			$PI_list = array();
			
			
			$result = $PDO_query->fetch(PDO::FETCH_ASSOC); 
			$row_index = 0;   
			
			while ($row = $PDO_query->fetch(PDO::FETCH_ASSOC))  {
					
					$PI_list[$row_index]["picode"] = $row["picode"];
					$PI_list[$row_index]["pi"] = $row["pi"];
					$row_index++;
			}
			
			$PI_list_count = count($PI_list);
			echo "PI count: " . $PI_list_count . "    ";
			
//--------------------------------------------------------------
//       end populate PI section
//-------------------------------------------------------------

//--------------------------------------------------------------------
//  Section: populate the Subject/Index-term listbox
//      used for authority control, javascript to copy and paste in selected fields
//----------------------------------------------------------------------
$querySubject_list = "SELECT DISTINCT subject FROM shfull ORDER BY subject";
//  echo for debugging purposes only
	
	// PDO connect  
	$PDO_string = "mysql:host=" . $db_host . ";port=" . $db_port . ";dbname=" . $db_name ;
	
	try	{
		$PDO_connection = new PDO($PDO_string, $db_username, $db_password); 
		
		} catch(PDOException $e)	{
			echo "Could not connect to the database because: ".	$e->getMessage()."<br>";
			die();
			}
	
			// PDO - create prepared statement: get the table.pifull
 			// --------------------------------------------------------
			$PDO_query = $PDO_connection->prepare($querySubject_list);
			// PDO - execute the query
			$result = $PDO_query->execute();
	  		if (!$result) {
				die ("Could not query the database: <br />". mysql_error());
				} 	
			$Subject_list = array();
			
			
			$result = $PDO_query->fetch(PDO::FETCH_ASSOC); 
			$row_index = 0;   
			
			while ($row = $PDO_query->fetch(PDO::FETCH_ASSOC))  {
					
					$Subject_list[$row_index]["subject"] = $row["subject"];
					$row_index++;
			}
			
			$Subject_list_count = count($Subject_list);
			echo "Subject count: " . $Subject_list_count . "<br>";
//--------------------------------------------------------------
//       end populate Subject section
//-------------------------------------------------------------
	
				
?>

<div id="masthead">
<h1 id="siteName">UCLA Institute for Social Research Data Archives</h1> 
          <h2 id="siteName"><a href="index.php" target="_self">Maintenance Menu</a>&nbsp;/&nbsp;Edit Base Record</h2>  
</div> <!--end masthead--><!--end masthead-->

<div style="margin: 1% 5% 2% 2%;line-height: 1.5;	">
  <form <?php 
  
  	if (isset($_SESSION['studynumber'])) {     //   a study has been chose so post means go to updateCheck
			echo " action='da_catalog_updateCheck.php'";  
			
		}   else {    //  a study HAS NOT been chosen so post the study info back to the input page when you do choose a study
				echo " action=''";  
				}
	
	?>    method="post" name="updateRecord" target="_self">
  
  
    <p><label>Studynumber: 
     <?php
		   		if (isset($_SESSION['studynumber'])) {
					
					$studynumber = $_SESSION['studynumber'];
					
					echo '<input name="studynumber" type="text" id="studynumber" value="' . $studynumber . '" size="30" maxlength="255">';
					
					
					echo '</select>';
					
					
				} else {
			
					echo '<select name="studynumber" id="studynumber">';
		   			echo '<option value="">choose studynumber</option>';
	   		
					foreach ($studynumberList as $key => $value) {
				
						echo '<option value="' . $value . '">' . $value;
				
				 	}
					
			echo " <input name='getbaserecord' type='submit' id='getbaserecord' value='Get this Studynumber'>";
				}
			
			
							
		?></label>
   
    <input name="updateTitle" type="submit" id="updateTitle" value="save/update record">
    <input name="reset form" type="reset" value="reset">
    <input type="button" onClick="history.go(0)" value="Reload page">
    <br><br>
      <input name="title" type="hidden" value="title">
       
       <label>Title: <input name="title" type="text" value="<?php echo $title ?>" size="100" maxlength="225">
       </label><input name="tisubsort" type="hidden" value="1">
       
          <br><br>
      <label>Title level citation: (Subsort number: <?php echo $cite_subsort ?>) <textarea name="cite_title" type="text" cols="200"><?php echo $cite_title ?></textarea></label>
      <input name="cite_subsort" type="hidden" value="<?php echo $cite_subsort ?>">
   
      <label>Restricted:<input name="restricted" type="checkbox"  value="*" <?php if ($restricted == "*") { echo "CHECKED"; }   ?>  >
      </label> 
       
       <label>SDA:<input name="sda" type="checkbox" value="*" <?php if ($sda == "*") { echo "CHECKED"; }   ?>  >
       </label>
       &nbsp;&nbsp;
       <label>Varsrch:<input name="varsrch" type="checkbox" value="*" <?php if ($varsrch == "*") { echo "CHECKED"; }   ?>  >
       </label>
       
       &nbsp;&nbsp;
      <label>CD Only:
         <input name="justonCD" type="checkbox" id="justonCD" value="*" <?php if ($justonCD == "*") { echo "CHECKED"; }   ?>  >
       </label>
       &nbsp;&nbsp;
       <label>
         <input name="article" type="hidden" value="">
       </label>
       &nbsp;&nbsp;
       <label>Mobility Data:<input name="mobilityData" type="checkbox" id="mobilityData" value="*" <?php if ($mobilityData == "*") { echo "CHECKED"; }   ?>  >
       </label> <label>Eve Fielder Collection:<input name="eveFielderCollection" type="checkbox" id="eveFielderCollection" value="*" <?php if ($eveFielderCollection == "*") { echo "CHECKED"; }   ?>  >
       </label></p>
  </form>
  <form action="da_catalog_processFormCheck.php" method="post" name="editSubject" target="_self">
  <br><label>Subject/Index Term List: <input name="subject" type="text" value="<?php echo $subjectTempList;  ?> " size="200" maxlength="255"></label>
     
      <label>Select Subject/Keyword(s) from list:</label>
        <input name="pickSubjects" type="button" id="pickSubjects" onClick="selectPasteCopy('editSubject', 'subject_list','subject')" value="Select and Paste to Subject List">
        <input name="clearOutSubject_list" type="button" id="clearOutSubject_list" onClick="clearoutTextElement('addRecord', 'subject')" value="clear out Subject list">
        <br>
        <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>
        
      <select name="subject_list" size="10" multiple id="subject_list">
  <!--
        //--------------------------------------------------------------------------
        //   dropdown box that is populated with Subject/Keyword terms
        //         used as authority control
        //         pick from list and paste into text box/pi with javscript (da_catalog.js library)  selectPasteCopy and clearoutTextElement scripts functions
        //--------------------------------------------------------------------------
         -->
          <?php
	   		
			for ($row_index=0; $row_index < $Subject_list_count; $row_index++) {
				$subject =  $Subject_list[$row_index]["subject"];
				
				echo '<option value="' . $subject . '">' .$subject;
				
				 }
		?>
        <!--
         //---------------------------------------------------------------------------------
     	//  end of suybject list box
    	 //------------------------------------------------
          -->
          
    </select>
   
        
         <label>Subject(s)/Keywords(s) currently linked to <?php echo $studynumber;  ?></label>
  <?php if (isset($_SESSION['studynumber'])) {
					
					//echo "<br>";
					$studynumber = $_SESSION['studynumber'];
					
					//sort($subjectListFull);
					//$subjectListFull = array_unique($subjectListFull);
					sort($subjectListFull);
					$subjectListFullCount = count($subjectListFull);
					//echo "<br>unique subject rows: " . $subjectListFullCount . "<br>";
			
					
						for ($row_index = 0; $row_index < $subjectListFullCount; $row_index++) {
							
							$subject = $subjectListFull[$row_index]["subject"];
							$shcode_id = $subjectListFull[$row_index]["shcode_id"];
							$subjectcode = $subjectListFull[$row_index]["subjectcode"];
							$subject_subsort = $subjectListFull[$row_index]["subject_subsort"];
							$currentSubject = null;
							
							if ($subjectcode != $currentSubjectCode) {
							echo "<input name='subject' type='text' value='" . $subject . "'  size='100' maxlength='255'>";
							echo "<input name='studynumber' type='hidden' value='" .  $studynumber  . "' >";
							echo "<input name='tisort' type='hidden' value='" .  $tisort  . "' >";
							echo "<input name='subjectcode' type='text' value='subjectcode: " .  $subjectcode  . "' >";
							echo "<input name='shcode_id' type='text' value='shcode_id: " .  $shcode_id  . "' >";
							echo "<input name='item_id' type='hidden' value='" .  $shcode_id  . "' >";
							echo "<input name='requestCategory' type='hidden' value='subject'>";
							// name below is the connecting table for the subjects
							//
							echo "<input name='subject_subsort' type='hidden' value='" . $subject_subsort . "'  size='3' maxlength='3'>";
							echo "<input name='item_subsort' type='text' value='" . $subject_subsort . "'  size='3' maxlength='3'>";
							//
							echo "<input name='table_name' type='hidden' value='shcode'>";
							echo "<input name='item_subsort_fieldname' type='hidden' value='subsort'>";
							echo "<input name='requestType' type='submit' value='Update sort number'>     <input name='requestType' type='submit' value='Delete link'>";
							//echo "   " . $row_index;
							$currentSubjectCode = $subjectcode;
							}
							
						}
								
				} 
        
         ?>
    </form>
 
  <br>
  <?php  
 
 // close the connection
	// mysql_close($connection);		
	$PDO_connection = null;
	
	?>
 
</div> <!-- end content-->
 
  </body></html>
Back to Top