示例#1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $Organisation = new Organisation();
     if (isset($_POST['Organisation'])) {
         $Organisation->attributes = $_POST['Organisation'];
         if ($Organisation->save()) {
             $this->redirect(array('index'));
         }
     }
     $this->pageTitle = 'Create Organisation | ' . Yii::app()->name;
     $this->breadcrumbs = array('Organisations' => array('index'), 'Create Organisation');
     $this->render('create', array('Organisation' => $Organisation));
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Organisation();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Organisation'])) {
         $model->attributes = $_POST['Organisation'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
 /**
  * Add Organisation check
  */
 public function add_check()
 {
     $validator = Validator::make(Input::all(), Organisation::$rulesAdd);
     if (!$validator->fails()) {
         $organisation = new Organisation(Input::all());
         if ($organisation->save()) {
             return Redirect::route('organisation_modify', $organisation->id)->with('mSuccess', 'L\'organisme a bien été ajouté');
         } else {
             return Redirect::route('organisation_add')->with('mError', 'Impossible de créer cet organisme')->withInput();
         }
     } else {
         return Redirect::route('organisation_add')->with('mError', 'Il y a des erreurs')->withErrors($validator->messages())->withInput();
     }
 }