Well I've made a litle progress with this, Thought i'd put up what I have got so far, if nothing else to keep a record of what I've changed, my memory isn't great.
As suggested I've made a second table to hold the places of interest:
Code: Select all
CREATE TABLE `phpbb_phoogle_poi` (
`user_id` mediumint(8) NOT NULL,
`username` varchar(25) NOT NULL,
`user_phoogle_map_center` varchar(255) NOT NULL,
`user_phoogle_comment` TEXT,
`user_phoogle_icon` tinyint(3) unsigned NOT NULL default '1',
`user_phoogle_allow` tinyint(1) unsigned NOT NULL default '1',
`user_phoogle_show_me` tinyint(1) unsigned NOT NULL default '0',
`group_id mediumint`(8) DEFAULT '0' NOT NULL,
`user_level tinyint(4) DEFAULT '0',
`user_allowavatar tinyint(1) DEFAULT '1' NOT NULL,
`user_avatar_type tinyint(4) DEFAULT '0' NOT NULL,
`user_rank int(11) DEFAULT '0',
`user_avatar varchar(100),
PRIMARY KEY (`user_phoogle_map_center`)
);
I added a test place of interest to this new table via phpMyAdmin then set about trying to get phooglemap to call the POI's from both the Users table and this new POI table:
Code: Select all
#
#-----[ OPEN ]------------------------------------------
#
phoogle_map.php
#
#-----[ FIND ]------------------------------------------
#
// sql for members with map points set in the selected user group
$sql_all_members = "SELECT ug.user_id, ug.group_id, u.username, u.user_level, u.user_rank, u.user_avatar_type, u.user_allowavatar, u.user_avatar, u.user_phoogle_map_center, u.user_phoogle_comment, u.user_phoogle_icon, u.user_phoogle_show_me
FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug
WHERE ug.group_id = $group_id AND
u.user_id = ug.user_id AND
u.user_phoogle_allow = 1 AND
u.user_phoogle_show_me = 1
ORDER BY u.username";
#
#-----[ REPLACE WITH ]------------------------------------------
#
// sql for members with map points set in the selected user group
$sql_all_members = "SELECT ug.user_id, ug.group_id, u.username, u.user_level, u.user_rank, u.user_avatar_type, u.user_allowavatar, u.user_avatar, u.user_phoogle_map_center, u.user_phoogle_comment, u.user_phoogle_icon, u.user_phoogle_show_me
FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug
WHERE ug.group_id = $group_id AND
u.user_id = ug.user_id AND
u.user_phoogle_allow = 1 AND
u.user_phoogle_show_me = 1
UNION
SELECT user_id, group_id, username, user_level, user_rank, user_avatar_type, user_allowavatar, user_avatar, user_phoogle_map_center, user_phoogle_comment, user_phoogle_icon, user_phoogle_show_me
FROM " . PHPBB_PHOOGLE_POI . "
WHERE group_id = $group_id AND
user_phoogle_allow = 1 AND
user_phoogle_show_me = 1
ORDER BY username";
#
#-----[ FIND ]------------------------------------------
#
// Regular sql for members with map points set - used for 'Show All Users' map and for sidebar list
$sql_all_members = "SELECT user_id, username, user_level, user_rank, user_avatar_type, user_allowavatar, user_avatar, user_phoogle_map_center, user_phoogle_comment, user_phoogle_icon, user_phoogle_show_me
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS ." AND
user_phoogle_allow = 1 AND
user_phoogle_show_me = 1
ORDER BY username
LIMIT $start, $show";
#
#-----[ REPLACE WITH ]------------------------------------------
#
// Regular sql for members with map points set - used for 'Show All Users' map and for sidebar list
$sql_all_members = "SELECT user_id, username, user_phoogle_map_center, user_phoogle_comment, user_phoogle_icon, user_phoogle_show_me, user_level
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS ." AND
user_phoogle_allow = 1 AND
user_phoogle_show_me = 1
UNION
SELECT user_id, username, user_phoogle_map_center, user_phoogle_comment, user_phoogle_icon, user_phoogle_show_me, user_level
FROM " . PHPBB_PHOOGLE_POI . "
WHERE user_id <> " . ANONYMOUS ." AND
user_phoogle_allow = 1 AND
user_phoogle_show_me = 1
ORDER BY username
LIMIT $start, $show";
#
#-----[ EOM ]------------------------------------------
#
That code seems to work in recalling locations from both the tables, it probably isn't how it should be done, infact it's probably a very poor way to do it (but knowing only VERY basic SQL and PHP and seemed to be the only way I could get it to work, I'm not clever enough to work out a better way
)
I haven't yet tried to get the User search working with both tables.
Now I need to be able to toggle the custom POI's (from the new table)
After a few hours of playing I somehow stumbled upon this:
Code: Select all
#
#-----[ OPEN ]------------------------------------------
#
phooglemap.php
#
#-----[ FIND ]------------------------------------------
#
// Added marker type for Show/Hide groups feature.
switch($user_level)
{
case ADMIN:
$user_phoogle_icon = ($use_special_markers == 1) ? '11' : $members['user_phoogle_icon'];
$marker_group = 'admin';
break;
case MOD:
$user_phoogle_icon = ($use_special_markers == 1) ? '12' : $members['user_phoogle_icon'];
$marker_group = 'moderator';
break;
default:
$user_phoogle_icon = $members['user_phoogle_icon'];
$marker_group = 'user';
}
#
#-----[ REPLACE WITH ]------------------------------------------
#
// Added marker type for Show/Hide groups feature.
switch($user_level)
{
case ADMIN:
$user_phoogle_icon = ($use_special_markers == 1) ? '11' : $members['user_phoogle_icon'];
$marker_group = 'admin';
break;
case MOD:
$user_phoogle_icon = ($use_special_markers == 1) ? '12' : $members['user_phoogle_icon'];
$marker_group = 'moderator';
break;
case USER:
$user_phoogle_icon = $members['user_phoogle_icon'];
$marker_group = 'user';
break;
default:
$user_phoogle_icon =($use_special_markers == 1) ? '9' : $profiledata['user_phoogle_icon'];
$marker_group = 'fisheries';
}
#
#-----[ OPEN ]------------------------------------------
#
phoogle_map.tpl
#
#-----[FIND ]------------------------------------------
#
<label>
<input name="show_user" type="checkbox" onclick="toggleGroup('user');" checked />Users</label>
#
#-----[AFTER ADD]------------------------------------------
#
<label>
<input name="show_user" type="checkbox" onclick="toggleGroup('CUSTOM POI's');" checked />CUSTOM POI's</label>
#
#-----[EOM]------------------------------------------
#
So Far that is all I have, I hope I have put all the changes Ive made so far, but having spent so much time changing a bit then testing it before chaning it again I could have missed a bit here by accident, don't think I have but sorry just in case I have
Obviously this is far from a solution to adding custom markers that you can link directly too (as I havent even looked at linking to the custom POI's from the new table yet) but its a start.
The one thing I could do with some advice on, as I've been trying to work it out but can't:
1. How to hide the Admin's markers by default but when you click on the Show Admin box they appear rather than them being on by default and having to click to hide them.