Skip to content

Commit

Permalink
Update FieldController.php
Browse files Browse the repository at this point in the history
  • Loading branch information
maks757 committed May 30, 2017
1 parent 6aca805 commit b219332
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions controllers/FieldController.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ public function actionCreateImage($id = null, $article_id = null, $languageId =
}

if($request->isPost){
$fields = Yii2DataArticle::findOne($article_id)->getField($languageId);
$field_end_position = Yii2DataArticle::findOne($article_id)->getEndPositionFromFields();
$model_image->imageFile = UploadedFile::getInstance($model_image, 'imageFile');

$model->load($request->post());
if($image = $model_image->upload())
$model->image = $image;
$model->article_id = $article_id;
if(!is_integer($model->position))
$model->position = $fields[count($fields) - 1]['position'] + 1;
$model->position = $field_end_position + 1;
$model->save();

$model_translation->load($request->post());
Expand Down Expand Up @@ -191,11 +191,11 @@ public function actionCreateSlider($id = null, $article_id = null, $languageId =
}

if($request->isPost){
$fields = Yii2DataArticle::findOne($article_id)->getField($languageId);
$field_end_position = Yii2DataArticle::findOne($article_id)->getEndPositionFromFields();
$model->load($request->post());
$model->article_id = $article_id;
if(!is_integer($model->position))
$model->position = $fields[count($fields) - 1]['position'] + 1;
$model->position = $field_end_position + 1;
$model->save();

$model_translation->load($request->post());
Expand Down Expand Up @@ -241,4 +241,4 @@ public function actionSliderDelete($id)
return $this->redirect(\Yii::$app->request->referrer);
}
//</editor-fold>
}
}

0 comments on commit b219332

Please sign in to comment.