From eafdf083a94bc1da2c2000dfe591442ec5c3e4e2 Mon Sep 17 00:00:00 2001 From: Justin Filip Date: Mon, 29 Oct 2012 12:18:06 +0800 Subject: [PATCH] MDL-36170 - mod/data - Don't display the blocks editing button within table HTML, use a standard API to create it. --- mod/data/view.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mod/data/view.php b/mod/data/view.php index de0d15ea361..a6c22f8d5c8 100644 --- a/mod/data/view.php +++ b/mod/data/view.php @@ -301,11 +301,16 @@ $title = $courseshortname.': ' . format_string($data->name); if ($PAGE->user_allowed_editing()) { - $buttons = '
'. - ''. - ''. - '
'; - $PAGE->set_button($buttons); + // Change URL parameter and block display string value depending on whether editing is enabled or not + if ($PAGE->user_is_editing()) { + $urlediting = 'off'; + $strediting = get_string('blockseditoff'); + } else { + $urlediting = 'on'; + $strediting = get_string('blocksediton'); + } + $url = new moodle_url($CFG->wwwroot.'/mod/data/view.php', array('id' => $cm->id, 'edit' => $urlediting)); + $PAGE->set_button($OUTPUT->single_button($url, $strediting)); } if ($mode == 'asearch') {