/** * Get own links for toolbar navigation * @return array */ protected function getToolbarNavigationLinks() { $LinkList = array(); if ($this->Configuration()->value('for_weather')) { $LinkList[] = '<li>' . Ajax::window('<a href="plugin/' . $this->key() . '/window.php">' . Ajax::tooltip(Icon::$LINE_CHART, __('Show temperature plots')) . '</a>') . '</li>'; } return $LinkList; }
/** * 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); } }
/** * @param \Runalyze\Dataset\Context $context * @return string * @codeCoverageIgnore */ protected function inlineDropdownWithRealLinks(Context $context) { $id = $context->activity()->id(); $html = '<li>' . \Ajax::window('<a href="' . $context->linker()->editUrl() . '">' . \Icon::$EDIT . ' ' . __('Edit') . '</a> ', 'small') . '</li>'; $html .= '<li><span class="link" data-action="privacy" data-activityid="' . $id . '">' . $this->privacyIconAndLabel($context) . '</span></li>'; $html .= '<li><span class="link" data-action="delete" data-activityid="' . $id . '" data-confirm="' . __('Do you really want to delete this activity?') . '"><i class="fa fa-fw fa-trash"></i> ' . __('Delete activity') . '</span></li>'; $html .= $context->activity()->isPublic() ? '<li><a href="' . $context->linker()->publicUrl() . '" target="_blank" onclick="(arguments[0] || window.event).stopPropagation();">' . \Icon::$ATTACH . ' ' . __('Public link') . '</a></li>' : ''; return $html; }
/** * 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); } } }
/** * 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); } } }
/** * Get own links for toolbar navigation * @return array */ protected function getToolbarNavigationLinks() { $LinkList = array(); $LinkList[] = '<li>' . Ajax::window('<a href="plugin/' . $this->key() . '/window.php">' . Ajax::tooltip(Icon::$LINE_CHART, __('Show temperature plots')) . '</a>') . '</li>'; $LinkList[] = '<li class="with-submenu"><span class="link">' . __('Equipment types') . '</span><ul class="submenu">'; foreach ($this->EquipmentTypes as $EqType) { $LinkList[] = '<li>' . $this->getInnerLink($EqType->name(), false, false, $EqType->id()) . '</li>'; } $LinkList[] = '</ul></li>'; return $LinkList; }
/** * Display header */ protected function displayHeader() { $name = $this->Plugin instanceof PluginTool ? $this->Plugin->getWindowLink() : $this->Plugin->name(); $Links = array(); $Links[] = array('tag' => Ajax::window('<a href="' . ConfigTabPlugins::getExternalUrl() . '">' . __('back to overview') . '</a>')); echo '<div class="panel-heading">'; echo '<div class="panel-menu">'; echo Ajax::toolbarNavigation($Links); echo '</div>'; echo '<h1>' . __('Plugin configuration') . ': ' . $name . '</h1>'; echo '</div>'; }
/** * 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! }
/** * Get delete link for an entry * @param int $id * @return string */ public static function getDeleteLinkFor($id) { return Ajax::window('<a href="plugin/RunalyzePluginPanel_Sportler/window.sportler.php?id=' . $id . '&delete=true">' . Icon::$DELETE . '</a>'); }
/** * Get uninstall link * @param string $name [optional] default: delete-icon * @return string */ public static function uninstallLink($key, $name = '') { if ($name == '') { $name = Icon::$DELETE; } return Ajax::window('<a href="' . self::UNINSTALL_URL . '?key=' . $key . '">' . Ajax::tooltip($name, __('Uninstall plugin')) . '</a>'); }
/** * Link to plot * @param string $text * @param int $year * @param int $sportid * @param string $group * @param boolean $current * @return string */ private function link($text, $year, $sportid, $group, $current = false, $analysis = false) { if (!$analysis) { $analysis = $this->Analysis; } if (FrontendShared::$IS_SHOWN) { return Ajax::window('<li' . ($current ? ' class="active"' : '') . '><a href="' . DataBrowserShared::getBaseUrl() . '?view=' . (Request::param('type') == 'week' ? 'weekkm' : 'monthkm') . '&type=' . Request::param('type') . '&y=' . $year . '&sportid=' . $sportid . '&group=' . $group . '&analysis=' . $analysis . '">' . $text . '</a></li>'); } else { return Ajax::window('<li' . ($current ? ' class="active"' : '') . '><a href="' . self::$URL . '?type=' . Request::param('type') . '&y=' . $year . '&sportid=' . $sportid . '&group=' . $group . '&analysis=' . $analysis . '">' . $text . '</a></li>'); } }
/** * Get link for editing a shoe * @param int $id * @return string */ private function editLinkFor($id) { return Ajax::window('<a href="plugin/' . $this->key() . '/window.schuhe.php?id=' . $id . '">' . Ajax::tooltip(Icon::$EDIT, __('Edit')) . '</a>'); }
/** * Display exported files */ protected function displayExportedFiles() { $ListOfFiles = $this->getExistingFiles(); $Fieldset = new FormularFieldset(sprintf(__('Up to now you have exported <strong>%d</strong> trainings.'), count($ListOfFiles))); if (strlen(Request::param('delete')) > 0) { $index = (int) Request::param('delete'); if (!isset($ListOfFiles[$index - 1])) { $Fieldset->addWarning('Don\' do that!'); } else { $Fieldset->addInfo(__('The file has been removed.')); Filesystem::deleteFile('export/files/' . $ListOfFiles[$index - 1]); unset($ListOfFiles[$index - 1]); } } else { $Fieldset->setCollapsed(); } if (empty($ListOfFiles)) { $Fieldset->addFileBlock('<em>' . __('You did not export any training.') . '</em>'); } else { foreach ($ListOfFiles as $i => $File) { $String = $File . ', ' . Filesystem::getFilesize(FRONTEND_PATH . 'export/files/' . $File); $Link = '<a href="inc/export/files/' . $File . '" target="_blank">' . $String . '</a>'; $Delete = Ajax::window('<a class="right small" href="' . self::$URL . '?id=' . $this->TrainingID . '&delete=' . ($i + 1) . '">[' . __('delete') . ']</a>', 'small'); $Fieldset->addFileBlock($Delete . $Link); } } $Formular = new Formular(); $Formular->setId('export-list'); $Formular->addFieldset($Fieldset); $Formular->display(); }
/** * Method for getting the right symbol(s) * @see PluginPanel::getRightSymbol() */ protected function getRightSymbol() { $Links = ''; $Links .= '<li>' . Ajax::window('<a href="plugin/' . $this->key() . '/window.plot.php" ' . Ajax::tooltip('', __('Show form'), true, true) . '>' . Icon::$LINE_CHART . '</a>') . '</li>'; $Links .= '<li>' . Ajax::window('<a href="plugin/' . $this->key() . '/window.php" ' . Ajax::tooltip('', __('How are these values calculated?'), true, true) . '>' . Icon::$MAGIC . '</a>') . '</li>'; $Links .= '<li>' . Ajax::window('<a href="plugin/' . $this->key() . '/window.info.php" ' . Ajax::tooltip('', __('Explanations: What are VDOT and TRIMP?'), true, true) . '>' . Icon::$INFO . '</a>') . '</li>'; return '<ul>' . $Links . '</ul>'; }
/** * Get link for the config-window * @param string $name [optional], default: settings-icon * @param string $add_param [optional] additional parameter starting with '&...' * @return string */ public final function getConfigLink($name = '', $add_param = '') { if ($name == '') { $name = Icon::$CONF; } return Ajax::window('<a href="' . self::$CONFIG_URL . '?id=' . $this->id() . $add_param . '">' . $name . '</a>', 'small'); }
/** * Get link for create window for a given date * @param int $timestamp * @return string */ public static function linkForDate($timestamp) { if ($timestamp > time()) { return '<span style="opacity:.25;">' . Icon::$ADD_SMALL . '</span>'; } $date = date('d.m.Y', $timestamp); return Ajax::window('<a href="' . self::$URL . '?date=' . $date . '">' . Icon::$ADD_SMALL . '</a>', 'small'); }
/** * Set all fieldsets and fields */ public function setFieldsetsAndFields() { $Data = AccountHandler::getDataForId(SessionAccountHandler::getId()); FormularInput::setStandardSize(FormularInput::$SIZE_MIDDLE); $UsernameField = new FormularInput('name', __('Username'), $Data['username']); $UsernameField->setDisabled(); $MailField = new FormularInput('name', __('Email address'), $Data['mail']); $MailField->setDisabled(); $NameField = new FormularInput('name', __('Name'), $Data['name']); $LanguageField = new FormularSelectBox('language', __('Language'), $Data['language']); foreach (Language::availableLanguages() as $klang => $lang) { $LanguageField->addOption($klang, $lang[0]); } $SinceField = new FormularInput('name', __('Registered since'), date('d.m.Y H:i', $Data['registerdate'])); $SinceField->setDisabled(); $LastLoginField = new FormularInput('name', __('Last Login'), date('d.m.Y H:i', $Data['lastlogin'])); $LastLoginField->setDisabled(); $Account = new FormularFieldset(__('Your account')); $Account->addField($UsernameField); $Account->addField($MailField); $Account->addField($NameField); $Account->addField($LanguageField); $Account->addField($SinceField); $Account->addField($LastLoginField); $AllowMailsField = new FormularSelectBox('allow_mails', __('Email me'), $Data['allow_mails']); $AllowMailsField->addOption('1', __('Yes')); $AllowMailsField->addOption('0', __('No')); $Notifications = new FormularFieldset(__('Notifications')); $Notifications->addInfo(__('At irregular intervals we are sending mails to you. We will never send you spam or advertisement.')); $Notifications->addField($AllowMailsField); $Password = new FormularFieldset(__('Change your password')); if (empty($_POST['old_pw']) && empty($_POST['new_pw']) && empty($_POST['new_pw_repeat'])) { $Password->setCollapsed(); } else { // Don't show passwords as 'value="..."' $_POST['old_pw'] = ''; $_POST['new_pw'] = ''; $_POST['new_pw_repeat'] = ''; } $Password->addField(new FormularInputPassword('old_pw', __('Old password'))); $Password->addField(new FormularInputPassword('new_pw', __('New password'))); $Password->addField(new FormularInputPassword('new_pw_repeat', __('Repeat new password'))); $Backup = new FormularFieldset(__('Backup your data')); $Backup->setCollapsed(); $Factory = new PluginFactory(); if ($Factory->isInstalled('RunalyzePluginTool_DbBackup')) { $Plugin = $Factory->newInstance('RunalyzePluginTool_DbBackup'); $Backup->addInfo(__('Please use the plugin') . ' \'<strong>' . $Plugin->getWindowLink() . '</strong>\'.'); } else { $Backup->addInfo(__('The backup of all your data is not manually possible yet.<br>' . 'In important individual cases write us an e-mail to mail@runalyze.de and and we will take care of it right away!')); } $DeleteLink = Ajax::window('<a href="call/window.delete.php"><strong>' . __('Delete your account') . ' »</strong></a>') . '<br><br>' . __('You\'ll receive an email with a link to confirm the deletion.<br>' . 'The deletion is permanent and cannot be reversed. ' . 'Therefore, you should backup your data.'); $Delete = new FormularFieldset(__('Delete your account')); $Delete->setCollapsed(); $Delete->addWarning($DeleteLink); $this->Formular->addFieldset($Account); $this->Formular->addFieldset($Notifications); $this->Formular->addFieldset($Password); $this->Formular->addFieldset($Backup); $this->Formular->addFieldset($Delete); $this->Formular->setLayoutForFields(FormularFieldset::$LAYOUT_FIELD_W100); }
/** * Table link * @return string */ public function tableLink() { return Ajax::window('<a href="plugin/' . $this->key() . '/window.equipment.table.php">' . Icon::$TABLE . ' ' . __('Show all equipment') . '</a>'); }
<?php /** * File for uninstalling plugins. * Call: call.Plugin.uninstall.php?key= */ require '../inc/class.Frontend.php'; $Pluginkey = filter_input(INPUT_GET, 'key'); $Frontend = new Frontend(); $Installer = new PluginInstaller($Pluginkey); echo '<h1>' . __('Uninstall') . ' ' . $Pluginkey . '</h1>'; if ($Installer->uninstall()) { echo HTML::okay(__('The plugin has been uninstalled.')); PluginFactory::clearCache(); Ajax::setReloadFlag(Ajax::$RELOAD_ALL); echo Ajax::getReloadCommand(); } else { echo HTML::error(__('There was a problem, the plugin could not be uninstalled.')); } echo '<ul class="blocklist">'; echo '<li>'; echo Ajax::window('<a href="' . ConfigTabPlugins::getExternalUrl() . '">' . Icon::$TABLE . ' ' . __('back to list') . '</a>'); echo '</li>'; echo '</ul>';
<?php if (SessionAccountHandler::isLoggedIn()) { ?> <a class="tab right" href="login.php?out" title="<?php _e('Logout'); ?> "> <i class="fa fa-fw fa-lg fa-sign-out"></i> <?php _e('Logout'); ?> </a> <?php echo Ajax::window('<a class="tab right b" href="' . ConfigTabs::$CONFIG_URL . '?key=config_tab_account"><i class="fa fa-fw fa-lg fa-user"></i>' . NBSP . SessionAccountHandler::getUsername() . '</a>'); ?> <?php } ?> <span class="left b"> <?php echo Ajax::window('<a class="tab" href="' . ConfigTabs::$CONFIG_URL . '"><i class="fa fa-fw fa-lg fa-cog"></i>' . NBSP . __('Configuration') . '</a>'); ?> <?php echo Ajax::window('<a class="tab" href="' . PluginTool::$DISPLAY_URL . '"><i class="fa fa-fw fa-lg fa-dashboard"></i>' . NBSP . __('Tools') . '</a>'); ?> <?php echo Ajax::window('<a class="tab" href="' . Frontend::$HELP_URL . '"><i class="fa fa-fw fa-lg fa-question-circle"></i>' . NBSP . __('Help') . '</a>'); ?> </span> </div>
/** * Internal link to routenet * @param string $text * @param int $sportid * @param int $year * @return string */ private static function linkToRoutenet($text, $sportid, $year) { return Ajax::window('<a class="" href="plugin/RunalyzePluginStat_Strecken/window.routenet.php?sport=' . $sportid . '&y=' . $year . '">' . $text . '</a>', 'big'); }
/** * Get link to this tool as overlay * @param string $name * @param boolean $wrapAsContainer optional */ public function getWindowLink($name = '', $wrapAsContainer = false) { if ($name == '') { $name = $this->name(); } return Ajax::window('<a href="' . parent::$DISPLAY_URL . '?id=' . $this->id() . ($wrapAsContainer ? '&wrap=true' : '') . '">' . $name . '</a>', 'big'); }
/** * Get ajax-link for showing week-kilometer * @return string */ protected function getWeekKmLink() { return Ajax::window('<a href="' . self::getUrlForWeekKm() . '">' . Ajax::tooltip(Icon::$BARS_SMALL, __('Activity per week')) . '</a>'); }
/** * Method for getting the right symbol(s) * @see PluginPanel::getRightSymbol() */ protected function getRightSymbol() { $Links = ''; $Links .= '<li>' . Ajax::window('<a href="plugin/' . $this->key() . '/window.plot.php" ' . Ajax::tooltip('', __('Show prognosis trend'), true, true) . '>' . Icon::$LINE_CHART . '</a>') . '</li>'; $Links .= '<li>' . Ajax::window('<a href="plugin/' . $this->key() . '/window.php" ' . Ajax::tooltip('', __('Prognosis calculator'), true, true) . '>' . Icon::$CALCULATOR . '</a>') . '</li>'; return '<ul>' . $Links . '</ul>'; }
/** * Display standard values */ protected function displayStandardValues() { if ($this->manualElevation != $this->calculatedElevation) { $Linker = new Runalyze\View\Activity\Linker($this->Context->activity()); $useCalculatedValueLink = Ajax::window('<a class="small as-input" href="' . $Linker->urlToElevationInfo('use-calculated-value=true') . '">» ' . __('apply data') . '</a>', 'small'); } else { $useCalculatedValueLink = ''; } $Fieldset = new FormularFieldset(__('General data')); $Fieldset->setHtmlCode(' <div class="w50"> <label>' . Ajax::tooltip(__('manual value'), __('If you did not insert a value by hand, this value has been calculated.')) . '</label> <span class="as-input">' . $this->manualElevation . ' m</span> </div> <div class="w50"> <label>' . __('Lowest point') . '</label> <span class="as-input">' . $this->lowestPoint . ' m</span> </div> <div class="w50"> <label>' . Ajax::tooltip(__('calculated value'), __('This value is calculated with your current configuration. The saved value may be outdated.')) . '</label> <span class="as-input">' . $this->calculatedElevation . ' m</span> ' . $useCalculatedValueLink . ' </div> <div class="w50"> <label>' . __('Highest point') . '</label> <span class="as-input">' . $this->highestPoint . ' m</span> </div> <div class="w50"> <label>ø ' . __('Gradient') . '</label> <span class="as-input">' . $this->Context->dataview()->gradientInPercent() . '</span> </div> <div class="w50"> <label>' . __('Up/Down') . '</label> <span class="as-input">+' . $this->Context->route()->elevationUp() . 'm / -' . $this->Context->route()->elevationDown() . 'm</span> </div> '); $Fieldset->display(); }
/** * Get ajax-link for searching * @return string */ protected function getNaviSearchLink() { return Ajax::window('<a href="' . SearchLink::$WINDOW_URL . '" ' . Ajax::tooltip('', __('Search for an activity'), false, true) . '>' . Icon::$SEARCH . '</a>', 'big'); }
use Runalyze\Activity\Distance; require '../../inc/class.Frontend.php'; $Frontend = new Frontend(); $Factory = new PluginFactory(); $Plugin = $Factory->newInstance('RunalyzePluginPanel_Prognose'); $distances = $Plugin->getDistances(); if (!isset($_GET['distance'])) { $distance = in_array(10, $distances) ? 10 : trim($distances[0]); } else { $distance = (double) $_GET['distance']; } $Submenu = ''; foreach ($distances as $km) { $km = trim($km); $link = 'plugin/RunalyzePluginPanel_Prognose/window.plot.php?distance=' . $km; $Submenu .= '<li' . ($km == $distance ? ' class="active"' : '') . '>' . Ajax::window('<a href="' . $link . '">' . (new Distance($km))->stringAuto() . '</a>') . '</li>'; } ?> <div class="panel-heading"> <div class="panel-menu"> <ul> <li class="with-submenu"><span class="link"><?php _e('Choose distance'); ?> </span><ul class="submenu"><?php echo $Submenu; ?> </ul></li> </ul> </div> <h1><?php
* @package Runalyze\Plugins\Panels */ require '../../inc/class.Frontend.php'; $Frontend = new Frontend(); if (!isset($_GET['y'])) { $_GET['y'] = 'lasthalf'; } $link = 'plugin/RunalyzePluginPanel_Rechenspiele/window.plot.php?y=all'; $Submenu = '<li' . ('all' == $_GET['y'] ? ' class="active"' : '') . '>' . Ajax::window('<a href="' . $link . '">' . __('All years') . '</a>') . '</li>'; $link = 'plugin/RunalyzePluginPanel_Rechenspiele/window.plot.php?y=lasthalf'; $Submenu .= '<li' . ('lasthalf' == $_GET['y'] ? ' class="active"' : '') . '>' . Ajax::window('<a href="' . $link . '">' . __('Last half year') . '</a>') . '</li>'; $link = 'plugin/RunalyzePluginPanel_Rechenspiele/window.plot.php?y=lastyear'; $Submenu .= '<li' . ('lastyear' == $_GET['y'] ? ' class="active"' : '') . '>' . Ajax::window('<a href="' . $link . '">' . __('Last year') . '</a>') . '</li>'; for ($j = date('Y'); $j >= START_YEAR; $j--) { $link = 'plugin/RunalyzePluginPanel_Rechenspiele/window.plot.php?y=' . $j; $Submenu .= '<li' . ($j == $_GET['y'] ? ' class="active"' : '') . '>' . Ajax::window('<a href="' . $link . '">' . $j . '</a>') . '</li>'; } ?> <div class="panel-heading"> <div class="panel-menu"> <ul> <li class="with-submenu"><span class="link"><?php _e('Choose year'); ?> </span><ul class="submenu"><?php echo $Submenu; ?> </ul></li> </ul> </div> <h1><?php
/** * Init edit links * @param \Runalyze\View\Activity\Linker $linker */ protected function initEditLinks(Linker $linker) { if ($this->Context->activity()->isPublic()) { $privacyLabel = __('Make private'); $privacyIcon = 'fa-lock'; } else { $privacyLabel = __('Make public'); $privacyIcon = 'fa-unlock'; } $this->ToolbarLinks[] = '<li class="with-submenu"><span class="link"><i class="fa fa-fw fa-wrench"></i></span><ul class="submenu">'; $this->ToolbarLinks[] = '<li>' . Ajax::window('<a class="link" href="' . $linker->editUrl() . '">' . Icon::$EDIT . ' ' . __('Edit') . '</a> ', 'small') . '</li>'; $this->ToolbarLinks[] = '<li><a class="ajax" target="statistics-inner" href="call/call.Training.display.php?id=' . $this->Context->activity()->id() . '&action=changePrivacy"><i class="fa fa-fw ' . $privacyIcon . '"></i> ' . $privacyLabel . '</a></li>'; $this->ToolbarLinks[] = '<li><a class="ajax" target="statistics-inner" href="call/call.Training.display.php?id=' . $this->Context->activity()->id() . '&action=delete" data-confirm="' . __('Do you really want to delete this activity?') . '"><i class="fa fa-fw fa-trash"></i> ' . __('Delete activity') . '</a></li>'; $this->ToolbarLinks[] = '</ul></li>'; }