Skip to content

Commit

Permalink
MDL-75599 mod_data: Fix warning message
Browse files Browse the repository at this point in the history
* Fix warning message when accessing advanced search page with a date field.
  • Loading branch information
Laurent David authored and laurentdavid committed Oct 18, 2022
1 parent efc6d19 commit abcbc42
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions mod/data/field/date/field.class.php
Expand Up @@ -72,12 +72,20 @@ function display_add_field($recordid = 0, $formdata = null) {
return $str;
}

//Enable the following three functions once core API issues have been addressed.
function display_search_field($value=0) {
$selectors = html_writer::select_time('days', 'f_'.$this->field->id.'_d', $value['timestamp'])
. html_writer::select_time('months', 'f_'.$this->field->id.'_m', $value['timestamp'])
. html_writer::select_time('years', 'f_'.$this->field->id.'_y', $value['timestamp']);
$datecheck = html_writer::checkbox('f_'.$this->field->id.'_z', 1, $value['usedate']);
// Enable the following three functions once core API issues have been addressed.

/**
* Display the search field in advanced search page
* @param mixed $value
* @return string
* @throws coding_exception
*/
public function display_search_field($value = null) {
$currenttime = time();
$selectors = html_writer::select_time('days', 'f_' . $this->field->id . '_d', $value['timestamp'] ?? $currenttime)
. html_writer::select_time('months', 'f_' . $this->field->id . '_m', $value['timestamp'] ?? $currenttime)
. html_writer::select_time('years', 'f_' . $this->field->id . '_y', $value['timestamp'] ?? $currenttime);
$datecheck = html_writer::checkbox('f_' . $this->field->id . '_z', 1, $value['usedate'] ?? 0);
$str = '<div class="form-inline">' . $selectors . ' ' . $datecheck . ' ' . get_string('usedate', 'data') . '</div>';

return $str;
Expand Down

0 comments on commit abcbc42

Please sign in to comment.