本文整理汇总了PHP中CheckboxField类的典型用法代码示例。如果您正苦于以下问题:PHP CheckboxField类的具体用法?PHP CheckboxField怎么用?PHP CheckboxField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CheckboxField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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'));
}
示例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 }");
}
示例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);
}
示例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'));
}
示例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);
}
示例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;
}
示例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')));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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.');
}
}