/**
  * 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();
 }
Example #2
0
 /**
  * Get fieldset for files
  * @return \FormularFieldset
  */
 private function getFilesFieldset()
 {
     $Fieldset = new FormularFieldset(__('Unused files'));
     $Fieldset->addFileBlock($this->getBlockForFiles('../data/import/'));
     $Fieldset->addFileBlock($this->getBlockForFiles('../data/log/'));
     $Fieldset->addFileBlock($this->getBlockForFiles('../data/backup-tool/backup/'));
     $Fieldset->addFileBlock($this->getBlockForFiles('../data/backup-tool/import/'));
     $Fieldset->addBlock('<input type="submit" value="' . __('Clear directories') . '">');
     $Fieldset->setCollapsed();
     return $Fieldset;
 }
    /**
     * 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);
            }
        }
    }
Example #4
0
 /**
  * Add a fieldset to formular
  * @param FormularFieldset $Fieldset 
  * @param boolean $opened [optional]
  */
 public function addFieldset(FormularFieldset $Fieldset, $opened = true)
 {
     $Fieldset->setId($this->Id . '_legend_' . count($this->fieldsets));
     if (!$opened) {
         $Fieldset->setCollapsed();
     }
     $this->fieldsets[] = $Fieldset;
 }
Example #5
0
 /**
  * Get fieldset for files
  * @return \FormularFieldset
  */
 private function getFilesFieldset()
 {
     $Fieldset = new FormularFieldset(__('Unused files'));
     $Fieldset->addFileBlock($this->getBlockForFiles('/import/files/'));
     $Fieldset->addFileBlock($this->getBlockForFiles('/export/files/'));
     $Fieldset->addFileBlock($this->getBlockForFiles('../log/'));
     $Fieldset->addFileBlock($this->getBlockForFiles('../plugin/RunalyzePluginTool_DbBackup/backup/'));
     $Fieldset->addFileBlock($this->getBlockForFiles('../plugin/RunalyzePluginTool_DbBackup/import/'));
     $Fieldset->addBlock('<input type="submit" value="' . __('Clear directories') . '">');
     $Fieldset->setCollapsed();
     return $Fieldset;
 }
 /**
  * Display list with files 
  */
 protected function displayList()
 {
     $ListOfFiles = $this->getExistingFiles();
     $Fieldset = new FormularFieldset(__('Export data'));
     if (empty($ListOfFiles)) {
         $Fieldset->addFileBlock('<em>You did not export anything.</em>');
     } else {
         foreach ($ListOfFiles as $File) {
             $String = '';
             $FileNameParts = explode('-', $File);
             $Year = isset($FileNameParts[3]) ? $FileNameParts[3] : '';
             if (strlen($Year) == 8) {
                 $String .= '<strong>' . substr($Year, 6, 2) . '.' . substr($Year, 4, 2) . '.' . substr($Year, 0, 4) . ':</strong> ';
             }
             $String .= $File;
             $String .= ', ' . Filesystem::getFilesize(FRONTEND_PATH . $this->BackupPath . $File);
             $Fieldset->addFileBlock('<a href="inc/' . $this->BackupPath . $File . '" target="_blank">' . $String . '</a>');
         }
     }
     if ($this->importIsOnProgress) {
         $Fieldset->setCollapsed();
     }
     $Formular = new Formular();
     $Formular->setId('backup-list');
     $Formular->addFieldset($Fieldset);
     $Formular->display();
 }
Example #7
0
 /**
  * Get fieldset
  * @return FormularFieldset
  * @codeCoverageIgnore
  */
 public function getFieldset()
 {
     $Fieldset = new FormularFieldset(__('Laps'));
     $Fieldset->addField(new TrainingInputSplits());
     $Fieldset->addCSSclass(TrainingFormular::$ONLY_DISTANCES_CLASS);
     if ($this->areEmpty()) {
         $Fieldset->setCollapsed();
     }
     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);
 }
Example #9
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();
 }
 /**
  * Display elevation correction
  */
 protected function displayInformation()
 {
     $Fieldset = new FormularFieldset(__('Note for elevation data'));
     $Fieldset->setId('general-information');
     $Fieldset->setCollapsed();
     $Fieldset->addSmallInfo(__('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();
 }