-
Notifications
You must be signed in to change notification settings - Fork 0
/
getPastModels.php
51 lines (41 loc) · 1.31 KB
/
getPastModels.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
<?php
error_reporting(E_ERROR);
/**
* getPastModels.php
* parameters:
* usr
* grp
* weeks (how many weeks back)
* Response:
* JSON array
*
* @author Julio Guerra (PAWS group, iSchool, University of Pittsburgh)
**/
$usr = $_GET["usr"];
$grp = $_GET["grp"];
$weeks = $_GET["weeks"];
include("config.php");
include("dbFunctions.php");
include("userFunctions.php");
header('Content-Type: application/json');
$courseinfo = getCourseInfo($grp);
$courseid = $courseinfo["courseid"];
$domain = $courseinfo["domain"];
$_past_models = getPastModels($usr, $courseid, $weeks);
$_json_output = "{\"user\":\"".$usr."\", \"group\":\"".$grp."\", \"models\": [ ";
foreach($_past_models as $key => $_model){
$_json_output .= "{\"built\":\"".$_model["computedon"]."\", \"progress\": [";
// $_model["progress"]
$_progress = split("\|",$_model["progress"]);
foreach($_progress as $doc_progress){
$_values = split(";",$doc_progress);
$_json_output .= "{\"docno\" : \"".$_values[0]."\", \"uprogress\" : \"".$_values[1]."\", \"uconfidence\" : \"".$_values[2]."\"},";
}
$_json_output = substr($_json_output,0,-1);
$_json_output .= "]},";
//$user["model"] = "[the user model]";
}
$_json_output = substr($_json_output,0,-1);
$_json_output .= "]}";
echo $_json_output;
?>