コード例 #1
0
 /**
  * Display data
  */
 protected function setDataToCode()
 {
     $showCellForHeartrate = $this->Context->trackdata()->has(Trackdata\Entity::HEARTRATE);
     $showCellForElevation = $this->Context->hasRoute() && $this->Context->route()->hasElevations();
     $this->Code .= '<table class="fullwidth zebra-style">';
     $this->Code .= '<thead><tr>';
     $this->Code .= '<th>' . __('Distance') . '</th>';
     $this->Code .= '<th>' . __('Time') . '</th>';
     $this->Code .= '<th>' . __('Pace') . '</th>';
     if ($showCellForHeartrate) {
         $this->Code .= '<th>' . __('&oslash; bpm') . '</th>';
     }
     if ($showCellForElevation) {
         $this->Code .= '<th>' . __('elev.') . '</th>';
     }
     $this->Code .= '</tr></thead>';
     $this->Code .= '<tbody>';
     $unit = $this->Context->sport()->paceUnit();
     foreach ($this->Laps->objects() as $Lap) {
         $Lap->pace()->setUnit($unit);
         $this->Code .= '<tr class="r">';
         $this->Code .= '<td>' . $Lap->trackDistance()->string() . '</td>';
         $this->Code .= '<td>' . $Lap->trackDuration()->string() . '</td>';
         $this->Code .= '<td>' . $Lap->pace()->value() . '<small>' . $Lap->pace()->appendix() . '</small></td>';
         if ($showCellForHeartrate) {
             $this->Code .= '<td>' . $Lap->HRavg()->inBPM() . '<small>bpm</small></td>';
         }
         if ($showCellForElevation) {
             $this->Code .= '<td class="c">+' . Elevation::format($Lap->elevationUp(), false) . '/-' . Elevation::format($Lap->elevationDown(), false) . '</td>';
         }
         $this->Code .= '</tr>';
     }
     $this->Code .= '</tbody>';
     $this->Code .= '</table>';
 }
コード例 #2
0
ファイル: ElevationUpDown.php プロジェクト: guancio/Runalyze
 /**
  * Constructor
  * @param \Runalyze\View\Activity\Context $Context
  */
 public function __construct(\Runalyze\View\Activity\Context $Context)
 {
     if ($Context->hasRoute()) {
         $upDown = '+' . ElevationBase::format($Context->route()->elevationUp(), false) . '/-' . ElevationBase::format($Context->route()->elevationDown(), false);
     } else {
         $upDown = '+' . ElevationBase::format($Context->activity()->elevation(), false) . '/-' . ElevationBase::format($Context->activity()->elevation(), false);
     }
     parent::__construct($upDown, Configuration::General()->distanceUnitSystem()->elevationUnit(), __('Elevation up/down'));
 }
コード例 #3
0
ファイル: Table.php プロジェクト: guancio/Runalyze
 /**
  * @param int $i
  * @return string
  */
 protected function tableRowFor($i)
 {
     $Lap = $this->Laps->at($i);
     $Lap->pace()->setUnit($this->DemandedPace->unit());
     return '<tr class="c ' . ($Lap->isActive() ? '' : 'unimportant') . '">' . '<td class="small">' . ($Lap->isActive() ? $this->IndexActive++ . '.' : '(' . $this->IndexResting++ . '.)') . '</td>' . '<td>' . ($Lap->hasTrackValues() ? $Lap->trackDistance()->string() : '-') . '</td>' . '<td>' . ($Lap->hasTrackValues() ? $Lap->trackDuration()->string() : '-') . '</td>' . '<td>' . $Lap->distance()->string() . '</td>' . '<td>' . $Lap->duration()->string() . '</td>' . ($this->DemandedTime->isZero() ? '' : '<td>' . $Lap->duration()->compareTo($this->DemandedTime, true) . '</td>') . '<td>' . $Lap->pace()->valueWithAppendix() . '</td>' . ($this->DemandedPace->isEmpty() ? '' : '<td>' . $Lap->pace()->compareTo($this->DemandedPace) . '</td>') . '<td>' . ($Lap->hasHR() ? Helper::Unknown($Lap->HRavg()->string(), '-') : '-') . '</td>' . '<td>' . ($Lap->hasHR() ? Helper::Unknown($Lap->HRmax()->string(), '-') : '-') . '</td>' . '<td>' . ($Lap->hasElevation() ? '+' . Elevation::format($Lap->elevationUp(), false) . '/-' . Elevation::format($Lap->elevationDown(), false) : '-') . '</td>' . $this->additionalTableCellsFor($Lap) . '</tr>';
 }
