Ejemplo n.º 1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Mglist();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Mglist'])) {
         $model->attributes = $_POST['Mglist'];
         $model->access_level = $_POST['access_level'];
         if ($model->save()) {
             $yg = new Yiigun();
             $yg->listCreate($model);
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
Ejemplo n.º 2
0
 public function create($list)
 {
     $this->output_str .= 'creating list...';
     $mgl = new Mglist();
     $mgl->name = $list->name;
     $mgl->access_level = $list->access_level;
     $mgl->address = $list->address;
     $mgl->description = $list->description;
     $mgl->created_at = new CDbExpression('NOW()');
     $mgl->modified_at = new CDbExpression('NOW()');
     //$list->members_count
     $this->output_str .= 'Saving...' . $mgl->name . '<br />';
     if ($mgl->save()) {
         $this->output_str .= 'successful';
     } else {
         $this->output_str .= 'failed to save list - might be duplicate naming';
     }
     $this->output_str .= '<br />';
 }