/** * Display row for config form * @return FormularField */ public function getFormField() { $Field = new FormularInput($this->Key, $this->formLabel(), $this->valueAsString()); $Field->setSize(FormularInput::$SIZE_FULL_INLINE); $Field->addAttribute('maxlength', PluginConfigurationValue::MAXLENGTH); return $Field; }
/** * Get code for displaying the field * @return string */ protected function getFieldCode() { $Code = ''; $Code .= $this->FieldDay->getCode(); $Code .= $this->FieldDaytime->getCode(); return $Code; }
/** * 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; }
/** * Add field: notes */ private function addFieldNotes() { $Field = new FormularInput('notes', __('Notes')); $Field->setLayout(FormularFieldset::$LAYOUT_FIELD_W100_IN_W33); $Field->setSize(FormularInput::$SIZE_FULL_INLINE); $this->Fieldset->addField($Field); $this->Fieldset->addField(new FormularInputHidden('opt[notes]', '', 'like')); }
/** * Get input for distance * @param string $distance * @return FormularInput */ protected function getDistanceInputCode($distance) { $FieldDistance = new FormularInput('splits[km][]', '', $distance); $FieldDistance->setUnit(FormularUnit::$KM); $FieldDistance->setLayout(FormularFieldset::$LAYOUT_FIELD_INLINE); return $FieldDistance->getCode(); }
/** * Add fields for robert bock and herbert steffny */ protected function addFieldsForBockAndSteffny() { $BestResult = new FormularInput('best-result-km', __('Best result')); $BestResult->setLayout(FormularFieldset::$LAYOUT_FIELD_W50); $BestResult->addCSSclass('hide-on-model-change'); $BestResult->addCSSclass('only-robert-bock'); $BestResult->addCSSclass('only-herbert-steffny'); $BestResult->addCSSclass('only-david-cameron'); $BestResult->setUnit(FormularUnit::$KM); $BestResultTime = new FormularInput('best-result-time', __('in')); $BestResultTime->setLayout(FormularFieldset::$LAYOUT_FIELD_W50); $BestResultTime->addCSSclass('hide-on-model-change'); $BestResultTime->addCSSclass('only-robert-bock'); $BestResultTime->addCSSclass('only-herbert-steffny'); $BestResultTime->addCSSclass('only-david-cameron'); $SecondBestResult = new FormularInput('second-best-result-km', __('Second best result')); $SecondBestResult->setLayout(FormularFieldset::$LAYOUT_FIELD_W50); $SecondBestResult->addCSSclass('hide-on-model-change'); $SecondBestResult->addCSSclass('only-robert-bock'); $SecondBestResult->setUnit(FormularUnit::$KM); $SecondBestResultTime = new FormularInput('second-best-result-time', __('in')); $SecondBestResultTime->setLayout(FormularFieldset::$LAYOUT_FIELD_W50); $SecondBestResultTime->addCSSclass('hide-on-model-change'); $SecondBestResultTime->addCSSclass('only-robert-bock'); $this->FieldsetInput->addField($BestResult); $this->FieldsetInput->addField($BestResultTime); $this->FieldsetInput->addField($SecondBestResult); $this->FieldsetInput->addField($SecondBestResultTime); }
/** * Display row for config form * @return FormularField */ public function getFormField() { $Field = new FormularInput($this->Key, $this->formLabel(), $this->valueAsString()); $Field->setSize(FormularInput::$SIZE_SMALL); return $Field; }
/** * Prepare for beeing displayed */ protected function prepareForDisplay() { $this->setUnit(Icon::$CALENDAR); $this->addCSSclass('pick-a-date'); parent::prepareForDisplay(); }
/** * 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); }
/** * Set standard size, used when no specific size is set (may be overwritten by css) * @param string $size */ public static function setStandardSize($size) { self::$standardSize = $size; }
FormularField::setKeyAsFailed($FieldName); } } } } } FormularInput::setStandardSize(FormularInput::$SIZE_MIDDLE); $Field = new FormularInput('new_username', __('Username')); $Field->setLayout(FormularFieldset::$LAYOUT_FIELD_W100); $Field->setUnit(FormularUnit::$USER); $Field->display(); $Field = new FormularInput('name', __('Name')); $Field->setLayout(FormularFieldset::$LAYOUT_FIELD_W100); $Field->setUnit(FormularUnit::$USER); $Field->display(); $Field = new FormularInput('email', __('Email')); $Field->setLayout(FormularFieldset::$LAYOUT_FIELD_W100); $Field->setUnit(FormularUnit::$MAIL); $Field->display(); $Field = new FormularInputPassword('password', __('Password')); $Field->setLayout(FormularFieldset::$LAYOUT_FIELD_W100); $Field->setUnit(FormularUnit::$PASS); $Field->display(); $Field = new FormularInputPassword('password_again', __('Password again')); $Field->setLayout(FormularFieldset::$LAYOUT_FIELD_W100); $Field->setUnit(FormularUnit::$PASS); $Field->display(); } ?> <?php
/** * Get input for distance * @param string $distance * @return FormularInput */ protected function getDistanceInputCode($distance) { $FieldDistance = new FormularInput('splits[km][]', '', $distance); $FieldDistance->setUnit(Configuration::General()->distanceUnitSystem()->distanceUnit()); $FieldDistance->setLayout(FormularFieldset::$LAYOUT_FIELD_INLINE); $FieldDistance->setParser(FormularValueParser::$PARSER_DISTANCE); $FieldDistance->hideLabel(); return $FieldDistance->getCode(); }
<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>