/** * Creates a new Pendingdoc model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Pendingdoc(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
public function actionRelease($id) { $model = $this->findModel($id); $workflowid = ArrayHelper::getValue(Docworkflow::find()->where(['document_id' => $id])->orderBy(['id' => SORT_DESC])->one(), 'id'); //print_r($workflowid . ' level0 ' . $model->user_id); if ($model->load(Yii::$app->request->post())) { //$userid1 = ArrayHelper::getValue(User::find()->where(['username' => Yii::$app->user->identity->username])->one(), 'id'); $sectionid = ArrayHelper::getValue(Document::find()->where(['id' => $id])->one(), 'section_id'); $userFName = ArrayHelper::getValue(User::find()->where(['id' => $model->user_id])->one(), 'userFName'); $userLName = ArrayHelper::getValue(User::find()->where(['id' => $model->user_id])->one(), 'userLName'); $section = ArrayHelper::getValue(Section::find()->where(['id' => $sectionid])->one(), 'sectionName'); $documentname = ArrayHelper::getValue(Document::find()->where(['id' => $id])->one(), 'documentName'); $pendingdoc = new Pendingdoc(); $pendingdoc->pendingDocFName = $userLName . ', ' . $userFName; $pendingdoc->pendingDocSection = $section; $pendingdoc->pendingDocName = $documentname; if ($workflowid == null) { if ($pendingdoc->save()) { print_r('level3'); return $this->redirect(['index']); //return $this->redirect('index.php?r=pendingdoc'); } } else { $workflow1 = new Docworkflow(); $workflow1 = $this->findModelWorkflow($workflowid); //$workflow1->id = $workflowid; $workflow1->timeRelease = date('Y-m-d H:i:s'); //$workflow1->totalTimeSpent = date('Y-m-d H:i:s'); $workflow1->user_release = $model->user_id; print_r('level1'); if ($workflow1->save()) { print_r('level2'); if ($pendingdoc->save()) { print_r('level3'); return $this->redirect(['index']); //return $this->redirect('index.php?r=pendingdoc'); } } } } else { return $this->renderAjax('release', ['model' => $model]); } }
public function actionRelease($id) { //$model = $this->findModel($id); $model = new Pendingdoc(); $userid = ArrayHelper::getValue(Document::find()->where(['id' => $id])->one(), 'user_id'); $userFName = ArrayHelper::getValue(User::find()->where(['id' => $userid])->one(), 'userFName'); $userLName = ArrayHelper::getValue(User::find()->where(['id' => $userid])->one(), 'userLName'); $section = ArrayHelper::getValue(Document::find()->where(['id' => $id])->one(), 'section_id'); $documentname = ArrayHelper::getValue(Document::find()->where(['id' => $id])->one(), 'documentName'); if ($model->load(Yii::$app->request->post())) { $model->pendingDocFName = $userFName . $userLName; $model->pendingDocSection = $section; $model->pendingDocName = $documentname; if ($model->save()) { return $this->redirect(['document/index']); } } else { return $this->renderAjax('release', ['model' => $model]); } }