|
|
@ -16,18 +16,17 @@ include("header.php"); |
|
|
|
|
|
|
|
|
|
|
|
// ************* <option value="0">{$lang_option_none}</option> |
|
|
|
// ************* <option value="0">{$lang_option_none}</option> |
|
|
|
|
|
|
|
|
|
|
|
$sql = "SELECT location_id AS id, location_name, location_parent, location_sort |
|
|
|
$sql = "SELECT location_id AS id, location_name AS name, |
|
|
|
|
|
|
|
location_parent AS parent, location_sort AS sort |
|
|
|
FROM location |
|
|
|
FROM location |
|
|
|
ORDER BY location_parent, location_sort, location_name"; |
|
|
|
ORDER BY location_parent, location_sort, location_name"; |
|
|
|
$sth = $dbh->query($sql); |
|
|
|
$sth = $dbh->query($sql); |
|
|
|
$locations = $sth->fetchAll(); |
|
|
|
$locations = $sth->fetchAll(); |
|
|
|
|
|
|
|
|
|
|
|
$location_counter = count($locations); |
|
|
|
if (count($locations) > 0) { |
|
|
|
|
|
|
|
|
|
|
|
if ($location_counter > 0) { |
|
|
|
|
|
|
|
foreach ($locations AS $location) { |
|
|
|
foreach ($locations AS $location) { |
|
|
|
$location_names[$location['location_id']] = $location['location_name']; |
|
|
|
$location_names[$location['id']] = $location['name']; |
|
|
|
$parents[$location['location_parent']][] = $location['location_id']; |
|
|
|
$parents[$location['parent']][] = $location['id']; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -43,7 +42,6 @@ function location($parents, $parent = 0) { |
|
|
|
$children[$child] = NULL; |
|
|
|
$children[$child] = NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $children; |
|
|
|
return $children; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -63,8 +61,11 @@ function checkchildren($locations, $level) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$tree = location($parents); |
|
|
|
$tree = location($parents); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// create tree option list |
|
|
|
$location_options = array(0 => '-'); |
|
|
|
$location_options = array(0 => '-'); |
|
|
|
checkchildren($tree, 0); |
|
|
|
checkchildren($tree, 0); |
|
|
|
|
|
|
|
|
|
|
|
$smarty->assign("location_options", $location_options); |
|
|
|
$smarty->assign("location_options", $location_options); |
|
|
|
$smarty->assign("location_parent", $location_parent); |
|
|
|
$smarty->assign("location_parent", $location_parent); |
|
|
|
|
|
|
|
|
|
|
|