/** * Init toolbar links */ private function initToolbarLinks() { $Linker = new Linker($this->Context->activity()); if ($this->Context->activity()->isPublic()) { $this->ToolbarLinks[] = '<a href="' . $Linker->publicUrl() . '" target="_blank">' . Icon::$ATTACH . ' ' . __('Public link') . '</a>'; } if (!Request::isOnSharedPage()) { $this->ToolbarLinks[] = Ajax::window('<a href="' . ExporterWindow::$URL . '?id=' . $this->Context->activity()->id() . '">' . Icon::$DOWNLOAD . ' ' . __('Export') . '</a> ', 'small'); $this->ToolbarLinks[] = Ajax::window('<a href="' . $Linker->editUrl() . '">' . Icon::$EDIT . ' ' . __('Edit') . '</a> ', 'small'); } $this->ToolbarLinks[] = Ajax::tooltip($Linker->weekLink(), '<em>' . __('Show week') . '</em><br>' . $this->Context->dataview()->weekday() . ', ' . $this->Context->dataview()->dateAndDaytime()); }
/** * Get HTML code for snippet * @return string */ protected function codeSnippet() { $Linker = new Linker($this->Context->activity()); $TextUrl = $Linker->publicUrl(); $Url = $Linker->publicUrl() . '&utm_medium=referral&utm_source=sharehtml'; $Date = $this->Context->dataview()->date(); $Time = $this->Context->dataview()->duration()->string(); $Title = $this->Context->activity()->distance() > 0 ? $this->Context->dataview()->distance() . ' ' : ''; $Title .= $this->Context->dataview()->titleByTypeOrSport(); $Pace = $this->Context->activity()->distance() > 0 ? $this->Context->dataview()->pace()->valueWithAppendix() : ''; $Elev = $this->Context->activity()->elevation() > 0 ? $this->Context->dataview()->elevation()->string() : ''; $Heart = $this->Context->activity()->hrAvg() > 0 ? $this->Context->dataview()->hrAvg()->string() : ''; $Spans = ''; if ($Time != '') { $Spans .= '<span class="runalyze-emb-time">' . $Time . '</span>'; } if ($Pace != '') { $Spans .= '<span class="runalyze-emb-pace">' . $Pace . '</span>'; } if ($Heart != '') { $Spans .= '<span class="runalyze-emb-heart">' . $Heart . '</span>'; } if ($Elev != '') { $Spans .= '<span class="runalyze-emb-elev">' . $Elev . '</span>'; } $UrlLink = System::isAtLocalhost() || !$this->Context->activity()->isPublic() ? '' : '<a href="' . $Url . '" class="runalyze-emb-share">' . $TextUrl . '</a>'; return '<div class="runalyze-emb"> <a href="https://runalyze.com/" class="runalyze-emb-runalyze">runalyze.com</a> <strong>' . $Title . '</strong> <small>' . $Date . '</small><br> <div class="runalyze-emb-infos"> ' . $Spans . ' </div> ' . $UrlLink . ' <div class="runalyze-clear"></div> </div> <script src="https://runalyze.com/lib/embedded.js"></script>'; }
/** * Init social share links * @param \Runalyze\View\Activity\Linker $linker */ protected function initShareLinks(Linker $linker) { $this->ToolbarLinks[] = '<li class="with-submenu"><span class="link"><i class="fa fa-fw fa-share-alt"></i> ' . __('Share') . '</span><ul class="submenu">'; if ($this->Context->activity()->isPublic()) { $this->ToolbarLinks[] = '<li><a href="' . $linker->publicUrl() . '" target="_blank">' . Icon::$ATTACH . ' ' . __('Public link') . '</a></li>'; } foreach (Export\Share\Types::getEnum() as $typeid) { $Exporter = Export\Share\Types::get($typeid, $this->Context); if ($Exporter->isPossible()) { $link = '<li><a href="' . $Exporter->url() . '"' . ($Exporter->isExternalLink() ? ' target="_blank"' : '') . '><i class="fa fa-fw ' . $Exporter->iconClass() . '"></i> ' . $Exporter->name() . '</a></li>'; $this->ToolbarLinks[] = !$Exporter->isExternalLink() ? Ajax::window($link) : $link; } } $this->ToolbarLinks[] = '</ul></li>'; }
/** * Display course */ public function displayCourse() { $this->Context = new Context(Request::sendId(), Request::param('account')); if (!$this->activityIsValid() || !$this->Context->hasRoute() || !$this->Context->route()->hasPositionData()) { die('Don\'t do that!'); } $Linker = new Linker($this->Context->activity()); echo '<meta property="og:type" content="metadata">' . NL; echo '<link rel="origin" href="' . $Linker->publicUrl() . '">' . NL; $this->RouteLoop = new Model\Route\Loop($this->Context->route()); $this->RouteLoop->setStepSize(self::STEP_SIZE); $this->TrackdataLoop = new Model\Trackdata\Loop($this->Context->trackdata()); $this->TrackdataLoop->setStepSize(self::STEP_SIZE); do { $this->displayActivityDataPoint(); } while ($this->RouteLoop->nextStep() && $this->TrackdataLoop->nextStep()); }
/** * @return string */ protected final function publicURL() { $Linker = new Linker($this->Context->activity()); return $Linker->publicUrl(); }
/** * Get HTML code for snippet * @return string */ protected function codeSnippet() { $this->Context->activity()->set(Activity\Entity::IS_PUBLIC, 1); $Linker = new Linker($this->Context->activity()); return '<iframe style="padding:0;margin:0 auto;display:block;max-width:100%;" src="' . $Linker->publicUrl() . '&mode=iframe" width="' . $this->width() . '" height="' . $this->height() . '"></iframe>'; }