コード例 #1
0
ファイル: AddressInput.php プロジェクト: winkbrace/winkform
 /**
  * setSelected method that will set the child inputs values
  * @param array $selected array(postcode, housenr, extension)
  * @param int $flag
  * @return \WinkForm\Input\AddressInput
  * @see \WinkForm\Input\Input::setSelected()
  */
 public function setSelected($selected, $flag = 0)
 {
     if (empty($this->posted) || $this->isFlagSet($flag, self::INPUT_OVERRULE_POST)) {
         $selected = array_values((array) $selected);
         $this->selected = $selected;
         list($postcode, $housenumber, $extension) = $selected;
         $this->postcode->setSelected($postcode);
         $this->houseNumber->setSelected($housenumber);
         $this->houseNumberExtension->setSelected($extension);
     }
     return $this;
 }
コード例 #2
0
ファイル: DateInput.php プロジェクト: winkbrace/winkform
 /**
  * render the date input element
  * @return string
  */
 public function render()
 {
     // check result of validity checks of parameters passed to this Input element
     $this->checkValidity();
     // we will show/hide the container div for the text field and the image and not the text field and the image themselves
     $hidden = $this->getHidden() === true ? ' style="display:none;"' : '';
     $this->setHidden(false);
     // the text field must have the selected values
     $this->text->setValue($this->value);
     $this->text->setSelected($this->selected);
     $this->text->setRenderWithLabel($this->renderWithLabel);
     $output = $this->renderLabel(array('class' => 'date-element')) . '<div id="' . $this->id . '-container" class="inputs-container date-element"' . $hidden . $this->renderStyle() . '>' . $this->text->render() . '</div>' . PHP_EOL;
     if (empty($this->disabled)) {
         $output .= $this->getJS() . PHP_EOL;
     }
     $output .= $this->renderInvalidations();
     return $output;
 }
コード例 #3
0
ファイル: InputTest.php プロジェクト: winkbrace/winkform
 /**
  * test $selected attribute
  */
 public function testInputSelected()
 {
     $input = new TextInput('test', 'value');
     $this->assertNull($input->getSelected());
     $input->setSelected('selected');
     $this->assertEquals('selected', $input->getSelected());
     // test overrule post
     $_POST['foo'] = 'one';
     $input = new TextInput('foo');
     $this->assertEquals('one', $input->getSelected());
     $input->setSelected('two', Input::INPUT_OVERRULE_POST);
     $this->assertEquals('two', $input->getSelected());
 }