4 public static function activeTimeField($model, $attribute, $htmlOptions = array())
9 $hourOptions = array(
'0' =>
' - ');
11 $hourOptions[$x] = (($x<10) ?
'0' :
'').$x;
16 $minuteOptions = array(
'0' =>
' - ');
18 $minuteOptions[$x] = (($x<10) ?
'0' :
'').$x;
23 $secondOptions = array(
'0' =>
' - ');
25 $secondOptions[$x] = (($x<10) ?
'0' :
'').$x;
30 $dayOptions = array(
'0' =>
' - ');
36 $monthOptions = array(
52 $yearOptions = array(
'0' =>
' - ');
55 $yearOptions[$x] = $x;
59 parent::resolveNameID($model, $attribute, $htmlOptions);
61 if (is_array($model->$attribute)) {
62 $arr = $model->$attribute;
63 $model->$attribute = mktime($arr[
'hour'], $arr[
'minute'], $arr[
'second'], $arr[
'month'], $arr[
'day'], $arr[
'year']);
66 if ($model->$attribute !=
'0' && isset($model->$attribute)) {
69 $day = intval(date(
'j', $model->$attribute));
70 $month = intval(date(
'm', $model->$attribute));
71 $year = intval(date(
'Y', $model->$attribute));
73 $hour = intval(date(
'H', $model->$attribute));
74 $minute = intval(date(
'i', $model->$attribute));
75 $second = intval(date(
's', $model->$attribute));
78 $day = intval(date(
'j', time()));
79 $month = intval(date(
'm', time()));
80 $year = intval(date(
'Y', time()));
82 $hour = intval(date(
'H', time()));
83 $minute = intval(date(
'i', time()));
84 $second = intval(date(
's', time()));
94 $return = parent::dropDownList($htmlOptions[
'name'].
'[day]', $day, $dayOptions);
95 $return .= parent::dropDownList($htmlOptions[
'name'].
'[month]', $month, $monthOptions);
96 $return .= parent::dropDownList($htmlOptions[
'name'].
'[year]', $year, $yearOptions);
98 $return .= parent::dropDownList($htmlOptions[
'name'].
'[hour]', $hour, $hourOptions);
99 $return .= parent::dropDownList($htmlOptions[
'name'].
'[minute]', $minute, $minuteOptions);
100 $return .= parent::dropDownList($htmlOptions[
'name'].
'[second]', $second, $secondOptions);
109 $dayOptions = array(
'00' =>
' - ');
111 $dayOptions[(($x<10) ?
'0' :
'').$x] = $x;
115 $monthOptions = array(
131 $yearOptions = array(
'0000' =>
' - ');
134 $yearOptions[$x] = $x;
138 parent::resolveNameID($model, $attribute, $htmlOptions);
140 if ($model->$attribute !=
'0000-00-00' && isset($model->$attribute)) {
141 if (is_array($model->$attribute)) {
142 $new = $model->$attribute;
145 $month = $new[
'month'];
146 $year = $new[
'year'];
148 $new = explode(
'-', $model->$attribute);
163 $return = parent::dropDownList($htmlOptions[
'name'].
'[day]', $day, $dayOptions);
164 $return .= parent::dropDownList($htmlOptions[
'name'].
'[month]', $month, $monthOptions);
165 $return .= parent::dropDownList($htmlOptions[
'name'].
'[year]', $year, $yearOptions);
170 public static function markSearch($model, $field, $prefix =
'<strong>', $sufix =
'</strong>')
172 $className = get_class($model);
173 if (isset($_GET[$className][$field]) && $_GET[$className][$field]) {
174 return str_replace($_GET[$className][$field], $prefix.$_GET[$className][$field].$sufix, $model->getAttribute($field));
176 return $model->getAttribute($field);