Browse Source

Trata caso de inexistência de campo customizado

MOODLE_37_STABLE
Matheus Garcia 6 years ago
parent
commit
bd43e5d384
  1. 18
      classes/util.php

18
classes/util.php

@ -81,15 +81,19 @@ function obtemCampoCustomizadoCurso($idCurso, $nomeCampo) {
"; ";
$valueArray = $DB->get_record_sql($sql, [$idCurso, $nomeCampo]); $valueArray = $DB->get_record_sql($sql, [$idCurso, $nomeCampo]);
$value = $valueArray->value;
$options = $valueArray->options;
if($options == null) { if($valueArray) {
return $value; $value = $valueArray->value;
$options = $valueArray->options;
if($options == null) {
return $value;
} else {
$optionsArray = preg_split("/\s*\n\s*/", trim($options));
return $optionsArray[$value-1];
}
} else { } else {
return '';
$optionsArray = preg_split("/\s*\n\s*/", trim($options));
return $optionsArray[$value-1];
} }
} }

Loading…
Cancel
Save