/**
  * 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();
 }
Beispiel #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();
 }
 /**
  * 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'));
 }
 /**
  * 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();
 }
 /**
  * Display form
  */
 protected function displayForm()
 {
     $Formular = new Formular(Plugin::$CONFIG_URL . '?id=' . $this->Plugin->id(), 'post');
     $Formular->addCSSclass('ajax');
     $Formular->addCSSclass('no-automatic-reload');
     $Formular->addHiddenValue('edit', 'true');
     $Formular->addFieldset($this->getFieldsetForDescription());
     $Formular->addFieldset($this->getFieldsetForValues());
     $Formular->addFieldset($this->getFieldsetForActivation());
     $Formular->setLayoutForFields(FormularFieldset::$LAYOUT_FIELD_W100);
     $Formular->display();
 }
Beispiel #6
0
/**
 * Window: explanations for calculations
 * @package Runalyze\Plugins\Panels
 */
require '../../inc/class.Frontend.php';
$Frontend = new Frontend();
?>
<div class="panel-heading">
	<h1><?php 
_e('Explanation: How are these experimental values calculated?');
?>
</h1>
</div>

<div class="panel-content">
<?php 
$Factory = new PluginFactory();
$Plugin = $Factory->newInstance('RunalyzePluginPanel_Rechenspiele');
$Formular = new Formular();
$Formular->setId('rechenspiele-calculator');
$Formular->addCSSclass('ajax');
$Formular->addCSSclass('no-automatic-reload');
$Formular->addFieldset($Plugin->getFieldsetTRIMP(), false);
$Formular->addFieldset($Plugin->getFieldsetVDOT(), false);
$Formular->addFieldset($Plugin->getFieldsetBasicEndurance());
$Formular->addFieldset($Plugin->getFieldsetPaces(), false);
$Formular->allowOnlyOneOpenedFieldset();
$Formular->display();
?>
</div>