Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gmap
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drupal.org
gmap
Commits
ef662156
Commit
ef662156
authored
18 years ago
by
webgeer
Browse files
Options
Downloads
Patches
Plain Diff
http://drupal.org/node/101538
parent
d67efcb2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gmap_location.module
+15
-15
15 additions, 15 deletions
gmap_location.module
with
15 additions
and
15 deletions
gmap_location.module
+
15
−
15
View file @
ef662156
...
...
@@ -87,7 +87,7 @@ function gmap_location_user_page() {
$result
=
db_query
(
"SELECT * FROM
{
location
}
WHERE (longitude !=0 OR latitude !=0) AND type='user'"
);
while
(
$u
=
db_fetch_object
(
$result
))
{
$account
=
user_load
(
array
(
'uid'
=>
$u
->
o
id
));
$account
=
user_load
(
array
(
'uid'
=>
$u
->
e
id
));
$dupes
=
array_intersect
(
$account
->
roles
,
$roles_override
);
if
(
empty
(
$dupes
))
{
$marker
=
$default_marker
;
...
...
@@ -103,7 +103,7 @@ function gmap_location_user_page() {
$newmarker
[
'link'
]
=
url
(
'user/'
.
$account
->
uid
);
$newmarker
[
'markername'
]
=
$marker
;
$newmarker
[
'tooltip'
]
=
check_plain
(
$account
->
name
);
$locationbyuser
[
$u
->
o
id
]
=
array
(
'latitude'
=>
$u
->
latitude
,
'longitude'
=>
$u
->
longitude
);
$locationbyuser
[
$u
->
e
id
]
=
array
(
'latitude'
=>
$u
->
latitude
,
'longitude'
=>
$u
->
longitude
);
}
else
{
$newmarker
[
'latitude'
]
=
$u
->
latitude
;
...
...
@@ -163,13 +163,13 @@ function gmap_location_node_page($nid=null) {
$output
.
=
'<p>'
.
variable_get
(
'gmap_node_map_header'
,
t
(
'This map illustrates the extent of nodes of this website.'
))
.
"</p>
\n
"
;
$result
=
db_query
(
"SELECT
o
id, longitude, latitude FROM
{
location
}
WHERE (longitude!=0 OR latitude !=0) AND type='node'"
);
$result
=
db_query
(
"SELECT
e
id, longitude, latitude FROM
{
location
}
WHERE (longitude!=0 OR latitude !=0) AND type='node'"
);
$thismap
=
gmap_parse_macro
(
variable_get
(
'gmap_node_map'
,
'[gmap|id=usermap|center=30,0|zoom=2|width=100%|height=400px]'
));
if
(
empty
(
$thismap
[
'markers'
]))
{
$thismap
[
'markers'
]
=
array
();
}
while
(
$locn
=
db_fetch_object
(
$result
))
{
$n
=
node_load
(
array
(
'vid'
=>
$locn
->
o
id
));
$n
=
node_load
(
array
(
'vid'
=>
$locn
->
e
id
));
if
(
$n
&&
node_access
(
'view'
,
$n
))
{
$thismap
=
gmap_location_node_map
(
$n
,
$thismap
,
false
);
}
...
...
@@ -496,7 +496,7 @@ function _gmap_location_getlatlon($node) {
function
gmap_location_block_view
(
$nid
)
{
$block
=
array
();
$node
=
node_load
(
array
(
'nid'
=>
$nid
)
)
;
$node
=
node_load
(
$nid
);
if
(
_gmap_location_getlatlon
(
$node
))
{
$block
[
'subject'
]
=
t
(
'Location'
);
if
(
strlen
(
variable_get
(
'gmap_location_block_macro_'
.
$node
->
type
,
''
))
>
0
)
{
...
...
@@ -581,7 +581,7 @@ function gmap_location_user($op, &$edit, &$user, $category = NULL) {
if
(
module_exist
(
'gmap'
)
&&
variable_get
(
'gmap_user'
,
0
)
&&
user_access
(
'set user location'
))
{
$object
->
gmap_location_latitude
=
$edit
[
'gmap_location_latitude'
];
$object
->
gmap_location_longitude
=
$edit
[
'gmap_location_longitude'
];
$object
->
o
id
=
$user
->
uid
;
$object
->
e
id
=
$user
->
uid
;
switch
(
$op
)
{
case
'categories'
:
...
...
@@ -590,7 +590,7 @@ function gmap_location_user($op, &$edit, &$user, $category = NULL) {
_gmap_location_validate_form
(
$object
);
return
;
case
'load'
:
$res
=
db_query
(
"SELECT * FROM
{
location
}
WHERE
o
id=%d AND type='user'"
,
$user
->
uid
);
$res
=
db_query
(
"SELECT * FROM
{
location
}
WHERE
e
id=%d AND type='user'"
,
$user
->
uid
);
if
(
$gmap_user
=
db_fetch_array
(
$res
))
{
if
(
$gmap_user
[
'latitude'
]
!=
0
)
$user
->
gmap_location_latitude
=
$gmap_user
[
'latitude'
];
if
(
$gmap_user
[
'longitude'
]
!=
0
)
$user
->
gmap_location_longitude
=
$gmap_user
[
'longitude'
];
...
...
@@ -606,7 +606,7 @@ function gmap_location_user($op, &$edit, &$user, $category = NULL) {
return
;
case
'delete'
:
db_query
(
"DELETE from
{
location
}
WHERE
o
id=%d AND type='user'"
,
$user
->
uid
);
db_query
(
"DELETE from
{
location
}
WHERE
e
id=%d AND type='user'"
,
$user
->
uid
);
return
;
case
'form'
:
...
...
@@ -669,11 +669,11 @@ function gmap_location_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
if
(
variable_get
(
'gmap_node_'
.
$node
->
type
,
0
))
{
$object
->
gmap_location_latitude
=
$node
->
gmap_location_latitude
;
$object
->
gmap_location_longitude
=
$node
->
gmap_location_longitude
;
$object
->
o
id
=
$node
->
vid
;
$object
->
e
id
=
$node
->
vid
;
switch
(
$op
)
{
case
'load'
:
$res
=
db_query
(
"SELECT * FROM
{
location
}
WHERE
o
id=%d AND type='node'"
,
$node
->
vid
);
$res
=
db_query
(
"SELECT * FROM
{
location
}
WHERE
e
id=%d AND type='node'"
,
$node
->
vid
);
if
(
$gmap_node
=
db_fetch_array
(
$res
))
{
if
(
$gmap_node
[
'latitude'
]
!=
0
)
$node
->
gmap_location_latitude
=
$gmap_node
[
'latitude'
];
if
(
$gmap_node
[
'longitude'
]
!=
0
)
$node
->
gmap_location_longitude
=
$gmap_node
[
'longitude'
];
...
...
@@ -694,7 +694,7 @@ function gmap_location_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
return
;
case
'delete'
:
db_query
(
"DELETE from
{
location
}
WHERE
o
id=%d AND type='node'"
,
$node
->
vid
);
db_query
(
"DELETE from
{
location
}
WHERE
e
id=%d AND type='node'"
,
$node
->
vid
);
return
;
}
...
...
@@ -775,14 +775,14 @@ function _gmap_location_validate_form(&$object) {
function
_gmap_location_store_location
(
&
$object
,
$type
,
$update
=
false
)
{
if
(
isset
(
$object
->
gmap_location_latitude
)
&&
isset
(
$object
->
gmap_location_longitude
))
{
if
(
$update
)
{
db_query
(
"UPDATE
{
location
}
SET latitude='%f', longitude='%f', source='%d' WHERE
o
id='%d' AND type='%s'"
,
$object
->
gmap_location_latitude
,
$object
->
gmap_location_longitude
,
1
,
$object
->
o
id
,
$type
);
db_query
(
"UPDATE
{
location
}
SET latitude='%f', longitude='%f', source='%d' WHERE
e
id='%d' AND type='%s'"
,
$object
->
gmap_location_latitude
,
$object
->
gmap_location_longitude
,
1
,
$object
->
e
id
,
$type
);
}
else
{
// based on location.module LOCATION_LATLON_USER_SUBMITTED=1
db_query
(
"INSERT INTO
{
location
}
(
o
id, type, latitude, longitude, source) VALUES (%d, '%s', '%f', '%f', '%d')"
,
$object
->
o
id
,
$type
,
$object
->
gmap_location_latitude
,
$object
->
gmap_location_longitude
,
1
);
db_query
(
"INSERT INTO
{
location
}
(
e
id, type, latitude, longitude, source) VALUES (%d, '%s', '%f', '%f', '%d')"
,
$object
->
e
id
,
$type
,
$object
->
gmap_location_latitude
,
$object
->
gmap_location_longitude
,
1
);
}
unset
(
$object
->
gmap_location_latitude
);
unset
(
$object
->
gmap_location_longitude
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment