Repository navigation
Expand file tree
/
Copy pathgetRegionsSubMenu.php
More file actions
90 lines (74 loc) · 1.95 KB
/
Copy pathgetRegionsSubMenu.php
File metadata and controls
90 lines (74 loc) · 1.95 KB
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
<?php
$debug =0;
if (array_key_exists("currentCatCSV",$_POST))
{
$currentCatCSV = $_POST['currentCatCSV'];
}
if($debug==1){
echo '<br>in dir - currentCatCSV = ', $currentCatCSV;
}
/*
Example return:
in dir - currentCombocsv = 3:business:33
*/
$catInfo=explode(":",$currentCatCSV);
if($debug==1){
echo '<br>print_r $catInfo = ';
print_r($catInfo);
}
$category_id= $catInfo[0];
$category_name = $catInfo[1];
$catLinkCount = $catInfo[2];//note this number of links in category is before regional filtering has been applied
if($debug==1){
echo '<br> $category_id= ', $category_id;
echo '<br> $category_name= ', $category_name;
echo '<br> $catLinkCount = ', $catLinkCount;
echo '<br> $linkCount = ', $linkCount;
echo '<br> $lft = ', $lft;
echo '<br> $rgt = ', $rgt;
echo '<br> $countcatInfo = ',$countcatInfo;
}
if (!defined('READER_AGENTS')) {
include(dirname( __FILE__, 2 ). "/odp2-configs/db_cfg/auth_constants.php");
}
include(dirname( __FILE__, 2 ). "/odp2-configs/db_cfg/".READER_AGENTS);
include(dirname( __FILE__, 2 ). "/odp2-configs/db_cfg/mysqli_connect.php");
$query = "SELECT * FROM ";
$query .= "regions";
$query .= " WHERE parent = ";
$query .= $category_id;
$query .= " AND link_count > 0";
$query .= " ORDER BY NAME";
if($debug==1){
echo '<br>$query = ', $query;
}
$result= mysqli_query($mysqli, $query);
$numRows=mysqli_num_rows($result);
if($debug==1){
echo '<br>$numRows = ', $numRows;
}
if($numRows > 0){
while ($row = mysqli_fetch_assoc($result)){
if($debug==1){
echo '<br>row = ';
print_r($row);
}
$sendArray[] = $row['id'].":".$row['name'].":".$row['lft'].":".$row['rgt'].":".$row['link_count'];
}
if($debug==1){
print_r($sendArray[0]);
}
}
if(mysqli_num_rows($result) > 0){
$json_encode_send_array = json_encode($sendArray, true);
echo $json_encode_send_array;
if($debug==1){
echo $json_encode_send_array;
}
}
else
{
$empty = json_encode("Sorry, No More Categories Found.");
echo $empty;
}
?>