/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new ItemProp(); if (isset($_POST['ItemProp'])) { $this->handlePostData(); $model->attributes = $_POST['ItemProp']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->prop_id)); } } $this->render('create', array('model' => $model, 'props' => $this->getProps())); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new ItemProp(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['ItemProp'])) { $model->attributes = $_POST['ItemProp']; if ($model->save()) { if (isset($_POST['PropValue'])) { $model->setPropValues($_POST['PropValue']); } $this->redirect(array('view', 'id' => $model->prop_id)); } } $this->render('create', array('model' => $model)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new ItemProp(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['ItemProp'])) { $model->attributes = $_POST['ItemProp']; if ($model->save()) { if (isset($_POST['PropValue'])) { $model->setPropValues($_POST['PropValue']); } $this->redirect(array('view', 'id' => $model->prop_id)); } } $item_props = ItemProp::model()->findAll(); $props = array('请选择'); foreach ($item_props as $item_prop) { $props[$item_prop->prop_id] = $item_prop->prop_name; } $this->render('create', array('model' => $model, 'props' => $props)); }