Browse Source

Trata caso de inexistência de campo customizado

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

6
classes/util.php

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

Loading…
Cancel
Save