From 1340e8c971f7127f3682abb629a6aadfef1824ad Mon Sep 17 00:00:00 2001 From: Lucas D'Avila Date: Tue, 14 Jul 2015 17:24:56 -0300 Subject: [PATCH] Compatibilizado relatório ficha do aluno com php jasper reports. --- ieducar/modules/Reports/Assets/Images/pixel.png | Bin 0 -> 952 bytes ieducar/modules/Reports/ReportSources/portabilis_ficha_aluno.jrxml | 3 ++- ieducar/modules/Reports/Views/FichaAlunoController.php | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 ieducar/modules/Reports/Assets/Images/pixel.png diff --git a/ieducar/modules/Reports/Assets/Images/pixel.png b/ieducar/modules/Reports/Assets/Images/pixel.png new file mode 100644 index 0000000..6200e22 Binary files /dev/null and b/ieducar/modules/Reports/Assets/Images/pixel.png differ diff --git a/ieducar/modules/Reports/ReportSources/portabilis_ficha_aluno.jrxml b/ieducar/modules/Reports/ReportSources/portabilis_ficha_aluno.jrxml index 3c2c1f4..0220d3b 100644 --- a/ieducar/modules/Reports/ReportSources/portabilis_ficha_aluno.jrxml +++ b/ieducar/modules/Reports/ReportSources/portabilis_ficha_aluno.jrxml @@ -13,6 +13,7 @@ + - + diff --git a/ieducar/modules/Reports/Views/FichaAlunoController.php b/ieducar/modules/Reports/Views/FichaAlunoController.php index 7013a8d..6926a52 100644 --- a/ieducar/modules/Reports/Views/FichaAlunoController.php +++ b/ieducar/modules/Reports/Views/FichaAlunoController.php @@ -67,6 +67,27 @@ class FichaAlunoController extends Portabilis_Controller_ReportCoreController $this->report->addArg('instituicao', (int)$this->getRequest()->ref_cod_instituicao); $this->report->addArg('escola', (int)$this->getRequest()->ref_cod_escola); $this->report->addArg('aluno', (int)$this->getRequest()->aluno_id); + $this->report->addArg('foto', $this->loadPhotoPath()); +} + + function loadPhotoPath() { + $studentPhotoPath = $this->studentPhotoPath(); + $studentHasPhoto = is_string($studentPhotoPath) && strlen($studentPhotoPath) > 0; + + return $studentHasPhoto ? $studentPhotoPath : $this->pixelPath(); + } + + function studentPhotoPath() { + $sql = "SELECT f.caminho FROM pmieducar.aluno a, cadastro.fisica_foto f " . + "WHERE a.cod_aluno = $1 and a.ref_idpes = f.idpes"; + + $studentId = $this->getRequest()->aluno_id; + + return Portabilis_Utils_Database::selectField($sql, $studentId); + } + + function pixelPath() { + return $_SERVER['DOCUMENT_ROOT'] . '/modules/Reports/Assets/Images/pixel.png'; } } -- libgit2 0.21.2