[geeklog-cvs] Geeklog-1.x/public_html lib-common.php,1.721,1.722
Blaine Lang
blaine at qs1489.pair.com
Thu Aug 14 11:15:00 EDT 2008
Update of /cvsroot/geeklog/Geeklog-1.x/public_html
In directory qs1489.pair.com:/tmp/cvs-serv26022
Modified Files:
lib-common.php
Log Message:
Add support for function to be called with a start or end offset, Now you can generate a list of years going back 80 years and stop 10 years before or after current year.
Example: Birthday of member on a site where members have to be 18. No use showing years 5+ current year.
Index: lib-common.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/lib-common.php,v
retrieving revision 1.721
retrieving revision 1.722
diff -C2 -d -r1.721 -r1.722
*** lib-common.php 12 Aug 2008 18:24:53 -0000 1.721
--- lib-common.php 14 Aug 2008 15:14:45 -0000 1.722
***************
*** 4844,4848 ****
* unless @selected is < current year then starts with @selected
*
! * @param string $selected Selected year
* @see function COM_getMonthFormOptions
* @see function COM_getDayFormOptions
--- 4844,4850 ----
* unless @selected is < current year then starts with @selected
*
! * @param string $selected Selected year
! * @param int $startoffset Optional (can be +/-) Used to determine start year for range of years
! * @param int $endoffset Optional (can be +/-) Used to determine end year for range of years
* @see function COM_getMonthFormOptions
* @see function COM_getDayFormOptions
***************
*** 4852,4860 ****
*/
! function COM_getYearFormOptions( $selected = '' )
{
$year_options = '';
$cur_year = date( 'Y', time() );
! $start_year = $cur_year;
if( !empty( $selected ))
--- 4854,4870 ----
*/
! function COM_getYearFormOptions( $selected = '', $startoffset=0, $endoffset=5 )
{
$year_options = '';
+ if ($startoffset != 0)
+ {
+ $start_year = date ( 'Y' ) + $startoffset;
+ }
+ else
+ {
+ $start_year = date( 'Y', time() );
+ }
$cur_year = date( 'Y', time() );
! $finish_year = $cur_year + $endoffset;
if( !empty( $selected ))
***************
*** 4866,4870 ****
}
! for( $i = $start_year - 1; $i <= $cur_year + 5; $i++ )
{
$year_options .= '<option value="' . $i . '"';
--- 4876,4880 ----
}
! for( $i = $start_year - 1; $i <= $finish_year; $i++ )
{
$year_options .= '<option value="' . $i . '"';
More information about the geeklog-cvs
mailing list