/** * Serve up an example CSV file * * @return void */ public function sampleTask() { $profile = new \Components\Members\Tables\Profile($this->database); $skip = array('gid', 'gidnumber', 'regIP', 'regHost', 'modifiedDate', 'proxypassword', 'loginshell', 'ftpshell', 'shadowexpire', 'params', 'proxyuidnumber'); $fields = array(); $row = array(); foreach ($profile->getProperties() as $key => $val) { if (in_array(strtolower($key), $skip)) { continue; } array_push($fields, $key); array_push($row, 'Example'); } $multi = array('interests', 'race', 'disability'); foreach ($multi as $key) { array_push($fields, $key); array_push($row, 'example;example;example'); } // Output header @ob_end_clean(); header("Pragma: public"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Expires: 0"); header("Content-Transfer-Encoding: binary"); header('Content-type: text/comma-separated-values'); header('Content-disposition: attachment; filename="members.csv"'); echo $this->quoteCsvRow($fields); //array_map('ucfirst', $fields)); echo $this->quoteCsvRow($row); exit; }