/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Cards(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Cards'])) { $model->attributes = $_POST['Cards']; if ($model->save()) { $this->redirect(array('index')); } } $this->render('create', array('model' => $model)); }
public function addcardAction() { $this->view->disable(); $user = $this->request->getPost('uid'); $number = $this->request->getPost('number'); $name = $this->request->getPost('name'); $address = $this->request->getPost('address'); $cards = new Cards(); $cards->user = $user; $cards->number = $number; $cards->name = $name; $cards->address = $address; if ($cards->save() == false) { echo false; } else { echo true; } }
public static function insertCard($card_id, $name, $desc, $due, $list_id) { $update = true; $model = Cards::getCardbyCardID($card_id); if ($model === null) { $model = new Cards(); $update = false; } $model->card_id = $card_id; $model->name = $name; $model->desc = $desc; $model->due = $due; $model->list_id = $list_id; if ($update) { if ($model->save()) { } } else { $model->insert(); } }