/** * Deletes a particular model. * If deletion is successful, the browser will be redirected to the 'admin' page. * @param integer $id the ID of the model to be deleted */ public function actionDelete($id) { if (Yii::app()->request->isPostRequest) { if ('admin' == CommonData::getPrivilege()) { $this->loadModel($id)->adminDelete(); } else { $this->loadModel($id)->userDelete(); } // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser if (!isset($_GET['ajax'])) { $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin')); } } else { Yii::log('Invalid request. Please do not repeat this request again.'); throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); } }
function __construct() { parent::__construct('articles'); }
function create($data) { $data['pass'] = $this->hash_data($data['pass']); return parent::create($data); }
function __construct() { parent::__construct('users'); }