예제 #1
0
 public function actionDeleteAll($id)
 {
     $arrIdNew = explode(",", $id);
     for ($i = 0; $i < count($arrIdNew); $i++) {
         $model = $this->loadModel($arrIdNew[$i]);
         // Xóa chi tiết đơn hàng
         $billDetail = new BillDetail();
         $criteria = new CDBCriteria();
         $criteria->addCondition("bill_id = " . $arrIdNew[$i]);
         $billDetail->deleteAll($criteria);
         // Xóa đơn hàng
         $model->delete();
     }
     Yii::app()->user->setFlash('success', translate('Xóa thành công.'));
     $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index'));
 }