MDL-54125 mod_data: fixed PHP notice

Also removed unused variables.
This commit is contained in:
Mark Nelson 2016-05-10 17:09:37 +08:00
parent e4b5a062d8
commit 2c216a6c39

View File

@ -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