mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
adding strfrotime to FormHelper::month #700, fix to radios which still need to be moved
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5178 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
624e02374a
commit
9667aa793a
3 changed files with 49 additions and 35 deletions
|
@ -1196,7 +1196,13 @@ class FormHelper extends AppHelper {
|
|||
}
|
||||
break;
|
||||
case 'month':
|
||||
$data = array('01' => 'January', '02' => 'February', '03' => 'March', '04' => 'April', '05' => 'May', '06' => 'June', '07' => 'July', '08' => 'August', '09' => 'September', '10' => 'October', '11' => 'November', '12' => 'December');
|
||||
$data = array('01'=>strftime("%B", strtotime("1/1/2006")), '02'=>strftime("%B", strtotime("2/1/2006")),
|
||||
'03'=>strftime("%B", strtotime("3/1/2006")), '04'=>strftime("%B", strtotime("4/1/2006")),
|
||||
'05'=>strftime("%B", strtotime("5/1/2006")), '06'=>strftime("%B", strtotime("6/1/2006")),
|
||||
'07'=>strftime("%B", strtotime("7/1/2006")), '08'=>strftime("%B", strtotime("8/1/2006")),
|
||||
'09'=>strftime("%B", strtotime("9/1/2006")), '10'=>strftime("%B", strtotime("10/1/2006")),
|
||||
'11'=>strftime("%B", strtotime("11/1/2006")),'12'=>strftime("%B", strtotime("12/1/2006"))
|
||||
);
|
||||
break;
|
||||
case 'year':
|
||||
$current = intval(date('Y'));
|
||||
|
|
|
@ -403,12 +403,12 @@ class HtmlHelper extends AppHelper {
|
|||
function radio($fieldName, $options, $inbetween = null, $htmlAttributes = array()) {
|
||||
|
||||
$this->setFormTag($fieldName);
|
||||
$value = isset($htmlAttributes['value']) ? $htmlAttributes['value'] : $this->tagValue($fieldName);
|
||||
$value = isset($htmlAttributes['value']) ? $htmlAttributes['value'] : $this->__value($fieldName);
|
||||
$out = array();
|
||||
|
||||
foreach($options as $optValue => $optTitle) {
|
||||
$optionsHere = array('value' => $optValue);
|
||||
if ($value !== false && $optValue == $value) {
|
||||
if (!empty($value) && $optValue == $value) {
|
||||
$optionsHere['checked'] = 'checked';
|
||||
}
|
||||
$parsedOptions = $this->_parseAttributes(array_merge($htmlAttributes, $optionsHere), null, '', ' ');
|
||||
|
|
|
@ -566,6 +566,14 @@ class FormHelperTest extends CakeTestCase {
|
|||
'/i', $result);
|
||||
}
|
||||
|
||||
function testMonth() {
|
||||
$result = $this->Form->month('Model.field');
|
||||
$this->assertPattern('/' .
|
||||
'<option\s+value="01"[^>]*>January<\/option>\s+'.
|
||||
'<option\s+value="02"[^>]*>February<\/option>\s+'.
|
||||
'/i', $result);
|
||||
}
|
||||
|
||||
function testDaySelect() {
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue