Commit b218e10680ac030a1e06abbc26a2da35fec6b192

Authored by Caroline Salib
2 parents 6d83c3ea 1340e8c9
Exists in master

Merge pull request #140 from ieducativa/compatibiliza-ficha-aluno

Compatibilizado relatório ficha do aluno com php jasper reports.
ieducar/modules/Reports/Assets/Images/pixel.png 0 → 100644

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  
... ...