本文整理汇总了PHP中CheckboxField类的典型用法代码示例。如果您正苦于以下问题:PHP CheckboxField类的具体用法?PHP CheckboxField怎么用?PHP CheckboxField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CheckboxField类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($configs, $features)
{
parent::__construct('MCOMPOSE_ConfigForm');
$this->configs = $configs;
$language = OW::getLanguage();
$field = new TextField('max_users');
$field->setRequired();
$field->setValue($configs['max_users']);
$this->addElement($field);
if ($features["friends"]) {
$field = new CheckboxField('friends_enabled');
$field->setValue($configs['friends_enabled']);
$this->addElement($field);
}
if ($features["groups"]) {
$field = new CheckboxField('groups_enabled');
$field->setValue($configs['groups_enabled']);
$this->addElement($field);
}
if ($features["events"]) {
$field = new CheckboxField('events_enabled');
$field->setValue($configs['events_enabled']);
$this->addElement($field);
}
// submit
$submit = new Submit('save');
$submit->setValue($language->text('mcompose', 'admin_save_btn'));
$this->addElement($submit);
}
开发者ID:vazahat,项目名称:dudex,代码行数:29,代码来源:admin.php
示例2: __construct
/**
* Constructor.
*/
public function __construct($ajax = false)
{
parent::__construct();
$form = new Form('sign-in');
$form->setAction("");
$username = new TextField('identity');
$username->setRequired(true);
$username->setHasInvitation(true);
$username->setInvitation(OW::getLanguage()->text('base', 'component_sign_in_login_invitation'));
$form->addElement($username);
$password = new PasswordField('password');
$password->setHasInvitation(true);
$password->setInvitation('password');
$password->setRequired(true);
$form->addElement($password);
$remeberMe = new CheckboxField('remember');
$remeberMe->setValue(true);
$remeberMe->setLabel(OW::getLanguage()->text('base', 'sign_in_remember_me_label'));
$form->addElement($remeberMe);
$submit = new Submit('submit');
$submit->setValue(OW::getLanguage()->text('base', 'sign_in_submit_label'));
$form->addElement($submit);
$this->addForm($form);
if ($ajax) {
$form->setAjaxResetOnSuccess(false);
$form->setAjax();
$form->setAction(OW::getRouter()->urlFor('BASE_CTRL_User', 'ajaxSignIn'));
$form->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if( data.result ){if(data.message){OW.info(data.message);}setTimeout(function(){window.location.reload();}, 1000);}else{OW.error(data.message);}}');
$this->assign('forgot_url', OW::getRouter()->urlForRoute('base_forgot_password'));
}
$this->assign('joinUrl', OW::getRouter()->urlForRoute('base_join'));
}
开发者ID:vazahat,项目名称:dudex,代码行数:35,代码来源:sign_in.php
示例3: __construct
public function __construct($name)
{
parent::__construct($name);
$this->setAction(OW::getRouter()->urlForRoute('ocsaffiliates.action_signup'));
$this->setAjax();
$lang = OW::getLanguage();
$affName = new TextField('name');
$affName->setRequired(true);
$affName->setLabel($lang->text('ocsaffiliates', 'affiliate_name'));
$this->addElement($affName);
$email = new TextField('email');
$email->setRequired(true);
$email->setLabel($lang->text('ocsaffiliates', 'email'));
$email->addValidator(new EmailValidator());
$this->addElement($email);
$password = new PasswordField('password');
$password->setRequired(true);
$password->setLabel($lang->text('ocsaffiliates', 'password'));
$this->addElement($password);
$payment = new Textarea('payment');
$payment->setRequired(true);
$payment->setLabel($lang->text('ocsaffiliates', 'payment_details'));
$this->addElement($payment);
if (OW::getConfig()->getValue('ocsaffiliates', 'terms_agreement')) {
$terms = new CheckboxField('terms');
$validator = new RequiredValidator();
$validator->setErrorMessage($lang->text('ocsaffiliates', 'terms_required_msg'));
$terms->addValidator($validator);
$this->addElement($terms);
}
$submit = new Submit('signup');
$submit->setValue($lang->text('ocsaffiliates', 'signup_btn'));
$this->addElement($submit);
$this->bindJsFunction(Form::BIND_SUCCESS, "function(data){\n if ( !data.result ) {\n OW.error(data.error);\n }\n else {\n document.location.reload();\n }\n }");
}
开发者ID:vazahat,项目名称:dudex,代码行数:35,代码来源:signup_form.php
示例4: __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);
}
开发者ID:hardikamutech,项目名称:loov,代码行数:36,代码来源:settings.php
示例5: 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'));
}
开发者ID:hardikamutech,项目名称:loov,代码行数:27,代码来源:mobile_settings.php
示例6: __construct
/**
* Class constructor
*
*/
public function __construct()
{
parent::__construct('configSaveForm');
$language = OW::getLanguage();
$configs = OW::getConfig()->getValues('googlelocation');
$element = new TextField('api_key');
$element->setValue($configs['api_key']);
$validator = new StringValidator(0, 40);
$validator->setErrorMessage($language->text('googlelocation', 'api_key_too_long'));
$element->addValidator($validator);
$this->addElement($element);
$options = array(GOOGLELOCATION_BOL_LocationService::DISTANCE_UNITS_MILES => $language->text('googlelocation', 'miles'), GOOGLELOCATION_BOL_LocationService::DISTANCE_UNITS_KM => $language->text('googlelocation', 'kms'));
$distanseUnits = new Selectbox('distanse_units');
$distanseUnits->setOptions($options);
$distanseUnits->setValue(GOOGLELOCATION_BOL_LocationService::getInstance()->getDistanseUnits());
$distanseUnits->setHasInvitation(false);
$this->addElement($distanseUnits);
$restrictions = new Selectbox('country_restriction');
$restrictions->setValue(!empty($configs['country_restriction']) ? $configs['country_restriction'] : null);
$restrictions->setOptions($this->countryList);
$restrictions->setInvitation(OW::getLanguage()->text('googlelocation', 'no_country_restriction'));
$this->addElement($restrictions);
$autofill = OW::getConfig()->getValue('googlelocation', 'auto_fill_location_on_search');
$autoFillLocationOnSearch = new CheckboxField('auto_fill_location_on_search');
$autoFillLocationOnSearch->setValue(empty($autofill) || $autofill == '0' ? false : $autofill);
$this->addElement($autoFillLocationOnSearch);
// submit
$submit = new Submit('save');
$submit->setValue($language->text('base', 'edit_button'));
$this->addElement($submit);
}
开发者ID:hardikamutech,项目名称:loov,代码行数:35,代码来源:admin.php
示例7: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$categoryFields = array();
$nonCategoryFields = array();
$fields->addFieldToTab('Root.Main', new TextField('ContentTitle', 'Content Title'));
$fields->addFieldToTab('Root.Main', new DropdownField('ItemStyle', 'Item Style', self::$styles));
$fields->addFieldToTab('Root.Main', new DropdownField('DefaultLayout', 'Default Layout', $this->dbObject('DefaultLayout')->enumValues()));
$fields->addFieldToTab('Root.Main', new NumericField('LimitTopResults', 'Limit Top Results - how many items to show at top (defaults to 4)'));
$fields->addFieldToTab('Root.Main', new NumericField('LimitBottomResults', 'Limit Bottom Results - how many items to show at bottom (defaults to 30)'));
//children fields
$fields->addFieldsToTab('Root.Main', array($useChildren = new CheckboxField('UseChildren', 'Use page as category?', 1), $categoryFields[] = $pageField = new ContentModuleTreeDropdownField('TopLevelPageID', 'Top Level Page', 'SiteTree'), $categoryFields[] = $showSearch = new CheckboxField('ShowSearch', 'Show search?'), $categoryFields[] = $hasCategories = new CheckBoxField('HasCategories', 'Has categories? (2 levels or single level)'), $categoryFields[] = $showCategories = new CheckboxField('ShowCategories', 'Show category navigation bar? (for filtering)')));
$pageField->addExtraClass('use-children');
$useChildren->addExtraClass('use-children');
$showSearch->addExtraClass('show-search');
$hasCategories->addExtraClass('has-categories');
$showCategories->addExtraClass('show-categories');
//add page fields
$fields->addFieldsToTab('Root.Main', array($tree = new ContentModuleTreeDropdownField('NewPage', 'Add Page (choose from dropdown to add below)', 'SiteTree'), $enableSeeMore = new CheckboxField('DisableSeeMore', 'Disable "See more"?', 0), $nonCategoryFields[] = $rEditor = new ContentModuleRelationshipEditor('PagesRelationEditor', 'Pages', 'Pages', $this, array('Title' => 'Title', 'Parent.Title' => 'Parent'))));
$rEditor->setSortField('SortOrder')->setShowDeleteButton(false);
//url for adding page
$tree->setAttribute('data-add_url', 'addPage');
$nonCategoryFields[] = $tree;
//setup classes for hiding show fields
foreach ($categoryFields as $categoryField) {
$categoryField->addExtraClass('category');
}
//setup classes for hiding show fields
foreach ($nonCategoryFields as $categoryField) {
$categoryField->addExtraClass('non-category');
}
Requirements::javascript(INPAGE_MODULES_DIR . '/javascript/RelatedPagesModuleCMS.js');
return $fields;
}
开发者ID:webtorque7,项目名称:inpage-modules,代码行数:34,代码来源:RelatedPagesModule.php
示例8: __construct
public function __construct()
{
parent::__construct('questions_add');
$language = OW::getLanguage();
$this->setAjax();
$this->setAjaxResetOnSuccess(false);
$field = new Textarea('question');
$field->addAttribute('maxlength', 500);
$field->setRequired();
$field->setHasInvitation(true);
$field->setInvitation($language->text('questions', 'question_add_text_inv'));
$field->addAttribute("inv", $language->text('questions', 'question_add_text_inv'));
$this->addElement($field);
$field = new CheckboxField('allowAddOprions');
$field->addAttribute('checked');
$field->setLabel($language->text('questions', 'question_add_allow_add_opt'));
$this->addElement($field);
$field = new QUESTIONS_OptionsField('answers');
$field->setHasInvitation(true);
$field->setInvitation($language->text('questions', 'question_add_option_inv'));
$this->addElement($field);
$submit = new Submit('save');
$submit->setValue($language->text('questions', 'question_add_save'));
$this->addElement($submit);
if (!OW::getRequest()->isAjax()) {
OW::getLanguage()->addKeyForJs('questions', 'feedback_question_empty');
OW::getLanguage()->addKeyForJs('questions', 'feedback_question_min_length');
OW::getLanguage()->addKeyForJs('questions', 'feedback_question_max_length');
OW::getLanguage()->addKeyForJs('questions', 'feedback_question_two_apt_required');
OW::getLanguage()->addKeyForJs('questions', 'feedback_question_dublicate_option');
OW::getLanguage()->addKeyForJs('questions', 'feedback_option_max_length');
$this->initJsResponder();
}
$this->setAction(OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlFor('QUESTIONS_CTRL_List', 'addQuestion')));
}
开发者ID:jorgemunoz8807,项目名称:havanabook,代码行数:35,代码来源:question_add.php
示例9: __construct
/**
* Class constructor
*
*/
public function __construct($plugins)
{
parent::__construct('configForm');
$language = OW::getLanguage();
$values = OW::getConfig()->getValues('attachments');
if ($plugins['video']) {
$field = new CheckboxField('video_share');
$field->setValue($values['video_share']);
$this->addElement($field);
}
if ($plugins['links']) {
$field = new CheckboxField('link_share');
$field->setValue($values['link_share']);
$this->addElement($field);
}
if ($plugins['photo']) {
$field = new CheckboxField('photo_share');
$field->setId('photo_share_check');
$field->setValue($values['photo_share']);
$this->addElement($field);
$field = new TextField('photo_album_name');
$field->setValue(OW::getLanguage()->text('attachments', 'default_photo_album_name'));
$field->setRequired();
$this->addElement($field);
}
// submit
$submit = new Submit('save');
$submit->setValue($language->text('attachments', 'config_save_label'));
$this->addElement($submit);
}
开发者ID:vazahat,项目名称:dudex,代码行数:34,代码来源:admin.php
示例10: __construct
function __construct($controller, $name)
{
$fields = new FieldList(array($t1 = new TextField('ExternalOrderId', 'Eventbrite Order #'), $checkbox = new CheckboxField('SharedContactInfo', 'Allow to share contact info?')));
$t1->setAttribute('placeholder', 'Enter your Eventbrite order #');
$t1->addExtraClass('event-brite-order-number');
$attendees = Session::get('attendees');
if (count($attendees) > 0) {
$t1->setValue(Session::get('ExternalOrderId'));
$t1->setReadonly(true);
$checkbox->setValue(intval(Session::get('SharedContactInfo')) === 1);
$fields->add(new LiteralField('ctrl1', 'Current Order has following registered attendees, please select one:'));
$options = array();
foreach ($attendees as $attendee) {
$ticket_external_id = intval($attendee['ticket_class_id']);
$ticket_type = SummitTicketType::get()->filter('ExternalId', $ticket_external_id)->first();
if (is_null($ticket_type)) {
continue;
}
$options[$attendee['id']] = $attendee['profile']['name'] . ' (' . $ticket_type->Name . ')';
}
$attendees_ctrl = new OptionSetField('SelectedAttendee', '', $options);
$fields->add($attendees_ctrl);
$validator = new RequiredFields(array('ExternalOrderId'));
// Create action
$actions = new FieldList($btn_clear = new FormAction('clearSummitAttendeeInfo', 'Clear'), $btn = new FormAction('saveSummitAttendeeInfo', 'Done'));
$btn->addExtraClass('btn btn-default active');
$btn_clear->addExtraClass('btn btn-danger active');
} else {
$validator = new RequiredFields(array('ExternalOrderId'));
// Create action
$actions = new FieldList($btn = new FormAction('saveSummitAttendeeInfo', 'Get Order'));
$btn->addExtraClass('btn btn-default active');
}
parent::__construct($controller, $name, $fields, $actions, $validator);
}
开发者ID:Thingee,项目名称:openstack-org,代码行数:35,代码来源:SummitAttendeeInfoForm.php
示例11: __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);
}
开发者ID:hardikamutech,项目名称:loov,代码行数:30,代码来源:settings.php
示例12: __construct
/**
* Class constructor
*/
public function __construct()
{
parent::__construct('update-question-form');
$this->setAction(OW::getRouter()->urlFor('OCSFAQ_CTRL_Admin', 'editQuestion'));
$lang = OW::getLanguage();
$questionId = new HiddenField('questionId');
$questionId->setRequired(true);
$this->addElement($questionId);
$question = new TextField('question');
$question->setRequired(true);
$question->setLabel($lang->text('ocsfaq', 'question'));
$this->addElement($question);
$btnSet = array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO, BOL_TextFormatService::WS_BTN_HTML);
$answer = new WysiwygTextarea('answer', $btnSet);
$answer->setRequired(true);
$answer->setLabel($lang->text('ocsfaq', 'answer'));
$this->addElement($answer);
$isFeatured = new CheckboxField('isFeatured');
$isFeatured->setLabel($lang->text('ocsfaq', 'is_featured'));
$this->addElement($isFeatured);
$categories = OCSFAQ_BOL_FaqService::getInstance()->getCategories();
if ($categories) {
$category = new Selectbox('category');
foreach ($categories as $cat) {
$category->addOption($cat->id, $cat->name);
}
$category->setLabel($lang->text('ocsfaq', 'category'));
$this->addElement($category);
}
// submit
$submit = new Submit('update');
$submit->setValue($lang->text('ocsfaq', 'btn_save'));
$this->addElement($submit);
}
开发者ID:vazahat,项目名称:dudex,代码行数:37,代码来源:faq_edit.php
示例13: __construct
/**
* Class constructor
*
*/
public function __construct($plugins)
{
parent::__construct('configForm');
$language = OW::getLanguage();
$values = OW::getConfig()->getValues('uheader');
if ($plugins['photo']) {
$field = new CheckboxField('photo_share');
$field->setId('photo_share_check');
$field->setValue($values['photo_share']);
$this->addElement($field);
$field = new TextField('photo_album_name');
$field->setValue(OW::getLanguage()->text('uheader', 'default_photo_album_name'));
$field->setRequired();
$this->addElement($field);
}
$field = new TextField('cover_height');
$field->setValue($values['cover_height']);
$field->addValidator(new IntValidator(self::COVER_MIN_HEIGHT, self::COVER_MAX_HEIGHT));
$field->setRequired();
$this->addElement($field);
// submit
$submit = new Submit('save');
$submit->setValue($language->text('uheader', 'config_save_label'));
$this->addElement($submit);
}
开发者ID:vazahat,项目名称:dudex,代码行数:29,代码来源:admin.php
示例14: __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);
}
开发者ID:vazahat,项目名称:dudex,代码行数:30,代码来源:hint_form.php
示例15: 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.');
}
}
开发者ID:Taitava,项目名称:silverstripe-socialmedia,代码行数:10,代码来源:SocialMediaExtension.php
示例16: 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;
}
开发者ID:helpfulrobot,项目名称:gdmedia-silverstripe-widget-pagelist,代码行数:10,代码来源:RelatedPage.php
示例17: Field
/**
* (non-PHPdoc)
* @see framework/forms/FormField#Field()
*/
function Field($properties = array())
{
if ($this->isReadonly()) {
$nullableCheckbox = new CheckboxField_Readonly($this->getIsNullId());
} else {
$nullableCheckbox = new CheckboxField($this->getIsNullId());
}
$nullableCheckbox->setValue(is_null($this->dataValue()));
return $this->valueField->Field() . ' ' . $nullableCheckbox->Field() . ' <span>' . $this->getIsNullLabel() . '</span>';
}
开发者ID:prostart,项目名称:cobblestonepath,代码行数:14,代码来源:NullableField.php
示例18: index
public function index()
{
$language = OW::getLanguage();
$config = OW::getConfig();
$form = new Form('privacy_settings');
$userApprove = new CheckboxField('user_approve');
$userApprove->setLabel($language->text('admin', 'permissions_index_user_approve'));
$form->addElement($userApprove);
$whoCanJoin = new RadioField('who_can_join');
$whoCanJoin->addOptions(array('1' => $language->text('admin', 'permissions_index_anyone_can_join'), '2' => $language->text('admin', 'permissions_index_by_invitation_only_can_join')));
$whoCanJoin->setLabel($language->text('admin', 'permissions_index_who_can_join'));
$form->addElement($whoCanJoin);
$whoCanInvite = new RadioField('who_can_invite');
$whoCanInvite->addOptions(array('1' => $language->text('admin', 'permissions_index_all_users_can_invate'), '2' => $language->text('admin', 'permissions_index_admin_only_can_invate')));
$whoCanInvite->setLabel($language->text('admin', 'permissions_index_who_can_invite'));
$form->addElement($whoCanInvite);
$guestsCanView = new RadioField('guests_can_view');
$guestsCanView->addOptions(array('1' => $language->text('admin', 'permissions_index_yes'), '2' => $language->text('admin', 'permissions_index_no'), '3' => $language->text('admin', 'permissions_index_with_password')));
$guestsCanView->setLabel($language->text('admin', 'permissions_index_guests_can_view_site'));
$guestsCanView->setDescription($language->text('admin', 'permissions_idex_if_not_yes_will_override_settings'));
$form->addElement($guestsCanView);
$password = new TextField('password');
$form->addElement($password);
$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();
$config->saveConfig('base', 'who_can_join', (int) $data['who_can_join']);
$config->saveConfig('base', 'who_can_invite', (int) $data['who_can_invite']);
$config->saveConfig('base', 'mandatory_user_approve', (bool) $data['user_approve'] ? 1 : 0);
if ((int) $data['guests_can_view'] === 3 && empty($data['password'])) {
OW::getFeedback()->error($language->text('admin', 'permission_global_privacy_empty_pass_error_message'));
} else {
if ((int) $data['guests_can_view'] === 3 && strlen(trim($data['password'])) < 4) {
OW::getFeedback()->error($language->text('admin', 'permission_global_privacy_pass_length_error_message'));
} else {
$config->saveConfig('base', 'guests_can_view', (int) $data['guests_can_view']);
$config->saveConfig('base', 'guests_can_view_password', trim($data['password']));
}
}
OW::getFeedback()->info($language->text('admin', 'permission_global_privacy_settings_success_message'));
$this->redirect();
}
}
$baseConfigs = $config->getValues('base');
$form->getElement('who_can_join')->setValue($baseConfigs['who_can_join']);
$form->getElement('who_can_invite')->setValue($baseConfigs['who_can_invite']);
$form->getElement('guests_can_view')->setValue($baseConfigs['guests_can_view']);
$form->getElement('user_approve')->setValue($baseConfigs['mandatory_user_approve']);
$form->getElement('password')->setValue($baseConfigs['guests_can_view_password']);
}
开发者ID:vazahat,项目名称:dudex,代码行数:54,代码来源:permissions.php
示例19: __construct
public function __construct()
{
parent::__construct('EQUESTIONS_SetupForm');
$language = OW::getLanguage();
$field = new CheckboxField('copyData');
$field->setValue(true);
$field->setLabel($language->text('equestions', 'admin_setup_copy_data_label'));
$this->addElement($field);
$button = new Submit('upgrade');
$button->setValue($language->text('equestions', 'admin_setup_upgrade_label'));
$this->addElement($button);
}
开发者ID:vazahat,项目名称:dudex,代码行数:12,代码来源:upgrade.php
示例20: __construct
public function __construct()
{
parent::__construct('settings-form');
$lang = OW::getLanguage();
$canView = new CheckboxField('canView');
$canView->setLabel($lang->text('ocsfavorites', 'can_view_favorites'));
$this->addElement($canView);
// submit
$submit = new Submit('save');
$submit->setValue($lang->text('ocsfavorites', 'btn_save'));
$this->addElement($submit);
}
开发者ID:vazahat,项目名称:dudex,代码行数:12,代码来源:settings_form.php
注:本文中的CheckboxField类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论