/**
  * Creates a new File model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new File();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->file_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 /**
  * 
  * @param Model $step
  * @param integer $project_id
  * @param integer $uid
  * @return string $comments
  */
 private function saveFunctionalities($step, $project_id, $uid)
 {
     $comment = '';
     foreach ($step->attributes as $key => $attribute) {
         if (!empty($attribute)) {
             if ($key == 'comment') {
                 $comment = $attribute;
             } else {
                 $bidpart = BidPart::find()->where(['attribute_name' => $key])->one();
                 if ($bidpart->file_upload) {
                     $file = new File();
                     $file->name = $attribute->baseName . '.' . $attribute->extension;
                     $file->description = $bidpart->description;
                     $file->project_id = $project_id;
                     $file->todo_id = null;
                     $file->deleted = 0;
                     $file->creator_id = $uid;
                     $file->updater_id = $uid;
                     $file->save();
                     rename($this->tempFileLocation . $file->name, $this->permFileLocation . $project_id . '/' . $file->name);
                 } else {
                     $functionality = new Functionality();
                     $functionality->name = $bidpart->name;
                     $functionality->description = $attribute;
                     $functionality->project_id = $project_id;
                     $functionality->deleted = 0;
                     $functionality->amount = 1;
                     $functionality->price = $bidpart->price;
                     $functionality->creator_id = $uid;
                     $functionality->updater_id = $uid;
                     $functionality->monthly_costs = $bidpart->monthly_costs;
                     $functionality->save(false);
                 }
             }
         }
     }
     return $comment;
 }