Skip to content

Commit

Permalink
Merge branch 'MDL-75599-master' of https://github.com/laurentdavid/mo…
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Oct 20, 2022
2 parents d98380b + c85c8eb commit b720790
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions mod/data/field/date/field.class.php
Expand Up @@ -89,15 +89,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 = null) {
if (empty($value)) {
$value = ['timestamp' => 0, 'usedate' => false];
}
$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 b720790

Please sign in to comment.