Location: PHPKode > projects > injooosm > components/com_injooosm/views/files/tmpl/file.php
<?php
/**
 * Joomla! 1.5 component injooosm
 *
 * @version $Id: file.php 2010-02-09 12:32:00$
 * @author Christian Knorr
 * @package injooosm
 * @subpackage frontend
 * @license GNU/GPL
 * @filesource
 *
 *
 */

// no direct access
defined('_JEXEC') or die('Restricted access');
echo $this->lh;

if ($this->maySeeSingleFile($this)) {
    echo $this->map;
    ?>
    <script language="javascript" type="text/javascript">

    function submitbutton(pressbutton)
    {
            var form = document.adminForm;


        // do field validation
            if (document.getElementById('format').value == ""){
                    alert( "<?php echo JText::_( 'OSM_NEED_FORMAT', true ); ?>" );
        } else {
            submitform( pressbutton);
            }
    }


    function startGallery() {
            var myGallery = new gallery($('myGallery'), {
                    timed: true,
                    showArrows: true,
                    embedLinks: false,
                    showCarousel: false
            });
    }
    window.addEvent('domready',startGallery);

    </script>
    <script type="text/javascript">
    dojo.require("dojox.charting.Chart2D");
    dojo.require("dojox.charting.widget.Legend");
<?php
if ( ($this->track->ele_asc != 0) AND ($this->track->ele_desc != 0)) {
?>
    makeCharts = function(){
        var hb = '<?php echo JText::_('OSM_HEARTFREQU'); ?>';
        var ele = '<?php echo JText::_('OSM_ELEVATION'); ?>';
        var chart1 = new dojox.charting.Chart2D("elevation");
        chart1.addPlot("default", {type: "Lines", hAxis: "x", vAxis: "y", markers: false, tension:4, shadows: {dx: 2, dy: 2, dw: 2}});
        chart1.addAxis("x", {leftBottom: true, majorLabels: false, minorLabels: true, majorTickStep: 100});
        chart1.addAxis("y", {vertical: true, fixUpper: "major", includeZero: false, majorTickStep: 200, fontColor:"#<?php echo $this->cfg->charts_linec; ?>"});
        chart1.addPlot("other", {type: "Lines", hAxis: "x", vAxis: "other y"});
        chart1.addAxis("other y", {vertical: true, leftBottom: false, fontColor:"#<?php echo $this->cfg->charts_bg; ?>"});
        chart1.addSeries(ele, [<?php echo $this->chart; ?>],
            {plot: "default", stroke: {color:"#<?php echo $this->cfg->charts_linec; ?>"}}
        );
        chart1.addSeries(hb, [<?php echo $this->beat; ?>],
            {plot:"other", stroke: {color:"#<?php echo $this->cfg->charts_bg; ?>"}}
        );
        chart1.render();
        var legend1 = new dojox.charting.widget.Legend({chart: chart1, horizontal: true}, "legend1");
        legend1.chart=chart1;
    };

    dojo.addOnLoad(makeCharts);
<?php
$nohight = false;
} else $nohight = true;
if ( ( isset($this->track->istrack) ) AND ( $this->track->istrack == "1" ) ) {
if ( $this->speed !== false ) {
?>
    makeSpeedChart = function(){
        <?php echo ("var speedchart = '".JText::_('OSM_SPEED_'.strtoupper($this->cfg->unit))."';\n"); ?>
        var chart2 = new dojox.charting.Chart2D("speedchart");
        chart2.addPlot("default", {type: "Lines", hAxis: "x", vAxis: "y", markers: false, tension:4, shadows: {dx: 2, dy: 2, dw: 2}});
        chart2.addAxis("x", {leftBottom: true, majorLabels: false, minorLabels: true, majorTickStep: 100});
        chart2.addAxis("y", {vertical: true, fixUpper: "major", includeZero: false, majorTickStep: 10, fontColor:"#<?php echo $this->cfg->charts_linec; ?>"});
        chart2.addPlot("other", {type: "Lines", hAxis: "x", vAxis: "other y"});
        chart2.addAxis("other y", {vertical: true, leftBottom: false, fontColor:"#<?php echo $this->cfg->charts_bg; ?>"});
        chart2.addSeries(speedchart, [<?php echo $this->speed; ?>],
            {plot: "default", stroke: {color:"#<?php echo $this->cfg->charts_linec; ?>"}}
        );
        chart2.render();
        var legend2 = new dojox.charting.widget.Legend({chart: chart2, horizontal: true}, "legend2");
        legend2.chart=chart2;
    };

    dojo.addOnLoad(makeSpeedChart);
<?php
}
} else $this->speed = false;
?>
    </script>
    <div class="tracktitle"><?php echo $this->track->title; ?></div>
    <center><div id="map" style="width: <?php echo $this->cfg->map_width; ?>px; height: <?php echo $this->cfg->map_height; ?>px; margin-bottom:20px;" ></div><?php

?><br />
    </center>
    <div>
<?php
/*
// ToDo: inspect GET['subid'] to give the ability single tracks are shown
if ( $this->clicklist !== false ) {
	$return = ("<div><ul>\n");
	foreach ($this->clicklist AS $value => $key ) {
		$return .= ("<li><a href=\"".$key['link']."\">".JText::_('OSM_TRACK').$value.": ".$key['name']."</a></li>\n");
	}
	$return .= ("</ul></div>\n");
	echo $return;
}
*/
?>
    </div>
    <div id="profile" style="width:<?php echo ((int)$this->cfg->charts_width+10); ?>px" >
<?php
if ($nohight == false) {
?>
        <div class="profile-img" id="elevation" style="width:<?php echo $this->cfg->charts_width; ?>px; height: <?php echo $this->cfg->charts_height; ?>px;"></div>
        <div id="legend1" style="width:200px; height:50px;"></div><br /><br />
<?php
}
// else echo "<div class=\"profile-img\" id=\"elevation\" style=\"width:".$this->cfg->charts_width."px; height:20px\">".JText::_('OSM_NO_ELE_INFO')."</div>\n";
if ( $this->speed !== false ) {
?>
        <div class="profile-img" id="speedchart" style="width:<?php echo $this->cfg->charts_width; ?>px; height: <?php echo $this->cfg->charts_height; ?>px;"></div>
        <div id="legend2" style="width:200px; height:50px;"></div>
<?php
}
// else echo "<div class=\"profile-img\" id=\"speedchart\" style=\"width:".$this->cfg->charts_width."px; height:20px\">".JText::_('OSM_NO_SPEED_INFO')."</div>\n";
?>
        <div class="gps-info">
            <table border="0" width="550px" align="center">
                <thead>
                    <tr>
                        <th colspan="3"><?php echo JText::_('OSM_DETAILS'); ?></th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td><?php echo JText::_('OSM_FROM'); ?></td>
                        <td><?php echo $this->profile; ?></td>
                        <td rowspan="8" valign="top">
<?php if ($this->track->distance != "") { ?>
                            <div id="count-box">
                            <div align="center"><span><label for="speed"><?php echo JText::_('OSM_AVG_SPEED'); ?></label><input type="text" name="speed" id="speed" value="" size="4" /></span><input type="button" name="button" class="button" value="Submit" onclick="getAvgTime(document.getElementById('speed').value,<?php echo $this->distance; ?>);" /></div>
                            <div align="center"><span><label for="time"><?php echo JText::_('OSM_ESTIMATED_TIME'); ?></label><input type="text" name="time" id="time" value="" size="9" readonly="readonly" /></span></div>
                            </div>
<?php } ?>
                        </td>
                    </tr>
                    <tr>
                        <td><?php echo JText::_('OSM_DATE'); ?>:</td>
                        <td><?php echo $this->date; ?></td>
                    </tr>
                    <tr>
                        <td><?php echo JText::_('OSM_LEVEL'); ?>:</td>
                        <td><?php echo $this->track->level; ?></td>
                    </tr>
<?php if ($this->track->distance != "") { ?>
                    <tr>
                        <td><?php echo JText::_('OSM_DISTANCE'); ?>:</td>
                        <td><?php echo $this->distance. " " . $this->unit; ?></td>
                    </tr>
<?php } ?>
                    <tr>
                        <td><?php echo JText::_('OSM_ELEVATION'); ?> +:</td>
                        <td><?php echo $this->track->ele_asc; ?> <?php echo JText::_('OSM_METERS'); ?></td>
                    </tr>
                    <tr>
                        <td><?php echo JText::_('OSM_ELEVATION'); ?> -:</td>
                        <td><?php echo $this->track->ele_desc; ?> <?php echo JText::_('OSM_METERS'); ?></td>
                    </tr>
                    <tr>
                        <td><?php echo JText::_('OSM_HITS'); ?>:</td>
                        <td><?php echo $this->track->hits; ?></td>
                    </tr>
                    <tr>
                        <td><?php echo JText::_('OSM_CAT'); ?>:</td>
                        <td><img src="<?php echo JURI::base(); ?>/images/injooosm/cats/<?php echo $this->track->image; ?>" alt="<?php echo $this->track->cat; ?>" title="<?php echo $this->track->cat; ?>" height="32px" /></td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="no-float">
        </div>
    </div>
    <div class="gps-headline"><?php echo JText::_('OSM_VOTING'); ?></div>
    <div class="description">
    <div id="ratingbox">
    <ul id="1001" class="rating <?php echo $this->vote['class']; ?>">
      <li id="1" class="rate one"><a href="index.php?option=com_injooosm&amp;controller=files&amp;task=vote&amp;rate=1&amp;id=<?php echo $this->track->id; ?>" title="1 Star">1</a></li>
      <li id="2" class="rate two"><a href="index.php?option=com_injooosm&amp;controller=files&amp;task=vote&amp;rate=2&amp;id=<?php echo $this->track->id; ?>" title="2 Stars">2</a></li>

      <li id="3" class="rate three"><a href="index.php?option=com_injooosm&amp;controller=files&amp;task=vote&amp;rate=3&amp;id=<?php echo $this->track->id; ?>" title="3 Stars">3</a></li>
      <li id="4" class="rate four"><a href="index.php?option=com_injooosm&amp;controller=files&amp;task=vote&amp;rate=4&amp;id=<?php echo $this->track->id; ?>" title="4 Stars">4</a></li>
      <li id="5" class="rate five"><a href="index.php?option=com_injooosm&amp;controller=files&amp;task=vote&amp;rate=5&amp;id=<?php echo $this->track->id; ?>" title="5 Stars">5</a></li>
      <li id="6" class="rate six"><a href="index.php?option=com_injooosm&amp;controller=files&amp;task=vote&amp;rate=6&amp;id=<?php echo $this->track->id; ?>" title="6 Stars">6</a></li>
      <li id="7" class="rate seven"><a href="index.php?option=com_injooosm&amp;controller=files&amp;task=vote&amp;rate=7&amp;id=<?php echo $this->track->id; ?>" title="7 Stars">7</a></li>
      <li id="8" class="rate eight"><a href="index.php?option=com_injooosm&amp;controller=files&amp;task=vote&amp;rate=8&amp;id=<?php echo $this->track->id; ?>" title="8 Stars">8</a></li>

      <li id="9" class="rate nine"><a href="index.php?option=com_injooosm&amp;controller=files&amp;task=vote&amp;rate=9&amp;id=<?php echo $this->track->id; ?>" title="9 Stars">9</a></li>
      <li id="10" class="rate ten"><a href="index.php?option=com_injooosm&amp;controller=files&amp;task=vote&amp;rate=10&amp;id=<?php echo $this->track->id; ?>" title="10 Stars">10</a></li>
    </ul>
    <div>(<?php echo JText::_('OSM_RATINGS'); ?>&nbsp;<?php echo $this->vote['count']; ?>)</div>
    </div>
    <div id="downloadbox">
        <form name="adminForm" id="adminForm" method="post" action="<?php echo $this->action; ?>">
            <div><b><?php echo JText::_('OSM_DOWNLOAD_FILE'); ?></b></div>
            <span><label for="format"><?php echo JText::_('OSM_FORMAT'); ?>&nbsp;</label>
            <select name="format" id="format">
                    <option value=""><?php echo JText::_('OSM_SELECT'); ?></option>
                    <option value="gpx">GPX</option>
                    <option value="kml">KML</option>
                    <option value="tcx">Garmin (tcx)</option>
            </select>
            <button class="button" type="button" onclick="submitbutton('download')">
                    <?php echo JText::_('Download') ?>
            </button>
            </span>
<?php
        echo JHTML::_( 'form.token' ) . "\n"; ?>
        <input type="hidden" name="option" value="com_injooosm" />
        <input type="hidden" name="id" value="<?php echo $this->track->id; ?>" />
        <input type="hidden" name="task" value="" />
        </form>
    </div>
    <div class="no-float"></div>
    </div>
    <div class="gps-headline"><?php echo JText::_('OSM_TERRAIN'); ?></div>
    <div class="description"><?php echo $this->track->terrain; ?></div>
    <div class="gps-headline"><?php echo JText::_('OSM_DESCRIPTION'); ?></div>
    <div class="description"><?php echo $this->track->description; ?></div>
    <?php
    if($this->images):
    ?>
    <div class="gps-headline"><?php echo JText::_('OSM_GALLERY'); ?></div>
    <div class="galleryContent">
            <div id="myGallery">
<?php
                foreach($this->images as $image)  {
		  $ext = explode('.',$image);
		  $ext = $ext[(count($ext)-1)];
		  $imgtypes = explode(',',$this->cfg->type);
		  if ( in_array($ext,$imgtypes) ) {
                    ?>
                    <div class="imageElement">
                            <h3><?php echo $this->track->title; ?></h3>
                            <p></p>
                            <img src="<?php
echo JURI::base()."images".DS."injooosm".DS.$this->track->id.DS.$image; ?>" class="full" height="0px" />
                    </div>
<?php
                    }
                }
                ?>
            </div>
    </div>
<?php
    endif;
    ?>
    <div class="no-float"></div>
    <div class="gps-headline"><?php echo JText::_('OSM_APPROACH'); ?></div>
    <div class="description"><?php


// die(var_dump($this->model->approach()));
$link = $this->model->approach($this->track->start_n,$this->track->start_e);
$routservices =
array(
	array(
		"img" => "http://data.giub.uni-bonn.de/openrouteservice/img/car_green.png",
		"name" => JText::_('OSM_CAR'),
		array(
			array("Fastest",JText::_('OSM_FASTEST')),
			array("Shortest",JText::_('OSM_SHORTEST'))
		)
	),
	array(
		"img" => "http://data.giub.uni-bonn.de/openrouteservice/img/bike_grey.png",
		"name" => JText::_('OSM_BICYCLE'),
		array(
			array("BicycleSafety",JText::_('OSM_SAVETEST')),
			array("Bicycle",JText::_('OSM_SHORTEST')),
			array("BicycleMTB",JText::_('OSM_MTB')),
			array("BicycleRacer",JText::_('OSM_RACERBIKE'))
		)
	),
	array(
		"img" => "http://data.giub.uni-bonn.de/openrouteservice/img/pedestrian_grey.png",
		"name" => JText::_('OSM_PEDESTRIAN'),
		array(
			array("Pedestrian",JText::_('OSM_SHORTEST'))
		)
	)
);
$userparams = explode("\n",$this->user->params);
if ( count($userparams) != 0 ) {
	foreach ($userparams AS $param) {
		$param = explode("=",$param);
		if ($param[0] == "language")
			$userlang = $param[1][0].$param[1][1];
	}
}
$availablelang = array('de','en','it','fr','es');	// allowed from ORS
if (in_array($userlang,$availablelang))
	$lang = $userlang;
		else
	$lang = "en";
foreach ($routservices AS $shifting) {
	echo "<img src=\"".$shifting['img']."\" alt=\"".$shifting['name']."\" title=\"".$shifting['name']."\"><ul>";
	foreach ($shifting[0] AS $service)
		echo "<li><a href=\"".$link."&amp;zoom=15&amp;pref=".$service[0]."&amp;lang=".$lang."\" target=\"_blank\">".$service[1]."</a></li>\n";
	echo "</ul>\n";
}

echo JText::_('OSM_POWEREDBY').": <a href=\"http://openrouteservice.org\">http://openrouteservice.org</a> (<a href=\"http://wiki.openstreetmap.org/wiki/OpenRouteService\">

".JText::_('OSM_HELP')."

</a>)</div>\n";

    // adding the comments
    if($this->cfg->comments == 1) {
        ?>
        <div class="comments"><?php echo JText::_('OSM_COMMENTS'); ?></div>
<?php
        if(!$this->comments)  {
            echo "<div>".JText::_('OSM_NO_COMMENTS')."</div>";
        } else {
            for($i=0, $n=count($this->comments); $i<$n; $i++) {
                $comment = $this->comments[$i];
                ?>
        <div class='comment'>
        <div class="comment-header"><div class="comment-title"><?php echo ($i+1).": ".$comment->title; ?></div><div class="date"><?php echo JHTML::_('date', $comment->date, JText::_('DATE_FORMAT_LC4'));; ?></div><div class="no-float"></div></div>
        <div class="comment-autor"><?php echo JHTML::_('email.cloak', $comment->email, true,$comment->user,true); ?></div>
        <div class="comment-text"><?php echo $comment->text; ?></div>
        <div class="no-float"></div>
        </div>
<?php
            }
        }
        //
        if($this->cfg->comment_who == 0) {
            echo $this->model->addcomment($this->cfg);
        } elseif ($this->cfg->comment_who == 1 && $this->user->get('id')) {
            echo $this->model->addcomment($this->cfg);
        } else {
            echo JText::_('OSM_ADD_COMMENT_NOT_AUTH');
        }
    } elseif ($this->cfg->comments == 2) {
        require_once( JPATH_PLUGINS . DS . 'content' . DS . 'jom_comment_bot.php' );
        echo jomcomment($this->track->id, "com_injooosm");
    }
?>
<div width="0" height="0" style="display:none">
<!-- Benötigte Bilder schon mal vorladen -->
		<img src="http://www.openlayers.org/api/img/cloud-popup-relative.png" />
		<img src="http://www.openlayers.org/api/img/marker.png" />
</div>
<?php
} else {
 echo '<p class="error">'.JText::_('OSM_NOT_AUTH').'</p>';
}
echo $this->footer;
if ( $this->cfg->map == "osm" )
	echo ("<script language=\"javascript\" type=\"text/javascript\">slippymap_init(\"map\");</script>");
Return current item: injooosm