Hello, I have three widgets in my nterms.php view:
//widget1
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'form',
'action'=>$this->createUrl('terms/nterms'),
'method'=>'get',
'enableAjaxValidation'=>false,
'htmlOptions'=>array('name'=>'filterForm'),
)); ?>
<p>
<?php echo CHtml::radioButton('Form_select', (isset($_GET['Form_select']) && $_GET['Form_select'] == 'yesterday'), array('value'=>'yesterday')); ?>
<?php echo Yii::t('main', 'Yesterday'); ?>
<?php echo CHtml::radioButton('Form_select', (isset($_GET['Form_select']) && $_GET['Form_select'] == 'today'), array('value'=>'today')); ?>
<?php echo Yii::t('main', 'Today'); ?>
</p>
<?php echo CHtml::submitButton(Yii::t('main', 'OK')); ?>
<?php $this->endWidget(); ?>
<?php echo CHtml::button('Print', array('submit' => array('terms/nterms', 'redir'=>'printpdf'))); ?>
//widget2
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'terms-grid',
'dataProvider'=>$dataProvider,
'filter'=>$model,
'columns'=>array(
array(
'name'=>'datetime',
'type'=>'raw',
'value'=>'date("Y-m-d H:i", strtotime($data->datetime)),
'visible'=>true,
),
array(
'name'=>'userName',
'type'=>'raw',
'value'=>'$data->user->fullname',
'visible'=>true,
),
array(
'class' => 'CButtonColumn',
'buttons' => array(
.....
),
)
));
if (isset($_GET['redir']) && $_GET['redir']=='printpdf')
{
ob_clean();
//widget3
$this->widget('ext.pdfGrid.EPDFGrid', array(
'id' => 'informe-pdf',
'fileName' => 'Pdf',//Nombre del archivo generado sin la extension pdf (.pdf)
'dataProvider'=>$dataProvider,
'columns' => array(
array(
'name'=>'datetime',
'type'=>'raw',
'value'=>'date("Y-m-d H:i", strtotime($data->datetime)),
'visible'=>true,
),
array(
'name'=>'userName',
'type'=>'raw',
'value'=>'$data->user->fullname',
'visible'=>true,
),
),
'config' => array(
'title' => 'Pdf',
'subTitle' => 'Pdf',
'colWidths' => array(50, 50),
),
));
}
When I filter data in the table, I generate pdf with filtered data. If I choose Today on radiobutton and click OK, the table displays correct data (records with today day). In addition I can sort and filter in the table these displayed data.
When I print pdf, pdf displays data with operations that were made in the table, it does not take data from radiobutton.
widget1 -> widget2
widget2 -> widget3
widget1 NOT -> widget3
How can I send data from radiobuttons to pdf? How can I integrate these three widgets?
Regards