Ejemplo n.º 1
0
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new Inventario('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Inventario'])) {
         $model->attributes = $_GET['Inventario'];
     }
     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('idinventario', 'codigo', 'descripcion', 'marca', 'modelo', 'serie', 'codestado', 'estado.estado', 'codigosap', 'codigoaf', 'fecha', 'codlugar', 'codigopadre', 'numerodocumento', 'rocoto', 'codep', 'codeporiginal', 'codepanterior', 'lugares.deslugar', 'barcoactual.nomep', 'barcoanterior.nomep', 'barcooriginal.nomep'));
     } else {
         $this->render('admin', array('model' => $model));
         /*echo "no pasa nada ";
         		Yii::app()->end();*/
     }
     //$cadenita=Yii::app()->request->baseUrl.DIRECTORY_SEPARATOR."assets".DIRECTORY_SEPARATOR."fotos".DIRECTORY_SEPARATOR.$model->codigosap."jpg";
     // if (file_exists ($cadenita)) {
     //$camarita="<img src='/exalmar/nocamarita.jpg' width=15 height=15  border=0>";
     //} else {
     // $camarita="";
     //}
 }