/** * 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 files */ private function displayFiles() { $Formular = new Formular(); $Formular->setId('admin-files'); $Formular->addHiddenValue('hash-files', $this->getAdminHash()); $Formular->addFieldset($this->getFilesFieldset()); $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(); }
/** * 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(); }