/**
  * Set boxed values
  */
 protected function setBoxedValues()
 {
     $Distance = new Distance($this->Context->activity()->distance());
     $this->BoxedValues = array(new BoxedValue(Helper::Unknown($Distance->string(false, false), '-.--'), $Distance->unit(), __('Distance')), new BoxedValue($this->Context->dataview()->duration()->string(), '', __('Time')), new BoxedValue($this->Context->dataview()->elapsedTime(), '', __('Elapsed time')), new BoxedValue($this->Context->dataview()->pace()->value(), $this->Context->dataview()->pace()->appendix(), __('Pace')), new BoxedValue(Helper::Unknown($this->Context->activity()->hrAvg(), '-'), 'bpm', __('ø Heartrate')), new BoxedValue(Helper::Unknown($this->Context->activity()->hrMax(), '-'), 'bpm', __('max. Heartrate')), new BoxedValue($this->Context->activity()->calories(), 'kcal', __('Calories')), new BoxedValue(Helper::Unknown($this->Context->dataview()->vdot()->value(), '-'), '', __('VDOT'), $this->Context->dataview()->vdotIcon()), new BoxedValue($this->Context->activity()->trimp(), '', __('TRIMP')), new Box\Elevation($this->Context));
 }
    /**
     * @return string
     */
    protected function getEquipmentCode()
    {
        $Code = '
			<table class="fullwidth zebra-style c">
				<thead>
					<tr>
						<th>' . __('Name') . '</th>
						<th>' . __('Category') . '</th>
						<th>' . __('prev. distance') . '</th>
						<th>' . __('Start of use') . '</th>
						<th>' . __('End of use') . '</th>
						<th>' . __('Notes') . '</th>
						<th>' . __('delete') . ' ' . $this->getDeleteIcon() . '</th>
					</tr>
				</thead>
				<tbody>';
        $Types = $this->Model->allEquipmentTypes();
        $Equipments = $this->Model->allEquipments();
        $Equipments[] = new Equipment\Entity();
        foreach ($Equipments as $Equipment) {
            $isNew = !$Equipment->hasID();
            $id = $isNew ? -1 : $Equipment->id();
            $delete = $isNew ? '' : '<input type="checkbox" class="delete-checkbox" name="equipment[delete][' . $id . ']">';
            $Code .= '
					<tr class="' . ($isNew ? ' unimportant' : '') . '">
						<td><input type="text" size="30" name="equipment[name][' . $id . ']" value="' . $Equipment->name() . '"></td>
						<td><select name="equipment[typeid][' . $id . ']">';
            foreach ($Types as $Type) {
                $Code .= '<option value="' . $Type->id() . '"' . HTML::Selected($Type->id() == $Equipment->typeid()) . '>' . $Type->name() . '</option>';
            }
            $AdditionalDistance = new Distance($Equipment->additionalDistance());
            $Code .= '</select></td>
						<td><span class="input-with-unit"><input type="text" class="small-size" name="equipment[additional_km][' . $id . ']" value="' . round($AdditionalDistance->valueInPreferredUnit()) . '"><label class="input-unit">' . $AdditionalDistance->unit() . '</label></span></td>
						<td><input type="text" class="small-size pick-a-date" placeholder="dd.mm.YYYY" name="equipment[date_start][' . $id . ']" value="' . $this->datetimeToString($Equipment->startDate()) . '"></td>
						<td><input type="text" class="small-size pick-a-date" placeholder="dd.mm.YYYY" name="equipment[date_end][' . $id . ']" value="' . $this->datetimeToString($Equipment->endDate()) . '"></td>
						<td><input type="text" size="fullwidth" name="equipment[notes][' . $id . ']" value="' . $Equipment->notes() . '"></td>
						<td>' . $delete . '</td>
					</tr>';
        }
        $Code .= '
			</tbody>
		</table>';
        return $Code;
    }
 /**
  * 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();
     }
 }