Commit 1340e8c971f7127f3682abb629a6aadfef1824ad
1 parent
23d5cfe8
Exists in
master
Compatibilizado relatório ficha do aluno com php jasper reports.
O Relatório tentará usar a imagem do aluno, porem ao não encontrar será usado uma imagem em branco. Isto é necessário uma vez que o php jasper reports não suporta expressão para mostrar ou não a foto.
Showing
3 changed files
with
23 additions
and
1 deletions
Show diff stats
952 Bytes
ieducar/modules/Reports/ReportSources/portabilis_ficha_aluno.jrxml
| ... | ... | @@ -13,6 +13,7 @@ |
| 13 | 13 | <defaultValueExpression><![CDATA[new java.lang.Integer(0)]]></defaultValueExpression> |
| 14 | 14 | </parameter> |
| 15 | 15 | <parameter name="logo" class="java.lang.String"/> |
| 16 | + <parameter name="foto" class="java.lang.String"/> | |
| 16 | 17 | <queryString> |
| 17 | 18 | <![CDATA[SELECT public.fcn_upper(nm_instituicao) AS nome_instituicao, |
| 18 | 19 | public.fcn_upper(nm_responsavel) AS nome_secretaria, |
| ... | ... | @@ -704,7 +705,7 @@ |
| 704 | 705 | </rectangle> |
| 705 | 706 | <image hAlign="Center" vAlign="Middle"> |
| 706 | 707 | <reportElement uuid="3a409d0f-1fbc-460e-9a20-b99f8b06a595" x="471" y="6" width="68" height="90"/> |
| 707 | - <imageExpression><![CDATA[$F{foto}]]></imageExpression> | |
| 708 | + <imageExpression><![CDATA[$P{foto}]]></imageExpression> | |
| 708 | 709 | </image> |
| 709 | 710 | <staticText> |
| 710 | 711 | <reportElement uuid="c2713064-d203-4433-b086-70d4dcb2557e" x="471" y="6" width="68" height="90"> | ... | ... |
ieducar/modules/Reports/Views/FichaAlunoController.php
| ... | ... | @@ -67,6 +67,27 @@ class FichaAlunoController extends Portabilis_Controller_ReportCoreController |
| 67 | 67 | $this->report->addArg('instituicao', (int)$this->getRequest()->ref_cod_instituicao); |
| 68 | 68 | $this->report->addArg('escola', (int)$this->getRequest()->ref_cod_escola); |
| 69 | 69 | $this->report->addArg('aluno', (int)$this->getRequest()->aluno_id); |
| 70 | + $this->report->addArg('foto', $this->loadPhotoPath()); | |
| 71 | +} | |
| 72 | + | |
| 73 | + function loadPhotoPath() { | |
| 74 | + $studentPhotoPath = $this->studentPhotoPath(); | |
| 75 | + $studentHasPhoto = is_string($studentPhotoPath) && strlen($studentPhotoPath) > 0; | |
| 76 | + | |
| 77 | + return $studentHasPhoto ? $studentPhotoPath : $this->pixelPath(); | |
| 78 | + } | |
| 79 | + | |
| 80 | + function studentPhotoPath() { | |
| 81 | + $sql = "SELECT f.caminho FROM pmieducar.aluno a, cadastro.fisica_foto f " . | |
| 82 | + "WHERE a.cod_aluno = $1 and a.ref_idpes = f.idpes"; | |
| 83 | + | |
| 84 | + $studentId = $this->getRequest()->aluno_id; | |
| 85 | + | |
| 86 | + return Portabilis_Utils_Database::selectField($sql, $studentId); | |
| 87 | + } | |
| 88 | + | |
| 89 | + function pixelPath() { | |
| 90 | + return $_SERVER['DOCUMENT_ROOT'] . '/modules/Reports/Assets/Images/pixel.png'; | |
| 70 | 91 | } |
| 71 | 92 | } |
| 72 | 93 | ... | ... |