コード例 #4
0
 /**
  * Display the table with summed data for every month
  */
 private function displayData()
 {
     echo '<table class="analysis-table fullwidth zebra-style r">';
     echo '<thead>' . HTML::monthTr(8, 1) . '</thead>';
     echo '<tbody>';
     if (empty($this->KmData)) {
         echo '<tr><td colspan="13" class="c"><em>' . __('No activities found.') . '</em></td></tr>';
     }
     foreach ($this->KmData as $y => $Data) {
         echo '<tr><td class="b l">' . $y . '</td>';
         for ($m = 1; $m <= 12; $m++) {
             if (isset($Data[$m])) {
                 if ($this->dat == 'km') {
                     echo '<td title="' . Distance::format($Data[$m]['distance']) . '">' . Distance::format($Data[$m]['distance']) . $this->getCircleFor(100 * $Data[$m]['distance'] / $this->maxKm) . '</td>';
                     //echo '<td style="vertical-align: bottom;">' . $tooltip . $circle . '</td>';
                 } else {
                     if ($this->dat == 's') {
                         echo '<td title="' . $Data[$m]['s'] . '">' . Duration::format($Data[$m]['s']) . $this->getCircleFor(100 * $Data[$m]['s'] / $this->maxs) . '</td>';
                     } else {
                         if ($this->dat == 'em') {
                             echo '<td title="' . Elevation::format($Data[$m]['elevation']) . '">' . Elevation::format($Data[$m]['elevation']) . $this->getCircleFor(100 * $Data[$m]['elevation'] / $this->maxEm) . '</td>';
                         } else {
                             if ($this->dat == 'kcal') {
                                 echo '<td title="' . $Data[$m]['kcal'] . ' kcal">' . $Data[$m]['kcal'] . ' kcal' . $this->getCircleFor(100 * $Data[$m]['kcal'] / $this->maxKcal) . '</td>';
                             } else {
                                 if ($this->dat == 'trimp') {
                                     echo '<td title="' . $Data[$m]['trimp'] . '">' . $Data[$m]['trimp'] . $this->getCircleFor(100 * $Data[$m]['trimp'] / $this->maxTrimp) . '</td>';
                                 } else {
                                     if ($this->dat == 'n') {
                                         echo '<td title="' . $Data[$m]['n'] . '">' . $Data[$m]['n'] . $this->getCircleFor(100 * $Data[$m]['n'] / $this->maxN) . '</td>';
                                     }
                                 }
                             }
                         }
                     }
                 }
             } else {
                 echo HTML::emptyTD();
             }
         }
         echo '</tr>';
     }
     echo '</tbody></table>';
 }
