public function actionAcceptReceivedSchedule($id) { $scheduleNotify = ScheduleNotification::findOne(['id' => $id]); $schedule = Schedule::findOne(['id' => $scheduleNotify['schedule_id']]); $newSchedule = new Schedule(); $newSchedule['title'] = $schedule['title']; $newSchedule['color'] = $schedule['color']; $newSchedule['start'] = $schedule['start']; $newSchedule['end'] = $schedule['end']; $newSchedule['create_at'] = $schedule['create_at']; $newSchedule['own_id'] = \Yii::$app->user->getId(); $newSchedule->save(); ScheduleNotification::deleteAll(['id' => $id]); $this->redirect('?r=schedule/create-event'); }
/** * Finds the Schedule model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Schedule the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Schedule::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
<?php /** * Created by PhpStorm. * User: Nguyen * Date: 12/1/2015 * Time: 10:15 PM */ $schedule = \common\models\Schedule::findOne(['id' => $model['schedule_id']]); $actionUser = \common\models\User::findOne(['id' => $model['action_id']]); ?> <div class="row"> <div class="col-md-2"> </div> <div class="col-md-8"> <div class="box box-info"> <div class="box-header with-border"> <h3 class="box-title"><?php if ($actionUser['fullname'] != '') { echo $actionUser['fullname']; } else { echo $actionUser['username']; } ?> </h3> </div><!-- /.box-header --> <!-- form start --> <div class="box-body"> <p> <?php