mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
meridian function
This commit is contained in:
parent
6d97aedd47
commit
a876c77987
2 changed files with 5 additions and 5 deletions
|
@ -1711,15 +1711,14 @@ class FormHelper extends AppHelper {
|
||||||
* that string is displayed as the empty element.
|
* that string is displayed as the empty element.
|
||||||
*
|
*
|
||||||
* @param string $fieldName Prefix name for the SELECT element
|
* @param string $fieldName Prefix name for the SELECT element
|
||||||
* @param string $selected Option which is selected.
|
|
||||||
* @param string $attributes Array of Attributes
|
* @param string $attributes Array of Attributes
|
||||||
* @param bool $showEmpty Show/Hide an empty option
|
* @param bool $showEmpty Show/Hide an empty option
|
||||||
* @return string Completed meridian select input
|
* @return string Completed meridian select input
|
||||||
* @access public
|
* @access public
|
||||||
* @link http://book.cakephp.org/view/1422/meridian
|
* @link http://book.cakephp.org/view/1422/meridian
|
||||||
*/
|
*/
|
||||||
public function meridian($fieldName, $selected = null, $attributes = array()) {
|
public function meridian($fieldName, $attributes = array()) {
|
||||||
$attributes += array('empty' => true, 'value' => $selected);
|
$attributes += array('empty' => true, 'value' => null);
|
||||||
if ((empty($attributes['value']) || $attributes['value'] === true) && $value = $this->value($fieldName)) {
|
if ((empty($attributes['value']) || $attributes['value'] === true) && $value = $this->value($fieldName)) {
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
extract($value);
|
extract($value);
|
||||||
|
@ -1907,9 +1906,10 @@ class FormHelper extends AppHelper {
|
||||||
case '12':
|
case '12':
|
||||||
$selectHourAttr['value'] = $hour;
|
$selectHourAttr['value'] = $hour;
|
||||||
$selectMinuteAttr['value'] = $min;
|
$selectMinuteAttr['value'] = $min;
|
||||||
|
$selectMeridianAttr['value'] = $meridian;
|
||||||
$opt .= $this->hour($fieldName, false, $selectHourAttr) . ':' .
|
$opt .= $this->hour($fieldName, false, $selectHourAttr) . ':' .
|
||||||
$this->minute($fieldName, $selectMinuteAttr) . ' ' .
|
$this->minute($fieldName, $selectMinuteAttr) . ' ' .
|
||||||
$this->meridian($fieldName, $meridian, $selectMeridianAttr);
|
$this->meridian($fieldName, $selectMeridianAttr);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$opt .= '';
|
$opt .= '';
|
||||||
|
|
|
@ -3901,7 +3901,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
date('a', $now),
|
date('a', $now),
|
||||||
'/option',
|
'/option',
|
||||||
'*/select'
|
'*/select'
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
$result = $this->Form->dateTime('Contact.date', 'DMY', '12');
|
$result = $this->Form->dateTime('Contact.date', 'DMY', '12');
|
||||||
|
|
Loading…
Add table
Reference in a new issue