From 2c216a6c39fd2b5be190254067b8218a1e498cc3 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Tue, 10 May 2016 17:09:37 +0800 Subject: [PATCH] MDL-54125 mod_data: fixed PHP notice Also removed unused variables. --- mod/data/lib.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/mod/data/lib.php b/mod/data/lib.php index 88827767a6a..090263597ac 100644 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -1208,14 +1208,13 @@ function data_print_template($template, $records, $data, $search='', $page=0, $r $cm = get_coursemodule_from_instance('data', $data->id); $context = context_module::instance($cm->id); - static $fields = NULL; - static $isteacher; - static $dataid = NULL; + static $fields = array(); + static $dataid = null; if (empty($dataid)) { $dataid = $data->id; } else if ($dataid != $data->id) { - $fields = NULL; + $fields = array(); } if (empty($fields)) { @@ -1223,7 +1222,6 @@ function data_print_template($template, $records, $data, $search='', $page=0, $r foreach ($fieldrecords as $fieldrecord) { $fields[]= data_get_field($fieldrecord, $data); } - $isteacher = has_capability('mod/data:managetemplates', $context); } if (empty($records)) { @@ -1698,14 +1696,13 @@ function data_print_preference_form($data, $perpage, $search, $sort='', $order=' data_generate_default_template($data, 'asearchtemplate'); } - static $fields = NULL; - static $isteacher; - static $dataid = NULL; + static $fields = array(); + static $dataid = null; if (empty($dataid)) { $dataid = $data->id; } else if ($dataid != $data->id) { - $fields = NULL; + $fields = array(); } if (empty($fields)) { @@ -1713,8 +1710,6 @@ function data_print_preference_form($data, $perpage, $search, $sort='', $order=' foreach ($fieldrecords as $fieldrecord) { $fields[]= data_get_field($fieldrecord, $data); } - - $isteacher = has_capability('mod/data:managetemplates', $context); } // Replacing tags