diff --git a/engine.php b/engine.php index 1bd997c..df09fa6 100755 --- a/engine.php +++ b/engine.php @@ -513,7 +513,7 @@ private function info_otec(){ private function get_instance_config($param){ if( isset( $this->blockInstance->config ) ){ - return $this->blockInstance->config->{$param}; + return property_exists( $this->blockInstance->config, $param ) ? $this->blockInstance->config->{$param} : false; } return false; } diff --git a/sence_report.php b/sence_report.php index d34a163..9c39bc8 100755 --- a/sence_report.php +++ b/sence_report.php @@ -85,17 +85,19 @@ private function genera_reporte(){ foreach ($this->headers as $header) { $xlsfile->write($row, $col++, $header); } - foreach ($asistencias as $datum) { - if (!is_object($datum)) { - continue; - } - $row++; - $col = 0; - foreach ($this->headers as $id => $header) { - if (isset($datum->{$id})) { - $xlsfile->write($row, $col++, $datum->{$id}); - } else { - $xlsfile->write($row, $col++, ''); + if( count( $asistencias ) > 0 ){ + foreach ($asistencias as $datum) { + if (!is_object($datum)) { + continue; + } + $row++; + $col = 0; + foreach ($this->headers as $id => $header) { + if (isset($datum->{$id})) { + $xlsfile->write($row, $col++, $datum->{$id}); + } else { + $xlsfile->write($row, $col++, ''); + } } } } @@ -107,7 +109,7 @@ private function get_asistencias(){ global $DB, $COURSE; $asistencias = $DB->get_records("block_sence", ['courseid' => $COURSE->id ], 'fechahora DESC'); if( count( $asistencias ) < 1 ){ - return null; + return []; } $result = [];