-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd-to-list.php
146 lines (132 loc) · 5.87 KB
/
add-to-list.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
<?php
session_start();
// Is Krumo present?
include('Polaris-API-PHP-Class/krumo/class.krumo.php');
// Look for optional local settings file. Helpful for presentation purposes. :)
if (file_exists('Polaris-API-PHP-Class/settings.local.php')) {
include 'Polaris-API-PHP-Class/settings.local.php';
}
// Include PHP class for use w/ API.
include('Polaris-API-PHP-Class/pac_polaris.inc');
// Reusable functions
include('functions.inc');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="favicon.ico">
<title>IUG Hackathon - Polaris My Lists Builder</title>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/jumbotron.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="js/ie-emulation-modes-warning.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/hackathon">IUG Hackathon - Polaris My Lists Builder</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<?php include ('login-form.inc'); ?>
</div><!--/.navbar-collapse -->
</div>
</nav>
<!-- Main jumbotron for a primary marketing message or call to action -->
<div class="jumbotron">
<div class="container">
<h1>Add to My Lists</h1>
<?php
$success = FALSE;
if (!empty($_GET['success'])) {
$success = $_GET['success'];
}
?>
<?php if ($success != TRUE) : ?>
<form action="add-to-list.php?success=true" method="post">
<input type="hidden" id="item_id" name="item_id" value="<?php print $_GET['ControlNumber']; ?>">
<div class="form-group">
<!-- Show them a dropdown that lists their lists. -->
<select name="list_id" id="list_id" class="form-control">
<?php
$barcode = 20080104020258;
if (isset($_SESSION['barcode'])) {
$barcode = $_SESSION['barcode'];
}
$lists = PolarisAPI::PatronAccountGetTitleLists($barcode); // Find the patron's list of lists.
if (!empty($lists->PatronAccountTitleListsRows)) {
foreach ($lists->PatronAccountTitleListsRows as $list) {
//krumo($list);
print '<option value="' . $list->RecordStoreID . '">' . $list->RecordStoreName . '</option>';
}
}
?>
</select>
</div>
<div class="form-group">
<button type="submit" class="btn btn-success">Add</button>
</div>
</form>
<?php else : ?>
<!-- If they submit the form, add the title to that list. -->
<?php
$barcode = 20080104020258;
if (isset($_SESSION['barcode'])) {
$barcode = $_SESSION['barcode'];
}
$list_id = $_POST['list_id'];
$item_id = $_POST['item_id'];
// Look up the item based on the id number.
$bib_record = PolarisAPI::getBib($item_id);
$title = '';
foreach($bib_record->BibGetRows as $row) {
switch ($row->ElementID) {
case 35:
//title
$title = $row->Value;
break;
}
}
$result = PolarisAPI::PatronTitleListAddTitle($barcode, $list_id, $item_id, $title);
?>
<!-- Show a success message. -->
<p class="bg-success" style="padding: 10px;"><i class="fa fa-thumbs-o-up"></i> Your item was successfully added to your list!</p>
<?php endif; ?>
</div>
</div>
<div class="container">
<?php include ('footer.inc'); ?>
</div> <!-- /container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>