/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Formats(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Formats'])) { $model->attributes = $_POST['Formats']; //echo $_POST['attachments']; //exit; $fileids = explode(",", $_POST['attachments']); $model->formatfile_id = $fileids[1]; // echo print_r($_POST); if ($model->save()) { foreach ($_POST['assigned'] as $i => $y) { //echo $y."\n"; $z = new Usertasks(); $z->designation_id = $y; $z->scheme_id = $model->schemeid; $z->task_type = "Formats"; $z->task_id = $model->id; $z->status = 0; //echo print_r($z); //exit; $z->save(); } //$this->redirect(array('view','id'=>$model->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 Usertasks(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Usertasks'])) { $model->attributes = $_POST['Usertasks']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }