mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Adding FormHelper::generateTime()
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3319 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
943454d280
commit
06f8fbb7c9
1 changed files with 34 additions and 0 deletions
|
@ -272,6 +272,40 @@ class FormHelper extends Helper {
|
|||
$requiredDiv = $this->divTag($divClass, $divTagInside);
|
||||
return $this->divTag("date", $requiredDiv);
|
||||
}
|
||||
/**
|
||||
* Returns a formatted date option element for HTML FORMs.
|
||||
*
|
||||
* @param string $tagName This should be "Modelname/fieldname"
|
||||
* @param string $prompt Text that will appear in the label field.
|
||||
* @param bool $required True if this field is a required field.
|
||||
* @param string $errorMsg Text that will appear if an error has occurred.
|
||||
* @param int $size Not used.
|
||||
* @todo Remove the $size parameter from this method.
|
||||
* @param array $htmlOptions HTML options array
|
||||
* @return string Date option wrapped in a div.
|
||||
*/
|
||||
function generateTime($tagName, $prompt, $required = false, $errorMsg = null, $size = 20, $htmlOptions = null, $selected = null) {
|
||||
$str = $this->Html->dateTimeOptionTag($tagName, 'NONE', '24', $selected, $htmlOptions);
|
||||
$strLabel = $this->labelTag($tagName, $prompt);
|
||||
$divClass = "optional";
|
||||
if ($required) {
|
||||
$divClass = "required";
|
||||
}
|
||||
$strError = "";
|
||||
|
||||
if ($this->isFieldError($tagName)) {
|
||||
$strError = $this->pTag('error', $errorMsg);
|
||||
$divClass = sprintf("%s error", $divClass);
|
||||
}
|
||||
$divTagInside = sprintf("%s %s %s", $strError, $strLabel, $str);
|
||||
$requiredDiv = $this->divTag($divClass, $divTagInside);
|
||||
return $this->divTag("time", $requiredDiv);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns a formatted datetime option element for HTML FORMs.
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue