4 public static function activeTimeField($model,$attribute,$htmlOptions=array())
9 $hourOptions = array(
'0'=>
' - ');
12 $hourOptions[$x] = (($x<10)?
'0':
'').$x;
17 $minuteOptions = array(
'0'=>
' - ');
20 $minuteOptions[$x] = (($x<10)?
'0':
'').$x;
25 $secondOptions = array(
'0'=>
' - ');
28 $secondOptions[$x] = (($x<10)?
'0':
'').$x;
33 $dayOptions = array(
'0'=>
' - ');
40 $monthOptions = array(
56 $yearOptions = array(
'0'=>
' - ');
60 $yearOptions[$x] = $x;
65 parent::resolveNameID($model,$attribute,$htmlOptions);
67 if (is_array($model->$attribute)) {
68 $arr = $model->$attribute;
69 $model->$attribute = mktime($arr[
'hour'],$arr[
'minute'],$arr[
'second'],$arr[
'month'],$arr[
'day'],$arr[
'year']);
72 if ($model->$attribute !=
'0' && isset($model->$attribute))
76 $day = intval(date(
'j',$model->$attribute));
77 $month = intval(date(
'm',$model->$attribute));
78 $year = intval(date(
'Y',$model->$attribute));
80 $hour = intval(date(
'H',$model->$attribute));
81 $minute = intval(date(
'i',$model->$attribute));
82 $second = intval(date(
's',$model->$attribute));
86 $day = intval(date(
'j',time()));
87 $month = intval(date(
'm',time()));
88 $year = intval(date(
'Y',time()));
90 $hour = intval(date(
'H',time()));
91 $minute = intval(date(
'i',time()));
92 $second = intval(date(
's',time()));
103 $return = parent::dropDownList($htmlOptions[
'name'].
'[day]', $day,$dayOptions);
104 $return .= parent::dropDownList($htmlOptions[
'name'].
'[month]', $month,$monthOptions);
105 $return .= parent::dropDownList($htmlOptions[
'name'].
'[year]', $year,$yearOptions);
107 $return .= parent::dropDownList($htmlOptions[
'name'].
'[hour]', $hour,$hourOptions);
108 $return .= parent::dropDownList($htmlOptions[
'name'].
'[minute]', $minute,$minuteOptions);
109 $return .= parent::dropDownList($htmlOptions[
'name'].
'[second]', $second,$secondOptions);
113 public static function activeDateField($model,$attribute,$htmlOptions=array())
117 $dayOptions = array(
'00'=>
' - ');
120 $dayOptions[(($x<10)?
'0':
'').$x] = $x;
124 $monthOptions = array(
140 $yearOptions = array(
'0000'=>
' - ');
144 $yearOptions[$x] = $x;
149 parent::resolveNameID($model,$attribute,$htmlOptions);
151 if ($model->$attribute !=
'0000-00-00' && isset($model->$attribute))
153 if (is_array($model->$attribute)) {
154 $new = $model->$attribute;
157 $month = $new[
'month'];
158 $year = $new[
'year'];
161 $new = explode(
'-',$model->$attribute);
176 $return = parent::dropDownList($htmlOptions[
'name'].
'[day]', $day,$dayOptions);
177 $return .= parent::dropDownList($htmlOptions[
'name'].
'[month]', $month,$monthOptions);
178 $return .= parent::dropDownList($htmlOptions[
'name'].
'[year]', $year,$yearOptions);