Buenas tardes, venogo de nuevo al foro con una pregunta. aqui mi caso. tengo una tabla "tbl_evento" donde se almacenan los datos de los cursos, talleres, charlas, etc. tambien tengo otra tabla "tbl_asistencia", donde se registran los participates de cada uno de los anteriores, resulta que ahora necesito crear un reporte, y debe ser segun los parametros que desee el usuario final, por lo que se me ocurrió crear un formulario, donde especifique los parametros que desea contenga dicho reporte, por ahora solo se me ocurre, fechainicio, fechafin, descripcionevento(curso,taller,charla) y idestructura(de donde proviene cada asistente), la verdad me parece bastante simple, en la misma carpeta de vista de tbl_evento cree una copia de "create" y "_form"los renombre "createReporte" y "_formReporte" respectivamente, cabe destacar que no se si está bien hacer eso. La cuestion es que quiero que en lugar de crear un registro me redireccione a un action donde pueda recojer los datos que fueron parametrizados por el usuario, aqui es donde no se como pasar ni recojer los mismos cualquier ayuda es bien recibida. aqui lo que tengo…
En mi controller para redireccionar el nuevo createReporte y _formReporte hice esto
public function actionReporte()
{
$model=new TblEvento;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['TblEvento']))
{
$model->attributes=$_POST['TblEvento'];
if($model->save())
$this->redirect(array('view','id'=>$model->id));
}
$this->render('createReporte',array(
'model'=>$model,
));
}
en el _formReporte tengo
<div>
<!--<div class="form"> -->
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'tbl-evento-form',
'enableAjaxValidation'=>false,
)); ?>
<form action='js:document.location.href="GenerarCircular?iddescripcionevento='.<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' />?COMO LO PASO?<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' />.'"' method="get" >
<div class="row">
<?php echo $form->labelEx($model,'iddescripcionevento'); ?>
<?php echo $form->dropDownList($model,'iddescripcionevento',
CHtml::listData(TblDescripcionevento::model()->findAll(),'id','nombre'),
array('prompt' => 'Seleccione un Evento...',
'style'=>"width:60%")
); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'Organismo / Ente'); ?>
<?php echo $form->dropDownList(TblEstructura::model(),'denominacion',
CHtml::listData(TblEstructura::model()->findAll(),'id','denominacion'),
array(
'ajax' => array('type' => 'POST'),
'prompt' => 'Todos los Organos / Entes...','style' => "width:50%"
)
); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'Fecha Inicio'); ?>
<?php
$this->widget("zii.widgets.jui.CJuiDatePicker",array(
"attribute"=>"fechainicio",
"model"=>$model,
"language"=>"es",
"options"=>array(
"dateFormat"=>"yy-mm-dd",
"showButtonPanel"=> true,
"changeYear"=>true
)
));
?>
<?php echo $form->error($model,'fechainicio'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'Fecha Fin'); ?>
<?php
$this->widget("zii.widgets.jui.CJuiDatePicker",array(
"attribute"=>"fechafin",
"model"=>$model,
"language"=>"es",
"options"=>array(
"dateFormat"=>"yy-mm-dd",
"showButtonPanel"=> true,
"changeYear"=>true
)
));
?>
<?php echo $form->error($model,'fechafin'); ?>
</div>
<?php
echo CHtml::button('Generar Correspondencia PDF',
array('class'=>'btn-primary',
'id'=>'boton',
'onclick' => 'js:document.location.href="GenerarCircular?iddescripcionevento='.<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' />?COMO LO PASO?<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' />.'"'
));
?>
</form>
<?php $this->endWidget(); ?>
</div><!-- form -->
y en el controller tengo el action para generar el pdf, donde quiero capturar los datos del _form pero no llegan nunca =(
public function actionGenerarCircular() {
$variable99 = $_GET['iddescripcionevento'];
$this->layout = "/layouts/stylepdf.css";
$mPDF1 = Yii::app()->ePdf->mpdf('utf-8', 'A4-L');
//$mPDF1->mPDF('utf-8', 'A4-L');
//$mPDF1->AddPage('P'); // Cambiar la orientacion de la vista
$mPDF1->WriteHTML($variable99);
$mPDF1->Output ('Certificados',EYiiPdf::OUTPUT_TO_BROWSER);
}