Guest User

Untitled

a guest
Sep 19th, 2018
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. abstract class AdminController extends CController
  2. {
  3. abstract public function getModel($scenario);
  4. public function actionCreate()
  5.     {
  6.         $model= $this->getModel('');
  7.         if(isset($_POST[get_class($model)]))
  8.         {
  9.             $model->attributes=$_POST['Users'];
  10.             if($model->save())
  11.                 $this->redirect(array('view','id'=>$model->id));
  12.         }
  13.         $this->render('create',array(
  14.             'model'=>$model,
  15.         ));
  16.     }
  17. }
  18.  
  19. class DefaultController extends AdminController
  20. {
  21. public function getModel($scenario)
  22.     {
  23.         return new Users($scenario);
  24.     }
  25. }
Add Comment
Please, Sign In to add comment