Skip to content

Commit

Permalink
0.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
phpNT authored May 8, 2017
1 parent df6098a commit 085ef5d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions controllers/ExportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,24 @@ public function actionCsv()
$items[$i] = $one;
$i++;
}
fputs($fp, implode($items, ';')."\n");
fputs($fp, implode($items, ',')."\n");
$items = [];
$i = 0;
foreach ($dataProvider->getModels() as $model) {
foreach ($searchModel->exportFields() as $one) {
if (is_string($one)) {
$items[$i] = $model[$one];
$item = str_replace('"', '\"', $model[$one]);
} else {
$items[$i] = $one($model);
$item = str_replace('"', '\"', $one($model));
}
if ($item) {
$items[$i] = '"'.$item.'"';
} else {
$items[$i] = $item;
}
$i++;
}
fputs($fp, implode($items, ';')."\n");
fputs($fp, implode($items, ',')."\n");
$items = [];
$i = 0;
}
Expand Down

0 comments on commit 085ef5d

Please sign in to comment.