コード例 #1
0
ファイル: DateInput.php プロジェクト: winkbrace/winkform
 /**
  * construct DateInput
  * @param string $name
  * @param mixed $value
  */
 function __construct($name, $value = null)
 {
     // set date format before construction to be able to validate $value
     $config = Config::all();
     $this->setDateFormat($config['date_format']);
     parent::__construct($name, $value);
     // create TextInput object with all same properties as this DateInput object
     $this->text = new TextInput($this->name, $value);
     $this->text->setWidth(80)->setMaxLength(10);
     $this->attachObserver($this->text);
     // set the calendar image specified in the config file if it is a valid url to an image
     $this->setCalendarImage($config['calendar_image']);
     if (empty($this->calendarImage)) {
         // set default calendar image (base64 encoded, so no actual image file required to use this class)
         // It is of course better to use an actual image for performance reasons
         $this->calendarImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACpklEQVRYheWXPWgU' . 'QRTHf5dLxIgiBEQtEgRR4gdiLShWojZ+gbYWthaijSCWgoWVBK1URJAjhYKKX6DEFEpADeYM+IGiSBJzaESNXvwai/cm+9yb3dsNF1L' . '4YGF+M/tm/vPmzcxuwTnHTFrTjI4O4JyjThS2AQeBlpxdb1e/Wanj1hHQAlQAB6zLMXiz8duUJqDZ1K0F2mPvfQZ+a7kTaAMKGQRUjd' . '8qJArWbwh4+I8S4KIqtk8JeKnlrkB70nMTeKHl84H2y35cm4QTsVl8AU4Bs5VvAb0ZZv8VOA60Kt8GemLvTI6VtgvKQB8wT3kUuJpBQ' . 'Bl4YPwqwLWkl9MEdCDreANZhjKSJ/WsPebXl+pncuActWvVDawGlgOHteMsOXDJ+B0K+JVC2zAkYLqeUmgbeqsAp/VFkGUqEG2rrBby' . '24ss7aSFBAwDR3MOltU2xAWEkrCYUN8Iq5lwKAJJtgjYqeV+4DWwQ/k+MAZsVe4BvgOble8hu6jWAklYJhyB9URJdBLYaPgIsMvwfmC' . 'P4QPaRy+xJJxqqH3HWTnR8izBIDJLkHN+yPAAcgR7fowct5778wpwwFLgmPJ15ILZolxE1tjzODBi+ANyl3geA17lFbAA2K38Cbk+9y' . 'lXkbvB8xskQp6fxNoHgbt5BAD8IjpEvmnZsm2vAj8NTyg7w0FLEtAEPAXWKH9EwujZh9jze+CH4WEV0Kk8mlfAHyQHSsoXkIupW/ksc' . 'EfrHXACORe6DJ8BnicNXE8AwFxgpZaXIB8YnjuQ+36F8mIkTyxnsjQB48AzLb9Fst7zO2TbeR5RAZanLMAnzgDRGnrLy0l9pwooAvOR' . 'PPAO/os2D8e/nl1ovJCAZUShbLS1pQloNXULp0mAtzkhAVdI2a8Ntke+UPjv/47/Ajh1PTcN0TPzAAAAAElFTkSuQmCC';
     }
 }
コード例 #2
0
ファイル: InputTest.php プロジェクト: winkbrace/winkform
 /**
  * test style attribute
  */
 public function testInputStyle()
 {
     $input = new TextInput('test');
     $input->setStyle(' text-align:right; ');
     $input->setWidth(300);
     $input->setHidden(true);
     $expected = array('text-align' => 'right', 'width' => '300px', 'display' => 'none');
     $this->assertEquals($expected, $input->getStyles()->all());
     $this->assertEquals(' style="text-align:right; width:300px; display:none;"', $input->renderStyle());
     // test removing style with spaces around
     $input->removeStyle(' text-align:right; ');
     $this->assertEquals(' style="width:300px; display:none;"', $input->renderStyle());
     $input->setWidth(200);
     $this->assertEquals(' style="width:200px; display:none;"', $input->renderStyle());
     $input->setHidden(false);
     $this->assertEquals(array('width' => '200px'), $input->getStyles()->all(), 'setting hidden to false should remove the display style');
 }