/**
  * Add info link
  */
 protected function addInfoLink()
 {
     if (!Request::isOnSharedPage()) {
         $Linker = new Linker($this->Context->activity());
         $InfoLink = Ajax::window('<a href="' . $Linker->urlToRoundsInfo() . '">' . __('More details about your laps') . '</a>', 'normal');
         $this->Header = HTML::info($InfoLink);
     }
 }
 /**
  * Add info link
  */
 protected function addInfoLink()
 {
     if ($this->Context->trackdata()->has(Trackdata\Entity::DISTANCE) && $this->Context->trackdata()->has(Trackdata\Entity::TIME)) {
         if (!Request::isOnSharedPage()) {
             $Linker = new Linker($this->Context->activity());
             $InfoLink = Ajax::window('<a href="' . $Linker->urlToRoundsInfo() . '">' . __('More details about your laps') . '</a>', 'big');
             $this->Header = HTML::info($InfoLink);
         }
     }
 }
 /**
  * Add info link
  */
 protected function addInfoLink()
 {
     if ($this->Context->dataview()->vdot()->value() > 0 || $this->Context->activity()->jdIntensity() > 0) {
         if (!Request::isOnSharedPage()) {
             $Linker = new Activity\Linker($this->Context->activity());
             $InfoLink = Ajax::window('<a href="' . $Linker->urlToVDOTInfo() . '">' . __('More about VDOT calculation') . '</a>', 'small');
             $this->Footer = HTML::info($InfoLink);
         }
     }
 }
 /**
  * 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());
 }
 /**
  * Add info link
  */
 protected function addInfoLink()
 {
     if (!Request::isOnSharedPage()) {
         $Linker = new Linker($this->Context->activity());
         $InfoLink = Ajax::window('<a href="' . $Linker->urlToElevationInfo() . '">' . __('More about elevation') . '</a>', 'normal');
         $this->Footer = HTML::info($InfoLink);
     } else {
         $this->Footer = '';
     }
     if ($this->Context->route()->hasCorrectedElevations()) {
         $this->Footer .= HTML::info(__('Elevation data were corrected.'));
     } elseif ($this->Context->route()->hasOriginalElevations() && Configuration::ActivityForm()->correctElevation()) {
         $this->Footer .= HTML::warning(__('Elevation data are not corrected.'));
     }
     // TODO: Add link to correct them now!
 }
Exemple #6
0
 /**
  * Display edit link if used in DataBrowser
  */
 public function displayEditLink()
 {
     if (Configuration::DataBrowser()->showEditLink()) {
         if ($this->isSummary || FrontendShared::$IS_SHOWN) {
             echo HTML::emptyTD();
         } else {
             echo HTML::td($this->Linker->smallEditLink());
         }
     }
 }
Exemple #7
0
    /**
     * 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>';
    }
 /**
  * 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());
 }
/**
 * Display formular for editing a training
 * Call:   call/call.Training.edit.php?id=
 */
require '../inc/class.Frontend.php';
use Runalyze\Model\Activity;
use Runalyze\View\Activity\Linker;
use Runalyze\View\Activity\Dataview;
$Frontend = new Frontend();
if (isset($_GET['delete']) && is_numeric($_GET['delete'])) {
    $Deleter = new Activity\Deleter(DB::getInstance(), Runalyze\Context::Factory()->activity($_GET['delete']));
    $Deleter->setAccountID(SessionAccountHandler::getId());
    $Deleter->delete();
    echo '<div class="panel-content"><p id="submit-info" class="error">' . __('The activity has been removed') . '</p></div>';
    echo '<script>$("#multi-edit-' . (int) $_GET['delete'] . '").remove();Runalyze.Statistics.resetUrl();Runalyze.reloadContent();</script>';
    exit;
}
$Training = new TrainingObject(Request::sendId());
$Activity = new Activity\Object($Training->getArray());
$Linker = new Linker($Activity);
$Dataview = new Dataview($Activity);
echo $Linker->editNavigation();
echo '<div class="panel-heading">';
echo '<h1>' . $Dataview->titleWithComment() . ', ' . $Dataview->dateAndDaytime() . '</h1>';
echo '</div>';
echo '<div class="panel-content">';
$Formular = new TrainingFormular($Training, StandardFormular::$SUBMIT_MODE_EDIT);
$Formular->setId('training');
$Formular->setLayoutForFields(FormularFieldset::$LAYOUT_FIELD_W50);
$Formular->display();
echo '</div>';
    /**
     * Display table-row for a competition
     * @param array $data
     */
    private function displayWKTr(array $data)
    {
        $Activity = new Activity\Entity($data);
        $Linker = new Linker($Activity);
        $Dataview = new Dataview($Activity);
        echo '<tr class="r">
				<td>' . $this->getIconForCompetition($data['id']) . '</td>
				<td class="c small">' . $Linker->weekLink() . '</a></td>
				<td class="l"><strong>' . $Linker->linkWithComment() . '</strong></td>
				<td>' . $Dataview->distance(1) . '</td>
				<td>' . $Dataview->duration()->string(Duration::FORMAT_COMPETITION) . '</td>
				<td class="small">' . $Dataview->pace()->value() . '</td>
				<td class="small">' . Helper::Unknown($Activity->hrAvg()) . ' / ' . Helper::Unknown($Activity->hrMax()) . ' bpm</td>
				<td class="small">' . ($Activity->weather()->isEmpty() ? '' : $Activity->weather()->fullString($Activity->isNight())) . '</td>
			</tr>';
    }
