/**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new Maestrocompo('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Maestrocompo'])) {
         $model->attributes = $_GET['Maestrocompo'];
         if ($this->isExportRequest()) {
             //<==== [[ADD THIS BLOCK BEFORE RENDER]]
             //set_time_limit(0); //Uncomment to export lage datasets
             //Add to the csv a single line of text
             //  $this->exportCSV(array('POSTS WITH FILTER:'), null, false);
             //Add to the csv a single model data with 3 empty rows after the data
             // $this->exportCSV($model, array_keys($model->attributeLabels()), false, 3);
             //Add to the csv a lot of models from a CDataProvider
             $this->exportCSV($model->search(), array('codigo', 'um', 'codtipo', 'descripcion', 'marca', 'modelo', 'nparte'), false);
             $newmodel->codigo = $data[0];
             $newmodel->um = $data[1];
             $newmodel->codtipo = $data[2];
             $newmodel->descripcion = $data[3];
             $newmodel->marca = $data[4];
             $newmodel->modelo = $data[5];
             $newmodel->nparte = $data[6];
         }
     }
     $this->render('admin', array('model' => $model));
 }