Ok, I believe I grabbed the whole source where it is talking about dates. Some reason even talks about time, which I dont have available anyway on the site.
Still look above to see where it is defined on line 5
Code: Select all
case "date":
if (is_array($field["fields"])) {
echo "<pre style=\"background-color:white\">";
print_r($field);
print_r($values["values"]);
$html = new CHtml;
//do some variables cleaning
if (is_array($years))
unset($years);
if (is_array($days))
unset($days);
if (is_array($months))
unset($months);
$date_vals = &$values["values"][$field["name"]];
if ($date_vals > 1000) {
//setting the previous values
$year_selected = isset($values["values"][$field["name"] ."_year"]) ? $values["values"][$field["name"] ."_year"] : @date("Y" , $date_vals );
$month_selected = isset($values["values"][$field["name"] ."_month"]) ? $values["values"][$field["name"] ."_month"] : @date("n" , $date_vals );
$day_selected = isset($values["values"][$field["name"] ."_day"]) ? $values["values"][$field["name"] ."_day"] : @date("j" , $date_vals );
//crap, adding the time values too
$hour_selected = isset($values["values"][$field["name"] ."_hour"]) ? $values["values"][$field["name"] ."_hour"] : @date("G" , $date_vals );
$minute_selected = isset($values["values"][$field["name"] ."_minute"]) ? $values["values"][$field["name"] ."_minute"] : @date("i" , $date_vals );
$second_selected = isset($values["values"][$field["name"] ."_second"]) ? $values["values"][$field["name"] ."_second"] : @date("s" , $date_vals );
} else {
$fld = $field["fields"];
//setting the default value
$year_selected = $fld["year"]["default"] == "now" ? date("Y") : $fld["year"]["default"];
$month_selected = $fld["month"]["default"] == "now" ? date("n") : $fld["month"]["default"];
$day_selected = $fld["day"]["default"] == "now" ? date("j") : $fld["day"]["default"];
//crap, adding the time values too
$hour_selected = $fld["hour"]["default"] == "now" ? date("G") : $fld["hour"]["default"];
$minute_selected = $fld["minute"]["default"] == "now" ? date("i") : $fld["minute"]["default"];
$second_selected = $fld["second"]["default"] == "now" ? date("s") : $fld["second"]["default"];
}
foreach ($field["fields"] as $key => $val) {
switch ($key) {
case "year":
if ($field["fields"]["year"]["empty"] == "true") {
$years[0] = "--" ;
}
for ($i = $field["fields"]["year"]["from"] ; $i <= $field["fields"]["year"]["to"] ; $i++ )
$years[$i] = $i;
$current_field .= $html->FormSelect(
$field["name"]."_year" ,
$years ,
$this->templates ,
"DateSelect",
$year_selected ,
array() ,
array("DISABLED" => ($field["fields"]["year"]["editable"] == "false") ? "DISABLED" : "")
);
$current_field .= $val["separator"];
break;
case "day":
if ($field["fields"]["day"]["empty"] == "true") {
$days[0] = "--" ;
}
for ($i = 1 ; $i <= 31 ; $i++ )
$days[$i] = sprintf("%02d",$i);
$current_field .= $html->FormSelect(
$field["name"]."_day" ,
$days ,
$this->templates ,
"DateSelect",
$day_selected,
array() ,
array("DISABLED" => ($field["fields"]["day"]["editable"] == "false") ? "DISABLED" : "")
);
$current_field .= $val["separator"];
break;
case "month":
if (($field["fields"]["month"]["empty"] == "true")) {
$months[0] = "--" ;
}
//importing the months from global
global $form_months;
if (is_array($months))
$formmonths = array_merge($months, $form_months);
else
$formmonths = $form_months;
//ehcking if the dates must apear like strings or numbers
$current_field .= $html->FormSelect(
$field["name"]."_month" ,
$formmonths,
$this->templates ,
"DateSelect",
$month_selected,
array() ,
array("DISABLED" => ($field["fields"]["month"]["editable"] == "false") ? "DISABLED" : "")
);
$current_field .= $val["separator"];
break;
case "hour":
for ($i = 0; $i <= 23; $i++ )
$hours[$i] = sprintf("%02d",$i);;
$current_field .= $html->FormSelect(
$field["name"]."_hour" ,
$hours ,
$this->templates ,
"DateSelect",
$hour_selected ,
array() ,
array("DISABLED" => ($field["fields"]["hour"]["editable"] == "false") ? "DISABLED" : "")
);
$current_field .= $val["separator"];
break;
case "minute":
for ($i = 0; $i <= 59; $i++ )
$minutes[$i] = sprintf("%02d",$i);;
$current_field .= $html->FormSelect(
$field["name"]."_minute" ,
$minutes ,
$this->templates ,
"DateSelect",
$minute_selected ,
array() ,
array("DISABLED" => ($field["fields"]["minute"]["editable"] == "false") ? "DISABLED" : "")
);
$current_field .= $val["separator"];
break;
case "second":
for ($i = 0; $i <= 59; $i++ )
$seconds[$i] = sprintf("%02d",$i);;
$current_field .= $html->FormSelect(
$field["name"]."_second" ,
$seconds ,
$this->templates ,
"DateSelect",
$second_selected ,
array() ,
array("DISABLED" => ($field["fields"]["minute"]["editable"] == "false") ? "DISABLED" : "")
);
$current_field .= $val["separator"];
break;
}
}
}
//if the field hs description then i add the valign code
$current_field_extra = $field["description"] ? $this->templates->blocks["TopAlign"]->output : "";
break;
oh, almost forgot, I took out the indexing from line 5, so instead of it starting out like
$form_months = array (1 => "January"
it is now starting out like
$form_months = array ( "January"