/**
     * @param string $keyid
     * @param int $pos
     * @param bool $isNew flag to indicate that a key is new
     * @return string
     */
    protected function getCodeForKey($keyid, $pos, $isNew = false)
    {
        $KeyObject = Dataset\Keys::get($keyid);
        if ($KeyObject->description() != '') {
            $DescriptionIcon = new Runalyze\View\Icon(Runalyze\View\Icon::INFO . ' ' . Runalyze\View\Tooltip::POSITION_RIGHT);
            $DescriptionIcon->setTooltip($KeyObject->description());
            $Icon = $DescriptionIcon->code();
        } else {
            $Icon = '';
        }
        if ($isNew) {
            $newIndicator = '<sup class="colored-green">' . __('new') . '</sup>';
        } else {
            $newIndicator = '';
        }
        return '<tr class="r" id="' . $keyid . '_tr">
				<td class="c">' . $Icon . '</td>
				<td class="l b">' . $KeyObject->label() . $newIndicator . '</td>
				<td class="c">
					<input type="checkbox" name="' . $keyid . '_active"' . (!$isNew && $this->Configuration->isActive($keyid) ? ' checked' : '') . ($KeyObject->mustBeShown() ? ' disabled' : '') . '>
				</td>
				<td class="c">
					<input class="dataset-position" type="text" name="' . $keyid . '_position" value="' . $pos . '" size="2">
					<span class="link" onclick="datasetMove(' . $keyid . ', \'up\')">' . Icon::$UP . '</span>
					<span class="link" onclick="datasetMove(' . $keyid . ', \'down\')">' . Icon::$DOWN . '</span>
				</td>
				<td class="c"><input type="text" name="' . $keyid . '_style" value="' . ($isNew ? '' : $this->Configuration->getStyle($keyid)) . '" size="15"></td>
				<td class="' . $KeyObject->cssClass() . '" style="' . ($isNew ? '' : $this->Configuration->getStyle($keyid)) . '">' . $KeyObject->stringFor($this->ExampleContext) . '</td>
			</tr>';
    }
Example #2
0
 /**
  * @param \Runalyze\Dataset\Context $context
  * @return string
  */
 public function codeForColumns(Context $context, array $hiddenKeys = array())
 {
     $Code = '';
     if ($this->AutomaticDistanceComparison) {
         $context->setData(Keys\Distance::KEY_DISTANCE_COMPARISON, $this->LastDistance);
         $this->LastDistance = $context->activity()->distance();
     }
     foreach ($this->ActiveKeys as $keyid) {
         if (in_array($keyid, $hiddenKeys)) {
             $Code .= '<td></td>';
         } else {
             $Key = Keys::get($keyid);
             $class = $Key->cssClass() != '' ? ' class="' . $Key->cssClass() . '"' : '';
             $style = $this->Configuration->getStyle($keyid) != '' ? ' style="' . $this->Configuration->getStyle($keyid) . '"' : '';
             $Code .= '<td' . $class . $style . '>' . $Key->stringFor($context) . '</td>';
         }
     }
     return $Code;
 }