/**
  * Set all fieldsets and fields
  */
 public function setFieldsetsAndFields()
 {
     $Types = new FormularFieldset(__('Activity types'));
     $Types->setHtmlCode($this->getCode());
     $Types->addInfo(__('Activity types are useful to seperate your training into different categories. ' . 'An activity type can only belong to one sport.'));
     $Types->addInfo(__('Finding your personal bests requires one type (for running) to be set as the \'Race\'-type.'));
     $this->Formular->addFieldset($Types);
 }
 /**
  * Set all fieldsets and fields
  */
 public function setFieldsetsAndFields()
 {
     $Clothes = new FormularFieldset(__('Your equipment'));
     $Clothes->setHtmlCode($this->getCode());
     $Clothes->addInfo(__('Equipment can be entered for additional statistics.<br>' . 'Category and abbreviation are used to order and display them in the form for editing an activity.'));
     $Clothes->addInfo(__('The category should be a number.'));
     $Clothes->addInfo(__('Just fill out the last row to add a new equipment.'));
     $this->Formular->addFieldset($Clothes);
 }
 /**
  * Display
  */
 public function display()
 {
     $Code = str_replace(array("\r", "\n", "\t"), array("", "", ""), $this->getHTMLCode());
     $CodeField = new FormularTextarea('code', __('Code'), $Code);
     $CodeField->addCSSclass('fullwidth');
     $CodeField->addAttribute('rows', 3);
     $FieldsetCode = new FormularFieldset(__('HTML-Code'));
     if (System::isAtLocalhost()) {
         $FieldsetCode->addError(__('Runalyze runs on a local server. Only people in your local network will be able to see the training.'));
     }
     $FieldsetCode->addField($CodeField);
     $FieldsetCode->addInfo(__('Add this code to your blog/website.'));
     $WidthField = new FormularInputNumber('width', __('Width'), $this->width());
     $WidthField->setLayout(FormularFieldset::$LAYOUT_FIELD_W50);
     $WidthField->setMin(200);
     $WidthField->setMax(600);
     $HeightField = new FormularInputNumber('height', __('Height'), $this->height());
     $HeightField->setLayout(FormularFieldset::$LAYOUT_FIELD_W50);
     $HeightField->setMin(200);
     $HeightField->setMax(600);
     $SubmitField = new FormularSubmit(__('Change size'), '');
     $FieldsetCode->addField($WidthField);
     $FieldsetCode->addField($HeightField);
     $FieldsetCode->addField($SubmitField);
     $FieldsetPreview = new FormularFieldset(__('Preview'));
     $FieldsetPreview->addBlock($Code);
     $Formular = new Formular($_SERVER['SCRIPT_NAME'] . '?type=IFrame&id=' . $this->Context->activity()->id());
     $Formular->addCSSclass('ajax');
     $Formular->addCSSclass('no-automatic-reload');
     $Formular->addFieldset($FieldsetCode);
     $Formular->addFieldset($FieldsetPreview);
     $Formular->setLayoutForFields(FormularFieldset::$LAYOUT_FIELD_W100);
     $Formular->display();
 }
 /**
  * Set all fieldsets and fields
  */
 public function setFieldsetsAndFields()
 {
     $Dataset = new FormularFieldset(__('Your Dataset'));
     $Dataset->setHtmlCode($this->getCode());
     $Dataset->addInfo(__('You can specify which values show up in the overview of your activities.') . '<br>' . __('This does not influence the detailed activity view, the form or any plugin.'));
     $this->Formular->addFieldset($Dataset);
 }
 /**
  * Set all fieldsets and fields
  */
 public function setFieldsetsAndFields()
 {
     $Sports = new FormularFieldset(__('Your sports'));
     $Sports->setHtmlCode($this->getCode() . $this->getInfoFieldsAfterCode());
     $Sports->addInfo(__('Hover over the headings if the abbreviations are unclear.'));
     $this->Formular->addFieldset($Sports);
 }
 /**
  * Set all fieldsets and fields
  */
 public function setFieldsetsAndFields()
 {
     $EquipmentType = new FormularFieldset(__('Your equipment categories'));
     $EquipmentType->setHtmlCode($this->getEquipmentTypeCode());
     $EquipmentType->addInfo(__('All your equipment is grouped into some categories. ' . 'For each category, you can define whether one or multiple objects of that category can belong to one activity. ' . 'In addition, you can specify to which sports a category belongs.'));
     $Equipment = new FormularFieldset(__('Your equipment'));
     $Equipment->setHtmlCode($this->getEquipmentCode() . $this->getJS());
     $Equipment->addInfo(__('RUNALYZE collects data and calculates statistics for each of your equipment objects. ' . 'To correctly estimate its lifetime you can specify a \'previous distance\' ' . 'which is added to its calculated distance, e.g. if you used your running shoes for 200 km before tracking them. ' . 'In addition, you can specify a start and end date for its usage. ' . 'Objects will be displayed as \'inactive\' as soon as you have entered an end date.'));
     $this->Formular->addFieldset($EquipmentType);
     $this->Formular->addFieldset($Equipment);
 }
 /**
  * Display the content
  * @see PluginPanel::displayContent()
  */
 protected function displayContent()
 {
     if (isset($_GET['delete'])) {
         System::clearCache();
     }
     $Fieldset = new FormularFieldset(__('Empty your cache'));
     $Fieldset->addInfo(self::getActionLink('<strong>' . __('Empty your cache') . '</strong>', 'delete=true'));
     $Formular = new Formular();
     $Formular->setId('cacheclean-form');
     $Formular->addFieldset($Fieldset);
     $Formular->display();
 }
 /**
  * Display
  */
 public function display()
 {
     $Code = str_replace(array("\r", "\n", "\t"), array("", "", ""), $this->getHTMLCode());
     $CodeField = new FormularTextarea('code', __('Code'), $Code);
     $CodeField->addCSSclass('fullwidth');
     $CodeField->addAttribute('rows', 8);
     $FieldsetCode = new FormularFieldset(__('HTML-Code'));
     $FieldsetCode->addField($CodeField);
     $FieldsetCode->addInfo(__('Add this code to your blog/website.'));
     $FieldsetPreview = new FormularFieldset(__('Preview'));
     $FieldsetPreview->addBlock($Code);
     if (!$this->Context->activity()->isPublic()) {
         $FieldsetPreview->addWarning(__('Your training is private: There is no link included.'));
     }
     $Formular = new Formular();
     $Formular->addFieldset($FieldsetCode);
     $Formular->addFieldset($FieldsetPreview);
     $Formular->setLayoutForFields(FormularFieldset::$LAYOUT_FIELD_W100);
     $Formular->display();
 }
 /**
  * Init fieldset for input data
  */
 protected function initFieldsetForInputData()
 {
     $this->FieldsetInput = new FormularFieldset(__('Input'));
     foreach ($this->InfoLines as $InfoMessage) {
         $this->FieldsetInput->addInfo($InfoMessage);
     }
     $FieldModel = new FormularSelectBox('model', __('Model'));
     $FieldModel->addOption('jack-daniels', 'Jack Daniels (VDOT)');
     $FieldModel->addOption('robert-bock', 'Robert Bock (CPP)');
     $FieldModel->addOption('herbert-steffny', 'Herbert Steffny');
     $FieldModel->addOption('david-cameron', 'David Cameron');
     $FieldModel->addAttribute('onchange', '$(\'#prognosis-calculator .only-\'+$(this).val()).closest(\'div\').show();$(\'#prognosis-calculator .hide-on-model-change:not(.only-\'+$(this).val()+\')\').closest(\'div\').hide();');
     $FieldModel->setLayout(FormularFieldset::$LAYOUT_FIELD_W50_AS_W100);
     $FieldDistances = new FormularInput('distances', __('Distances'));
     $FieldDistances->setLayout(FormularFieldset::$LAYOUT_FIELD_W50_AS_W100);
     $FieldDistances->setSize(FormularInput::$SIZE_FULL_INLINE);
     $this->FieldsetInput->addField($FieldModel);
     $this->FieldsetInput->addField($FieldDistances);
     $this->addFieldsForJackDaniels();
     $this->addFieldsForBockAndSteffny();
 }
 /**
  * Set all fieldsets and fields
  */
 public function setFieldsetsAndFields()
 {
     $Panels = new FormularFieldset(__('Panels'));
     $Panels->addInfo(__('Panels are small statistics always shown on the right side.'));
     $Panels->setHtmlCode($this->getCodeFor(PluginType::PANEL));
     $Panels->setCollapsed();
     $Stats = new FormularFieldset(__('Statistics'));
     $Stats->addInfo(__('Normal statistics are shown below the activitiy log.'));
     $Stats->setHtmlCode($this->getCodeFor(PluginType::STAT));
     $Tools = new FormularFieldset(__('Tools'));
     $Tools->addInfo(__('Complex tools for analyzing or processing the complete database will open in an overlay.'));
     $Tools->setHtmlCode($this->getCodeFor(PluginType::TOOL));
     $Tools->setCollapsed();
     $Install = new FormularFieldset(__('Install a new plugin'));
     $Install->addInfo(__('New plugins can be installed here.'));
     $Install->setHtmlCode($this->getCodeForInstall());
     $Install->setCollapsed();
     $this->Formular->addFieldset($Panels);
     $this->Formular->addFieldset($Stats);
     $this->Formular->addFieldset($Tools);
     $this->Formular->addFieldset($Install);
     $this->Formular->allowOnlyOneOpenedFieldset();
 }
