?
Current Path : /home1/savoy/www/savoyglobal.net/oscardraft/application/helpers/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/www/savoyglobal.net/oscardraft/application/helpers/datetime_helper.php |
<?php function createYears($start_year, $end_year, $id='year_select', $selected=null) { /*** the current year ***/ $selected = is_null($selected) ? date('Y') : $selected; /*** range of years ***/ $r = range($start_year, $end_year); /*** create the select ***/ $select = '<select name="'.$id.'" id="'.$id.'">'; foreach( $r as $year ) { $select .= "<option value=\"$year\""; $select .= ($year==$selected) ? ' selected="selected"' : ''; $select .= ">$year</option>\n"; } $select .= '</select>'; return $select; } function createMonths($id='month_select', $selected=null) { /*** array of months ***/ $months = array( 1=>'January', 2=>'February', 3=>'March', 4=>'April', 5=>'May', 6=>'June', 7=>'July', 8=>'August', 9=>'September', 10=>'October', 11=>'November', 12=>'December'); /*** current month ***/ $selected = is_null($selected) ? date('m') : $selected; $select = '<select name="'.$id.'" id="'.$id.'">'."\n"; foreach($months as $key=>$mon) { $select .= "<option value=\"$key\""; $select .= ($key==$selected) ? ' selected="selected"' : ''; $select .= ">$mon</option>\n"; } $select .= '</select>'; return $select; } function createDays($id='day_select', $selected=null) { /*** range of days ***/ $r = range(1, 31); /*** current day ***/ $selected = is_null($selected) ? date('d') : $selected; $select = "<select name=\"$id\" id=\"$id\">\n"; foreach ($r as $day) { $select .= "<option value=\"$day\""; $select .= ($day==$selected) ? ' selected="selected"' : ''; $select .= ">$day</option>\n"; } $select .= '</select>'; return $select; } function createHours($id='hours_select', $selected=null) { /*** range of hours ***/ $r = range(0, 23); /*** current hour ***/ $selected = is_null($selected) ? date('H') : $selected; $select = "<select name=\"$id\" id=\"$id\" class=\"chzn-done\" style=\"width:46px\">\n"; foreach ($r as $hour) { $select .= "<option value=\"$hour\""; $select .= ($hour==$selected) ? ' selected="selected"' : ''; $select .= ">".str_pad($hour, 2, '0', STR_PAD_LEFT)."</option>\n"; } $select .= '</select>'; return $select; } function createMinutes($id='minute_select', $selected=null) { /*** array of mins ***/ $minutes = range(0, 59); $selected = in_array($selected, $minutes) ? $selected : 0; $select = "<select name=\"$id\" id=\"$id\" class=\"chzn-done\" style=\"width:46px\">\n"; foreach($minutes as $min) { $select .= "<option value=\"$min\""; $select .= ($min==$selected) ? ' selected="selected"' : ''; $select .= ">".str_pad($min, 2, '0', STR_PAD_LEFT)."</option>\n"; } $select .= '</select>'; return $select; } ?>