public function __construct($serviceLocator, $options = null) { parent::__construct('AccountIndex'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $filter = $this->getInputFilter(); $group = new DisplayGroup('Subject'); $group->setLabel('Thêm môn học'); $this->add($group); // name $name = new Text('name'); $name->setLabel('Tên môn học:'); $name->setAttributes(['maxlength' => 255]); $this->add($name); $group->addElement($name); $filter->add(array('name' => 'name', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên môn học')))))); $categoryId = new Select('categoryId'); $categoryId->setLabel('Danh mục:'); $categoryId->setAttributes(['maxlength' => 10]); $this->add($categoryId); $this->loadCategories($categoryId, $options); $group->addElement($categoryId); $filter->add(array('name' => 'categoryId', 'required' => true, 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập danh mục môn học')))))); // code $description = new Textarea('description'); $description->setLabel('Mô tả môn học:'); $description->setAttributes(['maxlength' => 255, 'class' => 'form-control basicEditor ', 'style' => 'min-height: 300px;']); $this->add($description); $group->addElement($description); $filter->add(array('name' => 'description', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập mô tả môn học')))))); $this->add(array('name' => 'afterSubmit', 'type' => 'radio', 'attributes' => array('value' => '/admin/subject/add'), 'options' => array('layout' => 'fluid', 'clearBefore' => true, 'label' => 'Sau khi lưu dữ liệu:', 'value_options' => array('/admin/subject/add' => 'Tiếp tục nhập', '/admin/subject/index' => 'Hiện danh sách vừa nhập')))); $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSave', 'class' => 'btn btn-primary'))); }
public function getPerfil() { $element = new Select('perfil'); $element->setLabel('Perfil:'); $element->setAttributes(array('id' => 'perfil', 'class' => 'form-control validar')); return $element; }
public function __construct($name = null) { parent::__construct('objetosform'); $this->setAttribute('method', 'post'); $this->setAttribute('role', 'form'); $this->setAttributes(array('id' => 'objetosform')); $objetos_actividad_id = new Element('objetos_actividad_id'); $objetos_actividad_id->setLabel('Actividad'); $objetos_actividad_id->setAttributes(array('type' => 'text', 'placeholder' => 'Este campo se genera automáticamente', 'id' => 'objetos_actividad_id', 'readonly' => 'readonly', 'class' => 'form-control')); $objetos_id = new Element('objetos_id'); $objetos_id->setLabel('ID'); $objetos_id->setAttributes(array('type' => 'text', 'placeholder' => 'Este campo se genera automáticamente', 'id' => 'objetos_id', 'readonly' => 'readonly', 'class' => 'form-control')); $objetos_nombre = new Element('objetos_nombre'); $objetos_nombre->setLabel('Nombre'); $objetos_nombre->setAttributes(array('type' => 'text', 'placeholder' => 'ej: wKER001', 'id' => 'objetos_nombre', 'class' => 'form-control')); $objetos_tipo = new Element\Select('objetos_tipo'); $objetos_tipo->setLabel('Tipo'); $objetos_tipo->setEmptyOption('Elige un Tipo..'); $objetos_tipo->setOptions(array('disable_inarray_validator' => true)); $objetos_tipo->setAttributes(array('id' => 'objetos_tipo', 'class' => "form-control")); $guardar = new Element\Button('guardar'); $guardar->setAttributes(array('class' => 'btn btn-success mr5', 'type' => 'submit', 'id' => 'guardar')); $guardar->setOptions(array('label' => '<i class="glyphicon glyphicon-floppy-disk"></i>', 'label_options' => array('disable_html_escape' => true))); $etiquetas_id = new Element\Hidden('etiquetas_id'); $etiquetas_id->setAttributes(array('id' => 'etiquetas_id')); $this->add($objetos_actividad_id); $this->add($objetos_id); $this->add($objetos_nombre); $this->add($objetos_tipo); $this->add($etiquetas_id); $this->add($guardar); }
public function __construct($name = null) { parent::__construct('usuariosform'); $this->setAttribute('method', 'post'); $this->setAttribute('role', 'form'); $this->setAttributes(array('id' => 'usuariosform')); $usuarios_id = new Element('usuarios_id'); $usuarios_id->setLabel('ID'); $usuarios_id->setAttributes(array('type' => 'text', 'placeholder' => 'Este campo se genera automáticamente', 'id' => 'usuarios_id', 'readonly' => 'readonly', 'class' => 'form-control')); $usuarios_username = new Element('usuarios_username'); $usuarios_username->setLabel('Usuario'); $usuarios_username->setAttributes(array('type' => 'text', 'placeholder' => 'dvader', 'id' => 'usuarios_username', 'class' => 'form-control')); $usuarios_nombres = new Element('usuarios_nombres'); $usuarios_nombres->setLabel('Nombre'); $usuarios_nombres->setAttributes(array('type' => 'text', 'placeholder' => 'Darth Vader', 'id' => 'usuarios_nombres', 'class' => 'form-control')); $usuarios_estado = new Element\Select('usuarios_estado'); $usuarios_estado->setLabel('Estado'); //$usuarios_estado->setEmptyOption('ELige un Estado..'); $usuarios_estado->setOptions(array('disable_inarray_validator' => true)); $usuarios_estado->setAttributes(array('id' => 'usuarios_estado', 'class' => "form-control", 'data-rule-required' => "true", 'data-msg-required' => "Debe seleccionar el Estado")); $guardar = new Element\Button('guardar'); $guardar->setAttributes(array('class' => 'btn btn-success mr5', 'type' => 'submit', 'id' => 'guardar')); $guardar->setOptions(array('label' => '<i class="glyphicon glyphicon-floppy-disk"></i>', 'label_options' => array('disable_html_escape' => true))); $this->add($usuarios_id); $this->add($usuarios_username); $this->add($usuarios_nombres); $this->add($usuarios_estado); $this->add($guardar); }
function __invoke($name, $emptyOption, $value, $selected, array $options = null) { $options = $this->setDefaultOptions($options); $elementSelect = new Select($name); $elementSelect->setAttributes($options)->setEmptyOption($emptyOption)->setValueOptions($value)->setValue($selected); return $this->render($elementSelect); }
public function form(PhpRenderer $view) { // Normalize vocab terms for use in a select element. $terms = array_map('trim', explode(PHP_EOL, $this->vocab->terms())); $valueOptions = array_combine($terms, $terms); $select = new Select('customvocab'); $select->setAttributes(['class' => 'terms to-require', 'data-value-key' => '@value'])->setEmptyOption('Select Below')->setValueOptions($valueOptions); return $view->formSelect($select); }
public function getTemplate(PhpRenderer $view) { // Normalize vocab terms for use in a select element. $terms = array_map('trim', explode(PHP_EOL, $this->vocab->terms())); $valueOptions = array_combine($terms, $terms); $hidden = new Hidden('customvocab'); $hidden->setAttributes(['class' => 'language'])->setValue($this->vocab->lang()); $select = new Select('customvocab'); $select->setAttributes(['class' => 'terms'])->setEmptyOption('Select Below')->setValueOptions($valueOptions); return $view->formHidden($hidden) . $view->formSelect($select); }
public function __construct(EntityManager $em, $name = null, $options = array()) { $this->em = $em; parent::__construct('CityForm'); $this->setAttribute('method', 'post'); $this->setAttribute('enctype', 'multipart/form-data'); $this->setAttribute('class', 'form-horizontal'); $this->add(array('name' => 'ctname', 'attributes' => array('type' => 'text', 'placeholder' => 'City name', 'class' => 'commonDropDnInput'))); $stid = new Element\Select('stid'); $stid->setLabel('State name'); $stid->setAttributes(array('id' => 'stid')); $stid->setValueOptions($this->getOptionState()); $stid->setAttribute("class", "dropDnInput"); $this->add($stid); $ctcatid = new Element\Select('ctcatid'); $ctcatid->setLabel('City category'); $ctcatid->setValueOptions($this->getOptionCityCat()); $ctcatid->setAttribute("class", "dropDnInput"); $this->add($ctcatid); $ctdescription = new Element\Textarea('ctdescription'); $ctdescription->setLabel('City Description'); $ctdescription->setAttribute("class", "selectAreaInput"); $ctdescription->setAttribute("rows", "4"); $ctdescription->setAttribute("cols", "50"); $this->add($ctdescription); $ctspecialInstructions = new Element\Textarea('ctspecialInstructions'); $ctspecialInstructions->setLabel('City Special Instruction Description'); $ctspecialInstructions->setAttribute("class", "selectAreaInput"); $ctspecialInstructions->setAttribute("rows", "4"); $ctspecialInstructions->setAttribute("cols", "33"); $this->add($ctspecialInstructions); $ctbestSeasonToVisit = new Element\Textarea('ctbestSeasonToVisit'); $ctbestSeasonToVisit->setLabel('City Best Season to visit'); $ctbestSeasonToVisit->setAttribute("class", "selectAreaInput"); $ctbestSeasonToVisit->setAttribute("rows", "4"); $ctbestSeasonToVisit->setAttribute("cols", "43"); $this->add($ctbestSeasonToVisit); $this->add(array('name' => 'ctlatitude', 'attributes' => array('type' => 'text', 'placeholder' => 'City Lattitude', 'class' => 'commonDropDnInput'))); $this->add(array('name' => 'ctlongitude', 'attributes' => array('type' => 'text', 'placeholder' => 'City Longitude', 'class' => 'commonDropDnInput'))); $this->add(array('name' => 'cityPhoto', 'attributes' => array('type' => 'file'), 'options' => array('label' => 'File Upload'))); $this->add(array('name' => 'save', 'attributes' => array('type' => 'submit', 'value' => 'Submit', 'class' => "btn-blue"))); // $this->add(array( // 'name' => 'cancel', // 'attributes' => array( // 'type' => 'cancel', // 'value' => 'Cancel', // 'class' => 'btn btn-primary', // ), // 'options' => array( // 'label' => 'Cancel' // ), // )); }
/** * @dataProvider selectOptionsDataProvider */ public function testInArrayValidationOfOptions($valueTests, $options) { $element = new SelectElement('my-select'); $element->setAttributes(array('options' => $options)); $inputSpec = $element->getInputSpecification(); $this->assertArrayHasKey('validators', $inputSpec); $inArrayValidator = $inputSpec['validators'][0]; $this->assertInstanceOf('Zend\\Validator\\InArray', $inArrayValidator); foreach ($valueTests as $valueToTest) { $this->assertTrue($inArrayValidator->isValid($valueToTest)); } }
public function __construct($name = null, $options = array()) { parent::__construct(isset($name) ? $name : 'personal'); $id_hidden = new Element\Hidden('id'); $id_hidden->setName('id'); $firstname_text = new Element\Text('firstname'); $firstname_text->setLabel('First name'); $firstname_text->setLabelAttributes(array('class' => 'type_text')); $firstname_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...')); $lastname_text = new Element\Text('lastname'); $lastname_text->setLabel('Last name'); $lastname_text->setLabelAttributes(array('class' => 'type_text')); $lastname_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...', 'required' => true)); $country_select = new Element\Select('country_id'); $country_select->setLabel('Country'); $country_select->setLabelAttributes(array('class' => 'select f_3_w50')); $country_select->setAttributes(array('class' => 'sel_chosen')); $country_select->setOptions(array('disable_inarray_validator' => true, 'empty_option' => 'Please choose your country')); $state_select = new Element\Select('state_id'); $state_select->setLabel('Province/State'); $state_select->setLabelAttributes(array('class' => 'select f_3_w50')); $state_select->setAttributes(array('class' => 'sel_chosen', 'required' => true)); $state_select->setOptions(array('disable_inarray_validator' => true, 'empty_option' => 'Please choose your state')); $city_select = new Element\Select('city_id'); $city_select->setLabel('City'); $city_select->setLabelAttributes(array('class' => 'select f_3_w50')); $city_select->setAttributes(array('class' => 'sel_chosen', 'required' => true)); $city_select->setOptions(array('disable_inarray_validator' => true, 'empty_option' => 'Please choose your city')); $adress_text = new Element\Text('adress'); $adress_text->setLabel('Adress'); $adress_text->setLabelAttributes(array('class' => 'type_text')); $adress_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type adress in format (наш формат)')); $languages_select = new Element\Select('languages'); $languages_select->setLabel('Languages'); $languages_select->setLabelAttributes(array('class' => 'select', 'style' => 'float:left;')); $languages_select->setAttributes(array('class' => 'sel_chosen', 'multiple' => 'multiple', 'required' => true)); $languages_select->setOptions(array('disable_inarray_validator' => true)); $logo = new Element\Image('logo'); $logo->setAttributes(array('src', '/images/11.jpg', 'style' => 'float:left;')); $file = new Element\File('file'); $file->setLabelAttributes(array('style' => 'float:left;clear:both')); $this->add($id_hidden); $this->add($firstname_text); $this->add($lastname_text); $this->add($country_select); $this->add($state_select); $this->add($city_select); $this->add($adress_text); $this->add($languages_select); $this->add($logo); $this->add($file); }
public function addElements() { $this->setAttribute('method', 'post'); $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden'))); $element = new Element\Text('name'); $element->setAttributes(array('class' => 'name', 'size' => '30', 'class' => 'form-control', 'placeholder' => 'name')); $this->add($element); $element = new Element\Select('parent_id'); $element->setAttributes(array('class' => 'form-control ', 'placeholder' => 'parent')); $element->setValueOptions(array(0 => 'Main')); $this->add($element); $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Send', 'id' => 'submitbutton', 'class' => 'form-control btn btn-primary'))); }
/** * Load Textarea prevalue editor * - cols: Number of caracters display per line * - rows: Define the number of line visible in text zone * - wrap: Possible values are : hard / off / soft * define if line returns are automatic (hard / soft) * or if the horizontal display if exceeded (off) * * @return mixed */ public function load() { $config = $this->getConfig(); $cols = new Element\Text('cols'); $cols->setAttributes(array('value' => isset($config['cols']) ? $config['cols'] : '', 'class' => 'form-control')); $cols->setOptions(array('label' => 'Cols', 'label_attributes' => array('class' => 'required control-label col-lg-2'))); $rows = new Element\Text('rows'); $rows->setAttributes(array('value' => isset($config['rows']) ? $config['rows'] : '', 'class' => 'form-control')); $rows->setOptions(array('label' => 'Rows', 'label_attributes' => array('class' => 'required control-label col-lg-2'))); $wrap = new Element\Select('wrap'); $wrap->setAttributes(array('class' => 'form-control', 'options' => array('hard' => 'hard', 'off' => 'off', 'soft' => 'soft'), 'value' => isset($config['wrap']) ? $config['wrap'] : '')); $wrap->setOptions(array('label' => 'Wrap', 'label_attributes' => array('class' => 'required control-label col-lg-2'))); return array($cols, $rows, $wrap); }
public function __construct($name = null) { parent::__construct('actividadesform'); $this->setAttribute('method', 'post'); $this->setAttribute('role', 'form'); $this->setAttributes(array('id' => 'actividadesform')); $actividades_id = new Element('actividades_id'); $actividades_id->setLabel('ID'); $actividades_id->setAttributes(array('type' => 'text', 'placeholder' => 'Este campo se genera automáticamente', 'id' => 'actividades_id', 'readonly' => 'readonly', 'class' => 'form-control')); $actividades_nombre = new Element('actividades_nombre'); $actividades_nombre->setLabel('Nombre'); $actividades_nombre->setAttributes(array('type' => 'text', 'placeholder' => 'ej: Mi Primera Actividad', 'id' => 'actividades_nombre', 'class' => 'form-control')); $actividades_estado = new Element\Select('actividades_estado'); $actividades_estado->setLabel('Estado'); //$actividades_estado->setEmptyOption('ELige un Estado..'); $actividades_estado->setOptions(array('disable_inarray_validator' => true)); $actividades_estado->setAttributes(array('id' => 'actividades_estado', 'class' => "form-control", 'data-rule-required' => "true", 'data-msg-required' => "Debe seleccionar el Estado")); $actividades_responsable = new Element\Select('actividades_responsable'); $actividades_responsable->setLabel('Responsable'); // $actividades_responsable->setEmptyOption('Elige un Responsable..'); $actividades_responsable->setOptions(array('disable_inarray_validator' => true)); $actividades_responsable->setAttributes(array('id' => 'actividades_responsable', 'class' => "form-control")); $actividades_area = new Element\Select('actividades_area'); $actividades_area->setLabel('Área'); $actividades_area->setEmptyOption('Elige una Área..'); $actividades_area->setOptions(array('disable_inarray_validator' => true)); $actividades_area->setAttributes(array('id' => 'actividades_area', 'class' => "form-control")); $actividades_reporta = new Element('actividades_reporta'); $actividades_reporta->setLabel('Reportada Por'); $actividades_reporta->setAttributes(array('type' => 'text', 'placeholder' => 'Persona que reporta', 'id' => 'actividades_reporta', 'class' => 'form-control')); $actividades_fecha = new Element('actividades_fecha'); $actividades_fecha->setLabel('Fecha de Inicio'); $actividades_fecha->setAttributes(array('placeholder' => 'Fecha de Inicio', 'id' => 'actividades_fecha', 'class' => 'form-control')); $actividades_fecha_fin = new Element('actividades_fecha_fin'); $actividades_fecha_fin->setLabel('Fecha de Finalización'); $actividades_fecha_fin->setAttributes(array('placeholder' => 'Fecha de Finalización', 'id' => 'actividades_fecha_fin', 'class' => 'form-control')); $guardar = new Element\Button('guardar'); $guardar->setAttributes(array('class' => 'btn btn-success mr5', 'type' => 'submit', 'id' => 'guardar')); $guardar->setOptions(array('label' => '<i class="glyphicon glyphicon-floppy-disk"></i>', 'label_options' => array('disable_html_escape' => true))); $this->add($actividades_id); $this->add($actividades_nombre); $this->add($actividades_fecha); $this->add($actividades_estado); $this->add($actividades_responsable); $this->add($actividades_area); $this->add($actividades_reporta); $this->add($actividades_fecha_fin); $this->add($guardar); }
public function __construct(EntityManager $em, $name = null, $options = array()) { $this->em = $em; parent::__construct('toll'); $this->setAttribute('method', 'post'); $this->add(array('name' => 'tollName', 'attributes' => array('type' => 'text', 'class' => 'commonDropDnInput', 'placeholder' => 'Toll Name'))); $city = new Element\Select('cityId'); $city->setEmptyOption("Select City Name"); $city->setAttributes(array("id" => "cityId")); $city->setAttributes(array("class" => "dropDnInput")); // $city->setAttributes(array('onChange'=>'setter("city",this.options[this.selectedIndex].text)','class'=>'dropDnInput')); $city->setValueOptions($this->getOptionsForSelectCity()); $this->add($city); $locationId = new Element\Select('locationId'); $locationId->setEmptyOption("Select Location Name"); // $locationId->setAttributes("id","location"); $locationId->setAttributes(array("id" => "location")); $locationId->setAttributes(array("class" => "dropDnInput")); // $locationId->setAttributes(array('onChange'=>'setter("city",this.options[this.selectedIndex].text)','class'=>'dropDnInput')); $locationId->setValueOptions($this->getOptionsForSelectLocation()); $locationId->setDisableInArrayValidator(true); $this->add($locationId); $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Go', 'id' => 'submitbutton', 'class' => "btn-blue"))); }
public function __construct($name = null, $tracks = array()) { parent::__construct('submission'); $this->setAttribute('method', 'post'); $this->setAttribute('class', 'well offset3 span6'); // You'll see _() functions here. This is for the sake of "extractability" :) $this->add(array('name' => 'title', 'attributes' => array('type' => 'text', 'class' => 'span'), 'options' => array('label' => _('Title')))); $track = new Select('track_id', array('label' => _('Track'))); $track->setAttributes(array('class' => 'span', 'options' => $tracks)); $this->add($track); $this->add(array('name' => 'abstract', 'attributes' => array('type' => 'textarea', 'class' => 'span', 'rows' => '5'), 'options' => array('label' => _('Abstract')))); $this->add(array('name' => 'minicurriculo', 'attributes' => array('type' => 'textarea', 'class' => 'span', 'rows' => '5'), 'options' => array('label' => _('Mini-curriculo do palestrante')))); $duration = new Select('duration', array('label' => _('Duration'))); $duration->setAttributes(array('class' => 'span', 'options' => array('1' => '1h', '2' => '2h', '3' => '3h', '4' => '4h+'))); $this->add($duration); $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'id' => 'submitbutton', 'class' => 'btn btn-primary btn-large span', 'value' => _('Submit')))); }
public function __construct(EntityManager $em, $name = null, $options = array()) { $this->em = $em; // we want to ignore the name passed parent::__construct('vehiclemodel'); $this->setAttribute('method', 'post'); $this->add(array('name' => 'vehicleModelId', 'attributes' => array('type' => 'hidden'))); $vehicleBrand = new Element\Select('vehicleBrandId'); $vehicleBrand->setAttributes(array('class' => 'dropDnInput')); $vehicleBrand->setEmptyOption("Select Brand"); $vehicleBrand->setValueOptions($this->getOptionsForSelectBrands()); $vehicleBrand->setDisableInArrayValidator(TRUE); $this->add($vehicleBrand); $this->add(array('name' => 'vehicleModelName', 'attributes' => array('type' => 'text', 'class' => 'commonDropDnInput', 'placeholder' => 'Vehicle Model Name'))); $this->add(array('name' => 'status', 'type' => 'Select', 'attributes' => array('class' => 'dropDnInput'), 'options' => array('empty_option' => 'Select Status', 'value_options' => array('0' => 'InActive', '1' => 'Active')))); $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'vehiclModeladd', 'id' => 'submitbutton', 'class' => "btn-blue"))); }
public function __construct($name = null) { parent::__construct('user'); $this->setAttribute('method', 'post'); $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden'))); $element = new Element\Email('email'); $element->setAttributes(array('class' => 'form-control', 'placeholder' => 'email')); $this->add($element); $element = new Element\Text('name'); $element->setAttributes(array('class' => 'username', 'size' => '30', 'class' => 'form-control', 'placeholder' => 'name')); $this->add($element); $element = new Element\Password('password'); $element->setAttributes(array('class' => 'form-control', 'placeholder' => 'password')); $this->add($element); $element = new Element\Select('role'); $element->setAttributes(array('class' => 'form-control ', 'placeholder' => 'role')); $element->setValueOptions(User::getRoleNames()); $this->add($element); $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Send', 'id' => 'submitbutton', 'class' => 'form-control btn btn-primary'))); }
public function testProvidesInputSpecificationForMultipleSelect() { $element = new SelectElement(); $element->setAttributes(array('multiple' => true, 'options' => array('Option 1' => 'option1', 'Option 2' => 'option2', 'Option 3' => 'option3'))); $inputSpec = $element->getInputSpecification(); $this->assertArrayHasKey('validators', $inputSpec); $this->assertInternalType('array', $inputSpec['validators']); $expectedClasses = array('Zend\\Validator\\Explode'); foreach ($inputSpec['validators'] as $validator) { $class = get_class($validator); $this->assertTrue(in_array($class, $expectedClasses), $class); switch ($class) { case 'Zend\\Validator\\Explode': $this->assertInstanceOf('Zend\\Validator\\InArray', $validator->getValidator()); break; default: break; } } }
public function addElements() { $this->setAttribute('method', 'post'); $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden'))); $element = new Element\Text('title'); $element->setAttributes(array('size' => '30', 'class' => 'form-control', 'placeholder' => 'title')); $this->add($element); $element = new Element\Text('name'); $element->setAttributes(array('size' => '30', 'class' => 'form-control', 'placeholder' => 'Название на английском одним словом', 'alt' => 'Название на английском одним словом', 'title' => 'Название на английском одним словом')); $this->add($element); $element = new Element\Select('category_id'); $element->setAttributes(array('class' => 'form-control ', 'placeholder' => 'category')); $this->add($element); $element = new Element\File('thumb', array('required' => false)); $element->setLabel('Preview')->setOptions(array('required' => false))->setAttributes(array('required' => false, 'class' => 'form-control', 'placeholder' => 'preview')); $this->add($element); $element = new Element\Textarea('body'); $element->setAttributes(array('size' => '30', 'class' => 'form-control editor', 'placeholder' => 'body')); $this->add($element); $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Send', 'id' => 'submitbutton', 'class' => 'form-control btn btn-primary'))); }
public function __construct($name = null) { parent::__construct('terms'); $id_hidden = new Element\Hidden('id'); $id_hidden->setName('id'); $orders_radio = new Element\Radio('custom_orders'); $orders_radio->setLabel('Custom orders'); $orders_radio->setValueOptions(array('0' => 'No', '1' => 'Yes')); $shipping_select = new Element\Select('shipping'); $shipping_select->setLabel('Shipping'); $shipping_select->setLabelAttributes(array('class' => 'select f_3_w50')); $shipping_select->setAttributes(array('class' => 'sel_chosen')); $shipping_select->setOptions(array('disable_inarray_validator' => true, 'empty_option' => 'Please choose your shipping')); $policies_text = new Element\Textarea('wholesale_policies'); $policies_text->setLabel('Wholesale policies'); $policies_text->setLabelAttributes(array('class' => 'type_text')); $policies_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...')); $this->add($id_hidden); $this->add($orders_radio); $this->add($shipping_select); $this->add($policies_text); }
public function __construct($name = null) { parent::__construct('filmes'); $this->setAttribute('enctype', 'multipart/form-data'); $id = new Hidden('filmes_id'); $nome = new Text('filmes_nome'); $nome->setLabel('Nome: '); $nome->setAttributes(array('class' => 'form-control', 'id' => 'filmes_nome')); $preco = new Text('filmes_preco'); $preco->setLabel('Valor Aluguel: '); $preco->setAttributes(array('class' => 'form-control', 'id' => 'filmes_preco')); $categoria = new Select('categoria_id'); $categoria->setLabel('Categoria: '); $categoria->setAttributes(array('class' => 'form-control', 'id' => 'categoria_id', 'empty_option' => 'Please select an author', 'value_options' => $this->getOptionsForSelect())); $foto = new File('filmes_foto'); $foto->setLabel('Cartaz: '); $foto->setAttributes(array('class' => 'form-control')); $descricao = new Textarea('filmes_descricao'); $descricao->setLabel('Dados do Filme: '); $descricao->setAttributes(array('style' => 'height: 100px;', 'class' => 'form-control', 'id' => 'filmes_descricao')); $status = new Checkbox('filmes_status'); $status->setLabel("Mostrar?"); $status->setValue(1); $submit = new Button('submit'); $submit->setLabel('Cadastrar'); $submit->setAttributes(array('type' => 'submit', 'class' => 'btn btn-success')); $cancel = new Button('cancel'); $cancel->setLabel('Cancelar'); $cancel->setAttributes(array('type' => 'button', 'class' => 'btn btn-default', 'onclick' => 'javascript:history.go(-1)')); $this->add($id); $this->add($nome); $this->add($preco); $this->add($foto); $this->add($descricao); $this->add($categoria); $this->add($status); $this->add($submit); $this->add($cancel); }
public function __construct($name = null, $user_id = null) { parent::__construct($name); $this->setAttribute('method', 'post'); $this->setAttribute('class', 'well offset3 span5'); // You'll see _() functions here. This is for the sake of "extractability" :) $this->add(array('name' => 'user_id', 'attributes' => array('type' => 'hidden', 'value' => $user_id))); $this->add(array('name' => 'name', 'attributes' => array('type' => 'text', 'class' => 'span5'), 'options' => array('label' => _('Conference name')))); $this->add(array('name' => 'short_name', 'attributes' => array('type' => 'text', 'class' => 'span5'), 'options' => array('label' => _('Conference name (short)')))); $this->add(array('name' => 'description', 'attributes' => array('type' => 'textarea', 'class' => 'span5'), 'options' => array('label' => _('Description')))); $this->add(array('name' => 'registration_fee', 'attributes' => array('type' => 'textarea', 'class' => 'span5'), 'options' => array('label' => _('Registration fee')))); $this->add(array('name' => 'location', 'attributes' => array('type' => 'text', 'class' => 'span5'), 'options' => array('label' => _('Location')))); $this->add(array('name' => 'address', 'attributes' => array('type' => 'text', 'class' => 'span5'), 'options' => array('label' => _('Address')))); $this->add(array('name' => 'city', 'attributes' => array('type' => 'text', 'class' => 'span5'), 'options' => array('label' => _('City')))); $this->add(array('name' => 'state', 'attributes' => array('type' => 'text', 'class' => 'span5'), 'options' => array('label' => _('State')))); $this->add(array('name' => 'country', 'attributes' => array('type' => 'text', 'class' => 'span5'), 'options' => array('label' => _('Country')))); $gmt = new Select('gmt', array('label' => _('GMT'))); $gmt->setAttributes(array('class' => 'span5', 'options' => array('-12.0' => '(GMT -12:00) Eniwetok, Kwajalein', '-11.0' => '(GMT -11:00) Midway Island, Samoa', '-10.0' => '(GMT -10:00) Hawaii', '-9.0' => '(GMT -9:00) Alaska', '-8.0' => '(GMT -8:00) Pacific Time (US & Canada)', '-7.0' => '(GMT -7:00) Mountain Time (US & Canada)', '-6.0' => '(GMT -6:00) Central Time (US & Canada), Mexico City', '-5.0' => '(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima', '-4.0' => '(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz', '-3.5' => '(GMT -3:30) Newfoundland', '-3.0' => '(GMT -3:00) Brazil, Buenos Aires, Georgetown', '-2.0' => '(GMT -2:00) Mid-Atlantic', '-1.0' => '(GMT -1:00 hour) Azores, Cape Verde Islands', '0.0' => '(GMT) Western Europe Time, London, Lisbon, Casablanca', '1.0' => '(GMT +1:00 hour) Brussels, Copenhagen, Madrid, Paris', '2.0' => '(GMT +2:00) Kaliningrad, South Africa', '3.0' => '(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg', '3.5' => '(GMT +3:30) Tehran', '4.0' => '(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi', '4.5' => '(GMT +4:30) Kabul', '5.0' => '(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent', '5.5' => '(GMT +5:30) Bombay, Calcutta, Madras, New Delhi', '5.75' => '(GMT +5:45) Kathmandu', '6.0' => '(GMT +6:00) Almaty, Dhaka, Colombo', '7.0' => '(GMT +7:00) Bangkok, Hanoi, Jakarta', '8.0' => '(GMT +8:00) Beijing, Perth, Singapore, Hong Kong', '9.0' => '(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk', '9.5' => '(GMT +9:30) Adelaide, Darwin', '10.0' => '(GMT +10:00) Eastern Australia, Guam, Vladivostok', '11.0' => '(GMT +11:00) Magadan, Solomon Islands, New Caledonia', '12.0' => '(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka'))); $this->add($gmt); $this->add(new Checkbox('show_running', array('label' => _('Show alert when conference is running')))); $this->add(new Checkbox('active', array('label' => _('Active')))); $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'id' => 'submitbutton', 'value' => _('Save'), 'class' => 'btn btn-primary btn-large span2'))); }
public function __construct($name = null, $options = array()) { parent::__construct(isset($name) ? $name : 'about'); $id_hidden = new Element\Hidden('id'); $id_hidden->setName('id'); $specialty_text = new Element\Text('specialty'); $specialty_text->setLabel('Specialty'); $specialty_text->setLabelAttributes(array('class' => 'type_text')); $specialty_text->setAttributes(array('class' => 'type_text_input')); $proficiency_select = new Element\Select('proficiency_level'); $proficiency_select->setLabel('Proficiency level'); $proficiency_select->setLabelAttributes(array('class' => 'select f_3_w50')); $proficiency_select->setAttributes(array('class' => 'sel_chosen')); $proficiency_select->setOptions(array('disable_inarray_validator' => true, 'empty_option' => 'Please choose your proficiency')); $about_textarea = new Element\Textarea('about'); $about_textarea->setLabel('About'); $about_textarea->setLabelAttributes(array('class' => 'type_text')); $about_textarea->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...', 'required' => 'require')); $this->add($id_hidden); $this->add($specialty_text); $this->add($proficiency_select); $this->add($about_textarea); }
/** * Set the second attributes * * @param array $secondAttributes * @return DateSelect */ public function setSecondAttributes(array $secondAttributes) { $this->secondElement->setAttributes($secondAttributes); return $this; }
/** * Set the day attributes * * @param array $dayAttributes * @return DateSelect */ public function setDayAttributes(array $dayAttributes) { $this->dayElement->setAttributes($dayAttributes); return $this; }
/** * Builds fieldset with additional properties for the "yearly" repeat picker value. * It returns the built fieldset (used as a child of the "repeat" fieldset). * * @return Fieldset */ public function getRepeatYearlyFieldset() { $repeatYearlyFieldset = new Fieldset(self::YEARLY); $repeatYearlyFieldset->setLabel('Pick date'); $month = new Element\Select('month'); $month->setAttributes(array('class' => 'form-control month pull-left', 'autocomplete' => 'off')); $month->setValueOptions($this->_monthOptions); $repeatYearlyFieldset->add($month); $day = new Element\Number('dayOfMonth'); $day->setValue(1); $day->setAttributes(array('class' => 'form-control input-day pull-left', 'autocomplete' => 'off', 'maxlength' => 2, 'min' => 1, 'max' => 31)); $repeatYearlyFieldset->add($day); return $repeatYearlyFieldset; }
/** * Set the year attributes * * @param array $yearAttributes * @return MonthSelect */ public function setYearAttributes(array $yearAttributes) { $this->yearElement->setAttributes($yearAttributes); return $this; }
public function __construct(EntityManager $em, OrmPublicador $tipoPrivilegio = null, OrmPrivilegios $orm = null) { parent::__construct("formPrivilegios"); // var_dump($option); // exit(); /* * txtID */ $txtId = new Element\Hidden("id"); /* * txtNome */ $txtDataInicio = new Element\Text("dataInicio"); $txtDataInicio->setAttributes(array('class' => 'form-control', 'placeholder' => 'XX/XX/XXXX', 'max-length' => '10', 'required' => 'true')); $txtDataTermino = new Element\Text("dataTermino"); $txtDataTermino->setAttributes(array('class' => 'form-control', 'placeholder' => 'XX/XX/XXXX', 'max-length' => '10')); /* * cmbPublicador */ $dao = $em->getRepository('Stj\\Entity\\OrmPublicador'); if (empty($tipoPrivilegio)) { $lista = $dao->findAll(); } else { $lista = $dao->ListALLWhere($tipoPrivilegio->getId()); } $option = array(); foreach ($lista as $key => $value) { $tipoPrivilegio = new OrmPublicador(); $tipoPrivilegio = $value; $option[$tipoPrivilegio->getId()] = $tipoPrivilegio->getNome(); } $cmbPublicador = new Element\Select('publicador'); $cmbPublicador->setValueOptions($option); $cmbPublicador->setEmptyOption("Selecionar"); $cmbPublicador->setAttributes(array('class' => 'chosen-select', 'style' => 'width:175px;', 'required' => 'true')); /* * cmbPrivilegio */ $dao = $em->getRepository('Stj\\Entity\\OrmTipoPrivilegios'); $lista = $dao->findAll(); $option = array(); foreach ($lista as $key => $value) { $tipoPrivilegio = new OrmTipoPrivilegios(); $tipoPrivilegio = $value; $option[$tipoPrivilegio->getId()] = $tipoPrivilegio->getNome(); } $cmbPrivilegio = new Element\Select('privilegio'); $cmbPrivilegio->setValueOptions($option); $cmbPrivilegio->setEmptyOption("Selecionar"); $cmbPrivilegio->setAttributes(array('class' => 'chosen-select', 'style' => 'width:175px;', 'required' => 'true')); /* * Itoken */ $iToken = new Element\Csrf("iToken"); /* * btnSalvar */ $btnSalvar = new Element\Button('salvar'); $btnSalvar->setAttributes(array('class' => 'btn btn-darkgray btn-ef btn-ef-4 btn-ef-4c mb-10', 'type' => 'button')); /* * btnVoltar */ $btnVoltar = new Element\Button('voltar'); $btnVoltar->setAttributes(array('class' => 'btn btn-blue btn-ef btn-ef-4 btn-ef-4c mb-10', 'type' => 'button')); /* * Preencher Componentes */ if ($orm != null) { $txtId->setValue($orm->getId()); $txtDataInicio->setValue($orm->getDataInicio() != "" ? $orm->getDataInicio()->format('d/m/Y') : ""); $txtDataTermino->setValue($orm->getDataTermino() != "" ? $orm->getDataTermino()->format('d/m/Y') : ""); $cmbPrivilegio->setValue($orm->getTipoPrivilegio()->getId()); $cmbPublicador->setValue($orm->getPublicador()->getId()); } // Adiciona componetes no form $this->add($txtId); $this->add($txtDataInicio); $this->add($txtDataTermino); $this->add($cmbPublicador); $this->add($cmbPrivilegio); $this->add($iToken); $this->add($btnSalvar); $this->add($btnVoltar); $this->setAttributes(array('id' => 'form', 'data-parsley-validate' => NULL)); }
public function testDeprecateOptionsInAttributes() { $element = new SelectElement(); $valueOptions = array('Option 1' => 'option1', 'Option 2' => 'option2', 'Option 3' => 'option3'); $element->setAttributes(array('multiple' => true, 'options' => $valueOptions)); $this->assertEquals($valueOptions, $element->getValueOptions()); }
public function __construct(EntityManager $em, OrmPublicador $publicador = null, OrmLogin $orm = null) { parent::__construct("formLogin"); // var_dump($option); // exit(); /* * txtID */ $txtId = new Element\Hidden("id"); /* * txtNome */ $txtEmail = new Element\Email("email"); $txtEmail->setAttributes(array('class' => 'form-control', 'placeholder' => 'Nome do Grupo', 'data-parsley-trigger' => 'change', 'required' => 'true')); /* * txtSenha */ $txtSenha = new Element\Password("senha"); $txtSenha->setAttributes(array('id' => "senha", 'class' => 'form-control', 'placeholder' => 'Nome do Grupo', 'required' => 'true', "data-parsley-trigger" => "change", "data-parsley-length" => "[6, 20]")); /* * txtSenhaConfirma */ $txtSenhaConfirma = new Element\Password("senhaconfirmar"); $txtSenhaConfirma->setAttributes(array('class' => 'form-control', 'placeholder' => 'Nome do Grupo', 'required' => 'true', "data-parsley-trigger" => "change", "data-parsley-equalto" => "#senha")); /* * cmbPublicador */ $dao = $em->getRepository('Stj\\Entity\\OrmPublicador'); if (empty($publicador)) { $lista = $dao->findAll(); } else { $lista = $dao->ListALLWhere($publicador->getGrupo()->getCongregacao()->getId()); } $option = array(); foreach ($lista as $key => $value) { $publicador = new OrmPublicador(); $publicador = $value; $option[$publicador->getId()] = $publicador->getNome(); } $cmbPublicador = new Element\Select('publicador'); $cmbPublicador->setValueOptions($option); $cmbPublicador->setEmptyOption("Selecionar"); $cmbPublicador->setAttributes(array('class' => 'chosen-select', 'style' => 'width:175px;', 'required' => 'true')); /* * cmbNivel */ $dao = $em->getRepository('Stj\\Entity\\OrmNivel'); $lista = $dao->ListALL(FALSE); $option = array(); foreach ($lista as $key => $value) { $nivel = new OrmNivel(); $nivel = $value; $option[$nivel->getId()] = $nivel->getNome(); } $cmbNivel = new Element\Select('nivel'); $cmbNivel->setValueOptions($option); $cmbNivel->setEmptyOption("Selecionar"); $cmbNivel->setAttributes(array('class' => 'chosen-select', 'style' => 'width:175px;', 'required' => 'true')); /* * Itoken */ $iToken = new Element\Csrf("iToken"); /* * btnSalvar */ $btnSalvar = new Element\Button('salvar'); $btnSalvar->setAttributes(array('class' => 'btn btn-darkgray btn-ef btn-ef-4 btn-ef-4c mb-10', 'type' => 'button')); /* * btnVoltar */ $btnVoltar = new Element\Button('voltar'); $btnVoltar->setAttributes(array('class' => 'btn btn-blue btn-ef btn-ef-4 btn-ef-4c mb-10', 'type' => 'button')); /* * Preencher Componentes */ if ($orm != null) { $txtId->setValue($orm->getId()); $txtEmail->setValue($orm->getEmail()); $cmbPublicador->setValue($orm->getPublicador()->getId()); $cmbNivel->setValue($orm->getNivel()->getId()); } // Adiciona componetes no form $this->add($txtId); $this->add($txtEmail); $this->add($txtSenha); $this->add($txtSenhaConfirma); $this->add($cmbPublicador); $this->add($cmbNivel); $this->add($iToken); $this->add($btnSalvar); $this->add($btnVoltar); $this->setAttributes(array('id' => 'form', 'data-parsley-validate' => NULL)); }