/** * Add: course */ protected function addCourse() { if (strlen($this->Context->route()->name()) > 0) { $PathBox = new BoxedValue($this->Context->route()->name(), '', __('Course')); $PathBox->defineAsFloatingBlock('w100 flexible-height'); $this->BoxedValues[] = $PathBox; } }
/** * Add running dynamics */ protected function addRunningDynamics() { if ($this->Context->activity()->groundcontact() > 0 || $this->Context->activity()->verticalOscillation() > 0) { $Contact = new BoxedValue(Helper::Unknown($this->Context->activity()->groundcontact(), '-'), 'ms', __('Ground contact')); $Contact->defineAsFloatingBlock('w50'); $Oscillation = new BoxedValue(Helper::Unknown(round($this->Context->activity()->verticalOscillation() / 10, 1), '-'), 'cm', __('Vertical oscillation')); $Oscillation->defineAsFloatingBlock('w50'); $this->BoxedValues[] = $Contact; $this->BoxedValues[] = $Oscillation; } }
/** * Set boxed values to content */ protected function setBoxedValuesToContent() { $NumberOfBoxes = count($this->BoxedValues); $ValuesString = ''; foreach ($this->BoxedValues as &$Value) { $Value->defineAsFloatingBlockWithFixedWidth($NumberOfBoxes); $ValuesString .= $Value->getCode(); } $this->Content = BoxedValue::getWrappedValues($ValuesString); }
/** * Display boxed values */ protected function displayBoxedValues() { $Code = ''; foreach ($this->BoxedValues as &$Value) { $Code .= $Value->getCode(); } BoxedValue::wrapValues($Code); }
/** * Add training partner */ protected function addTrainingPartner() { if (!$this->Context->activity()->partner()->isEmpty()) { $TrainingPartner = new BoxedValue($this->Context->dataview()->partnerAsLinks(), '', __('Training partner')); $TrainingPartner->defineAsFloatingBlock('w100 flexible-height'); $this->BoxedValues[] = $TrainingPartner; } }
/** * Display the content (new design) */ protected function displayContentInNewDesign() { $Code = ''; $UserData = new UserData(DataObject::$LAST_OBJECT); if ($UserData->getPulseMax() == 0) { $topBox = new BoxedValue(__('Enter maximal HR'), '', __('Otherwise calculations will be wrong')); $topBox->addClass('colored-orange'); $topBox->defineAsFloatingBlockWithFixedWidth(1); $Code .= $topBox->getCode(); } $FirstValues = array(); $SecondValues = array(); if ($this->Configuration()->value('use_weight')) { $FirstValues[] = new BoxedValue(Helper::Unknown($UserData->getWeight(), '-'), 'kg', __('Weight')); } if ($this->Configuration()->value('use_pulse')) { $FirstValues[] = new BoxedValue(Helper::Unknown($UserData->getPulseRest(), '-'), 'bpm', __('Resting HR')); $FirstValues[] = new BoxedValue(Helper::Unknown($UserData->getPulseMax(), '-'), 'bpm', __('Maximal HR')); } $NumberOfFirstValues = count($FirstValues); foreach ($FirstValues as &$Value) { $Value->defineAsFloatingBlock($NumberOfFirstValues == 2 ? "w50" : "w33"); $Code .= $Value->getCode(); } if (!empty($Code)) { $Code .= '<br>'; } if ($this->Configuration()->value('use_body_fat')) { $SecondValues[] = new BoxedValue(Helper::Unknown($UserData->getBodyFat(), '-'), '%', __('Fat')); $SecondValues[] = new BoxedValue(Helper::Unknown($UserData->getWater(), '-'), '%', __('Water')); $SecondValues[] = new BoxedValue(Helper::Unknown($UserData->getMuscles(), '-'), '%', __('Muscles')); } foreach ($SecondValues as &$Value) { $Value->defineAsFloatingBlock("w33"); $Code .= $Value->getCode(); } if (!empty($Code)) { echo BoxedValue::wrapValues($Code); } $this->displayPlots(); }
/** * Show boxed values * @param array $data */ private function showDataAsBoxedValues($data) { $Factory = new Factory(SessionAccountHandler::getId()); foreach ($data as $dat) { // TODO: Define the decision (distance or time) somehow in the configuration $Sport = $Factory->sport($dat['sportid']); $Value = new BoxedValue(); $Value->setIcon($Sport->icon()->code()); $Value->setInfo($Sport->name()); $Value->defineAsFloatingBlock('w50'); if ($dat['count_distance'] >= $dat['count'] / 2) { $Distance = new Distance($dat['distance']); $Value->setValue($Distance->string(false, false, false)); $Value->setUnit($Distance->unit()); } else { $Duration = new Duration($dat['time_in_s']); $Value->setValue($Duration->string(Duration::FORMAT_WITH_HOURS)); } $Value->display(); } }