public function actionFocus($id) { $model = new StudentTeacher(); $model->student_id = $this->_user['studentId']; $model->teacher_id = $id; $model->save(); $this->redirect($this->createUrl('/teacher/view', array('id' => $id))); }
public function actionFocus($id) { //echo "$id"; //print_r($this->_user); $model = new StudentTeacher(); $model->student_id = $this->_user['studentId']; $model->teacher_id = $id; $model->save(); $this->redirect('index'); //print_r($model ); //exit; }
public function actionReview() { $message = false; $lesson = Lesson::model()->findByPk($_GET['id']); $model = StudentTeacher::model()->findByAttributes(array('student_id' => $this->_user['studentId'], 'teacher_id' => $lesson['teacher_id'])); if (!count($model)) { $model = new StudentTeacher(); } if (isset($_POST['StudentTeacher'])) { $model->attributes = $_POST['StudentTeacher']; $model->student_id = $this->_user['studentId']; $model->teacher_id = $lesson['teacher_id']; if ($model->save()) { $message = true; } } $this->render('review', array('lesson' => $lesson, 'message' => $message, 'model' => $model)); }