Re: [Phphtmllib-devel] phphtmllib/form/form_elements FEListBox.inc,1.13,1.14
Status: Beta
Brought to you by:
hemna
From: Culley H. <cu...@fa...> - 2004-03-11 15:02:37
|
Hi G=F6sta, I will add these if I don't end up switching it to using setlocale(). culley On Mar 11, 2004, at 1:44 AM, G=F6sta Bostr=F6m wrote: > This looks great! > > Could you add some more languages while you're at it? > (I'm not really sure if Swedish is shortened as 'se' like the domain = or > 'sv' for Swedish) > > 'sv' =3D> array ('short' =3D> array ('Jan', 'Feb', 'Mar', 'Apr', = 'Maj', > 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'), > 'long' =3D> array ('Januari', 'Februari', 'Mars', 'April', > 'Maj', 'Juni', 'Juli', 'Augusti', 'September', 'Oktober', 'November', > 'December')) > > Best regards, > > G=F6sta > > > > -----Original Message----- > From: php...@li... > [mailto:php...@li...] On Behalf Of > cu...@us... > Sent: den 11 mars 2004 07:01 > To: php...@li... > Subject: [Phphtmllib-devel] phphtmllib/form/form_elements > FEListBox.inc,1.13,1.14 > > Update of /cvsroot/phphtmllib/phphtmllib/form/form_elements > In directory > sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1675/form/form_elements > > Modified Files: > FEListBox.inc > Log Message: > > > Added several new date form elements: > > FEMonths > FEYears > FEDays > FEDate > > FEDate is a container object that contains the other three. FEDate is > not > complete but I wanted to commit this before I leave. Still need to = set > up a > validation routine for FEDate. Also need to figure out an elegant way > to > change element order in FEDate. Possibilities include: > > set_element_order('Ymd') > > set_year_first() > set_year_second() > set_year_third() > ... > > What would be best? > > Also, I ripped the locales for the months from PEAR. Rather than > identifier > strings should we set up constants for each locale? > > What do you think about all this? I think you would prefer = FECalendar, > but > this is a simple solution till something like that could be tackled. > > I haven't even tested submitting the date element yet so that probably > doesn't > work yet-- so far I have only worked on the display. > > culley > > > Index: FEListBox.inc > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: > /cvsroot/phphtmllib/phphtmllib/form/form_elements/FEListBox.inc,v > retrieving revision 1.13 > retrieving revision 1.14 > diff -u -d -r1.13 -r1.14 > --- FEListBox.inc 20 Nov 2003 23:08:34 -0000 1.13 > +++ FEListBox.inc 11 Mar 2004 06:01:14 -0000 1.14 > @@ -795,4 +795,262 @@ > return $c; > } > } > + > +/** > + * This class builds a FEDataList that shows > + * a select box for Months of the year > + * > + * @author Culley Harrelson <cu...@fa...> > + * > + */ > + > +class FEMonths extends FEListBox { > + > + /** > + * The months array divided up by language > + * @var array > + */ > + var $_locale =3D array( > + 'en' =3D> array ( > + 'short' =3D> array ('Jan', 'Feb', 'Mar', 'Apr', 'May', > 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), > + 'long' =3D> array ('January', 'February', 'March', =20 > 'April', > 'May', 'June', 'July', 'August', 'September', 'October', 'November', > 'December') > + ), > + 'de' =3D> array ( > + 'short' =3D> array ('Jan', 'Feb', 'M=E4rz', 'April', = 'Mai', > 'Juni', 'Juli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dez'), > + 'long' =3D> array ('Januar', 'Februar', 'M=E4rz', = 'April', > 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', > 'Dezember') > + ), > + 'fr' =3D> array ( > + 'short' =3D> array ('Jan', 'Fev', 'Mar', 'Avr', 'Mai', > 'Jun', 'Jul', 'Aou', 'Sep', 'Oct', 'Nov', 'Dec'), > + 'long' =3D> array ('Janvier', 'Fevrier', 'Mars', = 'Avril', > 'Mai', 'Juin', 'Juillet', 'Aout', 'Septembre', 'Octobre', 'Novembre', > 'Decembre') > + ), > + 'hu' =3D> array ( > + 'short' =3D> array ('jan', 'feb', 'm=E1rc', '=E1pr', = 'm=E1j', > 'j=FAn', 'j=FAl', 'aug', 'szept', 'okt', 'nov', 'dec'), > + 'long' =3D> array ('janu=E1r', 'febru=E1r', 'm=E1rcius', > '=E1prilis', 'm=E1jus', 'j=FAnius', 'j=FAlius', 'augusztus', = 'szeptember', > 'okt=F3ber', 'november', 'december') > + ), > + 'pl' =3D> array ( > + 'short' =3D> array ('Sty', 'Lut', 'Mar', 'Kwi', 'Maj', > 'Cze', 'Lip', 'Sie', 'Wrz', 'Pa=BC', 'Lis', 'Gru'), > + 'long' =3D> array ('Stycze=F1', 'Luty', 'Marzec', =20 > 'Kwiecie=F1', > 'Maj', 'Czerwiec', 'Lipiec', 'Sierpie=F1', 'Wrzesie=F1', = 'Pa=BCdziernik', > 'Listopad', 'Grudzie=F1') > + ), > + 'sl' =3D> array ( > + 'short' =3D> array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', > 'Jun', 'Jul', 'Avg', 'Sep', 'Okt', 'Nov', 'Dec'), > + 'long' =3D> array ('Januar', 'Februar', 'Marec', = 'April', > 'Maj', 'Junij', 'Julij', 'Avgust', 'September', 'Oktober', 'November', > 'December') > + ), > + 'ru' =3D> array ( > + 'short' =3D> array ('=DF=ED=E2', '=D4=E5=E2', '=CC=E0=F0',= '=C0=EF=F0', '=CC=E0=E9', > '=C8=FE=ED', '=C8=FE=EB', '=C0=E2=E3', '=D1=E5=ED', '=CE=EA=F2', = '=CD=EE=FF', '=C4=E5=EA'), > + 'long' =3D> array ('=DF=ED=E2=E0=F0=FC', '=D4=E5=E2=F0=E0= =EB=FC', '=CC=E0=F0=F2', '=C0=EF=F0=E5=EB=FC', > '=CC=E0=E9', '=C8=FE=ED=FC', '=C8=FE=EB=FC', '=C0=E2=E3=F3=F1=F2', = '=D1=E5=ED=F2=FF=E1=F0=FC', '=CE=EA=F2=FF=E1=F0=FC', '=CD=EE=FF=E1=F0=FC',= > '=C4=E5=EA=E0=E1=F0=FC') > + ), > + 'es' =3D> array ( > + 'short' =3D> array ('Ene', 'Feb', 'Mar', 'Abr', 'May', > 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'), > + 'long' =3D> array ('Enero', 'Febrero', 'Marzo', = 'Abril', > 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septimbre', 'Octubre', =20 > 'Noviembre', > 'Diciembre') > + ), > + 'da' =3D> array ( > + 'short' =3D> array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', > 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'), > + 'long' =3D> array ('Januar', 'Februar', 'Marts', = 'April', > 'Maj', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', > 'December') > + ), > + 'is' =3D> array ( > + 'short' =3D> array ('Jan', 'Feb', 'Mar', 'Apr', 'Ma=ED', > 'J=FAn', 'J=FAl', '=C1g=FA', 'Sep', 'Okt', 'N=F3v', 'Des'), > + 'long' =3D> array ('Jan=FAar', 'Febr=FAar', 'Mars', = 'Apr=EDl', > 'Ma=ED', 'J=FAn=ED', 'J=FAl=ED', '=C1g=FAst', 'September', 'Okt=F3ber', = 'N=F3vember', > 'Desember') > + ), > + 'it' =3D> array ( > + 'short' =3D> array ('Gen', 'Feb', 'Mar', 'Apr', 'Mag', > 'Giu', 'Lug', 'Ago', 'Set', 'Ott', 'Nov', 'Dic'), > + 'long' =3D> array ('Gennaio', 'Febbraio', 'Marzo', > 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', > 'Ottobre', 'Novembre', 'Dicembre') > + ), > + 'sk' =3D> array ( > + 'short' =3D> array ('Jan', 'Feb', 'Mar', 'Apr', 'M=E1j', > 'J=FAn', 'J=FAl', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'), > + 'long' =3D> array ('Janu=E1r', 'Febru=E1r', 'Marec', = 'Apr=EDl', > 'M=E1j', 'J=FAn', 'J=FAl', 'August', 'September', 'Okt=F3ber', = 'November', > 'December') > + ), > + 'cs' =3D> array ( > + 'short' =3D> array ('Led', '=DAno', 'B=F8e', 'Dub', = 'Kv=EC', > '=C8en', '=C8ec', 'Srp', 'Z=E1=F8', '=D8=EDj', 'Lis', 'Pro'), > + 'long' =3D> array ('Leden', '=DAnor', 'B=F8ezen', = 'Duben', > 'Kv=ECten', '=C8erven', '=C8ervenec', 'Srpen', 'Z=E1=F8=ED', '=D8=EDjen'= , 'Listopad', > 'Prosinec') > + ), > + 'hy' =3D> array( > + 'short' =3D> array > = ('=D0=DD=ED','=F6=EF=F1','=D8=F1=EF','=B2=E5=F1','=D8=DB=EB','=D0=DD=EB','= =D0=C9=EB','=FA=B7=EB','=EA=E5=EF','=D0=CF=EF','=DC=DB=D9','=B8=CF=EF=20 > ' > ), > + 'long' =3D> array > = ('=D0=E1=F5=DD=ED=B3=F1','=F6=BB=EF=F1=ED=B3=F1','=D8=B3=F1=EF','=B2=E5=F1= =C7=C9','=D8=B3=DB=C7=EB','=D0=E1=F5=DD=C7=EB','=D0=E1=F5=C9=C7=EB','=FA=B7= =E1=EB=EF=E1=EB'=20 > , > '=EA=BB=E5=EF=BB=D9=B5=BB=F1','=D0=E1=CF=EF=BB=D9=B5=BB=F1','=DC=E1=DB=BB= =D9=B5=BB=F1','=B8=BB=CF=EF=BB=D9=B5=BB=F1') > + ), > + 'nl' =3D> array ( > + 'short' =3D> array ('Jan', 'Feb', 'Mar', 'Apr', 'Mei', > 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'), > + 'long' =3D> array ('Januari', 'Februari', 'Maart', =20 > 'April', > 'Mei', 'Juni', 'Juli', 'Augustus', 'September', 'Oktober', 'November', > 'December') > + ) > + ); > + > + > + /** > + * The constructor > + * > + * @param string text label for the element > + * @param boolean is this a required element? > + * @param int element width in characters, pixels (px), = percentage > (%) or elements (em) > + * @param int element height in px > + * @param string locale one of: en, de, hu, pl, sl, ru, es, da, =20= > is, > it, sk, cs, hy, nl > + * @param string format either long or short > + */ > + function FEMonths($label, $required =3D TRUE, $width =3D NULL, = $height > =3D NULL, $locale =3D 'en', $format =3D 'long') { > + $this->FEListBox($label, $required, $width, $height, > array_flip($this->_locale[$locale][$format])); > + } > +} > + > +/** > + * This class builds a FEDataList that shows > + * a select box listing a range of years > + * > + * @author Culley Harrelson <cu...@fa...> > + * > + */ > + > +class FEYears extends FEListBox { > + > + /** > + * The constructor > + * > + * @param string text label for the element > + * @param boolean is this a required element? > + * @param int element width in characters, pixels (px), = percentage > (%) or elements (em) > + * @param int element height in px > + * @param int min_year > + * @param int max_year > + */ > + function FEYears($label, $required =3D TRUE, $width =3D NULL, = $height =20 > =3D > NULL, $min_year =3D 2000, $max_year =3D 2010) { > + $this->FEListBox($label, $required, $width, $height, > array_flip(range($min_year, $max_year))); > + } > +} > + > +/** > + * This class builds a FEDataList that shows > + * a select box listing the days of the month > + * > + * @author Culley Harrelson <cu...@fa...> > + * > + */ > + > +class FEDays extends FEListBox { > + > + /** > + * The constructor > + * > + * @param string text label for the element > + * @param boolean is this a required element? > + * @param int element width in characters, pixels (px), = percentage > (%) or elements (em) > + * @param int element height in px > + */ > + > + function FEDays($label, $required =3D TRUE, $width =3D NULL, = $height =3D > NULL) { > + $this->FEListBox($label, $required, $width, $height, > array_flip(range(1, 31))); > + } > +} > + > +/** > + * This class builds a FEDataList that shows > + * a select box listing the days of the month > + * > + * @author Culley Harrelson <cu...@fa...> > + * > + */ > + > +class FEDate extends FEBoxElement { > + > + /** > + * The default locale for the month display > + * @var string > + */ > + var $_locale =3D 'en'; > + > + /** > + * The month format. Default to the long format. > + * @var bool > + */ > + var $_short_months =3D false; > + > + /** > + * The earliest year shown in the year list. > + * @var int > + */ > + var $_min_year =3D 2000; > + > + /** > + * The latest year shown in the year list. > + * @var string > + */ > + var $_max_year =3D 2010; > + > + /** > + * The constructor > + * > + * @param string text label for the element > + * @param boolean is this a required element? > + * @param int element width in characters, pixels (px), = percentage > (%) or elements (em) > + * @param int element height in px > + */ > + > + function FEDate($label, $required =3D TRUE, $width =3D NULL, = $height =3D > NULL) { > + $this->FEBoxElement($label, $required, $width, $height); > + } > + > + /** > + * This function builds and returns the > + * form element object > + * > + * @return object > + */ > + function get_element() { > + > + $month_format =3D ($this->_short_months) ? 'short' : 'long'; > + $container =3D new Container(); > + $years =3D new FEYears($this->_element_name . '_years', = false, > null, null, $this->_min_year, $this->_max_year); > + $months =3D new FEMonths($this->_element_name . '_months', =20= > false, > null, null, $this->_locale, $month_format); > + $days =3D new FEDays($this->_element_name . '_days'); > + > + $container->add($months->get_element()); > + $container->add($days->get_element()); > + $container->add($years->get_element()); > + > + return $container; > + > + } > + > + /** > + * this method sets the locale for the Month display > + * > + * @param string locale > + */ > + function set_locale($locale =3D 'en') { > + > + $this->_locale =3D $locale; > + > + } > + > + /** > + * this method toggles the month display between short and long > format > + * > + * @param bool > + */ > + function set_short_months($short_months =3D true) { > + > + $this->_short_months =3D $short_months; > + > + } > + > + /** > + * this method sets the earliest year shown in the year list > + * > + * @param int > + */ > + function set_min_year($min_year) { > + > + $this->_min_year =3D $min_year; > + > + } > + > + /** > + * this method sets the latest year shown in the year list > + * > + * @param int > + */ > + function set_max_year($max_year) { > + > + $this->_max_year =3D $max_year; > + > + } > + > +} > + > ?> > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcl= ick > _______________________________________________ > Phphtmllib-devel mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phphtmllib-devel > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id638&op=3Dclick > _______________________________________________ > Phphtmllib-devel mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phphtmllib-devel |