Skip to content

Commit

Permalink
Merge branch 'MDL-79705' of https://github.com/paulholden/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
HuongNV13 committed Oct 18, 2023
2 parents 96c8642 + da6ef4a commit 0b9e0e1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
5 changes: 2 additions & 3 deletions reportbuilder/classes/local/helpers/user_profile_fields.php
Expand Up @@ -180,9 +180,8 @@ public function get_columns(): array {
->set_type($columntype)
->set_is_sortable($columntype !== column::TYPE_LONGTEXT)
->add_callback(static function($value, stdClass $row, profile_field_base $field): string {
// Special handling of checkboxes, we want to display their boolean state rather than the input element itself.
if (is_a($field, 'profile_field_checkbox')) {
return format::boolean_as_text($value);
if ($value === null) {
return '';
}

$field->data = $value;
Expand Down
Expand Up @@ -240,7 +240,7 @@ public function test_custom_report_content(): void {
[
'c0_firstname' => 'Admin',
'c1_data' => '',
'c2_data' => 'Not set',
'c2_data' => '',
'c3_data' => '',
'c4_data' => '',
'c5_data' => '',
Expand Down
14 changes: 2 additions & 12 deletions user/profile/field/checkbox/field.class.php
Expand Up @@ -14,17 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Strings for component 'profilefield_checkbox', language 'en', branch 'MOODLE_20_STABLE'
*
* @package profilefield_checkbox
* @copyright 2008 onwards Shane Elliot {@link http://pukunui.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

/**
* Class profile_field_checkbox
*
* @package profilefield_checkbox
* @copyright 2008 onwards Shane Elliot {@link http://pukunui.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down Expand Up @@ -52,10 +45,7 @@ public function edit_field_add($mform) {
* @return string HTML.
*/
public function display_data() {
$options = new stdClass();
$options->para = false;
$checked = intval($this->data) === 1 ? 'checked="checked"' : '';
return '<input disabled="disabled" type="checkbox" name="'.$this->inputname.'" '.$checked.' />';
return $this->data ? get_string('yes') : get_string('no');
}

/**
Expand Down

0 comments on commit 0b9e0e1

Please sign in to comment.