Exemplo n.º 1
0
 /**
  * Get string to display this dataset value
  * @param \Runalyze\Dataset\Context $context
  * @return string
  */
 public function stringFor(Context $context)
 {
     if ($context->hasData(parent::CONCAT_EQUIPMENT_KEY) && $context->data(parent::CONCAT_EQUIPMENT_KEY) != '') {
         $ids = explode(',', $context->data(parent::CONCAT_EQUIPMENT_KEY));
         $Factory = new \Runalyze\Model\Factory(\SessionAccountHandler::getId());
         $names = array();
         foreach (array_unique($ids) as $id) {
             $names[] = $Factory->equipment($id)->name();
         }
         $Icon = new \Runalyze\View\Icon('fa-cubes');
         $Icon->setTooltip(implode(', ', $names));
         return $Icon->code();
     }
     return '';
 }
Exemplo n.º 2
0
 /**
  * Display results
  */
 protected function displayResults()
 {
     if (!$this->WithResults) {
         return;
     }
     $Table = new \Runalyze\View\Dataset\Table($this->DatasetConfig);
     $Icon = new \Runalyze\View\Icon(Runalyze\View\Icon::INFO);
     echo '<p class="c">';
     $this->displayHeader();
     echo '</p>';
     echo '<table class="fullwidth zebra-style">';
     echo '<thead>';
     echo '<tr style="font-size:.5em;line-height:1;"><td></td>' . $Table->codeForColumnLabels($Icon->code()) . '</tr>';
     echo '</thead>';
     echo '<tbody>';
     $this->displayTrainingRows($Table);
     echo '</tbody>';
     echo '</table>';
 }
Exemplo n.º 3
0
    /**
     * @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>';
    }