/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Brands(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Brands'])) { $model->attributes = $_POST['Brands']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->brand_id)); } } $this->render('create', array('model' => $model)); }
} } $attachment->rename_file = "brand-" . ($brand->getMaxId() + 1); if (!empty($id)) { $attachment->rename_file = "brand-" . $id; } $vals['letter'] = L10n::getinitial($vals['name']); if (!empty($vals['description'])) { $vals['description'] = stripcslashes($vals['description']); } if (!empty($_FILES['pic']['name'])) { $attachment->upload_process(); $vals['picture'] = $attachment->file_full_url; } if (!empty($id)) { $result = $brand->save($vals, "update", $id); } else { $result = $brand->save($vals); } if (!$result) { flash(); } $cache->updateIndexCache(); } if (isset($_GET['q'])) { $conditions[] = "Brand.name like '%" . $_GET['q'] . "%'"; } setvar("Brandtypes", $_PB_CACHE['brandtype']); $amount = $brand->findCount(null, $conditions); $joins[] = "LEFT JOIN {$tb_prefix}companies c ON c.id=Brand.company_id"; $page->setPagenav($amount);
$attachment->insert_new = false; $attachment->rename_file = "brand-" . $id; } if (!empty($_FILES['pic']['name'])) { $attachment->upload_process(); $vals['picture'] = $attachment->file_full_url; } if (!empty($vals['description'])) { $vals['description'] = stripcslashes($vals['description']); } $vals['letter'] = L10n::getinitial($vals['name']); $vals['member_id'] = $_SESSION['MemberID']; $vals['company_id'] = $company_id; if (!empty($id)) { $vals['modified'] = $time_stamp; $res = $brand->save($vals, "update", $id, null, $conditions); } else { $vals['created'] = $vals['modified'] = $time_stamp; $res = $brand->save($vals); } $cache->updateIndexCache(); if (!$res) { flash("action_failed"); } else { flash("success"); } } } if (isset($_GET['do'])) { $do = trim($_GET['do']); if (!empty($_GET['id'])) {