/**
  * Init formular
  */
 protected function initFormular()
 {
     $this->Formular = new Formular();
     $this->Formular->setId('prognosis-calculator');
     $this->Formular->addCSSclass('ajax');
     $this->Formular->addCSSclass('no-automatic-reload');
     $this->Formular->addFieldset($this->FieldsetInput);
     $this->Formular->addFieldset($this->FieldsetResult);
     $this->Formular->addSubmitButton(__('Show prognosis'));
 }
示例#2
0
 /**
  * Display formular
  */
 private function displayFormular()
 {
     $this->Formular = new Formular($this->getUrl() . '&form=true');
     $this->setFieldsetsAndFields();
     $this->Formular->setId($this->key);
     $this->Formular->addCSSclass('ajax');
     $this->Formular->addCSSclass('no-automatic-reload');
     $this->Formular->addHiddenValue('configTabKey', $this->key);
     $this->Formular->addSubmitButton(__('Save'));
     $this->Formular->display();
 }
 /**
  * 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();
 }
<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>