Esempio n. 1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $this->addToolbar();
     $model = new Danhngon();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Danhngon'])) {
         $model->attributes = $_POST['Danhngon'];
         Libraries::check($model->attributes);
         $model->created_date = new CDbExpression('NOW()');
         $model->title = $model->title;
         //$model->validate();
         //Libraries::check($model->getErrors());
         $model->audio = str_replace("/06.WWW/", "", $model->audio);
         if ($model->save()) {
             $this->redirect(array('index'));
         }
     }
     $this->render('form', array('model' => $model));
 }