/** * Get fieldset block * @return string */ private function getFieldsetBlock() { $String = ''; foreach ($this->TrainingObjects as $i => $TrainingObject) { $activityIDs[] = $TrainingObject->getActivityId(); } $duplicates = (new DuplicateFinder(DB::getInstance(), SessionAccountHandler::getId()))->checkForDuplicates($activityIDs); $countDuplicates = count(array_filter($duplicates)); $String .= HTML::info(sprintf(__('Found %s activities.'), count($this->TrainingObjects))); if ($countDuplicates > 0) { $String .= HTML::warning(_n('Found <strong>one</strong> duplicate activity.', 'Found duplicate activities.', $countDuplicates)); } $String .= '<table class="fullwidth multi-import-table zebra-style c" id="multi-import-table">'; $String .= '<thead><tr><th>' . __('Import') . '</th><th>' . __('Date') . '</th><th>' . __('Duration') . '</th><th>' . __('Distance') . '</th><th colspan="4"></th></tr></thead>'; $String .= '<tbody>'; foreach ($this->TrainingObjects as $i => $TrainingObject) { $String .= '<tr>' . $this->getTableRowFor($TrainingObject, $i, $duplicates[$TrainingObject->getActivityId()]) . '</tr>'; } $String .= '</tbody>'; $String .= '</table>'; $String .= Ajax::wrapJSforDocumentReady(' $("#multi-import-table td").click(function(e){ if ($(e.target).closest(\'input[type="checkbox"]\').length == 0) $(this).parent().find(\'input:checkbox\').attr(\'checked\', !$(this).parent().find(\'input:checkbox\').attr(\'checked\')); }); '); return $String; }
/** * Display long description */ protected function displayLongDescription() { echo HTML::p(__('This plugin lists all your races. It shows you a summary of all your races and ' . 'your personal bests (over all distances with at least two results).')); echo HTML::p(__('In addition, it plots the trend of your results over a specific distance.' . 'If you run a race just for fun, you can mark it as a \'fun race\' to ignore it in the plot.')); echo HTML::info(__('You can define the activity type for races in your configuration.')); echo HTML::warning(__('Make sure that your activities hold the correct distance.' . 'Only races with exactly 10.00 km will be considered as a race over 10 kilometers.')); }
/** * 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); } }
/** * Display */ public function display() { $url = 'https://twitter.com/share?url=' . $this->getPublicURL() . '&text=' . $this->getText() . '&via=RunalyzeDE'; $Linklist = new BlocklinkList(); $Linklist->addCompleteLink($this->externalLink($url, __('Tweet!'))); $Linklist->display(); echo HTML::info(__('You will be forwared to Twitter, where you can define which text shall be displayed.')); }
/** * 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); } } }
/** * Set plot */ protected function setRightContent() { $this->addRightContent('plot', __('Heartrate plot'), new Activity\Plot\Heartrate($this->Context)); if ($this->Context->trackdata()->has(\Runalyze\Model\Trackdata\Entity::HEARTRATE) && $this->Context->trackdata()->has(\Runalyze\Model\Trackdata\Entity::TIME)) { $Table = new TableZonesHeartrate($this->Context); $Code = $Table->getCode(); $Code .= HTML::info(__('You\'ll be soon able to configure your own zones.')); $this->addRightContent('zones', __('Heartrate zones'), $Code); } }
/** * Display */ public function display() { if (!$this->Context->activity()->isPublic()) { echo HTML::error(__('This training is private and cannot be shared.')); return; } $Linklist = new BlocklinkList(); $Linklist->addCompleteLink($this->externalLink($this->getUrl(), __('Share!'))); $Linklist->display(); echo HTML::info(__('You will be forwarded to Facebook, where you can define which text shall be displayed.')); $this->throwLinkErrorForLocalhost(); }
/** * Display */ public function display() { if (!$this->Context->activity()->isPublic()) { echo HTML::error(__('This training is private and cannot be shared.')); return; } $url = 'https://plus.google.com/share?url=' . urlencode($this->getPublicURL()) . '&h1=de'; $Linklist = new BlocklinkList(); $Linklist->addCompleteLink($this->externalLink($url, __('Share +1'))); $Linklist->display(); echo HTML::info(__('You will be forwared to Google+, where you can define which text shall be displayed.')); $this->throwLinkErrorForLocalhost(); }
/** * 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! }
/** * Display */ public final function display() { $this->setFileContent(); $this->writeFile(); if (count($this->getAllErrors()) > 0) { foreach ($this->getAllErrors() as $Error) { echo HTML::error($Error); } } else { echo HTML::info(' ' . __('Your activity has been exported.') . '<br> <br> <a href="inc/export/files/' . $this->getFilename() . '"><strong>' . __('Download') . ': ' . $this->getFilename() . '</strong></a> '); } }
/** * Get fieldset block * @return string */ private function getFieldsetBlock() { $String = ''; $String .= HTML::info(sprintf(__('Found %s activities.'), count($this->TrainingObjects))); $String .= '<table class="fullwidth multi-import-table zebra-style c" id="multi-import-table">'; $String .= '<thead><tr><th>' . __('Import') . '</th><th>' . __('Date') . '</th><th>' . __('Duration') . '</th><th>' . __('Distance') . '</th><th colspan="4"></th></tr></thead>'; $String .= '<tbody>'; foreach ($this->TrainingObjects as $i => $TrainingObject) { $String .= '<tr>' . $this->getTableRowFor($TrainingObject, $i) . '</tr>'; } $String .= '</tbody>'; $String .= '</table>'; $String .= Ajax::wrapJSforDocumentReady(' $("#multi-import-table td").click(function(e){ if ($(e.target).closest(\'input[type="checkbox"]\').length == 0) $(this).parent().find(\'input:checkbox\').attr(\'checked\', !$(this).parent().find(\'input:checkbox\').attr(\'checked\')); }); '); return $String; }
<?php /** * Delete Account * Call: call/window.delete.php */ require '../inc/class.Frontend.php'; $Frontend = new Frontend(); $Errors = array(); AccountHandler::setAndSendDeletionKeyFor($Errors); echo HTML::h1(__('Delete your account.')); if (!empty($Errors)) { foreach ($Errors as $Error) { echo HTML::error($Error); } } else { echo HTML::info(__('<em>A confirmation has been sent via mail.</em><br>' . 'How sad, that you\'ve decided to delete your account.<br>' . 'Your account will be deleted as soon as you click on the confirmation link in your mail.')); }
/** * Get code for * @param string $PluginType * @return string */ private function getCodeFor($PluginType) { $Factory = new PluginFactory(); $Plugins = $Factory->completeData($PluginType); usort($Plugins, $this->pluginOrderFunction()); if (empty($Plugins)) { return HTML::info(__('No plugins available.')); } $Code = ' <table class="zebra-style fullwidth more-padding"> <thead> <tr class="top b"> <th colspan="3">' . PluginType::readableString($PluginType) . '</th> <th>' . __('Mode') . '</th> <th>' . __('Order') . '</th> <th></th> </tr> </thead> <tbody>'; foreach ($Plugins as $Data) { $Plugin = $Factory->newInstance($Data['key']); if ($Plugin === false) { $Code .= ' <tr class="unimportant"> <td>' . PluginInstaller::uninstallLink($Plugin->key()) . '</td> <td class="b">' . $Plugin->key() . '</td> <td colspan="4">' . __('The plugin cannot be found.') . '</td> </tr>'; } else { $Code .= ' <tr class="a' . ($Plugin->isInActive() ? ' unimportant' : '') . '"> <td>' . $Plugin->getConfigLink() . '</td> <td class="b">' . $Plugin->name() . '</td> <td>' . $Plugin->description() . '</td> <td><select name="plugin_modus_' . $Plugin->id() . '"> <option value="' . Plugin::ACTIVE . '"' . HTML::Selected($Plugin->isActive()) . '>' . __('enabled') . '</option> <option value="' . Plugin::ACTIVE_VARIOUS . '"' . HTML::Selected($Plugin->isHidden()) . '>' . __('hidden*') . '</option> <option value="' . Plugin::ACTIVE_NOT . '"' . HTML::Selected($Plugin->isInActive()) . '>' . __('not enabled') . '</option> </select></td> <td><input type="text" name="plugin_order_' . $Plugin->id() . '" size="3" value="' . $Plugin->order() . '"></td> <td>' . PluginInstaller::uninstallLink($Plugin->key()) . '</td> </tr>'; } } $Code .= ' </tbody> </table>'; switch ($PluginType) { case 'panel': $Code .= HTML::info(__('* Hidden plugins only show their headings.')); break; case 'stat': $Code .= HTML::info(__('* Hidden plugins are grouped as \'Miscellaneous\'.')); break; case 'tool': default: $Code .= ''; } return $Code; }
/** * Get code for * @param string $PluginType * @return string */ private function getCodeFor($PluginType) { $Factory = new PluginFactory(); $Plugins = $Factory->completeData($PluginType); usort($Plugins, $this->pluginOrderFunction()); if (empty($Plugins)) { return HTML::info(__('No plugins available.')); } $Code = ' <table class="zebra-style fullwidth more-padding"> <thead> <tr class="top b"> <th colspan="3">' . PluginType::readableString($PluginType) . '</th> <th>' . __('Mode') . '</th> <th>' . __('Order') . '</th> <th></th> </tr> </thead> <tbody>'; foreach ($Plugins as $pos => $Data) { $Plugin = $Factory->newInstance($Data['key']); if ($Plugin === false) { $Code .= ' <tr class="unimportant"> <td>' . PluginInstaller::uninstallLink($Plugin->key()) . '</td> <td class="b">' . $Plugin->key() . '</td> <td colspan="4">' . __('The plugin cannot be found.') . '</td> </tr>'; } else { $Code .= ' <tr id="' . $Plugin->id() . '_tr" class="a' . ($Plugin->isInActive() ? ' unimportant' : '') . '"> <td>' . $Plugin->getConfigLink() . '</td> <td class="b">' . $Plugin->name() . '</td> <td>' . $Plugin->description() . '</td> <td><select name="plugin_modus_' . $Plugin->id() . '"> <option value="' . Plugin::ACTIVE . '"' . HTML::Selected($Plugin->isActive()) . '>' . __('enabled') . '</option> <option value="' . Plugin::ACTIVE_VARIOUS . '"' . HTML::Selected($Plugin->isHidden()) . '>' . __('hidden*') . '</option> <option value="' . Plugin::ACTIVE_NOT . '"' . HTML::Selected($Plugin->isInActive()) . '>' . __('not enabled') . '</option> </select></td> <td style="white-space:nowrap;"> <input class="plugin-position" type="text" name="plugin_order_' . $Plugin->id() . '" size="3" value="' . ($pos + 1) . '"> <span class="link" onclick="pluginMove(' . $Plugin->id() . ', \'up\')">' . Icon::$UP . '</span> <span class="link" onclick="pluginMove(' . $Plugin->id() . ', \'down\')">' . Icon::$DOWN . '</span> </td> <td>' . PluginInstaller::uninstallLink($Plugin->key()) . '</td> </tr>'; } } $Code .= ' </tbody> </table>'; $Code .= Ajax::wrapJS(' function pluginMove(id, way) { var pos = parseInt($("input[name=\'plugin_order_"+id+"\']").val()), tr = $("#"+id+"_tr"); if (way == "up" && pos > 1) { $("#"+id+"_tr .plugin-position").val(pos-1); tr.prev().find(".plugin-position").val(pos); tr.prev().toggleClass("swapped"); tr.prev().before(tr); } else if (way == "down" && tr.next().find(".plugin-position").val() > 0) { $("#"+id+"_tr .plugin-position").val(pos+1); tr.next().find(".plugin-position").val(pos); tr.next().toggleClass("swapped"); tr.next().after(tr); } tr.toggleClass("swapped"); } '); switch ($PluginType) { case 'panel': $Code .= HTML::info(__('* Hidden plugins only show their headings.')); break; case 'stat': $Code .= HTML::info(__('* Hidden plugins are grouped as \'Miscellaneous\'.')); break; case 'tool': default: $Code .= ''; } return $Code; }
/** * Display the content * @see PluginPanel::displayContent() */ protected function displayContent() { $this->lookupPersonalBests(); $this->prepareForPrognosis(); foreach ($this->getDistances() as $km) { $this->showPrognosis($km); } if ($this->thereAreNotEnoughCompetitions()) { echo HTML::info(__('There are not enough results for good predictions.')); } }
/** * Finish result table */ protected function finishResultTable() { $this->ResultTable .= '</tbody></table>'; if ($_POST['model'] == 'robert-bock' && $this->PrognosisStrategies['robert-bock'] instanceof Prognosis\Bock) { $K = $this->PrognosisStrategies['robert-bock']->getK(); $e = $this->PrognosisStrategies['robert-bock']->getE(); $this->ResultTable .= HTML::info(sprintf(__('The results give the constants K = %f and e = %f.'), $K, $e)) . '<br>'; } }
/** * Display uploader */ protected function displayImportUploader() { $JScode = ' new qq.FineUploaderBasic({ button: $("#file-upload")[0], request: { endpoint: \'' . $_SERVER['SCRIPT_NAME'] . '?hideHtmlHeader=true&id=' . $this->id() . '&json=true\' }, callbacks: { onError: function(id, name, errorReason, xhr) { $("#upload-container").append(\'<p class="error appended-by-uploader">\'+errorReason+\'</p>\').removeClass("loading"); }, onSubmit: function(id, fileName) { $("#upload-container").addClass("loading"); }, onComplete: function(id, fileName, responseJSON) { $(".appended-by-uploader").remove(); $("#pluginTool").loadDiv(\'' . $_SERVER['SCRIPT_NAME'] . '?id=' . $this->id() . '&file=\'+encodeURIComponent(fileName)); if (!responseJSON.success) { if (responseJSON.error == "") responseJSON.error = \'An unknown error occured.\'; $("#pluginTool").append(\'<p class="error appended-by-uploader">\'+fileName+\': \'+responseJSON.error+\'</p>\'); $("#upload-container").removeClass("loading"); } } } });'; $Text = '<div id="upload-container" style="margin-bottom:5px;"><div class="c button" id="file-upload">' . __('Upload file') . '</div></div>'; $Text .= Ajax::wrapJSasFunction($JScode); $Text .= HTML::info(__('Allowed file extension: *.json.gz')); $Text .= HTML::warning(__('All shared links will be invalid if you (re-)import activities and overwrite all existing activities!')); $Text .= HTML::warning(__('The file has to be created with the same version of Runalyze!<br>' . 'You won\'t be able to import a file from an older version.')); $Text .= HTML::warning(__('The importer will not change existing data for equipment, sport types or activity types.<br>' . 'You have to make these changes by hand or delete the existing data in advance.')); $Fieldset = new FormularFieldset(__('Import data')); $Fieldset->setCollapsed(); $Fieldset->addBlock($Text); $Formular = new Formular(); $Formular->setId('backup-import'); $Formular->addFieldset($Fieldset); $Formular->display(); }
/** * Display additional info */ protected function displayInfos() { if ($this->showsAverage()) { $BasicEndurance = new BasicEndurance(); $BasicEndurance->readSettingsFromConfiguration(); echo HTML::info(__('Goal and average are based on current basic endurance calculations.')); } }
/** * Display the content * @see PluginPanel::displayContent() */ protected function displayContent() { $this->showValues(); if ($this->Configuration()->value('show_trainingpaces')) { $this->showPaces(); } if (Time::diffInDays(START_TIME) < 70) { echo HTML::info(__('There are not enough activities for good calculations.')); } }
/** * Display privacy information */ protected function displayPrivacyInfo() { $Factory = Runalyze\Context::Factory(); $Activity = $Factory->activity($this->TrainingID); if (!$Activity->isPublic()) { echo HTML::info(__('The training is currently <strong>private</strong>') . '<br> ' . Ajax::window('<a href="' . self::$URL . '?id=' . $this->TrainingID . '&public=true"> » ' . __('make it public') . '</a>', 'small')); } else { echo HTML::info(__('The training is currently <strong>public</strong>') . '<br> ' . Ajax::window('<a href="' . self::$URL . '?id=' . $this->TrainingID . '&public=false"> » ' . __('make it private') . '</a>', 'small')); } }
/** * Display the analysis */ private function displayAnalysis() { if (empty($this->AnalysisData)) { echo HTML::info(__('There is no data for this sport.')); } foreach ($this->AnalysisData as $i => $Data) { if (!is_array($Data)) { continue; } $this->printTableStart($Data['name']); if (empty($Data['foreach'])) { echo '<tr class="c">' . HTML::emptyTD($this->colspan, '<em>' . __('No data available.') . '</em>') . '</tr>'; } else { foreach ($Data['foreach'] as $i => $Each) { echo '<tr><td class="c b">' . $Each['name'] . '</td>'; for ($t = $this->timer_start; $t <= $this->timer_end; $t++) { if (isset($Data['array'][$Each['id']][$t])) { $num = $Data['array'][$Each['id']][$t]['num']; $dist = $Data['array'][$Each['id']][$t]['distance']; $time = $Data['array'][$Each['id']][$t]['s']; if ($this->dat == 'km') { $percent = $Data['array']['timer_sum_km'][$t] > 0 ? round(100 * $dist / $Data['array']['timer_sum_km'][$t], 1) : 0; } else { $percent = $Data['array']['timer_sum_s'][$t] > 0 ? round(100 * $time / $Data['array']['timer_sum_s'][$t], 1) : 0; } $this->displayTDfor($num, $time, $dist, $percent); } else { echo HTML::emptyTD(); } } if (isset($Data['array']['id_sum_s'][$Each['id']])) { $num = $Data['array']['id_sum_num'][$Each['id']]; $time = $Data['array']['id_sum_s'][$Each['id']]; $dist = $Data['array']['id_sum_km'][$Each['id']]; if ($this->dat == 'km') { $percent = $Data['array']['all_sum_km'] > 0 ? round(100 * $dist / $Data['array']['all_sum_km'], 1) : 0; } else { $percent = $Data['array']['all_sum_s'] > 0 ? round(100 * $time / $Data['array']['all_sum_s'], 1) : 0; } $this->displayTDfor($num, $time, $dist, $percent); } else { echo HTML::emptyTD(); } echo '</tr>'; } if ($i == count($Data['foreach']) - 1) { echo '<tr class="top-spacer no-zebra"><td class="c b">' . __('Total') . '</td>'; for ($t = $this->timer_start; $t <= $this->timer_end; $t++) { if (isset($Data['array']['timer_sum_km'][$t])) { if ($this->Sport->usesDistance() && $this->dat != 's') { echo '<td>' . Distance::format($Data['array']['timer_sum_km'][$t], false, 0) . '</td>'; } else { echo '<td>' . Duration::format($Data['array']['timer_sum_s'][$t]) . '</td>'; } } else { echo HTML::emptyTD(); } } if ($this->Sport->usesDistance() && $this->dat != 's') { echo '<td>' . Distance::format($Data['array']['all_sum_km'], false, 0) . '</td></tr>'; } else { echo '<td>' . Duration::format($Data['array']['all_sum_s']) . '</td></tr>'; } } } $this->printTableEnd(); } }
/** * Get info fields * @return string */ private function getInfoFieldsAfterCode() { $Code = HTML::info(__('<em>Ø HF</em> is necessary for the calculation of TRIMP.')); return $Code; }
/** * Add weather sources */ protected function addWeatherSourceInfo() { if ($this->Context->activity()->weather()->sourceIsKnown()) { $this->NotesContent .= HTML::info(sprintf(__('Source of weather data: %s'), $this->Context->activity()->weather()->sourceAsString())); } }
<?php if (isset($_POST['new_username'])) { if (is_array($Errors)) { foreach ($Errors as $Error) { if (is_array($Error)) { foreach ($Error as $String) { echo HTML::error($String); } } else { echo HTML::error($Error); } } } elseif (System::isAtLocalhost()) { echo HTML::info(__('You can login now. Enjoy Runalyze!')); } else { echo HTML::info(__('Thanks for your registration. You should receive an email within the next minutes with further instructions for activating your account.')); } } ?> </fieldset> <?php if (USER_CAN_REGISTER) { ?> <div class="c"> <input type="submit" value="<?php _e('Register'); ?> " name="submit"> </div> <?php
/** * Throw error: empty list */ private function throwErrorForEmptyList() { echo HTML::info(__('No exporter could be located.')); }
/** * Finish result table */ protected function finishResultTable() { $this->ResultTable .= '</tbody></table>'; if ($_POST['model'] == 'robert-bock' && $this->PrognosisStrategies['robert-bock'] instanceof Prognosis\Bock) { $K = $this->PrognosisStrategies['robert-bock']->getK(); $e = $this->PrognosisStrategies['robert-bock']->getE(); $this->ResultTable .= HTML::info(sprintf(__('The results give the constants K = %f and e = %f.'), $K, $e)) . '<br>'; if (!$this->PrognosisObject->isValid()) { $this->ResultTable .= HTML::warning(sprintf(__('K must be between %u and %u, e between %f and %f.'), Prognosis\Bock::K_LOWER_BOUND, Prognosis\Bock::K_UPPER_BOUND, Prognosis\Bock::E_LOWER_BOUND, Prognosis\Bock::E_UPPER_BOUND)); } } }