コード例 #5
0
ファイル: class.VDOTinfo.php プロジェクト: guancio/Runalyze
    /**
     * Display with corrector
     */
    protected function displayWithElevation()
    {
        if ($this->Context->hasRoute() && ($this->Context->route()->elevationUp() > 0 || $this->Context->route()->elevationDown())) {
            $up = $this->Context->route()->elevationUp();
            $down = $this->Context->route()->elevationDown();
        } else {
            $up = $this->Context->activity()->elevation();
            $down = $up;
        }
        $Modifier = new Calculation\Elevation\DistanceModifier($this->Context->activity()->distance(), $up, $down, Configuration::Vdot());
        $VDOT = new JD\VDOT(0, new JD\VDOTCorrector(Configuration::Data()->vdotFactor()));
        $VDOT->fromPaceAndHR($Modifier->correctedDistance(), $this->Context->activity()->duration(), $this->Context->activity()->hrAvg() / Configuration::Data()->HRmax());
        $Fieldset = new FormularFieldset(__('Correction: considering elevation'));
        $Fieldset->setHtmlCode('
			<p class="warning small ' . (Configuration::Vdot()->useElevationCorrection() ? 'hide' : '') . '">
				' . __('This correction method is currently unused.') . '
			</p>

			<div class="w50">
				<label>' . __('Up/Down') . '</label>
				<span class="as-input">+' . Elevation::format($up, false) . '/-' . Elevation::format($down, true) . '</span>
			</div>
			<div class="w50 double-height-right">
				<label>&rArr; ' . __('VDOT') . '</label>
				<span class="as-input ' . (!Configuration::Vdot()->useElevationCorrection() ? '' : 'highlight') . '">' . $VDOT->value() . '</span>
			</div>
			<div class="w50">
				<label>' . __('Influence') . '</label>
				<span class="as-input">' . Distance::format($Modifier->additionalDistance(), true, 3) . ' =&gt; ' . Distance::format($Modifier->correctedDistance(), true, 3) . '</span>
			</div>
		');
        $Fieldset->display();
    }
コード例 #6
0
    /**
     * Display the table for routes with procentual highest elevation
     */
    private function displayUpwardData()
    {
        echo '<table style="width:48%;" style="margin:0 5px;" class="right zebra-style">';
        echo '<thead><tr class="b c"><th colspan="4">' . __('Steepest routes') . '</th></tr></thead>';
        echo '<tbody>';
        if (empty($this->UpwardData)) {
            echo '<tr><td colspan="4"><em>' . __('No routes found.') . '</em></td></tr>';
        }
        foreach ($this->UpwardData as $Data) {
            $Activity = new Activity\Entity($Data);
            $Linker = new Linker($Activity);
            echo '<tr>
				<td class="small">' . $Linker->weekLink() . '</td>
				<td>' . $Linker->linkWithSportIcon() . '</td>
				<td>' . $this->labelFor($Data['route'], $Data['comment']) . '</td>
				<td class="r">
					' . round($Data['gradient'] / 10, 2) . '&nbsp;&#37;<br>
					<small>' . Elevation::format($Data['elevation']) . ',&nbsp;' . Distance::format($Data['distance']) . '</small>
				</td>
			</tr>';
        }
        echo '</tbody></table>';
    }
コード例 #7
0
ファイル: class.ElevationInfo.php プロジェクト: 9x/Runalyze
 /**
  * Get different algorithms for
  * @param array $array
  * @return string
  */
 protected function getDifferentAlgorithmsFor($array)
 {
     $Method = new ElevationMethod();
     $Calculator = new Data\Elevation\Calculation\Calculator($array);
     $TresholdRange = range(1, 10);
     $Algorithms = array(array(ElevationMethod::NONE, false), array(ElevationMethod::THRESHOLD, true), array(ElevationMethod::DOUGLAS_PEUCKER, true));
     $Code = '<table class="fullwidth zebra-style small">';
     $Code .= '<thead>';
     $Code .= '<tr><th class="r">' . __('Threshold') . ':</th>';
     foreach ($TresholdRange as $t) {
         $Code .= '<th>' . $t . '</th>';
     }
     $Code .= '</tr>';
     $Code .= '</thead>';
     $Code .= '<tbody>';
     foreach ($Algorithms as $Algorithm) {
         $Method->set($Algorithm[0]);
         $Calculator->setMethod($Method);
         $Code .= '<tr><td class="b">' . $Method->valueAsLongString() . '</td>';
         if ($Algorithm[1]) {
             foreach ($TresholdRange as $t) {
                 $highlight = Configuration::ActivityView()->elevationMinDiff() == $t && Configuration::ActivityView()->elevationMethod()->value() == $Algorithm[0] ? ' highlight' : '';
                 $Calculator->setThreshold($t);
                 $Calculator->calculate();
                 $Code .= '<td class="r' . $highlight . '">' . Elevation::format($Calculator->totalElevation()) . '</td>';
             }
         } else {
             $Calculator->calculate();
             $Code .= '<td class="c' . (Configuration::ActivityView()->elevationMethod()->value() == $Algorithm[0] ? ' highlight' : '') . '" colspan="' . count($TresholdRange) . '">' . Elevation::format($Calculator->totalElevation()) . '</td>';
         }
         $Code .= '</tr>';
     }
     $Code .= '</tbody>';
     $Code .= '</table>';
     return $Code;
 }
コード例 #8
0
ファイル: ElevationTest.php プロジェクト: 9x/Runalyze
 public function testStaticMethod()
 {
     Configuration::General()->distanceUnitSystem()->set(DistanceUnitSystem::METRIC);
     $this->assertEquals('123', Elevation::format(123, false));
 }