public static function defaultValues($user_id) { $tarief = new UserTarieven(); $tarief->user_id = $user_id; $tarief->naam = 'Dagdienst'; $tarief->omschrijving = 'Dagdienst'; $tarief->tarief = '0'; $tarief->dag_vanaf = 'Maandag'; $tarief->dag_totenmet = 'Vrijdag'; $tarief->tijd_vanaf = '06:00'; $tarief->tijd_tot = '23:00'; $tarief->tarief_eenheid = 'Uur'; $tarief->save(false); $tarief = new UserTarieven(); $tarief->user_id = $user_id; $tarief->naam = 'Nachtdienst'; $tarief->omschrijving = 'Nachtdienst'; $tarief->tarief = '0'; $tarief->dag_vanaf = 'Maandag'; $tarief->dag_totenmet = 'Vrijdag'; $tarief->tijd_vanaf = '23:00'; $tarief->tijd_tot = '06:00'; $tarief->tarief_eenheid = 'Uur'; $tarief->save(false); $tarief = new UserTarieven(); $tarief->user_id = $user_id; $tarief->naam = 'Weekenddienst'; $tarief->omschrijving = 'Weekenddienst'; $tarief->tarief = '0'; $tarief->dag_vanaf = 'Vrijdag'; $tarief->dag_totenmet = 'Maandag'; $tarief->tijd_vanaf = '17:00'; $tarief->tijd_tot = '06:00'; $tarief->tarief_eenheid = 'Uur'; $tarief->save(false); return true; }
public function search($params) { $query = UserTarieven::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['omschrijving' => $this->omschrijving, 'tarief' => $this->tarief, 'naam' => $this->naam, 'dag_vanaf' => $this->dag_vanaf, 'dag_totenmet' => $this->dag_totenmet, 'tarief_eenheid' => $this->tarief_eenheid, 'tijd_vanaf' => $this->tijd_vanaf, 'tijd_tot' => $this->tijd_tot]); // $query->andFilterWhere(['like', 'description', $this->description]) // ->andFilterWhere(['like', 'name', $this->name]); return $dataProvider; }
/** * Deletes an existing UserCv model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed */ public function actionDelete($id) { $model = $this->findModel($id); $user = User::findOne(['id' => $model->user_id]); $profile = Profile::findOne(['user_id' => $model->user_id]); $userabonnement = UserAbonnement::findOne(['user_id' => $model->user_id]); UserActivedays::deleteAll(['user_id' => $model->user_id]); $profile->delete(); $usertarieven = UserTarieven::deleteAll(['user_id' => $model->user_id]); UserReistarief::deleteAll(['user_id' => $model->user_id]); if ($userabonnement) { $userabonnement->delete(); } $model->delete(); $user->delete(); return $this->redirect(['index']); }
</div> <div class="panel-body"> <?php echo Form::widget(['model' => $tarievenNacht, 'form' => $form, 'columns' => 6, 'attributes' => ['tijd_vanaf' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => UserTarieven::timeDropdown('07:00')], 'tijd_tot' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => UserTarieven::timeDropdown('17:00')], 'dag_vanaf' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => UserTarieven::daysDropdown('Maandag')], 'dag_totenmet' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => UserTarieven::daysDropdown('Vrijdag')], 'tarief' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => '0']], 'tarief_eenheid' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => UserTarieven::eenheidDropdown()]]]); ?> </div> </div> <div class="panel panel-warning"> <div class="panel-heading"> <h3 class="panel-title">Weekenddienst</h3> </div> <div class="panel-body"> <?php echo Form::widget(['model' => $tarievenWeekend, 'form' => $form, 'columns' => 6, 'attributes' => ['tijd_vanaf' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => UserTarieven::timeDropdown('07:00')], 'tijd_tot' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => UserTarieven::timeDropdown('17:00')], 'dag_vanaf' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => UserTarieven::daysDropdown('Maandag')], 'dag_totenmet' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => UserTarieven::daysDropdown('Vrijdag')], 'tarief' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => '0']], 'tarief_eenheid' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => UserTarieven::eenheidDropdown()]]]); ?> </div> </div> <!--END tarief -------------------------------------------> </div> </div> </div> <!--START tariefReizen ------------------------------------------> <div class="panel panel-primary"> <div class="panel-heading" role="tab" id="headingFive"> <h4 class="panel-title"> <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseFive" aria-expanded="false" aria-controls="collapseFive"> Algemeen reis tarief
/** * Display registration page * input parameter $i is bedoeld om onderscheid te maken in abbonementstype aanbieding */ public function actionRegister($i = '') { $user = Yii::$app->getModule("user")->model("User", ["scenario" => "register"]); $profile = Yii::$app->getModule("user")->model("Profile"); $company = Yii::$app->getModule("user")->model("Company"); $userabonnement = Yii::$app->getModule("user")->model("UserAbonnement"); $abonnementstype = $i; //controleer of het abonnementype bestaat if (($abonnementstypeMdl = Abonnement::findOne($abonnementstype)) === null) { $abonnementstypeMdl = null; } // load post data $post = Yii::$app->request->post(); if ($user->load($post)) { // ensure profile data gets loaded $profile->load($post); $company->load($post); $userabonnement->load($post); // validate for ajax request if (Yii::$app->request->isAjax) { Yii::$app->response->format = Response::FORMAT_JSON; return ActiveForm::validate($user, $profile, $company, $userabonnement); } // validate for normal request if ($user->validate() && $profile->validate() && $company->validate() && $userabonnement->validate()) { // perform registration $role = Yii::$app->getModule("user")->model("Role"); //DE rol contactpersoon wordt gezet $user->setRegisterAttributes($role::ROLE_CONTACTPERSON, Yii::$app->request->userIP)->save(false); $profile->setUser($user->id)->save(false); $company->setUser($user->id)->save(false); $user->company_id = $company->id; $userabonnement->user_id = $user->id; $userabonnement->newAbonnement(); $userabonnement->save(false); $user->save(true); //set de standaard tarieven bij registratie UserTarieven::defaultValues($user->id); $userreistarief = new UserReistarief(); $userreistarief->user_id = $user->id; $userreistarief->setDefaultValues(); $userreistarief->save(false); $this->afterRegister($user); // set flash // don't use $this->refresh() because user may automatically be logged in and get 403 forbidden $successText = Yii::t("user", "Successvol geregistreerd [ {displayName} ]", ["displayName" => $user->getDisplayName()]); $guestText = ""; if (Yii::$app->user->isGuest) { $guestText = Yii::t("user", " - Controleer nu uw E-mail om u account te bevestigen"); } Yii::$app->session->setFlash("Register-success", $successText . $guestText); } } // render return $this->render("register", ['user' => $user, 'profile' => $profile, 'company' => $company, 'userabonnement' => $userabonnement, 'abonnementstypeMdl' => $abonnementstypeMdl]); }
</div> <div class="panel-body"> <?= Form::widget([ 'model'=>$tarievenWeekend, 'form'=>$form, 'columns'=>6, 'attributes'=>[ // 2 column layout 'tijd_vanaf'=>['type'=>Form::INPUT_DROPDOWN_LIST, 'items'=>UserTarieven::timeDropdown('17:00')], 'tijd_tot'=>['type'=>Form::INPUT_DROPDOWN_LIST, 'items'=>UserTarieven::timeDropdown('06:00')], 'dag_vanaf'=>['type'=>Form::INPUT_DROPDOWN_LIST, 'items'=>UserTarieven::daysDropdown('Vrijdag')], 'dag_totenmet'=>['type'=>Form::INPUT_DROPDOWN_LIST, 'items'=>UserTarieven::daysDropdown('Maandag')], 'tarief'=>['type'=>Form::INPUT_TEXT, 'options'=>['placeholder'=>'0']], 'tarief_eenheid'=>['type'=>Form::INPUT_DROPDOWN_LIST, 'items'=>UserTarieven::eenheidDropdown()], ] ]); ?> </div> </div> </div> <!-- EIND tarieven-------------------------------------------------------------> <!-- START bijzonderheden-------------------------------------------------------------> <?= $form->field($model, 'bijzonderheden')->widget(CKEditor::className(), [ 'options' => ['rows' => 3],
/** * Vervewijder alle werknemers die gelieerd zijn aan een company * **/ public function deleteDependentUsers($user) { $depUsers = Yii::$app->getModule("user")->model("User"); $depUsers = User::findAll(['company_id' => $user->company_id]); if ($depUsers) { foreach ($depUsers as $depUser) { //$reistarief = UserReistarief::findAll(['user_id'=>$depUser->id]); UserReistarief::deleteAll(['user_id' => $depUser->id]); //$tarief = UserTarieven::findAll(['user_id'=>$depUser->id]); UserTarieven::deleteAll(['user_id' => $depUser->id]); //$cv = UserCv::findAll(['user_id'=>$depUser->id]); UserCv::deleteAll(['user_id' => $depUser->id]); //$ce = CalendarEvents::find()->where(['user_id'=>$depUser->id])->all; CalendarEvents::deleteAll(['user_id' => $depUser->id]); //$cd = ContractDeals::find()->where(['user_id'=>$depUser->id])->all; ContractDeals::deleteAll(['user_id' => $depUser->id]); Profile::deleteAll(['user_id' => $depUser->id]); } } }