예제 #1
0
<?php

// LILLA RUTTKARTAN PÅ "PLANERAD RUTT"
require_once $_SERVER["DOCUMENT_ROOT"] . "/php/init.php";
//Security::demand(USER);
error_reporting(0);
if (isset($_GET["medlem"])) {
    $medlem = Medlem::loadById($_GET["medlem"]);
} else {
    $medlem = $USER;
}
$rutt = new Rutt($medlem);
$rutten = $rutt->getRutt();
$sista = $rutt->getCurrentIndex();
$just_nu_id = $medlem->getJustNuKommunId();
$just_nu_kommun = Kommun::loadById($just_nu_id);
$exclude[] = $just_nu_kommun->getKod();
$kommuntext = array();
$c = 0;
while (list($key, $stracka) = each($rutten)) {
    $c++;
    $key = $stracka["Kommun"]->getKod();
    $kommuntext[$key] = $kommuntext[$key] ? $kommuntext[$key] . ",{$c}" : $c;
}
reset($rutten);
?>
<map animation='1' showShadow='1' mapLeftMargin='0' mapRightMargin='0' mapBottomMargin='0'  maptopMargin='0' showBevel='0' showCanvasBorder='0'  showMarkerLabels='1' fillColor='F1f1f1' borderColor='CCCCCC' baseFont='Arial Narrow' baseFontSize='10' markerBorderColor='000000' markerBgColor='FF5904' markerRadius='6' legendPosition='bottom' useHoverColor='0' hoverColor='FF0000' showMarkerToolTip='1'  markerFontColor='FF5904' connectorColor='FF0000' showLabels='0'  includeValueInLabels='1' BorderColor='0372AB' showToolTip='1' waterBodyColor='00CCFF' waterBodyAlpha='50' >
	<data>
		<entity id= '<?php 
echo $just_nu_kommun->getKod();
?>
예제 #2
0
파일: Medlem.php 프로젝트: krillo/motiomera
 public function removeStaticRouteForUser($id, $completed = false)
 {
     if ($id == $this->getId()) {
         // check if international challenge
         $currentKommun = $this->getCurrentKommun();
         $ruttObj = new Rutt($this);
         $rutt = $ruttObj->getRutt();
         $curPos = false;
         $lastNonAbroad = false;
         foreach ($rutt as $id => $stracka) {
             $kommun = $stracka["Kommun"];
             $thisKm = $stracka["ThisKm"];
             $stracka_id = $stracka["id"];
             if ($curPos === false) {
                 // if this isn't the current kommun, and it's not abroad, we'll save it as the lastNonAbroad kommun
                 if ($kommun->getAbroad() == "false") {
                     $lastNonAbroad = $kommun;
                 }
             }
             if ($id == $ruttObj->getCurrentIndex()) {
                 // we're now at the current kommun
                 $curPos = true;
                 if ($kommun->getAbroad() == "false" || $thisKm > 0) {
                     // if it's not abroad, and not just a "jump to" kommun
                     if (!$completed) {
                         $stracka = Stracka::loadById($stracka_id);
                         $stracka->setStatic(0);
                         $stracka->commit();
                     }
                     continue;
                 }
             } elseif (!$curPos) {
                 // we haven't reached the current kommun yet
                 if (!$curPos && $stracka["fastRutt"] == 1) {
                     // this is part of the ended static route, and so it will be changed to non-static...
                     if (!$completed) {
                         // ...if it's not a completed static route
                         $stracka = Stracka::loadById($stracka_id);
                         $stracka->setStatic(0);
                         $stracka->commit();
                     }
                 } elseif ($stracka["fastRutt"] == 1 && !$completed) {
                     // if this static route isn't completed, it's changed to non-static
                     $stracka = Stracka::loadById($stracka_id);
                     $stracka->setStatic(0);
                     $stracka->commit();
                 } else {
                     // this looks a bit weird, it's here for historic reasons
                 }
                 continue;
             }
             $kommun = $stracka["Kommun"];
             $stracka = Stracka::loadById($stracka_id);
             $stracka->delete();
         }
         if ($lastNonAbroad != false && $this->getCurrentKommun()->getId() != $lastNonAbroad->getId()) {
             $strackaObj = new Stracka($lastNonAbroad, $this);
             $strackaObj->setTempStatus(false);
             $strackaObj->commit();
         }
         $this->setUserOnStaticRoute('false');
         $this->setFastRuttId(0);
         $this->commit();
     }
 }
예제 #3
0
    $USER->cleanTempStrackor();
}
$tabs = new TabBox("rapport", 590, null);
$medlem = !empty($_GET["id"]) ? Medlem::loadById($_GET["id"]) : $USER;
$smarty->assign("medlem", $medlem);
$tabs->addTab("Rutt", "rutt");
$tabs->addTab("Steg", "detaljerat");
if (isset($_GET["tab"])) {
    $tabs->setSelected($_GET["tab"]);
}
$smarty->assign("tabs", $tabs);
$stegtotal = $medlem->getStegTotal();
$kmTotal = Steg::stegToKm($stegtotal);
// Kommunjakt
$rutt = new Rutt($medlem);
$rutten = $rutt->getRutt();
$currentKommun = $medlem->getCurrentKommun();
$kommunnamn = Kommun::listNamn(true);
$rutter = $rutt->getRutt();
foreach ($rutter as $index => $temprutt) {
    $totalKm = $temprutt["TotalKm"];
}
if (empty($totalKm)) {
    $totalKm = 0;
}
$totalKmKvar = $totalKm - $kmTotal;
$smarty->assign("totalKmKvar", $totalKmKvar);
$dagar7000 = ceil($totalKmKvar / 7);
$dagar11000 = ceil($totalKmKvar / 11);
$smarty->assign("dagar7000", $dagar7000);
$smarty->assign("dagar11000", $dagar11000);
예제 #4
0
<?php

require_once $_SERVER["DOCUMENT_ROOT"] . "/php/init.php";
Security::demand(USER);
$smarty = new MMSmarty();
$smarty->assign("pagetitle", "Väkommen till en ny kommun");
$rutt = new Rutt($USER);
$rutter = $rutt->getRutt();
/*if(isset($rutter[$rutt->getCurrentIndex()+1]))
	$urlHandler->redirect("Medlem", URL_VIEW_OWN);
*/
$kommun = $rutt->getCurrentKommun();
$smarty->assign("kommun", $kommun);
$kommunvapen = $kommun->getKommunvapen();
$smarty->assign("kommunvapen", $kommunvapen);
$kommunbilder = $kommun->listKommunbilder();
$kommunbild = current($kommunbilder);
$smarty->assign("kommunbilder", $kommunbild);
$smarty->display('nykommun.tpl');