Beispiel #1
0
if ($Plugin->Configuration()->value('use_weight')) {
    $Plot->Data[] = array('label' => __('Weight'), 'color' => '#008', 'data' => $Weights);
}
if ($Plugin->Configuration()->value('use_pulse')) {
    $Plot->Data[] = array('label' => __('Resting HR'), 'color' => '#800', 'data' => $HRrests, 'yaxis' => 2);
}
$Plot->setMarginForGrid(5);
$Plot->setXLabels($Labels);
$Plot->setXAxisTimeFormat('%m/%y');
$Plot->setXAxisMaxToToday();
$Plot->Options['xaxis']['labelWidth'] = 50;
//$Plot->Options['xaxis']['tickLength'] = 3;
$Plot->Options['series']['curvedLines']['fit'] = true;
$Plot->PlotOptions['allowSelection'] = false;
$Plot->addYAxis(1, 'left');
$Plot->addYUnit(1, $Weight->unit(), 1);
$Plot->setYTicks(1, 2, 0);
$Plot->addYAxis(2, 'right', false);
$Plot->addYUnit(2, 'bpm', 0);
$Plot->setYTicks(2, 1, 0);
if ($Wunschgewicht > 1) {
    $Plot->addThreshold('y1', $Wunschgewicht);
    $Plot->addMarkingArea('y1', $Wunschgewicht, 0);
}
if (empty($Data)) {
    $Plot->raiseError(__('No data available.'));
} elseif (min(min($Weights), min($HRrests)) == 0 || count($Weights) <= 1) {
    $Plot->setZeroPointsToNull();
    $Plot->lineWithPoints();
    $Plot->Options['series']['curvedLines']['apply'] = false;
}
			<tr>
				<td><?php 
        echo RunalyzePluginPanel_Sportler::getDeleteLinkFor($Info['id']);
        ?>
</td>
				<td><?php 
        echo RunalyzePluginPanel_Sportler::getEditLinkFor($Info['id']);
        ?>
</td>
			<?php 
        foreach ($Fields as $Key => $Unit) {
            ?>
				<?php 
            if ($Key == 'weight') {
                $Weight = new Weight($Info[$Key]);
                $Info[$Key] = $Weight->string(false) . ' <small>' . $Weight->unit() . '</small>';
            }
            ?>
				<?php 
            $Value = $Unit == 'date' ? date('d.m.Y', $Info[$Key]) : $Info[$Key];
            ?>
				<?php 
            if ($Unit == 'date') {
                $Unit = '';
            }
            ?>
				<?php 
            if ($Key == 'sleep_duration' && $Value > 0) {
                $Value = (new Duration($Value * 60))->string('G:i');
            }
            ?>
    /**
     * Display the content (old design)
     */
    protected function displayContentInOldDesign()
    {
        $Weight = '';
        $Analyse = '';
        $UserData = new UserData(DataObject::$LAST_OBJECT);
        if ($this->Configuration()->value('use_weight')) {
            $UserWeight = new Weight($UserData->getWeight());
            $Weight = __('Weight') . ': <strong>' . Helper::Unknown($UserWeight->string(false), '-') . ' ' . $UserWeight->unit() . '</strong><br>';
        }
        if ($this->Configuration()->value('use_pulse')) {
            $Pulse = Helper::Unknown($UserData->getPulseRest(), '-') . ' bpm / ' . Helper::Unknown($UserData->getPulseMax()) . ' bpm';
        } else {
            $Pulse = Helper::Unknown($UserData->getPulseMax(), '-') . ' bpm';
        }
        if ($this->Configuration()->value('use_body_fat')) {
            $Analyse = __('Fat') . ': ' . Helper::Unknown($UserData->getBodyFat(), '-') . ' &#37;, ' . __('Water') . ': ' . Helper::Unknown($UserData->getWater(), '-') . ' &#37;, ' . __('Muscles') . ': ' . Helper::Unknown($UserData->getMuscles(), '-') . ' &#37;';
        }
        $AnalyseIsHidden = $this->Configuration()->value('use_weight') || $this->Configuration()->value('use_pulse');
        if (!$AnalyseIsHidden && !$this->Configuration()->value('use_body_fat')) {
            return;
        }
        echo '
			<div id="sportler-content">
				<span class="right">' . $Pulse . '</span>
				' . Ajax::flotChange($Weight, 'sportler_flots', 'sportler_weights') . '
				' . Ajax::flotChange($Analyse, 'sportler_flots', 'sportler_analyse', !$AnalyseIsHidden) . '

				<div id="sportler_flots" class="flot-changeable" style="position:relative;width:320px;height:150px;margin:0 auto;">
					<div class="flot ' . Ajax::$IMG_WAIT . '" id="sportler_weights" style="width:320px;height:150px;position:absolute;"></div>
					<div class="flot ' . Ajax::$IMG_WAIT . ($AnalyseIsHidden ? ' flot-hide' : '') . '" id="sportler_analyse" style="width:320px;height:150px;position:absolute;"></div>
				</div>
			</div>';
        include FRONTEND_PATH . '../plugin/' . $this->key() . '/Plot.gewicht.php';
        include FRONTEND_PATH . '../plugin/' . $this->key() . '/Plot.analyse.php';
    }