/** * Finds the BidPart model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return BidPart the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = BidPart::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Notify the admin that a registration has been made */ public function actionMailOverview($id = 1, $info = false) { $oneOffDataProvider = BidPart::find()->where(['attribute_name' => 'oneoff_costs'])->one(); $monthlyDataProvider = BidPart::find()->where(['attribute_name' => 'monthly_costs'])->one(); if ($info) { var_dump(['to' => Yii::$app->params['infoEmail'], 'cc' => '', 'bcc' => ['*****@*****.**', '*****@*****.**'], 'from' => [Yii::$app->params['infoEmail'] => 'De Lauwer'], 'subject' => Yii::t('registration', 'New registration notification')]); } $this->layout = '@common/mail/layouts/html'; return $this->render('@common/mail/overviewMail-html', ['oneOffDataProvider' => $oneOffDataProvider, 'monthlyDataProvider' => $monthlyDataProvider]); }
<li><span>Stap 6</span><?php echo Html::a(Yii::t('request-project', 'Overview'), ['/request-project/overview']); ?> </li> </ul> <div class="col-sm-6"> <div class="row"> <div class="block"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'informatie')->textInput()->label(BidPart::find()->where(['attribute_name' => 'informatie'])->one()->getLabel()); ?> <?php echo $form->field($model, 'comment')->textArea(); ?> <?php echo Html::a(Yii::t('common', 'Last step'), ['step-3'], ['class' => 'btn btn-primary']); ?> <?php echo Html::submitButton(Yii::t('common', 'Next step'), ['class' => 'btn btn-primary']); ?> <?php ActiveForm::end();
/** * * @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; }
/** * @return \yii\db\ActiveQuery */ public function getBidParts() { return $this->hasMany(BidPart::className(), ['bid_category_id' => 'id']); }