forked from figshare/Total-Impact
-
Notifications
You must be signed in to change notification settings - Fork 0
/
seed.php
executable file
·46 lines (39 loc) · 2.04 KB
/
seed.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
<?php require_once './bootstrap.php';
function runseed($name, $type) {
breadcrumb("in seed with " . $name . " " . $type);
$seed = new Models_Seeder();
$artifactIds = array();
$groups = "";
$contacts = "";
if ($type=="mendeley_profile") {
$detailList = $seed->getMendeleyProfileArtifacts($name);
$detailString = implode("\n", $detailList); # \n has to be in DOUBLE quotes not single quotes
$response = array("artifactIds"=>$detailString, "artifactCount"=>count($detailList));
} elseif ($type=="mendeley_group") {
$detailList = $seed->getMendeleyGroupArtifacts($name);
$detailString = implode("\n", $detailList); # \n has to be in DOUBLE quotes not single quotes
$response = array("artifactIds"=>$detailString, "artifactCount"=>count($detailList));
} elseif ($type=="slideshare_profile") {
$detailList = $seed->getSlideshareProfileArtifacts($name);
$detailString = implode("\n", $detailList); # \n has to be in DOUBLE quotes not single quotes
$response = array("artifactIds"=>$detailString, "artifactCount"=>count($detailList));
} elseif ($type=="dryad_profile") {
$detailList = $seed->getDryadProfileArtifacts($name);
$detailString = implode("\n", $detailList); # \n has to be in DOUBLE quotes not single quotes
$response = array("artifactIds"=>$detailString, "artifactCount"=>count($detailList));
} elseif ($type=="pubmed_grant") {
$detailList = $seed->getPubMedGrantArtifacts($name);
$detailString = implode("\n", $detailList); # \n has to be in DOUBLE quotes not single quotes
$response = array("artifactIds"=>$detailString, "artifactCount"=>count($detailList));
} elseif ($type=="quick_report_contacts") {
$contacts = $seed->getMendeleyProfileContactsDisplay($name);
$response = array("contacts"=>$contacts);
} elseif ($type=="quick_report_groups") {
$groups = $seed->getMendeleyProfileGroupsDisplay($name);
$response = array("groups"=>$groups);
}
return($response);
}
breadcrumb("finished seed.php");
echo json_encode(runseed(trim($_REQUEST['name']), trim($_REQUEST['type'])));
?>