-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
264 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ class tao_helpers_form_elements_xhtml_Calendar extends tao_helpers_form_elements | |
* Rendering of the XHTML implementation of the Calendar Widget. | ||
* | ||
* @author Bertrand Chevrier, <[email protected]> | ||
* @return The XHTML stream of the Calendar Widget. | ||
* @return string The XHTML stream of the Calendar Widget. | ||
*/ | ||
public function render() | ||
{ | ||
|
@@ -45,6 +45,23 @@ public function render() | |
$uniqueId = uniqid('calendar_'); | ||
$elementId = tao_helpers_Display::TextCleaner($this->getDescription()) . '_' . $uniqueId; | ||
|
||
if ($this->isDisabled()) { | ||
return $returnValue . sprintf( | ||
'<input type="text" | ||
name="%s" | ||
id="%s" | ||
data-testid="%s" | ||
value="%s" | ||
%s | ||
>', | ||
$this->name, | ||
$elementId, | ||
$this->getDescription(), | ||
$this->getDateOutput(), | ||
$this->renderAttributes() | ||
); | ||
} | ||
|
||
if (! isset($this->attributes['size'])) { | ||
$this->attributes['size'] = 20; | ||
} | ||
|
@@ -53,12 +70,12 @@ public function render() | |
$returnValue .= $this->renderAttributes(); | ||
|
||
if (! empty($this->value)) { | ||
$timeStamp = is_numeric($this->getRawValue()) ? $this->getRawValue() : $this->getEvaluatedValue(); | ||
$returnValue .= ' value="' . _dh(tao_helpers_Date::displayeDate($timeStamp, tao_helpers_Date::FORMAT_DATEPICKER)) . '"'; | ||
$returnValue .= ' value="' . $this->getDateOutput() . '"'; | ||
} | ||
|
||
$returnValue .= ' /></div>'; | ||
|
||
return (string) $returnValue; | ||
return $returnValue; | ||
} | ||
|
||
public function getEvaluatedValue() | ||
|
@@ -77,4 +94,15 @@ public function getEvaluatedValue() | |
|
||
return $returnValue; | ||
} | ||
|
||
private function getDateOutput(): string | ||
{ | ||
if (empty($this->value)) { | ||
return ''; | ||
} | ||
|
||
$timeStamp = is_numeric($this->getRawValue()) ? $this->getRawValue() : $this->getEvaluatedValue(); | ||
|
||
return _dh(tao_helpers_Date::displayeDate($timeStamp, tao_helpers_Date::FORMAT_DATEPICKER)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.