Example #1
0
 /**
  * @param string $icon optional icon instead of text
  * @return string
  */
 public function codeForColumnLabels($icon = false)
 {
     $Tooltip = new Tooltip('');
     $Code = '';
     foreach ($this->ActiveKeys as $keyid) {
         $Key = Keys::get($keyid);
         $Header = $icon ?: $Key->shortLabel();
         $Tooltip->setText($Key->label());
         $Tooltip->wrapAround($Header);
         $Code .= '<td>' . $Header . '</td>';
     }
     return $Code;
 }
Example #2
0
 /**
  * Add tooltip to code
  * @param string $code
  */
 protected function addTooltipToCode(&$code)
 {
     if (!empty($this->Tooltip)) {
         $Tooltip = new Tooltip($this->Tooltip);
         $Tooltip->wrapAround($code);
     }
 }
    /**
     * Get fieldset for VDOT
     * @return \FormularFieldset
     */
    public function getFieldsetVDOT()
    {
        $Table = '<table class="fullwidth zebra-style">
				<thead>
					<tr>
						<th colspan="10">' . sprintf(__('VDOT values of the last %s days'), Configuration::Vdot()->days()) . '</th>
					</tr>
				</thead>
				<tbody class="top-and-bottom-border">';
        $Tooltip = new Tooltip('');
        $VDOT = new VDOT(0, new VDOTCorrector(Configuration::Data()->vdotFactor()));
        $VDOTs = DB::getInstance()->query('SELECT `id`,`time`,`distance`,IF(`vdot_with_elevation`>0,`vdot_with_elevation`,`vdot`) as `vdot` FROM `' . PREFIX . 'training` WHERE time>=' . (time() - Configuration::Vdot()->days() * DAY_IN_S) . ' AND vdot>0 AND use_vdot=1 AND accountid = ' . SessionAccountHandler::getId() . ' ORDER BY time ASC')->fetchAll();
        foreach ($VDOTs as $i => $Data) {
            if ($i % 10 == 0) {
                $Table .= '<tr>';
            }
            $Tooltip->setText(date('d.m.Y', $Data['time']) . ': ' . Distance::format($Data['distance']));
            $VDOT->setValue($Data['vdot']);
            $Table .= '<td ' . $Tooltip->attributes() . '>' . Ajax::trainingLink($Data['id'], $VDOT->value()) . '</td>';
            if ($i % 10 == 9) {
                $Table .= '</tr>';
            }
        }
        if (count($VDOTs) % 10 != 0) {
            $Table .= HTML::emptyTD(10 - count($VDOTs) % 10);
        }
        $Table .= '</tbody></table>';
        $Fieldset = new FormularFieldset(__('VDOT'));
        $Fieldset->addBlock(sprintf(__('The VDOT value is the average, weighted by the time, of the VDOT of your activities in the last %s days.'), Configuration::Vdot()->days()));
        $Fieldset->addBlock(sprintf(__('Your current VDOT shape: <strong>%s</strong><br>&nbsp;'), Configuration::Data()->vdot()));
        $Fieldset->addBlock($Table);
        $Fieldset->addInfo(__('Jack Daniels uses VDOT as a fixed value and not based on the training progress.<br>' . 'We do instead predict the VDOT from all activities based on the heart rate. ' . 'These formulas are derived from Jack Daniels\' tables as well.'));
        return $Fieldset;
    }