Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/08/2014, 10:55
mariofernip
 
Fecha de Ingreso: julio-2014
Mensajes: 6
Antigüedad: 9 años, 9 meses
Puntos: 1
Pregunta Reportes en Symfony

Saludos necesito ayuda por favoshe intentado realizar reportes en symfony utilizando el siguiente Bundle,

https://github.com/psliwa/PdfBundle

pero al momento de invocar al reporte no se me genera el PDF, lo que se obtiene como resultado es lo siguiente



el codigo que tengo es el siguiente

CONTROLLER

Código:
 /**
    * @Pdf()
    */
    public function portadareporteAction() {
        $periodo='';
        
        $em = $this->getDoctrine()->getEntityManager();

       
        $listamaterias = $em->getRepository('administrativoBundle:Materia')->findAll();
        
        $listacursos = $em->getRepository('administrativoBundle:Curso')->findAll();
        
        $listaparalelos = $em->getRepository('administrativoBundle:Paralelo')->findAll();        
      
        $listahoras = $em->getRepository('administrativoBundle:Hora')->findAll();        
        
        $format = $this->get('request')->get('_format');
        
        $content = $this->render(sprintf('administrativoBundle:Default:portada_admin.%s.twig', $format),array(
            'periodo'=>$periodo,
            'listacursos'=>$listacursos,
            'listaparalelos'=>$listaparalelos,   
            'listameses'=>$listameses,
            'listahoras'=>$listahoras,        
        ));
        
         $contentType = 'pdf' == $format ? 'application/pdf' : 'text/html';

           $response = new Response($content, 200, array('content-type' => $contentType));

            return $response;
    }

en la vista tengo lo siguiente:

VIEW

Código:
{% extends '::frontend.html.twig'%}

{% block title %} Perfil de docente {% endblock%}
{% block id 'portada' %}

{% block article%}
<pdf>
    <dynamic-page>
<strong>    
    <h2>Materias</h2>
    <br>
</strong>
<div id="materias">
    <div id="materias_table">
        <table class="display" id="m_table">
            <thead>
                <tr>
                    <th>{{'Nombre' }}</th>
                    <th>{{'Area' }}</th>
                    <th>{{'Numero Horas'}}</th> 
                    <th>{{'Descripcion'}}</th> 
                    <th>{{'Estado'}}</th>                                         
                </tr>
            </thead>

            <tbody>{% for mat in listamaterias %}
                <tr>
                    <td ALIGN="CENTER" style="vertical-align:middle">{{mat.nombre}}</td>
                    <td ALIGN="CENTER" style="vertical-align:middle">{{mat.area}}</td>                        
                    <td ALIGN="CENTER" style="vertical-align:middle">{{mat.numerocreditos}}</td>
                    <td ALIGN="CENTER" style="vertical-align:middle">{{mat.descripcion}}</td>                        
                    <td ALIGN="CENTER" style="vertical-align:middle">{% if (mat.estado) ==1 %}
                        <strong>Activo</strong>
        {% endif %}
        {% if (mat.estado) ==0 %}
                        <strong>No activo</strong>
        {% endif %}</td>
                </tr>{% endfor%}
            </tbody>    
        </table>
        
    </div>


</div>

<hr>    
<div align="center" class="contenido">
    <div class="columna-izquierda">
        <strong>    
            <h2>Niveles</h2>
            <br>
        </strong>
        <table class="display" id="c_table">
            <thead>
                <tr >
                    <th>{{'Nombre' }}</th> 
                </tr>
            </thead>

            <tbody>{% for cur in listacursos %}
                <tr>
                    <td ALIGN="CENTER" style="vertical-align:middle">{{cur.nombre}}</td>
                </tr>{% endfor%}
            </tbody>


        </table> 
       
    </div>

    <div class="columna-derecha">
        <strong>    
            <h2> Paralelos</h2>
            <br>
        </strong>    
        <table class="display" id="p_table">
            <thead>
                <tr >
                    <th>{{'Nombre' }}</th> 
                </tr>
            </thead>

            <tbody>{% for par in listaparalelos %}
                <tr>
                    <td ALIGN="CENTER" style="vertical-align:middle">{{par.nombre}}</td>
                </tr>{% endfor%}
            </tbody>
        </table> 
        
    </div>

</div>

<hr>

    <strong>    
        <h2>Horas</h2>
        <br>
    </strong>
    <div id="horas">
        <div id="horas_table">
            <table class="display" id="h_table">
                <thead>
                    <tr>
                        <th>{{'Hora inicio -- Hora fin' }}</th>                                           
                        <th>{{'Descripcion'}}</th>                                       
                    </tr>
                </thead>

                <tbody>{% for hor in listahoras %}
                    <tr>
                        <td  ALIGN="CENTER" style="vertical-align:middle">{{hor}}</td> 
                        <td  ALIGN="CENTER" style="vertical-align:middle">{{hor.descripcion}}</td>                                             
                    </tr>{% endfor%}
                </tbody>    
            </table>
        </div>


    </div>

    <hr>
</dynamic-page>
</pdf>
{% endblock%}



{% block stylesheets %}
{{ parent() }}

{% include 'academicoBundle:Default:tablecss.html.twig'%}
    <style>
            .columna-izquierda{
                text-align:left;
                margin-right:5px;
                padding-left: 80px;
                float:left;
                width:245px;
            }
            .columna-derecha{
                float:right;
                width:245px;
                padding-right: 80px;
            }   
            .contenido{height:auto;overflow:auto}
            
            p.big {
            line-height: 200%;
            }
        </style>
   {% endblock %}
y en el ROUTING tengo lo siguiente,

Código:
portada_reporte:
    pattern:  /admin/reportegeneral
    defaults: { _controller: administrativoBundle:Default:portadareporteciudad, _format: pdf}    
    requirements:
        _format: pdf