publicfunction actionAdmin()
{
$model =newEmployee('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Employee']))
{
$model->attributes = $_GET['Employee'];
// save search parameters to the session data
Yii::app()->user->setState('EmployeeSearchParams', $_GET['Employee']);
}
$this->render('admin',array(
'model'=> $model,
));
}
publicfunction actionExcel()
{
...
$model =newEmployee('search');
$model->unsetAttributes(); // clear any default values
// retrieve the search parameters from the session data
$params =Yii::app()->user->getState('EmployeeSearchParams');
if( isset($params))
$model->attributes = $params;
// retrieve the data by CActiveDataProvider
$dataProvider = $model->search();
$data = $dataProvider->getData();
...
$i=5;
foreach($data as $record){
{
$objPHPExcel->setActiveSheetIndex()->setCellValue('B'.$i, $record->e_no);
...
$i++;
}
...
}