Mercurial > hg > ywww
comparison php/read/map/getMapRecommPaths.php @ 6:077b0a0a3e6d
remaining originals according to dependency walk
author | Robert Boland <robert@markup.co.uk> |
---|---|
date | Thu, 16 Feb 2017 22:29:02 +0000 |
parents | |
children | 385ddd7c4b55 a67bf725e87b |
comparison
equal
deleted
inserted
replaced
5:55445b456ad0 | 6:077b0a0a3e6d |
---|---|
1 <?PHP | |
2 if(!isset($ret)) | |
3 { | |
4 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); | |
5 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); | |
6 header("Cache-Control: no-store, no-cache, must-revalidate"); | |
7 header("Cache-Control: post-check=0, pre-check=0", false); | |
8 header("Pragma: no-cache"); | |
9 } | |
10 $linkedBooks = 0; | |
11 | |
12 $UserID = $_GET['user']; | |
13 | |
14 if(isset($_GET['loc'])){ | |
15 $loc = $_GET['loc']; | |
16 } | |
17 else{ | |
18 $loc = 0; //default location is 1 | |
19 } | |
20 | |
21 if(isset($_GET['listname'])){ | |
22 $listName = $_GET['listname']; | |
23 } | |
24 else{ | |
25 $listName = "MyMap"; //default map | |
26 } | |
27 | |
28 include "../../../../private/db.php"; | |
29 //need to have an if statement to catch the first time it is run and call - CALL b_setMapAuthorXYcoord | |
30 | |
31 //Can swicth to this call if the map is having problems | |
32 //Need to CALL b_setMap_RelatedISBNs to create the initial relationships and then | |
33 //b_setMap_AllRelatedISBNs b_setMap_relatedISBNs b_setMap_updateRelatedDuplicate | |
34 //Need to CALL b_setMap_updateRelatedDuplicate to update the relationships | |
35 //$query = "CALL b_getMap_relatedBooksNPath('$UserID', $loc)"; // this generates fixed points - | |
36 | |
37 | |
38 //Need to call this b_setupUserMap if there are no books for that UserID | |
39 // $query = "CALL b_getMap_relatedBooksNPath($UserID, $loc,\"$listName\")"; | |
40 $query = "CALL b_getMap_topRelatedBNP($UserID, $loc,\"$listName\")"; | |
41 | |
42 $results = mysqli_query($link, $query) or exit( mysqli_error( $link )); | |
43 | |
44 if( mysqli_num_rows($results) == 0) | |
45 { | |
46 //populate the data | |
47 mysqli_close($link); | |
48 include "../../../../private/db.php"; | |
49 $query1 = "CALL b_setupUserMap($UserID, $loc,\"$listName\")"; | |
50 $results1 = mysqli_query($link, $query1) or exit( mysqli_error( $link )); | |
51 | |
52 mysqli_close($link); | |
53 include "../../../../private/db.php"; | |
54 // $query = "CALL b_getMap_relatedBooksNPath($UserID, $loc,\"$listName\")"; | |
55 $query = "CALL b_getMap_topRelatedBNP($UserID, $loc,\"$listName\")"; | |
56 | |
57 $results = mysqli_query($link, $query) or exit( mysqli_error( $link )); | |
58 } | |
59 | |
60 $output = "<?xml version=\"1.0\"?>"; | |
61 $output .= "<results>"; | |
62 $LastISBN = "START"; | |
63 $ChangePaths = 0; | |
64 | |
65 while($line = mysqli_fetch_assoc($results)) { | |
66 | |
67 $ISBN =trim($line["ISBN"]); | |
68 $Title =trim($line["Title"]); | |
69 $Author =trim($line["Author"]); | |
70 $ImageURL =trim($line["ImageURL"]); | |
71 $ISBN2 =trim($line["ISBN2"]); | |
72 | |
73 IF ($LastISBN != $ISBN && $ChangePaths == 1) { | |
74 $output .= "</PATHS>"; | |
75 $output .= "</Node>"; | |
76 $ChangePaths = 0; | |
77 } | |
78 | |
79 IF ($LastISBN != $ISBN ) { | |
80 $ChangePaths = 1; | |
81 $output .= "<Node>"; | |
82 $output .= "<ISBN>" . $ISBN . "</ISBN>"; | |
83 $output .= "<Title>" . $Title . "</Title>"; | |
84 $output .= "<Author>" . $Author . "</Author>"; | |
85 $output .= "<ImageURL>" . $ImageURL. "</ImageURL>"; | |
86 $output .= "<PATHS>"; | |
87 } | |
88 | |
89 $output .= "<ISBN2>" . $ISBN2 . "</ISBN2>"; | |
90 | |
91 $LastISBN = $ISBN; | |
92 } | |
93 $output .= "</PATHS>"; | |
94 $output .= "</Node>"; | |
95 | |
96 $output .= "</results>"; | |
97 | |
98 echo $output; | |
99 | |
100 mysqli_close($link); | |
101 | |
102 ?> |