/** * Manages all models. */ public function actionAdmin() { $model = new People('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['People'])) { $model->attributes = $_GET['People']; } if (isset($_GET['export'])) { header("Content-Type: application/vnd.ms-excel; charset=utf-8"); header("Content-Disposition: inline; filename=\"people-report.xls\""); $dataProvider = $model->search(); $dataProvider->pagination = false; $fields = array('id', 'fname', 'lname', 'dob', 'mobile'); $labels = $model->attributeLabels(); $fval = array(); foreach ($fields as $field) { array_push($fval, $labels[$field]); } echo implode("\t", $fval) . "\n"; foreach ($dataProvider->data as $data) { $fval = array(); foreach ($fields as $field) { array_push($fval, $data->{$field}); } echo implode("\t", $fval) . "\n"; } Yii::app()->end(); } $ac = People::getAutoCompleteFields(); $this->render('admin', array('model' => $model, 'ac' => $ac)); }