/** * Activate difference * Add checkbox and warning for differences between handmade laps and total distance. */ public function activateHandmadeDifference() { $Checkbox = new FormularCheckbox('calculate-for-splits', __('Calculate values for handmade splits although total distance does not match.')); $Checkbox->setLayout(FormularFieldset::$LAYOUT_FIELD_W100_CHECKBOX); $this->Fieldset->addField($Checkbox); $this->Fieldset->addWarning(__('The total distance of your handmade laps differs from the gps distance.')); }
/** * 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', 8); $FieldsetCode = new FormularFieldset(__('HTML-Code')); $FieldsetCode->addField($CodeField); $FieldsetCode->addInfo(__('Add this code to your blog/website.')); $FieldsetPreview = new FormularFieldset(__('Preview')); $FieldsetPreview->addBlock($Code); if (!$this->Context->activity()->isPublic()) { $FieldsetPreview->addWarning(__('Your training is private: There is no link included.')); } $Formular = new Formular(); $Formular->addFieldset($FieldsetCode); $Formular->addFieldset($FieldsetPreview); $Formular->setLayoutForFields(FormularFieldset::$LAYOUT_FIELD_W100); $Formular->display(); }
/** * Get fieldset for server data * @return \FormularFieldset */ private function getServerDataFieldset() { $Fieldset = new FormularFieldset(__('Server information')); $Fieldset->addSmallInfo(__('PHP version:') . ' ' . PHP_VERSION); $Fieldset->addSmallInfo(__('MySQL version:') . ' ' . DB::getInstance()->getAttribute(PDO::ATTR_SERVER_VERSION)); $Fieldset->addSmallInfo(__('Time limit:') . ' ' . ini_get('max_execution_time')); $Fieldset->addSmallInfo(__('Memory limit:') . ' ' . ini_get('memory_limit')); $Fieldset->addSmallInfo(__('Upload limit:') . ' ' . ini_get('upload_max_filesize')); $Fieldset->addSmallInfo(__('Post limit:') . ' ' . ini_get('post_max_size')); if (Shell::isPerlAvailable()) { $Fieldset->addSmallInfo(__('Perl scripts can be used.')); } else { $Fieldset->addWarning(__('Perl scripts cannot be used.')); } $Fieldset->setCollapsed(); return $Fieldset; }
$Mode = StandardFormular::$SUBMIT_MODE_EDIT; $Shoe = new Shoe(Request::sendId()); } $Formular = new StandardFormular($Shoe, $Mode); if ($Formular->submitSucceeded()) { header('Location: window.schuhe.table.php'); ShoeFactory::clearCache(); exit; } if (Request::sendId() > 0) { $DeleteText = '<strong>' . __('Delete shoe') . ' »</strong>'; $DeleteUrl = $_SERVER['SCRIPT_NAME'] . '?delete=true&id=' . $Shoe->id(); $DeleteLink = Ajax::link($DeleteText, 'ajax', $DeleteUrl); if ($Shoe->getKm() != $Shoe->getAdditionalKm()) { $DeleteLink = __('The shoe cannot be deleted as long it is used for some activity.'); } $DeleteFieldset = new FormularFieldset(__('Delete shoe')); $DeleteFieldset->addWarning($DeleteLink); $Formular->addFieldset($DeleteFieldset); } $Factory = new PluginFactory(); $Plugin = $Factory->newInstance('RunalyzePluginPanel_Schuhe'); echo '<div class="panel-heading">'; echo '<div class="panel-menu"><ul><li>' . $Plugin->tableLink() . '</li></ul></div>'; echo '<h1>' . $Header . '</h1>'; echo '</div>'; echo '<div class="panel-content">'; $Formular->setId('shoe'); $Formular->setLayoutForFields(FormularFieldset::$LAYOUT_FIELD_W33); $Formular->display(); echo '</div>';
/** * Display fieldset: Delete training */ protected function initDeleteFieldset() { $DeleteText = '<strong>' . __('Permanently delete this activity') . ' »</strong>'; $DeleteUrl = $_SERVER['SCRIPT_NAME'] . '?delete=' . $this->dataObject->id(); $DeleteLink = Ajax::link($DeleteText, 'ajax', $DeleteUrl); $Fieldset = new FormularFieldset(__('Delete activity')); $Fieldset->addWarning($DeleteLink); $Fieldset->setCollapsed(); $this->addFieldset($Fieldset); }
/** * Get fieldset: description * @return \FormularFieldset */ protected function getFieldsetForDescription() { $Fieldset = new FormularFieldset(__('Description')); $Fieldset->addText($this->Plugin->description()); if ($this->Plugin->isInActive()) { $Fieldset->addWarning(__('The plugin is deactivated.')); } 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') . ' »</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); }
/** * 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(); }