Esempio n. 1
0
 /**
  * Init general fieldsets
  */
 protected function initGeneralFieldset()
 {
     $this->Fieldset = new FormularFieldset(__('Search activities'));
     $this->addFieldSport();
     $this->addFieldTimeRange();
     $this->addFieldSort();
     $this->Fieldset->setLayoutForFields(FormularFieldset::$LAYOUT_FIELD_W50_IN_W33);
 }
Esempio n. 2
0
 /**
  * Create fieldset for configuration
  */
 protected function createFieldset()
 {
     $this->Fieldset = new FormularFieldset(__('Calculate laps'));
     $this->Fieldset->addField($this->lapDistanceField());
     $this->Fieldset->addField($this->lapTimeField());
     $this->Fieldset->addField($this->distancesField());
     $this->Fieldset->addField($this->timeField());
     $this->Fieldset->addField($this->paceField());
     $this->Fieldset->addField($this->timesField());
     $this->Fieldset->setLayoutForFields(FormularFieldset::$LAYOUT_FIELD_W33);
 }
 /**
  * Set attributes to fieldset
  * @param FormularFieldset $Fieldset
  * @param array $FieldsetArray
  */
 private function setAttributesToFieldset(FormularFieldset &$Fieldset, $FieldsetArray)
 {
     $Fieldset->setTitle($FieldsetArray['legend']);
     if (isset($FieldsetArray['layout'])) {
         $Fieldset->setLayoutForFields($FieldsetArray['layout']);
     }
     if (isset($FieldsetArray['css'])) {
         $Fieldset->addCSSclass($FieldsetArray['css']);
     }
     if (isset($FieldsetArray['conf'])) {
         $Fieldset->setConfValueToSaveStatus($FieldsetArray['conf']);
     }
 }
Esempio n. 4
0
 /**
  * Get fieldset for settings
  * @return \FormularFieldset
  */
 private function getSettingsFieldset()
 {
     FormularInput::setStandardSize(FormularInput::$SIZE_MIDDLE);
     $Fieldset = new FormularFieldset(__('Settings'));
     $Fieldset->addField(new FormularCheckbox('RUNALYZE_DEBUG', __('Debug mode')));
     $Fieldset->addField(new FormularCheckbox('USER_CANT_LOGIN', __('Maintenance mode')));
     $Fieldset->addField(new FormularCheckbox('USER_CAN_REGISTER', __('Users can register')));
     $Fieldset->addField(new FormularInput('GARMIN_API_KEY', Ajax::tooltip(__('Garmin API-key'), __('Needed for any online-version of the Garmin Communicator<br>see http://developer.garmin.com/web-device/garmin-communicator-plugin/get-your-site-key/'))));
     $Fieldset->addField(new FormularInput('PERL_PATH', __('Perl Path')));
     $Fieldset->addField(new FormularInput('TTBIN_PATH', __('TTBIN Converter Path')));
     $Fieldset->addField(new FormularInput('MAIL_SENDER', __('Sender e-mail')));
     $Fieldset->addField(new FormularInput('MAIL_NAME', __('Sender e-mail name')));
     $Fieldset->addField(new FormularInput('SMTP_HOST', __('SMTP: host')));
     $Fieldset->addField(new FormularInput('SMTP_PORT', __('SMTP: port')));
     $Fieldset->addField(new FormularInput('SMTP_SECURITY', __('SMTP: encryption')));
     $Fieldset->addField(new FormularInput('SMTP_USERNAME', __('SMTP: username')));
     $Fieldset->addField(new FormularInputPassword('SMTP_PASSWORD', __('SMTP: password')));
     $Fieldset->addField(new FormularInput('OPENWEATHERMAP_API_KEY', Ajax::tooltip(__('OpenWeatherMap API-Key'), __('Loading weather data requires an api key, see openweathermap.org/appid'))));
     $Fieldset->addField(new FormularInput('NOKIA_HERE_APPID', Ajax::tooltip(__('Nokia/Here App-ID'), __('Nokia maps require an app-id/-token, see developer.here.com'))));
     $Fieldset->addField(new FormularInput('NOKIA_HERE_TOKEN', Ajax::tooltip(__('Nokia/Here Token'), __('Nokia maps require an app-id/-token, see developer.here.com'))));
     $Fieldset->addField(new FormularSubmit(__('Save'), ''));
     $Fieldset->setLayoutForFields(FormularFieldset::$LAYOUT_FIELD_W100);
     if (!is_writable(FRONTEND_PATH . '../data/config.php')) {
         $Fieldset->addError(__('<strong>data/config.php</strong> is not writable') . ', <em>(chmod = ' . substr(decoct(fileperms(FRONTEND_PATH . '../data/config.php')), 1) . ')</em> ' . __('Changes can\'t be saved.'));
     }
     return $Fieldset;
 }
 /**
  * Init fieldset to remove data series
  */
 protected function initFieldsetToRemoveDataSeries()
 {
     $Fields = $this->fieldOptionsForDataSeriesToRemove();
     if (!empty($Fields)) {
         $Fieldset = new FormularFieldset(__('Remove data series'));
         $Fieldset->addInfo(__('You may want to remove a data series if a sensor, e.g. your heart rate strap, produced unusable data.'));
         $Fieldset->addWarning(__('Attention: This operation cannot be undone.'));
         $Fieldset->setCollapsed();
         foreach ($Fields as $field) {
             $Fieldset->addField($field);
         }
         $Fieldset->setLayoutForFields(FormularFieldset::$LAYOUT_FIELD_W100_CHECKBOX);
         $this->addFieldset($Fieldset);
     }
 }
