Exemplo n.º 1
0
 /**
  * @return string
  */
 protected function tableHeaderForAdditionalKeys()
 {
     $Labels = new \DatasetLabels();
     $Code = '';
     foreach ($this->AdditionalKeys as $key) {
         $Code .= '<th class="small">' . $Labels->get($key) . '</th>';
     }
     return $Code;
 }
Exemplo n.º 2
0
 /**
  * Display labels
  */
 public function displayTableLabels()
 {
     if (Configuration::DataBrowser()->showEditLink()) {
         echo HTML::emptyTD();
     }
     $Labels = new DatasetLabels();
     foreach ($this->data as $set) {
         echo '<td><span ' . Ajax::tooltip('', $Labels->get($set['name']), false, true) . '>' . $Labels->get($set['name']) . '</span></td>';
     }
 }
Exemplo n.º 3
0
 /**
  * Display a single dataset
  * @param array $set
  */
 private function displayDataset($set)
 {
     if ($this->isSummary && $set['summary'] == 0) {
         echo HTML::emptyTD();
     } else {
         $Labels = new DatasetLabels();
         echo HTML::td('<span ' . Ajax::tooltip('', $Labels->get($set['name']), false, true) . '>' . $this->getDataset($set['name']) . '</span>', $set['class'], $set['style']);
     }
 }
Exemplo n.º 4
0
    /**
     * Get code
     * @return string 
     */
    private function getCode()
    {
        $Code = '
			<table class="c fullwidth zebra-style" id="conf-tab-dataset">
				<thead>
					<tr>
						<th>&nbsp;</th>
						<th>' . Ajax::tooltip(__('Display'), __('The information will be shown directly in the row.')) . '</th>
						<th colspan="2">' . Ajax::tooltip(__('Summary'), __('The value will be summarized for the sport.')) . '</th>
						<th>' . Ajax::tooltip(__('Order'), __('Indicates the order of appearance.')) . '</th>
						<th>' . Ajax::tooltip(__('CSS-Class'), __('\'c\': centered<br>\'l\': left-aligned<br>\'small\': small<br>\'b\': bold')) . '</th>
						<th>' . Ajax::tooltip(__('CSS-Style'), __('any CSS-Code')) . '</th>
						<th>' . __('Example') . '</th>
					</tr>
				</thead>
				<tbody>';
        $Labels = new DatasetLabels();
        $DatasetObject = new Dataset();
        $DatasetObject->setActivityData($this->getExampleTraining());
        $Dataset = DB::getInstance()->query('SELECT *, (`position` = 0) as `hidden` FROM `' . PREFIX . 'dataset` WHERE accountid = ' . SessionAccountHandler::getId() . ' ORDER BY (`position` > 0) DESC, `position` ASC')->fetchAll();
        foreach ($Dataset as $pos => $Data) {
            $disabled = $Data['modus'] == 3 ? ' disabled' : '';
            $checked_2 = $Data['modus'] >= 2 ? ' checked' : '';
            $checked = $Data['summary'] == 1 ? ' checked' : '';
            $SummarySign = '';
            switch ($Data['summary_mode']) {
                case 'YES':
                case 'NO':
                    $checked .= ' disabled';
                    break;
                case 'AVG':
                    $SummarySign = '&Oslash;';
                    break;
                case 'SUM':
                    $SummarySign = '&sum;';
                    break;
                case 'MAX':
                    $SummarySign = 'max';
                    break;
            }
            $Example = $DatasetObject->getDataset($Data['name']);
            $Code .= '
				<tr class="r" id="' . $Data['id'] . '_tr">
					<td class="l b">' . $Labels->get($Data['name']) . '</td>
					<td class="c">
						<input type="hidden" name="' . $Data['id'] . '_modus_3" value="' . $Data['modus'] . '">
						<input type="checkbox" name="' . $Data['id'] . '_modus"' . $checked_2 . $disabled . '>
					</td>
					<td class="c"><input type="checkbox" name="' . $Data['id'] . '_summary"' . $checked . '></td>
					<td class="c small">' . $SummarySign . '</td>
					<td class="c">
						<input class="dataset-position" type="text" name="' . $Data['id'] . '_position" value="' . ($pos + 1) . '" size="2">
						<span class="link" onclick="datasetMove(' . $Data['id'] . ', \'up\')">' . Icon::$UP . '</span>
						<span class="link" onclick="datasetMove(' . $Data['id'] . ', \'down\')">' . Icon::$DOWN . '</span>
					</td>
					<td class="c"><input type="text" name="' . $Data['id'] . '_class" value="' . $Data['class'] . '" size="7"></td>
					<td class="c"><input type="text" name="' . $Data['id'] . '_style" value="' . $Data['style'] . '" size="15"></td>
					<td class="' . $Data['class'] . '" style="' . $Data['style'] . '">' . $Example . '</td>
				</tr>';
        }
        $Code .= '
				</tbody>
			</table>';
        $Code .= Ajax::wrapJS('
			function datasetMove(id, way) {
				var pos = parseInt($("input[name=\'"+id+"_position\']").val()),
					tr = $("#"+id+"_tr");

				if (way == "up" && pos > 1) {
					$("#"+id+"_tr .dataset-position").val(pos-1);
					tr.prev().find(".dataset-position").val(pos);
					tr.prev().toggleClass("swapped");
					tr.prev().before(tr);
				} else if (way == "down" && tr.next().find(".dataset-position").val() > 0) {
					$("#"+id+"_tr .dataset-position").val(pos+1);
					tr.next().find(".dataset-position").val(pos);
					tr.next().toggleClass("swapped");
					tr.next().after(tr);
				}

				tr.toggleClass("swapped");
			}
		');
        return $Code;
    }