-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrowse-expertise.html
executable file
·153 lines (152 loc) · 7.21 KB
/
browse-expertise.html
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
<?php
//get and set url protocol
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://';
//set and sanitize global variables for URL construction
$server = isset($_SERVER['SERVER_NAME']) ? htmlentities(strip_tags($_SERVER['SERVER_NAME'])) : null;
$path = isset($_SERVER['PHP_SELF']) ? htmlentities(strip_tags(dirname($_SERVER['PHP_SELF']))) : null;
$fileName = isset($_SERVER['SCRIPT_NAME']) ? htmlentities(strip_tags(basename($_SERVER['SCRIPT_NAME']))) : null;
$fileNameURI = isset($_SERVER['REQUEST_URI']) ? htmlentities(strip_tags($_SERVER['REQUEST_URI'])) : null;
$fileExtension = isset($_SERVER['PATH_INFO']) ? pathinfo($fileName, PATHINFO_EXTENSION) : null;
//assign value for title of page
$pageTitle = 'Linked People (Demo) - Expertise';
//declare filename for additional stylesheet variable - default is "none"
$customCSS = 'none';
//bring special functions and utilities onto page
include './meta/inc/utilities.php';
//pass database parameters and connect to database
include_once './meta/assets/database-params.inc';
//create an array with filepaths for multiple page scripts - default is "none"
$customScript[0] = 'none';
?>
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8"/>
<meta http-equiv="x-ua-compatible" content="ie=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title><?php echo($pageTitle); ?>: Montana State University (MSU) Library</title>
<meta name="description" content="<?php echo($pageTitle); ?>: Code prototype for Linked People"/>
<link rel="canonical" href="<?php echo $protocol.$server.$path; ?>/<?php echo $fileName; ?>"/>
<link rel="stylesheet prefetch" href="https://fonts.googleapis.com/css?family=Oswald"/>
<style>
html {-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;box-sizing:border-box;}
*,:before,:after {box-sizing:inherit;}
html,body {-webkit-font-smoothing:antialiased;background-color:#eee;color:#333;font-family:Oswald,Helvetica,arial,sans-serif;font-size:100%;font-stretch:normal;font-style:normal;font-variant:normal;font-weight:400;height:100%;line-height:1.5;margin:0;padding:0;width:100%;}
header {background-color:#002a61;color:#fff;line-height:70px;padding:0 70px;width:100%;}
nav {color:#828282;display:inline;font-size:.7em;padding:0 10px;}
a {color:#002a61;transition:all .3s;}
nav a {color:#bebebe;text-decoration:none;}
nav a:hover {text-decoration:underline;}
header .nav a,footer .nav a {font-size:14px;}
header .nav a:not(:last-child),footer .nav a:not(:last-child) {border-right:.0725em solid #c4c4c4;margin-right:5px;padding-right:10px;}
main {/*height:100vh;*/min-height:396px;padding:20px 40px;}
.content {column-gap:40px;column-width:300px;}
.content {display:grid;grid-gap:40px;grid-template-columns:repeat(1, 100%);}
section {-webkit-column-break-inside:avoid;background-color:#fff;break-inside:avoid;padding:30px;page-break-inside:avoid;}
@supports (column-width:300px;) {
section+section {margin:20px 0;}
}
@supports (display:grid) {
section+section {margin:0;}
}
header h1 {color:#fff;display:inline-block;font-size:2em;font-weight:bold;margin:10px 0;padding:0;}
h1 {color:#1a202c;font-size:1.5em;font-weight:normal;padding:10px 30px;}
h2 {color:#5d5d5d;font-size:1.17em;font-weight:normal;margin-bottom:.4em;}
p+p {margin-top:.7em;}
hr {border:0;border-bottom:0 solid #fff;border-top:.0725em solid #c4c4c4;box-sizing:content-box;height:0;margin:2em auto 1em;}
a.home {text-decoration:none;color:#fff;}
.border-ftr {width:90%;}
.center {text-align:center;}
.copyright {font-size:12px;}
.text {padding:5px;width:250px;}
/*medium screen view < 1030px (based on 16px browser default)*/
@media all and (max-width:64.375em) {
/*.content {grid-template-columns: repeat(2, 48%);}*/
}
/*small screen view < 801px (based on 16px browser default)*/
@media all and (max-width:50.063em) {
header {line-height:40px;padding:0 45px;}
header nav {display:block;padding:0;}
main {padding-left:15px;padding-right:15px;}
.content {grid-template-columns: repeat(1, 100%);}
}
</style>
<?php
if ($customCSS = (empty($customCSS)) ? null : $customCSS) {
$countedCSS = count($customCSS);
for ($i = 0; $i < $countedCSS; $i++) {
?>
<link rel="stylesheet" href="<?php echo $customCSS[$i]; ?>">
<?php
}
}
?>
</head>
<body id="page" vocab="https://schema.org/" typeof="AboutPage" resource="<?php echo $protocol.$server.$path; ?>/<?php echo $fileName; ?>#page">
<link property="isPartOf" typeof="CollectionPage" href="<?php echo $protocol.$server.$path; ?>/"/>
<header>
<h1><a class="home" href="index.html">Linked People</a></h1>
<nav class="nav"><a href="index.html">Home</a> <a href="search.html">Search</a> <a href="browse-expertise.html">Browse</a></nav>
</header>
<main>
<h1>Browse People Expertise</h1>
<div class="content">
<section>
<h2>By Topic</h2>
<ul>
<?php
//request expertise topics
$query = 'SELECT create_action.object, create_action.object_uri,
COUNT(create_action_match.create_id) as object_count
FROM linked_people.create_action_match
JOIN linked_people.create_action ON (create_action.create_id = create_action_match.create_id)
JOIN linked_people.person ON (create_action_match.person_id = person.person_id)
GROUP BY create_action.object';
$getExpertiseTopics = $connectLibstaff->query($query) or die("Error retrieving data from database.");
//list expertise topics and print out as HTML
while ($row = $getExpertiseTopics->fetch_object()) {
$object = $row->object;
$object_url = $row->object_uri;
$object_count = $row->object_count;
$url_term = basename($object_url);
if ($getExpertiseTopics->num_rows) {
?>
<li property="additionalType" resource="<?php echo $object_url; ?>">
<a href="./search.html?expertise=<?php echo urlencode($url_term);?>"><?php echo $object; ?> (<?php echo $object_count; ?>)</a>
<link property="about" href="https://en.wikipedia.org/wiki/<?php echo str_replace(' ', '_', $object); ?>" />
</li>
<?php
} else {
?>
<li>There are no expertise topics assigned to the databases.</li>
<?php
}
}
?>
</ul>
</section>
</div>
</main>
<footer>
<hr class="border-ftr">
<p class="nav center">
<a property="relatedLink" href="https://github.com/msulibrary/linked-people">GitHub</a>
<a property="relatedLink" href="http://journal.code4lib.org/articles/12320">Article</a>
<a property="relatedLink" href="https://www.lib.montana.edu/">Library</a>
</p>
<p class="copyright center">
© <a property="author creator copyrightHolder reviewedBy" rel="author" href="https://www.wikidata.org/wiki/Q15255419">Montana State University (MSU) Library</a> <time property="dateModified lastReviewed" datetime="2017-04-17T18:57:03-07:00" title="published 2017-04-17T18:57:03-07:00">2017</time>
</p>
</footer>
<?php
if ($customScript = (empty($customScript)) ? null : $customScript) {
$counted = count($customScript);
for ($i = 0; $i < $counted; $i++) {
?>
<script type="text/javascript" src="<?php echo $customScript[$i]; ?>"></script>
<?php
}
}
?>
</body>
</html>