Esempio n. 6
0
 /**
  * Get fieldset for tools
  * @return \FormularFieldset
  */
 private function getToolsFieldset()
 {
     $result = '';
     if (isset($_POST['hash']) && $this->isLoggedIn && $_POST['job'] == 'tools') {
         ob_start();
         include FRONTEND_PATH . 'plugin/cli.pluginmap.php';
         $result = ob_get_contents();
         ob_end_clean();
     }
     $Fieldset = new FormularFieldset(__('Tools'));
     $Fieldset->addField(new FormularCheckbox('read_plugins', __('Look for new plugins')));
     $Fieldset->addField(new FormularSubmit(__('Go'), ''));
     $Fieldset->setLayoutForFields(FormularFieldset::$LAYOUT_FIELD_W100);
     if (!empty($result)) {
         $Fieldset->addOkay($result);
     }
     if (!is_writable(FRONTEND_PATH . 'plugin/pluginmap.php')) {
         $Fieldset->addError(__('<strong>/inc/plugin/pluginmap.php</strong> is not writable') . ', <em>(chmod = ' . substr(decoct(fileperms(FRONTEND_PATH . 'plugin/pluginmap.php')), 1) . ')</em> ' . __('These tools will not work.'));
     }
     return $Fieldset;
 }
 /**
  * Display import form 
  */
 protected function displayImportForm()
 {
     $Fieldset = new FormularFieldset(__('Import file'));
     $Formular = new Formular($_SERVER['SCRIPT_NAME'] . '?id=' . $this->id());
     $Formular->setId('import-json-form');
     $Formular->addCSSclass('ajax');
     $Formular->addCSSclass('no-automatic-reload');
     $Formular->addHiddenValue('file', $_GET['file']);
     if (substr($_GET['file'], -8) != '.json.gz') {
         $Fieldset->addError(__('You can only import *.json.gz-files.'));
         Filesystem::deleteFile('../data/DbBackup/import/' . $_GET['file']);
     } else {
         require_once __DIR__ . '/class.RunalyzeJsonAnalyzer.php';
         $Analyzer = new RunalyzeJsonAnalyzer('../data/DbBackup/import/' . $_GET['file']);
         if ($Analyzer->fileIsOkay()) {
             $Fieldset->addField(new FormularCheckbox('overwrite_config', __('Overwrite general configuration'), true));
             $Fieldset->addField(new FormularCheckbox('overwrite_dataset', __('Overwrite dataset configuration'), true));
             $Fieldset->addField(new FormularCheckbox('overwrite_plugin', __('Overwrite plugins'), true));
             $Fieldset->addField(new FormularCheckbox('delete_trainings', __('Delete all old activities'), false));
             $Fieldset->addField(new FormularCheckbox('delete_user_data', __('Delete all old body values'), false));
             $Fieldset->addFileBlock(sprintf(__('There are <strong>%s</strong> activities in this file.'), $Analyzer->count('runalyze_training')));
             $Fieldset->addFileBlock(sprintf(__('There are <strong>%s</strong> body values in this file.'), $Analyzer->count('runalyze_user')));
             $Fieldset->setLayoutForFields(FormularFieldset::$LAYOUT_FIELD_W100);
             $Formular->addSubmitButton(__('Import'));
         } elseif (!$Analyzer->versionIsOkay()) {
             $Fieldset->addError(sprintf(__('Versions do not match! The backup is from %s but you are using %s.'), $Analyzer->fileVersion(), 'v' . RUNALYZE_VERSION));
         } else {
             $Fieldset->addError(__('The file seems to be corrupted.'));
             foreach ($Analyzer->errors() as $Error) {
                 $Fieldset->addError($Error);
             }
         }
     }
     $Formular->addFieldset($Fieldset);
     $Formular->display();
 }
Esempio n. 8
0
<div class="w50" id="login-window">
<?php 
FormularInput::setStandardSize(FormularInput::$SIZE_MIDDLE);
$Fieldset = new FormularFieldset(__('Administration'));
$Fieldset->addField(new FormularInput('user', __('Account'), 'admin'));
$Fieldset->addField(new FormularInputPassword('password', __('Password')));
$Fieldset->setLayoutForFields(FormularFieldset::$LAYOUT_FIELD_W100);
$Formular = new Formular();
$Formular->setId('admin-login');
$Formular->addFieldset($Fieldset);
$Formular->addSubmitButton(__('Login'));
$Formular->setSubmitButtonsCentered();
$Formular->display();
?>
</div>