public static function updateEventFromDialog($eventid, $codetitle, $title, $color) { //at update a $POST is coming in here $modelEvent = CalendarEvents::findOne($eventid); if ($modelEvent) { $modelEvent->title = $title; $modelEvent->color = $color; $modelEvent->code_title = $codetitle; $modelEvent->save(false); } }
/** * Finds the CalendarEvents model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return CalendarEvents the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { $model = null; $model = CalendarEvents::findOne($id); return $model; }
/** * Finds the CalendarEvents model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return CalendarEvents the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = CalendarEvents::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * 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]); } } }