-
Notifications
You must be signed in to change notification settings - Fork 0
/
index-backend.php
271 lines (228 loc) · 9.16 KB
/
index-backend.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
<?php
include("config.php");
include("dbFunctions.php");
include("userFunctions.php");
$usr = $_GET["usr"];
$grp = $_GET["grp"];
$sid = $_GET["sid"];
$reader_url = $config_readerURL;
$courseInfo = getCourseInfo($grp);
$course_key = $courseInfo["coursekey"];
$course_domain = $courseInfo["domain"];
$course_kseadb = $courseInfo["legacy_kseadb"];
$course_title = $courseInfo["title"];
$course = $course_key; // used for getting the file name of the json structure
// The book, docno and page can either be received as parameters or
// they are taken from the last action of the user, or the default given the
// group (grp)
$bookid = "";
$docno = "";
$page = -1;
// AS PARAMETERS: The book, docno and page to load can be received as parameters
//if (isset($_GET['course']) ) { $course = $_GET['course'];}
if (isset($_GET['bookid']) ) { $bookid = $_GET['bookid'];}
if (isset($_GET['docno']) ) { $docno = $_GET['docno'];}
if (isset($_GET['page']) ) { $page = $_GET['page'];}
// if there were no parameters got from URL
if(strlen($bookid) == 0){
$user_last_doc = getUserLastDocViewed($usr,$grp,$course_domain);
if(!is_null($user_last_doc)){
$bookid = $user_last_doc["docsrc"];
$docno = $user_last_doc["docno"];
$page = 1;
}else{
if($course === 'isd'){
$bookid = "lamming";
$docno = "lamming-0001";
$page = 1;
}
if($course === 'tdo'){
$bookid = "tdo";
$docno = "tdo-2000";
$page = 1;
}
if($course === 'ir'){
$bookid = "iir";
$docno = "iir-2104";
$page = 1;
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>ReadingCircle ~ PAWS Lab at Pitt</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link href="css/bootstrap.css" type="text/css" rel="stylesheet"/>
<link href="css/button.css" type="text/css" rel="stylesheet"/>
<link href="css/eRaeder.css" type="text/css" rel="stylesheet"/>
<!--<link type='text/css' href='css/demo.css' rel='stylesheet' media='screen'/>
<link type='text/css' href='css/basic.css' rel='stylesheet' media='screen'/>
<link type='text/css' href='css/basic_ie.css' rel='stylesheet' media='screen'/>
<link type="text/css" rel="stylesheet" href="chosen/chosen.css"/>
<link type="text/css" rel="stylesheet" href="css/button.css"/>-->
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.peity.min.js"></script>
<script type="text/javascript" src="js/jquery.scrollTo.min.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<script type="text/javascript" src="d3/d3.js"></script>
<!--script type="text/javascript" src="partition-sunburst.js"></script-->
<script>
$(document).ready(function () {
var flag = 0;
$("#slide-btn").click(function () {
if (flag == 0) {
$("#sidebar").animate({"width":"0"}, 500)
$("#content").animate({"padding":"0 0 0 200px"}, 500)
$("#slide-btn").animate({"left":"0"}, 500)
$("#sidebar").hide(500)
$("#toggle-question-status").hide();
flag = 1
return true;
}
if (flag == 1) {
$("#sidebar").animate({"width":"450px"}, 500).show()
$("#slide-btn").animate({"left":"450px"}, 500)
$("#content").animate({"padding":"0 0 0 500px"}, 500)
$("#toggle-question-status").show(500);
flag = 0
return true;
}
});
});
function sbRefresh(docno){
$("#iframe-sun")
//.load(function(){window.frames[0].setHighlight(docno);})
.attr("src","partition-sunburst.php?usr=<?php echo $usr;?>&grp=<?php echo $grp;?>&sid=<?php echo $sid;?>&course=<?php echo $course;?>&dbase=<?php echo $course_kseadb;?>&docno="+docno);
//alert("partition-sunburst.php?usr=<?php echo $usr;?>&grp=<?php echo $grp;?>&sid=<?php echo $sid;?>&course=<?php echo $course;?>&dbase=<?php echo $course_kseadb;?>&docno="+docno);
}
</script>
</head>
<body>
<div id="container">
<div id="sidebar">
<iframe name="iframe-sb" id="iframe-sun" width="450px" height="400px" scrolling="no" style="overflow:hidden;"
src="partition-sunburst.php?v=100&usr=<?php echo $usr;?>&grp=<?php echo $grp;?>&sid=<?php echo $sid;?>&course=<?php echo $course;?>&dbase=<?php echo $course_kseadb;?>&docno=<?php echo $docno;?>" ></iframe>
<div style="width:450px; overflow:hidden">
<?php require_once("small-multiples.php") ?>
</div>
</div>
<div id="slide-btn">
<button id="slide-toggle" class="btn btn-inverse btn-mini"><i class="icon-resize-horizontal icon-white"></i> </button>
</div>
<div id="content">
<iframe id="readings" src="<?php echo $reader_url;?>?bookid=<?php echo $bookid;?>&docno=<?php echo $docno;?>&page=<?php echo $page;?>&usr=<?php echo $usr;?>&grp=<?php echo $grp;?>&sid=<?php echo $sid;?>&course=<?php echo $course;?>&dbase=<?php echo $course_kseadb;?>"
name="iframe-content" scrolling="no" style="overflow-x:hidden; overflow:hidden; padding-top: -100px; height: 1130px; width: 100%;"></iframe>
</div>
</div>
<!-- Ruikun's work part1 -->
<div id="peerCompareShowBox">
<div id="peerCompareShowWrapper">
<div class="chartCompare">
<iframe name="iframe-sb" id="iframe-sun" width="450px" height="435px" src="partition-sunburst.php?v=100&usr=<?php echo $usr;?>&grp=<?php echo $grp;?>&sid=<?php echo $sid;?>&course=<?php echo $course;?>&dbase=<?php echo $course_kseadb;?>"></iframe>
<h5 id="firstChartCompare"></h5>
</div>
</div>
<span id="closeBtn">Close</span> </div>
<!-- part1 end -->
<div id="overlay"></div>
</body>
<!-- Ruikun's work part2 -->
<script type="text/javascript">
var usr = "<?php echo $usr; ?>";
var grp = "<?php echo $grp; ?>";
var sid = "<?php echo $sid; ?>";
var course = "<?php echo $course; ?>";
var course_kseadb = "<?php echo $course_kseadb; ?>";
var groupmodels_url = "<?php echo $config_groupMoldelsURL; ?>";
groupmodels_url = groupmodels_url+"?grp="+grp+"&mode=model";
var userName=[], userLogin=[];
//alert(thisUrl);
$.ajax({
url: groupmodels_url,
async:false,
success: function(result){
for(var i=0;i<result.users.length;i++){
userName[i]=result.users[i].name;
userLogin[i]=result.users[i].login;
}
//alert(userName);
//alert(userLogin);
}
})
/* var peerCompare=document.getElementById("peerCompareShowBtn");
var peerCompareShowWrapper=document.getElementById("peerCompareShowWrapper");
peerCompare.onclick=peerCompareShow;
var peerCompareShowBox=document.getElementById("peerCompareShowBox");*/
/* var svgTemp=document.getElementById("chart2").getElementsByTagName("svg");
for (var k=0; k<svgTemp.length;k++){
svgTemp[k].onclick=getUserName;
}*/
var svgNameSub=0;
$(function(){
$("#chart2 #chart2Btn a").click(function(){
switch($(this).html()){
case "0":
svgNameSub=0;
break;
case "1":
svgNameSub=1;
break;
case "2":
svgNameSub=2;
break;
}
//alert(svgNameSub);
peerCompareShow();
return false;
});
});
// @@@@ REVIEW
var userNameSub=0;
for(var j=0;j<userLogin.length;j++){
if(userLogin[j]==usr){
userNameSub=j;
//alert(userName[j])
}
}
//var compareUserName=[];
//var subNum=0;
/* for(var k=0;k<userLogin.length;k++){
//if(userLogin[k]!=usr){
compareUserName[subNum]=userName[k];
subNum++;
//}
}*/
var closeBtn=document.getElementById("closeBtn");
closeBtn.onclick=PeerCompareClose;
var peerCompareShowWrapper=document.getElementById("peerCompareShowWrapper");
function peerCompareShow(){
//$("#peerCompareShowBox").css("display","block");
$("#peerCompareShowBox").fadeIn("fast");
peerCompareShowWrapper.innerHTML="<div class='chartCompare'><iframe src='partition-sunburst.php?v=100&usr="+usr+"&grp="+grp+"&sid="+sid+"&course="+course+"&dbase="+course_kseadb+"' name='iframe-sb' id='iframe-sun' width='450px' height='435px'></iframe>"+
"<h5>"+userName[userNameSub]+"</h5></div>"+
"<div class='chartCompare'><iframe src='partition-sunburst.php?v=100&usr="+userLogin[svgNameSub]+"&grp="+grp+"&sid="+sid+"&course="+course+"&dbase="+course_kseadb+"' name='iframe-sb' id='iframe-sun' width='450px' height='435px'></iframe>"+
"<h5>"+userName[svgNameSub]+"</h5></div>";
}
function PeerCompareClose(){
$("#peerCompareShowBox").fadeOut("fast");
//$("#peerCompareShowBox").css("display","none");
}
/* for(var j=0;j<userLogin.length;j++){
if(userLogin[j]==usr){
document.getElementById("firstChartCompare").innerHTML=userName[j];
//alert(userName[j])
}
}*/
/* for(var j=0;j<userLogin.length;j++){
if(userLogin[j]!=usr){
peerCompareShowWrapper.innerHTML+="<div class='chartCompare'><iframe src='partition-sunburst.php?v=100&usr="+userLogin[j]+"&grp="+grp+"&sid="+sid+"&course="+course+"&dbase="+course_kseadb+"' name='iframe-sb' id='iframe-sun' width='450px' height='435px'></iframe><h5>"+userName[j]+"</h5></div>";
}
else{
document.getElementById("firstChartCompare").innerHTML=userName[j];
}
}*/
//peerCompareShowWrapper.innerHTML+="<div style='clear:both'></div>";
</script>
</html>