Skip to content

Commit

Permalink
Elimina PHP Notice - Permite excel sin asistencia
Browse files Browse the repository at this point in the history
  • Loading branch information
fauzcategui committed May 21, 2021
1 parent 4d8a9cc commit e2cd664
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
26 changes: 14 additions & 12 deletions sence_report.php
Original file line number Diff line number Diff line change
Expand Up @@ -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++, '');
}
}
}
}
Expand All @@ -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 = [];
Expand Down

0 comments on commit e2cd664

Please sign in to comment.