/** * Manages all models. */ public function actionIndex() { $model = new Client('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Client'])) { $model->attributes = $_GET['Client']; } $this->render('admin', array('model' => $model)); }
/** * */ public function actionIndex() { $model = new Client('search'); $model->unsetAttributes(); // clear any default values if (Yii::app()->getRequest()->getQuery('Client')) { $model->setAttributes(Yii::app()->getRequest()->getQuery('Client')); } $this->render('index', ['model' => $model]); }
public function actionClone($id) { $model = $this->loadModel($id); $client = new Client(); $client->attributes = $model->attributes; $client->unsetAttributes(array('client_id')); $client->save(); $this->redirect('/client/update/' . $client->client_id); }
/** * Manages all models. */ public function actionAdmin($client_id = null) { if (Yii::app()->user->checkAccess('client.index') || Yii::app()->user->checkAccess('client.create') || Yii::app()->user->checkAccess('client.update') || Yii::app()->user->checkAccess('client.delete')) { $model = new Client('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Client'])) { $model->attributes = $_GET['Client']; } if (isset($_GET['pageSize'])) { Yii::app()->user->setState('clientpageSize', (int) $_GET['pageSize']); unset($_GET['pageSize']); } if (isset($_GET['archivedClient'])) { Yii::app()->user->setState('archived_client', $_GET['archivedClient']); unset($_GET['archivedClient']); } $model->client_archived = Yii::app()->user->getState('archived_client', Yii::app()->params['defaultArchived']); $this->render('admin', array('model' => $model, 'client_id' => $client_id)); } else { throw new CHttpException(403, 'You are not authorized to perform this action'); } }