public function run()
    {
        $this->controller->getSearchCriteria();
        $this->controller->dataProvider->pagination = false;
        $query = $this->controller->dataProvider->query;

        $config = new ExporterConfig();
        $exporter = new Exporter($config);
        $result = $query->asArray()->all();
        $fields = $this->fields;
        $values = array_map(function ($ar) use ($fields) {
        //$values = array_map(function () use ($fields) {
            $return = [];
            foreach($fields as $field) {
                $keyString = "['" . str_replace('.', "']['", $field) . "']"; 
                eval("\$return[] = \$ar".$keyString.";");
            }
            return $return;
        }, $result);
        if(isset($_GET['test'])) {
            return json_encode(array_merge([$this->fields], $values));
        } else {
            $this->setHttpHeaders('csv', $this->controller->getCompatibilityId(), 'text/plain');
            $exporter->export('php://output', array_merge([$this->fields], $values));
        }
    }
public function run()
    {
        $this->controller->getSearchCriteria();
        $this->controller->dataProvider->pagination = false;
        $query = $this->controller->dataProvider->query;

        $config = new ExporterConfig();
        $exporter = new Exporter($config);
        $result = $query->asArray()->all();
        $fields = $this->fields;
        $values = array_map(function ($ar) use ($fields) {
        //$values = array_map(function () use ($fields) {
            $return = [];
            foreach($fields as $field) {
                $keyString = "['" . str_replace('.', "']['", $field) . "']"; 
                eval("\$return[] = \$ar".$keyString.";");
            }
            return $return;
        }, $result);
        if(isset($_GET['test'])) {
            return json_encode(array_merge([$this->fields], $values));
        } else {
            $this->setHttpHeaders('csv', $this->controller->getCompatibilityId(), 'text/plain');
            $exporter->export('php://output', array_merge([$this->fields], $values));
        }
    }
public function run ( ) { $ this -> controller -> getSearchCriteria ( ) ; $ this -> controller -> dataProvider -> pagination = false ; $ query = $ this -> controller -> dataProvider -> query ; $ config = new ExporterConfig ( ) ; $ exporter = new Exporter ( $ config ) ; $ result = $ query -> asArray ( ) -> all ( ) ; $ fields = $ this -> fields ; $ values = array_map ( function ( $ ar ) use ( $ fields ) { //$values = array_map(function () use ($fields) { $ return = [ ] ; foreach ( $ fields as $ field ) { $ keyString = "['" . str_replace ( '.' , "']['" , $ field ) . "']" ; eval ( "\$return[] = \$ar" . $ keyString . ";" ) ; } return $ return ; } , $ result ) ; if ( isset ( $ _GET [ 'test' ] ) ) { return json_encode ( array_merge ( [ $ this -> fields ] , $ values ) ) ; } else { $ this -> setHttpHeaders ( 'csv' , $ this -> controller -> getCompatibilityId ( ) , 'text/plain' ) ; $ exporter -> export ( 'php://output' , array_merge ( [ $ this -> fields ] , $ values ) ) ; } }
Creates the pdf file for download
Creates the pdf file for download