function approve($id) { if ($_POST) { $weblink = new Weblink($id); $weblink->from_array($_POST); $weblink->save(); $weblink->check_last_query(); print_r($_POST); } }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Weblink(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Weblink'])) { $model->attributes = $_POST['Weblink']; $model->created_on = new CDbExpression('NOW()'); $model->created_by = Yii::app()->user->id; if ($model->save()) { Yii::app()->user->setFlash('success', 'Saved successfully'); $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
function save($id = FALSE) { if ($_POST) { $weblink = new Weblink($id); if ($_FILES['image']['name']) { if ($weblink->id) { $weblink->delete_file($weblink->id, 'uploads/weblinks/', 'image'); } $_POST['image'] = $weblink->upload($_FILES['image'], 'uploads/weblinks/', 98, 90); //$weblink->thumb('uploads/weblinks/thumb',50,50); } $_POST['title'] = lang_encode($_POST['title']); $_POST['description'] = lang_encode($_POST['description']); if (!$id) { $_POST['user_id'] = $this->session->userdata('id'); } $weblink->from_array($_POST); $weblink->save(); set_notify('success', lang('save_data_complete')); redirect($_POST['referer']); } }