Exemple #11
0
 /**
  * @return string
  */
 protected final function publicURL()
 {
     $Linker = new Linker($this->Context->activity());
     return $Linker->publicUrl();
 }
    /**
     * Display the images
     */
    private function displayTable()
    {
        if ($this->sportid > 0) {
            $sports_not_short = $this->sportid . ',';
        } else {
            $sports_not_short = '';
            $sports = DB::getInstance()->query('SELECT `id` FROM `' . PREFIX . 'sport` WHERE `short`=0 AND `accountid` = ' . SessionAccountHandler::getId())->fetchAll();
            foreach ($sports as $sport) {
                $sports_not_short .= $sport['id'] . ',';
            }
        }
        $nights = DB::getInstance()->query('SELECT * FROM (
			SELECT
				id,
				time,
				s,
				sportid,
				distance,
				is_track,
				HOUR(FROM_UNIXTIME(`time`)) as `H`,
				MINUTE(FROM_UNIXTIME(`time`)) as `MIN`
			FROM `' . PREFIX . 'training`
			WHERE
				`sportid` IN(' . substr($sports_not_short, 0, -1) . ') AND
                                `accountid` = ' . SessionAccountHandler::getId() . ' AND
				(HOUR(FROM_UNIXTIME(`time`))!=0 OR MINUTE(FROM_UNIXTIME(`time`))!=0) 
				' . $this->getYearDependenceForQuery() . '
			ORDER BY
				ABS(12-(`H`+10)%24-`MIN`/60) ASC,
				`MIN` DESC LIMIT 20
			) t
		ORDER BY
			(`H`+12)%24 ASC,
			`MIN` ASC')->fetchAll();
        if (empty($nights)) {
            $this->dataIsMissing = true;
            return;
        }
        echo '<table class="fullwidth zebra-style">';
        echo '<thead><tr class="b c"><th colspan="8">' . __('Nightly activities') . '</th></tr></thead>';
        echo '<tbody>';
        foreach ($nights as $i => $data) {
            $Activity = new Activity\Entity($data);
            $Linker = new Linker($Activity);
            $View = new Dataview($Activity);
            if ($i % 2 == 0) {
                echo '<tr">';
            }
            echo '<td class="b">' . $View->daytime() . '</td>
				<td>' . $Linker->linkWithSportIcon() . '</td>
				<td>' . $View->distanceOrDuration() . ' ' . SportFactory::name($Activity->sportid()) . '</td>
				<td>' . $Linker->weekLink() . '</td>';
            if ($i % 2 == 1) {
                echo '</tr>';
            }
        }
        echo '</tbody></table>';
        // TODO: Find a better description.
        echo '<p class="text">';
        echo __('2 a.m. is considered as <em>most extreme</em> time for a training. ');
        echo __('The 20 trainings being nearest to that time are listed.');
        echo '</p>';
    }
Exemple #13
0
 /**
  * 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() . '&amp;mode=iframe" width="' . $this->width() . '" height="' . $this->height() . '"></iframe>';
 }
    /**
     * Display the table for routes with procentual highest elevation
     */
    private function displayUpwardData()
    {
        echo '<table style="width:48%;" style="margin:0 5px;" class="right zebra-style">';
        echo '<thead><tr class="b c"><th colspan="4">' . __('Steepest routes') . '</th></tr></thead>';
        echo '<tbody>';
        if (empty($this->UpwardData)) {
            echo '<tr><td colspan="4"><em>' . __('No routes found.') . '</em></td></tr>';
        }
        foreach ($this->UpwardData as $Data) {
            $Activity = new Activity\Object($Data);
            $Linker = new Linker($Activity);
            echo '<tr>
				<td class="small">' . $Linker->weekLink() . '</td>
				<td>' . $Linker->linkWithSportIcon() . '</td>
				<td>' . $this->labelFor($Data['route'], $Data['comment']) . '</td>
				<td class="r">
					' . round($Data['gradient'] / 10, 2) . '&nbsp;&#37;<br>
					<small>' . $Data['elevation'] . '&nbsp;m,&nbsp;' . $Data['distance'] . '&nbsp;km</small>
				</td>
			</tr>';
        }
        echo '</tbody></table>';
    }
 /**
  * Display prev/next navigation
  */
 protected function displayNavigation()
 {
     $prevId = Linker::prevId($this->Context->activity()->id(), $this->Context->activity()->timestamp());
     $nextId = Linker::nextId($this->Context->activity()->id(), $this->Context->activity()->timestamp());
     if ($prevId !== false) {
         echo Ajax::trainingLink($prevId, '<i class="fa fa-fw fa-chevron-left"></i>');
     } else {
         echo '<i class="transparent-70 fa-grey fa fa-fw fa-chevron-left"></i>';
     }
     if ($nextId !== false) {
         echo Ajax::trainingLink($nextId, '<i class="fa fa-fw fa-chevron-right"></i>');
     } else {
         echo '<i class="transparent-70 fa-grey fa fa-fw fa-chevron-right"></i>';
     }
 }