/** * 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'; } }
/** * construct AddressInput object * @param string $name * @param string $value */ function __construct($name, $value = null) { parent::__construct($name, $value); $translator = Translator::getInstance(); // create the text inputs // NOTE: values must be the same as the titles for the jquery script $postcode = $translator->get('inputs.postal-code'); $this->postcode = Form::text($name . '-' . $postcode)->setPlaceholder(str_replace('-', ' ', $postcode))->setTitle(str_replace('-', ' ', $postcode))->setWidth(100); $hnr = $translator->get('inputs.house-number'); $this->houseNumber = Form::text($name . '-' . $hnr)->setTitle(str_replace('-', ' ', $hnr))->setPlaceholder(str_replace('-', ' ', $hnr))->setWidth(50); $ext = $translator->get('inputs.extension'); $this->houseNumberExtension = Form::text($name . '-' . $ext)->setPlaceholder(str_replace('-', ' ', $ext))->setTitle(str_replace('-', ' ', $ext))->setWidth(150); $this->attachObserver($this->postcode); $this->attachObserver($this->houseNumber); $this->attachObserver($this->houseNumberExtension); // set the global placeholder style that will get copied down $this->addClass('address'); }
/** * construct InputButton * @param string $name * @param mixed $value */ function __construct($name, $value = null) { parent::__construct($name, $value); // always set btn class $this->addClass('btn'); }