Exemple #11
0
 /**
  * Display elevation correction
  */
 protected function displayInformation()
 {
     $Fieldset = new FormularFieldset(__('Note for elevation data'));
     $Fieldset->setId('general-information');
     $Fieldset->setCollapsed();
     $Fieldset->addInfo(__('The calculation of elevation data is very difficult - there is not one single solution. ' . 'Bad gps data can be corrected via srtm-data but these are only available in a 90x90m grid and not always perfectly accurate. ' . 'In addition, every platform uses another algorithm to determine the elevation value (for up-/downwards). ' . 'We give you therefore the possibility to choose algorithm and threshold such that the values fit your experience.'));
     $Fieldset->display();
 }
    /**
     * Init fieldset for correct elevation
     */
    protected function initElevationCorrectionFieldset()
    {
        if ($this->dataObject->get('routeid') > 0) {
            $Route = Runalyze\Context::Factory()->route($this->dataObject->get('routeid'));
            if ($Route->hasPositionData() && !$Route->hasCorrectedElevations()) {
                $Fieldset = new FormularFieldset(__('Use elevation correction'));
                $Fieldset->setCollapsed();
                $Fieldset->addInfo('
					<a class="ajax" target="gps-results" href="call/call.Training.elevationCorrection.php?id=' . $this->dataObject->id() . '"><strong>' . __('Correct elevation data') . '</strong></a><br>
					<br>
					<small id="gps-results" class="block">
						' . __('Elevation data via GPS is very inaccurate. Therefore you can correct it via some satellite data.') . '
					</small>');
                $this->addFieldset($Fieldset);
            }
        }
    }
Exemple #13
0
 /**
  * Add info for handmade laps
  */
 public function activateHandmadeInfo()
 {
     $this->Fieldset->addInfo(__('Leave lap distances empty to use your handmade laps.'));
 }
Exemple #14
0
 /**
  * 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();
 }
    /**
     * Get fieldset for paces
     * @return \FormularFieldset
     */
    public function getFieldsetPaces()
    {
        $Table = '<table class="fullwidth zebra-style">
				<thead>
					<tr>
						<th>' . __('Name') . '</th>
						<th class="small">' . __('Pace') . '</th>
						<th class="small">' . __('Description') . '</th>
					</tr>
				</thead>
				<tbody>';
        $VDOT = new VDOT(Configuration::Data()->vdot());
        foreach ($this->getArrayForPaces() as $Pace) {
            $Table .= '<tr>
						<td class="b">' . $Pace['short'] . '</td>
						<td class=""><em>' . Duration::format($VDOT->paceAt($Pace['limit-low'] / 100)) . '</em>&nbsp;-&nbsp;<em>' . Duration::format($VDOT->paceAt($Pace['limit-high'] / 100)) . '</em>/km</td>
						<td class="">' . $Pace['description'] . '</td>
					</tr>';
        }
        $Table .= '
				</tbody>
			</table>';
        $Fieldset = new FormularFieldset(__('Training paces'));
        $Fieldset->addBlock($Table);
        $Fieldset->addInfo(__('These paces are based on Jack Daniels\' recommendation.'));
        return $Fieldset;
    }
 /**
  * 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') . ' &raquo;</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);
 }
 /**
  * Display form: import finished 
  */
 protected function displayImportFinish()
 {
     require_once __DIR__ . '/class.RunalyzeBulkInsert.php';
     require_once __DIR__ . '/class.RunalyzeJsonImporterResults.php';
     require_once __DIR__ . '/class.RunalyzeJsonImporter.php';
     $fileName = '../data/DbBackup/import/' . $_POST['file'];
     $Importer = new RunalyzeJsonImporter($fileName);
     $Importer->importData();
     Filesystem::deleteFile($fileName);
     Ajax::setReloadFlag(Ajax::$RELOAD_ALL);
     $Fieldset = new FormularFieldset(__('Import data'));
     $Fieldset->addText(__('All data have been imported.'));
     $Fieldset->addText(__('It is recommended to use the <em>Database cleanup</em> tool.'));
     $Fieldset->addInfo($Importer->resultsAsString());
     $Fieldset->addBlock(Ajax::getReloadCommand());
     $Formular = new Formular();
     $Formular->setId('import-finished');
     $Formular->addFieldset($Fieldset);
     $Formular->display();
 }
 /**
  * Get fieldset: activation
  * @return \FormularFieldset
  */
 protected function getFieldsetForActivation()
 {
     $activationLink = $this->Plugin->isInActive() ? $this->Plugin->getConfigLink(__('Activate plugin'), '&active=' . Plugin::ACTIVE) : $this->Plugin->getConfigLink(__('Deactivate plugin'), '&active=' . Plugin::ACTIVE_NOT);
     $Fieldset = new FormularFieldset(__('Activation'));
     $Fieldset->addInfo($activationLink);
     return $Fieldset;
 }
    /**
     * Get fieldset for paces
     * @return \FormularFieldset
     */
    public function getFieldsetPaces()
    {
        $Table = '<table class="fullwidth zebra-style">
				<thead>
					<tr>
						<th>' . __('Name') . '</th>
						<th class="small">' . __('Pace') . '</th>
						<th class="small">' . __('Description') . '</th>
					</tr>
				</thead>
				<tbody>';
        $VDOT = new VDOT(Configuration::Data()->vdot());
        $PaceObject = new Runalyze\Activity\Pace(0, 1, SportFactory::getSpeedUnitFor(Configuration::General()->runningSport()));
        foreach ($this->getArrayForPaces() as $Pace) {
            $Table .= '<tr>
						<td class="b">' . $Pace['short'] . '</td>
						<td class=""><em>' . $PaceObject->setTime($VDOT->paceAt($Pace['limit-high'] / 100))->value() . '</em> - <em>' . $PaceObject->setTime($VDOT->paceAt($Pace['limit-low'] / 100))->value() . '</em>' . $PaceObject->appendix() . '</td>
						<td class="">' . $Pace['description'] . '</td>
					</tr>';
        }
        $Table .= '
				</tbody>
			</table>';
        $Fieldset = new FormularFieldset(__('Training paces'));
        $Fieldset->addBlock($Table);
        $Fieldset->addInfo(__('These paces are based on Jack Daniels\' recommendation.'));
        return $Fieldset;
    }