本文整理汇总了PHP中CheckboxField::setDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP CheckboxField::setDescription方法的具体用法?PHP CheckboxField::setDescription怎么用?PHP CheckboxField::setDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CheckboxField
的用法示例。
在下文中一共展示了CheckboxField::setDescription方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$language = OW::getLanguage();
$config = OW::getConfig();
OW::getDocument()->setHeading(OW::getLanguage()->text('admin', 'heading_mobile_settings'));
OW::getDocument()->setHeadingIconClass('ow_ic_gear_wheel');
$settingsForm = new Form('mobile_settings');
$disableMobile = new CheckboxField('disable_mobile');
$disableMobile->setLabel($language->text('admin', 'mobile_settings_mobile_context_disable_label'));
$disableMobile->setDescription($language->text('admin', 'mobile_settings_mobile_context_disable_desc'));
$settingsForm->addElement($disableMobile);
$submit = new Submit('save');
$submit->setValue($language->text('admin', 'save_btn_label'));
$settingsForm->addElement($submit);
$this->addForm($settingsForm);
if (OW::getRequest()->isPost()) {
if ($settingsForm->isValid($_POST)) {
$data = $settingsForm->getValues();
$config->saveConfig('base', 'disable_mobile_context', (bool) $data['disable_mobile']);
OW::getFeedback()->info($language->text('admin', 'settings_submit_success_message'));
} else {
OW::getFeedback()->error('Error');
}
$this->redirect();
}
$disableMobile->setValue($config->getValue('base', 'disable_mobile_context'));
}
示例2: __construct
/**
* Class constructor
*
*/
public function __construct($configs)
{
parent::__construct('configSaveForm');
$language = OW::getLanguage();
$field = new RadioField('itunes_mode');
$field->setOptions(array("test" => $language->text("skadateios", "itunes_mode_test"), "live" => $language->text("skadateios", "itunes_mode_live")));
$field->setValue($configs["itunes_mode"]);
$this->addElement($field);
$field = new CheckboxField('billing_enabled');
$field->setValue($configs["billing_enabled"]);
$this->addElement($field);
$field = new TextField('itunes_secret');
$field->addValidator(new ConfigRequireValidator());
$field->setValue($configs["itunes_secret"]);
$this->addElement($field);
$promoUrl = new TextField('app_url');
$promoUrl->setRequired();
$promoUrl->addValidator(new UrlValidator());
$promoUrl->setLabel($language->text('skadateios', 'app_url_label'));
$promoUrl->setDescription($language->text('skadateios', 'app_url_desc'));
$promoUrl->setValue($configs['app_url']);
$this->addElement($promoUrl);
$smartBanner = new CheckboxField('smart_banner');
$smartBanner->setLabel($language->text('skadateios', 'smart_banner_label'));
$smartBanner->setDescription($language->text('skadateios', 'smart_banner_desc'));
$smartBanner->setValue($configs['smart_banner']);
$this->addElement($smartBanner);
// submit
$submit = new Submit('save');
$submit->setValue($language->text('admin', 'save_btn_label'));
$this->addElement($submit);
}
示例3: __construct
/**
* Class constructor
*
*/
public function __construct()
{
parent::__construct('configSaveForm');
$language = OW::getLanguage();
$field = new TextField('public_key');
$field->addValidator(new ConfigRequireValidator());
$this->addElement($field);
$field = new CheckboxField('billing_enabled');
$this->addElement($field);
// submit
$submit = new Submit('save');
$submit->setValue($language->text('admin', 'save_btn_label'));
$this->addElement($submit);
$promoUrl = new TextField('app_url');
$promoUrl->setRequired();
$promoUrl->addValidator(new UrlValidator());
$promoUrl->setLabel($language->text('skandroid', 'app_url_label'));
$promoUrl->setDescription($language->text('skandroid', 'app_url_desc'));
$promoUrl->setValue(OW::getConfig()->getValue('skandroid', 'app_url'));
$this->addElement($promoUrl);
$smartBanner = new CheckboxField('smart_banner');
$smartBanner->setLabel($language->text('skandroid', 'smart_banner_label'));
$smartBanner->setDescription($language->text('skandroid', 'smart_banner_desc'));
$smartBanner->setValue(OW::getConfig()->getValue('skandroid', 'smart_banner'));
$this->addElement($smartBanner);
}
示例4: __construct
public function __construct()
{
parent::__construct('hint-form');
$this->setAjax(TRUE);
$this->setAction(OW::getRouter()->urlForRoute('profileprogressbar.admin_hint'));
$this->setAjaxResetOnSuccess(FALSE);
$this->bindJsFunction('success', 'function(data)
{
$("#profile-progressbar").tipTip({content: data.content});
OW.info("Settings successfully saved");
}');
$checkBox = new CheckboxField('show-hint');
if ((bool) OW::getConfig()->getValue('profileprogressbar', 'show_hint')) {
$checkBox->addAttribute('checked', 'checked');
}
$checkBox->setLabel(OW::getLanguage()->text('profileprogressbar', 'show_hint_label'));
$checkBox->setDescription(OW::getLanguage()->text('profileprogressbar', 'show_hint_desc'));
$this->addElement($checkBox);
$hintText = new WysiwygTextarea('hint-text');
$hintText->setRequired();
$hintText->setSize(WysiwygTextarea::SIZE_L);
$hintText->setValue(OW::getLanguage()->text('profileprogressbar', 'hint_text'));
$hintText->setLabel(OW::getLanguage()->text('profileprogressbar', 'hint_label'));
$hintText->setDescription(OW::getLanguage()->text('profileprogressbar', 'hint_desc'));
$this->addElement($hintText);
$submit = new Submit('save');
$submit->setValue('Save');
$this->addElement($submit);
}
示例5: UpdateCMSFields
public function UpdateCMSFields(FieldList $fields)
{
if ($this->IsInSocialMedia()) {
$fields->addFieldToTab('Root.Main', $text = new CompositeField(), 'Content');
$text->setDescription('Tämä blogiartikkeli on julkaistu sosiaalisessa mediassa. Muutokset blogiin eivät enää päivity sosiaaliseen mediaan. Jos poistat blogin, se ei poistu somesta automaattisesti.');
} else {
$fields->addFieldToTab('Root.Main', $checkbox = new CheckboxField('PublishInSocialMedia', 'Julkaise sosiaalisessa mediassa'), 'Content');
$checkbox->setDescription('Julkaisu tapahtuu kun klikkaat "Tallenna ja julkaise". Jos teet muutoksia sisältöön ensimmäisen some-julkaisun jälkeen, muutokset päivittyvät ainoastaan blogiin, eivätkä mene someen. Jos poistat artikkelin, se täytyy käydä erikseen poistamassa somessa.');
}
}
示例6: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('PageListingWidgetID');
$fields->addFieldToTab('Root.Main', new TreeDropdownField("PageID", "Related page", "SiteTree"));
$showChildrenField = new CheckboxField("ShowChildren", "Show Children");
$showChildrenField->setDescription("If ticked, links to the selected pages children are shown.<br/>If not ticked, a link to the selected page is shown");
$fields->addFieldToTab('Root.Main', $showChildrenField);
return $fields;
}
示例7: __construct
/**
* Constructor.
*
* @param array $itemsList
*/
public function __construct($langId)
{
parent::__construct();
$this->service = BOL_LanguageService::getInstance();
if (empty($langId)) {
$this->setVisible(false);
return;
}
$languageDto = $this->service->findById($langId);
if ($languageDto === null) {
$this->setVisible(false);
return;
}
$language = OW::getLanguage();
$form = new Form('lang_edit');
$form->setAjax();
$form->setAction(OW::getRouter()->urlFor('ADMIN_CTRL_Languages', 'langEditFormResponder'));
$form->setAjaxResetOnSuccess(false);
$labelTextField = new TextField('label');
$labelTextField->setLabel($language->text('admin', 'clone_form_lbl_label'));
$labelTextField->setDescription($language->text('admin', 'clone_form_descr_label'));
$labelTextField->setRequired();
$labelTextField->setValue($languageDto->getLabel());
$form->addElement($labelTextField);
$tagTextField = new TextField('tag');
$tagTextField->setLabel($language->text('admin', 'clone_form_lbl_tag'));
$tagTextField->setDescription($language->text('admin', 'clone_form_descr_tag'));
$tagTextField->setRequired();
$tagTextField->setValue($languageDto->getTag());
if ($languageDto->getTag() == 'en') {
$tagTextField->addAttribute('disabled', 'disabled');
}
$form->addElement($tagTextField);
$rtl = new CheckboxField('rtl');
$rtl->setLabel($language->text('admin', 'lang_edit_form_rtl_label'));
$rtl->setDescription($language->text('admin', 'lang_edit_form_rtl_desc'));
$rtl->setValue((bool) $languageDto->getRtl());
$form->addElement($rtl);
$hiddenField = new HiddenField('langId');
$hiddenField->setValue($languageDto->getId());
$form->addElement($hiddenField);
$submit = new Submit('submit');
$submit->setValue($language->text('admin', 'btn_label_edit'));
$form->addElement($submit);
$form->bindJsFunction(Form::BIND_SUCCESS, "function(data){if(data.result){OW.info(data.message);setTimeout(function(){window.location.reload();}, 1000);}else{OW.error(data.message);}}");
$this->addForm($form);
}
示例8: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$languageField = new DropdownField('Language', 'Language', array('af' => 'Afrikaans', 'sq' => 'Albanian', 'eu' => 'Basque', 'be' => 'Belarusian', 'bg' => 'Bulgarian', 'ca' => 'Catalan', 'zh-cn' => 'Chinese (Simplified)', 'zh-tw' => 'Chinese (Traditional)', 'hr' => 'Croatian', 'cs' => 'Czech', 'da' => 'Danish', 'nl' => 'Dutch', 'nl-be' => 'Dutch (Belgium)', 'nl-nl' => 'Dutch (Netherlands)', 'en' => 'English', 'en-au' => 'English (Australia)', 'en-bz' => 'English (Belize)', 'en-ca' => 'English (Canada)', 'en-ie' => 'English (Ireland)', 'en-jm' => 'English (Jamaica)', 'en-nz' => 'English (New Zealand)', 'en-ph' => 'English (Phillipines)', 'en-za' => 'English (South Africa)', 'en-tt' => 'English (Trinidad)', 'en-gb' => 'English (United Kingdom)', 'en-us' => 'English (United States)', 'en-zw' => 'English (Zimbabwe)', 'et' => 'Estonian', 'fo' => 'Faeroese', 'fi' => 'Finnish', 'fr' => 'French', 'fr-be' => 'French (Belgium)', 'fr-ca' => 'French (Canada)', 'fr-fr' => 'French (France)', 'fr-lu' => 'French (Luxembourg)', 'fr-mc' => 'French (Monaco)', 'fr-ch' => 'French (Switzerland)', 'gl' => 'Galician', 'gd' => 'Gaelic', 'de' => 'German', 'de-at' => 'German (Austria)', 'de-de' => 'German (Germany)', 'de-li' => 'German (Liechtenstein)', 'de-lu' => 'German (Luxembourg)', 'de-ch' => 'German (Switzerland)', 'el' => 'Greek', 'haw' => 'Hawaiian', 'hu' => 'Hungarian', 'is' => 'Icelandic', 'in' => 'Indonesian', 'ga' => 'Irish', 'it' => 'Italian', 'it-it' => 'Italian (Italy)', 'it-ch' => 'Italian (Switzerland)', 'ja' => 'Japanese', 'ko' => 'Korean', 'mk' => 'Macedonian', 'no' => 'Norwegian', 'pl' => 'Polish', 'pt' => 'Portuguese', 'pt-br' => 'Portuguese (Brazil)', 'pt-pt' => 'Portuguese (Portugal)', 'ro' => 'Romanian', 'ro-mo' => 'Romanian (Moldova)', 'ro-ro' => 'Romanian (Romania)', 'ru' => 'Russian', 'ru-mo' => 'Russian (Moldova)', 'ru-ru' => 'Russian (Russia)', 'sr' => 'Serbian', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'es' => 'Spanish', 'es-ar' => 'Spanish (Argentina)', 'es-bo' => 'Spanish (Bolivia)', 'es-cl' => 'Spanish (Chile)', 'es-co' => 'Spanish (Colombia)', 'es-cr' => 'Spanish (Costa Rica)', 'es-do' => 'Spanish (Dominican Republic)', 'es-ec' => 'Spanish (Ecuador)', 'es-sv' => 'Spanish (El Salvador)', 'es-gt' => 'Spanish (Guatemala)', 'es-hn' => 'Spanish (Honduras)', 'es-mx' => 'Spanish (Mexico)', 'es-ni' => 'Spanish (Nicaragua)', 'es-pa' => 'Spanish (Panama)', 'es-py' => 'Spanish (Paraguay)', 'es-pe' => 'Spanish (Peru)', 'es-pr' => 'Spanish (Puerto Rico)', 'es-es' => 'Spanish (Spain)', 'es-uy' => 'Spanish (Uruguay)', 'es-ve' => 'Spanish (Venezuela)', 'sv' => 'Swedish', 'sv-fi' => 'Swedish (Finland)', 'sv-se' => 'Swedish (Sweden)', 'tr' => 'Turkish', 'uk' => 'Ukranian'));
$languageField->setHasEmptyDefault(true)->setEmptyString('Select Language');
$podcastImage = new UploadField('PodcastImage', 'Podcast Image');
$podcastImage->setFolderName('podcast/podcast-artwork')->setDescription("iTunes recommends a size of at least 1400x1400")->getValidator()->setAllowedExtensions(array('jpg', 'png'));
$completeField = new CheckboxField('Complete');
$completeField->setDescription('This podcast is complete. No more episodes will be added to the podcast.');
$blockField = new CheckboxField('Block');
$blockField->setDescription('Prevent the <strong>entire</strong> podcast from appearing in the iTunes podcast directory.');
$explicitField = new DropdownField('Explicit', 'Explicit', $this->dbObject('Explicit')->enumValues());
$explicitField->setDescription("Displays an 'Explicit', 'Clean' or no parental advisory graphic next to your podcast artwork in iTunes.");
$fields->addFieldsToTab('Root.Podcast', array(new TextField('PodcastTitle', 'Podcast Title'), new TextField('Subtitle'), $languageField, new TextField('Author'), new TextAreaField('Summary'), new TextField('OwnerName', 'Owner Name'), new EmailField('OwnerEmail', 'Owner Email'), new TextField('Copyright'), $completeField, $blockField, $explicitField, new TextAreaField('Keywords'), $podcastImage));
$config = GridFieldConfig_RelationEditor::create();
$episodesTable = new GridField('PodcastEpisodes', 'Podcast Episodes', $this->PodcastEpisodes()->sort('EpisodeDate', 'DESC'), $config);
$fields->addFieldToTab('Root.Episodes', $episodesTable);
return $fields;
}
示例9: index
public function index()
{
$language = OW::getLanguage();
$config = OW::getConfig();
$adminForm = new Form('adminForm');
$element = new Selectbox('actionMember');
$element->setLabel($language->text('grouprss', 'action_member_label'));
$element->setDescription($language->text('grouprss', 'action_member_desc'));
$element->setValue($config->getValue('grouprss', 'actionMember'));
$element->setRequired();
$element->addOption('admin', $language->text('grouprss', 'site_admin'));
$element->addOption('owner', $language->text('grouprss', 'group_owner'));
$element->addOption('both', $language->text('grouprss', 'both_admin_owner'));
$adminForm->addElement($element);
$element = new Selectbox('postLocation');
$element->setLabel($language->text('grouprss', 'post_location_label'));
$element->setDescription($language->text('grouprss', 'post_location_desc'));
$element->setValue($config->getValue('grouprss', 'postLocation'));
$element->setRequired();
$element->addOption('wall', $language->text('grouprss', 'wall_location'));
$element->addOption('newsfeed', $language->text('grouprss', 'newsfeed_location'));
$adminForm->addElement($element);
$element = new CheckboxField('disablePosting');
$element->setLabel($language->text('grouprss', 'disable_posting_label'));
$element->setDescription($language->text('grouprss', 'disable_posting_desc'));
$element->setValue($config->getValue('grouprss', 'disablePosting'));
$adminForm->addElement($element);
$element = new Submit('saveSettings');
$element->setValue(OW::getLanguage()->text('grouprss', 'admin_save_settings'));
$adminForm->addElement($element);
if (OW::getRequest()->isPost()) {
if ($adminForm->isValid($_POST)) {
$values = $adminForm->getValues();
$config->saveConfig('grouprss', 'actionMember', $values['actionMember']);
$config->saveConfig('grouprss', 'postLocation', $values['postLocation']);
$config->saveConfig('grouprss', 'disablePosting', $values['disablePosting']);
GROUPRSS_BOL_FeedService::getInstance()->addAllGroupFeed();
//OW::getFeedback()->info($language->text('grouprss', 'user_save_success'));
}
}
$this->addForm($adminForm);
}
示例10: index
public function index()
{
$language = OW::getLanguage();
$config = OW::getConfig();
$adminForm = new Form('adminForm');
$element = new TextField('logsPerPage');
$element->setRequired(true);
$element->setValue($config->getValue('credits', 'logsPerPage'));
$element->setLabel($language->text('credits', 'logs_per_page'));
$element->addValidator(new IntValidator(1));
$adminForm->addElement($element);
$element = new CheckboxField('enableEmail');
$element->setLabel(OW::getLanguage()->text('credits', 'admin_enable_email'));
$element->setDescription(OW::getLanguage()->text('credits', 'admin_enable_email_desc'));
$element->setValue($config->getValue('credits', 'enableEmail'));
$adminForm->addElement($element);
$element = new CheckboxField('enablePM');
$element->setLabel(OW::getLanguage()->text('credits', 'admin_enable_pm'));
$element->setDescription(OW::getLanguage()->text('credits', 'admin_enable_pm_desc'));
$element->setValue($config->getValue('credits', 'enablePM'));
$adminForm->addElement($element);
$element = new CheckboxField('enableNotification');
$element->setLabel(OW::getLanguage()->text('credits', 'admin_enable_notification'));
$element->setDescription(OW::getLanguage()->text('credits', 'admin_enable_notification_desc'));
$element->setValue($config->getValue('credits', 'enableNotification'));
$adminForm->addElement($element);
$element = new Submit('saveSettings');
$element->setValue(OW::getLanguage()->text('credits', 'admin_save_settings'));
$adminForm->addElement($element);
if (OW::getRequest()->isPost()) {
if ($adminForm->isValid($_POST)) {
$values = $adminForm->getValues();
$config->saveConfig('credits', 'logsPerPage', $values['logsPerPage']);
$config->saveConfig('credits', 'enableEmail', $values['enableEmail']);
$config->saveConfig('credits', 'enablePM', $values['enablePM']);
$config->saveConfig('credits', 'enableNotification', $values['enableNotification']);
OW::getFeedback()->info($language->text('credits', 'save_sucess_msg'));
}
}
$this->addForm($adminForm);
}
示例11: setCreateProjectFolderField
/**
* If there isn't a capistrano env project folder, show options to create one
*
* @param FieldList $fields
*/
public function setCreateProjectFolderField(&$fields)
{
// Check if the capistrano project folder exists
if (!$this->Name) {
return;
}
if ($this->projectFolderExists()) {
return;
}
$createFolderNotice = new LabelField('CreateEnvFolderNotice', 'Warning: No Capistrano project folder exists');
$createFolderNotice->addExtraClass('message warning');
$fields->insertBefore($createFolderNotice, 'Name');
$createFolderField = new CheckboxField('CreateEnvFolder', 'Create folder');
$createFolderField->setDescription('Would you like to create the capistrano project folder?');
$fields->insertAfter($createFolderField, 'CreateEnvFolderNotice');
}
示例12: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$fields->addFieldToTab("Root", new Tab(_t("Newsletter.Configuration", "NewsletterConfiguration"), $globalUnsubscribe = new CheckboxField("GlobalUnsubscribe", _t("Newsletter.LabelGobalUnsubscribe", "Unsubscribe from all lists by default?"))));
$globalUnsubscribeDescription = _t("Newsletter.GlobalUnsubscribeDescription", "Clicking any unsubscribe links in each newsletter will unsubscribe the recipient from all mailing lists\n\t\t\tif checked<br />\n\t\t\totherwise only unsubscribe the recipient from mailing lists that the newsletter related to");
$globalUnsubscribe->setDescription($globalUnsubscribeDescription);
}
示例13: index
public function index()
{
$language = OW::getLanguage();
$config = OW::getConfig();
$adminForm = new Form('adminForm');
$element = new TextField('minimumPayment');
$element->setRequired(true);
$element->setValue($config->getValue('sponsors', 'minimumPayment'));
$validator = new FloatValidator(0);
$validator->setErrorMessage($language->text('sponsors', 'invalid_numeric_format'));
$element->addValidator($validator);
$element->setLabel($language->text('sponsors', 'minimum_payment_required'));
$element->setDescription($language->text('sponsors', 'minimum_payment_required_desc'));
$adminForm->addElement($element);
$element = new TextField('topSponsorsCount');
$element->setRequired(true);
$element->setValue($config->getValue('sponsors', 'topSponsorsCount'));
$validator = new IntValidator(1);
$validator->setErrorMessage($language->text('sponsors', 'invalid_numeric_format'));
$element->addValidator($validator);
$element->setLabel($language->text('sponsors', 'sponsors_count_displayed'));
$element->setDescription($language->text('sponsors', 'sponsors_count_displayed_desc'));
$adminForm->addElement($element);
$element = new TextField('sponsorValidity');
$element->setRequired(true);
$element->setValue($config->getValue('sponsors', 'sponsorValidity'));
$validator = new IntValidator(1);
$validator->setErrorMessage($language->text('sponsors', 'invalid_numeric_format'));
$element->addValidator($validator);
$element->setLabel($language->text('sponsors', 'sponsorship_validatity'));
$element->setDescription($language->text('sponsors', 'sponsorship_validatity_desc'));
$adminForm->addElement($element);
$element = new CheckboxField('alwaysSingleFlip');
$element->setLabel($language->text('sponsors', 'always_single_flip'));
$element->setDescription($language->text('sponsors', 'always_single_flip_desc'));
$element->setValue($config->getValue('sponsors', 'alwaysSingleFlip'));
$adminForm->addElement($element);
$element = new CheckboxField('autoApprove');
$element->setLabel($language->text('sponsors', 'auto_approve'));
$element->setDescription($language->text('sponsors', 'auto_approve_desc'));
$element->setValue($config->getValue('sponsors', 'autoApprove'));
$adminForm->addElement($element);
$element = new CheckboxField('newSponsorLinkAtLast');
$element->setLabel($language->text('sponsors', 'show_new_sponsor_link_last'));
$element->setDescription($language->text('sponsors', 'show_new_sponsor_link_last_desc'));
$element->setValue($config->getValue('sponsors', 'newSponsorLinkAtLast'));
$adminForm->addElement($element);
$element = new CheckboxField('onlyAdminCanAdd');
$element->setLabel($language->text('sponsors', 'only_admin_add_sponsors'));
$element->setDescription($language->text('sponsors', 'only_admin_add_sponsors_desc'));
$element->setValue($config->getValue('sponsors', 'onlyAdminCanAdd'));
$adminForm->addElement($element);
$element = new TextField('cutoffDay');
$element->setRequired(true);
$element->setValue($config->getValue('sponsors', 'cutoffDay'));
$validator = new IntValidator(1, 20);
$validator->setErrorMessage($language->text('sponsors', 'invalid_numeric_format'));
$element->addValidator($validator);
$element->setLabel($language->text('sponsors', 'cutoff_date_notify'));
$element->setDescription($language->text('sponsors', 'cutoff_date_notify_desc'));
$adminForm->addElement($element);
$element = new Submit('saveSettings');
$element->setValue(OW::getLanguage()->text('sponsors', 'admin_save_settings'));
$adminForm->addElement($element);
if (OW::getRequest()->isPost()) {
if ($adminForm->isValid($_POST)) {
$values = $adminForm->getValues();
$config->saveConfig('sponsors', 'minimumPayment', $values['minimumPayment']);
$config->saveConfig('sponsors', 'alwaysSingleFlip', $values['alwaysSingleFlip']);
$config->saveConfig('sponsors', 'topSponsorsCount', $values['topSponsorsCount']);
$config->saveConfig('sponsors', 'sponsorValidity', $values['sponsorValidity']);
$config->saveConfig('sponsors', 'autoApprove', $values['autoApprove']);
$config->saveConfig('sponsors', 'newSponsorLinkAtLast', $values['newSponsorLinkAtLast']);
$config->saveConfig('sponsors', 'onlyAdminCanAdd', $values['onlyAdminCanAdd']);
$config->saveConfig('sponsors', 'cutoffDay', $values['cutoffDay']);
OW::getFeedback()->info($language->text('sponsors', 'user_save_success'));
}
}
$this->addForm($adminForm);
$this->setPageHeading(OW::getLanguage()->text('sponsors', 'admin_settings_title'));
$this->setPageTitle(OW::getLanguage()->text('sponsors', 'admin_settings_title'));
$this->setPageHeadingIconClass('ow_ic_gear_wheel');
}
示例14: getCMSFields
/**
* Overwrites SiteTree.getCMSFields.
*
* This method creates a customised CMS form for back-end user.
*
* @return fieldset
*/
function getCMSFields()
{
Requirements::javascript(THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js');
Requirements::javascript('openlayers/javascript/ollayeradmin.js');
$fields = parent::getCMSFields();
$fields->removeFieldsFromTab("Root.Main", array("Url", "DisplayPriority", "Cluster", "Enabled", "Visible", "Queryable", "ogc_name", "ogc_map", "ogc_transparent"));
$geometryType = $fields->fieldByName("Root.Main.GeometryType");
$opacity = $fields->fieldByName("Root.Main.Opacity");
$LayerCategory = $fields->fieldByName("Root.Main.LayerType");
$fields->removeFieldFromTab("Root.Main", "GeometryType");
$fields->removeFieldFromTab("Root.Main", "Opacity");
$fields->removeFieldFromTab("Root.Main", "LayerType");
$ogc_format = $fields->fieldByName("Root.Main.ogc_format");
$fields->removeFieldFromTab("Root.Main", "ogc_format");
$LayerType = $fields->fieldByName("Root.Main.Type");
$fields->removeFieldFromTab("Root.Main", "Type");
$reducedLayerFieldObject = $fields->fieldByName("Root.Main.ReducedLayer");
$fields->removeFieldFromTab("Root.Main", "ReducedLayer");
$fullOGCNameFieldObject = $fields->fieldByName("Root.Main.full_ogc_name");
$fields->removeFieldFromTab("Root.Main", "full_ogc_name");
$clusterPopupHeader = $fields->fieldByName("Root.Main.ClusterPopupHeader");
$clusterAttributes = $fields->fieldByName("Root.Main.ClusterAttributes");
$baselayer = $fields->fieldByName("Root.Main.Baselayer");
$fields->removeFieldFromTab("Root.Main", "Baselayer");
$styleMaps = $fields->fieldByName("Root.Main.StyleMapID");
$fields->removeFieldFromTab("Root.Main", "StyleMapID");
$fields->removeFieldFromTab("Root.Main", "ClusterPopupHeader");
$fields->removeFieldFromTab("Root.Main", "ClusterAttributes");
$XMLWhitelist = $fields->fieldByName("Root.Main.XMLWhitelist");
$Labels = $fields->fieldByName("Root.Main.Labels");
$SinglePopupHeader = $fields->fieldByName("Root.Main.SinglePopupHeader");
$fields->removeFieldFromTab("Root.Main", "XMLWhitelist");
$fields->removeFieldFromTab("Root.Main", "Labels");
$fields->removeFieldFromTab("Root.Main", "SinglePopupHeader");
$wmsCompositeField = new CustomCompositeField(new LiteralField("WMSLabel", "<br /><h3>OGC WMS Configuration</h3>"), $baselayer, $opacityField = new OpacityNumericField('Opacity', 'Opacity', $this->Opacity), $ogc_format, $OGCTransparencyField = new CheckboxField("ogc_transparent", "Transparency"));
$wmsCompositeField->addClassName('wmscomposite');
$wmsCompositeField->addClassName('wmsUntiledcomposite');
$wmsCompositeField->addClassName('ogccomposite');
$baselayer->setDescription("Each map must have one base layer.");
$opacityField->setDescription("Define layer's opacity, use number between 0.0 (fully transparent) to 1.0 (not transparent).<br>50% opacity can be entered as 0.5.");
$ogc_format->setDescription("Defines the MIME/Type for getmap requests.");
$OGCTransparencyField->setDescription("Use this flag if the layer shall have alpha channel, if available.");
$wfsCompositeField = new CustomCompositeField(new LiteralField("WFSLabel", "<br /><h3>OGC WFS Configuration</h3>"), $styleMaps, $reducedLayerFieldObject, $FullLayerName = new TextField("full_ogc_name", "Detailed Layer Name"), $ClusterField = new CheckboxField("Cluster", "Cluster"));
$wfsCompositeField->addClassName('wfscomposite');
$wfsCompositeField->addClassName('ogccomposite');
$styleMaps->setDescription("Define the render style of the vector layer. Use Style Maps admin to define those styles.<br/>If no style is selected, the layer will be rendered with a default style.");
$reducedLayerFieldObject->setDescription("Enable this if the vector layer is very large and the layer rendered is only a subset of the available <br/>attributes. The Detailed Layer Name field defines the OGC WFS layer which will be used to<br/>retrieve all attribute data, i.e. when the user clicks on a feature.");
$FullLayerName->setDescription("Define a second WFS layer which will be used to retrieve attribute data from a seelcted feature.");
$ClusterField->setDescription("Cluster can be applied ideally for point layers and group large datasets to cluster points.");
//
$fields->addFieldsToTab("Root.Main", array(new CompositeField(new LiteralField("OGCLabel", "<h2>Display Settings</h2>"), $EnabledField = new CheckboxField("Enabled", "Enabled"), $VisibleField = new CheckboxField("Visible", "Visible"), $geometryType, $LayerCategory, $QueryableField = new CheckboxField("Queryable", "Queryable"), $DisplayPriorityField = new NumericField("DisplayPriority", "Draw Priority")), new CompositeField(new LiteralField("OGCSettings", "<h2>OGC Server Settings</h2>"), new TextField("Url", "URL"), $mapParameterField = new TextField("ogc_map", "Map filename"), $LayerType, $LayerNameField = new TextField("ogc_name", "Layer Name")), $wmsCompositeField, $wfsCompositeField));
$mapParameterField->setDescription("Optional: Path to UMN Mapserver mapfile.");
$LayerType->setDescription('Define the source of data and its behaviour on the map. The URL will be appended as a <br/>vendor parameter to each OGC request.') . $EnabledField->setDescription("Flag if the layer is shown and used on the map.");
$DisplayPriorityField->setDescription("Higher numbered layers will be drawn on top or lower numbered layers.");
$LayerCategory->setDescription("Use layer type to define its behaviour: <br/>Overlay: selectable, background: static data, contextual: base map.");
$VisibleField->setDescription("Sets the default state of the map if it is visible or hidden.");
$QueryableField->setDescription("Sets the behaviour is the user can query items on the map for this layer.");
$LayerNameField->setDescription("Use the OGC layer name as it appears in the GetCapabilities XML document.");
$fields->addFieldsToTab("Root.MapPopup", array(new CheckboxField("UseTemplateForPopupWindow", "Use SilverStripe HTML templates"), new LiteralField("divPopupAttributes1", "<div class='divAttributesTemplate'>"), new LiteralField("label01", "<h3>Popup Window - Single Item</h3>"), new TextField("SinglePopupHeader", "Popup Header"), new LiteralField("SinglePopupHeader_description", "<strong>Popup Header</strong>: Static text line for popup header for this layer, i.e., '<strong><em>Selected Item:</em></strong>)'. If no value is provided, the layer title will be shown instead.<br/><br/>"), new TextField("XMLWhitelist", "Attributes"), new LiteralField("XMLWhitelist_description", "<strong>Attributes</strong>: comma separated list of attributes (available via the OGC interface).<br/><br/>"), new TextField("Labels", "Labels for Attributes"), new LiteralField("Labels_description", "<strong>Attributes</strong>: comma separated list of lables for the attributes (see Attributes).<br/><br/>"), new LiteralField("label02", "<h3>Popup Window - Multiple Items</h3>"), new TextField("ClusterPopupHeader", "Popup Header"), new LiteralField("ClusterPopupHeader_description", "<strong>Attributes</strong>: Text line for cluster popup header, i.e., 'There are \$items.TotalItems Sites'></strong>).<br/><br/>"), new TextField("ClusterAttributes", "Attributes"), new LiteralField("ClusterAttributes_description", "<strong>Attributes</strong>: comma separated list of lables for the attributes (see Attributes).<br/><br/>"), new LiteralField("divPopupAttributes2", "</div>"), new LiteralField("divPopupTemplate1", "<div class='divPopupTemplate'>"), new LiteralField("label04", "<h3>Popup Window</h3>"), new TextareaField('Popup_SingleInformation', 'Template - Single Item', $this->Popup_SingleInformation), new TextareaField('Popup_ClusterInformation', 'Template - Cluster Items', $this->Popup_ClusterInformation), new LiteralField("divPopupTemplate2", "</div>"), new LiteralField("label03", "<h3>Available Attributes (WFS layers only)</h3>"), new LiteralField('describeFeatureType', "<a href='#' class='describeFeatureType' data-id='" . $this->ID . "' onclick='return false;'>List Labels</a>"), new LiteralField('featureTypeAttributes', "<div id='featureTypeAttributes'><ul><li>Not loaded...</li></ul></div>")));
return $fields;
}
示例15: maintenance
public function maintenance()
{
$language = OW::getLanguage();
$this->setPageHeading($language->text('admin', 'maintenance_page_heading'));
$this->setPageTitle($language->text('admin', 'maintenance_page_title'));
$form = new Form('maintenance');
$maintananceEnable = new CheckboxField('maintenance_enable');
$maintananceEnable->setLabel($language->text('admin', 'maintenance_enable_label'));
$maintananceEnable->setDescription($language->text('admin', 'maintenance_enable_desc'));
$form->addElement($maintananceEnable);
$intro = new Textarea('maintenance_text');
$intro->setLabel($language->text('admin', 'maintenance_text_label'));
$intro->setDescription($language->text('admin', 'maintenance_text_desc'));
$form->addElement($intro);
// splash screen
$splashScreenEnable = new CheckboxField('splash_screen');
$splashScreenEnable->setLabel($language->text('admin', 'splash_enable_label'));
$splashScreenEnable->setDescription($language->text('admin', 'splash_enable_desc'));
$form->addElement($splashScreenEnable);
$intro = new Textarea('intro');
$intro->setLabel($language->text('admin', 'splash_intro_label'));
$intro->setDescription($language->text('admin', 'splash_intro_desc'));
$form->addElement($intro);
$buttonLabel = new TextField('button_label');
$buttonLabel->setLabel($language->text('admin', 'splash_button_label'));
$buttonLabel->setDescription($language->text('admin', 'splash_button_label_desc'));
$form->addElement($buttonLabel);
$leaveUrl = new TextField('leave_url');
$leaveUrl->setLabel($language->text('admin', 'splash_leave_url_label'));
$leaveUrl->setDescription($language->text('admin', 'splash_leave_url_desc'));
$leaveUrl->addValidator(new UrlValidator());
$form->addElement($leaveUrl);
$submit = new Submit('save');
$submit->setValue($language->text('admin', 'permissions_index_save'));
$form->addElement($submit);
$this->addForm($form);
if (OW::getRequest()->isPost()) {
if ($form->isValid($_POST)) {
$data = $form->getValues();
$langService = BOL_LanguageService::getInstance();
$key = $langService->findKey('admin', 'maintenance_text_value');
if ($key === null) {
$prefix = $langService->findPrefix('admin');
$key = new BOL_LanguageKey();
$key->setKey('maintenance_text_value');
$key->setPrefixId($prefix->getId());
$langService->saveKey($key);
}
$value = $langService->findValue($langService->getCurrent()->getId(), $key->getId());
if ($value === null) {
$value = new BOL_LanguageValue();
$value->setKeyId($key->getId());
$value->setLanguageId($langService->getCurrent()->getId());
}
$value->setValue($data['maintenance_text']);
$langService->saveValue($value);
OW::getConfig()->saveConfig('base', 'maintenance', (bool) $data['maintenance_enable']);
// save splash screen
$key = $langService->findKey('admin', 'splash_intro_value');
if ($key === null) {
$prefix = $langService->findPrefix('admin');
$key = new BOL_LanguageKey();
$key->setKey('splash_intro_value');
$key->setPrefixId($prefix->getId());
$langService->saveKey($key);
}
$value = $langService->findValue($langService->getCurrent()->getId(), $key->getId());
if ($value === null) {
$value = new BOL_LanguageValue();
$value->setKeyId($key->getId());
$value->setLanguageId($langService->getCurrent()->getId());
}
$value->setValue($data['intro']);
$langService->saveValue($value);
$key = $langService->findKey('admin', 'splash_button_value');
if ($key === null) {
$prefix = $langService->findPrefix('admin');
$key = new BOL_LanguageKey();
$key->setKey('splash_button_value');
$key->setPrefixId($prefix->getId());
$langService->saveKey($key);
}
$value = $langService->findValue($langService->getCurrent()->getId(), $key->getId());
if ($value === null) {
$value = new BOL_LanguageValue();
$value->setKeyId($key->getId());
$value->setLanguageId($langService->getCurrent()->getId());
}
$value->setValue($data['button_label']);
$langService->saveValue($value);
$url = trim($data['leave_url']);
if (!empty($url) && !strstr($url, 'http')) {
$url = 'http://' . $url;
}
OW::getConfig()->saveConfig('base', 'splash_leave_url', $url);
OW::getConfig()->saveConfig('base', 'splash_screen', (bool) $data['splash_screen']);
OW::getFeedback()->info($language->text('admin', 'maintenance_submit_success_message'));
$this->redirect();
}
}
//.........这里部分代码省略.........