This repository has been archived by the owner on May 15, 2019. It is now read-only.
forked from ndlibersa/resources
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathajax_htmldata.php
2685 lines (2028 loc) · 87.6 KB
/
ajax_htmldata.php
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
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/*
**************************************************************************************************************************
** CORAL Resources Module v. 1.2
**
** Copyright (c) 2010 University of Notre Dame
**
** This file is part of CORAL.
**
** CORAL is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
**
** CORAL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License along with CORAL. If not, see <http://www.gnu.org/licenses/>.
**
**************************************************************************************************************************
*/
session_start();
include_once 'directory.php';
include_once 'user.php';
$config = new Configuration();
$util = new Utility();
switch ($_GET['action']) {
case 'getProductDetails':
$resourceID = $_GET['resourceID'];
$resource = new Resource(new NamedArguments(array('primaryKey' => $resourceID)));
$resourceFormat = new ResourceFormat(new NamedArguments(array('primaryKey' => $resource->resourceFormatID)));
$resourceType = new ResourceType(new NamedArguments(array('primaryKey' => $resource->resourceTypeID)));
$acquisitionType = new AcquisitionType(new NamedArguments(array('primaryKey' => $resource->acquisitionTypeID)));
$status = new Status(new NamedArguments(array('primaryKey' => $resource->statusID)));
$createUser = new User(new NamedArguments(array('primaryKey' => $resource->createLoginID)));
$updateUser = new User(new NamedArguments(array('primaryKey' => $resource->updateLoginID)));
$archiveUser = new User(new NamedArguments(array('primaryKey' => $resource->archiveLoginID)));
//get parent resource
//only returns one - ResourceRelationship object
$resourceRelationship = new ResourceRelationship();
$resourceRelationship = $resource->getParentResource();
$parentResource = new Resource(new NamedArguments(array('primaryKey' => $resourceRelationship->relatedResourceID)));
//get children resources
$sanitizedInstance = array();
$instance = new Resource();
$childResourceArray = array();
foreach ($resource->getChildResources() as $instance) {
foreach (array_keys($instance->attributeNames) as $attributeName) {
$sanitizedInstance[$attributeName] = $instance->$attributeName;
}
$sanitizedInstance[$instance->primaryKeyName] = $instance->primaryKey;
array_push($childResourceArray, $sanitizedInstance);
}
//get aliases
$sanitizedInstance = array();
$instance = new Alias();
$aliasArray = array();
foreach ($resource->getAliases() as $instance) {
foreach (array_keys($instance->attributeNames) as $attributeName) {
$sanitizedInstance[$attributeName] = $instance->$attributeName;
}
$sanitizedInstance[$instance->primaryKeyName] = $instance->primaryKey;
$aliasType = new AliasType(new NamedArguments(array('primaryKey' => $instance->aliasTypeID)));
$sanitizedInstance['aliasTypeShortName'] = $aliasType->shortName;
array_push($aliasArray, $sanitizedInstance);
}
//get organizations (already returned in an array)
$orgArray = $resource->getOrganizationArray();
?>
<table class='linedFormTable' style='width:460px;'>
<tr>
<th width="115"></th>
<th></th>
</tr>
<tr>
<th colspan='2' style='margin-top: 7px; margin-bottom: 5px;'>
<span style='float:left; vertical-align:top; max-width:400px; margin-left:3px;'><span style='font-weight:bold;font-size:120%;margin-right:8px;'><?php echo $resource->titleText; ?></span><span style='font-weight:normal;font-size:100%;'><?php echo $acquisitionType->shortName . " " . $resourceFormat->shortName . " " . $resourceType->shortName; ?></span></span>
<span style='float:right; vertical-align:top;'><?php if ($user->canEdit()){ ?><a href='ajax_forms.php?action=getUpdateProductForm&height=498&width=730&resourceID=<?php echo $resource->resourceID; ?>&modal=true' class='thickbox'><img src='images/edit.gif' alt='edit' title='edit resource'></a><?php } ?> <?php if ($user->isAdmin){ ?><a href='javascript:void(0);' class='removeResource' id='<?php echo $resourceID; ?>'><img src='images/cross.gif' alt='remove resource' title='remove resource'></a><?php } ?></span>
</th>
</tr>
<tr>
<td style='vertical-align:top;width:115px;'>Record ID:</td>
<td style='width:345px;'><?php echo $resource->resourceID; ?></td>
</tr>
<tr>
<td style='vertical-align:top;width:115px;'>Status:</td>
<td style='width:345px;'><?php echo $status->shortName; ?></td>
</tr>
<?php
if (!is_null_date($resource->archiveDate)){
?>
<tr class='lightGrayBackground'>
<td>
Archived:
</td>
<td>
<i>
<?php
echo format_date($resource->archiveDate);
if ($archiveUser->getDisplayName){
echo " by " . $archiveUser->getDisplayName;
}else if ($resource->archiveLoginID){
echo " by " . $resource->archiveLoginID;
}
?>
</i>
</td>
</tr>
<?php
}
?>
<tr>
<td>
Created:
</td>
<td>
<i>
<?php
echo format_date($resource->createDate);
if ($createUser->getDisplayName){
echo " by " . $createUser->getDisplayName;
}else if ($resource->createLoginID){
echo " by " . $resource->createLoginID;
}
?>
</i>
</td>
</tr>
<?php
if (!is_null_date($resource->updateDate)){
?>
<tr>
<td>
Last Update:
</td>
<td>
<i>
<?php
echo format_date($resource->updateDate);
if ($updateUser->getDisplayName){
echo " by " . $updateUser->getDisplayName;
}else if ($resource->updateLoginID){
echo " by " . $resource->updateLoginID;
}
?>
</i>
</td>
</tr>
<?php
}
if (($parentResource->titleText) || (count($childResourceArray) > 0)){ ?>
<tr>
<td style='vertical-align:top;width:115px;'>Related Products:
<?php if (count($childResourceArray) > 0) { ?>
<br><span style='float: right;'>Child: <br></span>
<?php } ?>
</td>
<td style='width:345px;'>
<?php
if ($parentResource->titleText){
echo "<span style='float: left;'>" . $parentResource->titleText . " (Parent) <a href='resource.php?resourceID=" . $parentResource->resourceID . "' target='_BLANK'><img src='images/arrow-up-right.gif' alt='view resource' title='View " . $parentResource->titleText . "' style='vertical-align:top;'></a></span><br />";
} else {
echo "<br />";
}
?>
<?php
if (count($childResourceArray) > 0) { ?>
<?php
foreach ($childResourceArray as $childResource){
$childResourceObj = new Resource(new NamedArguments(array('primaryKey' => $childResource['resourceID'])));
echo "<span style='float: left;'>" . $childResourceObj->titleText . "<a href='resource.php?resourceID=" . $childResourceObj->resourceID . "' target='_BLANK'><img src='images/arrow-up-right.gif' alt='view resource' title='View " . $childResourceObj->titleText . "' style='vertical-align:top;'></a></span><br />";
}
?>
</td>
</tr>
<?php
}
}
if ($resource->isbnOrISSN){
?>
<tr>
<td style='vertical-align:top;width:115px;'>ISSN / ISBN:</td>
<td style='width:345px;'><?php echo $resource->isbnOrISSN; ?></td>
</tr>
<?php
}
if (count($aliasArray) > 0){
?>
<tr>
<td style='vertical-align:top;width:115px;'>Aliases:</td>
<td style='width:345px;'>
<?php
foreach ($aliasArray as $resourceAlias){
echo "\n<span style='float: left; width:95px;'>" . $resourceAlias['aliasTypeShortName'] . ":</span><span style='width:270px;'>" . $resourceAlias['shortName'] . "</span><br />";
}
?>
</td>
</tr>
<?php
}
if (count($orgArray) > 0){
?>
<tr>
<td style='vertical-align:top;width:115px;'>Organizations:</td>
<td style='width:345px;'>
<?php
foreach ($orgArray as $organization){
//if organizations is installed provide a link
if ($config->settings->organizationsModule == 'Y'){
echo "<span style='float:left; width:75px;'>" . $organization['organizationRole'] . ":</span><span style='width:270px;'>" . $organization['organization'] . " <a href='" . $util->getOrganizationURL() . $organization['organizationID'] . "' target='_blank'><img src='images/arrow-up-right.gif' alt='View " . $organization['organization'] . "' title='View " . $organization['organization'] . "' style='vertical-align:top;'></a></span><br />";
}else{
echo "<span style='float:left; width:75px;'>" . $organization['organizationRole'] . ":</span><span style='width:270px;'>" . $organization['organization'] . "</span><br />";
}
}
?>
</td>
</tr>
<?php
}
if ($resource->resourceURL) { ?>
<tr>
<td style='vertical-align:top;width:115px;'>Resource URL:</td>
<td style='width:345px;'><?php echo $resource->resourceURL; ?> <a href='<?php echo $resource->resourceURL; ?>' target='_blank'><img src='images/arrow-up-right.gif' alt='Visit Resource URL' title='Visit Resource URL' style='vertical-align:top;'></a></td>
</tr>
<?php
}
if ($resource->resourceAltURL) { ?>
<tr>
<td style='vertical-align:top;width:115px;'>Alt URL:</td>
<td style='width:345px;'><?php echo $resource->resourceAltURL; ?> <a href='<?php echo $resource->resourceAltURL; ?>' target='_blank'><img src='images/arrow-up-right.gif' alt='Visit Secondary Resource URL' title='Visit Secondary Resource URL' style='vertical-align:top;'></a></td>
</tr>
<?php
}
if ($resource->descriptionText){ ?>
<tr>
<td style='vertical-align:top;width:115px;'>Description:</td>
<td style='width:345px;'><?php echo nl2br($resource->descriptionText); ?></td>
</tr>
<?php } ?>
</table>
<?php if ($user->canEdit()){ ?>
<a href='ajax_forms.php?action=getUpdateProductForm&height=498&width=730&modal=true&resourceID=<?php echo $resourceID; ?>' class='thickbox' id='editResource'>edit product details</a><br />
<?php } ?>
<br />
<br />
<?php
//get subjects for this tab
$sanitizedInstance = array();
$generalDetailSubjectIDArray = array();
foreach ($resource->getGeneralDetailSubjectLinkID() as $instance) {
foreach (array_keys($instance->attributeNames) as $attributeName) {
$sanitizedInstance[$attributeName] = $instance->$attributeName;
}
$sanitizedInstance[$instance->primaryKeyName] = $instance->primaryKey;
array_push($generalDetailSubjectIDArray, $sanitizedInstance);
}
if (count($generalDetailSubjectIDArray) > 0){
?>
<table class='linedFormTable' style='width:460px;max-width:460px;'>
<tr>
<th>Subjects</th>
<th>
</th>
<th>
</th>
</tr>
<?php
$generalSubjectID = 0;
foreach ($generalDetailSubjectIDArray as $generalDetailSubjectID){
$generalSubject = new GeneralSubject(new NamedArguments(array('primaryKey' => $generalDetailSubjectID[generalSubjectID])));
$detailedSubject = new DetailedSubject(new NamedArguments(array('primaryKey' => $generalDetailSubjectID[detailedSubjectID])));
?>
<tr>
<td>
<?php if ($generalDetailSubjectID['generalSubjectID'] != $generalSubjectID) {
echo $generalSubject->shortName;
// Allow deleting of the General Subject if no Detail Subjects exist
if (in_array($generalDetailSubjectID['generalSubjectID'], $generalDetailSubjectIDArray[0], true) > 1) {
$canDelete = false;
} else {
$canDelete = true;
}
} else {
echo " ";
$canDelete = true;
}
?>
</td>
<td>
<?php echo $detailedSubject->shortName; ?>
</td>
<td style='width:50px;'>
<?php if ($user->canEdit() && $canDelete){ ?>
<a href='javascript:void(0);' tab='Product' class='removeResourceSubjectRelationship' generalDetailSubjectID='<?php echo $generalDetailSubjectID[generalDetailSubjectLinkID]; ?>' resourceID='<?php echo $resourceID; ?>'><img src='images/cross.gif' alt='remove subject' title='remove subject'></a>
<?php } ?>
</td>
</tr>
<?php
$generalSubjectID = $generalDetailSubjectID['generalSubjectID'];
}
?>
<?php } ?>
</table>
<?php
if ($user->canEdit()){
?>
<a href='ajax_forms.php?action=getResourceSubjectForm&height=233&width=425&tab=Product&resourceID=<?php echo $resourceID; ?>&modal=true' class='thickbox'>add new subject</a>
<?php
}
?>
<br />
<br />
<?php
//get notes for this tab
$sanitizedInstance = array();
$noteArray = array();
foreach ($resource->getNotes('Product') as $instance) {
foreach (array_keys($instance->attributeNames) as $attributeName) {
$sanitizedInstance[$attributeName] = $instance->$attributeName;
}
$sanitizedInstance[$instance->primaryKeyName] = $instance->primaryKey;
$updateUser = new User(new NamedArguments(array('primaryKey' => $instance->updateLoginID)));
//in case this user doesn't have a first / last name set up
if (($updateUser->firstName != '') || ($updateUser->lastName != '')){
$sanitizedInstance['updateUser'] = $updateUser->firstName . " " . $updateUser->lastName;
}else{
$sanitizedInstance['updateUser'] = $instance->updateLoginID;
}
$noteType = new NoteType(new NamedArguments(array('primaryKey' => $instance->noteTypeID)));
if (!$noteType->shortName){
$sanitizedInstance['noteTypeName'] = 'General Note';
}else{
$sanitizedInstance['noteTypeName'] = $noteType->shortName;
}
array_push($noteArray, $sanitizedInstance);
}
if (count($noteArray) > 0){
?>
<table class='linedFormTable' style='width:460px;max-width:460px;'>
<tr>
<th>Additional Notes</th>
<th>
<?php if ($user->canEdit()){ ?>
<a href='ajax_forms.php?action=getNoteForm&height=233&width=410&tab=Product&resourceID=<?php echo $resourceID; ?>&resourceNoteID=&modal=true' class='thickbox'>add new note</a>
<?php } ?>
</th>
</tr>
<?php foreach ($noteArray as $resourceNote){ ?>
<tr>
<td style='width:115px;'><?php echo $resourceNote['noteTypeName']; ?><br />
<?php if ($user->canEdit()){ ?>
<a href='ajax_forms.php?action=getNoteForm&height=233&width=410&tab=Product&resourceID=<?php echo $resourceID; ?>&resourceNoteID=<?php echo $resourceNote['resourceNoteID']; ?>&modal=true' class='thickbox'><img src='images/edit.gif' alt='edit' title='edit note'></a> <a href='javascript:void(0);' class='removeNote' id='<?php echo $resourceNote['resourceNoteID']; ?>' tab='Product'><img src='images/cross.gif' alt='remove note' title='remove note'></a>
<?php } ?>
</td>
<td><?php echo nl2br($resourceNote['noteText']); ?><br /><i><?php echo format_date($resourceNote['updateDate']) . " by " . $resourceNote['updateUser']; ?></i></td>
</tr>
<?php } ?>
</table>
<?php
}else{
if ($user->canEdit()){
?>
<a href='ajax_forms.php?action=getNoteForm&height=233&width=410&tab=Product&resourceID=<?php echo $resourceID; ?>&resourceNoteID=&modal=true' class='thickbox'>add new note</a>
<?php
}
}
break;
case 'getResourceTitle':
$resourceID = $_GET['resourceID'];
$resource = new Resource(new NamedArguments(array('primaryKey' => $resourceID)));
echo $resource->titleText;
break;
case 'getAcquisitionsDetails':
$config = new Configuration();
$resourceID = $_GET['resourceID'];
$resource = new Resource(new NamedArguments(array('primaryKey' => $resourceID)));
$orderType = new OrderType(new NamedArguments(array('primaryKey' => $resource->orderTypeID)));
$acquisitionType = new AcquisitionType(new NamedArguments(array('primaryKey' => $resource->acquisitionTypeID)));
//get purchase sites
$sanitizedInstance = array();
$instance = new PurchaseSite();
$purchaseSiteArray = array();
foreach ($resource->getResourcePurchaseSites() as $instance) {
$purchaseSiteArray[]=$instance->shortName;
}
//get payments
$sanitizedInstance = array();
$instance = new ResourcePayment();
$paymentArray = array();
foreach ($resource->getResourcePayments() as $instance) {
foreach (array_keys($instance->attributeNames) as $attributeName) {
$sanitizedInstance[$attributeName] = $instance->$attributeName;
}
$sanitizedInstance[$instance->primaryKeyName] = $instance->primaryKey;
$selector = new User(new NamedArguments(array('primaryKey' => $instance->selectorLoginID)));
$sanitizedInstance['selectorName'] = $selector->firstName . " " . $selector->lastName;
$orderType = new OrderType(new NamedArguments(array('primaryKey' => $instance->orderTypeID)));
$sanitizedInstance['orderType'] = $orderType->shortName;
array_push($paymentArray, $sanitizedInstance);
}
//get license statuses
$sanitizedInstance = array();
$instance = new ResourceLicenseStatus();
$licenseStatusArray = array();
foreach ($resource->getResourceLicenseStatuses() as $instance) {
foreach (array_keys($instance->attributeNames) as $attributeName) {
$sanitizedInstance[$attributeName] = $instance->$attributeName;
}
$sanitizedInstance[$instance->primaryKeyName] = $instance->primaryKey;
$changeUser = new User(new NamedArguments(array('primaryKey' => $instance->licenseStatusChangeLoginID)));
if (($changeUser->firstName) || ($changeUser->lastName)) {
$sanitizedInstance['changeName'] = $changeUser->firstName . " " . $changeUser->lastName;
}else{
$sanitizedInstance['changeName'] = $instance->licenseStatusChangeLoginID;
}
$licenseStatus = new LicenseStatus(new NamedArguments(array('primaryKey' => $instance->licenseStatusID)));
$sanitizedInstance['licenseStatus'] = $licenseStatus->shortName;
array_push($licenseStatusArray, $sanitizedInstance);
}
//get licenses (already returned in array)
$licenseArray = $resource->getLicenseArray();
?>
<table class='linedFormTable' style='width:460px;'>
<tr>
<th colspan='2' style='vertical-align:bottom;'>
<span style='float:left;vertical-align:bottom;'>Order</span>
<?php if ($user->canEdit()){ ?>
<span style='float:right;vertical-align:bottom;'><a href='ajax_forms.php?action=getOrderForm&height=462&width=783&modal=true&resourceID=<?php echo $resourceID; ?>' class='thickbox' id='editOrder'><img src='images/edit.gif' alt='edit' title='edit order information'></a></span>
<?php } ?>
</th>
</tr>
<?php if ($resource->acquisitionTypeID) { ?>
<tr>
<td style='vertical-align:top;width:110px;'>Acquisition Type:</td>
<td style='width:350px;'><?php echo $acquisitionType->shortName; ?></td>
</tr>
<?php } ?>
<?php if ($resource->orderNumber) { ?>
<tr>
<td style='vertical-align:top;width:110px;'>Order Number:</td>
<td style='width:350px;'><?php echo $resource->orderNumber; ?></td>
</tr>
<?php } ?>
<?php if ($resource->systemNumber) { ?>
<tr>
<td style='vertical-align:top;width:110px;'>System Number:</td>
<td style='width:350px;'>
<?php
echo $resource->systemNumber;
if ($config->settings->catalogURL != ''){
echo " <a href='" . $config->settings->catalogURL . $resource->systemNumber . "' target='_blank'>catalog view</a>";
}
?>
</td>
</tr>
<?php } ?>
<?php if (count($purchaseSiteArray) > 0) { ?>
<tr>
<td style='vertical-align:top;width:110px;'>Purchasing Sites:</td>
<td style='width:350px;'><?php echo implode(", ", $purchaseSiteArray); ?></td>
</tr>
<?php } ?>
<?php if (!is_null_date($resource->subscriptionStartDate)) { ?>
<tr>
<td style='vertical-align:top;width:110px;'>Subscription Start:</td>
<td style='width:350px;'><?php echo format_date($resource->subscriptionStartDate); ?></td>
</tr>
<?php } ?>
<?php if (!is_null_date($resource->subscriptionEndDate)) { ?>
<tr>
<td style='vertical-align:top;width:110px;'>Subscription End:</td>
<td style='width:350px;'><?php echo format_date($resource->subscriptionEndDate); ?>
<?php if ($resource->subscriptionAlertEnabledInd == "1") { echo "<i>Expiration Alert Enabled</i>"; } ?>
</td>
</tr>
<?php } ?>
</table>
<br />
<table class='linedFormTable' style='width:460px;'>
<tr>
<th colspan='3'>Initial Cost</th>
</th>
</tr>
<?php
if (count($paymentArray) > 0){
foreach ($paymentArray as $payment){
if ($payment['fundName']){
$fund = $payment['fundName'];
}else{
$fund = " ";
}
if (integer_to_cost($payment['paymentAmount'])){
$cost = $payment['currencyCode'] . " " . integer_to_cost($payment['paymentAmount']);
}else{
$cost = " ";
}
?>
<tr>
<td><?php echo $fund; ?></td>
<td><?php echo $cost; ?></td>
<td><?php echo $payment['orderType']; ?></td>
</tr>
<?php
}
}else{
echo "<tr><td colspan='3'><i>No payment information available.</i></td></tr>";
}
?>
</table>
<?php if ($user->canEdit()){ ?>
<a href='ajax_forms.php?action=getOrderForm&height=462&width=783&modal=true&resourceID=<?php echo $resourceID; ?>' class='thickbox' id='newAlias'>edit acquisitions information</a>
<?php } ?>
<br />
<br />
<br />
<br />
<table class='linedFormTable' style='width:460px;'>
<tr>
<th colspan='2'>
<span style='float:left;vertical-align:bottom;'>License</span>
<?php if ($user->canEdit()){ ?>
<span style='float:right;vertical-align:bottom;'><a href='ajax_forms.php?action=getLicenseForm&height=420&width=385&modal=true&resourceID=<?php echo $resourceID; ?>' class='thickbox' id='editLicense'><img src='images/edit.gif' alt='edit' title='edit resource'></a></span>
<?php } ?>
</th>
</tr>
<tr>
<td style='vertical-align:top;width:110px;'>Status:</td>
<td style='width:350px;'>
<?php
if (count($licenseStatusArray) > 0){
foreach ($licenseStatusArray as $licenseStatus){
echo $licenseStatus['licenseStatus'] . " on <i>" . format_date($licenseStatus['licenseStatusChangeDate']) . " by " . $licenseStatus['changeName'] . "</i><br />";
}
}else{
echo "<i>No license status information available.</i>";
}
?>
</td>
</tr>
<?php if ($config->settings->licensingModule == "Y"){ ?>
<tr>
<td style='vertical-align:top;width:110px;'>Licenses:</td>
<td style='width:350px;'>
<?php
if (count($licenseArray) > 0){
foreach ($licenseArray as $license){
echo $license['license'] . " <a href='" . $util->getLicensingURL() . $license['licenseID'] . "' target='_blank'><img src='images/arrow-up-right.gif' alt='View License' title='View License' style='vertical-align:top;'></a><br />";
}
}else{
echo "<i>No associated licenses available.</i>";
}
?>
</td>
</tr>
<?php } ?>
</table>
<?php if ($user->canEdit()){ ?>
<?php if ($config->settings->licensingModule == "Y"){ ?>
<a href='ajax_forms.php?action=getLicenseForm&height=420&width=378&modal=true&resourceID=<?php echo $resourceID; ?>' class='thickbox'>edit license and status</a>
<?php }else{ ?>
<a href='ajax_forms.php?action=getLicenseForm&height=300&width=378&modal=true&resourceID=<?php echo $resourceID; ?>' class='thickbox'>edit license status</a>
<?php } ?>
<?php } ?>
<br /><br /><br /><br />
<?php
//get notes for this tab
$sanitizedInstance = array();
$noteArray = array();
foreach ($resource->getNotes('Acquisitions') as $instance) {
foreach (array_keys($instance->attributeNames) as $attributeName) {
$sanitizedInstance[$attributeName] = $instance->$attributeName;
}
$sanitizedInstance[$instance->primaryKeyName] = $instance->primaryKey;
$updateUser = new User(new NamedArguments(array('primaryKey' => $instance->updateLoginID)));
//in case this user doesn't have a first / last name set up
if (($updateUser->firstName != '') || ($updateUser->lastName != '')){
$sanitizedInstance['updateUser'] = $updateUser->firstName . " " . $updateUser->lastName;
}else{
$sanitizedInstance['updateUser'] = $instance->updateLoginID;
}
$noteType = new NoteType(new NamedArguments(array('primaryKey' => $instance->noteTypeID)));
if (!$noteType->shortName){
$sanitizedInstance['noteTypeName'] = 'General Note';
}else{
$sanitizedInstance['noteTypeName'] = $noteType->shortName;
}
array_push($noteArray, $sanitizedInstance);
}
if (count($noteArray) > 0){
?>
<table class='linedFormTable' style='width:460px;max-width:460px;'>
<tr>
<th>Additional Notes</th>
<th>
<?php if ($user->canEdit()){?>
<a href='ajax_forms.php?action=getNoteForm&height=233&width=410&tab=Acquisitions&resourceID=<?php echo $resourceID; ?>&resourceNoteID=&modal=true' class='thickbox'>add new note</a>
<?php } ?>
</th>
</tr>
<?php foreach ($noteArray as $resourceNote){ ?>
<tr>
<td style='width:110px;'><?php echo $resourceNote['noteTypeName']; ?><br />
<?php if ($user->canEdit()){?>
<a href='ajax_forms.php?action=getNoteForm&height=233&width=410&tab=Acquisitions&resourceID=<?php echo $resourceID; ?>&resourceNoteID=<?php echo $resourceNote['resourceNoteID']; ?>&modal=true' class='thickbox'><img src='images/edit.gif' alt='edit' title='edit note'></a> <a href='javascript:void(0);' class='removeNote' id='<?php echo $resourceNote['resourceNoteID']; ?>' tab='Acquisitions'><img src='images/cross.gif' alt='remove note' title='remove note'></a>
<?php } ?>
</td>
<td><?php echo nl2br($resourceNote['noteText']); ?><br /><i><?php echo format_date($resourceNote['updateDate']) . " by " . $resourceNote['updateUser']; ?></i></td>
</tr>
<?php } ?>
</table>
<?php
}else{
if ($user->canEdit()){
?>
<a href='ajax_forms.php?action=getNoteForm&height=233&width=410&tab=Acquisitions&resourceID=<?php echo $resourceID; ?>&resourceNoteID=&modal=true' class='thickbox'>add new note</a>
<?php
}
}
break;
case 'getAccessDetails':
$resourceID = $_GET['resourceID'];
$resource = new Resource(new NamedArguments(array('primaryKey' => $resourceID)));
$userLimit = new UserLimit(new NamedArguments(array('primaryKey' => $resource->userLimitID)));
$storageLocation = new StorageLocation(new NamedArguments(array('primaryKey' => $resource->storageLocationID)));
$accessMethod = new AccessMethod(new NamedArguments(array('primaryKey' => $resource->accessMethodID)));
$authenticationType = new AuthenticationType(new NamedArguments(array('primaryKey' => $resource->authenticationTypeID)));
//get administering sites
$sanitizedInstance = array();
$instance = new AdministeringSite();
$administeringSiteArray = array();
foreach ($resource->getResourceAdministeringSites() as $instance) {
$administeringSiteArray[]=$instance->shortName;
}
//get authorized sites
$sanitizedInstance = array();
$instance = new PurchaseSite();
$authorizedSiteArray = array();
foreach ($resource->getResourceAuthorizedSites() as $instance) {
$authorizedSiteArray[]=$instance->shortName;
}
?>
<table class='linedFormTable' style='width:460px;'>
<tr>
<th colspan='2'>
<span style='float:left;vertical-align:bottom;'>Access Information</span>
<?php if ($user->canEdit()){ ?>
<span style='float:right;vertical-align:bottom;'><a href='ajax_forms.php?action=getAccessForm&height=394&width=640&modal=true&resourceID=<?php echo $resourceID; ?>' class='thickbox' id='editAccess'><img src='images/edit.gif' alt='edit' title='edit resource'></a></span>
<?php } ?>
</th>
</tr>
<?php if (count($administeringSiteArray) > 0) { ?>
<tr>
<td style='vertical-align:top;width:150px;'>Administering Sites:</td>
<td style='width:310px;'><?php echo implode(", ", $administeringSiteArray); ?></td>
</tr>
<?php } ?>
<?php if (count($authorizedSiteArray) > 0) { ?>
<tr>
<td style='vertical-align:top;width:150px;'>Authorized Sites:</td>
<td style='width:310px;'><?php echo implode(", ", $authorizedSiteArray); ?></td>
</tr>
<?php } ?>
<?php if ($authenticationType->shortName) { ?>
<tr>
<td style='vertical-align:top;width:150px;'>Authentication Type:</td>
<td style='width:310px;'><?php echo $authenticationType->shortName; ?></td>
</tr>
<?php } ?>
<?php if (($resource->authenticationUserName) || ($resource->authenticationPassword)) { ?>
<tr>
<td style='vertical-align:top;width:150px;'>Username / Password:</td>
<td style='width:310px;'><?php echo $resource->authenticationUserName . " / " . $resource->authenticationPassword; ?></td>
</tr>
<?php } ?>
<?php if ($userLimit->shortName) { ?>
<tr>
<td style='vertical-align:top;width:150px;'>Simultaneous User Limit:</td>
<td style='width:310px;'><?php echo $userLimit->shortName; ?></td>
</tr>
<?php } ?>
<?php if ($resource->registeredIPAddressException){ ?>
<tr>
<td style='vertical-align:top;width:150px;'>Registered IP Address:</td>
<td style='width:310px;'><?php echo $resource->registeredIPAddressException; ?></td>
</tr>
<?php } ?>
<?php if ($storageLocation->shortName) { ?>
<tr>
<td style='vertical-align:top;width:150px;'>Storage Location:</td>
<td style='width:310px;'><?php echo $storageLocation->shortName; ?></td>
</tr>
<?php } ?>
<?php if ($resource->coverageText) { ?>
<tr>
<td style='vertical-align:top;width:150px;'>Coverage:</td>
<td style='width:310px;'><?php echo $resource->coverageText; ?></td>
</tr>
<?php } ?>
<?php if ($accessMethod->shortName) { ?>
<tr>
<td style='vertical-align:top;width:150px;'>Access Method:</td>
<td style='width:310px;'><?php echo $accessMethod->shortName; ?></td>
</tr>
<?php
}
if ((count($administeringSiteArray) == 0) && (!$authenticationType->shortName) && (!$resource->coverageText) && (!$resource->authenticationUserName) && (!$resource->authenticationPassword) && (!$userLimit->shortName) && (!$resource->registeredIPAddressException) && (!$storageLocation->shortName) && (!$accessMethod->shortName)){
echo "<tr><td colspan='2'><i>No access information available.</i></td></tr>";
}
?>
</table>
<?php if ($user->canEdit()){ ?>
<a href='ajax_forms.php?action=getAccessForm&height=394&width=640&modal=true&resourceID=<?php echo $resourceID; ?>' class='thickbox' id='editAccess'>edit access information</a>
<?php } ?>
<br /><br /><br />
<?php
//get notes for this tab
$sanitizedInstance = array();
$noteArray = array();
foreach ($resource->getNotes('Access') as $instance) {
foreach (array_keys($instance->attributeNames) as $attributeName) {
$sanitizedInstance[$attributeName] = $instance->$attributeName;
}
$sanitizedInstance[$instance->primaryKeyName] = $instance->primaryKey;
$updateUser = new User(new NamedArguments(array('primaryKey' => $instance->updateLoginID)));
//in case this user doesn't have a first / last name set up
if (($updateUser->firstName != '') || ($updateUser->lastName != '')){
$sanitizedInstance['updateUser'] = $updateUser->firstName . " " . $updateUser->lastName;
}else{
$sanitizedInstance['updateUser'] = $instance->updateLoginID;
}
$noteType = new NoteType(new NamedArguments(array('primaryKey' => $instance->noteTypeID)));
if (!$noteType->shortName){
$sanitizedInstance['noteTypeName'] = 'General Note';
}else{
$sanitizedInstance['noteTypeName'] = $noteType->shortName;
}
array_push($noteArray, $sanitizedInstance);
}
if (count($noteArray) > 0){
?>
<table class='linedFormTable' style='width:460px;max-width:460px;'>
<tr>
<th>Additional Notes</th>
<th>
<?php if ($user->canEdit()){?>
<a href='ajax_forms.php?action=getNoteForm&height=233&width=410&tab=Access&resourceID=<?php echo $resourceID; ?>&resourceNoteID=&modal=true' class='thickbox'>add new note</a>
<?php } ?>
</th>
</tr>
<?php foreach ($noteArray as $resourceNote){ ?>
<tr>
<td style='width:150px;'><?php echo $resourceNote['noteTypeName']; ?><br />
<?php if ($user->canEdit()){?>
<a href='ajax_forms.php?action=getNoteForm&height=233&width=410&tab=Access&resourceID=<?php echo $resourceID; ?>&resourceNoteID=<?php echo $resourceNote['resourceNoteID']; ?>&modal=true' class='thickbox'><img src='images/edit.gif' alt='edit' title='edit note'></a> <a href='javascript:void(0);' class='removeNote' id='<?php echo $resourceNote['resourceNoteID']; ?>' tab='Access'><img src='images/cross.gif' alt='remove note' title='remove note'></a>
<?php } ?>
</td>
<td><?php echo nl2br($resourceNote['noteText']); ?><br /><i><?php echo format_date($resourceNote['updateDate']) . " by " . $resourceNote['updateUser']; ?></i></td>
</tr>
<?php } ?>
</table>
<?php
}else{
if ($user->canEdit()){
?>
<a href='ajax_forms.php?action=getNoteForm&height=233&width=410&tab=Access&resourceID=<?php echo $resourceID; ?>&resourceNoteID=&modal=true' class='thickbox'>add new note</a>
<?php
}
}
break;
case 'getContactDetails':
$resourceID = $_GET['resourceID'];
if (isset($_GET['archiveInd'])) $archiveInd = $_GET['archiveInd']; else $archiveInd='';
if (isset($_GET['showArchivesInd'])) $showArchivesInd = $_GET['showArchivesInd']; else $showArchivesInd='';
$resource = new Resource(new NamedArguments(array('primaryKey' => $resourceID)));
$util = new Utility();
//these are used to display the header since the arrays have resource and organization level contacts combined
$resContactFlag = 0;
$orgContactFlag = 0;
//get contacts
$sanitizedInstance = array();
$contactArray = array();
$contactObjArray = array();
if ((isset($archiveInd)) && ($archiveInd == "1")){
//if we want archives to be displayed
if ($showArchivesInd == "1"){
if (count($resource->getArchivedContacts()) > 0){
echo "<i><b>The following are archived contacts:</b></i>";
}
$contactArray = $resource->getArchivedContacts();