本文整理汇总了PHP中CheckboxField::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP CheckboxField::setValue方法的具体用法?PHP CheckboxField::setValue怎么用?PHP CheckboxField::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CheckboxField
的用法示例。
在下文中一共展示了CheckboxField::setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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);
}
示例2: __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);
}
示例3: __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);
}
示例4: __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);
}
示例5: build
/**
* @param IRSVP $rsvp
* @param IRSVPQuestionTemplate $question
* @param IRSVPAnswer $answer
* @return FormField
*/
public function build(IRSVP $rsvp, IRSVPQuestionTemplate $question, IRSVPAnswer $answer)
{
$field = new CheckboxField($question->name(), $question->label());
$field->setValue($question->initialValue());
if ($question->isReadOnly()) {
$field->setDisabled(true);
}
if ($question->isMandatory()) {
$field->setAttribute('data-rule-required', 'true');
}
if (!is_null($answer)) {
$field->setValue($answer->value());
}
$field->setFieldHolderTemplate('RSVPCheckboxField_holder');
return $field;
}
示例6: FieldList
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);
}
示例7: build
/**
* @param ISurveyStep $current_step
* @param ISurveyQuestionTemplate $question
* @param ISurveyAnswer $answer
* @return FormField
*/
public function build(ISurveyStep $current_step, ISurveyQuestionTemplate $question, ISurveyAnswer $answer)
{
$field = new CheckboxField($question->name(), $question->label());
$field->setValue($question->initialValue());
if ($question->isReadOnly()) {
$field->setDisabled(true);
}
if ($question->isMandatory()) {
$field->setAttribute('data-rule-required', 'true');
}
if (!is_null($answer)) {
$field->setValue($answer->value());
}
$this->buildDependantRules($current_step, $question, $field);
return $field;
}
示例8: __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);
}
示例9: __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);
}
示例10: __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'));
}
示例11: settings
public function settings()
{
if (!OW::getUser()->isAuthenticated()) {
throw new AuthenticateException();
}
$contentMenu = new BASE_CMP_PreferenceContentMenu();
$contentMenu->getElement('email_notifications')->setActive(true);
$this->addComponent('contentMenu', $contentMenu);
OW::getDocument()->setHeading(OW::getLanguage()->text('notifications', 'setup_page_heading'));
OW::getDocument()->setHeadingIconClass('ow_ic_mail');
OW::getDocument()->setTitle(OW::getLanguage()->text('notifications', 'setup_page_title'));
$actions = $this->service->collectActionList();
$settings = $this->service->findRuleList($this->userId);
$form = new NOTIFICATIONS_SettingForm();
$this->addForm($form);
$processActions = array();
foreach ($actions as $action) {
$field = new CheckboxField($action['action']);
$field->setValue(!empty($action['selected']));
if (isset($settings[$action['action']])) {
$field->setValue((bool) $settings[$action['action']]->checked);
}
$form->addElement($field);
$processActions[] = $action['action'];
}
if (OW::getRequest()->isPost()) {
$result = $form->process($_POST, $processActions, $settings);
if ($result) {
OW::getFeedback()->info(OW::getLanguage()->text('notifications', 'settings_changed'));
} else {
OW::getFeedback()->warning(OW::getLanguage()->text('notifications', 'settings_not_changed'));
}
$this->redirect();
}
$tplActions = array();
foreach ($actions as $action) {
if (empty($tplActions[$action['section']])) {
$tplActions[$action['section']] = array('label' => $action['sectionLabel'], 'icon' => empty($action['sectionIcon']) ? '' : $action['sectionIcon'], 'actions' => array());
}
$tplActions[$action['section']]['actions'][$action['action']] = $action;
}
$this->assign('actions', $tplActions);
}
示例12: 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>';
}
示例13: testFieldValueSettingFalse
function testFieldValueSettingFalse()
{
/* Create the field, and set the value as NULL */
$field = new CheckboxField('IsChecked', 'Checked');
$field->setValue(false);
/* dataValue() for the field is 0 */
$this->assertEquals($field->dataValue(), 0, 'dataValue() returns a 0');
/* Value() returns 0 as well */
$this->assertEquals($field->Value(), 0, 'Value() returns a 0');
}
示例14: __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);
}
示例15: FieldList
function __construct($controller, $name)
{
$current_user = Member::currentUser();
$fields = new FieldList($this->first_name_field = new TextField('FirstName', 'First name / Given name', $current_user->FirstName), $this->last_name_field = new TextField('Surname', 'Last name / Family name', $current_user->Surname), $os_activity = new CustomCheckboxSetField('OpenStackActivity', 'Which of the following do you yourself personally do?<BR>Select All That Apply', DeploymentSurveyOptions::$activities_options), $os_relationship = new TextAreaField('OpenStackRelationship', 'Please describe your relationship with OpenStack'), $this->email_field = new TextField('Email', 'Your Email', $current_user->Email), $ok_2_contact = new CheckboxField('OkToContact', 'The OpenStack Foundation and User Committee may communicate with me in the future about my usage.'));
$os_relationship->addExtraClass('hidden');
$os_relationship->setColumns(30);
$ok_2_contact->setValue(0);
$this->email_field->setDisabled(true);
$nextButton = new FormAction('NextStep', ' Next Step ');
$actions = new FieldList($nextButton);
$validator = new RequiredFields();
Requirements::javascript('surveys/js/deployment_survey_aboutyou_form.js');
parent::__construct($controller, $name, $fields, $actions, $validator);
}