Location: PHPKode > projects > injooosm > components/com_injooosm/views/injooosm/tmpl/geo.php
<?php
/**
 * Joomla! 1.5 component injooosm
 *
 * @version $Id: geo.php 2010-02-09 21:54:00$
 * @author Christian Knorr
 * @package injooosm
 * @subpackage frontend
 * @license GNU/GPL
 * @filesource
 *
 */
defined('_JEXEC') or die('Restricted access');
$document =& JFactory::getDocument();
$user = JFactory::getUser();
$userid = (int)$user->id;

if ( $userid ) {
	echo ("<script>\n	alerttext='".JText::_('OSM_SET_HOMEPOSITION')."';\n</script>\n");
} else {
	echo ("<script>\n	alerttext='".JText::_('OSM_HOMEPOSITION_GUESTS')."';\n</script>\n");
}
$document->addScript('components'.DS.'com_injooosm'.DS.'assets'.DS.'js'.DS.'homeposition.js');

//JHTML::_('behavior.tooltip'); // with this option IE8 doesn't work
$otherusers = 0;
$scriptbody = "";
$latlon = injooosmHelper::getLatLon();
$scriptheader = ("<script>\n");
if ( $userid )
	$homepos = JText::_('OSM_MY_HOMEPOSITION');
else
	$homepos = "false";
for($x=0;$x<=count($latlon);$x++){
	if ($latlon[$x]->id == $userid) {
		$userlat = $latlon[$x]->osmlat;
		$userlon = $latlon[$x]->osmlon;
		$uservis = $latlon[$x]->osmvisible;	
	} elseif (($latlon[$x]->osmlat) && ($latlon[$x]->osmlon) && ($latlon[$x]->osmvisible)) {
		if ( ( ( $userid ) && ( $latlon[$x]->osmvisible != "non" ) ) || ( ( !$userid ) && ( $latlon[$x]->osmvisible == "all" ) ) ) {
			if (empty($vars)) {
				$vars = (
"	var SizeIconOtherUser = new OpenLayers.Size(24,24);
	var OffsetIconOtherUser = new OpenLayers.Pixel(-11,-14);
	var IconOtherUser = 'components/com_injooosm/assets/images/user.png';
	var MarkerHomePosition = '".$homepos."';
	var inittext = '".JText::_('OSM_HERE_LIVE').": ';
	var username=Array();
	var name=Array();
	var lat=Array();
	var lon=Array();
	var link=Array();
	var id=Array();\n");
			}
			$scriptbody .= "	lat[".
				$otherusers."] = '".$latlon[$x]->osmlat."'; lon[".
				$otherusers."] = '".$latlon[$x]->osmlon."'; username[".
				$otherusers."] = '".$latlon[$x]->username."'; name[".
				$otherusers."] = '".$latlon[$x]->name."'; id[".
				$otherusers."] = '".$latlon[$x]->id."'; link[".
				$otherusers."] = '".getProfileLink($latlon[$x]->id,$latlon[$x]->username)."';\n";
			$otherusers++;
		}
	} elseif (empty($vars)) {
		$scriptbody = "	var MarkerHomePosition = '".$homepos."';\n";
	}
}
$scriptfooter = ("</script>\n");
$scriptbody = "	var otherusers = '".$otherusers."';\n".$scriptbody;
$script = $scriptheader.$vars.$scriptbody.$scriptfooter;

echo $script;
echo ("<div id=\"map\" style=\"width: ".$this->cfg->map_width."px; height: ".$this->cfg->map_height."px;\" ></div>
<div id=\"otheruser\" style=\"width: ".$this->cfg->map_width."px;\" >".JText::_('OSM_HERE_LIVE_DESC')."</div>\n");
if ( $userid ) {
?><form action="<?php echo JRoute::_($this->action); ?>" method="post" name="adminForm" id="adminForm">
	<table>
		<tr>
			<td><?php
echo JText::_('OSM_LAT');
if ( $userlat ) $lat = round($userlat,15); else $lat = "";
if ( $userlon ) $lon = round($userlon,15); else $lon = "";
?></td>
			<td><input type="input" size="15" class="output" name="lat" id="lat" value="<?php
echo $lat; ?>" onchange="handleFillLL();mapcenter();"></input><?php
echo JText::_('OSM_LAT_U');
echo "</td>\n			<td>";
echo JHTML::tooltip(JText::_('OSM_TT_LAT'), JText::_('OSM_TT_HEADER'),'tooltip.png');?></td>
		</tr>
		<tr>
			<td><?php
echo JText::_('OSM_LON');
?></td>
			<td><input type="input" size="15" class="output" name="lon" id="lon" value="<?php
echo $lon; ?>" onchange="handleFillLL();mapcenter();"></input><?php
echo JText::_('OSM_LON_U');
echo "</td>\n			<td>";
echo JHTML::tooltip(JText::_('OSM_TT_LON'), JText::_('OSM_TT_HEADER'),'tooltip.png');?></td>
		</tr>
		<tr>
			<td><?php echo JText::_('OSM_VISIBLE'); ?>
			</td>
			<td>
				<select name="visible" id="visible" size="3">
<?php
// selected="selected"
$snon = "";
$sreg = "";
$sall = "";

if ( $uservis == "non" )
	$snon = " selected=\"selected\"";
elseif ( $uservis == "reg" )
	$sreg = " selected=\"selected\"";
else
	$sall = " selected=\"selected\"";
echo "					<option value=\"all\"".$sall.">".JText::_('OSM_VISIBLE_ALL')."</option>
					<option value=\"reg\"".$sreg.">".JText::_('OSM_VISIBLE_REG')."</option>
					<option value=\"non\"".$snon.">".JText::_('OSM_VISIBLE_NONE')."</option>
				</select>
";
?>			</td>
		</tr>
	</table>
	<?php
echo JHTML::_( 'form.token' ) . "\n"; ?>
	<input type="hidden" name="option" value="com_injooosm" />
	<input type="hidden" name="controller" value="geo" />
	<input type="hidden" name="task" value="" />
<?php
if(isset($this->id)) echo '	<input type="hidden" name="id" value="'.$this->id.'" />';
?>
	<input type="submit" name="Submit" class="button" value="<?php echo JText::_('SAVE') ?>" onclick="submitbutton('save')" />
</form>
<?php } else { ?>
	<input type="hidden" name="lat" id="lat" value=""></input>
	<input type="hidden" name="lon" id="lon" value=""></input>
<?php } ?>
<script>init();</script>
<div class="no-float"><?php
//echo $this->disclaimericons;
echo $this->footer;
echo "</div>";
Return current item: injooosm