/** * Display navigation */ protected function displayNavigation() { $Code = '<div id="ajax-navigation" class="panel">'; $Code .= '<div class="panel-heading">'; $Code .= '<h1>' . __('Multi editor') . '</h1>'; $Code .= '</div>'; $Code .= '<div class="panel-content">'; $Code .= '<table class="multi-edit-table fullwidth zebra-style"><tbody>'; foreach (self::$IDs as $i => $ID) { $Preview = new Preview(new Activity\Object($this->fetchActivity($ID))); $Code .= '<tr id="multi-edit-' . $ID . '" class="link ' . ($i == 0 ? ' highlight' : '') . ' show-on-hover-parent">'; $Code .= '<td class="multi-edit-sport-icon c"><span class="link show-on-hover multi-edit-remove-link">' . Icon::$CROSS_SMALL . '</span>' . $Preview->sportIcon() . '</td>'; $Code .= '<td>' . $Preview->dateAndSmallTime() . '<br><small>' . $Preview->durationAndDistance() . '</small></td>'; $Code .= '<td class="multi-edit-icon">' . $Preview->hrIcon() . '</td>'; $Code .= '<td class="multi-edit-icon">' . $Preview->splitsIcon() . '</td>'; $Code .= '<td class="multi-edit-icon">' . $Preview->mapIcon() . '</td>'; $Code .= '</tr>'; } $Code .= '</tbody></table>'; $Code .= '</div>'; $Code .= '</div>'; echo Ajax::wrapJS('$(\'#ajax-navigation\').remove();$(\'#ajax-outer\').append(\'' . $Code . '\')'); echo Ajax::wrapJSasFunction('$("#ajax-navigation tr.link").click(function(e){ $("#ajax-navigation tr.link.highlight").removeClass("highlight").addClass("edited"); $(this).removeClass("edited").addClass("highlight"); Runalyze.Overlay.load( "' . Linker::EDITOR_URL . '?mode=multi&id=" + $(this).attr("id").substr(11) ); });'); echo Ajax::wrapJSasFunction('$("#ajax-navigation .multi-edit-remove-link").click(function(e){ $(this).parent().parent().remove(); e.stopPropagation(); });'); }
/** * Get table row for training * @param TrainingObject $TrainingObject * @param int $i */ private function getTableRowFor(TrainingObject &$TrainingObject, $i) { $TrainingObject->updateAfterParsing(); $Data = urlencode(serialize($TrainingObject->getArray())); $Inputs = HTML::checkBox('training-import[' . $i . ']', true); $Inputs .= HTML::hiddenInput('training-data[' . $i . ']', $Data); $Preview = new Preview(new Activity\Entity(array(Activity\Entity::TIMESTAMP => $TrainingObject->getTimestamp(), Activity\Entity::SPORTID => $TrainingObject->get('sportid'), Activity\Entity::TIME_IN_SECONDS => $TrainingObject->getTimeInSeconds(), Activity\Entity::DISTANCE => $TrainingObject->getDistance(), Activity\Entity::IS_TRACK => $TrainingObject->isTrack(), Activity\Entity::HR_AVG => $TrainingObject->getPulseAvg(), Activity\Entity::SPLITS => $TrainingObject->get('splits'), Activity\Entity::ROUTEID => $TrainingObject->hasPositionData()))); $Row = '<td>' . $Inputs . '</td>'; $Row .= '<td>' . $Preview->dateAndTime() . '</td>'; $Row .= '<td>' . $Preview->duration() . '</td>'; $Row .= '<td>' . $Preview->distance() . '</td>'; $Row .= '<td>' . $Preview->sportIcon() . '</td>'; $Row .= '<td>' . $Preview->hrIcon() . '</td>'; $Row .= '<td>' . $Preview->splitsIcon() . '</td>'; $Row .= '<td>' . $Preview->mapIcon() . '</td>'; return $Row; }